Index: doc/index.html
===================================================================
diff -u -rdb31aba05701517b161d7633e64d5af925358ee0 -r3142818cb17b21de68aa1898a4a5e25f4c13f921
--- doc/index.html	(.../index.html)	(revision db31aba05701517b161d7633e64d5af925358ee0)
+++ doc/index.html	(.../index.html)	(revision 3142818cb17b21de68aa1898a4a5e25f4c13f921)
@@ -23,7 +23,7 @@
 </center>
 
   <ul>
-    <li> <b>Directory './library/lib': </b><br><a HREF="./Script-xotcl.html">Script.xotcl</a>, <a HREF="./doc-tools-xotcl.html">doc-tools.xotcl</a>, <a HREF="./htmllib-xotcl.html">htmllib.xotcl</a>, <a HREF="./make-xotcl.html">make.xotcl</a>, <a HREF="./makeDoc-xotcl.html">makeDoc.xotcl</a>, <a HREF="./metadataAnalyzer-xotcl.html">metadataAnalyzer.xotcl</a>, <a HREF="./mixinStrategy-xotcl.html">mixinStrategy.xotcl</a>, <a HREF="./package-xotcl.html">package.xotcl</a>, <a HREF="./staticMetadata-xotcl.html">staticMetadata.xotcl</a>, <a HREF="./test-xotcl.html">test.xotcl</a>, <a HREF="./trace-xotcl.html">trace.xotcl</a>, <a HREF="./upvarcompat-xotcl.html">upvarcompat.xotcl</a>, <a HREF="./xodoc-xotcl.html">xodoc.xotcl</a>, <a HREF="./xotcl1-xotcl.html">xotcl1.xotcl</a><li> <b>Directory './library/store': </b><br><a HREF="./JufGdbmStorage-xotcl.html">JufGdbmStorage.xotcl</a>, <a HREF="./MemStorage-xotcl.html">MemStorage.xotcl</a>, <a HREF="./MultiStorage-xotcl.html">MultiStorage.xotcl</a>, <a HREF="./Persistence-xotcl.html">Persistence.xotcl</a>, <a HREF="./Storage-xotcl.html">Storage.xotcl</a>, <a HREF="./TclGdbmStorage-xotcl.html">TclGdbmStorage.xotcl</a>, <a HREF="./TextFileStorage-xotcl.html">TextFileStorage.xotcl</a>, <a HREF="./persistenceExample-xotcl.html">persistenceExample.xotcl</a><li> <b>Directory './library/serialize': </b><br><a HREF="./Serializer-xotcl.html">Serializer.xotcl</a><li> <b>Directory './tests': </b><br><a HREF="./12-xotcl.html">12.xotcl</a>, <a HREF="./aliastest-xotcl.html">aliastest.xotcl</a>, <a HREF="./destroytest-xotcl.html">destroytest.xotcl</a>, <a HREF="./forwardtest-xotcl.html">forwardtest.xotcl</a>, <a HREF="./info-method-xotcl.html">info-method.xotcl</a>, <a HREF="./interceptor-slot-xotcl.html">interceptor-slot.xotcl</a>, <a HREF="./method-modifiers-xotcl.html">method-modifiers.xotcl</a>, <a HREF="./mix-xotcl.html">mix.xotcl</a>, <a HREF="./mixinoftest-xotcl.html">mixinoftest.xotcl</a>, <a HREF="./o2-xotcl.html">o2.xotcl</a>, <a HREF="./object-system-xotcl.html">object-system.xotcl</a>, <a HREF="./parameters-xotcl.html">parameters.xotcl</a>, <a HREF="./protected-xotcl.html">protected.xotcl</a>, <a HREF="./slottest-xotcl.html">slottest.xotcl</a>, <a HREF="./speedtest-xotcl.html">speedtest.xotcl</a>, <a HREF="./stack-xotcl.html">stack.xotcl</a>, <a HREF="./testo-xotcl.html">testo.xotcl</a>, <a HREF="./testx-xotcl.html">testx.xotcl</a>, <a HREF="./var-xotcl.html">var.xotcl</a>, <a HREF="./varresolutiontest-xotcl.html">varresolutiontest.xotcl</a><li> <b>Directory './apps/scripts': </b><br><a HREF="./adapter-xotcl.html">adapter.xotcl</a>, <a HREF="./adapterExample-xotcl.html">adapterExample.xotcl</a>, <a HREF="./composite-xotcl.html">composite.xotcl</a>, <a HREF="./compositeExample-xotcl.html">compositeExample.xotcl</a>, <a HREF="./observer-xotcl.html">observer.xotcl</a>, <a HREF="./parameter-xotcl.html">parameter.xotcl</a>, <a HREF="./pinger-xotcl.html">pinger.xotcl</a>, <a HREF="./simpleFilters-xotcl.html">simpleFilters.xotcl</a>, <a HREF="./soccerClub-xotcl.html">soccerClub.xotcl</a>, <a HREF="./soccerClub2-xotcl.html">soccerClub2.xotcl</a><li> <b>Directory './apps/comm': </b><br><a HREF="./ftp-xotcl.html">ftp.xotcl</a>, <a HREF="./link-checker-xotcl.html">link-checker.xotcl</a>, <a HREF="./secure-webclient-xotcl.html">secure-webclient.xotcl</a>, <a HREF="./secure-webserver-xotcl.html">secure-webserver.xotcl</a>, <a HREF="./webclient-xotcl.html">webclient.xotcl</a>, <a HREF="./webserver-xotcl.html">webserver.xotcl</a><li> <b>Directory './apps/actiweb/univ': </b><br><a HREF="./UNIVERSAL-xotcl.html">UNIVERSAL.xotcl</a><li> <b>Directory './apps/utils': </b><br><a HREF="./xo-daemon.html">xo-daemon</a>, <a HREF="./xo-whichPkg.html">xo-whichPkg</a>
+    <li> <b>Directory './library/lib': </b><br><a HREF="./Script-xotcl.html">Script.xotcl</a>, <a HREF="./doc-tools-xotcl.html">doc-tools.xotcl</a>, <a HREF="./htmllib-xotcl.html">htmllib.xotcl</a>, <a HREF="./make-xotcl.html">make.xotcl</a>, <a HREF="./makeDoc-xotcl.html">makeDoc.xotcl</a>, <a HREF="./metadataAnalyzer-xotcl.html">metadataAnalyzer.xotcl</a>, <a HREF="./mixinStrategy-xotcl.html">mixinStrategy.xotcl</a>, <a HREF="./package-xotcl.html">package.xotcl</a>, <a HREF="./staticMetadata-xotcl.html">staticMetadata.xotcl</a>, <a HREF="./test-xotcl.html">test.xotcl</a>, <a HREF="./trace-xotcl.html">trace.xotcl</a>, <a HREF="./upvarcompat-xotcl.html">upvarcompat.xotcl</a>, <a HREF="./xodoc-xotcl.html">xodoc.xotcl</a>, <a HREF="./xotcl1-xotcl.html">xotcl1.xotcl</a><li> <b>Directory './library/store': </b><br><a HREF="./JufGdbmStorage-xotcl.html">JufGdbmStorage.xotcl</a>, <a HREF="./MemStorage-xotcl.html">MemStorage.xotcl</a>, <a HREF="./MultiStorage-xotcl.html">MultiStorage.xotcl</a>, <a HREF="./Persistence-xotcl.html">Persistence.xotcl</a>, <a HREF="./Storage-xotcl.html">Storage.xotcl</a>, <a HREF="./TclGdbmStorage-xotcl.html">TclGdbmStorage.xotcl</a>, <a HREF="./TextFileStorage-xotcl.html">TextFileStorage.xotcl</a>, <a HREF="./persistenceExample-xotcl.html">persistenceExample.xotcl</a><li> <b>Directory './library/serialize': </b><br><a HREF="./Serializer-xotcl.html">Serializer.xotcl</a><li> <b>Directory './tests': </b><br><a HREF="./aliastest-xotcl.html">aliastest.xotcl</a>, <a HREF="./destroytest-xotcl.html">destroytest.xotcl</a>, <a HREF="./forwardtest-xotcl.html">forwardtest.xotcl</a>, <a HREF="./info-method-xotcl.html">info-method.xotcl</a>, <a HREF="./interceptor-slot-xotcl.html">interceptor-slot.xotcl</a>, <a HREF="./method-modifiers-xotcl.html">method-modifiers.xotcl</a>, <a HREF="./mixinoftest-xotcl.html">mixinoftest.xotcl</a>, <a HREF="./object-system-xotcl.html">object-system.xotcl</a>, <a HREF="./parameters-xotcl.html">parameters.xotcl</a>, <a HREF="./protected-xotcl.html">protected.xotcl</a>, <a HREF="./slottest-xotcl.html">slottest.xotcl</a>, <a HREF="./speedtest-xotcl.html">speedtest.xotcl</a>, <a HREF="./testo-xotcl.html">testo.xotcl</a>, <a HREF="./testx-xotcl.html">testx.xotcl</a>, <a HREF="./varresolutiontest-xotcl.html">varresolutiontest.xotcl</a><li> <b>Directory './apps/scripts': </b><br><a HREF="./adapter-xotcl.html">adapter.xotcl</a>, <a HREF="./adapterExample-xotcl.html">adapterExample.xotcl</a>, <a HREF="./composite-xotcl.html">composite.xotcl</a>, <a HREF="./compositeExample-xotcl.html">compositeExample.xotcl</a>, <a HREF="./observer-xotcl.html">observer.xotcl</a>, <a HREF="./parameter-xotcl.html">parameter.xotcl</a>, <a HREF="./pinger-xotcl.html">pinger.xotcl</a>, <a HREF="./simpleFilters-xotcl.html">simpleFilters.xotcl</a>, <a HREF="./soccerClub-xotcl.html">soccerClub.xotcl</a>, <a HREF="./soccerClub2-xotcl.html">soccerClub2.xotcl</a><li> <b>Directory './apps/comm': </b><br><a HREF="./ftp-xotcl.html">ftp.xotcl</a>, <a HREF="./link-checker-xotcl.html">link-checker.xotcl</a>, <a HREF="./secure-webclient-xotcl.html">secure-webclient.xotcl</a>, <a HREF="./secure-webserver-xotcl.html">secure-webserver.xotcl</a>, <a HREF="./webclient-xotcl.html">webclient.xotcl</a>, <a HREF="./webserver-xotcl.html">webserver.xotcl</a><li> <b>Directory './apps/actiweb/univ': </b><br><a HREF="./UNIVERSAL-xotcl.html">UNIVERSAL.xotcl</a><li> <b>Directory './apps/utils': </b><br><a HREF="./xo-daemon.html">xo-daemon</a>, <a HREF="./xo-whichPkg.html">xo-whichPkg</a>
   </ul>
   <p>
 
Index: library/lib/doc-tools.xotcl
===================================================================
diff -u -rdb31aba05701517b161d7633e64d5af925358ee0 -r3142818cb17b21de68aa1898a4a5e25f4c13f921
--- library/lib/doc-tools.xotcl	(.../doc-tools.xotcl)	(revision db31aba05701517b161d7633e64d5af925358ee0)
+++ library/lib/doc-tools.xotcl	(.../doc-tools.xotcl)	(revision 3142818cb17b21de68aa1898a4a5e25f4c13f921)
@@ -1,8 +1,8 @@
-package provide xotcl::doc-tools 0.1
-package require XOTcl
+package provide next::doc 0.1
+package require next
 
 #
-# Study for documentation classes for XOTcl2.
+# Study for documentation classes for Next.
 # 
 # Compared to the "old" @ docmentation effort, this is a rather
 # light-weight structure based on xotcl 2 language features. The
@@ -23,9 +23,8 @@
 # are available).
 #
 
-namespace eval ::xodoc {}
-namespace eval ::xodoc-tools {
-  ::xotcl::use xotcl2
+namespace eval ::next::doc {
+  namespace import -force ::next::*
 
   #
   # A few helper commands:
@@ -42,13 +41,24 @@
     return $result
   }
 
-  Class create DocClass -superclass Class {
+  Class create EntityFactory -superclass Class {
     #
-    # DocClass is a meta class for named doc entities
+    # EntityFactory is a meta-class for named doc entities
     #
+
+    :attribute tag:required
+
+    namespace eval ::next::doc::entities {}
+    set :root_namespace ::next::doc::entities
+
+    :method init {} {
+      next
+      [:info class] eval set :tags([:tag]) [self]
+    }
+
     :method createOrConfigure {id arguments} {
       namespace eval $id {}
-      if {[::xotcl::objectproperty $id object]} {
+      if {[::next::core::objectproperty $id object]} {
 	$id configure {*}$arguments
       } else {
 	:create $id {*}$arguments
@@ -57,12 +67,12 @@
   }
 
 
-  Class create docEntity {
+  Class create Entity {
     #
-    # docEntity is the base class for the documentation classes
+    # Entity is the base class for the documentation classes
     #
 
-    # every docEntity must be created with a "doc" value and can have
+    # every Entity must be created with a "doc" value and can have
     # an optional initcmd 
     :method objectparameter args {next {doc __initcmd:initcmd,optional}}
 
@@ -79,11 +89,11 @@
     :method _doc {doc use what value} {
       if {$doc ne ""} {return $doc}
       if {$use ne ""} {
-	foreach thing {xotclCmd xotclClass} {
+	foreach thing {NextCommand NextClass} {
 	  set docobj [$thing id $use]
-	  if {[::xotcl::objectproperty $docobj object]} break
+	  if {[::next::core::objectproperty $docobj object]} break
 	}
-	if {[::xotcl::objectproperty $docobj object]} {
+	if {[::next::core::objectproperty $docobj object]} {
 	  if {![$docobj exists $what]} {error "no attribute $what in $docobj"}
 	  set names [list]
 	  foreach v [$docobj $what] {
@@ -96,6 +106,14 @@
 	}
       }
     }
+
+    # @method process
+    #
+    # This is an abstract hook method to be refined by the subclasses
+    # of Entity
+    :method process {comment_block} {
+      error "Implement '[::next::core::current method]()' for the class '[:info class]'"
+    }
     
     # @method param
     #
@@ -115,7 +133,7 @@
 	lappend flags -spec $spec
       }
       lappend flags -fullname param
-      @ xotclCmdParam $name -partof [self] {*}$flags [:_doc $doc $use params $name]
+      @ NextCommand::Parameter $name -partof [self] {*}$flags [:_doc $doc $use params $name]
     }
 
     # @method variant
@@ -125,38 +143,85 @@
     # completely different. A typical case are subcommands in Tcl.
     #
     :method variant {name doc {-use ""}} {
-      @ xotclCmdVariant $name -partof [self] [:_doc $doc $use variants $name]
+      @ NextCommand::Variant $name -partof [self] [:_doc $doc $use variants $name]
     }
 
     # @method text
     #
-    # text is used to access the content of doc of an docEntity, and
+    # text is used to access the content of doc of an Entity, and
     # performs substitution on it.  The substitution is not essential,
     # but looks for now convenient.
     #
     :method text {} {subst ${:doc}}
   }
 
-  # @class docPart
   #
-  # An docPart is a part of the documentation, defined by a
-  # separate object. Every docPart is associated to another
+  # Now, define some kinds of docEntities. The toplevel docEntities
+  # are named objects in the ::next::doc::entities namespace to ease access to it.
+  #
+  # We define here the following toplevel docEntities (e.g. xotclObject will follow):
+  #  - NextCommand
+  #  - NextObject
+  #
+  # The xotcl methods are defined as Parts.
+  #  - NextMethod
+  #
+
+  EntityFactory create NextCommand \
+      -tag "command" \
+      -superclass Entity {
+	:attribute name
+	:attribute arguments
+	:attribute {returns ""}
+	:object method id {name} {return [[:info class] eval {set :root_namespace}]::cmd::[string trimleft $name :]}
+	:object method new args {
+	  foreach {att value} $args {if {$att eq "-name"} {set name $value}}
+	  :createOrConfigure [:id $name] $args
+	}
+      }
+  
+  EntityFactory create NextClass \
+      -tag "class" \
+      -superclass Entity {
+	:attribute name
+	:attribute {methods:multivalued ""} {set :incremental 1}
+	:object method id {name} {puts stderr ""; return [[:info class] eval {set :root_namespace}]::class::[string trimleft $name :]}
+	:object method new args {
+	  foreach {att value} $args {if {$att eq "-name"} {set name $value}}
+	  :createOrConfigure [:id $name] $args
+	}
+	
+	# @method process
+	# 
+	# This method implements the provided, yet abstract
+	# Entity.process() method.
+	#
+	# @see Entity#process()
+	:method process {comment_block} {
+	  puts stderr "+++ comment_block: $comment_block"
+	}
+      }
+  
+  # @class Part
+  #
+  # A Part is a part of a documentation entity, defined by a
+  # separate object. Every Part is associated to another
   # documentation entity and is identified by a name.
   #
-  Class create docPart -superclass docEntity {
+  Class create Part -superclass Entity {
     #:method objectparameter args {next {doc -use}}
     :attribute name:required
     :attribute partof:required
     :attribute use
   }
 
   #
-  # variant and param are docParts:
+  # variant and param are Parts:
   #
-  Class create xotclCmdVariant -superclass docPart {
+  Class create NextCommand::Variant -superclass Part {
     :method init {} {${:partof} variants add [self] end}
   }
-  Class create xotclCmdParam -superclass docPart {
+  Class create NextCommand::Parameter -superclass Part {
     :attribute param
     :attribute fullname    
     :attribute spec
@@ -166,51 +231,20 @@
 
 
   #
-  # Now, define some kinds of docEntities. The toplevel docEntities
-  # are named objects in the ::xoDoc namespace to ease access to it.
-  #
-  # We define here the following toplevel docEntities (e.g. xotclObject will follow):
-  #  - xotclCmd
-  #  - xotclClass
-  #
-  # The xotcl methods are defined as docParts.
-  #  - xotclMethod
-  #
-
-  DocClass create xotclCmd -superclass docEntity {
-    :attribute name
-    :attribute arguments
-    :attribute {returns ""}
-    :object method id {name} {return ::xodoc::cmd::[string trimleft $name :]}
-    :object method new args {
-      foreach {att value} $args {if {$att eq "-name"} {set name $value}}
-      :createOrConfigure [:id $name] $args
-    }
-  }
-
-  DocClass create xotclClass -superclass docEntity {
-    :attribute name
-    :attribute {methods:multivalued ""} {set :incremental 1}
-    :object method id {name} {return ::xodoc::object::[string trimleft $name :]}
-    :object method new args {
-      foreach {att value} $args {if {$att eq "-name"} {set name $value}}
-      :createOrConfigure [:id $name] $args
-    }
-  }
-
-  #
   # xotclMethod is a named entity, which is part of some other
   # docEntity (a class or an object). We might be able to use the
   # "use" parameter for registered aliases to be able to refer to the 
   # documentation of the original method.
   #
-  DocClass create xotclMethod -superclass docPart {
+  EntityFactory create NextMethod \
+      -tag "method" \
+      -superclass Part {
     :attribute {scope class}
     :attribute {modifier public}
     :attribute arguments
     :attribute {returns ""}
     :object method id {partof scope name} {
-      return ::xodoc::method::[string trimleft $partof :]::${scope}::${name}
+      return [[:info class] eval {set :root_namespace}]::method::[string trimleft $partof :]::${scope}::${name}
     }
 
     :object method new args {
@@ -220,9 +254,9 @@
 	if {$att eq "-scope"}  {set scope  $value}
       }
       if {![info exists scope]} {
-	if {[::xotcl::objectproperty $partof class]} {
+	if {[::next::core::objectproperty $partof class]} {
 	  set scope class
-	} elseif {[::xotcl::objectproperty $partof object]} {
+	} elseif {[::next::core::objectproperty $partof object]} {
 	  set scope object
 	} else {
 	  set scope class
@@ -231,7 +265,7 @@
       :createOrConfigure [:id $partof $scope $name] $args
     }
 
-    :method init {} {[xotclClass id ${:partof}] methods add [self] end}
+    :method init {} {[NextClass id ${:partof}] methods add [self] end}
 
     :method signature {} {
       if {[info exists :arguments]} {
@@ -242,12 +276,14 @@
       }
       set result "obj ${:name} $arguments"
     }
-  }
+  }; # NextMethod
+
+  namespace export EntityFactory NextCommand NextClass NextMethod @
 }
 
 
 
-namespace eval ::xodoc-tools {
+namespace eval ::next::doc {
   
   #
   # Provide a simple HTML renderer. For now, we make our life simple
@@ -321,22 +357,75 @@
 #
 # post processor for initcmds and method bodies
 #
-namespace eval ::xodoc-tools {
+namespace eval ::next {
+  namespace import -force ::next::doc::*
+  Object create doc  {
 
-  Object create postprocessor  {
+    :method log {msg} {
+      puts stderr "[self]->[uplevel 1 [list ::next::core::current proc]]: $msg"
+    }
 
+    # @method process
+    #
+    # There is a major distinction: Is the entity the comment block is
+    # referring to given *extrinsically* (to the comment block) or
+    # *intrinsically* (as a starting tag).
+    # 
+    # a. extrinsic: 'thing' is a valid class or object name
+    # b. intrinsic: 'thing' is a arbitrary string block describing 
+    # a script.
+    # 
     :method process {thing} {
-      if {[::xotcl::objectproperty $thing class]} {
+      # TODO: tcl packages as an option?
+      # 1) in-situ processing: a class object
+      if {[::next::core::objectproperty $thing class]} {
         if {[$thing exists __initcmd]} {
-          :analyze_initcmd xotclClass $thing [$thing eval {set :__initcmd}]
+          :analyze_initcmd NextClass $thing [$thing eval {set :__initcmd}]
         }
-      } elseif {[::xotcl::objectproperty $thing object]} {
-        puts "can't postprocess objects currently"
+      } elseif {[::next::core::objectproperty $thing object]} {
+	# 2) in-situ processing: a non-class object
+	:log "can't postprocess objects currently"
+      } elseif {[file isfile $thing]} {
+	# 3) alien script file
+	if {[file isreadable $thing]} {
+	  set fh [open $thing r]
+	  if {[catch {set script [read $thing]} msg]} {
+	    :log "error reading the file '$thing', i.e.: '$msg'"
+	  }
+	} else {
+	  :log "file '$thing' not readable"
+	}
       } else {
-        puts "no idea how to postprocess $thing"
+	# 4) we assume a string block, e.g., to be fed into eval
+	:analyze $thing
       }
     }
 
+    :method analyze {script} {
+      set blocks [:comment_blocks $script]
+      :log "blocks: '$blocks'"
+      foreach block $blocks {
+	:log "block: '$block'"
+        set analyzed_block [:analyze_comment_block $block]
+        set cb [dict create {*}$analyzed_block]
+	:log ">>>> $cb"
+	#
+	# 1) resolve the entity by tag; e.g.: class -> NextClass
+	#
+	set entity [EntityFactory eval set :tags([dict get $cb entity])]
+	#
+	# 2) provide an object rep of the entity
+	#
+	set entity_instance [@ $entity [dict get $cb [$entity tag]] [dict get $cb text]]
+	#
+	# 3) process entity-specific parts, according to their tags
+	#
+	$entity_instance process $analyzed_block
+      }
+    }
+
+
+
     :method analyze_line {line} {
       if {[regexp {^\s*$} $line]} {
         return 1
@@ -347,6 +436,71 @@
       }
     }
 
+    :method analyze_line {line} {
+      #
+      # 1 ... empty line
+      #
+      if {[regexp {^\s*$} $line]} {
+        return 1
+      } elseif {[regexp {^\s*#\s*@[^[:space:]@]} $line]} {
+	#
+	# 2 ... tagged comment line
+	#
+	return 2
+      } elseif {[regexp {^\s*#\s*[^[:space:]]\s*} $line]} {
+	#
+	# 3 ... untagged, non-emtpy comment line
+	#
+
+        return 3
+      } elseif {[regexp {^\s*#} $line]} {
+	#
+	# 4 ... untagged, empty comment line
+	#
+        return 4
+      } else {
+	#
+	# 5 ... code line
+	#
+        return 5
+      }
+    }
+
+    :method analyze_line {line} {
+      if {[regexp -- {^\s*#+[#\s]*(.*)$} $line --> comment]} {
+	return [list 1 [string trim $comment]]
+      } else {
+	return [list 0 $line]
+      }
+    }
+	 
+
+    :method append_tag {line} {
+      set line [:remove_comment_markup $line]
+      set tag [string trimleft [lindex $line 0] @]
+      return [list $tag [lrange $line 1 end]]
+    }
+    
+    :method comment_blocks {script} {
+      set lines [split $script \n]
+      set comment_blocks [list]
+      set was_comment 0
+      set spec {
+	0,1	{set comment_block [list]; lappend comment_block $text}
+	1,0	{lappend comment_blocks $comment_block}
+	1,1	{lappend comment_block $text}
+	0,0	{}
+      }
+      array set do $spec 
+      foreach line $lines {
+        foreach {is_comment text} [:analyze_line $line] break;
+	eval $do($was_comment,$is_comment)
+	set was_comment $is_comment
+      }
+      return $comment_blocks
+    }
+
+
     :method remove_comment_markup {comment} {
       regsub -all -line {^\s*#} $comment "" comment
       return $comment
@@ -361,9 +515,10 @@
             if {[regexp {^\s*(\S+)\s+(.*)$} $value _ name desc]} {
               set value [list $name $desc]
             } else {
-              puts stderr "invialid param specification $value"
+              puts stderr "invalid param specification $value"
             }
           }
+	  lappend result entity $kind
           lappend result $kind $value
         } else {
           append text $line
@@ -374,54 +529,54 @@
       return $result
     }
 
-    :method comment_blocks {{-mode all} source} {
-      set comment_blocks [list]
-      set lines [split $source \n]
+    # :method comment_blocks {{-mode all} source} {
+    #   set comment_blocks [list]
+    #   set lines [split $source \n]
 
-      # states
-      #   1 empty line
-      #   2 (pseudo) comment
-      #   3 code
+    #   # states
+    #   #   1 empty line
+    #   #   2 (pseudo) comment: tag line (2a) vs. text line (2b)
+    #   #   3 code
 
-      set behaviour(all) {
-        1,1 {} 
-        1,2 {set comment $line\n} 
-        1,3 {} 
-        2,1 {lappend comment_blocks [:remove_comment_markup $comment]} 
-        2,2 {append comment $line\n} 
-        2,3 {lappend comment_blocks [:remove_comment_markup $comment]} 
-        3,1 {} 
-        3,2 {set comment $line\n} 
-        3,3 {}
-      }
-      set behaviour(first) {
-        1,1 {} 
-        1,2 {set comment $line\n} 
-        1,3 {set code 1} 
-        2,1 {if {!$code} {lappend comment_blocks [:remove_comment_markup $comment]}} 
-        2,2 {append comment $line\n} 
-        2,3 {if {!$code} {lappend comment_blocks [:remove_comment_markup $comment]}; set code 1} 
-        3,1 {} 
-        3,2 {set comment $line\n} 
-        3,3 {}
-      }
-      array set actions $behaviour($mode)
-      set state 1
-      set code 0
-      foreach line $lines {
-        set nextstate [:analyze_line $line]
-        eval $actions($state,$nextstate)
-        set state $nextstate
-      }
+    #   set behaviour(all) {
+    #     1,1 {} 
+    #     1,2 {set comment $line\n} 
+    #     1,3 {} 
+    #     2,1 {lappend comment_blocks [:remove_comment_markup $comment]} 
+    #     2,2 {append comment $line\n} 
+    #     2,3 {lappend comment_blocks [:remove_comment_markup $comment]} 
+    #     3,1 {} 
+    #     3,2 {set comment $line\n} 
+    #     3,3 {}
+    #   }
+    #   set behaviour(first) {
+    #     1,1 {} 
+    #     1,2 {set comment $line\n} 
+    #     1,3 {set code 1} 
+    #     2,1 {if {!$code} {lappend comment_blocks [:remove_comment_markup $comment]}} 
+    #     2,2 {append comment $line\n} 
+    #     2,3 {if {!$code} {lappend comment_blocks [:remove_comment_markup $comment]}; set code 1} 
+    #     3,1 {} 
+    #     3,2 {set comment $line\n} 
+    #     3,3 {}
+    #   }
+    #   array set actions $behaviour($mode)
+    #   set state 1
+    #   set code 0
+    #   foreach line $lines {
+    #     set nextstate [:analyze_line $line]
+    #     eval $actions($state,$nextstate)
+    #     set state $nextstate
+    #   }
      
-      return $comment_blocks
-    }
+    #   return $comment_blocks
+    # }
 
     :method analyze_method_block {-methodName -partof -scope -arguments analyzed_block} {
       array set cb $analyzed_block
       
-      @ xotclMethod $methodName -partof $partof -scope $scope $cb(text)
-      set m [xotclMethod id $partof $scope $methodName]
+      @ NextMethod $methodName -partof $partof -scope $scope $cb(text)
+      set m [NextMethod id $partof $scope $methodName]
       set docparams [list]
       foreach {att value} $analyzed_block {
         # we do not handle "use" yet
@@ -492,50 +647,246 @@
 	    [$name object info method body $methodName]
       }
       
-    }
+    }; # ::next::doc object
 
   # activate the recoding of initcmads
-  ::xotcl::configure keepinitcmd true
+  ::next::core::configure keepinitcmd true
   }
 }
 
 #
 # toplevel interface
-#   ::xodoc-tool::make all
-#   ::xodoc-tool::make doc
+#   ::next::doc::make all
+#   ::next::doc::make doc
 #
-namespace eval ::xodoc-tools {
+namespace eval ::next::doc {
 
   Object create make  {
 
-    :method all {{-verbose:switch} {-class ::xotcl2::Class}} {
+    :method all {{-verbose:switch} {-class ::next::Class}} {
       foreach c [$class info instances -closure] {
         if {$verbose} {puts "postprocess $c"}
-        ::xodoc-tools::postprocessor process $c
+        ::next::doc::postprocessor process $c
       }
     }
 
-    :method doc {{-renderer ::xodoc-tools::HTMLrenderer}} {
+    :method doc {{-renderer ::next::doc::HTMLrenderer}} {
 
       # register the HTML renderer for all docEntities.
       
-      docEntity mixin add $renderer
+      Entity mixin add $renderer
 
       puts "<h2>Primitive XOTcl framework commands</h2>\n<UL>"
-      foreach cmd [sorted [xotclCmd info instances] name] {
+      foreach cmd [sorted [NextCommand info instances] name] {
         $cmd renderCmd
       }
       puts "</UL>\n\n"
       
       puts "<h2>XOTcl Classes</h2>\n<UL>"
-      foreach cmd [sorted [xotclClass info instances] name] {
+      foreach cmd [sorted [NextClass info instances] name] {
         $cmd renderClass
       }
       puts "</UL>\n\n"
 
-      docEntity mixin delete $renderer
+      Entity mixin delete $renderer
     }
   }
 
+  #
+  # modal comment block parsing
+  #
+
+  #
+  # contexts are entities
+  #
+  Object create entity {
+    set :processed_part context
+    :method process {comment_block} {
+      set last_line ""
+      foreach line $comment_block {
+	set activity [${:processed_part} transition $line $last_line]
+	puts stderr activity=$activity
+	${:processed_part} signal $activity $line
+	set last_line [${:processed_part} current_comment_line]
+      }
+    }
+  }
+
+  #
+  # Infrastructure for state objects:
+  #
+  # 1. CommentState: a base class for sharing behaviour between atomic
+  # and non-orthogonal super-states; it is widely an intermediate,
+  # abstracted class, providing a refinement protocol for concrete
+  # state subclasses
+  #
+
+  Class create CommentState {
+    
+    :method on_enter {line} {
+      puts stderr [self]->[::next::core::current proc]
+    }
+    
+    :method on_exit {line} { 
+      puts stderr [self]->[::next::core::current proc]
+    }
+
+    :method signal {event line} {;}
+
+    #
+    # activity/event interface
+    #
+
+    :method event=process {line} {;}
+    :method event=close {line} {;}
+    :method event=next {line} {;}
+    :method event=exit {msg} {
+      error $msg
+    }
+  }
+
+  # 2. CommentLines represent atomic states in the parsing state
+  # machinery: tag, text, space
+
+  Class create CommentLine -superclass CommentState {
+    :attribute comment_part; # points to the super-state objects
+    :forward signal {% ${:comment_part} } %proc
+    :method match {line} {;}
+    :method is? {line} {
+      foreach cline [[:info class] info instances] {
+	if {[$cline match $line]} {
+	  return [namespace tail $cline]
+	}
+      }
+    }
+  }
+  
+
+  CommentLine create tag {
+    :method match {line} {
+      set tag [lindex $line 0]
+      return [expr {[string first @ $tag] == 0}]
+    }
+    :method event=process {line} {
+      # 1. is it a valid tag line?
+      set tag [lindex $line 0]
+      # 2. get the tag label, its value, and the remainder text
+      puts stderr tag=[string trimleft @ $tag],value=[lindex $line 1],text=[lrange $line 2 end]
+    }
+  }
+
+  CommentLine create text {
+    :method match {line} {
+      return [regexp -- {[^[:space:]@]+} $line]
+    }
+    :method event=process {line} {
+    
+      puts stderr text=$line
+    }
+
+  }
+
+  CommentLine create space {
+    :method match {line} {
+      return [expr {$line eq {}}]
+    }
+  }
+
+  
+  #
+  # 3. CommentParts represent orthogonal super-states over
+  # CommentLines: context, description, part
+  #
+  
+  Class create CommentPart -superclass CommentState {
+    :attribute current_comment_line:required
+    :attribute comment_line_transitions
+    :attribute next_comment_part; # implements a STATE-OWNED TRANSITION scheme
+
+    :method init {} {
+      ${:current_comment_line} comment_part [self]
+    }
+
+    :method transition {line {source_state ""}} {
+      array set transitions ${:comment_line_transitions}
+      if {$source_state eq ""} {
+	set actual_target_state ${:current_comment_line}
+      } else {
+	set actual_target_state [$source_state is? $line]
+      }
+      
+      puts stderr "+++ info exists transitions(${source_state}->${actual_target_state})"
+      if {![info exists transitions(${source_state}->${actual_target_state})]} {
+	error "Style violation in a [namespace tail [self]] section: A $source_state line is followed by a $actual_target_state line."
+      }
+
+      set :current_comment_line ${actual_target_state}
+      return $transitions(${source_state}->${actual_target_state})
+    }
+
+    :method on_enter {line} {
+      next
+      if {![info exists :current_comment_line]} {
+	set :current_comment_line [:transition $line]
+      }
+	${:current_comment_line} [::next::core::next proc]
+      }
+  
+    :method on_exit {} {
+      ${:current_comment_line} [::next::core::next proc]
+      next
+    }
+
+    :method signal {event line} {
+      :event=$event $line
+      ${:current_comment_line} event=$event $line
+    }
+
+    #
+    # handled events
+    #
+    :method event=next {} {;}
+    
+  }; # CommentPart
+  
+
+  #
+  # the OWNER-DRIVEN TRANSITIONS read as follows:
+  # <current_state>.<event> {<next_state> <activity>}
+  #
+  
+  CommentPart create context \
+      -next_comment_part description \
+      -comment_line_transitions {
+	->tag		process
+	tag->text	process
+	text->text	process
+	text->space	next
+	tag->space	next
+      } \
+      -current_comment_line tag
+
+  
+  CommentPart create description \
+      -next_comment_part part \
+      -comment_line_transitions {
+	->text		process
+	text->text	process
+	text->space	space next
+      } \
+      -current_comment_line text
+  
+  CommentPart create part \
+      -next_comment_part part \
+      -comment_line_transitions {
+	->tag		process
+	tag->text	process
+	text->text	process
+	text->tag	next
+	text->space	next
+	tag->tag	next
+      } \
+      -current_comment_line tag
 }
-puts stderr "Doc Tools loaded: [info command ::xotcl-tools]"
\ No newline at end of file
+
+puts stderr "Doc Tools loaded: [info command ::next::doc]"
\ No newline at end of file
Index: library/lib/pkgIndex.tcl
===================================================================
diff -u -r81c800c8b9cb42ef6743d9b80ac2be5ca211a69a -r3142818cb17b21de68aa1898a4a5e25f4c13f921
--- library/lib/pkgIndex.tcl	(.../pkgIndex.tcl)	(revision 81c800c8b9cb42ef6743d9b80ac2be5ca211a69a)
+++ library/lib/pkgIndex.tcl	(.../pkgIndex.tcl)	(revision 3142818cb17b21de68aa1898a4a5e25f4c13f921)
@@ -9,7 +9,7 @@
 # full path name of this file's directory.
 
 package ifneeded XOTcl 2.0 [list source [file join $dir xotcl1.xotcl]]
-package ifneeded xotcl::doc-tools 0.1 [list source [file join $dir doc-tools.xotcl]]
+package ifneeded next::doc 0.1 [list source [file join $dir doc-tools.xotcl]]
 package ifneeded xotcl::htmllib 0.1 [list source [file join $dir htmllib.xotcl]]
 package ifneeded xotcl::metadataAnalyzer 0.84 [list source [file join $dir metadataAnalyzer.xotcl]]
 package ifneeded xotcl::mixinStrategy 0.9 [list source [file join $dir mixinStrategy.xotcl]]
Index: library/store/XOTclSdbm/Makefile
===================================================================
diff -u -r78e6c23b4195221aba2a75be9e813382d74f20fb -r3142818cb17b21de68aa1898a4a5e25f4c13f921
--- library/store/XOTclSdbm/Makefile	(.../Makefile)	(revision 78e6c23b4195221aba2a75be9e813382d74f20fb)
+++ library/store/XOTclSdbm/Makefile	(.../Makefile)	(revision 3142818cb17b21de68aa1898a4a5e25f4c13f921)
@@ -67,8 +67,8 @@
 SHELL		= /bin/sh
 
 srcdir		= .
-prefix		= /usr/local/ns
-exec_prefix	= /usr/local/ns
+prefix		= /usr/local/tcl-8.5.8
+exec_prefix	= /usr/local/tcl-8.5.8
 
 bindir		= ${exec_prefix}/bin
 libdir		= ${exec_prefix}/lib
@@ -110,7 +110,7 @@
 SHLIB_LD_FLAGS	= @SHLIB_LD_FLAGS@
 SHLIB_LD_LIBS	= ${LIBS} -L/usr/local/src/tcl8.5.8/unix -ltclstub8.5
 STLIB_LD	= ${AR} cr
-TCL_DEFS	= -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"8.5\" -DPACKAGE_STRING=\"tcl\ 8.5\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DNO_VALUES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_PTHREAD_GET_STACKSIZE_NP=1 -DTCL_THREADS=1 -DTCL_CFGVAL_ENCODING=\"iso8859-1\" -DMODULE_SCOPE=extern\ __attribute__\(\(__visibility__\(\"hidden\"\)\)\) -DMAC_OSX_TCL=1 -DTCL_SHLIB_EXT=\".dylib\" -DTCL_CFG_DEBUG=1 -DTCL_TOMMATH=1 -DMP_PREC=4 -DTCL_WIDE_INT_IS_LONG=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRTOL=1 -DHAVE_WAITPID=1 -DHAVE_GETADDRINFO=1 -DHAVE_GETPWUID_R_5=1 -DHAVE_GETPWUID_R=1 -DHAVE_GETPWNAM_R_5=1 -DHAVE_GETPWNAM_R=1 -DHAVE_GETGRGID_R_5=1 -DHAVE_GETGRGID_R=1 -DHAVE_GETGRNAM_R_5=1 -DHAVE_GETGRNAM_R=1 -DHAVE_MTSAFE_GETHOSTBYNAME=1 -DHAVE_MTSAFE_GETHOSTBYADDR=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_STRUCT_TM_TM_ZONE=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MKTIME=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_STRUCT_STAT_ST_BLKSIZE=1 -DHAVE_ST_BLKSIZE=1 -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DHAVE_CHFLAGS=1 -DHAVE_GETATTRLIST=1 -DHAVE_COPYFILE_H=1 -DHAVE_COPYFILE=1 -DUSE_VFORK=1 -DTCL_DEFAULT_ENCODING=\"utf-8\" -DTCL_LOAD_FROM_MEMORY=1 -DTCL_WIDE_CLICKS=1 -DHAVE_AVAILABILITYMACROS_H=1 -DHAVE_WEAK_IMPORT=1 -D_DARWIN_C_SOURCE=1 -DHAVE_FTS=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1 -DTCL_UNLOAD_DLLS=1 
+TCL_DEFS	= -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"8.5\" -DPACKAGE_STRING=\"tcl\ 8.5\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DNO_VALUES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_PTHREAD_GET_STACKSIZE_NP=1 -DTCL_THREADS=1 -DTCL_CFGVAL_ENCODING=\"iso8859-1\" -DMODULE_SCOPE=extern\ __attribute__\(\(__visibility__\(\"hidden\"\)\)\) -DMAC_OSX_TCL=1 -DHAVE_COREFOUNDATION=1 -DTCL_SHLIB_EXT=\".dylib\" -DTCL_CFG_DEBUG=1 -DTCL_TOMMATH=1 -DMP_PREC=4 -DTCL_WIDE_INT_IS_LONG=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRTOL=1 -DHAVE_WAITPID=1 -DHAVE_GETADDRINFO=1 -DHAVE_GETPWUID_R_5=1 -DHAVE_GETPWUID_R=1 -DHAVE_GETPWNAM_R_5=1 -DHAVE_GETPWNAM_R=1 -DHAVE_GETGRGID_R_5=1 -DHAVE_GETGRGID_R=1 -DHAVE_GETGRNAM_R_5=1 -DHAVE_GETGRNAM_R=1 -DHAVE_MTSAFE_GETHOSTBYNAME=1 -DHAVE_MTSAFE_GETHOSTBYADDR=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_STRUCT_TM_TM_ZONE=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MKTIME=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_STRUCT_STAT_ST_BLKSIZE=1 -DHAVE_ST_BLKSIZE=1 -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DHAVE_CHFLAGS=1 -DHAVE_GETATTRLIST=1 -DHAVE_COPYFILE_H=1 -DHAVE_COPYFILE=1 -DHAVE_LIBKERN_OSATOMIC_H=1 -DHAVE_OSSPINLOCKLOCK=1 -DHAVE_PTHREAD_ATFORK=1 -DUSE_VFORK=1 -DTCL_DEFAULT_ENCODING=\"utf-8\" -DTCL_LOAD_FROM_MEMORY=1 -DTCL_WIDE_CLICKS=1 -DHAVE_AVAILABILITYMACROS_H=1 -DHAVE_WEAK_IMPORT=1 -D_DARWIN_C_SOURCE=1 -DHAVE_FTS=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1 -DTCL_UNLOAD_DLLS=1 
 TCL_BIN_DIR	= /usr/local/src/tcl8.5.8/unix
 TCL_SRC_DIR	= /usr/local/src/tcl8.5.8
 # This is necessary for packages that use private Tcl headers
@@ -134,7 +134,7 @@
 TCLSH		= $(TCLSH_ENV) $(TCLSH_PROG)
 SHARED_BUILD	= 1
 
-INCLUDES	=  -I/Users/neumann/src/xotcl-2.0.0/generic -I./generic -I"/usr/local/src/tcl8.5.8/generic"
+INCLUDES	=  -I/Users/ssoberni/Documents/dev/xotcl/generic -I./generic -I"/usr/local/src/tcl8.5.8/generic"
 
 EXTRA_CFLAGS	=  
 
@@ -149,7 +149,7 @@
 CONFIG_CLEAN_FILES = Makefile
 
 CPPFLAGS	= 
-LIBS		=  -L/Users/neumann/src/xotcl-2.0.0 -lxotclstub2.0.0 -L/Users/neumann/src/xotcl-2.0.0 -lxotcl2.0.0 
+LIBS		=  -L/Users/ssoberni/Documents/dev/xotcl -lxotclstub2.0.0 -L/Users/ssoberni/Documents/dev/xotcl -lxotcl2.0.0 
 AR		= ar
 CFLAGS		= -pipe  ${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}  
 COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
Index: library/xml/TclExpat-1.1/Makefile
===================================================================
diff -u -r78e6c23b4195221aba2a75be9e813382d74f20fb -r3142818cb17b21de68aa1898a4a5e25f4c13f921
--- library/xml/TclExpat-1.1/Makefile	(.../Makefile)	(revision 78e6c23b4195221aba2a75be9e813382d74f20fb)
+++ library/xml/TclExpat-1.1/Makefile	(.../Makefile)	(revision 3142818cb17b21de68aa1898a4a5e25f4c13f921)
@@ -67,8 +67,8 @@
 SHELL		= /bin/sh
 
 srcdir		= .
-prefix		= /usr/local/ns
-exec_prefix	= /usr/local/ns
+prefix		= /usr/local/tcl-8.5.8
+exec_prefix	= /usr/local/tcl-8.5.8
 
 bindir		= ${exec_prefix}/bin
 libdir		= ${exec_prefix}/lib
@@ -110,7 +110,7 @@
 SHLIB_LD_FLAGS	= @SHLIB_LD_FLAGS@
 SHLIB_LD_LIBS	= ${LIBS} -L/usr/local/src/tcl8.5.8/unix -ltclstub8.5
 STLIB_LD	= ${AR} cr
-TCL_DEFS	= -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"8.5\" -DPACKAGE_STRING=\"tcl\ 8.5\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DNO_VALUES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_PTHREAD_GET_STACKSIZE_NP=1 -DTCL_THREADS=1 -DTCL_CFGVAL_ENCODING=\"iso8859-1\" -DMODULE_SCOPE=extern\ __attribute__\(\(__visibility__\(\"hidden\"\)\)\) -DMAC_OSX_TCL=1 -DTCL_SHLIB_EXT=\".dylib\" -DTCL_CFG_DEBUG=1 -DTCL_TOMMATH=1 -DMP_PREC=4 -DTCL_WIDE_INT_IS_LONG=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRTOL=1 -DHAVE_WAITPID=1 -DHAVE_GETADDRINFO=1 -DHAVE_GETPWUID_R_5=1 -DHAVE_GETPWUID_R=1 -DHAVE_GETPWNAM_R_5=1 -DHAVE_GETPWNAM_R=1 -DHAVE_GETGRGID_R_5=1 -DHAVE_GETGRGID_R=1 -DHAVE_GETGRNAM_R_5=1 -DHAVE_GETGRNAM_R=1 -DHAVE_MTSAFE_GETHOSTBYNAME=1 -DHAVE_MTSAFE_GETHOSTBYADDR=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_STRUCT_TM_TM_ZONE=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MKTIME=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_STRUCT_STAT_ST_BLKSIZE=1 -DHAVE_ST_BLKSIZE=1 -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DHAVE_CHFLAGS=1 -DHAVE_GETATTRLIST=1 -DHAVE_COPYFILE_H=1 -DHAVE_COPYFILE=1 -DUSE_VFORK=1 -DTCL_DEFAULT_ENCODING=\"utf-8\" -DTCL_LOAD_FROM_MEMORY=1 -DTCL_WIDE_CLICKS=1 -DHAVE_AVAILABILITYMACROS_H=1 -DHAVE_WEAK_IMPORT=1 -D_DARWIN_C_SOURCE=1 -DHAVE_FTS=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1 -DTCL_UNLOAD_DLLS=1 
+TCL_DEFS	= -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"8.5\" -DPACKAGE_STRING=\"tcl\ 8.5\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DNO_VALUES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_PTHREAD_GET_STACKSIZE_NP=1 -DTCL_THREADS=1 -DTCL_CFGVAL_ENCODING=\"iso8859-1\" -DMODULE_SCOPE=extern\ __attribute__\(\(__visibility__\(\"hidden\"\)\)\) -DMAC_OSX_TCL=1 -DHAVE_COREFOUNDATION=1 -DTCL_SHLIB_EXT=\".dylib\" -DTCL_CFG_DEBUG=1 -DTCL_TOMMATH=1 -DMP_PREC=4 -DTCL_WIDE_INT_IS_LONG=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRTOL=1 -DHAVE_WAITPID=1 -DHAVE_GETADDRINFO=1 -DHAVE_GETPWUID_R_5=1 -DHAVE_GETPWUID_R=1 -DHAVE_GETPWNAM_R_5=1 -DHAVE_GETPWNAM_R=1 -DHAVE_GETGRGID_R_5=1 -DHAVE_GETGRGID_R=1 -DHAVE_GETGRNAM_R_5=1 -DHAVE_GETGRNAM_R=1 -DHAVE_MTSAFE_GETHOSTBYNAME=1 -DHAVE_MTSAFE_GETHOSTBYADDR=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_STRUCT_TM_TM_ZONE=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MKTIME=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_STRUCT_STAT_ST_BLKSIZE=1 -DHAVE_ST_BLKSIZE=1 -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DHAVE_CHFLAGS=1 -DHAVE_GETATTRLIST=1 -DHAVE_COPYFILE_H=1 -DHAVE_COPYFILE=1 -DHAVE_LIBKERN_OSATOMIC_H=1 -DHAVE_OSSPINLOCKLOCK=1 -DHAVE_PTHREAD_ATFORK=1 -DUSE_VFORK=1 -DTCL_DEFAULT_ENCODING=\"utf-8\" -DTCL_LOAD_FROM_MEMORY=1 -DTCL_WIDE_CLICKS=1 -DHAVE_AVAILABILITYMACROS_H=1 -DHAVE_WEAK_IMPORT=1 -D_DARWIN_C_SOURCE=1 -DHAVE_FTS=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1 -DTCL_UNLOAD_DLLS=1 
 TCL_BIN_DIR	= /usr/local/src/tcl8.5.8/unix
 TCL_SRC_DIR	= /usr/local/src/tcl8.5.8
 # This is necessary for packages that use private Tcl headers
@@ -134,7 +134,7 @@
 TCLSH		= $(TCLSH_ENV) $(TCLSH_PROG)
 SHARED_BUILD	= 1
 
-INCLUDES	=  -I/Users/neumann/src/xotcl-2.0.0/generic -I./generic -I"/usr/local/src/tcl8.5.8/generic"
+INCLUDES	=  -I/Users/ssoberni/Documents/dev/xotcl/generic -I./generic -I"/usr/local/src/tcl8.5.8/generic"
 
 EXTRA_CFLAGS	=  
 
@@ -149,7 +149,7 @@
 CONFIG_CLEAN_FILES = Makefile
 
 CPPFLAGS	= 
-LIBS		=  -L/Users/neumann/src/xotcl-2.0.0 -lxotclstub2.0.0 
+LIBS		=  -L/Users/ssoberni/Documents/dev/xotcl -lxotclstub2.0.0 
 AR		= ar
 CFLAGS		= -pipe  ${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}  
 COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
Index: tests/doc.xotcl
===================================================================
diff -u
--- tests/doc.xotcl	(revision 0)
+++ tests/doc.xotcl	(revision 3142818cb17b21de68aa1898a4a5e25f4c13f921)
@@ -0,0 +1,218 @@
+package require next
+package require xotcl::test
+package require next::doc
+
+namespace import -force ::next::*
+namespace import -force ::next::doc::*
+
+
+Test parameter count 1
+
+Test case scanning {
+
+  set lines {
+    "# @package o"			1
+    "bla"				0
+    "# @object o"			1
+    "# 1 2 3"				1
+    "#"					1
+    "#    "				1
+    "   #   "				1
+    "\t#\t \t"				1
+    "#  345"				1
+    "# @tag1 part1"			1
+    "bla; # no comment"			0
+    ""					0
+    "\t\t"				0
+    "### # # # # @object o # ####"	1
+    "# # # # # 345"			1
+    "# # # @tag1 part1"			1
+    "bla; # # # # # no comment"		0
+    "    "				0
+
+  }
+  
+  foreach {::line ::result} $lines {
+    ? {foreach {is_comment text} [doc analyze_line $::line] break; set is_comment} $::result "doc analyze_line '$::line'"
+  }
+
+  set ::script {
+    # @package o
+    # 1 2 3
+    bla
+    bla
+    # @object o
+    # 1 2 3
+    #
+    #  345 
+    # @tag1 part1 
+    # @tag2 part2
+    bla; # no comment
+    bla
+    bla
+    bla
+    
+    
+    ### # # # # @object o # ####
+    # 1 2 3
+    #
+    # # # # # 345 
+    # # # @tag1 part1 
+    # @tag2 part2
+    bla; # # # # # no comment
+  }
+
+  set blocks {{{@package o} {1 2 3}} {{@object o} {1 2 3} {} 345 {@tag1 part1} {@tag2 part2}} {{@object o # ####} {1 2 3} {} 345 {@tag1 part1} {@tag2 part2}}}
+
+    ? {doc comment_blocks $::script} $blocks
+}
+
+Test case parsing {
+  set blocks {{{@package o} {1 2 4}} {{@object o} {1 2 3} {} 345 {@tag1 part1} {@tag2 part2}} {{@object o # ####} {1 2 3} {} 345 {@tag1 part1} {@tag2 part2}}}
+    
+    ::next::doc::entity process [lindex $blocks 0]
+}
+
+exit
+  # states
+  #   1 empty line
+  #   2 tagged comment line
+  #   3 untagged, non-empty comment line
+  #   4 untagged, empty comment line
+  #   5 code line
+
+  set lines {
+    "" 		1
+    "   " 	1
+    "\t\t\t"	1
+    "abc"	5
+    "   abc"	5
+    "\t\t\tabc"	5
+    "#"		4
+    "   #   "	4
+    "\t\t\t# "	4
+    "#@"	3
+    "#@ tag"	3
+    "# @ tag"	3
+    "# @\ttag"	3
+    "#@tag"	2
+    "# @tag"	2
+    "# @1tag"	2
+    "\t#\t@tag"	2
+    "# @@"	3
+    "# @@@"	3
+  }
+
+  #
+  # TODO: without qualifying variable names by "::", they are *not*
+  # created in the evaluation scope of ? (e.g., the global namespace
+  # "::"). where do they go? and, why?
+  #
+  foreach {::line ::result} $lines {
+    ? {doc analyze_line $::line} $::result "doc analyze_line '$::line'"
+  }
+
+  set ::blocks {
+    # @tag0 entity hier kommt mehr text mit einer zweiten zeile die
+    # sich dahinzieht
+    # 
+    # eine beschreibung, hier kommt mehr text mit einer zweiten zeile
+    # die sich dahinzieht
+    #
+  }
+
+  ? {doc comment_blocks $::blocks} "1,1 1,2 2,4 4,3 3,4 4,2 2,2 2,1"
+
+  set result {
+    context tag0
+    description {some description}
+    tag0 entity
+    parts {
+      tag1 part1
+      tag2 part2
+    }
+  }
+
+ set ::blocks {
+   # some description
+   #
+   # @tag1 part1 some description which takes
+   # more than a line
+   # @tag2 part2
+  } 3-3-3-2-2
+
+  set result {
+    context tag0
+    description {some description}
+    tag0 entity
+    parts {
+      tag1 part1
+      tag2 part2
+    }
+  }
+ 
+  
+}
+
+Test case parsing {
+set str {
+    # @class Foo
+    # 
+    # The class Foo defines the behaviour for all Foo objects
+    #
+    # @author gneumann@wu.ac.at
+    # @author ssoberni@wu.ac.at
+  }
+  Class create Foo {
+    # @attribute attr1 
+    #
+    # This attribute 1 is wonderful
+    :attribute attr1
+    :attribute attr2
+    :attribute attr3
+  }
+  
+#  doc process $str
+#  ? {::next::core::is [NextClass id ::Foo] object} 1
+
+  Class create Bar {
+    # The class Bar defines the behaviour for all Foo objects
+    #
+    # @author mstrembe@wu.ac.at
+
+    :attribute attr1
+
+    # @attribute attr2
+    #
+    # This attribute 2 is wonderful
+    :attribute attr2
+
+    # @attribute attr3
+    #
+    # This attribute 3 is wonderful
+    :attribute attr3
+  }
+
+}
+
+# # # # # # # # # # # # # # # # # # # #
+# # # # # # # # # # # # # # # # # # # #
+# # # # # # # # # # # # # # # # # # # #
+
+Test case various {
+  Class create AMetaClass -superclass Class
+  AMetaClass create AClass {
+    :object method id {} {
+      return [::next::core::current class]-[:info class]
+    }
+  }
+  
+  ? {AClass id} -::AMetaClass
+  
+  Class create AMixin {
+    :method id {} {return "[::next::core::current class]-[:info class]-[next]";}
+  }
+  
+  AClass object mixin add AMixin
+  ? {AClass id} ::AMixin-::AMetaClass--::AMetaClass
+}