Index: Makefile.in
===================================================================
diff -u -r9a578692ecf2d05eb4da0de37c7e0bdca3819570 -r9333bfa110291a29fa898b0ce554e8848db5d031
--- Makefile.in	(.../Makefile.in)	(revision 9a578692ecf2d05eb4da0de37c7e0bdca3819570)
+++ Makefile.in	(.../Makefile.in)	(revision 9333bfa110291a29fa898b0ce554e8848db5d031)
@@ -19,8 +19,7 @@
 # have been added in a customized configure script.
 #========================================================================
 
-#NX_VERSION 	= @PACKAGE_VERSION@
-NX_VERSION 	= @NX_VERSION@
+NX_VERSION 	= @PACKAGE_VERSION@
 
 src_lib_dir		= ${srcdir}/library
 src_doc_dir		= ${srcdir}/doc
@@ -47,6 +46,7 @@
 appdirs		= 
 appsrc		= COPYRIGHT 
 
+
 # XOTcl subpackage
 xotcl_srcdir	= ${srcdir}/library/xotcl
 xotcl_src_doc_dir = ${xotcl_srcdir}/doc
@@ -65,11 +65,8 @@
 	$(src_lib_dir)/serialize/serializer.tcl \
 	$(xotcl_src_doc_dir)/langRef.xotcl \
 	$(xotcl_src_lib_dir)/lib/*.xotcl \
-	$(xotcl_src_lib_dir)/store/*.xotcl \
 	$(xotcl_src_test_dir)/*.xotcl \
-	$(xotcl_src_app_dir)/scripts/*.xotcl \
 	$(xotcl_src_app_dir)/comm/[flsw]*.xotcl \
-	$(xotcl_src_app_dir)/actiweb/univ/UNIVERSAL.xotcl \
 	$(xotcl_src_app_dir)/utils/xo-*[a-z0-9] 
 
 #export TCLLIBPATH=. ${srcdir}
@@ -80,6 +77,10 @@
 # are correct.
 #========================================================================
 
+DTRACE_OBJ = @DTRACE_OBJ@
+DTRACE_HDR = $(src_generic_dir)/nsfDTrace.h
+DTRACE_SRC = $(src_generic_dir)/nsfDTrace.d
+
 #========================================================================
 # The names of the source files is defined in the configure script.
 # The object files are used for linking into the final library.
@@ -89,7 +90,7 @@
 #========================================================================
 
 PKG_SOURCES	= @PKG_SOURCES@
-PKG_OBJECTS	= @PKG_OBJECTS@
+PKG_OBJECTS	= @PKG_OBJECTS@ ${DTRACE_OBJ}
 
 PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
 PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
@@ -132,12 +133,20 @@
 
 DESTDIR		=
 
+PKG_DIR		= $(PACKAGE_NAME)$(PACKAGE_VERSION)
+pkgdatadir	= $(datadir)/$(PKG_DIR)
+pkglibdir	= $(libdir)/$(PKG_DIR)
+pkgincludedir	= $(includedir)/$(PKG_DIR)
+
 top_builddir	= .
 
-INSTALL		= @INSTALL@
-INSTALL_PROGRAM	= @INSTALL_PROGRAM@
-INSTALL_DATA	= @INSTALL_DATA@
-INSTALL_SCRIPT	= @INSTALL_SCRIPT@
+INSTALL_OPTIONS =
+INSTALL		= $(SHELL) $(srcdir)/config/install-sh -c ${INSTALL_OPTIONS}
+INSTALL_DATA_DIR = ${INSTALL} -d -m 755
+INSTALL_PROGRAM	= ${INSTALL} -m 755
+INSTALL_DATA	= ${INSTALL} -m 644
+INSTALL_SCRIPT	= ${INSTALL_PROGRAM}
+INSTALL_LIBRARY	= ${INSTALL_DATA}
 
 PACKAGE_NAME	= @PACKAGE_NAME@
 PACKAGE_VERSION	= @PACKAGE_VERSION@
@@ -158,21 +167,18 @@
 SHLIB_CFLAGS	= @SHLIB_CFLAGS@
 SHLIB_LD	= @SHLIB_LD@
 SHLIB_LD_LIBS	= @SHLIB_LD_LIBS@
-#CC_SEARCH_FLAGS = @CC_SEARCH_FLAGS@
-#LD_SEARCH_FLAGS = @LD_SEARCH_FLAGS@
 STLIB_LD	= @STLIB_LD@
 TCL_DEFS	= @TCL_DEFS@
 TCL_BIN_DIR	= @TCL_BIN_DIR@
 TCL_SRC_DIR	= @TCL_SRC_DIR@
+#
+DTRACE          = dtrace
+#
 # Not used, but retained for reference of what libs Tcl required
 TCL_LIBS	= @TCL_LIBS@
 
-pkgdatadir	= @pkgdatadir@
-pkglibdir	= @pkglibdir@
-pkgincludedir	= @pkgincludedir@
+xotcl_pkglibdir	= $(pkglibdir)/xotcl
 
-xotcl_pkglibdir	= @pkglibdir@/xotcl
-
 installed_shells = $(DESTDIR)$(bindir)/nxsh $(DESTDIR)$(bindir)/nxwish $(DESTDIR)$(bindir)/xotclsh $(DESTDIR)$(bindir)/xowish
 
 #========================================================================
@@ -186,9 +192,10 @@
 TCLSH_ENV	= TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library` \
 		  @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \
 		  PATH="$(EXTRA_PATH):$(PATH)" \
-		  TCLLIBPATH="$(top_builddir) ${srcdir}"
+		  TCLLIBPATH="$(top_builddir) ${srcdir} $(TCLLIBPATH)"
 TCLSH_PROG	= @TCLSH_PROG@
 TCLSH		= $(TCLSH_ENV) $(TCLSH_PROG)
+#TCLSH		= $(TCLSH_ENV) valgrind --dsymutil=yes $(TCLSH_PROG)
 SHARED_BUILD	= @SHARED_BUILD@
 
 INCLUDES	= @PKG_INCLUDES@ @TCL_INCLUDES@ @NSF_BUILD_INCLUDE_SPEC@
@@ -214,6 +221,32 @@
 # Start of user-definable TARGETS section
 #========================================================================
 
+EXAMPLE_SCRIPTS = \
+	$(src_doc_dir)/example-scripts/bagel.html \
+	$(src_doc_dir)/example-scripts/per-object-mixins.html \
+	$(src_doc_dir)/example-scripts/rosetta-abstract-type.html \
+	$(src_doc_dir)/example-scripts/rosetta-classes.html \
+	$(src_doc_dir)/example-scripts/rosetta-constraint-genericity.html \
+	$(src_doc_dir)/example-scripts/rosetta-delegates.html \
+	$(src_doc_dir)/example-scripts/rosetta-distinct-objects.html \
+	$(src_doc_dir)/example-scripts/rosetta-polymorphic-copy.html \
+	$(src_doc_dir)/example-scripts/rosetta-polymorphism.html \
+	$(src_doc_dir)/example-scripts/rosetta-serialization.html \
+	$(src_doc_dir)/example-scripts/rosetta-singleton.html \
+	$(src_doc_dir)/example-scripts/rosetta-unknown-method.html \
+	$(src_doc_dir)/example-scripts/tk-horse-race.html \
+	$(src_doc_dir)/example-scripts/tk-locomotive.html \
+	$(src_doc_dir)/example-scripts/tk-mini.html \
+	$(src_doc_dir)/example-scripts/tk-spread.html \
+	$(src_doc_dir)/example-scripts/traits-composite.html \
+	$(src_doc_dir)/example-scripts/traits-simple.html \
+	$(src_doc_dir)/example-scripts/container.html \
+
+
+%.html : %.tcl
+	$(TCLSH) $(src_app_dir_native)/utils/source-doc-beautifier.tcl $<
+	asciidoc $*.txt
+
 #========================================================================
 # TEA TARGETS.  Please note that the "libraries:" target refers to platform
 # independent files, and the "binaries:" target inclues executable programs and
@@ -243,14 +276,71 @@
 	   if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \
 	done; fi;
 
-libraries-pkgindex:
+libraries-pkgindex: pkgIndex.tcl
 	@$(TCLSH) $(src_lib_dir_native)/lib/make.tcl -dir $(src_lib_dir_native) -all
 
-fulldoc: doc pdf
+full-doc: doc pdf example-doc
 # use language reference as sample file to trigger generation of documentation files
 doc: $(xotcl_target_doc_dir)/langRef-xotcl.html
 
-$(xotcl_target_doc_dir)/langRef-xotcl.html: $(xotcl_src_doc_dir)/langRef.xotcl $(XODOC_SOURCE)
+YUIDOC_OUTPUT = \
+	$(target_doc_dir)/$(PACKAGE_NAME)/index.html \
+	$(target_doc_dir)/nx/index.html \
+	$(xotcl_target_doc_dir)/XOTcl-langRef/index.html
+
+yuidoc: pkgIndex.tcl $(YUIDOC_OUTPUT)
+
+$(target_doc_dir)/$(PACKAGE_NAME)/index.html: $(PACKAGE_NAME).nxd
+	$(TCLSH) $(src_app_dir_native)/utils/nxdoc $(NXDFLAGS) -doctitle $(PACKAGE_NAME) \
+	-docurl "http://next-scripting.org/" -docversion $(PACKAGE_VERSION) \
+	-outdir $(target_doc_dir) -indexfiles generic/nxdocIndex.tcl -- "package:$(PACKAGE_NAME)"
+
+$(target_doc_dir)/nx/index.html: library/nx/nx.nxd $(PACKAGE_NAME).nxd
+	$(TCLSH) $(src_app_dir_native)/utils/nxdoc $(NXDFLAGS) -doctitle nx \
+	-docurl "http://next-scripting.org/" -docversion $(PACKAGE_VERSION) \
+	-outdir $(target_doc_dir) -indexfiles library/nx/nxdocIndex.tcl -- "package:nx"
+
+$(xotcl_target_doc_dir)/XOTcl-langRef/index.html: library/xotcl/doc/langRef.xotcl 
+	$(TCLSH) $(src_app_dir_native)/utils/nxdoc -doctitle XOTcl-langRef \
+	-docurl "http://next-scripting.org/" -docversion $(PACKAGE_VERSION) \
+	-outdir $(xotcl_target_doc_dir) -frontend xodoc -- package:XOTcl-langRef
+
+yuidoc-dev: NXDFLAGS := -validation
+yuidoc-dev: yuidoc
+
+XOWIKI_OUTPUT = \
+	$(target_doc_dir)/$(PACKAGE_NAME).xowiki \
+	$(target_doc_dir)/nx.xowiki \
+	$(xotcl_target_doc_dir)/XOTcl-langRef.xowiki
+
+xowiki: pkgIndex.tcl $(XOWIKI_OUTPUT)
+
+$(target_doc_dir)/$(PACKAGE_NAME).xowiki : $(PACKAGE_NAME).nxd
+	$(TCLSH) $(src_app_dir_native)/utils/nxdoc $(NXDFLAGS) -doctitle $(PACKAGE_NAME) \
+	-docurl "http://next-scripting.org/" -docversion $(PACKAGE_VERSION) \
+	-outdir $(target_doc_dir) -format xowiki -layout many-to-1 -indexfiles generic/nxdocIndex.tcl \
+	-- "package:$(PACKAGE_NAME)"
+
+
+$(target_doc_dir)/nx.xowiki : library/nx/nx.nxd $(PACKAGE_NAME).nxd
+	$(TCLSH) $(src_app_dir_native)/utils/nxdoc $(NXDFLAGS) -doctitle nx \
+	-docurl "http://next-scripting.org/" -docversion $(PACKAGE_VERSION) \
+	-outdir $(target_doc_dir) -format xowiki -layout many-to-1 -indexfiles library/nx/nxdocIndex.tcl \
+	-- "package:nx"
+
+$(xotcl_target_doc_dir)/XOTcl-langRef.xowiki : library/xotcl/doc/langRef.xotcl
+	$(TCLSH) $(src_app_dir_native)/utils/nxdoc -doctitle XOTcl-langRef \
+	-docurl "http://next-scripting.org/" -docversion $(PACKAGE_VERSION) \
+	-outdir $(target_doc_dir) -format xowiki -layout many-to-1 \
+	-frontend xodoc -- package:XOTcl-langRef
+
+xowiki-dev: NXDFLAGS := -validation
+xowiki-dev: xowiki
+
+
+example-doc: $(EXAMPLE_SCRIPTS)
+
+$(xotcl_target_doc_dir)/langRef-xotcl.html: pkgIndex.tcl $(xotcl_src_doc_dir)/langRef.xotcl $(XODOC_SOURCE)
 	@docs=""; \
 	for i in $(XODOC_SOURCE); do docs="$$docs `@CYGPATH@ $$i`"; done; \
 	$(TCLSH) $(xotcl_src_lib_dir)/lib/makeDoc.xotcl \
@@ -390,11 +480,14 @@
 test-core: $(TCLSH_PROG)
 	$(TCLSH) $(src_test_dir_native)/object-system.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
 	$(TCLSH) $(src_test_dir_native)/destroy.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
-	$(TCLSH) $(src_test_dir_native)/method-modifiers.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_test_dir_native)/methods.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_test_dir_native)/method-parameter.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
 	$(TCLSH) $(src_test_dir_native)/var-access.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
 	$(TCLSH) $(src_test_dir_native)/varresolution.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
 	$(TCLSH) $(src_test_dir_native)/info-method.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
 	$(TCLSH) $(src_test_dir_native)/submethods.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_test_dir_native)/disposition.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_test_dir_native)/volatile.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
 	$(TCLSH) $(src_test_dir_native)/parameters.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
 	$(TCLSH) $(src_test_dir_native)/returns.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
 	$(TCLSH) $(src_test_dir_native)/method-require.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
@@ -405,6 +498,22 @@
 	$(TCLSH) $(src_test_dir_native)/mixinof.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
 	$(TCLSH) $(src_test_dir_native)/tcl86.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
 	$(TCLSH) $(src_test_dir_native)/contains.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_test_dir_native)/tcloo.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_test_dir_native)/interp.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/bagel.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/container.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-abstract-type.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-classes.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-constraint-genericity.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-delegates.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-distinct-objects.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-polymorphic-copy.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-polymorphism.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-serialization.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-singleton.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-unknown-method.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/traits-composite.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
+	$(TCLSH) $(src_doc_dir_native)/example-scripts/traits-simple.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
 
 test-xotcl: $(TCLSH_PROG)
 	$(TCLSH) $(xotcl_src_test_dir)/testo.xotcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
@@ -511,20 +620,22 @@
 $(src_generic_dir)/predefined.h: $(src_generic_dir)/mk_predefined.tcl $(src_generic_dir)/nsf.tcl
 	(cd $(src_generic_dir); $(TCLSH) mk_predefined.tcl nsf.tcl > predefined.h)
 
-$(src_generic_dir)/tclAPI.h: $(src_generic_dir)/gentclAPI.tcl $(src_generic_dir)/gentclAPI.decls
-	$(TCLSH) $(src_generic_dir)/gentclAPI.tcl > $(src_generic_dir)/tclAPI.h
+$(src_generic_dir)/nsfAPI.h: $(src_generic_dir)/gentclAPI.tcl $(src_generic_dir)/nsfAPI.decls
+	$(TCLSH) $(src_generic_dir)/gentclAPI.tcl $(src_generic_dir)/nsfAPI.decls > $(src_generic_dir)/nsfAPI.h
 
-nsfStubInit.$(OBJEXT): $(PKG_HEADERS)
-nsfStubLib.$(OBJEXT): $(src_generic_dir)/nsfStubLib.c $(PKG_HEADERS)
-nsf.$(OBJEXT): $(src_generic_dir)/nsf.c $(src_generic_dir)/predefined.h $(src_generic_dir)/nsfAccessInt.h $(src_generic_dir)/tclAPI.h $(PKG_HEADERS) $(src_generic_dir)/nsfStack.c
+aolstub.$(OBJEXT): $(src_generic_dir)/aolstub.c $(PKG_HEADERS)
+nsf.$(OBJEXT): $(src_generic_dir)/nsf.c $(src_generic_dir)/predefined.h $(src_generic_dir)/nsfAccessInt.h $(src_generic_dir)/nsfAPI.h $(PKG_HEADERS) $(src_generic_dir)/nsfStack.c $(src_generic_dir)/asm/nsfAssemble.c $(src_generic_dir)/asm/nsfAsmExecuteCallThreading.c $(src_generic_dir)/asm/nsfAsmExecuteLabelThreading.c $(src_generic_dir)/asm/nsfAsmAssemble.c $(DTRACE_HDR) 
+nsfDebug.$(OBJEXT): $(src_generic_dir)/nsfDebug.c $(PKG_HEADERS)
 nsfError.$(OBJEXT): $(src_generic_dir)/nsfError.c $(PKG_HEADERS)
 nsfMetaData.$(OBJEXT): $(src_generic_dir)/nsfMetaData.c $(PKG_HEADERS)
+nsfObj.$(OBJEXT): $(src_generic_dir)/nsfObj.c $(PKG_HEADERS)
 nsfObjectData.$(OBJEXT): $(src_generic_dir)/nsfObjectData.c $(PKG_HEADERS)
+nsfPointer.$(OBJEXT): $(src_generic_dir)/nsfPointer.c $(PKG_HEADERS)
 nsfProfile.$(OBJEXT): $(src_generic_dir)/nsfProfile.c $(PKG_HEADERS)
-nsfTrace.$(OBJEXT): $(src_generic_dir)/nsfTrace.c $(PKG_HEADERS)
-nsfUtil.$(OBJEXT): $(src_generic_dir)/nsfUtil.c $(PKG_HEADERS)
 nsfShadow.$(OBJEXT): $(src_generic_dir)/nsfShadow.c $(PKG_HEADERS)
-aolstub.$(OBJEXT): $(src_generic_dir)/aolstub.c $(PKG_HEADERS)
+nsfStubInit.$(OBJEXT): $(PKG_HEADERS)
+nsfStubLib.$(OBJEXT): $(src_generic_dir)/nsfStubLib.c $(PKG_HEADERS)
+nsfUtil.$(OBJEXT): $(src_generic_dir)/nsfUtil.c $(PKG_HEADERS)
 
 #
 # Target to regenerate header files and stub files from the *.decls tables.
@@ -551,6 +662,17 @@
 		if [ $$match -eq 0 ]; then echo $$i; fi \
 	done
 
+# DTrace support
+
+$(PKG_OBJECTS): $(DTRACE_HDR)
+
+$(DTRACE_HDR): $(DTRACE_SRC)
+	$(DTRACE) -h $(DTRACE_SWITCHES) -o $@ -s $(DTRACE_SRC)
+
+$(DTRACE_OBJ): $(DTRACE_SRC) $(TCL_OBJS)
+	$(DTRACE) -G $(DTRACE_SWITCHES) -o $@ -s $(DTRACE_SRC) $(TCL_OBJS)
+
+
 #========================================================================
 # End of user-definable section
 #========================================================================
@@ -560,17 +682,19 @@
 # variable in configure.in
 #========================================================================
 
-clean:  
-	-rm -rf $(BINARIES) $(CLEANFILES) $(installed_shells) pkgIndex.tcl ./receiver \
-		$(xotcl_target_doc_dir)/*-xotcl.html
+cleandoc:  
+	-rm -rf $(xotcl_target_doc_dir)/*-xotcl.html $(dir $(YUIDOC_OUTPUT)) $(XOWIKI_OUTPUT)
+
+clean: cleandoc
+	-rm -rf $(BINARIES) $(CLEANFILES) ./receiver
 	find ${srcdir} -type f -name \*~ -exec rm \{} \;
 	@if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \
 	for dir in $$dirs ; do \
 	   if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \
 	done; fi
 
 distclean: clean
-	-rm -rf Makefile $(CONFIG_CLEAN_FILES)
+	-rm -rf $(CONFIG_CLEAN_FILES)
 	-rm -f config.cache config.log config.status
 	@if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \
 	for dir in $$dirs ; do \
@@ -688,7 +812,8 @@
 	@echo " In order install next-scripting, invoke:"
 	@echo "   make install"
 	@echo ""
-	@echo " In order to install next-scripting for AOLserver 4.x, invoke:"
+	@echo " In order to install next-scripting for AOLserver 4.x"
+	@echo " or Naviserver, invoke:"
 	@echo "   make install-aol"
 	@echo "" 
 	@echo " In order to invoke next-scripting interactively (before install), use:"