--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/.cvsignore	2005-12-30 14:59:16.000000000 +0000
+++ hashcaml/.cvsignore	2006-04-24 12:23:36.000000000 +0100
@@ -11,4 +11,3 @@
 ocamlcompopt.sh
 package-macosx
 .DS_Store
-*.annot
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/.depend	2005-10-26 14:23:27.000000000 +0100
+++ hashcaml/.depend	2006-04-24 12:23:36.000000000 +0100
@@ -24,6 +24,8 @@
     parsing/asttypes.cmi 
 parsing/printast.cmi: parsing/parsetree.cmi 
 parsing/syntaxerr.cmi: parsing/location.cmi 
+parsing/asttypes.cmo: parsing/asttypes.cmi 
+parsing/asttypes.cmx: parsing/asttypes.cmi 
 parsing/lexer.cmo: utils/warnings.cmi parsing/parser.cmi utils/misc.cmi \
     parsing/location.cmi parsing/lexer.cmi 
 parsing/lexer.cmx: utils/warnings.cmx parsing/parser.cmx utils/misc.cmx \
@@ -43,13 +45,17 @@
 parsing/parser.cmo: parsing/syntaxerr.cmi parsing/parsetree.cmi \
     parsing/longident.cmi parsing/location.cmi utils/clflags.cmi \
     parsing/asttypes.cmi parsing/parser.cmi 
-parsing/parser.cmx: parsing/syntaxerr.cmx parsing/parsetree.cmi \
+parsing/parser.cmx: parsing/syntaxerr.cmx parsing/parsetree.cmx \
     parsing/longident.cmx parsing/location.cmx utils/clflags.cmx \
-    parsing/asttypes.cmi parsing/parser.cmi 
+    parsing/asttypes.cmx parsing/parser.cmi 
+parsing/parsetree.cmo: parsing/longident.cmi parsing/location.cmi \
+    parsing/asttypes.cmi parsing/parsetree.cmi 
+parsing/parsetree.cmx: parsing/longident.cmx parsing/location.cmx \
+    parsing/asttypes.cmx parsing/parsetree.cmi 
 parsing/printast.cmo: parsing/parsetree.cmi parsing/longident.cmi \
     parsing/location.cmi parsing/asttypes.cmi parsing/printast.cmi 
-parsing/printast.cmx: parsing/parsetree.cmi parsing/longident.cmx \
-    parsing/location.cmx parsing/asttypes.cmi parsing/printast.cmi 
+parsing/printast.cmx: parsing/parsetree.cmx parsing/longident.cmx \
+    parsing/location.cmx parsing/asttypes.cmx parsing/printast.cmi 
 parsing/syntaxerr.cmo: parsing/location.cmi parsing/syntaxerr.cmi 
 parsing/syntaxerr.cmx: parsing/location.cmx parsing/syntaxerr.cmi 
 typing/btype.cmi: typing/types.cmi typing/path.cmi parsing/asttypes.cmi 
@@ -70,7 +76,7 @@
 typing/outcometree.cmi: parsing/asttypes.cmi 
 typing/parmatch.cmi: typing/types.cmi typing/typedtree.cmi \
     parsing/location.cmi typing/env.cmi 
-typing/path.cmi: typing/ident.cmi 
+typing/path.cmi: parsing/longident.cmi typing/ident.cmi 
 typing/predef.cmi: typing/types.cmi typing/path.cmi typing/ident.cmi 
 typing/printtyp.cmi: typing/types.cmi typing/path.cmi typing/outcometree.cmi \
     parsing/longident.cmi typing/ident.cmi 
@@ -104,19 +110,19 @@
     utils/clflags.cmi typing/btype.cmi parsing/asttypes.cmi typing/ctype.cmi 
 typing/ctype.cmx: typing/types.cmx typing/subst.cmx typing/path.cmx \
     utils/misc.cmx parsing/longident.cmx typing/ident.cmx typing/env.cmx \
-    utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmi typing/ctype.cmi 
+    utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmx typing/ctype.cmi 
 typing/datarepr.cmo: typing/types.cmi typing/predef.cmi utils/misc.cmi \
     parsing/asttypes.cmi typing/datarepr.cmi 
 typing/datarepr.cmx: typing/types.cmx typing/predef.cmx utils/misc.cmx \
-    parsing/asttypes.cmi typing/datarepr.cmi 
+    parsing/asttypes.cmx typing/datarepr.cmi 
 typing/env.cmo: typing/types.cmi utils/tbl.cmi typing/subst.cmi \
     typing/predef.cmi typing/path.cmi utils/misc.cmi parsing/longident.cmi \
     typing/ident.cmi typing/datarepr.cmi utils/consistbl.cmi utils/config.cmi \
-    typing/btype.cmi parsing/asttypes.cmi typing/env.cmi 
+    utils/clflags.cmi typing/btype.cmi parsing/asttypes.cmi typing/env.cmi 
 typing/env.cmx: typing/types.cmx utils/tbl.cmx typing/subst.cmx \
     typing/predef.cmx typing/path.cmx utils/misc.cmx parsing/longident.cmx \
     typing/ident.cmx typing/datarepr.cmx utils/consistbl.cmx utils/config.cmx \
-    typing/btype.cmx parsing/asttypes.cmi typing/env.cmi 
+    utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmx typing/env.cmi 
 typing/ident.cmo: typing/ident.cmi 
 typing/ident.cmx: typing/ident.cmi 
 typing/includeclass.cmo: typing/types.cmi typing/printtyp.cmi \
@@ -128,7 +134,7 @@
     typing/btype.cmi parsing/asttypes.cmi typing/includecore.cmi 
 typing/includecore.cmx: typing/types.cmx typing/typedtree.cmx \
     typing/predef.cmx typing/path.cmx utils/misc.cmx typing/ctype.cmx \
-    typing/btype.cmx parsing/asttypes.cmi typing/includecore.cmi 
+    typing/btype.cmx parsing/asttypes.cmx typing/includecore.cmi 
 typing/includemod.cmo: typing/types.cmi typing/typedtree.cmi utils/tbl.cmi \
     typing/subst.cmi typing/printtyp.cmi typing/path.cmi typing/mtype.cmi \
     utils/misc.cmi typing/includecore.cmi typing/includeclass.cmi \
@@ -145,8 +151,10 @@
     typing/mtype.cmi 
 typing/oprint.cmo: typing/outcometree.cmi parsing/asttypes.cmi \
     typing/oprint.cmi 
-typing/oprint.cmx: typing/outcometree.cmi parsing/asttypes.cmi \
+typing/oprint.cmx: typing/outcometree.cmx parsing/asttypes.cmx \
     typing/oprint.cmi 
+typing/outcometree.cmo: parsing/asttypes.cmi typing/outcometree.cmi 
+typing/outcometree.cmx: parsing/asttypes.cmx typing/outcometree.cmi 
 typing/parmatch.cmo: utils/warnings.cmi typing/types.cmi typing/typedtree.cmi \
     typing/predef.cmi typing/path.cmi utils/misc.cmi parsing/location.cmi \
     typing/ident.cmi typing/env.cmi typing/datarepr.cmi typing/ctype.cmi \
@@ -154,13 +162,13 @@
 typing/parmatch.cmx: utils/warnings.cmx typing/types.cmx typing/typedtree.cmx \
     typing/predef.cmx typing/path.cmx utils/misc.cmx parsing/location.cmx \
     typing/ident.cmx typing/env.cmx typing/datarepr.cmx typing/ctype.cmx \
-    typing/btype.cmx parsing/asttypes.cmi typing/parmatch.cmi 
-typing/path.cmo: typing/ident.cmi typing/path.cmi 
-typing/path.cmx: typing/ident.cmx typing/path.cmi 
+    typing/btype.cmx parsing/asttypes.cmx typing/parmatch.cmi 
+typing/path.cmo: parsing/longident.cmi typing/ident.cmi typing/path.cmi 
+typing/path.cmx: parsing/longident.cmx typing/ident.cmx typing/path.cmi 
 typing/predef.cmo: typing/types.cmi typing/path.cmi typing/ident.cmi \
     typing/btype.cmi parsing/asttypes.cmi typing/predef.cmi 
 typing/predef.cmx: typing/types.cmx typing/path.cmx typing/ident.cmx \
-    typing/btype.cmx parsing/asttypes.cmi typing/predef.cmi 
+    typing/btype.cmx parsing/asttypes.cmx typing/predef.cmi 
 typing/primitive.cmo: utils/misc.cmi typing/primitive.cmi 
 typing/primitive.cmx: utils/misc.cmx typing/primitive.cmi 
 typing/printtyp.cmo: typing/types.cmi typing/primitive.cmi typing/predef.cmi \
@@ -169,9 +177,9 @@
     utils/clflags.cmi typing/btype.cmi parsing/asttypes.cmi \
     typing/printtyp.cmi 
 typing/printtyp.cmx: typing/types.cmx typing/primitive.cmx typing/predef.cmx \
-    typing/path.cmx typing/outcometree.cmi typing/oprint.cmx utils/misc.cmx \
+    typing/path.cmx typing/outcometree.cmx typing/oprint.cmx utils/misc.cmx \
     parsing/longident.cmx typing/ident.cmx typing/env.cmx typing/ctype.cmx \
-    utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmi \
+    utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmx \
     typing/printtyp.cmi 
 typing/stypes.cmo: typing/typedtree.cmi typing/printtyp.cmi \
     parsing/location.cmi utils/clflags.cmi typing/stypes.cmi 
@@ -191,10 +199,10 @@
 typing/typeclass.cmx: utils/warnings.cmx typing/typetexp.cmx typing/types.cmx \
     typing/typedtree.cmx typing/typedecl.cmx typing/typecore.cmx \
     typing/subst.cmx typing/stypes.cmx typing/printtyp.cmx typing/predef.cmx \
-    typing/path.cmx parsing/parsetree.cmi typing/parmatch.cmx utils/misc.cmx \
+    typing/path.cmx parsing/parsetree.cmx typing/parmatch.cmx utils/misc.cmx \
     parsing/longident.cmx parsing/location.cmx typing/includeclass.cmx \
     typing/ident.cmx typing/env.cmx typing/ctype.cmx utils/clflags.cmx \
-    typing/btype.cmx parsing/asttypes.cmi typing/typeclass.cmi 
+    typing/btype.cmx parsing/asttypes.cmx typing/typeclass.cmi 
 typing/typecore.cmo: utils/warnings.cmi typing/typetexp.cmi typing/types.cmi \
     typing/typedtree.cmi typing/stypes.cmi typing/printtyp.cmi \
     typing/primitive.cmi typing/predef.cmi typing/path.cmi \
@@ -205,10 +213,10 @@
 typing/typecore.cmx: utils/warnings.cmx typing/typetexp.cmx typing/types.cmx \
     typing/typedtree.cmx typing/stypes.cmx typing/printtyp.cmx \
     typing/primitive.cmx typing/predef.cmx typing/path.cmx \
-    parsing/parsetree.cmi typing/parmatch.cmx utils/misc.cmx \
+    parsing/parsetree.cmx typing/parmatch.cmx utils/misc.cmx \
     parsing/longident.cmx parsing/location.cmx typing/ident.cmx \
     typing/env.cmx typing/ctype.cmx utils/clflags.cmx typing/btype.cmx \
-    parsing/asttypes.cmi typing/typecore.cmi 
+    parsing/asttypes.cmx typing/typecore.cmi 
 typing/typedecl.cmo: typing/typetexp.cmi typing/types.cmi \
     typing/typedtree.cmi typing/subst.cmi typing/printtyp.cmi \
     typing/primitive.cmi typing/predef.cmi typing/path.cmi \
@@ -219,47 +227,49 @@
 typing/typedecl.cmx: typing/typetexp.cmx typing/types.cmx \
     typing/typedtree.cmx typing/subst.cmx typing/printtyp.cmx \
     typing/primitive.cmx typing/predef.cmx typing/path.cmx \
-    parsing/parsetree.cmi utils/misc.cmx parsing/longident.cmx \
+    parsing/parsetree.cmx utils/misc.cmx parsing/longident.cmx \
     parsing/location.cmx typing/includecore.cmx typing/ident.cmx \
     typing/env.cmx typing/ctype.cmx utils/config.cmx utils/clflags.cmx \
-    typing/btype.cmx parsing/asttypes.cmi typing/typedecl.cmi 
+    typing/btype.cmx parsing/asttypes.cmx typing/typedecl.cmi 
 typing/typedtree.cmo: typing/types.cmi typing/primitive.cmi typing/path.cmi \
     utils/misc.cmi parsing/location.cmi typing/ident.cmi typing/env.cmi \
-    parsing/asttypes.cmi typing/typedtree.cmi 
+    typing/ctype.cmi parsing/asttypes.cmi typing/typedtree.cmi 
 typing/typedtree.cmx: typing/types.cmx typing/primitive.cmx typing/path.cmx \
     utils/misc.cmx parsing/location.cmx typing/ident.cmx typing/env.cmx \
-    parsing/asttypes.cmi typing/typedtree.cmi 
+    typing/ctype.cmx parsing/asttypes.cmx typing/typedtree.cmi 
 typing/typemod.cmo: typing/types.cmi typing/typedtree.cmi typing/typedecl.cmi \
-    typing/typecore.cmi typing/typeclass.cmi typing/subst.cmi \
-    typing/stypes.cmi typing/printtyp.cmi typing/path.cmi \
-    parsing/parsetree.cmi typing/mtype.cmi utils/misc.cmi \
+    typing/typecore.cmi typing/typeclass.cmi hashing/transig.cmo \
+    typing/subst.cmi typing/stypes.cmi typing/printtyp.cmi \
+    polymarshal/polymarshal.cmi typing/path.cmi parsing/parsetree.cmi \
+    hashing/normtrans.cmo typing/mtype.cmi utils/misc.cmi \
     parsing/longident.cmi parsing/location.cmi typing/includemod.cmi \
     typing/ident.cmi typing/env.cmi typing/ctype.cmi utils/config.cmi \
     utils/clflags.cmi typing/btype.cmi typing/typemod.cmi 
 typing/typemod.cmx: typing/types.cmx typing/typedtree.cmx typing/typedecl.cmx \
-    typing/typecore.cmx typing/typeclass.cmx typing/subst.cmx \
-    typing/stypes.cmx typing/printtyp.cmx typing/path.cmx \
-    parsing/parsetree.cmi typing/mtype.cmx utils/misc.cmx \
+    typing/typecore.cmx typing/typeclass.cmx hashing/transig.cmx \
+    typing/subst.cmx typing/stypes.cmx typing/printtyp.cmx \
+    polymarshal/polymarshal.cmx typing/path.cmx parsing/parsetree.cmx \
+    hashing/normtrans.cmx typing/mtype.cmx utils/misc.cmx \
     parsing/longident.cmx parsing/location.cmx typing/includemod.cmx \
     typing/ident.cmx typing/env.cmx typing/ctype.cmx utils/config.cmx \
     utils/clflags.cmx typing/btype.cmx typing/typemod.cmi 
 typing/types.cmo: typing/primitive.cmi typing/path.cmi utils/misc.cmi \
     typing/ident.cmi parsing/asttypes.cmi typing/types.cmi 
 typing/types.cmx: typing/primitive.cmx typing/path.cmx utils/misc.cmx \
-    typing/ident.cmx parsing/asttypes.cmi typing/types.cmi 
+    typing/ident.cmx parsing/asttypes.cmx typing/types.cmi 
 typing/typetexp.cmo: utils/warnings.cmi typing/types.cmi utils/tbl.cmi \
     typing/printtyp.cmi typing/path.cmi parsing/parsetree.cmi utils/misc.cmi \
     parsing/longident.cmi parsing/location.cmi typing/env.cmi \
     typing/ctype.cmi typing/btype.cmi typing/typetexp.cmi 
 typing/typetexp.cmx: utils/warnings.cmx typing/types.cmx utils/tbl.cmx \
-    typing/printtyp.cmx typing/path.cmx parsing/parsetree.cmi utils/misc.cmx \
+    typing/printtyp.cmx typing/path.cmx parsing/parsetree.cmx utils/misc.cmx \
     parsing/longident.cmx parsing/location.cmx typing/env.cmx \
     typing/ctype.cmx typing/btype.cmx typing/typetexp.cmi 
 typing/unused_var.cmo: utils/warnings.cmi parsing/parsetree.cmi \
     parsing/longident.cmi parsing/location.cmi parsing/asttypes.cmi \
     typing/unused_var.cmi 
-typing/unused_var.cmx: utils/warnings.cmx parsing/parsetree.cmi \
-    parsing/longident.cmx parsing/location.cmx parsing/asttypes.cmi \
+typing/unused_var.cmx: utils/warnings.cmx parsing/parsetree.cmx \
+    parsing/longident.cmx parsing/location.cmx parsing/asttypes.cmx \
     typing/unused_var.cmi 
 bytecomp/bytegen.cmi: bytecomp/lambda.cmi bytecomp/instruct.cmi 
 bytecomp/bytelink.cmi: bytecomp/symtable.cmi bytecomp/emitcode.cmi 
@@ -293,7 +303,7 @@
 bytecomp/bytegen.cmx: typing/types.cmx bytecomp/switch.cmx \
     typing/primitive.cmx utils/misc.cmx bytecomp/lambda.cmx \
     bytecomp/instruct.cmx typing/ident.cmx utils/config.cmx \
-    parsing/asttypes.cmi bytecomp/bytegen.cmi 
+    parsing/asttypes.cmx bytecomp/bytegen.cmi 
 bytecomp/bytelibrarian.cmo: utils/misc.cmi bytecomp/emitcode.cmi \
     utils/config.cmi utils/clflags.cmi bytecomp/bytelink.cmi \
     bytecomp/bytelibrarian.cmi 
@@ -330,7 +340,7 @@
 bytecomp/emitcode.cmx: bytecomp/translmod.cmx bytecomp/opcodes.cmx \
     utils/misc.cmx bytecomp/meta.cmx bytecomp/lambda.cmx \
     bytecomp/instruct.cmx typing/ident.cmx typing/env.cmx utils/config.cmx \
-    utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmi \
+    utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmx \
     bytecomp/emitcode.cmi 
 bytecomp/instruct.cmo: typing/types.cmi parsing/location.cmi \
     bytecomp/lambda.cmi typing/ident.cmi typing/env.cmi bytecomp/instruct.cmi 
@@ -341,7 +351,7 @@
     parsing/asttypes.cmi bytecomp/lambda.cmi 
 bytecomp/lambda.cmx: typing/types.cmx typing/primitive.cmx typing/path.cmx \
     utils/misc.cmx parsing/location.cmx typing/ident.cmx typing/env.cmx \
-    parsing/asttypes.cmi bytecomp/lambda.cmi 
+    parsing/asttypes.cmx bytecomp/lambda.cmi 
 bytecomp/matching.cmo: typing/types.cmi bytecomp/typeopt.cmi \
     typing/typedtree.cmi bytecomp/switch.cmi bytecomp/printlambda.cmi \
     typing/primitive.cmi typing/predef.cmi typing/parmatch.cmi utils/misc.cmi \
@@ -351,7 +361,7 @@
     typing/typedtree.cmx bytecomp/switch.cmx bytecomp/printlambda.cmx \
     typing/primitive.cmx typing/predef.cmx typing/parmatch.cmx utils/misc.cmx \
     parsing/location.cmx bytecomp/lambda.cmx typing/ident.cmx \
-    typing/btype.cmx parsing/asttypes.cmi bytecomp/matching.cmi 
+    typing/btype.cmx parsing/asttypes.cmx bytecomp/matching.cmi 
 bytecomp/meta.cmo: bytecomp/meta.cmi 
 bytecomp/meta.cmx: bytecomp/meta.cmi 
 bytecomp/printinstr.cmo: bytecomp/printlambda.cmi parsing/location.cmi \
@@ -365,13 +375,13 @@
     parsing/asttypes.cmi bytecomp/printlambda.cmi 
 bytecomp/printlambda.cmx: typing/types.cmx typing/primitive.cmx \
     parsing/location.cmx bytecomp/lambda.cmx typing/ident.cmx \
-    parsing/asttypes.cmi bytecomp/printlambda.cmi 
+    parsing/asttypes.cmx bytecomp/printlambda.cmi 
 bytecomp/runtimedef.cmo: bytecomp/runtimedef.cmi 
 bytecomp/runtimedef.cmx: bytecomp/runtimedef.cmi 
 bytecomp/simplif.cmo: bytecomp/lambda.cmi typing/ident.cmi utils/clflags.cmi \
     parsing/asttypes.cmi bytecomp/simplif.cmi 
 bytecomp/simplif.cmx: bytecomp/lambda.cmx typing/ident.cmx utils/clflags.cmx \
-    parsing/asttypes.cmi bytecomp/simplif.cmi 
+    parsing/asttypes.cmx bytecomp/simplif.cmi 
 bytecomp/switch.cmo: bytecomp/switch.cmi 
 bytecomp/switch.cmx: bytecomp/switch.cmi 
 bytecomp/symtable.cmo: utils/tbl.cmi bytecomp/runtimedef.cmi \
@@ -381,7 +391,7 @@
 bytecomp/symtable.cmx: utils/tbl.cmx bytecomp/runtimedef.cmx \
     typing/predef.cmx utils/misc.cmx bytecomp/meta.cmx bytecomp/lambda.cmx \
     typing/ident.cmx bytecomp/emitcode.cmx bytecomp/dll.cmx utils/clflags.cmx \
-    bytecomp/bytesections.cmx parsing/asttypes.cmi bytecomp/symtable.cmi 
+    bytecomp/bytesections.cmx parsing/asttypes.cmx bytecomp/symtable.cmi 
 bytecomp/translclass.cmo: typing/types.cmi bytecomp/typeopt.cmi \
     typing/typedtree.cmi typing/typeclass.cmi bytecomp/translobj.cmi \
     bytecomp/translcore.cmi typing/path.cmi utils/misc.cmi \
@@ -393,38 +403,42 @@
     bytecomp/translcore.cmx typing/path.cmx utils/misc.cmx \
     bytecomp/matching.cmx parsing/location.cmx bytecomp/lambda.cmx \
     typing/ident.cmx typing/env.cmx typing/ctype.cmx utils/clflags.cmx \
-    typing/btype.cmx parsing/asttypes.cmi bytecomp/translclass.cmi 
+    typing/btype.cmx parsing/asttypes.cmx bytecomp/translclass.cmi 
 bytecomp/translcore.cmo: typing/types.cmi bytecomp/typeopt.cmi \
     typing/typedtree.cmi bytecomp/translobj.cmi typing/primitive.cmi \
-    typing/predef.cmi typing/path.cmi utils/misc.cmi bytecomp/matching.cmi \
-    parsing/location.cmi bytecomp/lambda.cmi typing/ident.cmi typing/env.cmi \
-    utils/config.cmi utils/clflags.cmi typing/btype.cmi parsing/asttypes.cmi \
-    bytecomp/translcore.cmi 
+    typing/predef.cmi polymarshal/polymarshal.cmi typing/path.cmi \
+    utils/misc.cmi bytecomp/matching.cmi parsing/longident.cmi \
+    parsing/location.cmi bytecomp/lambda.cmi typing/ident.cmi \
+    hashing/hashpackage.cmi typing/env.cmi utils/config.cmi utils/clflags.cmi \
+    typing/btype.cmi parsing/asttypes.cmi bytecomp/translcore.cmi 
 bytecomp/translcore.cmx: typing/types.cmx bytecomp/typeopt.cmx \
     typing/typedtree.cmx bytecomp/translobj.cmx typing/primitive.cmx \
-    typing/predef.cmx typing/path.cmx utils/misc.cmx bytecomp/matching.cmx \
-    parsing/location.cmx bytecomp/lambda.cmx typing/ident.cmx typing/env.cmx \
-    utils/config.cmx utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmi \
-    bytecomp/translcore.cmi 
+    typing/predef.cmx polymarshal/polymarshal.cmx typing/path.cmx \
+    utils/misc.cmx bytecomp/matching.cmx parsing/longident.cmx \
+    parsing/location.cmx bytecomp/lambda.cmx typing/ident.cmx \
+    hashing/hashpackage.cmx typing/env.cmx utils/config.cmx utils/clflags.cmx \
+    typing/btype.cmx parsing/asttypes.cmx bytecomp/translcore.cmi 
 bytecomp/translmod.cmo: typing/types.cmi typing/typedtree.cmi \
     bytecomp/translobj.cmi bytecomp/translcore.cmi bytecomp/translclass.cmi \
     typing/printtyp.cmi typing/primitive.cmi typing/predef.cmi \
-    typing/path.cmi typing/mtype.cmi utils/misc.cmi parsing/longident.cmi \
-    parsing/location.cmi bytecomp/lambda.cmi typing/ident.cmi typing/env.cmi \
-    typing/ctype.cmi parsing/asttypes.cmi bytecomp/translmod.cmi 
+    polymarshal/polymarshal.cmi typing/path.cmi typing/mtype.cmi \
+    utils/misc.cmi parsing/longident.cmi parsing/location.cmi \
+    bytecomp/lambda.cmi typing/ident.cmi typing/env.cmi typing/ctype.cmi \
+    utils/clflags.cmi parsing/asttypes.cmi bytecomp/translmod.cmi 
 bytecomp/translmod.cmx: typing/types.cmx typing/typedtree.cmx \
     bytecomp/translobj.cmx bytecomp/translcore.cmx bytecomp/translclass.cmx \
     typing/printtyp.cmx typing/primitive.cmx typing/predef.cmx \
-    typing/path.cmx typing/mtype.cmx utils/misc.cmx parsing/longident.cmx \
-    parsing/location.cmx bytecomp/lambda.cmx typing/ident.cmx typing/env.cmx \
-    typing/ctype.cmx parsing/asttypes.cmi bytecomp/translmod.cmi 
+    polymarshal/polymarshal.cmx typing/path.cmx typing/mtype.cmx \
+    utils/misc.cmx parsing/longident.cmx parsing/location.cmx \
+    bytecomp/lambda.cmx typing/ident.cmx typing/env.cmx typing/ctype.cmx \
+    utils/clflags.cmx parsing/asttypes.cmx bytecomp/translmod.cmi 
 bytecomp/translobj.cmo: typing/primitive.cmi utils/misc.cmi \
     parsing/longident.cmi bytecomp/lambda.cmi typing/ident.cmi typing/env.cmi \
     utils/clflags.cmi typing/btype.cmi parsing/asttypes.cmi \
     bytecomp/translobj.cmi 
 bytecomp/translobj.cmx: typing/primitive.cmx utils/misc.cmx \
     parsing/longident.cmx bytecomp/lambda.cmx typing/ident.cmx typing/env.cmx \
-    utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmi \
+    utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmx \
     bytecomp/translobj.cmi 
 bytecomp/typeopt.cmo: typing/types.cmi typing/typedtree.cmi \
     typing/primitive.cmi typing/predef.cmi typing/path.cmi utils/misc.cmi \
@@ -433,7 +447,7 @@
 bytecomp/typeopt.cmx: typing/types.cmx typing/typedtree.cmx \
     typing/primitive.cmx typing/predef.cmx typing/path.cmx utils/misc.cmx \
     bytecomp/lambda.cmx typing/ident.cmx typing/env.cmx typing/ctype.cmx \
-    parsing/asttypes.cmi bytecomp/typeopt.cmi 
+    parsing/asttypes.cmx bytecomp/typeopt.cmi 
 asmcomp/asmgen.cmi: bytecomp/lambda.cmi asmcomp/cmm.cmi 
 asmcomp/asmlink.cmi: asmcomp/compilenv.cmi 
 asmcomp/clambda.cmi: bytecomp/lambda.cmi typing/ident.cmi \
@@ -510,14 +524,14 @@
 asmcomp/clambda.cmo: bytecomp/lambda.cmi typing/ident.cmi \
     parsing/asttypes.cmi asmcomp/clambda.cmi 
 asmcomp/clambda.cmx: bytecomp/lambda.cmx typing/ident.cmx \
-    parsing/asttypes.cmi asmcomp/clambda.cmi 
+    parsing/asttypes.cmx asmcomp/clambda.cmi 
 asmcomp/closure.cmo: utils/tbl.cmi bytecomp/switch.cmi typing/primitive.cmi \
     utils/misc.cmi bytecomp/lambda.cmi typing/ident.cmi asmcomp/compilenv.cmi \
     utils/clflags.cmi asmcomp/clambda.cmi parsing/asttypes.cmi \
     asmcomp/closure.cmi 
 asmcomp/closure.cmx: utils/tbl.cmx bytecomp/switch.cmx typing/primitive.cmx \
     utils/misc.cmx bytecomp/lambda.cmx typing/ident.cmx asmcomp/compilenv.cmx \
-    utils/clflags.cmx asmcomp/clambda.cmx parsing/asttypes.cmi \
+    utils/clflags.cmx asmcomp/clambda.cmx parsing/asttypes.cmx \
     asmcomp/closure.cmi 
 asmcomp/cmm.cmo: typing/ident.cmi asmcomp/arch.cmo asmcomp/cmm.cmi 
 asmcomp/cmm.cmx: typing/ident.cmx asmcomp/arch.cmx asmcomp/cmm.cmi 
@@ -529,7 +543,7 @@
 asmcomp/cmmgen.cmx: typing/types.cmx bytecomp/switch.cmx asmcomp/proc.cmx \
     typing/primitive.cmx utils/misc.cmx bytecomp/lambda.cmx typing/ident.cmx \
     utils/config.cmx asmcomp/compilenv.cmx asmcomp/cmm.cmx utils/clflags.cmx \
-    asmcomp/clambda.cmx parsing/asttypes.cmi asmcomp/arch.cmx \
+    asmcomp/clambda.cmx parsing/asttypes.cmx asmcomp/arch.cmx \
     asmcomp/cmmgen.cmi 
 asmcomp/codegen.cmo: asmcomp/split.cmi asmcomp/spill.cmi asmcomp/reload.cmi \
     asmcomp/reg.cmi asmcomp/printmach.cmi asmcomp/printlinear.cmi \
@@ -554,11 +568,11 @@
 asmcomp/emit.cmo: asmcomp/reg.cmi asmcomp/proc.cmi utils/misc.cmi \
     asmcomp/mach.cmi parsing/location.cmi asmcomp/linearize.cmi \
     asmcomp/emitaux.cmi utils/config.cmi asmcomp/compilenv.cmi \
-    asmcomp/cmm.cmi asmcomp/arch.cmo asmcomp/emit.cmi 
+    asmcomp/cmm.cmi utils/clflags.cmi asmcomp/arch.cmo asmcomp/emit.cmi 
 asmcomp/emit.cmx: asmcomp/reg.cmx asmcomp/proc.cmx utils/misc.cmx \
     asmcomp/mach.cmx parsing/location.cmx asmcomp/linearize.cmx \
     asmcomp/emitaux.cmx utils/config.cmx asmcomp/compilenv.cmx \
-    asmcomp/cmm.cmx asmcomp/arch.cmx asmcomp/emit.cmi 
+    asmcomp/cmm.cmx utils/clflags.cmx asmcomp/arch.cmx asmcomp/emit.cmi 
 asmcomp/emitaux.cmo: asmcomp/emitaux.cmi 
 asmcomp/emitaux.cmx: asmcomp/emitaux.cmi 
 asmcomp/interf.cmo: asmcomp/reg.cmi asmcomp/proc.cmi utils/misc.cmi \
@@ -595,8 +609,10 @@
     asmcomp/arch.cmx asmcomp/proc.cmi 
 asmcomp/reg.cmo: asmcomp/cmm.cmi asmcomp/reg.cmi 
 asmcomp/reg.cmx: asmcomp/cmm.cmx asmcomp/reg.cmi 
-asmcomp/reload.cmo: asmcomp/reloadgen.cmi asmcomp/reload.cmi 
-asmcomp/reload.cmx: asmcomp/reloadgen.cmx asmcomp/reload.cmi 
+asmcomp/reload.cmo: asmcomp/reloadgen.cmi asmcomp/reg.cmi asmcomp/mach.cmi \
+    asmcomp/cmm.cmi asmcomp/arch.cmo asmcomp/reload.cmi 
+asmcomp/reload.cmx: asmcomp/reloadgen.cmx asmcomp/reg.cmx asmcomp/mach.cmx \
+    asmcomp/cmm.cmx asmcomp/arch.cmx asmcomp/reload.cmi 
 asmcomp/reloadgen.cmo: asmcomp/reg.cmi utils/misc.cmi asmcomp/mach.cmi \
     asmcomp/reloadgen.cmi 
 asmcomp/reloadgen.cmx: asmcomp/reg.cmx utils/misc.cmx asmcomp/mach.cmx \
@@ -607,20 +623,20 @@
 asmcomp/schedgen.cmx: asmcomp/reg.cmx utils/misc.cmx asmcomp/mach.cmx \
     asmcomp/linearize.cmx asmcomp/cmm.cmx asmcomp/arch.cmx \
     asmcomp/schedgen.cmi 
-asmcomp/scheduling.cmo: asmcomp/schedgen.cmi asmcomp/mach.cmi \
-    asmcomp/arch.cmo asmcomp/scheduling.cmi 
-asmcomp/scheduling.cmx: asmcomp/schedgen.cmx asmcomp/mach.cmx \
-    asmcomp/arch.cmx asmcomp/scheduling.cmi 
+asmcomp/scheduling.cmo: asmcomp/schedgen.cmi asmcomp/scheduling.cmi 
+asmcomp/scheduling.cmx: asmcomp/schedgen.cmx asmcomp/scheduling.cmi 
 asmcomp/selectgen.cmo: utils/tbl.cmi asmcomp/reg.cmi asmcomp/proc.cmi \
     utils/misc.cmi asmcomp/mach.cmi typing/ident.cmi asmcomp/cmm.cmi \
     asmcomp/arch.cmo asmcomp/selectgen.cmi 
 asmcomp/selectgen.cmx: utils/tbl.cmx asmcomp/reg.cmx asmcomp/proc.cmx \
     utils/misc.cmx asmcomp/mach.cmx typing/ident.cmx asmcomp/cmm.cmx \
     asmcomp/arch.cmx asmcomp/selectgen.cmi 
-asmcomp/selection.cmo: asmcomp/selectgen.cmi asmcomp/reg.cmi utils/misc.cmi \
-    asmcomp/mach.cmi asmcomp/cmm.cmi asmcomp/arch.cmo asmcomp/selection.cmi 
-asmcomp/selection.cmx: asmcomp/selectgen.cmx asmcomp/reg.cmx utils/misc.cmx \
-    asmcomp/mach.cmx asmcomp/cmm.cmx asmcomp/arch.cmx asmcomp/selection.cmi 
+asmcomp/selection.cmo: asmcomp/selectgen.cmi asmcomp/reg.cmi asmcomp/proc.cmi \
+    utils/misc.cmi asmcomp/mach.cmi asmcomp/cmm.cmi asmcomp/arch.cmo \
+    asmcomp/selection.cmi 
+asmcomp/selection.cmx: asmcomp/selectgen.cmx asmcomp/reg.cmx asmcomp/proc.cmx \
+    utils/misc.cmx asmcomp/mach.cmx asmcomp/cmm.cmx asmcomp/arch.cmx \
+    asmcomp/selection.cmi 
 asmcomp/spill.cmo: asmcomp/reg.cmi asmcomp/proc.cmi utils/misc.cmi \
     asmcomp/mach.cmi asmcomp/spill.cmi 
 asmcomp/spill.cmx: asmcomp/reg.cmx asmcomp/proc.cmx utils/misc.cmx \
@@ -713,6 +729,20 @@
     utils/ccomp.cmi driver/pparse.cmi 
 driver/pparse.cmx: utils/misc.cmx parsing/location.cmx utils/clflags.cmx \
     utils/ccomp.cmx driver/pparse.cmi 
+polymarshal/polymarshal.cmi: typing/types.cmi typing/typedtree.cmi \
+    parsing/location.cmi bytecomp/lambda.cmi typing/ident.cmi typing/env.cmi 
+polymarshal/polymarshal.cmo: typing/types.cmi typing/typedtree.cmi \
+    typing/typecore.cmi typing/printtyp.cmi bytecomp/printlambda.cmi \
+    typing/primitive.cmi typing/predef.cmi typing/path.cmi \
+    typing/outcometree.cmi hashing/normtypes.cmo parsing/location.cmi \
+    bytecomp/lambda.cmi typing/ident.cmi typing/env.cmi typing/ctype.cmi \
+    utils/clflags.cmi parsing/asttypes.cmi polymarshal/polymarshal.cmi 
+polymarshal/polymarshal.cmx: typing/types.cmx typing/typedtree.cmx \
+    typing/typecore.cmx typing/printtyp.cmx bytecomp/printlambda.cmx \
+    typing/primitive.cmx typing/predef.cmx typing/path.cmx \
+    typing/outcometree.cmx hashing/normtypes.cmx parsing/location.cmx \
+    bytecomp/lambda.cmx typing/ident.cmx typing/env.cmx typing/ctype.cmx \
+    utils/clflags.cmx parsing/asttypes.cmx polymarshal/polymarshal.cmi 
 toplevel/genprintval.cmi: typing/types.cmi typing/path.cmi \
     typing/outcometree.cmi typing/env.cmi 
 toplevel/topdirs.cmi: parsing/longident.cmi 
@@ -730,7 +760,7 @@
     parsing/longident.cmi typing/ident.cmi typing/env.cmi typing/datarepr.cmi \
     typing/ctype.cmi typing/btype.cmi toplevel/genprintval.cmi 
 toplevel/genprintval.cmx: typing/types.cmx typing/printtyp.cmx \
-    typing/predef.cmx typing/path.cmx typing/outcometree.cmi utils/misc.cmx \
+    typing/predef.cmx typing/path.cmx typing/outcometree.cmx utils/misc.cmx \
     parsing/longident.cmx typing/ident.cmx typing/env.cmx typing/datarepr.cmx \
     typing/ctype.cmx typing/btype.cmx toplevel/genprintval.cmi 
 toplevel/topdirs.cmo: utils/warnings.cmi typing/types.cmi toplevel/trace.cmi \
@@ -751,22 +781,24 @@
     typing/typedtree.cmi typing/typecore.cmi bytecomp/translmod.cmi \
     bytecomp/symtable.cmi bytecomp/simplif.cmi typing/printtyp.cmi \
     bytecomp/printlambda.cmi bytecomp/printinstr.cmi parsing/printast.cmi \
-    typing/predef.cmi typing/path.cmi parsing/parsetree.cmi parsing/parse.cmi \
-    typing/outcometree.cmi typing/oprint.cmi utils/misc.cmi bytecomp/meta.cmi \
-    parsing/longident.cmi parsing/location.cmi parsing/lexer.cmi \
-    typing/ident.cmi toplevel/genprintval.cmi driver/errors.cmi \
-    typing/env.cmi bytecomp/emitcode.cmi bytecomp/dll.cmi utils/consistbl.cmi \
+    typing/predef.cmi polymarshal/polymarshal.cmi typing/path.cmi \
+    parsing/parsetree.cmi parsing/parse.cmi typing/outcometree.cmi \
+    typing/oprint.cmi utils/misc.cmi bytecomp/meta.cmi parsing/longident.cmi \
+    parsing/location.cmi parsing/lexer.cmi typing/ident.cmi \
+    toplevel/genprintval.cmi driver/errors.cmi typing/env.cmi \
+    bytecomp/emitcode.cmi bytecomp/dll.cmi utils/consistbl.cmi \
     utils/config.cmi driver/compile.cmi utils/clflags.cmi \
     bytecomp/bytegen.cmi typing/btype.cmi toplevel/toploop.cmi 
 toplevel/toploop.cmx: utils/warnings.cmx typing/types.cmx typing/typemod.cmx \
     typing/typedtree.cmx typing/typecore.cmx bytecomp/translmod.cmx \
     bytecomp/symtable.cmx bytecomp/simplif.cmx typing/printtyp.cmx \
     bytecomp/printlambda.cmx bytecomp/printinstr.cmx parsing/printast.cmx \
-    typing/predef.cmx typing/path.cmx parsing/parsetree.cmi parsing/parse.cmx \
-    typing/outcometree.cmi typing/oprint.cmx utils/misc.cmx bytecomp/meta.cmx \
-    parsing/longident.cmx parsing/location.cmx parsing/lexer.cmx \
-    typing/ident.cmx toplevel/genprintval.cmx driver/errors.cmx \
-    typing/env.cmx bytecomp/emitcode.cmx bytecomp/dll.cmx utils/consistbl.cmx \
+    typing/predef.cmx polymarshal/polymarshal.cmx typing/path.cmx \
+    parsing/parsetree.cmx parsing/parse.cmx typing/outcometree.cmx \
+    typing/oprint.cmx utils/misc.cmx bytecomp/meta.cmx parsing/longident.cmx \
+    parsing/location.cmx parsing/lexer.cmx typing/ident.cmx \
+    toplevel/genprintval.cmx driver/errors.cmx typing/env.cmx \
+    bytecomp/emitcode.cmx bytecomp/dll.cmx utils/consistbl.cmx \
     utils/config.cmx driver/compile.cmx utils/clflags.cmx \
     bytecomp/bytegen.cmx typing/btype.cmx toplevel/toploop.cmi 
 toplevel/topmain.cmo: utils/warnings.cmi toplevel/toploop.cmi \
@@ -775,11 +807,64 @@
 toplevel/topmain.cmx: utils/warnings.cmx toplevel/toploop.cmx \
     toplevel/topdirs.cmx utils/misc.cmx driver/errors.cmx utils/config.cmx \
     utils/clflags.cmx toplevel/topmain.cmi 
-toplevel/topstart.cmo: toplevel/topmain.cmi 
-toplevel/topstart.cmx: toplevel/topmain.cmx 
 toplevel/trace.cmo: typing/types.cmi toplevel/toploop.cmi typing/printtyp.cmi \
     typing/predef.cmi typing/path.cmi utils/misc.cmi bytecomp/meta.cmi \
     parsing/longident.cmi typing/ctype.cmi toplevel/trace.cmi 
 toplevel/trace.cmx: typing/types.cmx toplevel/toploop.cmx typing/printtyp.cmx \
     typing/predef.cmx typing/path.cmx utils/misc.cmx bytecomp/meta.cmx \
     parsing/longident.cmx typing/ctype.cmx toplevel/trace.cmi 
+hashing/hashpackage.cmi: typing/typedtree.cmi 
+hashing/hashpackage.cmo: typing/types.cmi typing/typedtree.cmi \
+    typing/printtyp.cmi typing/primitive.cmi typing/predef.cmi \
+    typing/path.cmi parsing/longident.cmi parsing/location.cmi \
+    typing/ident.cmi typing/env.cmi typing/ctype.cmi parsing/asttypes.cmi \
+    hashing/hashpackage.cmi 
+hashing/hashpackage.cmx: typing/types.cmx typing/typedtree.cmx \
+    typing/printtyp.cmx typing/primitive.cmx typing/predef.cmx \
+    typing/path.cmx parsing/longident.cmx parsing/location.cmx \
+    typing/ident.cmx typing/env.cmx typing/ctype.cmx parsing/asttypes.cmx \
+    hashing/hashpackage.cmi 
+hashing/normtrans.cmo: typing/types.cmi typing/typedtree.cmi \
+    hashing/transig.cmo typing/printtyp.cmi typing/primitive.cmi \
+    typing/predef.cmi typing/path.cmi hashing/npretty.cmo \
+    hashing/normtypedecl.cmo hashing/normtree.cmo parsing/longident.cmi \
+    parsing/location.cmi typing/ident.cmi hashing/hashpackage.cmi \
+    typing/env.cmi typing/ctype.cmi utils/clflags.cmi parsing/asttypes.cmi 
+hashing/normtrans.cmx: typing/types.cmx typing/typedtree.cmx \
+    hashing/transig.cmx typing/printtyp.cmx typing/primitive.cmx \
+    typing/predef.cmx typing/path.cmx hashing/npretty.cmx \
+    hashing/normtypedecl.cmx hashing/normtree.cmx parsing/longident.cmx \
+    parsing/location.cmx typing/ident.cmx hashing/hashpackage.cmx \
+    typing/env.cmx typing/ctype.cmx utils/clflags.cmx parsing/asttypes.cmx 
+hashing/normtree.cmo: typing/types.cmi typing/typedtree.cmi \
+    typing/primitive.cmi hashing/normtypedecl.cmo hashing/hashpackage.cmi \
+    parsing/asttypes.cmi 
+hashing/normtree.cmx: typing/types.cmx typing/typedtree.cmx \
+    typing/primitive.cmx hashing/normtypedecl.cmx hashing/hashpackage.cmx \
+    parsing/asttypes.cmx 
+hashing/normtypedecl.cmo: typing/types.cmi typing/printtyp.cmi \
+    typing/predef.cmi typing/path.cmi typing/ident.cmi typing/env.cmi \
+    typing/ctype.cmi utils/clflags.cmi parsing/asttypes.cmi 
+hashing/normtypedecl.cmx: typing/types.cmx typing/printtyp.cmx \
+    typing/predef.cmx typing/path.cmx typing/ident.cmx typing/env.cmx \
+    typing/ctype.cmx utils/clflags.cmx parsing/asttypes.cmx 
+hashing/normtypes.cmo: typing/types.cmi typing/typedtree.cmi \
+    typing/printtyp.cmi typing/predef.cmi typing/path.cmi \
+    parsing/longident.cmi parsing/location.cmi typing/ident.cmi \
+    typing/env.cmi typing/ctype.cmi parsing/asttypes.cmi 
+hashing/normtypes.cmx: typing/types.cmx typing/typedtree.cmx \
+    typing/printtyp.cmx typing/predef.cmx typing/path.cmx \
+    parsing/longident.cmx parsing/location.cmx typing/ident.cmx \
+    typing/env.cmx typing/ctype.cmx parsing/asttypes.cmx 
+hashing/npretty.cmo: hashing/normtypedecl.cmo hashing/normtree.cmo \
+    hashing/hashpackage.cmi parsing/asttypes.cmi 
+hashing/npretty.cmx: hashing/normtypedecl.cmx hashing/normtree.cmx \
+    hashing/hashpackage.cmx parsing/asttypes.cmx 
+hashing/pptypedtree.cmo: typing/types.cmi typing/typedtree.cmi \
+    parsing/asttypes.cmi 
+hashing/pptypedtree.cmx: typing/types.cmx typing/typedtree.cmx \
+    parsing/asttypes.cmx 
+hashing/transig.cmo: typing/types.cmi typing/typedtree.cmi typing/predef.cmi \
+    typing/ident.cmi typing/ctype.cmi utils/clflags.cmi 
+hashing/transig.cmx: typing/types.cmx typing/typedtree.cmx typing/predef.cmx \
+    typing/ident.cmx typing/ctype.cmx utils/clflags.cmx 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/Changes	2006-01-04 13:05:49.000000000 +0000
+++ hashcaml/Changes	2006-04-24 12:23:34.000000000 +0100
@@ -1,38 +1,3 @@
-Objective Caml 3.09.1:
-----------------------
-
-Bug fixes:
-- compilers: raise not_found with -principal PR#3855
-- compilers: assert failure in typeclass.cml PR#3856
-- compilers: assert failure in typing/ctype.ml PR#3909
-- compilers: fatal error exception Ctype.Unify PR#3918
-- compilers: spurious warning Y PR#3868
-- compilers: spurious warning Z on loop index PR#3907
-- compilers: error message that emacs cannot parse
-- ocamlopt: problems with -for-pack/-pack PR#3825, PR#3826, PR#3919
-- ocamlopt: can't produce shared libraries on x86_64 PR#3869, PR#3924
-- ocamlopt: float alignment problem on SPARC PR#3944
-- ocamlopt: can't compile on MIPS PR#3936
-- runtime: missing dependence for ld.conf
-- runtime: missing dependence for .depend.nt PR#3880
-- runtime: memory leak in caml_register_named_value PR#3940
-- runtime: crash in Marshal.to_buffer PR#3879
-- stdlib: Sys.time giving wrong results on Mac OS X PR#3850
-- stdlib: Weak.get_copy causing random crashes in rare cases
-- stdlib, debugger, labltk: use TMPDIR if set PR#3895
-- stdlib: scanf bug on int32 and nativeint PR#3932
-- camlp4: mkcamlp4 option parsing problem PR#3941
-- camlp4: bug in pretty-printing of lazy/assert/new
-- camlp4: update the unmaintained makefile for _loc name
-- ocamldoc: several fixes see ocamldoc/Changes.txt
-- otherlibs/str: bug in long sequences of alternatives PR#3783
-- otherlibs/systhreads: deadlock in Windows PR#3910
-- tools: update dumpobj to handle new event format PR#3873
-- toplevel: activate warning Y in toplevel PR#3832
-
-New features:
-- otherlibs/labltk: browser uses menu bars instead of menu buttons
-
 Objective Caml 3.09.0:
 ----------------------
 
@@ -51,8 +16,8 @@
 Both compilers:
 - Added warnings 'Y' and 'Z' for local variables that are bound but
   never used.
-- Added warning for some uses non-returning functions (e.g. raise), when they
-  are passed extra arguments, or followed by extra statements.
+- Added warning for some uses non-returning functions (e.g. raise), when they are
+  passed extra arguments, or followed by extra statements.
 - Pattern matching: more prudent compilation in case of guards; fixed PR#3780.
 - Compilation of classes: reduction in size of generated code.
 - Compilation of "module rec" definitions: fixed a bad interaction with
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/INSTALL	2005-12-02 09:56:43.000000000 +0000
+++ hashcaml/INSTALL	2006-04-24 12:23:34.000000000 +0100
@@ -17,9 +17,6 @@
     limit stacksize 64M  # if your shell is zsh or tcsh
     ulimit -s 65536      # if your shell is bash
 
-* If you do not have write access to /tmp, you should set the environment
-  variable TMPDIR to the name of some other temporary directory.
-
 
 INSTALLATION INSTRUCTIONS
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/Makefile	2005-09-24 17:20:36.000000000 +0100
+++ hashcaml/Makefile	2006-04-24 12:23:36.000000000 +0100
@@ -1,4 +1,5 @@
 #########################################################################
+
 #                                                                       #
 #                            Objective Caml                             #
 #                                                                       #
@@ -17,7 +18,7 @@
 include config/Makefile
 include stdlib/StdlibModules
 
-CAMLC=boot/ocamlrun boot/ocamlc -nostdlib -I boot
+CAMLC=boot/ocamlrun boot/ocamlc -nostdlib -I boot -g
 CAMLOPT=boot/ocamlrun ./ocamlopt -nostdlib -I stdlib
 COMPFLAGS=-warn-error A $(INCLUDES)
 LINKFLAGS=
@@ -31,8 +32,8 @@
 SHELL=/bin/sh
 MKDIR=mkdir -p
 
-INCLUDES=-I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver \
-         -I toplevel
+INCLUDES=-I utils -I parsing -I hashing -I typing -I bytecomp -I asmcomp -I driver \
+         -I toplevel -I polymarshal
 
 UTILS=utils/misc.cmo utils/tbl.cmo utils/config.cmo \
   utils/clflags.cmo utils/terminfo.cmo utils/ccomp.cmo utils/warnings.cmo \
@@ -41,20 +42,27 @@
 OPTUTILS=$(UTILS)
 
 PARSING=parsing/linenum.cmo parsing/location.cmo parsing/longident.cmo \
-  parsing/syntaxerr.cmo parsing/parser.cmo \
-  parsing/lexer.cmo parsing/parse.cmo parsing/printast.cmo
+  parsing/syntaxerr.cmo parsing/asttypes.cmo parsing/parsetree.cmo parsing/parser.cmo \
+  parsing/lexer.cmo parsing/parse.cmo parsing/printast.cmo \
+  #parsing/asttypes.cmo
+
+POLYMARSHAL=polymarshal/polymarshal.cmo
 
 TYPING=typing/unused_var.cmo typing/ident.cmo typing/path.cmo \
   typing/primitive.cmo typing/types.cmo \
   typing/btype.cmo typing/oprint.cmo \
   typing/subst.cmo typing/predef.cmo \
   typing/datarepr.cmo typing/env.cmo \
-  typing/typedtree.cmo typing/ctype.cmo \
+  typing/ctype.cmo typing/typedtree.cmo \
   typing/printtyp.cmo typing/includeclass.cmo \
   typing/mtype.cmo typing/includecore.cmo \
   typing/includemod.cmo typing/parmatch.cmo \
   typing/typetexp.cmo typing/stypes.cmo typing/typecore.cmo \
   typing/typedecl.cmo typing/typeclass.cmo \
+  hashing/normtypedecl.cmo hashing/hashpackage.cmo \
+  hashing/normtree.cmo  hashing/normtypes.cmo \
+  hashing/npretty.cmo hashing/transig.cmo \
+  hashing/normtrans.cmo hashing/pptypedtree.cmo \
   typing/typemod.cmo
 
 COMP=bytecomp/lambda.cmo bytecomp/printlambda.cmo \
@@ -63,6 +71,28 @@
   bytecomp/translclass.cmo bytecomp/translmod.cmo \
   bytecomp/simplif.cmo bytecomp/runtimedef.cmo
 
+COMPTYPING=typing/unused_var.cmo typing/ident.cmo typing/path.cmo \
+  typing/primitive.cmo typing/types.cmo \
+  typing/btype.cmo typing/outcometree.cmo typing/oprint.cmo \
+  typing/subst.cmo typing/predef.cmo \
+  typing/datarepr.cmo typing/env.cmo \
+  typing/ctype.cmo typing/typedtree.cmo \
+  typing/printtyp.cmo typing/includeclass.cmo \
+  typing/mtype.cmo typing/includecore.cmo \
+  typing/includemod.cmo typing/parmatch.cmo \
+  typing/typetexp.cmo typing/stypes.cmo typing/typecore.cmo \
+  typing/typedecl.cmo typing/typeclass.cmo \
+  hashing/normtypes.cmo hashing/normtypedecl.cmo \
+  hashing/hashpackage.cmo hashing/normtree.cmo \
+  hashing/npretty.cmo hashing/transig.cmo \
+  hashing/normtrans.cmo hashing/pptypedtree.cmo \
+  bytecomp/lambda.cmo  bytecomp/printlambda.cmo polymarshal/polymarshal.cmo\
+  typing/typemod.cmo \
+  bytecomp/typeopt.cmo bytecomp/switch.cmo bytecomp/matching.cmo \
+  bytecomp/translobj.cmo bytecomp/translcore.cmo \
+  bytecomp/translclass.cmo bytecomp/translmod.cmo \
+  bytecomp/simplif.cmo bytecomp/runtimedef.cmo
+
 BYTECOMP=bytecomp/meta.cmo bytecomp/instruct.cmo bytecomp/bytegen.cmo \
   bytecomp/printinstr.cmo bytecomp/opcodes.cmo bytecomp/emitcode.cmo \
   bytecomp/bytesections.cmo bytecomp/dll.cmo bytecomp/symtable.cmo \
@@ -95,19 +125,36 @@
 TOPLEVELLIB=toplevel/toplevellib.cma
 TOPLEVELSTART=toplevel/topstart.cmo
 
-COMPOBJS=$(UTILS) $(PARSING) $(TYPING) $(COMP) $(BYTECOMP) $(DRIVER)
+COMPOBJS=$(UTILS) $(PARSING) \
+  $(COMPTYPING) $(BYTECOMP) $(DRIVER)
 
-TOPLIB=$(UTILS) $(PARSING) $(TYPING) $(COMP) $(BYTECOMP) $(TOPLEVEL)
+TOPLIB=$(UTILS) $(PARSING) $(COMPTYPING) \
+  $(BYTECOMP) $(TOPLEVEL)
 
 TOPOBJS=$(TOPLEVELLIB) $(TOPLEVELSTART)
 
-OPTOBJS=$(OPTUTILS) $(PARSING) $(TYPING) $(COMP) $(ASMCOMP) $(OPTDRIVER)
+OPTOBJS=$(OPTUTILS) $(PARSING) $(TYPING) $(POLYMARSHAL) \
+  $(COMP) $(ASMCOMP) $(OPTDRIVER)
 
-EXPUNGEOBJS=utils/misc.cmo utils/tbl.cmo \
+EXPUNGEOBJS=utils/misc.cmo utils/tbl.cmo parsing/asttypes.cmo \
   utils/config.cmo utils/clflags.cmo \
-  typing/ident.cmo typing/path.cmo typing/types.cmo typing/btype.cmo \
+  typing/ident.cmo parsing/longident.cmo typing/path.cmo \
+  typing/primitive.cmo typing/types.cmo typing/btype.cmo \
   typing/predef.cmo bytecomp/runtimedef.cmo bytecomp/bytesections.cmo \
-  bytecomp/dll.cmo bytecomp/meta.cmo bytecomp/symtable.cmo toplevel/expunge.cmo
+  typing/datarepr.cmo typing/subst.cmo utils/consistbl.cmo typing/env.cmo \
+  bytecomp/dll.cmo bytecomp/meta.cmo utils/terminfo.cmo parsing/linenum.cmo \
+  utils/warnings.cmo parsing/location.cmo bytecomp/lambda.cmo \
+  bytecomp/translobj.cmo typing/ctype.cmo typing/typedtree.cmo \
+  typing/parmatch.cmo bytecomp/printlambda.cmo bytecomp/typeopt.cmo \
+  bytecomp/switch.cmo bytecomp/matching.cmo typing/outcometree.cmo \
+  typing/oprint.cmo typing/printtyp.cmo hashing/hashpackage.cmo \
+  parsing/parsetree.cmo typing/typetexp.cmo typing/stypes.cmo \
+  typing/typecore.cmo hashing/normtypes.cmo polymarshal/polymarshal.cmo \
+  bytecomp/translcore.cmo typing/includeclass.cmo typing/includecore.cmo \
+  typing/typedecl.cmo typing/typeclass.cmo bytecomp/translclass.cmo \
+  typing/mtype.cmo bytecomp/translmod.cmo bytecomp/opcodes.cmo \
+  bytecomp/instruct.cmo bytecomp/emitcode.cmo bytecomp/symtable.cmo \
+  toplevel/expunge.cmo
 
 PERVASIVES=$(STDLIB_MODULES) outcometree topdirs toploop
 
@@ -122,8 +169,12 @@
 	@echo "should work.  But see the file INSTALL for more details."
 
 # Recompile the system using the bootstrap compiler
+#all: runtime ocamlc ocamllex ocamlyacc ocamltools library ocaml \
+#	otherlibraries camlp4out $(DEBUGGER) ocamldoc
+
+# Cut-down system to increase recompilation speed
 all: runtime ocamlc ocamllex ocamlyacc ocamltools library ocaml \
-  otherlibraries camlp4out $(DEBUGGER) ocamldoc
+     otherlibraries 
 
 # The compilation of ocaml will fail if the runtime has changed.
 # Never mind, just do make bootstrap to reach fixpoint again.
@@ -255,9 +306,9 @@
 	for i in $(OTHERLIBRARIES); do \
           (cd otherlibs/$$i; $(MAKE) install) || exit $$?; \
         done
-	cd ocamldoc; $(MAKE) install
+	#cd ocamldoc; $(MAKE) install
 	if test -f ocamlopt; then $(MAKE) installopt; else :; fi
-	cd camlp4; $(MAKE) install BINDIR=$(BINDIR) LIBDIR=$(LIBDIR) MANDIR=$(MANDIR)
+	#cd camlp4; $(MAKE) install BINDIR=$(BINDIR) LIBDIR=$(LIBDIR) MANDIR=$(MANDIR)
 	if test -f debugger/ocamldebug; then (cd debugger; $(MAKE) install); \
 	   else :; fi
 	cp config/Makefile $(LIBDIR)/Makefile.config
@@ -657,6 +708,7 @@
 	rm -f utils/*.cm[iox] utils/*.[so] utils/*~
 	rm -f parsing/*.cm[iox] parsing/*.[so] parsing/*~
 	rm -f typing/*.cm[iox] typing/*.[so] typing/*~
+	rm -f polymarshal/*.cm[iox] polymarshal/*.[so] polymarshal/*~
 	rm -f bytecomp/*.cm[iox] bytecomp/*.[so] bytecomp/*~
 	rm -f asmcomp/*.cm[iox] asmcomp/*.[so] asmcomp/*~
 	rm -f driver/*.cm[iox] driver/*.[so] driver/*~
@@ -665,7 +717,7 @@
 	rm -f *~
 
 depend: beforedepend
-	(for d in utils parsing typing bytecomp asmcomp driver toplevel; \
+	(for d in utils parsing typing bytecomp asmcomp driver polymarshal toplevel hashing; \
 	 do $(CAMLDEP) $(DEPFLAGS) $$d/*.mli $$d/*.ml; \
 	 done) > .depend
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/asmcomp/amd64/emit.mlp	2005-12-17 16:23:09.000000000 +0000
+++ hashcaml/asmcomp/amd64/emit.mlp	2006-04-24 12:23:18.000000000 +0100
@@ -534,12 +534,7 @@
             end
     | Lswitch jumptbl ->
         let lbl = new_label() in
-        if !pic_code then begin
-          `	leaq	{emit_label lbl}(%rip), %r11\n`;
-          `	jmp	*(%r11, {emit_reg i.arg.(0)}, 8)\n`
-        end else begin
-          `	jmp	*{emit_label lbl}(, {emit_reg i.arg.(0)}, 8)\n`
-        end;
+        `	jmp	*{emit_label lbl}(, {emit_reg i.arg.(0)}, 8)\n`;
         `	.section .rodata\n`;
         emit_align 8;
         `{emit_label lbl}:`;
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/asmcomp/amd64/proc.ml	2005-12-17 16:23:09.000000000 +0000
+++ hashcaml/asmcomp/amd64/proc.ml	2006-04-24 12:23:18.000000000 +0100
@@ -92,7 +92,6 @@
 let rax = phys_reg 0
 let rcx = phys_reg 5
 let rdx = phys_reg 4
-let r11 = phys_reg 9
 let rxmm15 = phys_reg 115
 
 let stack_slot slot ty =
@@ -170,7 +169,6 @@
   | Iop(Istore(Single, _)) -> [| rxmm15 |]
   | Iop(Ialloc _ | Iintop(Icomp _) | Iintop_imm((Idiv|Imod|Icomp _), _))
         -> [| rax |]
-  | Iswitch(_, _) when !pic_code -> [| r11 |]
   | _ -> [||]
 
 let destroyed_at_raise = all_phys_regs
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/asmcomp/asmpackager.ml	2005-12-17 16:49:57.000000000 +0000
+++ hashcaml/asmcomp/asmpackager.ml	2006-04-24 12:23:18.000000000 +0100
@@ -118,17 +118,17 @@
           (fun accu n -> if List.mem n accu then accu else n :: accu))
       [] lst in
   let units =
-    List.fold_right
-      (fun m accu ->
+    List.fold_left
+      (fun accu m ->
         match m.pm_kind with PM_intf -> accu | PM_impl info -> info :: accu)
-      members [] in
+      [] members in
   let ui = Compilenv.current_unit_infos() in
   let pkg_infos =
     { ui_name = ui.ui_name;
       ui_symbol = ui.ui_symbol;
       ui_defines =
-          List.flatten (List.map (fun info -> info.ui_defines) units) @
-          [ui.ui_symbol];
+          ui.ui_symbol ::
+          union (List.map (fun info -> info.ui_defines) units);
       ui_imports_cmi =
           (ui.ui_name, Env.crc_of_unit ui.ui_name) ::
           filter(Asmlink.extract_crc_interfaces());
@@ -194,7 +194,7 @@
   | Forward_reference(file, ident) ->
       fprintf ppf "Forward reference to %s in file %s" ident file
   | Wrong_for_pack(file, path) ->
-      fprintf ppf "File %s@ was not compiled with the `-for-pack %s' option"
+      fprintf ppf "File %s@ was not compiled with the `-pack %s' option"
               file path
   | File_not_found file ->
       fprintf ppf "File %s not found" file
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/asmcomp/closure.ml	2005-12-11 10:21:12.000000000 +0000
+++ hashcaml/asmcomp/closure.ml	2006-04-24 12:23:18.000000000 +0100
@@ -36,15 +36,6 @@
       Tbl.add id (Uprim(Pfield pos, [Uvar env_param]))
               (build_closure_env env_param (pos+1) rem)
 
-(* Auxiliary for accessing globals.  We change the name of the global
-   to the name of the corresponding asm symbol.  This is done here
-   and no longer in Cmmgen so that approximations stored in .cmx files
-   contain the right names if the -for-pack option is active. *)
-
-let getglobal id =
-  Uprim(Pgetglobal (Ident.create_persistent (Compilenv.symbol_for_global id)),
-        [])
-
 (* Check if a variable occurs in a [clambda] term. *)
 
 let occurs_var var u =
@@ -538,8 +529,7 @@
       end
   | Lprim(Pgetglobal id, []) as lam ->
       check_constant_result lam
-                            (getglobal id)
-                            (Compilenv.global_approx id)
+          (Uprim(Pgetglobal id, [])) (Compilenv.global_approx id)
   | Lprim(Pmakeblock(tag, mut) as prim, lams) ->
       let (ulams, approxs) = List.split (List.map (close fenv cenv) lams) in
       (Uprim(prim, ulams),
@@ -557,7 +547,7 @@
   | Lprim(Psetfield(n, _), [Lprim(Pgetglobal id, []); lam]) ->
       let (ulam, approx) = close fenv cenv lam in
       (!global_approx).(n) <- approx;
-      (Uprim(Psetfield(n, false), [getglobal id; ulam]),
+      (Uprim(Psetfield(n, false), [Uprim(Pgetglobal id, []); ulam]),
        Value_unknown)
   | Lprim(p, args) ->
       simplif_prim p (close_list_approx fenv cenv args)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/asmcomp/cmmgen.ml	2005-12-11 10:21:12.000000000 +0000
+++ hashcaml/asmcomp/cmmgen.ml	2006-04-24 12:23:18.000000000 +0100
@@ -853,7 +853,7 @@
   | Uprim(prim, args) ->
       begin match (simplif_primitive prim, args) with
         (Pgetglobal id, []) ->
-          Cconst_symbol (Ident.name id)
+          Cconst_symbol (Compilenv.symbol_for_global id)
       | (Pmakeblock(tag, mut), []) ->
           transl_constant(Const_block(tag, []))
       | (Pmakeblock(tag, mut), args) ->
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/asmrun/amd64.S	2005-12-18 15:42:06.000000000 +0000
+++ hashcaml/asmrun/amd64.S	2006-04-24 12:23:45.000000000 +0100
@@ -52,7 +52,7 @@
         pushq   %rdi
         pushq   %rbx
         pushq   %rax
-        movq    %rsp, caml_gc_regs(%rip)
+        movq    %rsp, caml_gc_regs
     /* Save floating-point registers */
         subq    $(16*8), %rsp
         movlpd  %xmm0, 0*8(%rsp)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/bytecomp/bytegen.ml	2005-08-25 16:35:16.000000000 +0100
+++ hashcaml/bytecomp/bytegen.ml	2006-04-24 12:23:39.000000000 +0100
@@ -353,6 +353,11 @@
   | Pbintcomp(bi, Cge) -> Kccall("caml_greaterequal", 2)
   | Pbigarrayref(n, _, _) -> Kccall("bigarray_get_" ^ string_of_int n, n + 1)
   | Pbigarrayset(n, _, _) -> Kccall("bigarray_set_" ^ string_of_int n, n + 2)
+  | Ppmconcatenate -> Kccall("caml_polymarshal_concatenate", 2)
+  | Ppmmakepackage -> Kccall("caml_polymarshal_make_package", 2)
+  | Ppmextractpackage -> Kccall("caml_polymarshal_extract_package", 2)
+  | Prandom256 -> Kccall("random256", 1)
+  | Pflattentyperep -> Kccall("flatten_typerep_block", 1)
   | _ -> fatal_error "Bytegen.comp_primitive"
 
 let is_immed n = immed_min <= n && n <= immed_max
@@ -371,6 +376,7 @@
    cont = list of instructions to execute afterwards
    Result = list of instructions that evaluate exp, then perform cont. *)
 
+let vid_prefix = "_tyrep_" (* FIXME *)
 let rec comp_expr env exp sz cont =
   if sz > !max_stack_used then max_stack_used := sz;
   match exp with
@@ -387,9 +393,27 @@
         let ofs = Ident.find_same id env.ce_rec in
         Koffsetclosure(ofs) :: cont
       with Not_found ->
+        (* FIXME *)
+
+        (* MUST BE SORTED OUT
+
+           also see comments in Polymarshal.rewrite_let_lambda_code that
+           are pertinent
+
+        *)
+        
+        let s = Ident.name id in
+          if (String.length s >= String.length vid_prefix) &&
+             (String.sub s 0 (String.length vid_prefix) = vid_prefix) then
+            (* we have found an unbound typerep identifier in
+               the lambda term. *)
+            Kconst (Const_block(0, [Const_base(Const_string "__DUMMY__")])) :: cont
+          else
+          begin
         Format.eprintf "%a@." Ident.print id;
         fatal_error ("Bytegen.comp_expr: var " ^ Ident.unique_name id)
       end
+      end
   | Lconst cst ->
       Kconst cst :: cont
   | Lapply(func, args) ->
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/bytecomp/lambda.ml	2005-08-25 16:35:16.000000000 +0100
+++ hashcaml/bytecomp/lambda.ml	2006-04-24 12:23:38.000000000 +0100
@@ -81,6 +81,12 @@
   (* Operations on big arrays *)
   | Pbigarrayref of int * bigarray_kind * bigarray_layout
   | Pbigarrayset of int * bigarray_kind * bigarray_layout
+  (* Polymorphic marshalling *)
+  | Ppmconcatenate
+  | Ppmmakepackage
+  | Ppmextractpackage
+  | Prandom256
+  | Pflattentyperep
 
 and comparison =
     Ceq | Cneq | Clt | Cgt | Cle | Cge
@@ -236,6 +242,68 @@
       Llet(Strict, id, arg, name_list (Lvar id :: names) rem) in
   name_list [] args
 
+module IdentSet =
+  Set.Make(struct
+    type t = Ident.t
+    let compare = compare
+  end)
+
+let collected_fun_idents = ref IdentSet.empty
+
+let rec fun_idents = function
+    Lvar _
+  | Lconst _ -> ()
+  | Lapply(fn, args) ->
+      fun_idents fn; List.iter fun_idents args
+  | Lfunction(kind, params, body) ->
+      List.iter
+        (fun param ->
+           collected_fun_idents := IdentSet.add param !collected_fun_idents)
+        params;
+      fun_idents body
+  | Llet(str, id, arg, body) ->
+      fun_idents arg; fun_idents body
+  | Lletrec(decl, body) ->
+      fun_idents body;
+      List.iter (fun (id, exp) -> fun_idents exp) decl
+  | Lprim(p, args) ->
+      List.iter fun_idents args
+  | Lswitch(arg, sw) ->
+      fun_idents arg; 
+      List.iter (fun (key, case) -> fun_idents case) sw.sw_consts;
+      List.iter (fun (key, case) -> fun_idents case) sw.sw_blocks;
+      begin match sw.sw_failaction with
+      | None -> ()
+      | Some l -> fun_idents l
+      end
+  | Lstaticraise (_,args) ->
+      List.iter fun_idents args
+  | Lstaticcatch(e1, (_,vars), e2) ->
+      fun_idents e1; fun_idents e2
+  | Ltrywith(e1, exn, e2) ->
+      fun_idents e1; fun_idents e2
+  | Lifthenelse(e1, e2, e3) ->
+      fun_idents e1; fun_idents e2; fun_idents e3
+  | Lsequence(e1, e2) ->
+      fun_idents e1; fun_idents e2
+  | Lwhile(e1, e2) ->
+      fun_idents e1; fun_idents e2
+  | Lfor(v, e1, e2, dir, e3) -> 
+      fun_idents e1; fun_idents e2; fun_idents e3
+  | Lassign(id, e) ->
+      fun_idents e
+  | Lsend (k, met, obj, args) ->
+      List.iter fun_idents (met::obj::args)
+  | Levent (lam, evt) ->
+      fun_idents lam
+  | Lifused (v, e) ->
+      fun_idents e
+
+let function_bound_variables lam =
+  collected_fun_idents := IdentSet.empty;
+  fun_idents lam;
+  !collected_fun_idents
+
 let rec iter f = function
     Lvar _
   | Lconst _ -> ()
@@ -281,12 +349,6 @@
   | Lifused (v, e) ->
       f e
 
-module IdentSet =
-  Set.Make(struct
-    type t = Ident.t
-    let compare = compare
-  end)
-
 let free_ids get l =
   let fv = ref IdentSet.empty in
   let rec free l =
@@ -352,7 +414,9 @@
   | Pdot(p, s, pos) ->
       Lprim(Pfield pos, [transl_path p])
   | Papply(p1, p2) ->
-      fatal_error "Lambda.transl_path"
+  (* This case arises in HashCaml when referencing "myname"s. *)
+      Lapply(transl_path p1, [transl_path p2])
+(*      fatal_error "Lambda.transl_path"*)
 
 (* Compile a sequence of expressions *)
 
@@ -403,6 +467,66 @@
   and subst_case (key, case) = (key, subst case)
   in subst lam
 
+let ids_seen = ref IdentSet.empty
+let sub = ref Ident.empty
+
+(* remove shadowing on Lfunction nodes *)
+let remove_shadowing lam =
+  let rec subst = function
+    Lvar id as l ->
+      (try Lvar (Ident.find_same id !sub) with Not_found -> l)
+  | Lconst sc as l -> l
+  | Lapply(fn, args) -> Lapply(subst fn, List.map subst args)
+  | Lfunction(kind, params, body) ->
+      let saved_ids_seen = !ids_seen in
+      let saved_sub = !sub in
+      let params' =
+        List.map (fun id ->
+                    let name =
+                      if IdentSet.mem id !ids_seen then
+                        (* name already seen => rename it *)
+                        let new_name = Ident.create (Ident.name id) in
+                        let _ = sub := Ident.add id new_name !sub in
+                          new_name
+                      else
+                        id
+                    in
+                    begin
+                      ids_seen := IdentSet.add name !ids_seen;
+                      name
+                    end) params
+      in
+      let ret = Lfunction(kind, params', subst body)
+      in (ids_seen := saved_ids_seen; sub := saved_sub; ret)
+  | Llet(str, id, arg, body) -> Llet(str, id, subst arg, subst body)
+  | Lletrec(decl, body) -> Lletrec(List.map subst_decl decl, subst body)
+  | Lprim(p, args) -> Lprim(p, List.map subst args)
+  | Lswitch(arg, sw) ->
+      Lswitch(subst arg,
+              {sw with sw_consts = List.map subst_case sw.sw_consts;
+                       sw_blocks = List.map subst_case sw.sw_blocks;
+                       sw_failaction =
+                         match sw.sw_failaction with
+                         | None -> None
+                         | Some l -> Some (subst l)})
+                   
+  | Lstaticraise (i,args) ->  Lstaticraise (i, List.map subst args)
+  | Lstaticcatch(e1, io, e2) -> Lstaticcatch(subst e1, io, subst e2)
+  | Ltrywith(e1, exn, e2) -> Ltrywith(subst e1, exn, subst e2)
+  | Lifthenelse(e1, e2, e3) -> Lifthenelse(subst e1, subst e2, subst e3)
+  | Lsequence(e1, e2) -> Lsequence(subst e1, subst e2)
+  | Lwhile(e1, e2) -> Lwhile(subst e1, subst e2)
+  | Lfor(v, e1, e2, dir, e3) -> Lfor(v, subst e1, subst e2, dir, subst e3) 
+  | Lassign(id, e) -> Lassign(id, subst e)
+  | Lsend (k, met, obj, args) ->
+      Lsend (k, subst met, subst obj, List.map subst args)
+  | Levent (lam, evt) -> Levent (subst lam, evt)
+  | Lifused (v, e) -> Lifused (v, subst e)
+  and subst_decl (id, exp) = (id, subst exp)
+  and subst_case (key, case) = (key, subst case)
+  in
+    ids_seen := IdentSet.empty;
+    subst lam
 
 (* To let-bind expressions to variables *)
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/bytecomp/lambda.mli	2005-08-25 16:35:16.000000000 +0100
+++ hashcaml/bytecomp/lambda.mli	2006-04-24 12:23:39.000000000 +0100
@@ -81,6 +81,12 @@
   (* Operations on big arrays *)
   | Pbigarrayref of int * bigarray_kind * bigarray_layout
   | Pbigarrayset of int * bigarray_kind * bigarray_layout
+  (* Polymorphic marshalling *)
+  | Ppmconcatenate
+  | Ppmmakepackage
+  | Ppmextractpackage
+  | Prandom256
+  | Pflattentyperep
 
 and comparison =
     Ceq | Cneq | Clt | Cgt | Cle | Cge
@@ -178,12 +184,14 @@
 val iter: (lambda -> unit) -> lambda -> unit
 module IdentSet: Set.S with type elt = Ident.t
 val free_variables: lambda -> IdentSet.t
+val function_bound_variables: lambda -> IdentSet.t
 val free_methods: lambda -> IdentSet.t
 
 val transl_path: Path.t -> lambda
 val make_sequence: ('a -> lambda) -> 'a list -> lambda
 
 val subst_lambda: lambda Ident.tbl -> lambda -> lambda
+val remove_shadowing: lambda -> lambda
 val bind : let_kind -> Ident.t -> lambda -> lambda -> lambda
 
 val commute_comparison : comparison -> comparison
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/bytecomp/printlambda.ml	2005-08-25 16:35:16.000000000 +0100
+++ hashcaml/bytecomp/printlambda.ml	2006-04-24 12:23:38.000000000 +0100
@@ -172,6 +172,11 @@
   | Pbintcomp(bi, Cge) -> print_boxed_integer ">=" ppf bi
   | Pbigarrayref(n, kind, layout) -> print_bigarray "get" kind ppf layout
   | Pbigarrayset(n, kind, layout) -> print_bigarray "set" kind ppf layout
+  | Ppmconcatenate -> fprintf ppf "pmconcatenate"
+  | Ppmmakepackage -> fprintf ppf "pmmakepackage"
+  | Ppmextractpackage -> fprintf ppf "pmextractpackage"
+  | Prandom256 -> fprintf ppf "random256"
+  | Pflattentyperep -> fprintf ppf "flattentyperep"
 
 let rec lam ppf = function
   | Lvar id ->
@@ -302,4 +307,4 @@
 
 let structured_constant = struct_const
 
-let lambda = lam
+let lambda ppf l = Format.pp_set_margin ppf 150; lam ppf l
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/bytecomp/translclass.ml	2005-08-13 21:59:37.000000000 +0100
+++ hashcaml/bytecomp/translclass.ml	2006-04-24 12:23:39.000000000 +0100
@@ -142,7 +142,9 @@
                    (inh_init, obj_init, true)
                | Cf_let (rec_flag, defs, vals) ->
                    (inh_init,
-                    Translcore.transl_let rec_flag defs
+                    Translcore.transl_let rec_flag
+                      (* FIXME OBJECTS next line *)
+                      (List.map (fun (pat, exp) -> (pat, exp, Types.tyvar_id_memo_empty)) defs)
                       (List.fold_right
                          (fun (id, expr) rem ->
                             lsequence (Lifused(id, set_inst_var obj id expr))
@@ -182,7 +184,9 @@
       let (inh_init, obj_init) =
         build_object_init cl_table obj (vals @ params) inh_init obj_init cl
       in
-      (inh_init, Translcore.transl_let rec_flag defs obj_init)
+      (* FIXME OBJECTS next line *)
+      let defs' = (List.map (fun (pat, exp) -> (pat, exp, Types.tyvar_id_memo_empty)) defs) in
+      (inh_init, Translcore.transl_let rec_flag defs' obj_init)
   | Tclass_constraint (cl, vals, pub_meths, concr_meths) ->
       build_object_init cl_table obj params inh_init obj_init cl
 
@@ -379,7 +383,9 @@
   match cl.cl_desc with
     Tclass_let (rec_flag, defs, vals, cl) ->
       let env, wrap = build_class_lets cl in
-      (env, fun x -> Translcore.transl_let rec_flag defs (wrap x))
+      (* FIXME OBJECTS next line *)
+      let defs' = (List.map (fun (pat, exp) -> (pat, exp, Types.tyvar_id_memo_empty)) defs) in
+      (env, fun x -> Translcore.transl_let rec_flag defs' (wrap x))
   | _ ->
       (cl.cl_env, fun x -> x)
 
@@ -418,7 +424,9 @@
       (path, transl_apply obj_init oexprs)
   | Tclass_let (rec_flag, defs, vals, cl) ->
       let path, obj_init = transl_class_rebind obj_init cl in
-      (path, Translcore.transl_let rec_flag defs obj_init)
+      (* FIXME OBJECTS next line *)
+      let defs' = (List.map (fun (pat, exp) -> (pat, exp, Types.tyvar_id_memo_empty)) defs) in
+      (path, Translcore.transl_let rec_flag defs' obj_init)
   | Tclass_structure _ -> raise Exit
   | Tclass_constraint (cl', _, _, _) ->
       let path, obj_init = transl_class_rebind obj_init cl' in
@@ -434,7 +442,9 @@
   match cl.cl_desc with
     Tclass_let (rec_flag, defs, vals, cl) ->
       let path, obj_init = transl_class_rebind_0 self obj_init cl in
-      (path, Translcore.transl_let rec_flag defs obj_init)
+      (* FIXME OBJECTS next line *)
+      let defs' = (List.map (fun (pat, exp) -> (pat, exp, Types.tyvar_id_memo_empty)) defs) in
+      (path, Translcore.transl_let rec_flag defs' obj_init)
   | _ ->
       let path, obj_init = transl_class_rebind obj_init cl in
       (path, lfunction [self] obj_init)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/bytecomp/translcore.ml	2005-08-25 16:35:16.000000000 +0100
+++ hashcaml/bytecomp/translcore.ml	2006-04-24 12:23:39.000000000 +0100
@@ -33,8 +33,9 @@
 
 (* Forward declaration -- to be filled in by Translmod.transl_module *)
 let transl_module =
-  ref((fun cc rootpath modl -> assert false) :
-      module_coercion -> Path.t option -> module_expr -> lambda)
+  ref((fun cc wrapper_id_map rootpath modl -> assert false) :
+      module_coercion -> (Ident.t * Ident.t) list -> Path.t option ->
+        module_expr -> lambda)
 
 let transl_object =
   ref (fun id s cl -> assert false :
@@ -140,7 +141,7 @@
        false)
 ]
 
-let primitives_table = create_hashtable 57 [
+let primitives_table = create_hashtable 61 [
   "%identity", Pidentity;
   "%ignore", Pignore;
   "%field0", Pfield 0;
@@ -255,7 +256,12 @@
   "%bigarray_ref_3", Pbigarrayref(3, Pbigarray_unknown, Pbigarray_c_layout);
   "%bigarray_set_1", Pbigarrayset(1, Pbigarray_unknown, Pbigarray_c_layout);
   "%bigarray_set_2", Pbigarrayset(2, Pbigarray_unknown, Pbigarray_c_layout);
-  "%bigarray_set_3", Pbigarrayset(3, Pbigarray_unknown, Pbigarray_c_layout)
+  "%bigarray_set_3", Pbigarrayset(3, Pbigarray_unknown, Pbigarray_c_layout);
+  "%caml_polymarshal_concatenate", Ppmconcatenate;
+  "%caml_polymarshal_make_package", Ppmmakepackage;
+  "%caml_polymarshal_extract_package", Ppmextractpackage;
+  "%random256", Prandom256;
+  "%flatten_typerep_block", Pflattentyperep
 ]
 
 let prim_makearray =
@@ -447,7 +453,8 @@
           Texp_match
             ({exp with exp_type = pat.pat_type; exp_desc =
               Texp_ident (Path.Pident param,
-                          {val_type = pat.pat_type; val_kind = Val_reg})},
+                          {val_type = pat.pat_type; val_kind = Val_reg},
+                          [] (*FIXME?*))},
              pat_expr_list, partial) }
       in
       push_defaults loc bindings
@@ -513,6 +520,17 @@
                Const_base(Const_int char)]))])])
 ;;
 
+(* FIXME share with hashing/normtypes.ml *)
+let code_for_myname env modname =
+  let lident = Longident.Ldot (modname, "myname") in
+  let (path, vd) =
+    try Env.lookup_value lident env with Not_found -> assert false in
+  let ty = Predef.type_typerep in
+    { exp_desc = Texp_ident (path, vd, []);
+      exp_loc = Location.none;
+      exp_type = ty;
+      exp_env = env }
+
 let rec cut n l =
   if n = 0 then ([],l) else
   match l with [] -> failwith "Translcore.cut"
@@ -532,7 +550,7 @@
 
 and transl_exp0 e =
   match e.exp_desc with
-    Texp_ident(path, {val_kind = Val_prim p}) ->
+    Texp_ident(path, {val_kind = Val_prim p}, _) ->
       let public_send = p.prim_name = "%send" in
       if public_send || p.prim_name = "%sendself" then
         let kind = if public_send then Public else Self in
@@ -545,9 +563,9 @@
                   Lsend(Cached, Lvar meth, Lvar obj, [Lvar cache; Lvar pos]))
       else
 	transl_primitive p
-  | Texp_ident(path, {val_kind = Val_anc _}) ->
+  | Texp_ident(path, {val_kind = Val_anc _}, _) ->
       raise(Error(e.exp_loc, Free_super_var))
-  | Texp_ident(path, {val_kind = Val_reg | Val_self _}) ->
+  | Texp_ident(path, {val_kind = Val_reg | Val_self _}, _) ->
       transl_path path
   | Texp_ident _ -> fatal_error "Translcore.transl_exp: bad Texp_ident"
   | Texp_constant cst ->
@@ -562,7 +580,7 @@
             transl_function e.exp_loc !Clflags.native_code repr partial pl)
       in
       Lfunction(kind, params, body)
-  | Texp_apply({exp_desc = Texp_ident(path, {val_kind = Val_prim p})}, args)
+  | Texp_apply({exp_desc = Texp_ident(path, {val_kind = Val_prim p}, _)}, args)
     when List.length args >= p.prim_arity
     && List.for_all (fun (arg,_) -> arg <> None) args ->
       let args, args' = cut p.prim_arity args in
@@ -680,6 +698,16 @@
       Lifthenelse(transl_exp cond,
                   event_before ifso (transl_exp ifso),
                   lambda_unit)
+  | Texp_ifname(exp1, exp2, ifso, ifnot_opt) ->
+      let cond =
+        Lprim (Pccall{prim_name = "caml_equal"; prim_arity = 2;
+               prim_alloc = true; prim_native_name = "";
+               prim_native_float = false}, [transl_exp exp1; transl_exp exp2])
+      in
+        Lifthenelse (cond, event_before ifso (transl_exp ifso),
+                     match ifnot_opt with
+                       None -> lambda_unit
+                     | Some ifnot -> event_before ifnot (transl_exp ifnot))
   | Texp_sequence(expr1, expr2) ->
       Lsequence(transl_exp expr1, event_before expr2 (transl_exp expr2))
   | Texp_while(cond, body) ->
@@ -718,7 +746,7 @@
              modifs
              (Lvar cpy))
   | Texp_letmodule(id, modl, body) ->
-      Llet(Strict, id, !transl_module Tcoerce_none None modl, transl_exp body)
+      Llet(Strict, id, !transl_module Tcoerce_none [] None modl, transl_exp body)
   | Texp_assert (cond) ->
       if !Clflags.noassert
       then lambda_unit
@@ -734,6 +762,25 @@
           cl_loc = e.exp_loc;
           cl_type = Tcty_signature cty;
           cl_env = e.exp_env }
+    (* if -polymarshal is specified on the command line, then Texp_typeof
+       nodes etc. will have been translated out by the Polymarshal module. *)
+  | Texp_typeof _ ->
+      Lconst (Const_base (Const_string "<dynamic types disabled>"))
+  | Texp_typerep _ ->
+      Lconst (Const_base (Const_string "<dynamic types disabled>"))
+  | Texp_hashname _ ->
+      Lconst (Const_base (Const_string "<dynamic types disabled>"))
+  | Texp_fresh -> Lprim(Prandom256, [lambda_unit])
+  | Texp_fieldname path -> 
+      (* path can never be just Pident _ since this is caught in Typecore.
+         Calling Path.split is therefore always safe. *)
+      let (module_part, rest) = Path.split path in
+      let myname_code = code_for_myname e.exp_env module_part in
+      let (_, params) = Hashpackage.add_hash_param myname_code
+                          Hashpackage.empty_hash_param_set in
+      let pkg = Hashpackage.make_package rest params in
+        transl_exp (Hashpackage.generate_code pkg)
+  | Texp_namecoercion (_, _, exp) -> transl_exp exp
 
 and transl_list expr_list =
   List.map transl_exp expr_list
@@ -833,22 +880,34 @@
       let rec transl = function
         [] ->
           body
-      | (pat, expr) :: rem ->
-          Matching.for_let pat.pat_loc (transl_exp expr) pat (transl rem)
+      | (pat, expr, pat_var_types) :: rem ->
+          let lambda_term = Matching.for_let pat.pat_loc (transl_exp expr)
+                            pat (transl rem)
+          in
+            if !Clflags.polymarshal then
+                Polymarshal.rewrite_let_lambda_code pat expr
+                                                    pat_var_types lambda_term
+            else
+              lambda_term
       in transl pat_expr_list
   | Recursive ->
       let idlist =
         List.map
-          (fun (pat, expr) ->
+          (fun (pat, expr, _) ->
             match pat.pat_desc with
               Tpat_var id -> id
             | _ -> raise(Error(pat.pat_loc, Illegal_letrec_pat)))
         pat_expr_list in
-      let transl_case (pat, expr) id =
+      let transl_case (pat, expr, pat_var_types) id =
         let lam = transl_exp expr in
         if not (check_recursive_lambda idlist lam) then
           raise(Error(expr.exp_loc, Illegal_letrec_expr));
-        (id, lam) in
+         if !Clflags.polymarshal then
+           (id, Polymarshal.rewrite_let_lambda_code pat expr
+                                                    pat_var_types lam)
+         else
+           (id, lam)
+      in
       Lletrec(List.map2 transl_case pat_expr_list idlist, body)
 
 and transl_setinstvar self var expr =
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/bytecomp/translcore.mli	2003-11-25 09:20:43.000000000 +0000
+++ hashcaml/bytecomp/translcore.mli	2006-04-24 12:23:38.000000000 +0100
@@ -25,7 +25,8 @@
 val transl_exp: expression -> lambda
 val transl_apply: lambda -> (expression option * optional) list -> lambda
 val transl_let:
-      rec_flag -> (pattern * expression) list -> lambda -> lambda
+      rec_flag -> (pattern * expression * Ident.t tyvar_id_memo) list ->
+      lambda -> lambda
 val transl_primitive: Primitive.description -> lambda
 val transl_exception:
       Ident.t -> Path.t option -> exception_declaration -> lambda
@@ -45,6 +46,7 @@
 
 (* Forward declaration -- to be filled in by Translmod.transl_module *)
 val transl_module :
-      (module_coercion -> Path.t option -> module_expr -> lambda) ref
+      (module_coercion -> (Ident.t * Ident.t) list -> Path.t option ->
+       module_expr -> lambda) ref
 val transl_object :
       (Ident.t -> string list -> class_expr -> lambda) ref
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/bytecomp/translmod.ml	2004-08-12 13:55:11.000000000 +0100
+++ hashcaml/bytecomp/translmod.ml	2006-04-24 12:23:38.000000000 +0100
@@ -32,6 +32,26 @@
 
 exception Error of Location.t * error
 
+let vid_prefix = "_tyrep_" (* FIXME *)
+(* FIXME: see note below on close_toplevel_term. *)
+let close_term lam = lam
+
+(*
+  IdentSet.fold (fun id l -> 
+                   let s = Ident.name id in
+                     if String.length s < String.length vid_prefix then
+                       lam
+                     else if String.sub s 0 (String.length vid_prefix) =
+                             vid_prefix then
+                       (* we have found an unbound typerep identifier in
+                          the lambda term.  Add a let to bind it to a
+                          dummy typerep. *)
+                       Llet(Strict, id,
+                            Lconst(Const_base(Const_string "<dummy>")), l)
+                     else
+                       lam)
+                (free_variables lam) lam
+*)
 (* Compile a coercion *)
 
 let rec apply_coercion restr arg =
@@ -48,11 +68,26 @@
         Lfunction(Curried, [param],
           apply_coercion cc_res
             (Lapply(Lvar id, [apply_coercion cc_arg (Lvar param)]))))
-  | Tcoerce_primitive p ->
-      transl_primitive p
+  | Tcoerce_primitive (p, ty, env) ->
+      (* not only will the primitive be eta-expanded but also it will have
+         typerep lambdas added on the front to discard any incoming
+         typereps. *)
+      Polymarshal.make_discard_wrapper ty env (transl_primitive p)
 
-and apply_coercion_field id (pos, cc) =
-  apply_coercion cc (Lprim(Pfield pos, [Lvar id]))
+and apply_coercion_field id (pos, cc, nvd_opt) =
+  let arg = Lprim (Pfield pos, [Lvar id]) in
+  match cc with
+  (* if a primitive is exposed using "val" in a signature, then ensure
+     that only the "discarding typereps" wrapper is generated, even if
+     the primitive is exposed at a less general type. *)
+    Tcoerce_primitive _ -> apply_coercion cc arg
+  | _ ->
+    begin match nvd_opt with
+      None -> apply_coercion cc arg
+    | Some (id', vd1, vd2, env) ->
+        apply_coercion cc
+          (Polymarshal.make_coercion_wrapper transl_exp vd1 vd2 env arg)
+    end
 
 (* Compose two coercions
    apply_coercion c1 (apply_coercion c2 e) behaves like
@@ -66,10 +101,26 @@
       let v2 = Array.of_list pc2 in
       Tcoerce_structure
         (List.map
-          (function (p1, Tcoerce_primitive p) ->
-                      (p1, Tcoerce_primitive p)
-                  | (p1, c1) ->
-                      let (p2, c2) = v2.(p1) in (p2, compose_coercions c1 c2))
+          (function (p1, Tcoerce_primitive (p, ty, env), nvds_opt) ->
+                      (p1, Tcoerce_primitive (p, ty, env), nvds_opt)
+                  | (p1, c1, nvds_opt_1) ->
+                      let (p2, c2, nvds_opt_2) = v2.(p1) in
+                      begin
+                        match (nvds_opt_1, nvds_opt_2) with
+                          (None, None) ->
+                            (p2, compose_coercions c1 c2, None)
+                        | (None, Some nvds) ->
+                            (p2, compose_coercions c1 c2, Some nvds)
+                        | (Some nvds, None) ->
+                            (p2, compose_coercions c1 c2, Some nvds)
+                        | (Some (id, vd1, _, env), Some (_, _, vd2, _)) ->
+                            (* FIXME very tentative: something like this is
+                               needed but needs testing to make sure correct
+                               value descriptions and environment are being
+                               used. *)
+                            (p2, compose_coercions c1 c2,
+                             Some (id, vd1, vd2, env))
+                      end)
              pc1)
   | (Tcoerce_functor(arg1, res1), Tcoerce_functor(arg2, res2)) ->
       Tcoerce_functor(compose_coercions arg2 arg1,
@@ -233,36 +284,36 @@
 
 (* Compile a module expression *)
 
-let rec transl_module cc rootpath mexp =
+let rec transl_module cc wrapper_id_map rootpath mexp =
   match mexp.mod_desc with
     Tmod_ident path ->
       apply_coercion cc (transl_path path)
-  | Tmod_structure str ->
-      transl_structure [] cc rootpath str
+  | Tmod_structure (_, str) ->
+      transl_structure [] cc wrapper_id_map rootpath str
   | Tmod_functor(param, mty, body) ->
       let bodypath = functor_path rootpath param in
       oo_wrap mexp.mod_env true
         (function
         | Tcoerce_none ->
             Lfunction(Curried, [param],
-                      transl_module Tcoerce_none bodypath body)
+                      transl_module Tcoerce_none wrapper_id_map bodypath body)
         | Tcoerce_functor(ccarg, ccres) ->
             let param' = Ident.create "funarg" in
             Lfunction(Curried, [param'],
                       Llet(Alias, param, apply_coercion ccarg (Lvar param'),
-                           transl_module ccres bodypath body))
+                           transl_module ccres wrapper_id_map bodypath body))
         | _ ->
             fatal_error "Translmod.transl_module")
         cc
   | Tmod_apply(funct, arg, ccarg) ->
       oo_wrap mexp.mod_env true
         (apply_coercion cc)
-        (Lapply(transl_module Tcoerce_none None funct,
-                [transl_module ccarg None arg]))
+        (Lapply(transl_module Tcoerce_none wrapper_id_map None funct,
+                [transl_module ccarg wrapper_id_map None arg]))
   | Tmod_constraint(arg, mty, ccarg) ->
-      transl_module (compose_coercions cc ccarg) rootpath arg
+      transl_module (compose_coercions cc ccarg) wrapper_id_map rootpath arg
 
-and transl_structure fields cc rootpath = function
+and transl_structure fields cc wrapper_id_map rootpath = function
     [] ->
       begin match cc with
         Tcoerce_none ->
@@ -272,68 +323,88 @@
           let v = Array.of_list (List.rev fields) in
           Lprim(Pmakeblock(0, Immutable),
                 List.map
-                  (fun (pos, cc) ->
+                  (fun (pos, cc, nvds_opt) ->
                     match cc with
-                      Tcoerce_primitive p -> transl_primitive p
-                    | _ -> apply_coercion cc (Lvar v.(pos)))
+                      Tcoerce_primitive (p, ty, env) ->
+                        if !Clflags.polymarshal then
+                          Polymarshal.make_discard_wrapper ty env
+                            (transl_primitive p)
+                        else transl_primitive p
+                    | _ ->
+                      if !Clflags.polymarshal then
+                      begin
+                        match nvds_opt with
+                          None -> apply_coercion cc (Lvar v.(pos))
+                        | Some (id, vd1, vd2, env) ->
+                            apply_coercion cc
+                              (Polymarshal.make_coercion_wrapper
+                                 transl_exp vd1 vd2 env (Lvar v.(pos)))
+                      end
+                      else
+                        apply_coercion cc (Lvar v.(pos)))
                   pos_cc_list)
       | _ ->
           fatal_error "Translmod.transl_structure"
       end
   | Tstr_eval expr :: rem ->
-      Lsequence(transl_exp expr, transl_structure fields cc rootpath rem)
+      Lsequence(transl_exp expr, transl_structure fields cc wrapper_id_map
+                                                  rootpath rem)
   | Tstr_value(rec_flag, pat_expr_list) :: rem ->
-      let ext_fields = rev_let_bound_idents pat_expr_list @ fields in
+      let pat_expr_list' = List.map (fun (a, b, c) -> (a, b)) pat_expr_list in
+      let ext_fields = rev_let_bound_idents pat_expr_list' @ fields in
       transl_let rec_flag pat_expr_list
-                 (transl_structure ext_fields cc rootpath rem)
+                 (transl_structure ext_fields cc wrapper_id_map rootpath rem)
   | Tstr_primitive(id, descr) :: rem ->
       begin match descr.val_kind with
         Val_prim p -> primitive_declarations :=
                         p.Primitive.prim_name :: !primitive_declarations
       | _ -> ()
       end;
-      transl_structure fields cc rootpath rem
+      transl_structure fields cc wrapper_id_map rootpath rem
   | Tstr_type(decls) :: rem ->
-      transl_structure fields cc rootpath rem
+      transl_structure fields cc wrapper_id_map rootpath rem
   | Tstr_exception(id, decl) :: rem ->
       Llet(Strict, id, transl_exception id (field_path rootpath id) decl,
-           transl_structure (id :: fields) cc rootpath rem)
+           transl_structure (id :: fields) cc wrapper_id_map rootpath rem)
   | Tstr_exn_rebind(id, path) :: rem ->
       Llet(Strict, id, transl_path path,
-           transl_structure (id :: fields) cc rootpath rem)
+           transl_structure (id :: fields) cc wrapper_id_map rootpath rem)
   | Tstr_module(id, modl) :: rem ->
       Llet(Strict, id,
-           transl_module Tcoerce_none (field_path rootpath id) modl,
-           transl_structure (id :: fields) cc rootpath rem)
+           transl_module Tcoerce_none wrapper_id_map
+                         (field_path rootpath id) modl,
+           transl_structure (id :: fields) cc wrapper_id_map rootpath rem)
   | Tstr_recmodule bindings :: rem ->
       let ext_fields = List.rev_append (List.map fst bindings) fields in
       compile_recmodule
         (fun id modl ->
-          transl_module Tcoerce_none (field_path rootpath id) modl)
+          transl_module Tcoerce_none wrapper_id_map
+                        (field_path rootpath id) modl)
         bindings
-        (transl_structure ext_fields cc rootpath rem)
+        (transl_structure ext_fields cc wrapper_id_map rootpath rem)
   | Tstr_modtype(id, decl) :: rem ->
-      transl_structure fields cc rootpath rem
+      transl_structure fields cc wrapper_id_map rootpath rem
   | Tstr_open path :: rem ->
-      transl_structure fields cc rootpath rem
+      transl_structure fields cc wrapper_id_map rootpath rem
   | Tstr_class cl_list :: rem ->
       let ids = List.map (fun (i, _, _, _) -> i) cl_list in
       Lletrec(List.map
                 (fun (id, arity, meths, cl) ->
                   (id, transl_class ids id arity meths cl))
                 cl_list,
-              transl_structure (List.rev ids @ fields) cc rootpath rem)
+              transl_structure (List.rev ids @ fields) cc wrapper_id_map
+                               rootpath rem)
   | Tstr_cltype cl_list :: rem ->
-      transl_structure fields cc rootpath rem
+      transl_structure fields cc wrapper_id_map rootpath rem
   | Tstr_include(modl, ids) :: rem ->
       let mid = Ident.create "include" in
       let rec rebind_idents pos newfields = function
         [] ->
-          transl_structure newfields cc rootpath rem
+          transl_structure newfields cc wrapper_id_map rootpath rem
       | id :: ids ->
           Llet(Alias, id, Lprim(Pfield pos, [Lvar mid]),
                rebind_idents (pos + 1) (id :: newfields) ids) in
-      Llet(Alias, mid, transl_module Tcoerce_none None modl,
+      Llet(Alias, mid, transl_module Tcoerce_none wrapper_id_map None modl,
            rebind_idents 0 fields ids)
 
 (* Update forward declaration in Translcore *)
@@ -342,13 +413,14 @@
 
 (* Compile an implementation *)
 
-let transl_implementation module_name (str, cc) =
+let transl_implementation module_name (str, cc, wrapper_id_map) =
   reset_labels ();
   primitive_declarations := [];
   let module_id = Ident.create_persistent module_name in
   Lprim(Psetglobal module_id,
         [transl_label_init
-            (transl_structure [] cc (global_path module_id) str)])
+            (close_term (transl_structure [] cc wrapper_id_map
+                                          (global_path module_id) str))])
 
 (* A variant of transl_structure used to compile toplevel structure definitions
    for the native-code compiler. Store the defined values in the fields
@@ -367,7 +439,8 @@
       Lsequence(subst_lambda subst (transl_exp expr),
                 transl_store subst rem)
   | Tstr_value(rec_flag, pat_expr_list) :: rem ->
-      let ids = let_bound_idents pat_expr_list in
+      let pat_expr_list' = List.map (fun (a, b, c) -> (a, b)) pat_expr_list in
+      let ids = let_bound_idents pat_expr_list' in
       let lam = transl_let rec_flag pat_expr_list (store_idents ids) in
       Lsequence(subst_lambda subst lam,
                 transl_store (add_idents false ids subst) rem)
@@ -390,7 +463,7 @@
                 transl_store (add_ident false id subst) rem)
   | Tstr_module(id, modl) :: rem ->
       let lam =
-        transl_module Tcoerce_none (field_path (global_path glob) id) modl in
+        transl_module Tcoerce_none [] (* FIXME? *) (field_path (global_path glob) id) modl in
       (* Careful: the module value stored in the global may be different
          from the local module value, in case a coercion is applied.
          If so, keep using the local module value (id) in the remainder of
@@ -404,7 +477,7 @@
       compile_recmodule
         (fun id modl ->
           subst_lambda subst
-            (transl_module Tcoerce_none
+            (transl_module Tcoerce_none [] (* FIXME? *)
                            (field_path (global_path glob) id) modl))
         bindings
         (Lsequence(store_idents ids,
@@ -433,7 +506,7 @@
           Llet(Alias, id, Lprim(Pfield pos, [Lvar mid]),
                Lsequence(store_ident id, store_idents (pos + 1) idl)) in
       Llet(Strict, mid,
-           subst_lambda subst (transl_module Tcoerce_none None modl),
+           subst_lambda subst (transl_module Tcoerce_none [] (* FIXME? *) None modl),
            store_idents 0 ids)
 
   and store_ident id =
@@ -475,7 +548,8 @@
     [] -> []
   | Tstr_eval expr :: rem -> defined_idents rem
   | Tstr_value(rec_flag, pat_expr_list) :: rem ->
-      let_bound_idents pat_expr_list @ defined_idents rem
+      let pat_expr_list' = List.map (fun (a, b, c) -> (a, b)) pat_expr_list in
+      let_bound_idents pat_expr_list' @ defined_idents rem
   | Tstr_primitive(id, descr) :: rem -> defined_idents rem
   | Tstr_type decls :: rem -> defined_idents rem
   | Tstr_exception(id, decl) :: rem -> id :: defined_idents rem
@@ -515,9 +589,9 @@
       let rec export_map pos map prims undef = function
         [] ->
           natural_map pos map prims undef
-      | (source_pos, Tcoerce_primitive p) :: rem ->
+      | (source_pos, Tcoerce_primitive (p, _, _) (* FIXME is this ok? *), _) :: rem ->
           export_map (pos + 1) map ((pos, p) :: prims) undef rem
-      | (source_pos, cc) :: rem ->
+      | (source_pos, cc, _ (* FIXME almost certainly need to change*)) :: rem ->
           let id = idarray.(source_pos) in
           export_map (pos + 1) (Ident.add id (pos, cc) map)
                      prims (list_remove id undef) rem
@@ -565,15 +639,30 @@
 
 let toploop_setvalue_id id = toploop_setvalue id (Lvar id)
 
+(* FIXME: the following is dirty, but will do for the moment.  Something
+   similar to this is probably the right thing to be doing though. *)
 let close_toplevel_term lam =
-  IdentSet.fold (fun id l -> Llet(Strict, id, toploop_getvalue id, l))
+  IdentSet.fold (fun id l -> 
+                   let s = Ident.name id in
+                     if String.length s < String.length vid_prefix then
+                       Llet(Strict, id, toploop_getvalue id, l)
+                     else if String.sub s 0 (String.length vid_prefix) =
+                             vid_prefix then
+                       (* we have found an unbound typerep identifier in
+                          the lambda term.  Add a let to bind it to a
+                          typerep flagged as such. *)
+                       Llet(Strict, id,
+                            Lconst(Const_block(0,[Const_base(Const_string "__DUMMY__")])), l)
+                     else
+                       Llet(Strict, id, toploop_getvalue id, l))
                 (free_variables lam) lam
 
 let transl_toplevel_item = function
     Tstr_eval expr ->
       transl_exp expr
   | Tstr_value(rec_flag, pat_expr_list) ->
-      let idents = let_bound_idents pat_expr_list in
+      let pat_expr_list' = List.map (fun (a, b, c) -> (a, b)) pat_expr_list in
+      let idents = let_bound_idents pat_expr_list' in
       transl_let rec_flag pat_expr_list
                  (make_sequence toploop_setvalue_id idents)
   | Tstr_primitive(id, descr) ->
@@ -589,11 +678,11 @@
          with "open" (PR#1672) *)
       set_toplevel_unique_name id;
       toploop_setvalue id
-                        (transl_module Tcoerce_none (Some(Pident id)) modl)
+                        (transl_module Tcoerce_none [] (* FIXME? *) (Some(Pident id)) modl)
   | Tstr_recmodule bindings ->
       let idents = List.map fst bindings in
       compile_recmodule
-        (fun id modl -> transl_module Tcoerce_none (Some(Pident id)) modl)
+        (fun id modl -> transl_module Tcoerce_none [] (* FIXME? *) (Some(Pident id)) modl)
         bindings
         (make_sequence toploop_setvalue_id idents)
   | Tstr_modtype(id, decl) ->
@@ -622,7 +711,7 @@
       | id :: ids ->
           Lsequence(toploop_setvalue id (Lprim(Pfield pos, [Lvar mid])),
                     set_idents (pos + 1) ids) in
-      Llet(Strict, mid, transl_module Tcoerce_none None modl, set_idents 0 ids)
+      Llet(Strict, mid, transl_module Tcoerce_none [] (* FIXME *) None modl, set_idents 0 ids)
 
 let transl_toplevel_item_and_close itm =
   close_toplevel_term (transl_label_init (transl_toplevel_item itm))
@@ -645,7 +734,7 @@
     | Tcoerce_structure pos_cc_list ->
         let g = Array.of_list component_names in
         List.map
-          (fun (pos, cc) -> apply_coercion cc (get_component g.(pos)))
+          (fun (pos, cc, _ (* FIXME *)) -> apply_coercion cc (get_component g.(pos)))
           pos_cc_list
     | _ ->
         assert false in
@@ -669,7 +758,7 @@
       let id = Array.of_list component_names in
       (List.length pos_cc_list,
        make_sequence
-         (fun dst (src, cc) ->
+         (fun dst (src, cc, _ (* FIXME *)) ->
            Lprim(Psetfield(dst, false),
                  [Lprim(Pgetglobal target_name, []);
                   apply_coercion cc (get_component id.(src))]))
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/bytecomp/translmod.mli	2004-04-09 14:32:27.000000000 +0100
+++ hashcaml/bytecomp/translmod.mli	2006-04-24 12:23:39.000000000 +0100
@@ -18,7 +18,8 @@
 open Typedtree
 open Lambda
 
-val transl_implementation: string -> structure * module_coercion -> lambda
+val transl_implementation: string ->
+  structure * module_coercion * ((Ident.t * Ident.t) list) -> lambda
 val transl_store_implementation:
       string -> structure * module_coercion -> int * lambda
 val transl_toplevel_definition: structure -> lambda
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/byterun/Makefile	2005-11-29 11:57:49.000000000 +0000
+++ hashcaml/byterun/Makefile	2006-04-24 12:23:39.000000000 +0100
@@ -25,14 +25,15 @@
   compare.o ints.o floats.o str.o array.o io.o extern.o intern.o \
   hash.o sys.o meta.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o \
   lexing.o callback.o debugger.o weak.o compact.o finalise.o custom.o \
-  dynlink.o unix.o
+  dynlink.o unix.o hash256.o random256.o sha2.o polymarshal.o \
+  strnstr.o
 
 DOBJS=$(OBJS:.o=.d.o) instrtrace.d.o
 
 PRIMS=alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
   intern.c interp.c ints.c io.c lexing.c md5.c meta.c obj.c parsing.c \
   signals.c str.c sys.c terminfo.c callback.c weak.c finalise.c stacks.c \
-  dynlink.c
+  dynlink.c sha2.c hash256.c random256.c polymarshal.c
 
 PUBLIC_INCLUDES=alloc.h callback.h config.h custom.h fail.h intext.h \
   memory.h misc.h mlvalues.h printexc.h signals.h compatibility.h
@@ -57,7 +58,7 @@
         done
 	cp ld.conf $(LIBDIR)/ld.conf
 
-ld.conf: ../config/Makefile
+ld.conf:
 	echo "$(STUBLIBDIR)" >ld.conf
 	echo "$(LIBDIR)" >>ld.conf
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/byterun/Makefile.nt	2005-12-30 09:58:40.000000000 +0000
+++ hashcaml/byterun/Makefile.nt	2006-04-24 12:23:39.000000000 +0100
@@ -104,7 +104,7 @@
 	$(CC) $(CFLAGS) $(BYTECCCOMPOPTS) -c $<
 	mv $*.$(O) $*.$(SO)
 
-.depend.nt: .depend
+.depend.nt:
 	sed -e '/\.d\.o/q' -e 's/^\(.*\)\.o:/\1.$$(DO) \1.$$(SO):/' .depend > .depend.nt
 
 include .depend.nt
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/byterun/callback.c	2005-12-30 09:57:09.000000000 +0000
+++ hashcaml/byterun/callback.c	2006-04-24 12:23:40.000000000 +0100
@@ -220,12 +220,6 @@
   char * name = String_val(vname);
   unsigned int h = hash_value_name(name);
 
-  for (nv = named_value_table[h]; nv != NULL; nv = nv->next) {
-    if (strcmp(name, nv->name) == 0) {
-      nv->val = val;
-      return Val_unit;
-    }
-  }
   nv = (struct named_value *)
          caml_stat_alloc(sizeof(struct named_value) + strlen(name));
   strcpy(nv->name, name);
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/byterun/exec.h	2004-06-01 13:36:34.000000000 +0100
+++ hashcaml/byterun/exec.h	2006-04-24 12:23:39.000000000 +0100
@@ -56,7 +56,7 @@
 
 /* Magic number for this release */
 
-#define EXEC_MAGIC "Caml1999X008"
+#define EXEC_MAGIC "Hash1999X008"
 
 
 #endif /* CAML_EXEC_H */
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/byterun/extern.c	2005-11-22 11:50:34.000000000 +0000
+++ hashcaml/byterun/extern.c	2006-04-24 12:23:39.000000000 +0100
@@ -17,6 +17,7 @@
 
 /* The interface of this file is "intext.h" */
 
+#include <stdio.h>
 #include <string.h>
 #include "alloc.h"
 #include "custom.h"
@@ -144,13 +145,6 @@
   extern_limit = extern_output_block->data + SIZE_EXTERN_OUTPUT_BLOCK;
 }
 
-static void close_extern_output(void)
-{
-  if (extern_userprovided_output == NULL){
-    extern_output_block->end = extern_ptr;
-  }
-}
-
 static void free_extern_output(void)
 {
   struct output_block * blk, * nextblk;
@@ -472,7 +466,7 @@
   /* Marshal the object */
   extern_rec(v);
   /* Record end of output */
-  close_extern_output();
+  extern_output_block->end = extern_ptr;
   /* Undo the modifications done on externed blocks */
   extern_replay_trail();
   /* Write the sizes */
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/byterun/finalise.c	2005-09-22 15:21:50.000000000 +0100
+++ hashcaml/byterun/finalise.c	2006-04-24 12:23:39.000000000 +0100
@@ -204,7 +204,7 @@
 }
 
 /* Put (f,v) in the recent set. */
-CAMLprim value caml_final_register (value f, value v)
+CAMLprim value caml_final_register (value typerep, value f, value v)
 {
   if (!(Is_block (v) && (Is_in_heap (v) || Is_young (v)))){
     caml_invalid_argument ("Gc.finalise");
@@ -226,7 +226,13 @@
     }
   }
   Assert (young < size);
+#ifdef ENABLE_POLYMARSHAL
+  /* partially apply the user-supplied function now to knock off the
+     typerep lambda */
+  final_table[young].fun = caml_callback(f, typerep);
+#else
   final_table[young].fun = f;
+#endif
   if (Tag_val (v) == Infix_tag) v -= Infix_offset_val (v);
   final_table[young].val = v;
   ++ young;
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/byterun/interp.c	2005-10-25 19:34:07.000000000 +0100
+++ hashcaml/byterun/interp.c	2006-04-24 12:23:39.000000000 +0100
@@ -32,6 +32,8 @@
 #include "signals.h"
 #include "stacks.h"
 
+extern int hash_count;
+
 /* Registers for the abstract machine:
         pc         the code pointer
         sp         the stack pointer (grows downward)
@@ -184,6 +186,13 @@
 static intnat caml_bcodcount;
 #endif
 
+void print_hash_count(void)
+{
+  if (getenv("HASHCOUNT")) {
+    printf("hash function called %d times\n", hash_count);
+  }
+}
+
 /* The interpreter itself */
 
 value caml_interprete(code_t prog, asize_t prog_size)
@@ -232,6 +241,8 @@
     return Val_unit;
   }
 
+  atexit(print_hash_count);
+
 #if defined(THREADED_CODE) && defined(ARCH_SIXTYFOUR) && !defined(ARCH_CODE32)
   jumptbl_base = Jumptbl_base;
 #endif
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/byterun/intext.h	2005-09-22 15:21:50.000000000 +0100
+++ hashcaml/byterun/intext.h	2006-04-24 12:23:40.000000000 +0100
@@ -79,6 +79,8 @@
 void caml_output_val (struct channel * chan, value v, value flags);
   /* Output [v] with flags [flags] on the channel [chan]. */
 
+CAMLextern value caml_output_value_to_string(value, value);
+
 /* </private> */
 
 CAMLextern void caml_output_value_to_malloc(value v, value flags,
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/byterun/md5.c	2005-09-22 15:21:50.000000000 +0100
+++ hashcaml/byterun/md5.c	2006-04-24 12:23:39.000000000 +0100
@@ -13,6 +13,7 @@
 
 /* $Id: md5.c,v 1.19 2005/09/22 14:21:50 xleroy Exp $ */
 
+#include <stdio.h>
 #include <string.h>
 #include "alloc.h"
 #include "fail.h"
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/byterun/sys.c	2005-11-09 15:58:03.000000000 +0000
+++ hashcaml/byterun/sys.c	2006-04-24 12:23:40.000000000 +0100
@@ -34,10 +34,6 @@
 #ifdef HAS_TIMES
 #include <sys/times.h>
 #endif
-#ifdef HAS_GETRUSAGE
-#include <sys/time.h>
-#include <sys/resource.h>
-#endif
 #ifdef HAS_GETTIMEOFDAY
 #include <sys/time.h>
 #endif
@@ -251,28 +247,20 @@
 
 CAMLprim value caml_sys_time(value unit)
 {
-#ifdef HAS_GETRUSAGE
-  struct rusage ru;
-
-  getrusage (RUSAGE_SELF, &ru);
-  return caml_copy_double (ru.ru_utime.tv_sec + ru.ru_utime.tv_usec / 1e6
-                           + ru.ru_stime.tv_sec + ru.ru_stime.tv_usec / 1e6);
+#ifdef HAS_TIMES
+#ifndef CLK_TCK
+#ifdef HZ
+#define CLK_TCK HZ
 #else
-  #ifdef HAS_TIMES
-    #ifndef CLK_TCK
-      #ifdef HZ
-        #define CLK_TCK HZ
-      #else
-        #define CLK_TCK 60
-      #endif
-    #endif
+#define CLK_TCK 60
+#endif
+#endif
     struct tms t;
     times(&t);
     return caml_copy_double((double)(t.tms_utime + t.tms_stime) / CLK_TCK);
-  #else
+#else
     /* clock() is standard ANSI C */
     return caml_copy_double((double)clock() / CLOCKS_PER_SEC);
-  #endif
 #endif
 }
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/byterun/sys.h	2003-12-16 18:09:43.000000000 +0000
+++ hashcaml/byterun/sys.h	2006-04-24 12:23:40.000000000 +0100
@@ -22,6 +22,7 @@
 
 CAMLextern void caml_sys_error (value);
 extern void caml_sys_init (char * exe_name, char ** argv);
+CAMLextern value caml_sys_random_seed (value unit);
 CAMLextern value caml_sys_exit (value);
 
 extern char * caml_exe_name;
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/byterun/weak.c	2005-12-05 13:37:43.000000000 +0000
+++ hashcaml/byterun/weak.c	2006-04-24 12:23:40.000000000 +0100
@@ -19,7 +19,6 @@
 
 #include "alloc.h"
 #include "fail.h"
-#include "major_gc.h"
 #include "memory.h"
 #include "mlvalues.h"
 
@@ -114,11 +113,7 @@
     if (Tag_val (v) < No_scan_tag){
       mlsize_t i;
       for (i = 0; i < Wosize_val (v); i++){
-        value f = Field (v, i);
-        if (caml_gc_phase == Phase_mark && Is_block (f) && Is_in_heap (f)){
-          caml_darken (f, NULL);
-        }
-        Modify (&Field (elt, i), f);
+        Modify (&Field (elt, i), Field (v, i));
       }
     }else{
       memmove (Bp_val (elt), Bp_val (v), Bosize_val (v));
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/camlp4/etc/mkcamlp4.sh.tpl	2006-01-03 17:12:25.000000000 +0000
+++ hashcaml/camlp4/etc/mkcamlp4.sh.tpl	2006-04-24 12:23:11.000000000 +0100
@@ -13,13 +13,15 @@
     case "$1" in
     -I) INCL="$INCL -I $2"; shift;;
     -version) echo "mkcamlp4, version $VERSION"; exit;;
-    [a-zA-Z]*.cmi)
+    *)
         j=`basename "$1" .cmi`
+        if test "$j.cmi" = "$1"; then
         first="`expr "$j" : '\(.\)' | tr 'a-z' 'A-Z'`"
         rest="`expr "$j" : '.\(.*\)'`"
         INTERFACES="$INTERFACES $first$rest"
-        ;;
-    *) OPTS="$OPTS $1";;
+        else
+            OPTS="$OPTS $1"
+        fi;;
     esac
     shift
 done
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/camlp4/etc/pr_o.ml	2006-01-03 18:12:30.000000000 +0000
+++ hashcaml/camlp4/etc/pr_o.ml	2006-04-24 12:23:11.000000000 +0100
@@ -1407,9 +1407,7 @@
         <:expr< for $_$ = $_$ $to:_$ $_$ do { $list:_$ } >> |
         <:expr< while $_$ do { $list:_$ } >> | <:expr< ($list: _$) >> |
         <:expr< let $opt:_$ $list:_$ in $_$ >> |
-        <:expr< let module $_$ = $_$ in $_$ >> |
-        <:expr< new $list:_$ >> | 
-        <:expr< assert $_$ >> | <:expr< lazy $_$ >> as e ->
+        <:expr< let module $_$ = $_$ in $_$ >> as e ->
           fun curr next dg k ->
             [: `S LO "("; `expr e "" [: `HVbox [: `S RO ")"; k :] :] :]
       | e -> fun curr next _ k -> [: `not_impl "expr" e :] ]}];
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/camlp4/etc/pr_r.ml	2006-01-03 18:12:30.000000000 +0000
+++ hashcaml/camlp4/etc/pr_r.ml	2006-04-24 12:23:11.000000000 +0100
@@ -1315,8 +1315,7 @@
         <:expr< while $_$ do { $list:_$ } >> |
         <:expr< let $opt:_$ $list:_$ in $_$ >> |
         <:expr< let module $_$ = $_$ in $_$ >> |
-        <:expr< new $list:_$ >> | 
-        <:expr< assert $_$ >> | <:expr< lazy $_$ >> as e ->
+        <:expr< new $list:_$ >> as e ->
           fun curr next _ k ->
             [: `S LO "("; `expr e [: `HVbox [: `S RO ")"; k :] :] :]
       | e -> fun curr next _ k -> [: `not_impl "expr" e :] ]}];
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/camlp4/unmaintained/scheme/Makefile	2005-12-19 16:46:54.000000000 +0000
+++ hashcaml/camlp4/unmaintained/scheme/Makefile	2006-04-24 12:23:12.000000000 +0100
@@ -77,9 +77,9 @@
 
 
 .ml.cmo:
-	$(OCAMLC) $(OCAMLCFLAGS) -pp "$(CAMLP4) $(P4INCLUDES) `awk 'NR == 1 { ORS=" "; for (i=2; i < NF; i++) print $$i; } ' $<` -loc loc" -c $< 
+	$(OCAMLC) $(OCAMLCFLAGS) -pp "$(CAMLP4) $(P4INCLUDES) `awk 'NR == 1 { ORS=" "; for (i=2; i < NF; i++) print $$i; } ' $<`" -c $<
 
 .ml.cmx:
-	$(OCAMLOPT) $(OCAMLCFLAGS) -pp "$(CAMLP4) $(P4INCLUDES)  `awk 'NR == 1 { ORS=" "; for (i=2; i < NF; i++) print $$i; } ' $<` -loc loc" -c $<
+	$(OCAMLOPT) $(OCAMLCFLAGS) -pp "$(CAMLP4) $(P4INCLUDES)  `awk 'NR == 1 { ORS=" "; for (i=2; i < NF; i++) print $$i; } ' $<`" -c $<
 
 include .depend
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/camlp4/unmaintained/scheme/pa_scheme.ml	2005-12-19 16:49:53.000000000 +0000
+++ hashcaml/camlp4/unmaintained/scheme/pa_scheme.ml	2006-04-24 12:23:11.000000000 +0100
@@ -237,7 +237,7 @@
 and minus kwt =
   parser
   [ [: `'.' :] -> identifier kwt ("-.", False)
-  | [: `('0'..'9' as c); n = number (Buff.store (Buff.store 0 '-') c) :] ->
+  | [: `('0'..'9' as c); n = number (Buff.store (Buff.store 0 '-') c) :] ep ->
       n
   | [: id = ident (Buff.store 0 '-') :] -> identifier kwt id ]
 and less kwt =
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/camlp4/unmaintained/scheme/pr_scheme.ml	2005-12-19 16:49:53.000000000 +0000
+++ hashcaml/camlp4/unmaintained/scheme/pr_scheme.ml	2006-04-24 12:23:11.000000000 +0100
@@ -203,7 +203,7 @@
     pr_box ppf f x = fprintf ppf "@[%t@]" f;
     pr_rules =
       extfun Extfun.empty with
-      [ (loc, c, []) ->
+      [ (loc, c, []) as x ->
           fun ppf curr next dg k -> fprintf ppf "(@[<hv>%s%t@]" c (ks ")" k)
       | (loc, c, tl) ->
           fun ppf curr next dg k ->
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/debugger/Makefile	2005-08-25 16:35:16.000000000 +0100
+++ hashcaml/debugger/Makefile	2006-04-24 12:23:14.000000000 +0100
@@ -31,15 +31,32 @@
   ../otherlibs/unix/unix.cma \
   ../utils/misc.cmo ../utils/config.cmo \
   ../utils/tbl.cmo ../utils/clflags.cmo ../utils/consistbl.cmo \
-  ../parsing/longident.cmo \
+  ../parsing/longident.cmo ../parsing/asttypes.cmo ../utils/terminfo.cmo \
+  ../utils/warnings.cmo ../parsing/linenum.cmo \
+  ../typing/primitive.cmo ../parsing/location.cmo \
   ../typing/ident.cmo ../typing/path.cmo ../typing/types.cmo \
-  ../typing/btype.cmo ../typing/primitive.cmo ../typing/typedtree.cmo \
+  ../typing/btype.cmo \
   ../typing/subst.cmo ../typing/predef.cmo \
   ../typing/datarepr.cmo ../typing/env.cmo ../typing/oprint.cmo \
-  ../typing/ctype.cmo ../typing/printtyp.cmo ../typing/mtype.cmo \
+  ../bytecomp/opcodes.cmo ../typing/ident.cmo ../bytecomp/lambda.cmo  \
+  ../typing/ctype.cmo \
+  ../typing/typedtree.cmo ../typing/printtyp.cmo ../typing/mtype.cmo \
   ../bytecomp/runtimedef.cmo ../bytecomp/bytesections.cmo \
   ../bytecomp/dll.cmo ../bytecomp/meta.cmo ../bytecomp/symtable.cmo \
-  ../bytecomp/opcodes.cmo \
+  ../bytecomp/opcodes.cmo ../bytecomp/printlambda.cmo ../bytecomp/typeopt.cmo\
+  ../bytecomp/switch.cmo \
+  ../typing/parmatch.cmo ../bytecomp/matching.cmo \
+  ../hashing/hashpackage.cmo ../typing/typetexp.cmo ../typing/stypes.cmo\
+  ../typing/typecore.cmo\
+  ../hashing/normtypes.cmo ../polymarshal/polymarshal.cmo \
+  ../bytecomp/translobj.cmo ../bytecomp/translcore.cmo \
+  ../typing/includecore.cmo\
+  ../typing/includeclass.cmo\
+  ../typing/typedecl.cmo\
+  ../typing/typeclass.cmo\
+  ../bytecomp/translclass.cmo ../bytecomp/translmod.cmo\
+  ../bytecomp/instruct.cmo\
+  ../bytecomp/emitcode.cmo\
   ../toplevel/genprintval.cmo \
   ../otherlibs/dynlink/dynlink.cmo
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/debugger/eval.ml	2003-07-02 10:14:30.000000000 +0100
+++ hashcaml/debugger/eval.ml	2006-04-24 12:23:14.000000000 +0100
@@ -59,7 +59,7 @@
         | None ->
             raise(Error(Unbound_identifier id))
         end
-  | Pdot(root, fieldname, pos) ->
+  | Pdot(root, field_name, pos) ->
       let v = path event root in
       if not (Debugcom.Remote_value.is_block v) then
         raise(Error(Not_initialized_yet root));
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/debugger/main.ml	2005-11-29 12:17:27.000000000 +0000
+++ hashcaml/debugger/main.ml	2006-04-24 12:23:14.000000000 +0100
@@ -111,8 +111,7 @@
 
 let main () =
   try
-    socket_name := Filename.concat Filename.temp_dir_name
-                          ("camldebug" ^ (string_of_int (Unix.getpid ())));
+    socket_name := "/tmp/camldebug" ^ (string_of_int (Unix.getpid ()));
     begin try
       Arg.parse speclist anonymous "";
       Arg.usage speclist
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/debugger/printval.ml	2002-02-13 11:09:17.000000000 +0000
+++ hashcaml/debugger/printval.ml	2006-04-24 12:23:14.000000000 +0100
@@ -58,7 +58,7 @@
         with Symtable.Error _ ->
           raise Error
         end
-    | Pdot(root, fieldname, pos) ->
+    | Pdot(root, field_name, pos) ->
         let v = eval_path root in
         if not (Debugcom.Remote_value.is_block v)
         then raise Error
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/driver/errors.ml	2005-11-09 15:58:47.000000000 +0000
+++ hashcaml/driver/errors.ml	2006-04-24 12:23:17.000000000 +0100
@@ -63,7 +63,7 @@
   | Sys_error msg ->
       fprintf ppf "I/O error: %s" msg
   | Warnings.Errors (n) ->
-      fprintf ppf "@.Error: error-enabled warnings (%d occurrences)" n
+      fprintf ppf "@.Error: %d error-enabled warnings occurred." n
   | x -> fprintf ppf "@]"; raise x in
 
   fprintf ppf "@[%a@]@." report exn
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/driver/main.ml	2005-05-09 14:39:17.000000000 +0100
+++ hashcaml/driver/main.ml	2006-04-24 12:23:17.000000000 +0100
@@ -62,7 +62,7 @@
 
 let print_version_and_library () =
   print_string "The Objective Caml compiler, version ";
-  print_string Config.version; print_newline();
+  print_string Config.version; print_string " (HashCaml)"; print_newline();
   print_string "Standard library directory: ";
   print_string Config.standard_library; print_newline();
   exit 0
@@ -89,6 +89,7 @@
   let set r () = r := true
   let unset r () = r := false
   let _a = set make_archive
+  let _allowmynames = set allowmynames
   let _c = set compile_only
   let _cc s = c_compiler := s; c_linker := s
   let _cclib s = ccobjs := Misc.rev_split_words s @ !ccobjs
@@ -97,6 +98,8 @@
   let _custom = set custom_runtime
   let _dllib s = dllibs := Misc.rev_split_words s @ !dllibs
   let _dllpath s = dllpaths := !dllpaths @ [s]
+  let _dnormtrans = set dnormtrans
+  let _dnormtree = set dnormtree
   let _dtypes = set save_types
   let _g = set debug
   let _i () = print_types := true; compile_only := true
@@ -111,14 +114,18 @@
   let _noassert = set noassert
   let _nolabels = set classic
   let _noautolink = set no_auto_link
+  let _nomlpoly = (fun () -> mlpoly := false; polymarshal := false)
+  let _nopolymarshal = unset polymarshal
   let _nostdlib = set no_std_include
   let _o s = output_name := Some s
   let _output_obj () = output_c_object := true; custom_runtime := true
   let _pack = set make_package
+  let _pmdebug = set pmdebug
   let _pp s = preprocessor := Some s
   let _principal = set principal
   let _rectypes = set recursive_types
   let _thread = set use_threads
+  let _tupled_typereps = set tupled_typereps
   let _vmthread = set use_vmthreads
   let _unsafe = set fast
   let _use_prims s = use_prims := s
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/driver/main_args.ml	2005-12-28 17:27:03.000000000 +0000
+++ hashcaml/driver/main_args.ml	2006-04-24 12:23:17.000000000 +0100
@@ -15,6 +15,7 @@
 module Make_options (F :
    sig
      val _a : unit -> unit
+     val _allowmynames : unit -> unit
      val _c : unit -> unit
      val _cc : string -> unit
      val _cclib : string -> unit
@@ -23,6 +24,8 @@
      val _custom : unit -> unit
      val _dllib : string -> unit
      val _dllpath : string -> unit
+     val _dnormtrans : unit -> unit
+     val _dnormtree : unit -> unit
      val _dtypes : unit -> unit
      val _g : unit -> unit
      val _i : unit -> unit
@@ -36,14 +39,18 @@
      val _noassert : unit -> unit
      val _noautolink : unit -> unit
      val _nolabels : unit -> unit
+     val _nomlpoly : unit -> unit
+     val _nopolymarshal : unit -> unit
      val _nostdlib : unit -> unit
      val _o : string -> unit
      val _output_obj : unit -> unit
      val _pack : unit -> unit
+     val _pmdebug : unit -> unit
      val _pp : string -> unit
      val _principal : unit -> unit
      val _rectypes : unit -> unit
      val _thread : unit -> unit
+     val _tupled_typereps : unit -> unit
      val _vmthread : unit -> unit
      val _unsafe : unit -> unit
      val _use_prims : string -> unit
@@ -65,6 +72,8 @@
 struct
   let list = [
     "-a", Arg.Unit F._a, " Build a library";
+    "-allowmynames", Arg.Unit F._allowmynames,
+           " Allows references to mynames (experts only)";
     "-c", Arg.Unit F._c, " Compile only (do not link)";
     "-cc", Arg.String F._cc,
            "<command>  Use <command> as the C compiler and linker";
@@ -78,6 +87,8 @@
            "<lib>  Use the dynamically-loaded library <lib>";
     "-dllpath", Arg.String F._dllpath,
            "<dir>  Add <dir> to the run-time search path for shared libraries";
+    "-dnormtrans", Arg.Unit F._dnormtrans, " Print normalisation information";
+    "-dnormtree", Arg.Unit F._dnormtree, " Print generated normtree(s)";
     "-dtypes", Arg.Unit F._dtypes, " Save type information in <filename>.annot";
      "-for-pack", Arg.String (fun s -> ()),
            "<ident>  Ignored (for compatibility with ocamlopt)";
@@ -102,6 +113,10 @@
     "-noautolink", Arg.Unit F._noautolink,
            " Don't automatically link C libraries specified in .cma files";
     "-nolabels", Arg.Unit F._nolabels, " Ignore non-optional labels in types";
+    "-nomlpoly", Arg.Unit F._nomlpoly,
+           " Use relaxed value restriction (implies -nopolymarshal)";
+    "-nopolymarshal", Arg.Unit F._nopolymarshal,
+           " Disable polymorphic marshalling (experts only)";
     "-nostdlib", Arg.Unit F._nostdlib,
            " do not add default directory to the list of include directories";
     "-o", Arg.String F._o, "<file>  Set output file name to <file>";
@@ -109,6 +124,8 @@
            " Output a C object file instead of an executable";
     "-pack", Arg.Unit F._pack,
            " Package the given .cmo files into one .cmo";
+    "-pmdebug", Arg.Unit F._pmdebug,
+           " Print debugging info for polymorphic marshalling";
     "-pp", Arg.String F._pp,
            "<command>  Pipe sources through preprocessor <command>";
     "-principal", Arg.Unit F._principal,
@@ -116,6 +133,8 @@
     "-rectypes", Arg.Unit F._rectypes, " Allow arbitrary recursive types";
     "-thread", Arg.Unit F._thread,
            " Generate code that supports the system threads library";
+    "-tupledtrs", Arg.Unit F._tupled_typereps,
+           " Use tupled instead of curried form for typereps (experts only)";
     "-unsafe", Arg.Unit F._unsafe,
            " No bounds checking on array and string access";
     "-use-runtime", Arg.String F._use_runtime,
@@ -127,10 +146,10 @@
     "-version", Arg.Unit F._version, " Print compiler version and exit";
     "-verbose", Arg.Unit F._verbose, " Print calls to external commands";
     "-vmthread", Arg.Unit F._vmthread,
-           " Generate code that supports the threads library with VM-level\n\
-      \     scheduling";
+  " Generate code that supports the threads library with VM-level scheduling";
     "-w", Arg.String F._w,
       "<flags>  Enable or disable warnings according to <flags>:\n\
+      \032    A/a enable/disable all warnings\n\
       \032    C/c enable/disable suspicious comment\n\
       \032    D/d enable/disable deprecated features\n\
       \032    E/e enable/disable fragile match\n\
@@ -144,12 +163,11 @@
       \032    Y/y enable/disable suspicious unused variables\n\
       \032    Z/z enable/disable all other unused variables\n\
       \032    X/x enable/disable all other warnings\n\
-      \032    A/a enable/disable all warnings\n\
       \032    default setting is \"Aelz\"";
     "-warn-error" , Arg.String F._warn_error,
-     "<flags>  Treat the warnings of <flags> as errors, if they are\n\
-      \     enabled.  See option -w for the list of flags.\n\
-      \     Default setting is \"a\" (warnings are not errors)";
+      "<flags>  Treat the warnings of <flags> as errors, if they are enabled.\n\
+      \032    See option -w for the list of flags.\n\
+      \032    Default setting is \"a\" (warnings are not errors)";
     "-where", Arg.Unit F._where,
            " Print location of standard library and exit";
     "-nopervasives", Arg.Unit F._nopervasives, " (undocumented)";
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/driver/main_args.mli	2005-05-09 14:39:17.000000000 +0100
+++ hashcaml/driver/main_args.mli	2006-04-24 12:23:17.000000000 +0100
@@ -15,6 +15,7 @@
 module Make_options (F :
     sig
       val _a : unit -> unit
+      val _allowmynames : unit -> unit
       val _c : unit -> unit
       val _cc : string -> unit
       val _cclib : string -> unit
@@ -23,6 +24,8 @@
       val _custom : unit -> unit
       val _dllib : string -> unit
       val _dllpath : string -> unit
+      val _dnormtrans : unit -> unit
+      val _dnormtree : unit -> unit
       val _dtypes : unit -> unit
       val _g : unit -> unit
       val _i : unit -> unit
@@ -36,14 +39,18 @@
       val _noassert : unit -> unit
       val _noautolink : unit -> unit
       val _nolabels : unit -> unit
+      val _nomlpoly : unit -> unit
+      val _nopolymarshal : unit -> unit
       val _nostdlib : unit -> unit
       val _o : string -> unit
       val _output_obj : unit -> unit
       val _pack : unit -> unit
+      val _pmdebug : unit -> unit
       val _pp : string -> unit
       val _principal : unit -> unit
       val _rectypes : unit -> unit
       val _thread : unit -> unit
+      val _tupled_typereps : unit -> unit
       val _vmthread : unit -> unit
       val _unsafe : unit -> unit
       val _use_prims : string -> unit
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/driver/optmain.ml	2005-12-28 17:27:03.000000000 +0000
+++ hashcaml/driver/optmain.ml	2006-04-24 12:23:17.000000000 +0100
@@ -112,8 +112,8 @@
        "-dtypes", Arg.Set save_types,
              " Save type information in <filename>.annot";
        "-for-pack", Arg.String (fun s -> for_package := Some s),
-             "<ident>  Generate code that can later be `packed' with\n\
-         \     ocamlopt -pack -o <ident>.cmx";
+             "<ident>  Generate code that can later be `packed' with\n
+                       \t\t\tocamlopt -pack -o <ident>.cmx";
        "-i", Arg.Unit (fun () -> print_types := true; compile_only := true),
              " Print inferred interface";
        "-I", Arg.String(fun dir -> include_dirs := dir :: !include_dirs),
@@ -143,7 +143,7 @@
              " Output a C object file instead of an executable";
        "-p", Arg.Set gprofile,
              " Compile and link with profiling support for \"gprof\"\n\
-         \     (not supported on all platforms)";
+               \t(not supported on all platforms)";
        "-pack", Arg.Set make_package,
               " Package the given .cmx files into one .cmx";
        "-pp", Arg.String(fun s -> preprocessor := Some s),
@@ -164,6 +164,7 @@
        "-verbose", Arg.Set verbose, " Print calls to external commands";
        "-w", Arg.String (Warnings.parse_options false),
              "<flags>  Enable or disable warnings according to <flags>:\n\
+         \032    A/a enable/disable all warnings\n\
          \032    C/c enable/disable suspicious comment\n\
          \032    D/d enable/disable deprecated features\n\
          \032    E/e enable/disable fragile match\n\
@@ -177,12 +178,11 @@
          \032    Y/y enable/disable suspicious unused variables\n\
          \032    Z/z enable/disable all other unused variables\n\
          \032    X/x enable/disable all other warnings\n\
-         \032    A/a enable/disable all warnings\n\
          \032    default setting is \"Aelz\"";
        "-warn-error" , Arg.String (Warnings.parse_options true),
-        "<flags>  Treat the warnings of <flags> as errors, if they are\n\
-         \     enabled.  See option -w for the list of flags.\n\
-         \     Default setting is \"a\" (warnings are not errors)";
+        "<flags>  Treat the warnings of <flags> as errors, if they are enabled.\n\
+         \032    See option -w for the list of flags.\n\
+         \032    Default setting is \"a\" (warnings are not errors)";
        "-where", Arg.Unit print_standard_library,
          " Print location of standard library and exit";
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/lex/lexgen.ml	2004-03-23 16:57:24.000000000 +0000
+++ hashcaml/lex/lexgen.ml	2006-04-24 12:23:40.000000000 +0100
@@ -77,9 +77,7 @@
 
 
 (* A lot of sets and map structures *)
-
 module Ints = Set.Make(struct type t = int let compare = compare end)
-
 module Tags = Set.Make(struct type t = tag_info let compare = compare end)
 
 module TagMap =
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/.depend	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/.depend	2006-04-24 12:23:37.000000000 +0100
@@ -7,11 +7,10 @@
     odoc_dot.cmx odoc_config.cmx odoc_args.cmx odoc_analyse.cmx \
     ../utils/misc.cmx ../utils/config.cmx ../utils/clflags.cmx 
 odoc_analyse.cmo: ../utils/warnings.cmi ../typing/typetexp.cmi \
-    ../typing/types.cmi ../typing/typemod.cmi ../typing/typedtree.cmi \
-    ../typing/typedecl.cmi ../typing/typecore.cmi ../typing/typeclass.cmi \
-    ../bytecomp/translcore.cmi ../bytecomp/translclass.cmi \
-    ../parsing/syntaxerr.cmi ../parsing/parse.cmi odoc_types.cmi \
-    odoc_text.cmi odoc_sig.cmi odoc_module.cmo odoc_misc.cmi \
+    ../typing/typemod.cmi ../typing/typedtree.cmi ../typing/typedecl.cmi \
+    ../typing/typecore.cmi ../typing/typeclass.cmi ../bytecomp/translcore.cmi \
+    ../bytecomp/translclass.cmi ../parsing/syntaxerr.cmi ../parsing/parse.cmi \
+    odoc_types.cmi odoc_sig.cmi odoc_module.cmo odoc_misc.cmi \
     odoc_messages.cmo odoc_merge.cmi odoc_global.cmi odoc_dep.cmo \
     odoc_cross.cmi odoc_comments.cmi odoc_class.cmo odoc_ast.cmi \
     odoc_args.cmi ../utils/misc.cmi ../parsing/location.cmi \
@@ -19,11 +18,10 @@
     ../typing/ctype.cmi ../utils/config.cmi ../utils/clflags.cmo \
     ../utils/ccomp.cmi odoc_analyse.cmi 
 odoc_analyse.cmx: ../utils/warnings.cmx ../typing/typetexp.cmx \
-    ../typing/types.cmx ../typing/typemod.cmx ../typing/typedtree.cmx \
-    ../typing/typedecl.cmx ../typing/typecore.cmx ../typing/typeclass.cmx \
-    ../bytecomp/translcore.cmx ../bytecomp/translclass.cmx \
-    ../parsing/syntaxerr.cmx ../parsing/parse.cmx odoc_types.cmx \
-    odoc_text.cmx odoc_sig.cmx odoc_module.cmx odoc_misc.cmx \
+    ../typing/typemod.cmx ../typing/typedtree.cmx ../typing/typedecl.cmx \
+    ../typing/typecore.cmx ../typing/typeclass.cmx ../bytecomp/translcore.cmx \
+    ../bytecomp/translclass.cmx ../parsing/syntaxerr.cmx ../parsing/parse.cmx \
+    odoc_types.cmx odoc_sig.cmx odoc_module.cmx odoc_misc.cmx \
     odoc_messages.cmx odoc_merge.cmx odoc_global.cmx odoc_dep.cmx \
     odoc_cross.cmx odoc_comments.cmx odoc_class.cmx odoc_ast.cmx \
     odoc_args.cmx ../utils/misc.cmx ../parsing/location.cmx \
@@ -55,11 +53,11 @@
 odoc_class.cmx: ../typing/types.cmx odoc_value.cmx odoc_types.cmx \
     odoc_parameter.cmx odoc_name.cmx 
 odoc_comments.cmo: odoc_types.cmi odoc_text.cmi odoc_see_lexer.cmo \
-    odoc_parser.cmi odoc_misc.cmi odoc_messages.cmo odoc_lexer.cmo \
-    odoc_global.cmi odoc_comments_global.cmi odoc_comments.cmi 
+    odoc_parser.cmi odoc_messages.cmo odoc_lexer.cmo odoc_global.cmi \
+    odoc_comments_global.cmi odoc_comments.cmi 
 odoc_comments.cmx: odoc_types.cmx odoc_text.cmx odoc_see_lexer.cmx \
-    odoc_parser.cmx odoc_misc.cmx odoc_messages.cmx odoc_lexer.cmx \
-    odoc_global.cmx odoc_comments_global.cmx odoc_comments.cmi 
+    odoc_parser.cmx odoc_messages.cmx odoc_lexer.cmx odoc_global.cmx \
+    odoc_comments_global.cmx odoc_comments.cmi 
 odoc_comments_global.cmo: odoc_comments_global.cmi 
 odoc_comments_global.cmx: odoc_comments_global.cmi 
 odoc_config.cmo: ../utils/config.cmi odoc_config.cmi 
@@ -89,9 +87,9 @@
 odoc_global.cmo: ../utils/clflags.cmo odoc_global.cmi 
 odoc_global.cmx: ../utils/clflags.cmx odoc_global.cmi 
 odoc_html.cmo: odoc_text.cmi odoc_ocamlhtml.cmo odoc_messages.cmo \
-    odoc_info.cmi odoc_dag2html.cmi odoc_args.cmi 
+    odoc_info.cmi odoc_dag2html.cmi 
 odoc_html.cmx: odoc_text.cmx odoc_ocamlhtml.cmx odoc_messages.cmx \
-    odoc_info.cmx odoc_dag2html.cmx odoc_args.cmx 
+    odoc_info.cmx odoc_dag2html.cmx 
 odoc_info.cmo: ../typing/printtyp.cmi odoc_value.cmo odoc_types.cmi \
     odoc_type.cmo odoc_text.cmi odoc_str.cmi odoc_search.cmi odoc_scan.cmo \
     odoc_print.cmi odoc_parameter.cmo odoc_name.cmi odoc_module.cmo \
@@ -192,8 +190,8 @@
     odoc_text.cmi 
 odoc_text.cmx: odoc_types.cmx odoc_text_parser.cmx odoc_text_lexer.cmx \
     odoc_text.cmi 
-odoc_text_lexer.cmo: odoc_text_parser.cmi odoc_misc.cmi 
-odoc_text_lexer.cmx: odoc_text_parser.cmx odoc_misc.cmx 
+odoc_text_lexer.cmo: odoc_text_parser.cmi 
+odoc_text_lexer.cmx: odoc_text_parser.cmx 
 odoc_text_parser.cmo: odoc_types.cmi odoc_misc.cmi odoc_text_parser.cmi 
 odoc_text_parser.cmx: odoc_types.cmx odoc_misc.cmx odoc_text_parser.cmi 
 odoc_to_text.cmo: odoc_messages.cmo odoc_info.cmi 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/Changes.txt	2006-01-04 13:05:49.000000000 +0000
+++ hashcaml/ocamldoc/Changes.txt	2006-04-24 12:23:38.000000000 +0100
@@ -2,25 +2,9 @@
  - need to fix display of type parameters for inherited classes/class types
  - latex: types variant polymorphes dpassent de la page quand ils sont trop longs
  - utilisation nouvelles infos de Xavier: "dbut de rec", etc.
- - xml generator
 
 =====
-Release 3.09.1:
- - fix: remove .TP for generated man pages, use .sp instead
-   (.TP caused a lot of odd margins)
- - fix: html generator now output DOCTYPE and character encoding information.
- - add: m_text_only field in Module.t_module, to separate real modules
-   from text files handled as modules.
- - fix: display only text for "text modules"
- - extensible {foo } syntax
- - user can give .txt files on the command line, containing ocamldoc formatted
-   text, to be able to include bigger texts out of source files
- - -o option is now used by the html generator to indicate the prefix
-   of generated index files (to avoid conflict when a Index module exists
-   on case-insensitive file systems).
-
-=====
-Release 3.08.4:
+Next release:
  - some improvements in html display
  - better error messages for misplaced variant constructors comments
  - some fixes in man page generation (escaping characters)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/Makefile	2005-11-10 14:44:36.000000000 +0000
+++ hashcaml/ocamldoc/Makefile	2006-04-24 12:23:37.000000000 +0100
@@ -53,6 +53,7 @@
 OCAMLSRCDIR=..
 INCLUDES_DEP=-I $(OCAMLSRCDIR)/parsing \
 	-I $(OCAMLSRCDIR)/utils \
+	-I $(OCAMLSRCDIR)/hashing \
 	-I $(OCAMLSRCDIR)/typing \
 	-I $(OCAMLSRCDIR)/driver \
 	-I $(OCAMLSRCDIR)/bytecomp \
@@ -139,6 +140,7 @@
 	$(OCAMLSRCDIR)/utils/warnings.cmo \
 	$(OCAMLSRCDIR)/utils/ccomp.cmo \
 	$(OCAMLSRCDIR)/utils/consistbl.cmo \
+	$(OCAMLSRCDIR)/utils/terminfo.cmo \
 	$(OCAMLSRCDIR)/parsing/linenum.cmo\
 	$(OCAMLSRCDIR)/parsing/location.cmo\
 	$(OCAMLSRCDIR)/parsing/longident.cmo \
@@ -168,10 +170,19 @@
 	$(OCAMLSRCDIR)/typing/typeclass.cmo \
 	$(OCAMLSRCDIR)/typing/mtype.cmo \
 	$(OCAMLSRCDIR)/typing/includemod.cmo \
-	$(OCAMLSRCDIR)/typing/typemod.cmo \
 	$(OCAMLSRCDIR)/bytecomp/lambda.cmo \
-	$(OCAMLSRCDIR)/bytecomp/typeopt.cmo \
 	$(OCAMLSRCDIR)/bytecomp/printlambda.cmo \
+        $(OCAMLSRCDIR)/hashing/normtypes.cmo \
+        $(OCAMLSRCDIR)/hashing/normtypedecl.cmo \
+	$(OCAMLSRCDIR)/polymarshal/polymarshal.cmo \
+        $(OCAMLSRCDIR)/hashing/normtree.cmo \
+        $(OCAMLSRCDIR)/hashing/hashpackage.cmo \
+	$(OCAMLSRCDIR)/hashing/npretty.cmo \
+	$(OCAMLSRCDIR)/hashing/transig.cmo \
+        $(OCAMLSRCDIR)/hashing/normtrans.cmo \
+        $(OCAMLSRCDIR)/hashing/pptypedtree.cmo \
+	$(OCAMLSRCDIR)/typing/typemod.cmo \
+	$(OCAMLSRCDIR)/bytecomp/typeopt.cmo \
 	$(OCAMLSRCDIR)/bytecomp/switch.cmo \
 	$(OCAMLSRCDIR)/bytecomp/matching.cmo \
 	$(OCAMLSRCDIR)/bytecomp/translobj.cmo \
@@ -277,7 +288,7 @@
 ###########
 test: dummy
 	$(MKDIR) $@
-	$(OCAMLDOC_RUN) -html -colorize-code -sort -d $@ $(INCLUDES) -dump $@/ocamldoc.odoc test.txt test2.txt odoc*.ml odoc*.mli -v
+	$(OCAMLDOC_RUN) -html -colorize-code -sort -d $@ $(INCLUDES) -dump $@/ocamldoc.odoc odoc*.ml odoc*.mli
 
 test_stdlib: dummy
 	$(MKDIR) $@
@@ -292,7 +303,7 @@
 
 test_latex: dummy
 	$(MKDIR) $@
-	$(OCAMLDOC_RUN) -latex -sort -o $@/test.tex -d $@ $(INCLUDES) odoc*.ml odoc*.mli test2.txt ../stdlib/*.mli ../otherlibs/unix/unix.mli
+	$(OCAMLDOC_RUN) -latex -sort -o $@/test.tex -d $@ $(INCLUDES) odoc*.ml odoc*.mli ../stdlib/*.mli ../otherlibs/unix/unix.mli
 
 test_latex_simple: dummy
 	$(MKDIR) $@
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_analyse.ml	2005-11-10 14:44:36.000000000 +0000
+++ hashcaml/ocamldoc/odoc_analyse.ml	2006-04-24 12:23:38.000000000 +0100
@@ -9,10 +9,9 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: odoc_analyse.ml,v 1.12.2.2 2005/11/10 14:44:36 guesdon Exp $ *)
+(* $Id: odoc_analyse.ml,v 1.12 2005/08/13 20:59:37 doligez Exp $ *)
 
-(** Analysis of source files. This module is strongly inspired from
-    driver/main.ml :-) *)
+(** Analysis of source files. This module is strongly inspired from driver/main.ml :-) *)
 
 let print_DEBUG s = print_string s ; print_newline ()
 
@@ -153,7 +152,7 @@
    driver/error.ml file. We do this because there are
    some differences between the possibly raised exceptions
    in the bytecode (error.ml) and opt (opterros.ml) compilers
-   and we don't want to take care of this. Besises, these
+   and we don't want to take care of this. Besisdes, this
    differences only concern code generation (i believe).*)
 let process_error exn =
   let report ppf = function
@@ -197,11 +196,7 @@
 let process_file ppf sourcefile =
   if !Odoc_args.verbose then
     (
-     let f = match sourcefile with
-       Odoc_args.Impl_file f
-     | Odoc_args.Intf_file f -> f
-     | Odoc_args.Text_file f -> f
-     in
+     let f = match sourcefile with Odoc_args.Impl_file f | Odoc_args.Intf_file f -> f in
      print_string (Odoc_messages.analysing f) ;
      print_newline ();
     );
@@ -213,9 +208,9 @@
          match parsetree_typedtree_opt with
            None ->
              None
-         | Some (parsetree, typedtree) ->
+	 | Some ((_, parsetree), (t_str, t_coercion, _)) ->
              let file_module = Ast_analyser.analyse_typed_tree file
-                 !Location.input_name parsetree typedtree
+		 !Location.input_name parsetree (t_str, t_coercion)
              in
              file_module.Odoc_module.m_top_deps <- Odoc_dep.impl_dependencies parsetree ;
 
@@ -265,45 +260,6 @@
            incr Odoc_global.errors ;
            None
       )
-  | Odoc_args.Text_file file ->
-      try
-        let mod_name =
-          String.capitalize (Filename.basename (Filename.chop_extension file))
-        in
-        let txt =
-          try Odoc_text.Texter.text_of_string (Odoc_misc.input_file_as_string file)
-          with Odoc_text.Text_syntax (l, c, s) ->
-            raise (Failure (Odoc_messages.text_parse_error l c s))
-        in
-        let m =
-          {
-            Odoc_module.m_name = mod_name ;
-            Odoc_module.m_type = Types.Tmty_signature [] ;
-            Odoc_module.m_info = None ;
-            Odoc_module.m_is_interface = true ;
-            Odoc_module.m_file = file ;
-            Odoc_module.m_kind = Odoc_module.Module_struct
-              [Odoc_module.Element_module_comment txt] ;
-            Odoc_module.m_loc =
-              { Odoc_types.loc_impl = None ;
-                Odoc_types.loc_inter = Some (file, 0) } ;
-            Odoc_module.m_top_deps = [] ;
-            Odoc_module.m_code = None ;
-            Odoc_module.m_code_intf = None ;
-	    Odoc_module.m_text_only = true ;
-          }
-        in
-        Some m
-      with
-       | Sys_error s
-       | Failure s ->
-           prerr_endline s;
-           incr Odoc_global.errors ;
-           None
-       | e ->
-           process_error e ;
-           incr Odoc_global.errors ;
-           None
 
 (** Remove the class elements between the stop special comments. *)
 let rec remove_class_elements_between_stop keep eles =
@@ -524,3 +480,6 @@
   with
     Sys_error s ->
       raise (Failure s)
+
+
+(* eof $Id: odoc_analyse.ml,v 1.12 2005/08/13 20:59:37 doligez Exp $ *)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_args.ml	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_args.ml	2006-04-24 12:23:37.000000000 +0100
@@ -20,7 +20,6 @@
 type source_file =
     Impl_file of string
   | Intf_file of string
-  | Text_file of string
 
 let include_dirs = Clflags.include_dirs
 
@@ -215,7 +214,6 @@
   "-pp", Arg.String (fun s -> preprocessor := Some s), M.preprocess ;
   "-impl", Arg.String (fun s -> files := !files @ [Impl_file s]), M.option_impl ;
   "-intf", Arg.String (fun s -> files := !files @ [Intf_file s]), M.option_intf ;
-  "-text", Arg.String (fun s -> files := !files @ [Text_file s]), M.option_text ;
   "-rectypes", Arg.Set recursive_types, M.rectypes ;
   "-nolabels", Arg.Unit (fun () -> classic := true), M.nolabels ;
   "-warn-error", Arg.Set Odoc_global.warn_error, M.werr ;
@@ -320,9 +318,6 @@
         if Filename.check_suffix f "mli" then
           Intf_file f
         else
-          if Filename.check_suffix f "txt" then
-            Text_file f
-          else
             failwith (Odoc_messages.unknown_extension f)
     in
     files := !files @ [sf]
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_args.mli	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_args.mli	2006-04-24 12:23:37.000000000 +0100
@@ -17,7 +17,6 @@
 type source_file =
     Impl_file of string
   | Intf_file of string
-  | Text_file of string
 
 (** The include_dirs in the OCaml compiler. *)
 val include_dirs : string list ref
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_ast.ml	2005-11-10 14:44:36.000000000 +0000
+++ hashcaml/ocamldoc/odoc_ast.ml	2006-04-24 12:23:38.000000000 +0100
@@ -101,7 +101,7 @@
             info_list
       | Typedtree.Tstr_value (_, pat_exp_list) ->
           List.iter
-            (fun (pat,exp) ->
+            (fun (pat,exp,_) ->
               match iter_val_pattern pat.Typedtree.pat_desc with
                 None -> ()
               | Some n -> Hashtbl.add table_values n (pat,exp)
@@ -308,7 +308,7 @@
                 (
                  (
                   match func_body.exp_desc with
-                    Typedtree.Texp_let (_, ({pat_desc = Typedtree.Tpat_var id } , exp) :: _, func_body2) ->
+                    Typedtree.Texp_let (_, ({pat_desc = Typedtree.Tpat_var id } , exp, _) :: _, func_body2) ->
                       let name = Name.from_ident id in
                       let new_param = Simple_name
                           { sn_name = name ;
@@ -453,7 +453,7 @@
                             (
                              (
                               match body.exp_desc with
-                                Typedtree.Texp_let (_, ({pat_desc = Typedtree.Tpat_var id } , exp) :: _, body2) ->
+                                Typedtree.Texp_let (_, ({pat_desc = Typedtree.Tpat_var id } , exp, _) :: _, body2) ->
                                   let name = Name.from_ident id in
                                   let new_param = Simple_name
                                       { sn_name = name ;
@@ -1405,7 +1405,6 @@
           m_top_deps = [] ;
 	  m_code = None ; (* code is set by the caller, after the module is created *)
 	  m_code_intf = m_code_intf ;
-	  m_text_only = false ;
       }
       in
       match (p_module_expr.Parsetree.pmod_desc, tt_module_expr.Typedtree.mod_desc) with
@@ -1414,7 +1413,7 @@
           { m_base with m_kind = Module_alias { ma_name = alias_name ;
                                                 ma_module = None ; } }
 
-      | (Parsetree.Pmod_structure p_structure, Typedtree.Tmod_structure tt_structure) ->
+      | (Parsetree.Pmod_structure (_, p_structure), Typedtree.Tmod_structure (_, tt_structure)) ->
           let elements = analyse_structure env complete_name pos_start pos_end p_structure tt_structure in
           (* we must complete the included modules *)
           let included_modules_from_tt = tt_get_included_module_list tt_structure in
@@ -1510,9 +1509,9 @@
 *)
           }
 
-      | (Parsetree.Pmod_structure p_structure,
+      | (Parsetree.Pmod_structure (_, p_structure),
          Typedtree.Tmod_constraint
-	   ({ Typedtree.mod_desc = Typedtree.Tmod_structure tt_structure},
+	   ({ Typedtree.mod_desc = Typedtree.Tmod_structure (_, tt_structure)},
 	    tt_modtype, _)
 	) ->
 	  (* needed for recursive modules *)
@@ -1587,7 +1586,6 @@
          m_top_deps = [] ;
 	 m_code = (if !Odoc_args.keep_code then Some !file else None) ;
 	 m_code_intf = None ;
-	 m_text_only = false ;
        }
   end
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_comments.ml	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_comments.ml	2006-04-24 12:23:38.000000000 +0100
@@ -312,33 +312,4 @@
 
 module Basic_info_retriever = Info_retriever (Odoc_text.Texter)
 
-let info_of_string s =
-  let dummy =
-    {
-      i_desc = None ;
-      i_authors = [] ;
-      i_version = None ;
-      i_sees = [] ;
-      i_since = None ;
-      i_deprecated = None ;
-      i_params = [] ;
-      i_raised_exceptions = [] ;
-      i_return_value = None ;
-      i_custom = [] ;
-    }
-  in
-  let s2 = Printf.sprintf "(** %s *)" s in
-  let (_, i_opt) = Basic_info_retriever.first_special "-" s2 in
-  match i_opt with
-    None -> dummy
-  | Some i -> i
-
-let info_of_comment_file f =
-  try
-    let s = Odoc_misc.input_file_as_string f in
-    info_of_string s
-  with
-    Sys_error s ->
-      failwith s
-
-(* eof $Id: odoc_comments.ml,v 1.4.12.1 2005/11/07 15:59:04 doligez Exp $ *)
+(* eof $Id: odoc_comments.ml,v 1.4 2003/11/24 10:39:29 starynke Exp $ *)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_comments.mli	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_comments.mli	2006-04-24 12:23:38.000000000 +0100
@@ -55,18 +55,3 @@
           string -> string -> Odoc_types.info option * 'a list
 
   end
-
-(** [info_of_string s] parses the given string
-   like a regular ocamldoc comment and return an
-   {!Odoc_types.info} structure.
-   @return an empty structure if there was a syntax error. TODO: change this
-*)
-val info_of_string : string -> Odoc_types.info
-
-(** [info_of_comment_file file] parses the given file
-   and return an {!Odoc_types.info} structure. The content of the
-   file must have the same syntax as the content of a special comment.
-   @raise Failure is the file could not be opened or there is a
-   syntax error.
-*)
-val info_of_comment_file : string -> Odoc_types.info
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_cross.ml	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_cross.ml	2006-04-24 12:23:37.000000000 +0100
@@ -681,7 +681,6 @@
       Module_list l
   | Index_list ->
       Index_list
-  | Custom (s,t) -> Custom (s, (assoc_comments_text module_list t))
 
 and assoc_comments_text module_list text =
   List.map (assoc_comments_text_elements module_list) text
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_html.ml	2005-11-10 14:44:36.000000000 +0000
+++ hashcaml/ocamldoc/odoc_html.ml	2006-04-24 12:23:37.000000000 +0100
@@ -9,9 +9,9 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: odoc_html.ml,v 1.58.2.3 2005/11/10 14:44:36 guesdon Exp $ *)
+(* $Id: odoc_html.ml,v 1.58 2005/08/16 00:48:56 garrigue Exp $ *)
 
-(** Generation of html documentation.*)
+(** Generation of html documentation. *)
 
 let print_DEBUG s = print_string s ; print_newline ()
 
@@ -248,9 +248,6 @@
       | Odoc_info.Subscript t -> self#html_of_Subscript b t
       | Odoc_info.Module_list l -> self#html_of_Module_list b l
       | Odoc_info.Index_list -> self#html_of_Index_list b
-      | Odoc_info.Custom (s,t) -> self#html_of_custom_text b s t
-
-    method html_of_custom_text b s t = ()
 
     method html_of_Raw b s = bs b (self#escape s)
 
@@ -453,7 +450,7 @@
           bs b "</td></tr>\n"
         )
         l;
-      bs b "</table>\n"
+      bs b "</table>\n</body>\n</html>";
 
     method html_of_Index_list b =
       let index_if_not_empty l url m =
@@ -690,11 +687,6 @@
     inherit text
     inherit info
 
-    val mutable doctype =
-      "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"
-    val mutable character_encoding =
-      "<meta content=\"text/html; charset=iso-8859-1\" http-equiv=\"Content-Type\">\n"
-
     (** The default style options. *)
     val mutable default_style_options =
       ["a:visited {color : #416DFF; text-decoration : none; }" ;
@@ -787,35 +779,26 @@
        when printing a module type. *)
     val mutable known_modules_names = StringSet.empty
 
-    method index_prefix =
-      if !Odoc_args.out_file = Odoc_messages.default_out_file then
-        "index"
-      else
-        Filename.basename !Odoc_args.out_file
-
     (** The main file. *)
-    method index =
-      let p = self#index_prefix in
-      Printf.sprintf "%s.html" p
-
+    method index = "index.html"
     (** The file for the index of values. *)
-    method index_values = Printf.sprintf "%s_values.html" self#index_prefix
+    method index_values = "index_values.html"
     (** The file for the index of types. *)
-    method index_types = Printf.sprintf "%s_types.html" self#index_prefix
+    method index_types = "index_types.html"
     (** The file for the index of exceptions. *)
-    method index_exceptions = Printf.sprintf "%s_exceptions.html" self#index_prefix
+    method index_exceptions = "index_exceptions.html"
     (** The file for the index of attributes. *)
-    method index_attributes = Printf.sprintf "%s_attributes.html" self#index_prefix
+    method index_attributes = "index_attributes.html"
     (** The file for the index of methods. *)
-    method index_methods = Printf.sprintf "%s_methods.html" self#index_prefix
+    method index_methods = "index_methods.html"
     (** The file for the index of classes. *)
-    method index_classes = Printf.sprintf "%s_classes.html" self#index_prefix
+    method index_classes = "index_classes.html"
     (** The file for the index of class types. *)
-    method index_class_types = Printf.sprintf "%s_class_types.html" self#index_prefix
+    method index_class_types = "index_class_types.html"
     (** The file for the index of modules. *)
-    method index_modules = Printf.sprintf "%s_modules.html" self#index_prefix
+    method index_modules = "index_modules.html"
     (** The file for the index of module types. *)
-    method index_module_types = Printf.sprintf "%s_module_types.html" self#index_prefix
+    method index_module_types = "index_module_types.html"
 
 
     (** The list of attributes. Filled in the [generate] method. *)
@@ -899,7 +882,6 @@
         in
         bs b "<head>\n";
         bs b style;
-	bs b character_encoding ;
         bs b "<link rel=\"Start\" href=\"";
         bs b self#index;
         bs b "\">\n" ;
@@ -1280,11 +1262,11 @@
       bp b "<a name=\"%s\"></a>" (Naming.value_target v);
       (
        match v.val_code with
-         None -> bs b (self#escape (Name.simple v.val_name))
+         None -> bs b (Name.simple v.val_name)
        | Some c ->
            let file = Naming.file_code_value_complete_target v in
            self#output_code v.val_name (Filename.concat !Args.target_dir file) c;
-           bp b "<a href=\"%s\">%s</a>" file (self#escape (Name.simple v.val_name))
+           bp b "<a href=\"%s\">%s</a>" file (Name.simple v.val_name)
       );
       bs b " : ";
       self#html_of_type_expr b (Name.father v.val_name) v.val_type;
@@ -1986,7 +1968,7 @@
         let f_ele e =
           let simple_name = Name.simple (name e) in
           let father_name = Name.father (name e) in
-          bp b "<tr><td><a href=\"%s\">%s</a> " (target e) (self#escape simple_name);
+          bp b "<tr><td><a href=\"%s\">%s</a> " (target e) simple_name;
           if simple_name <> father_name && father_name <> "" then
             bp b "[<a href=\"%s\">%s</a>]" (fst (Naming.html_files father_name)) father_name;
           bs b "</td>\n<td>";
@@ -2040,7 +2022,6 @@
         let b = new_buf () in
         let pre_name = opt (fun c -> c.cl_name) pre in
         let post_name = opt (fun c -> c.cl_name) post in
-	bs b doctype ;
         bs b "<html>\n";
         self#print_header b
           ~nav: (Some (pre_name, post_name, cl.cl_name))
@@ -2087,7 +2068,6 @@
         let b = new_buf () in
         let pre_name = opt (fun ct -> ct.clt_name) pre in
         let post_name = opt (fun ct -> ct.clt_name) post in
-	bs b doctype ;
         bs b "<html>\n";
         self#print_header b
           ~nav: (Some (pre_name, post_name, clt.clt_name))
@@ -2133,7 +2113,6 @@
         let b = new_buf () in
         let pre_name = opt (fun mt -> mt.mt_name) pre in
         let post_name = opt (fun mt -> mt.mt_name) post in
-	bs b doctype ;
         bs b "<html>\n";
         self#print_header b
           ~nav: (Some (pre_name, post_name, mt.mt_name))
@@ -2201,7 +2180,6 @@
         let b = new_buf () in
         let pre_name = opt (fun m -> m.m_name) pre in
         let post_name = opt (fun m -> m.m_name) post in
-	bs b doctype ;
         bs b "<html>\n";
         self#print_header b
           ~nav: (Some (pre_name, post_name, modu.m_name))
@@ -2210,10 +2188,6 @@
         bs b "<body>\n" ;
         self#print_navbar b pre_name post_name modu.m_name ;
         bs b "<center><h1>";
-	if modu.m_text_only then
-	  bs b modu.m_name
-	else
-	  (
            bs b
              (
               if Module.module_is_functor modu then
@@ -2226,11 +2200,10 @@
             match modu.m_code with
               None -> ()
             | Some _ -> bp b " (<a href=\"%s\">.ml</a>)" code_file
-           )
 	  );
         bs b "</h1></center>\n<br>\n";
 
-        if not modu.m_text_only then self#html_of_module b ~with_link: false modu;
+        self#html_of_module b ~with_link: false modu;
 
         (* parameters for functors *)
         self#html_of_module_parameter_list b
@@ -2238,7 +2211,7 @@
           (Module.module_parameters modu);
 
         (* a horizontal line *)
-        if not modu.m_text_only then bs b "<hr width=\"100%\">\n";
+        bs b "<hr width=\"100%\">\n";
 
         (* module elements *)
         List.iter
@@ -2275,14 +2248,13 @@
         Sys_error s ->
           raise (Failure s)
 
-    (** Generate the [<index_prefix>.html] file corresponding to the given module list.
+    (** Generate the [index.html] file corresponding to the given module list.
        @raise Failure if an error occurs.*)
     method generate_index module_list =
       try
         let chanout = open_out (Filename.concat !Args.target_dir self#index) in
         let b = new_buf () in
         let title = match !Args.title with None -> "" | Some t -> self#escape t in
-	bs b doctype ;
         bs b "<html>\n";
         self#print_header b self#title;
         bs b "<body>\n";
@@ -2298,8 +2270,7 @@
              self#html_of_Index_list b;
              bs b "<br/>";
              self#html_of_Module_list b
-               (List.map (fun m -> m.m_name) module_list);
-	     bs b "</body>\n</html>"
+	       (List.map (fun m -> m.m_name) module_list)
          | Some i -> self#html_of_info ~indent: false b info
         );
         Buffer.output_buffer chanout b;
@@ -2399,7 +2370,7 @@
         self#index_module_types
 
     (** Generate all the html files from a module list. The main
-       file is [<index_prefix>.html]. *)
+       file is [index.html]. *)
     method generate module_list =
       (* init the style *)
       self#init_style ;
@@ -2477,3 +2448,5 @@
           Buffer.contents b
         )
   end
+
+(* eof $Id: odoc_html.ml,v 1.58 2005/08/16 00:48:56 garrigue Exp $ *)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_info.ml	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_info.ml	2006-04-24 12:23:37.000000000 +0100
@@ -48,7 +48,6 @@
   | Subscript of text
   | Module_list of string list
   | Index_list
-  | Custom of string * text
 
 and text = text_element list
 
@@ -274,8 +273,34 @@
 
   Buffer.contents b
 
-let info_of_string = Odoc_comments.info_of_string
-let info_of_comment_file = Odoc_comments.info_of_comment_file
+let info_of_string s =
+  let dummy =
+    {
+      i_desc = None ;
+      i_authors = [] ;
+      i_version = None ;
+      i_sees = [] ;
+      i_since = None ;
+      i_deprecated = None ;
+      i_params = [] ;
+      i_raised_exceptions = [] ;
+      i_return_value = None ;
+      i_custom = [] ;
+    }
+  in
+  let s2 = Printf.sprintf "(** %s *)" s in
+  let (_, i_opt) = Odoc_comments.Basic_info_retriever.first_special "-" s2 in
+  match i_opt with
+    None -> dummy
+  | Some i -> i
+
+let info_of_comment_file f =
+  try
+    let s = Odoc_misc.input_file_as_string f in
+    info_of_string s
+  with
+    Sys_error s ->
+      failwith s
 
 module Search =
   struct
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_info.mli	2005-11-10 14:44:36.000000000 +0000
+++ hashcaml/ocamldoc/odoc_info.mli	2006-04-24 12:23:38.000000000 +0100
@@ -52,7 +52,6 @@
   | Module_list of string list
        (** The table of the given modules with their abstract. *)
   | Index_list (** The links to the various indexes (values, types, ...) *)
-  | Custom of string * text (** to extend \{foo syntax *)
 
 (** A text is a list of [text_element]. The order matters. *)
 and text = text_element list
@@ -453,7 +452,6 @@
           mutable m_top_deps : Name.t list ; (** The toplevels module names this module depends on. *)
 	  mutable m_code : string option ; (** The whole code of the module *)
 	  mutable m_code_intf : string option ; (** The whole code of the interface of the module *)
-	  m_text_only : bool ; (** [true] if the module comes from a text file *)
         }
 
     and module_type_alias = Odoc_module.module_type_alias =
@@ -921,7 +919,6 @@
       type source_file =
 	  Impl_file of string
 	| Intf_file of string
-	| Text_file of string
 
       (** The class type of documentation generators. *)
       class type doc_generator =
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_latex.ml	2005-11-10 14:44:36.000000000 +0000
+++ hashcaml/ocamldoc/odoc_latex.ml	2006-04-24 12:23:38.000000000 +0100
@@ -243,9 +243,6 @@
       | Odoc_info.Subscript t -> self#latex_of_Subscript fmt t
       | Odoc_info.Module_list _ -> ()
       | Odoc_info.Index_list -> ()
-      | Odoc_info.Custom (s,t) -> self#latex_of_custom_text fmt s t
-
-    method latex_of_custom_text fmt s t = ()
 
     method latex_of_Raw fmt s =
       ps fmt (self#escape s)
@@ -1013,16 +1010,7 @@
     (** Generate the LaTeX code for the given top module, in the given buffer. *)
     method generate_for_top_module fmt m =
       let (first_t, rest_t) = self#first_and_rest_of_info m.m_info in
-      let text =
-	if m.m_text_only then
-	  [ Title (1, None, [Raw m.m_name]  @
-                   (match first_t with
-                     [] -> []
-                   | t -> (Raw " : ") :: t)
-		  ) ;
-	  ]
-	else
-	  [ Title (1, None,
+      let text = [ Title (1, None,
                    [ Raw (Odoc_messages.modul^" ") ; Code m.m_name ] @
                    (match first_t with
                      [] -> []
@@ -1035,7 +1023,7 @@
       self#latex_of_text fmt rest_t ;
 
       self#latex_of_text fmt [ Newline ] ;
-      if not m.m_text_only then ps fmt "\\ocamldocvspace{0.5cm}\n\n";
+      ps fmt "\\ocamldocvspace{0.5cm}\n\n";
       List.iter
         (fun ele ->
           self#latex_of_module_element fmt m.m_name ele;
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_man.ml	2005-11-10 10:28:50.000000000 +0000
+++ hashcaml/ocamldoc/odoc_man.ml	2006-04-24 12:23:38.000000000 +0100
@@ -85,7 +85,7 @@
           bs b "\"\n";
           List.iter
             (fun (ex, desc) ->
-              bs b ".sp\n.B \"";
+	      bs b ".TP\n.B \"";
               bs b ex;
               bs b "\"\n";
               self#man_of_text b desc;
@@ -120,7 +120,7 @@
           bs b "\"\n";
           List.iter
             (fun see ->
-              bs b ".sp\n";
+	      bs b ".TP\n \"\"\n";
               self#man_of_see b see;
               bs b "\n"
             )
@@ -250,12 +250,12 @@
           self#man_of_text2 b t
       | Odoc_info.List tl ->
           List.iter
-            (fun t -> bs b "\n.sp\n \\-"; self#man_of_text2 b t; bs b "\n")
+            (fun t -> bs b ".TP\n \"\"\n"; self#man_of_text2 b t; bs b "\n")
             tl;
           bs b "\n"
       | Odoc_info.Enum tl ->
           List.iter
-            (fun t -> bs b "\n.sp\n \\-"; self#man_of_text2 b t; bs b "\n")
+            (fun t -> bs b ".TP\n \"\"\n"; self#man_of_text2 b t; bs b "\n")
             tl;
           bs b "\n"
       | Odoc_info.Newline ->
@@ -282,9 +282,6 @@
           ()
       | Odoc_info.Index_list ->
           ()
-      | Odoc_info.Custom (s,t) -> self#man_of_custom_text b s t
-
-    method man_of_custom_text b s t = ()
 
     (** Print groff string to display code. *)
     method man_of_code b s = self#man_of_text b [ Code s ]
@@ -506,7 +503,7 @@
           bs b ": \n";
           List.iter
             (fun p ->
-              bs b ".sp\n";
+              bs b ".TP\n";
               bs b "\"";
               bs b (Parameter.complete_name p);
               bs b "\"\n";
@@ -551,7 +548,7 @@
           bs b ":\"\n";
           List.iter
             (fun (p, desc_opt) ->
-              bs b ".sp\n";
+              bs b ".TP\n";
               bs b ("\""^p.mp_name^"\"\n");
               self#man_of_module_type b m_name p.mp_type;
               bs b "\n";
@@ -668,7 +665,7 @@
         let b = new_buf () in
         bs b (".TH \""^cl.cl_name^"\" ");
         bs b !Odoc_args.man_section ;
-        bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" ");
+        bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^"\" ");
         bs b "OCamldoc ";
         bs b ("\""^(match !Args.title with Some t -> t | None -> "")^"\"\n");
 
@@ -727,7 +724,7 @@
         let b = new_buf () in
         bs b (".TH \""^ct.clt_name^"\" ");
         bs b !Odoc_args.man_section ;
-        bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" ");
+        bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^"\" ");
         bs b "OCamldoc ";
         bs b ("\""^(match !Args.title with Some t -> t | None -> "")^"\"\n");
 
@@ -784,7 +781,7 @@
         let b = new_buf () in
         bs b (".TH \""^mt.mt_name^"\" ");
         bs b !Odoc_args.man_section ;
-        bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" ");
+        bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^"\" ");
         bs b "OCamldoc ";
         bs b ("\""^(match !Args.title with Some t -> t | None -> "")^"\"\n");
 
@@ -862,7 +859,7 @@
         let b = new_buf () in
         bs b (".TH \""^m.m_name^"\" ");
         bs b !Odoc_args.man_section ;
-        bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" ");
+        bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^"\" ");
         bs b "OCamldoc ";
         bs b ("\""^(match !Args.title with Some t -> t | None -> "")^"\"\n");
 
@@ -989,7 +986,7 @@
         let b = new_buf () in
         bs b (".TH \""^name^"\" ");
         bs b !Odoc_args.man_section ;
-        bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" ");
+        bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^"\" ");
         bs b "OCamldoc ";
         bs b ("\""^(match !Args.title with Some t -> t | None -> "")^"\"\n");
         bs b ".SH NAME\n";
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_messages.ml	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_messages.ml	2006-04-24 12:23:38.000000000 +0100
@@ -38,7 +38,6 @@
 let preprocess = "<command>\tPipe sources through preprocessor <command>"
 let option_impl ="<file>\tConsider <file> as a .ml file"
 let option_intf ="<file>\tConsider <file> as a .mli file"
-let option_text ="<file>\tConsider <file> as a .txt file"
 let display_custom_generators_dir = "\tDisplay custom generators standard directory and exit"
 let add_load_dir = "<dir>\tAdd the given directory to the search path for custom\n"^
   "\t\tgenerators "^bytecode_only
@@ -63,9 +62,7 @@
 let default_out_file = "ocamldoc.out"
 let out_file =
   "<file>\tSet the ouput file name, used by texi, latex and dot generators\n"^
-  "\t\t(default is "^default_out_file^")\n"^
-  "\t\tor the prefix of index files for the HTML generator\n"^
-  "\t\t(default is index)"
+  "\t\t(default is "^default_out_file^")"
 
 let dot_include_all =
   "\n\t\tInclude all modules in the dot output, not only the\n"^
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_misc.ml	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_misc.ml	2006-04-24 12:23:38.000000000 +0100
@@ -9,17 +9,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: odoc_misc.ml,v 1.19.4.1 2005/11/07 15:59:04 doligez Exp $ *)
-
-let no_blanks s =
-  let len = String.length s in
-  let buf = Buffer.create len in
-  for i = 0 to len - 1 do
-    match s.[i] with
-      ' ' | '\n' | '\t' | '\r' -> ()
-    | c -> Buffer.add_char buf c
-  done;
-  Buffer.contents buf
+(* $Id: odoc_misc.ml,v 1.19 2005/03/24 17:20:53 doligez Exp $ *)
 
 let input_file_as_string nom =
   let chanin = open_in_bin nom in
@@ -132,7 +122,6 @@
             )
       | Odoc_types.Index_list ->
           ""
-      | Odoc_types.Custom (_, t) -> string_of_text t
   in
   String.concat "" (List.map iter t)
 
@@ -273,7 +262,6 @@
              l
           )
     | Odoc_types.Index_list -> []
-    | Odoc_types.Custom (s,t) -> [Odoc_types.Custom (s, text_no_title_no_list t)]
   in
   List.flatten (List.map iter t)
 
@@ -303,7 +291,6 @@
     | Odoc_types.Subscript t  -> iter_text t
     | Odoc_types.Module_list _ -> ()
     | Odoc_types.Index_list -> ()
-    | Odoc_types.Custom (_, t) -> iter_text t
   and iter_text te =
     List.iter iter_ele te
   in
@@ -395,7 +382,6 @@
   | Odoc_types.Subscript _
   | Odoc_types.Module_list _
   | Odoc_types.Index_list -> (false, text_ele, None)
-  | Odoc_types.Custom _ -> (false, text_ele, None)
 
 let first_sentence_of_text t =
   let (_,t2,_) = first_sentence_text t in
@@ -479,3 +465,5 @@
     | Types.Tsubst t2 -> iter t2.Types.desc
   in
   { typ with Types.desc = iter typ.Types.desc }
+
+(* eof $Id: odoc_misc.ml,v 1.19 2005/03/24 17:20:53 doligez Exp $ *)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_misc.mli	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_misc.mli	2006-04-24 12:23:38.000000000 +0100
@@ -13,11 +13,6 @@
 
 (** Miscelaneous functions *)
 
-(** [no_blanks s] returns the given string without any blank
-   characters, i.e. '\n' '\r' ' ' '\t'.
-*)
-val no_blanks : string -> string
-
 (** This function returns a file in the form of one string.*)
 val input_file_as_string : string -> string
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_module.ml	2005-11-10 14:44:36.000000000 +0000
+++ hashcaml/ocamldoc/odoc_module.ml	2006-04-24 12:23:38.000000000 +0100
@@ -73,7 +73,6 @@
     mutable m_top_deps : Name.t list ; (** The toplevels module names this module depends on. *)
     mutable m_code : string option ; (** The whole code of the module *)
     mutable m_code_intf : string option ; (** The whole code of the interface of the module *)
-    m_text_only : bool ; (** [true] if the module comes from a text file *)
   }
 
 and module_type_alias = {
@@ -241,7 +240,6 @@
             m_top_deps = [] ;
 	    m_code = None ;
 	    m_code_intf = None ;
-	    m_text_only = false ;
           }
 (*
    module_type_elements ~trans: trans
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_search.ml	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_search.ml	2006-04-24 12:23:37.000000000 +0100
@@ -76,7 +76,6 @@
       | T.Block t
       | T.Superscript t
       | T.Subscript t
-      |	T.Custom (_,t)
       | T.Link (_, t) -> search_text root t v
       | T.List l
       | T.Enum l -> List.flatten (List.map (fun t -> search_text root t v) l)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_sig.ml	2005-11-10 14:44:36.000000000 +0000
+++ hashcaml/ocamldoc/odoc_sig.ml	2006-04-24 12:23:37.000000000 +0100
@@ -683,7 +683,6 @@
                 m_top_deps = [] ;
 		m_code = None ;
 		m_code_intf = code_intf ;
-		m_text_only = false ;
               }
             in
             let (maybe_more, info_after_opt) =
@@ -774,7 +773,6 @@
                       m_top_deps = [] ;
 		      m_code = None ;
 		      m_code_intf = code_intf ;
-		      m_text_only = false ;
 		    }
 		  in
 		  let (maybe_more, info_after_opt) =
@@ -1320,7 +1318,6 @@
         m_top_deps = [] ;
 	m_code = None ;
 	m_code_intf = code_intf ;
-	m_text_only = false ;
       }
 
     end
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_texi.ml	2005-11-10 14:44:36.000000000 +0000
+++ hashcaml/ocamldoc/odoc_texi.ml	2006-04-24 12:23:37.000000000 +0100
@@ -299,9 +299,6 @@
       | Subscript t -> self#texi_of_Subscript t
       | Odoc_info.Module_list _ -> ""
       | Odoc_info.Index_list -> ""
-      | Odoc_info.Custom (s,t) -> self#texi_of_custom_text s t
-
-    method texi_of_custom_text s t = ""
 
     method texi_of_Verbatim s = s
     method texi_of_Raw s = self#escape s
@@ -432,11 +429,11 @@
     method private soft_fix_linebreaks =
       let re = Str.regexp "\n[ \t]*" in
       fun ind t ->
-        let rep = String.make (succ ind) ' ' in
-        rep.[0] <- '\n' ;
+        let rp = String.make (succ ind) ' ' in
+        rp.[0] <- '\n' ;
         List.map
           (function
-            | Raw s -> Raw (Str.global_replace re rep s)
+            | Raw s -> Raw (Str.global_replace re rp s)
             | te -> te) t
 
     (** {3 [text] values generation}
@@ -992,13 +989,8 @@
       let depth = Name.depth m.m_name in
       let title = [
         self#node depth m.m_name ;
-        Title (depth, None,
-	       if m.m_text_only then
-		 [ Raw m.m_name ]
-	       else
-		 [ Raw (Odoc_messages.modul ^ " ") ;
-                   Code m.m_name ]
-	      ) ;
+        Title (depth, None, [ Raw (Odoc_messages.modul ^ " ") ; 
+                              Code m.m_name ]) ; 
         self#index `Module m.m_name ; Newline ] in
       puts chanout (self#texi_of_text title) ;
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_text.ml	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_text.ml	2006-04-24 12:23:38.000000000 +0100
@@ -140,10 +140,6 @@
 	  p b "}"
       |	Index_list ->
 	  p b "{!indexlist}"
-      |	Custom (s,t) ->
-	  p b "{%s " s;
-	  p_text b t;
-	  p b "}"
 
     let string_of_text s =
       let b = Buffer.create 256 in
@@ -151,3 +147,4 @@
       Buffer.contents b
 
   end
+ 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_text_lexer.mll	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_text_lexer.mll	2006-04-24 12:23:38.000000000 +0100
@@ -136,8 +136,8 @@
 let begin_left = "{L"blank_nl
 let begin_right = "{R"blank_nl
 let begin_italic = "{i"blank_nl | html_italic
-let begin_list = "{ul"blank_nl? | html_list
-let begin_enum = "{ol"blank_nl? | html_enum
+let begin_list = "{ul" | html_list
+let begin_enum = "{ol" | html_enum
 let begin_item = "{li"blank_nl | "{- " | html_item
 let begin_link = "{{:"
 let begin_latex = "{%"blank_nl
@@ -162,7 +162,6 @@
 let begin_sec_ref = "{!section:"blank_nl | "{!section:"
 let begin_mod_list_ref = "{!modules:"blank_nl | "{!modules:"
 let index_list = "{!indexlist}"
-let begin_custom = "{"['a'-'z''A'-'Z']['a'-'z''A'-'Z''0'-'9']*
 let begin_superscript = "{^"blank_nl | "{^"
 let begin_subscript = "{_"blank_nl | "{_"
 
@@ -183,7 +182,6 @@
 
 | end
     {
-      print_DEBUG "end";
       incr_cpts lexbuf ;
       if !verb_mode or !latex_mode or !code_pre_mode or
         (!open_brackets >= 1) then
@@ -197,7 +195,6 @@
     }
 | begin_title
     {
-      print_DEBUG "begin_title";
       incr_cpts lexbuf ;
       if !verb_mode or !latex_mode or !code_pre_mode or
         (!open_brackets >= 1) or !ele_ref_mode then
@@ -308,7 +305,6 @@
      }
 | begin_list
     {
-      print_DEBUG "LIST";
       incr_cpts lexbuf ;
       if !verb_mode or !latex_mode or !code_pre_mode or
         (!open_brackets >= 1) or !ele_ref_mode then
@@ -327,7 +323,6 @@
     }
 | begin_item
     {
-      print_DEBUG "ITEM";
       incr_cpts lexbuf ;
       if !verb_mode or !latex_mode or !code_pre_mode or
         (!open_brackets >= 1) or !ele_ref_mode then
@@ -749,19 +744,6 @@
 
 | eof           { EOF }
 
-| begin_custom
-    {
-      print_DEBUG "begin_custom";
-      incr_cpts lexbuf ;
-      if !verb_mode or !latex_mode or !code_pre_mode or
-        (!open_brackets >= 1) or !ele_ref_mode then
-        Char (Lexing.lexeme lexbuf)
-      else
-	let s = Lexing.lexeme lexbuf in
-	let tag = Odoc_misc.no_blanks s in
-        CUSTOM tag
-    }
-
 |  "{"
     {
       incr_cpts lexbuf ;
@@ -775,3 +757,5 @@
       incr_cpts lexbuf ;
       Char (Lexing.lexeme lexbuf)
     }
+
+    
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_text_parser.mly	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_text_parser.mly	2006-04-24 12:23:38.000000000 +0100
@@ -36,7 +36,6 @@
 %token LEFT
 %token RIGHT
 %token ITALIC
-%token <string> CUSTOM
 %token LIST
 %token ENUM
 %token ITEM
@@ -101,7 +100,6 @@
   Title text END { let n, l_opt = $1 in Title (n, l_opt, $2) }
 | BOLD text END { Bold $2 }
 | ITALIC text END { Italic $2 }
-| CUSTOM text END { Custom ($1, $2) }
 | EMP text END { Emphasize $2 }
 | SUPERSCRIPT text END { Superscript $2 }
 | SUBSCRIPT text END { Subscript $2 }
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_types.ml	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_types.ml	2006-04-24 12:23:38.000000000 +0100
@@ -46,7 +46,6 @@
   | Subscript of text
   | Module_list of string list
   | Index_list
-  | Custom of string * text
 
 and text = text_element list
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/ocamldoc/odoc_types.mli	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/ocamldoc/odoc_types.mli	2006-04-24 12:23:38.000000000 +0100
@@ -52,7 +52,6 @@
   | Module_list of string list
        (** The table of the given modules with their abstract; *)
   | Index_list (** The links to the various indexes (values, types, ...) *)
-  | Custom of string * text (** to extend \{foo syntax *)
 
 (** [text] is a list of text_elements. The order matters. *)
 and text = text_element list
@@ -131,3 +130,4 @@
 (** Verify that a dump has the correct magic number
    and return its content. *)
 val open_dump : 'a dump -> 'a
+
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/otherlibs/dynlink/Makefile	2004-11-29 14:53:32.000000000 +0000
+++ hashcaml/otherlibs/dynlink/Makefile	2006-04-24 12:23:42.000000000 +0100
@@ -18,14 +18,74 @@
 include ../../config/Makefile
 
 CAMLC=../../boot/ocamlrun ../../ocamlc
-INCLUDES=-I ../../utils -I ../../typing -I ../../bytecomp
+INCLUDES=-I ../../utils -I ../../typing -I ../../bytecomp -I ../../parsing -I ../../hashing -I ../../polymarshal
 COMPFLAGS=-warn-error A -I ../../stdlib $(INCLUDES)
 
 OBJS=dynlink.cmo
-COMPILEROBJS=misc.cmo config.cmo tbl.cmo clflags.cmo consistbl.cmo \
-  ident.cmo path.cmo \
-  types.cmo btype.cmo predef.cmo runtimedef.cmo \
-  bytesections.cmo dll.cmo meta.cmo symtable.cmo opcodes.cmo
+UTILS=misc.cmo tbl.cmo config.cmo \
+  clflags.cmo terminfo.cmo ccomp.cmo warnings.cmo \
+  consistbl.cmo
+
+OPTUTILS=$(UTILS)
+
+PARSING=linenum.cmo location.cmo longident.cmo \
+  syntaxerr.cmo asttypes.cmo parsetree.cmo parser.cmo \
+  lexer.cmo parse.cmo printast.cmo \
+  asttypes.cmo
+
+POLYMARSHAL=polymarshal/polymarshal.cmo
+
+TYPING=unused_var.cmo ident.cmo path.cmo \
+  primitive.cmo types.cmo \
+  btype.cmo outcometree.cmo oprint.cmo \
+  subst.cmo predef.cmo \
+  datarepr.cmo env.cmo \
+  ctype.cmo typedtree.cmo \
+  printtyp.cmo includeclass.cmo \
+  mtype.cmo includecore.cmo \
+  includemod.cmo parmatch.cmo \
+  typetexp.cmo stypes.cmo typecore.cmo \
+  typedecl.cmo typeclass.cmo \
+  normtypedecl.cmo hashpackage.cmo \
+  normtree.cmo  normtypes.cmo \
+  npretty.cmo transig.cmo \
+  normtrans.cmo pptypedtree.cmo \
+  typemod.cmo
+
+COMP=lambda.cmo  printlambda.cmo \
+  typeopt.cmo switch.cmo matching.cmo \
+  translobj.cmo translcore.cmo \
+  translclass.cmo translmod.cmo \
+  simplif.cmo runtimedef.cmo
+
+COMPTYPING=unused_var.cmo ident.cmo path.cmo \
+  primitive.cmo types.cmo \
+  btype.cmo outcometree.cmo oprint.cmo \
+  subst.cmo predef.cmo \
+  datarepr.cmo env.cmo \
+  ctype.cmo typedtree.cmo \
+  printtyp.cmo includeclass.cmo \
+  mtype.cmo includecore.cmo \
+  includemod.cmo parmatch.cmo \
+  typetexp.cmo stypes.cmo typecore.cmo \
+  typedecl.cmo typeclass.cmo \
+  normtypedecl.cmo  hashpackage.cmo \
+  normtree.cmo  normtypes.cmo \
+  npretty.cmo transig.cmo \
+  normtrans.cmo pptypedtree.cmo \
+  lambda.cmo  printlambda.cmo polymarshal.cmo\
+  typemod.cmo \
+  typeopt.cmo switch.cmo matching.cmo \
+  translobj.cmo translcore.cmo \
+  translclass.cmo translmod.cmo \
+  simplif.cmo runtimedef.cmo 
+
+BYTECOMP=meta.cmo instruct.cmo bytegen.cmo \
+  printinstr.cmo opcodes.cmo emitcode.cmo \
+  bytesections.cmo dll.cmo symtable.cmo \
+  bytelink.cmo bytelibrarian.cmo bytepackager.cmo
+
+COMPILEROBJS=$(UTILS) $(PARSING) $(COMPTYPING) $(BYTECOMP)
 
 all: dynlink.cma extract_crc
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/otherlibs/labltk/browser/editor.ml	2005-12-09 12:40:56.000000000 +0000
+++ hashcaml/otherlibs/labltk/browser/editor.ml	2006-04-24 12:23:42.000000000 +0100
@@ -287,8 +287,8 @@
   val compiler_menu = new Jg_menu.c "Compiler" ~parent:menus
   val module_menu = new Jg_menu.c "Modules" ~parent:menus
   val window_menu = new Jg_menu.c "Windows" ~parent:menus
-  initializer
-    Menu.add_checkbutton menus ~state:`Disabled
+  val label =
+    Checkbutton.create menus ~state:`Disabled
       ~onvalue:"modified" ~offvalue:"unchanged"
   val mutable current_dir = Unix.getcwd ()
   val mutable error_messages = []
@@ -314,18 +314,14 @@
           ~command:(fun () -> self#set_edit txt)
       end
 
-  method set_file_name txt =
-    Menu.configure_checkbutton menus `Last
-      ~label:(Filename.basename txt.name)
-      ~variable:txt.modified
-
   method set_edit txt  =
     if windows <> [] then
       Pack.forget [(List.hd windows).frame];
     windows <- txt :: exclude txt windows;
     self#reset_window_menu;
     current_tw <- txt.tw;
-    self#set_file_name txt;
+    Checkbutton.configure label ~text:(Filename.basename txt.name)
+      ~variable:txt.modified;
     Textvariable.set vwindow txt.number;
     Text.yview txt.tw ~scroll:(`Page 0);
     pack [txt.frame] ~fill:`Both ~expand:true ~side:`Bottom
@@ -385,7 +381,7 @@
     pack [sb] ~fill:`Y ~side:`Right;
     pack [tw] ~fill:`Both ~expand:true ~side:`Left;
     self#set_edit txt;
-    Textvariable.set txt.modified "unchanged";
+    Checkbutton.deselect label;
     Lexical.init_tags txt.tw
 
   method clear_errors () =
@@ -433,8 +429,9 @@
       let text = Text.get txt.tw ~start:tstart ~stop:(tposend 1) in
       output_string file text;
       close_out file;
-      txt.name <- name;
-      self#set_file_name txt
+      Checkbutton.configure label ~text:(Filename.basename name);
+      Checkbutton.deselect label;
+      txt.name <- name
     with
       Sys_error _ ->
         Jg_message.info ~master:top ~title:"Error"
@@ -456,7 +453,7 @@
             | `No -> ()
             | `Cancel -> raise Exit
             end;
-          Textvariable.set txt.modified "unchanged";
+          Checkbutton.deselect label;
           (Text.index current_tw ~index:(`Mark"insert", []), [])
         with Not_found -> self#new_window name; tstart
       in
@@ -632,6 +629,13 @@
       ~command:Viewer.search_symbol;
     module_menu#add_command "Close all"
       ~command:Viewer.close_all_views;
+
+    (* pack everything *)
+    pack (List.map ~f:(fun m -> coe m#button)
+            [file_menu; edit_menu; compiler_menu; module_menu; window_menu]
+          @ [coe label])
+      ~side:`Left ~ipadx:5 ~anchor:`W;
+    pack [menus] ~before:(List.hd windows).frame ~side:`Top ~fill:`X
 end
 
 (* The main function starts here ! *)
@@ -654,7 +658,7 @@
       false
   then () else
     let top = Jg_toplevel.titled "OCamlBrowser Editor" in
-    let menus = Jg_menu.menubar top in
+    let menus = Frame.create top ~name:"menubar" in
     let ed = new editor ~top ~menus in
     already_open := !already_open @ [ed];
     if file <> None then ed#reopen ~file ~pos
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/otherlibs/labltk/browser/jg_menu.ml	2005-12-09 12:29:55.000000000 +0000
+++ hashcaml/otherlibs/labltk/browser/jg_menu.ml	2006-04-24 12:23:42.000000000 +0100
@@ -16,12 +16,15 @@
 
 open Tk
 
-class c ~parent ?(underline=0) label = object (self)
-  val menu =
-    let menu =  Menu.create parent in
-    Menu.add_cascade parent ~menu ~label ~underline;
-    menu
-  method menu = menu
+class c ~parent ?underline:(n=0) text = object (self)
+  val pair =
+    let button =
+      Menubutton.create parent ~text ~underline:n in
+    let menu =  Menu.create button in
+    Menubutton.configure button ~menu;
+    button, menu
+  method button = fst pair
+  method menu = snd pair
   method virtual add_command :
       ?underline:int ->
       ?accelerator:string ->     ?activebackground:color ->
@@ -30,15 +33,10 @@
       ?font:string ->            ?foreground:color ->
       ?image:image ->            ?state:state ->
       string -> unit
-  method add_command ?(underline=0) ?accelerator ?activebackground
+  method add_command ?underline:(n=0) ?accelerator ?activebackground
       ?activeforeground ?background ?bitmap ?command ?font ?foreground
       ?image ?state label =
-    Menu.add_command menu ~label ~underline ?accelerator
+    Menu.add_command (self#menu) ~label ~underline:n ?accelerator
       ?activebackground ?activeforeground ?background ?bitmap
       ?command ?font ?foreground ?image ?state
 end
-
-let menubar tl =
-  let menu = Menu.create tl ~name:"menubar" ~typ:`Menubar in
-  Toplevel.configure tl ~menu;
-  menu
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/otherlibs/labltk/browser/main.ml	2005-12-09 13:48:07.000000000 +0000
+++ hashcaml/otherlibs/labltk/browser/main.ml	2006-04-24 12:23:42.000000000 +0100
@@ -67,7 +67,7 @@
 
   let path = ref [] in
   let st = ref true in
-  (*let spec =
+  let spec =
     [ "-I", Arg.String (fun s -> path := s :: !path),
       "<dir>  Add <dir> to the list of include directories";
       "-labels", Arg.Clear Clflags.classic, " <obsolete>";
@@ -100,7 +100,7 @@
   if not (check ~spec Sys.argv) then fatal_error (usage ~spec errmsg);
   Arg.parse spec
     (fun name -> raise(Arg.Bad("don't know what to do with " ^ name)))
-    errmsg;*)
+    errmsg;
   Config.load_path :=
     Sys.getcwd ()
     :: List.rev_map ~f:(Misc.expand_directory Config.standard_library) !path
@@ -135,6 +135,5 @@
     try
       if is_win32 then mainLoop ()
       else Printexc.print mainLoop ()
-    with Protocol.TkError _ ->
-      if not is_win32 then flush stderr
+    with Protocol.TkError _ -> ()
   done
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/otherlibs/labltk/browser/shell.ml	2005-12-09 12:29:55.000000000 +0000
+++ hashcaml/otherlibs/labltk/browser/shell.ml	2006-04-24 12:23:43.000000000 +0100
@@ -279,11 +279,13 @@
         if res = "" then may_exec (Filename.concat dir prog) else res) in
   if progpath = "" then program_not_found prog else
   let tl = Jg_toplevel.titled title in
-  let menus = Menu.create tl ~name:"menubar" ~typ:`Menubar in
-  Toplevel.configure tl ~menu:menus;
+  let menus = Frame.create tl ~name:"menubar" in
   let file_menu = new Jg_menu.c "File" ~parent:menus
   and history_menu = new Jg_menu.c "History" ~parent:menus
   and signal_menu = new Jg_menu.c "Signal" ~parent:menus in
+  pack [menus] ~side:`Top ~fill:`X;
+  pack [file_menu#button; history_menu#button; signal_menu#button]
+    ~side:`Left ~ipadx:5 ~anchor:`W;
   let frame, tw, sb = Jg_text.create_with_scrollbar tl in
   Text.configure tw ~background:`White;
   pack [sb] ~fill:`Y ~side:`Right;
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/otherlibs/labltk/browser/viewer.ml	2005-12-09 12:29:55.000000000 +0000
+++ hashcaml/otherlibs/labltk/browser/viewer.ml	2006-04-24 12:23:43.000000000 +0100
@@ -316,19 +316,19 @@
 (* Launch the classical viewer *)
 
 let f ?(dir=Unix.getcwd()) ?on () =
-  let (top, tl) = match on with
+  let tl = match on with
     None ->
       let tl = Jg_toplevel.titled "Module viewer" in
-      ignore (Jg_bind.escape_destroy tl); (tl, coe tl)
+      ignore (Jg_bind.escape_destroy tl); coe tl
   | Some top ->
       Wm.title_set top "OCamlBrowser";
       Wm.iconname_set top "OCamlBrowser";
       let tl = Frame.create top in
       bind tl ~events:[`Destroy] ~action:(fun _ -> exit 0);
       pack [tl] ~expand:true ~fill:`Both;
-      (top, coe tl)
+      coe tl
   in
-  let menus = Jg_menu.menubar top in
+  let menus = Frame.create tl ~name:"menubar" in
   let filemenu = new Jg_menu.c "File" ~parent:menus
   and modmenu = new Jg_menu.c "Modules" ~parent:menus in
   let fmbox, mbox, msb = Jg_box.create_with_scrollbar tl in
@@ -366,6 +366,8 @@
     ~command:(fun () -> reset_modules mbox; Env.reset_cache ());
   modmenu#add_command "Search symbol..." ~command:search_symbol;
 
+  pack [filemenu#button; modmenu#button] ~side:`Left ~ipadx:5 ~anchor:`W;
+  pack [menus] ~side:`Top ~fill:`X;      
   pack [close; search] ~fill:`X ~side:`Right ~expand:true;
   pack [coe buttons; coe ew] ~fill:`X ~side:`Bottom;
   pack [msb] ~side:`Right ~fill:`Y;
@@ -376,20 +378,19 @@
 (* Smalltalk-like version *)
 
 class st_viewer ?(dir=Unix.getcwd()) ?on () =
-  let (top, tl) = match on with
+  let tl = match on with
     None ->
       let tl = Jg_toplevel.titled "Module viewer" in
-      ignore (Jg_bind.escape_destroy tl); (tl, coe tl)
+      ignore (Jg_bind.escape_destroy tl); coe tl
   | Some top ->
       Wm.title_set top "OCamlBrowser";
       Wm.iconname_set top "OCamlBrowser";
       let tl = Frame.create top in
       bind tl ~events:[`Destroy] ~action:(fun _ -> exit 0);
-      pack [tl] ~side:`Bottom ~expand:true ~fill:`Both;
-      (top, coe tl)
+      pack [tl] ~expand:true ~fill:`Both;
+      coe tl
   in
-  let menus = Menu.create top ~name:"menubar" ~typ:`Menubar in
-  let () = Toplevel.configure top ~menu:menus in
+  let menus = Frame.create tl ~name:"menubar" in
   let filemenu = new Jg_menu.c "File" ~parent:menus
   and modmenu = new Jg_menu.c "Modules" ~parent:menus
   and viewmenu = new Jg_menu.c "View" ~parent:menus
@@ -489,6 +490,10 @@
     (* Help menu *)
     helpmenu#add_command "Manual..." ~command:show_help;
 
+    pack [filemenu#button; viewmenu#button; modmenu#button]
+      ~side:`Left ~ipadx:5 ~anchor:`W;
+    pack [helpmenu#button] ~side:`Right ~anchor:`E ~ipadx:5;
+    pack [menus] ~fill:`X;      
     pack [search_frame] ~fill:`X;      
     pack [boxes_frame] ~fill:`Both ~expand:true;
     pack [buttons] ~fill:`X ~side:`Bottom;
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/otherlibs/labltk/examples_camltk/fileopen.ml	2005-11-29 12:17:27.000000000 +0000
+++ hashcaml/otherlibs/labltk/examples_camltk/fileopen.ml	2006-04-24 12:23:43.000000000 +0100
@@ -33,7 +33,7 @@
               FileTypes [ { typename= "just test";
                             extensions= [".foo"; ".test"];
                             mactypes= ["FOOO"; "BARR"] } ];
-              InitialDir Filename.temp_dir_name;
+              InitialDir "/tmp";
               InitialFile "hogehoge" ] in
          Label.configure t [Text s])];;
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/otherlibs/labltk/tkanim/tkanim.ml	2005-11-29 12:17:27.000000000 +0000
+++ hashcaml/otherlibs/labltk/tkanim/tkanim.ml	2006-04-24 12:23:43.000000000 +0100
@@ -208,7 +208,7 @@
     animate_gen canvas i anim
 
 let gifdata s =
-  let tmp_dir = ref Filename.temp_dir_name in
+  let tmp_dir = ref "/tmp" in
   let mktemp =
     let cnter = ref 0
     and pid = Unix.getpid() in
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/otherlibs/str/str.ml	2005-11-07 15:59:04.000000000 +0000
+++ hashcaml/otherlibs/str/str.ml	2006-04-24 12:23:42.000000000 +0100
@@ -227,9 +227,7 @@
   (* Add a new instruction *)
   let emit_instr opc arg =
     if !progpos >= Array.length !prog then begin
-      let newlen = ref (Array.length !prog) in
-      while !progpos >= !newlen do newlen := !newlen * 2 done;
-      let nprog = Array.make !newlen 0 in
+      let nprog = Array.make (2 * Array.length !prog) 0 in
       Array.blit !prog 0 nprog 0 (Array.length !prog);
       prog := nprog
     end;
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/otherlibs/systhreads/win32.c	2005-12-07 12:30:59.000000000 +0000
+++ hashcaml/otherlibs/systhreads/win32.c	2006-04-24 12:23:44.000000000 +0100
@@ -252,7 +252,7 @@
 
 /* The "tick" thread fakes a signal at regular intervals. */
 
-static DWORD WINAPI caml_thread_tick(void * arg)
+static void caml_thread_tick(void * arg)
 {
   while(1) {
     Sleep(Thread_timeout);
@@ -277,7 +277,7 @@
   value vthread = Val_unit;
   value descr;
   HANDLE tick_thread;
-  DWORD th_id;
+  uintnat tick_id;
 
   /* Protect against repeated initialization (PR#1325) */
   if (curr_thread != NULL) return Val_unit;
@@ -324,8 +324,8 @@
     caml_channel_mutex_unlock = caml_io_mutex_unlock;
     caml_channel_mutex_unlock_exn = caml_io_mutex_unlock_exn;
     /* Fork the tick thread */
-    tick_thread = CreateThread(NULL, 0, caml_thread_tick, NULL, 0, &th_id);
-    if (tick_thread == NULL) caml_wthread_error("Thread.init");
+    tick_thread = (HANDLE) _beginthread(caml_thread_tick, 0, NULL);
+    if (tick_thread == (HANDLE)(-1)) caml_wthread_error("Thread.init");
     CloseHandle(tick_thread);
   End_roots();
   return Val_unit;
@@ -333,7 +333,7 @@
 
 /* Create a thread */
 
-static DWORD WINAPI caml_thread_start(void * arg)
+static void caml_thread_start(void * arg)
 {
   caml_thread_t th = (caml_thread_t) arg;
   value clos;
@@ -360,7 +360,6 @@
   /* Free the thread descriptor */
   stat_free(th);
   /* The thread now stops running */
-  return 0;
 }
 
 CAMLprim value caml_thread_new(value clos)
@@ -368,7 +367,7 @@
   caml_thread_t th;
   value vthread = Val_unit;
   value descr;
-  DWORD th_id;
+  uintnat th_id;
 
   Begin_roots2 (clos, vthread)
     /* Create a finalized value to hold thread handle */
@@ -407,9 +406,14 @@
     curr_thread->next->prev = th;
     curr_thread->next = th;
     /* Fork the new thread */
+#if 0
     th->wthread =
-      CreateThread(NULL, 0, caml_thread_start, (void *) th, 0, &th_id);
+      CreateThread(NULL,0, (LPTHREAD_START_ROUTINE) caml_thread_start,
+                   (void *) th, 0, &th_id);
     if (th->wthread == NULL) {
+#endif
+    th->wthread = (HANDLE) _beginthread(caml_thread_start, 0, (void *) th);
+    if (th->wthread == (HANDLE)(-1)) {
       /* Fork failed, remove thread info block from list of threads */
       th->next->prev = curr_thread;
       curr_thread->next = th->next;
@@ -469,7 +473,6 @@
 CAMLprim value caml_thread_join(value th)
 {
   HANDLE h;
-
   Begin_root(th)                /* prevent deallocation of handle */
     h = Threadhandle(th)->handle;
     enter_blocking_section();
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/otherlibs/threads/pervasives.ml	2004-07-13 13:25:13.000000000 +0100
+++ hashcaml/otherlibs/threads/pervasives.ml	2006-04-24 12:23:44.000000000 +0100
@@ -436,7 +436,7 @@
   let b4 = input_byte ic in
   (n1 lsl 24) + (b2 lsl 16) + (b3 lsl 8) + b4
 
-external unmarshal : string -> int -> 'a = "caml_input_value_from_string"
+external _unmarshal : string -> int -> 'a = "caml_input_value_from_string"
 external marshal_data_size : string -> int -> int = "caml_marshal_data_size"
 
 let input_value ic =
@@ -446,7 +446,7 @@
   let buffer = string_create (20 + bsize) in
   string_blit header 0 buffer 0 20;
   really_input ic buffer 20 bsize;
-  unmarshal buffer 0
+  _unmarshal buffer 0
 
 external seek_in : in_channel -> int -> unit = "caml_ml_seek_in"
 external pos_in : in_channel -> int = "caml_ml_pos_in"
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/otherlibs/unix/unix.mli	2005-11-22 11:58:47.000000000 +0000
+++ hashcaml/otherlibs/unix/unix.mli	2006-04-24 12:23:41.000000000 +0100
@@ -310,7 +310,7 @@
    to the given size. *)
 
 
-(** {6 File status} *)
+(** {6 File statistics} *)
 
 
 type file_kind =
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/parsing/lexer.mli	2003-11-21 16:01:13.000000000 +0000
+++ hashcaml/parsing/lexer.mli	2006-04-24 12:23:44.000000000 +0100
@@ -25,6 +25,7 @@
   | Unterminated_string_in_comment
   | Keyword_as_label of string
   | Literal_overflow of string
+  | Myname_as_ident
 ;;
 
 exception Error of error * Location.t
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/parsing/lexer.mll	2005-04-11 17:44:26.000000000 +0100
+++ hashcaml/parsing/lexer.mll	2006-04-26 13:59:40.000000000 +0100
@@ -27,6 +27,7 @@
   | Unterminated_string_in_comment
   | Keyword_as_label of string
   | Literal_overflow of string
+  | Myname_as_ident
 ;;
 
 exception Error of error * Location.t;;
@@ -37,8 +38,10 @@
   create_hashtable 149 [
     "and", AND;
     "as", AS;
+    "at", AT;
     "assert", ASSERT;
     "begin", BEGIN;
+    "cfresh", CFRESH;
     "class", CLASS;
     "constraint", CONSTRAINT;
     "do", DO;
@@ -49,11 +52,15 @@
     "exception", EXCEPTION;
     "external", EXTERNAL;
     "false", FALSE;
+    "fieldname", FIELDNAME;
     "for", FOR;
+    "fresh", FRESH;
     "fun", FUN;
     "function", FUNCTION;
     "functor", FUNCTOR;
+    "hashname", HASHNAME;
     "if", IF;
+    "ifname", IFNAME;
     "in", IN;
     "include", INCLUDE;
     "inherit", INHERIT;
@@ -64,6 +71,7 @@
     "method", METHOD;
     "module", MODULE;
     "mutable", MUTABLE;
+    "namecoercion", NAMECOERCION;
     "new", NEW;
     "object", OBJECT;
     "of", OF;
@@ -79,6 +87,9 @@
     "true", TRUE;
     "try", TRY;
     "type", TYPE;
+    "typemode", TYPEMODE;
+    "dyntype", TYPEOF;
+    "rep", TYPEREP;
     "val", VAL;
     "virtual", VIRTUAL;
     "when", WHEN;
@@ -201,6 +212,10 @@
       fprintf ppf "`%s' is a keyword, it cannot be used as label name" kwd
   | Literal_overflow ty ->
       fprintf ppf "Integer literal exceeds the range of representable integers of type %s" ty
+  | Myname_as_ident ->
+      fprintf ppf "Explicit use of `myname' is not allowed.\nIf you would \
+        like to bypass this restriction (not recommended), use -allowmynames \
+        compiler flag."
 ;;
 
 }
@@ -257,6 +272,8 @@
           try
             Hashtbl.find keyword_table s
           with Not_found ->
+            if (not !Clflags.allowmynames) && s = "myname" then
+              raise (Error(Myname_as_ident, Location.curr lexbuf));
             LIDENT s }
   | uppercase identchar *
       { UIDENT(Lexing.lexeme lexbuf) }       (* No capitalized keywords *)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/parsing/longident.ml	2000-03-25 18:55:44.000000000 +0000
+++ hashcaml/parsing/longident.ml	2006-04-24 12:23:44.000000000 +0100
@@ -36,3 +36,10 @@
     [] -> Lident ""  (* should not happen, but don't put assert false
                         so as not to crash the toplevel (see Genprintval) *)
   | hd :: tl -> List.fold_left (fun p s -> Ldot(p, s)) (Lident hd) tl
+
+let rec to_string l =
+  match l with
+    Lident s -> s
+  | Ldot (l', s) -> (to_string l') ^ "." ^ s
+  | Lapply (l1, l2) -> (to_string l1) ^ "(" ^ (to_string l2) ^ ")"
+
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/parsing/longident.mli	2000-03-25 18:55:44.000000000 +0000
+++ hashcaml/parsing/longident.mli	2006-04-24 12:23:45.000000000 +0100
@@ -20,4 +20,5 @@
   | Lapply of t * t
 
 val flatten: t -> string list
+val to_string : t -> string
 val parse: string -> t
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/parsing/parse.mli	1999-11-17 18:58:19.000000000 +0000
+++ hashcaml/parsing/parse.mli	2006-04-24 12:23:44.000000000 +0100
@@ -14,7 +14,8 @@
 
 (* Entry points in the parser *)
 
-val implementation : Lexing.lexbuf -> Parsetree.structure
+val implementation : Lexing.lexbuf ->
+  Parsetree.myname_type * Parsetree.structure
 val interface : Lexing.lexbuf -> Parsetree.signature
 val toplevel_phrase : Lexing.lexbuf -> Parsetree.toplevel_phrase
 val use_file : Lexing.lexbuf -> Parsetree.toplevel_phrase list
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/parsing/parser.mly	2005-03-23 03:08:37.000000000 +0000
+++ hashcaml/parsing/parser.mly	2006-04-26 13:59:40.000000000 +0100
@@ -192,11 +192,13 @@
 %token AND
 %token AS
 %token ASSERT
+%token AT
 %token BACKQUOTE
 %token BAR
 %token BARBAR
 %token BARRBRACKET
 %token BEGIN
+%token CFRESH
 %token <char> CHAR
 %token CLASS
 %token COLON
@@ -217,15 +219,19 @@
 %token EXCEPTION
 %token EXTERNAL
 %token FALSE
+%token FIELDNAME
 %token <string> FLOAT
 %token FOR
+%token FRESH
 %token FUN
 %token FUNCTION
 %token FUNCTOR
 %token GREATER
 %token GREATERRBRACE
 %token GREATERRBRACKET
+%token HASHNAME
 %token IF
+%token IFNAME
 %token IN
 %token INCLUDE
 %token <string> INFIXOP0
@@ -258,6 +264,7 @@
 %token MINUSGREATER
 %token MODULE
 %token MUTABLE
+%token NAMECOERCION
 %token <nativeint> NATIVEINT
 %token NEW
 %token OBJECT
@@ -289,6 +296,9 @@
 %token TRUE
 %token TRY
 %token TYPE
+%token TYPEMODE
+%token TYPEOF
+%token TYPEREP
 %token <string> UIDENT
 %token UNDERSCORE
 %token VAL
@@ -361,7 +371,7 @@
 /* Entry points */
 
 %start implementation                   /* for implementation files */
-%type <Parsetree.structure> implementation
+%type <Parsetree.myname_type * Parsetree.structure> implementation
 %start interface                        /* for interface files */
 %type <Parsetree.signature> interface
 %start toplevel_phrase                  /* for interactive use */
@@ -374,7 +384,9 @@
 /* Entry points */
 
 implementation:
-    structure EOF                        { $1 }
+    structure EOF                        { (Pmyname_hashed, $1) }
+  | TYPEMODE FRESH structure EOF         { (Pmyname_fresh, $3) }
+  | TYPEMODE CFRESH structure EOF        { (Pmyname_cfresh, $3) }
 ;
 interface:
     signature EOF                        { List.rev $1 }
@@ -409,9 +421,17 @@
     mod_longident
       { mkmod(Pmod_ident $1) }
   | STRUCT structure END
-      { mkmod(Pmod_structure($2)) }
+      { mkmod(Pmod_structure(Pmyname_hashed, $2)) }
+  | FRESH STRUCT structure END
+      { mkmod(Pmod_structure(Pmyname_fresh, $3)) }
+  | CFRESH STRUCT structure END
+      { mkmod(Pmod_structure(Pmyname_cfresh, $3)) }
   | STRUCT structure error
       { unclosed "struct" 1 "end" 3 }
+  | FRESH STRUCT structure error
+      { unclosed "struct" 1 "end" 3 }
+  | CFRESH STRUCT structure error
+      { unclosed "struct" 1 "end" 3 }
   | FUNCTOR LPAREN UIDENT COLON module_type RPAREN MINUSGREATER module_expr
       { mkmod(Pmod_functor($3, $5, $8)) }
   | module_expr LPAREN module_expr RPAREN
@@ -820,6 +840,10 @@
       { mkexp(Pexp_ifthenelse($2, $4, Some $6)) }
   | IF seq_expr THEN expr
       { mkexp(Pexp_ifthenelse($2, $4, None)) }
+  | IFNAME simple_expr EQUAL simple_expr THEN expr ELSE expr
+      { mkexp(Pexp_ifname($2, $4, $6, Some $8)) }
+  | IFNAME simple_expr EQUAL simple_expr THEN expr
+      { mkexp(Pexp_ifname($2, $4, $6, None)) }
   | WHILE seq_expr DO seq_expr DONE
       { mkexp(Pexp_while($2, $4)) }
   | FOR val_ident EQUAL seq_expr direction_flag seq_expr DO seq_expr DONE
@@ -888,6 +912,18 @@
       { mkexp (Pexp_object($2)) }
   | OBJECT class_structure error
       { unclosed "object" 1 "end" 3 }
+  | TYPEOF LPAREN expr RPAREN %prec below_SHARP
+      { mkexp (Pexp_typeof $3) }
+  | TYPEREP LPAREN core_type RPAREN %prec below_SHARP
+      { mkexp (Pexp_typerep $3) }
+  | NAMECOERCION LPAREN type_longident COMMA type_longident COMMA expr RPAREN %prec below_SHARP
+      { mkexp (Pexp_namecoercion($3, $5, $7)) }
+  | FIELDNAME val_longident %prec below_SHARP
+      { mkexp (Pexp_fieldname $2) }
+  | FRESH
+      { mkexp(Pexp_fresh) }
+  | HASHNAME LPAREN core_type COMMA expr RPAREN
+      { mkexp(Pexp_hashname($3, $5)) }
 ;
 simple_expr:
     val_longident
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/parsing/parsetree.mli	2005-03-23 03:08:37.000000000 +0000
+++ hashcaml/parsing/parsetree.mli	2006-04-26 13:59:40.000000000 +0100
@@ -96,6 +96,7 @@
   | Pexp_setfield of expression * Longident.t * expression
   | Pexp_array of expression list
   | Pexp_ifthenelse of expression * expression * expression option
+  | Pexp_ifname of expression * expression * expression * expression option
   | Pexp_sequence of expression * expression
   | Pexp_while of expression * expression
   | Pexp_for of string * expression * expression * direction_flag * expression
@@ -111,6 +112,12 @@
   | Pexp_lazy of expression
   | Pexp_poly of expression * core_type option
   | Pexp_object of class_structure
+  | Pexp_typeof of expression
+  | Pexp_typerep of core_type
+  | Pexp_fresh
+  | Pexp_fieldname of Longident.t
+  | Pexp_namecoercion of Longident.t * Longident.t * expression
+  | Pexp_hashname of core_type * expression
 
 (* Value descriptions *)
 
@@ -232,9 +239,11 @@
   { pmod_desc: module_expr_desc;
     pmod_loc: Location.t }
 
+and myname_type = Pmyname_hashed | Pmyname_fresh | Pmyname_cfresh
+
 and module_expr_desc =
     Pmod_ident of Longident.t
-  | Pmod_structure of structure
+  | Pmod_structure of myname_type * structure
   | Pmod_functor of string * module_type * module_expr
   | Pmod_apply of module_expr * module_expr
   | Pmod_constraint of module_expr * module_type
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/parsing/printast.ml	2005-11-16 16:01:12.000000000 +0000
+++ hashcaml/parsing/printast.ml	2006-04-26 13:59:40.000000000 +0100
@@ -244,6 +244,12 @@
       expression i ppf e1;
       expression i ppf e2;
       option i expression ppf eo;
+  | Pexp_ifname (e1, e2, e3, eo) ->
+      line i ppf "Pexp_ifname\n";
+      expression i ppf e1;
+      expression i ppf e2;
+      expression i ppf e3;
+      option i expression ppf eo;
   | Pexp_sequence (e1, e2) ->
       line i ppf "Pexp_sequence\n";
       expression i ppf e1;
@@ -295,6 +301,22 @@
   | Pexp_object s ->
       line i ppf "Pexp_object";
       class_structure i ppf s
+  | Pexp_typeof e ->
+      line i ppf "Pexp_typeof";
+      expression i ppf e;
+  | Pexp_typerep ct ->
+      line i ppf "Pexp_typerep";
+      core_type i ppf ct
+  | Pexp_fresh ->
+      line i ppf "Pexp_typerep"
+  | Pexp_fieldname t ->
+      line i ppf "Pexp_fieldname %a\n" fmt_longident t
+  | Pexp_namecoercion (t1, t2, _) ->
+      line i ppf "Pexp_namecoercion %a %a\n" fmt_longident t1 fmt_longident t2
+  | Pexp_hashname (ct, e) ->
+      line i ppf "Pexp_hashname\n";
+      core_type i ppf ct;
+      expression i ppf e
 
 and value_description i ppf x =
   line i ppf "value_description\n";
@@ -425,7 +447,7 @@
 and class_field i ppf x =
   match x with
   | Pcf_inher (ce, so) ->
-      line i ppf "Pcf_inher\n";
+      printf "Pcf_inher\n";
       class_expr (i+1) ppf ce;
       option (i+1) string ppf so;
   | Pcf_val (s, mf, e, loc) ->
@@ -532,8 +554,14 @@
   let i = i+1 in
   match x.pmod_desc with
   | Pmod_ident (li) -> line i ppf "Pmod_ident %a\n" fmt_longident li;
-  | Pmod_structure (s) ->
-      line i ppf "Pmod_structure\n";
+  | Pmod_structure (Pmyname_hashed, s) ->
+      line i ppf "Pmod_structure-hashed\n";
+      structure i ppf s;
+  | Pmod_structure (Pmyname_fresh, s) ->
+      line i ppf "Pmod_structure-fresh\n";
+      structure i ppf s;
+  | Pmod_structure (Pmyname_cfresh, s) ->
+      line i ppf "Pmod_structure-cfresh\n";
       structure i ppf s;
   | Pmod_functor (s, mt, me) ->
       line i ppf "Pmod_functor \"%s\"\n" s;
@@ -681,6 +709,6 @@
 
 let interface ppf x = list 0 signature_item ppf x;;
 
-let implementation ppf x = list 0 structure_item ppf x;;
+let implementation ppf (kind, x) = list 0 structure_item ppf x;;
 
 let top_phrase ppf x = toplevel_phrase 0 ppf x;;
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/parsing/printast.mli	2000-03-06 22:11:39.000000000 +0000
+++ hashcaml/parsing/printast.mli	2006-04-24 12:23:44.000000000 +0100
@@ -16,5 +16,5 @@
 open Format;;
 
 val interface : formatter -> signature_item list -> unit;;
-val implementation : formatter -> structure_item list -> unit;;
+val implementation : formatter -> (myname_type * (structure_item list)) -> unit;;
 val top_phrase : formatter -> toplevel_phrase -> unit;;
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/stdlib/.depend	2004-11-25 00:04:15.000000000 +0000
+++ hashcaml/stdlib/.depend	2006-04-24 12:23:13.000000000 +0100
@@ -5,7 +5,7 @@
 moreLabels.cmi: set.cmi map.cmi hashtbl.cmi 
 oo.cmi: camlinternalOO.cmi 
 parsing.cmi: obj.cmi lexing.cmi 
-printf.cmi: buffer.cmi 
+printf.cmi: obj.cmi buffer.cmi 
 random.cmi: nativeint.cmi int64.cmi int32.cmi 
 weak.cmi: hashtbl.cmi 
 arg.cmo: sys.cmi string.cmi printf.cmi list.cmi buffer.cmi array.cmi arg.cmi 
@@ -30,6 +30,8 @@
 complex.cmx: complex.cmi 
 digest.cmo: string.cmi printf.cmi digest.cmi 
 digest.cmx: string.cmx printf.cmx digest.cmi 
+dyntype.cmo: obj.cmi dyntype.cmi 
+dyntype.cmx: obj.cmx dyntype.cmi 
 filename.cmo: sys.cmi string.cmi random.cmi printf.cmi buffer.cmi \
     filename.cmi 
 filename.cmx: sys.cmx string.cmx random.cmx printf.cmx buffer.cmx \
@@ -64,6 +66,8 @@
 nativeint.cmx: sys.cmx pervasives.cmx nativeint.cmi 
 obj.cmo: marshal.cmi obj.cmi 
 obj.cmx: marshal.cmx obj.cmi 
+oldmarshal.cmo: string.cmi oldmarshal.cmi 
+oldmarshal.cmx: string.cmx oldmarshal.cmi 
 oo.cmo: camlinternalOO.cmi oo.cmi 
 oo.cmx: camlinternalOO.cmx oo.cmi 
 parsing.cmo: obj.cmi lexing.cmi array.cmi parsing.cmi 
@@ -72,8 +76,10 @@
 pervasives.cmx: pervasives.cmi 
 printexc.cmo: printf.cmi obj.cmi printexc.cmi 
 printexc.cmx: printf.cmx obj.cmx printexc.cmi 
-printf.cmo: string.cmi obj.cmi list.cmi char.cmi buffer.cmi printf.cmi 
-printf.cmx: string.cmx obj.cmx list.cmx char.cmx buffer.cmx printf.cmi 
+printf.cmo: string.cmi obj.cmi list.cmi char.cmi buffer.cmi array.cmi \
+    printf.cmi 
+printf.cmx: string.cmx obj.cmx list.cmx char.cmx buffer.cmx array.cmx \
+    printf.cmi 
 queue.cmo: obj.cmi queue.cmi 
 queue.cmx: obj.cmx queue.cmi 
 random.cmo: string.cmi pervasives.cmi nativeint.cmi int64.cmi int32.cmi \
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/stdlib/Makefile	2004-11-29 14:53:30.000000000 +0000
+++ hashcaml/stdlib/Makefile	2006-04-24 12:23:13.000000000 +0100
@@ -36,6 +36,7 @@
   camlinternalOO.cmo oo.cmo camlinternalMod.cmo \
   genlex.cmo weak.cmo \
   lazy.cmo filename.cmo complex.cmo \
+  dyntype.cmo oldmarshal.cmo \
   arrayLabels.cmo listLabels.cmo stringLabels.cmo moreLabels.cmo stdLabels.cmo
 
 all: stdlib.cma std_exit.cmo camlheader camlheader_ur
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/stdlib/StdlibModules	2004-08-12 13:57:00.000000000 +0100
+++ hashcaml/stdlib/StdlibModules	2006-04-24 12:23:13.000000000 +0100
@@ -13,6 +13,7 @@
   char \
   complex \
   digest \
+  dyntype \
   filename \
   format \
   gc \
@@ -29,6 +30,7 @@
   moreLabels \
   nativeint \
   obj \
+  oldmarshal \
   oo \
   parsing \
   pervasives \
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/stdlib/filename.ml	2005-11-29 12:17:27.000000000 +0000
+++ hashcaml/stdlib/filename.ml	2006-04-24 12:23:14.000000000 +0100
@@ -40,7 +40,7 @@
     String.length name >= String.length suff &&
     String.sub name (String.length name - String.length suff)
                     (String.length suff) = suff
-  let temp_dir_name =
+  let temporary_directory =
     try Sys.getenv "TMPDIR" with Not_found -> "/tmp"
   let quote = generic_quote "'\\''"
 end
@@ -71,7 +71,7 @@
    (let s = String.sub name (String.length name - String.length suff)
                             (String.length suff) in
     String.lowercase s = String.lowercase suff)
-  let temp_dir_name =
+  let temporary_directory =
     try Sys.getenv "TEMP" with Not_found -> "."
   let quote s =
     let l = String.length s in
@@ -98,28 +98,28 @@
   let is_relative = Win32.is_relative
   let is_implicit = Win32.is_implicit
   let check_suffix = Win32.check_suffix
-  let temp_dir_name = Unix.temp_dir_name
+  let temporary_directory = Unix.temporary_directory
   let quote = Unix.quote
 end
 
 let (current_dir_name, parent_dir_name, dir_sep, is_dir_sep, rindex_dir_sep,
-     is_relative, is_implicit, check_suffix, temp_dir_name, quote) =
+     is_relative, is_implicit, check_suffix, temporary_directory, quote) =
   match Sys.os_type with
     "Unix" ->
       (Unix.current_dir_name, Unix.parent_dir_name, Unix.dir_sep,
        Unix.is_dir_sep, Unix.rindex_dir_sep,
        Unix.is_relative, Unix.is_implicit, Unix.check_suffix,
-       Unix.temp_dir_name, Unix.quote)
+       Unix.temporary_directory, Unix.quote)
   | "Win32" ->
       (Win32.current_dir_name, Win32.parent_dir_name, Win32.dir_sep,
        Win32.is_dir_sep, Win32.rindex_dir_sep,
        Win32.is_relative, Win32.is_implicit, Win32.check_suffix,
-       Win32.temp_dir_name, Win32.quote)
+       Win32.temporary_directory, Win32.quote)
   | "Cygwin" ->
       (Cygwin.current_dir_name, Cygwin.parent_dir_name, Cygwin.dir_sep,
        Cygwin.is_dir_sep, Cygwin.rindex_dir_sep,
        Cygwin.is_relative, Cygwin.is_implicit, Cygwin.check_suffix,
-       Cygwin.temp_dir_name, Cygwin.quote)
+       Cygwin.temporary_directory, Cygwin.quote)
   | _ -> assert false
 
 let concat dirname filename =
@@ -164,7 +164,7 @@
 
 let temp_file_name prefix suffix =
   let rnd = (Random.State.bits prng) land 0xFFFFFF in
-  concat temp_dir_name (Printf.sprintf "%s%06x%s" prefix rnd suffix)
+  concat temporary_directory (Printf.sprintf "%s%06x%s" prefix rnd suffix)
 ;;
 
 let temp_file prefix suffix =
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/stdlib/filename.mli	2005-11-29 12:17:27.000000000 +0000
+++ hashcaml/stdlib/filename.mli	2006-04-24 12:23:13.000000000 +0100
@@ -77,7 +77,10 @@
    (readable and writable only by the file owner).  The file is
    guaranteed to be different from any other file that existed when
    [temp_file] was called.
-*)
+   Under Unix, the temporary directory is [/tmp] by default; if set,
+   the value of the environment variable [TMPDIR] is used instead.
+   Under Windows, the name of the temporary directory is the
+   value of the environment variable [TEMP], or [C:\temp] by default. *)
 
 val open_temp_file :
       ?mode: open_flag list -> string -> string -> string * out_channel
@@ -90,14 +93,6 @@
    It can contain one or several of [Open_append], [Open_binary],
    and [Open_text].  The default is [[Open_text]] (open in text mode). *)
 
-val temp_dir_name : string
-(** The name of the temporary directory:
-    Under Unix, the value of the [TMPDIR] environment variable, or "/tmp"
-    if the variable is not set.
-    Under Windows, the value of the [TEMP] environment variable, or "."
-    if the variable is not set.
-*)
-
 val quote : string -> string
 (** Return a quoted version of a file name, suitable for use as
    one argument in a shell command line, escaping all shell
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/stdlib/list.ml	2005-10-25 19:34:07.000000000 +0100
+++ hashcaml/stdlib/list.ml	2006-04-24 12:23:13.000000000 +0100
@@ -194,6 +194,12 @@
   | (a1::l1, a2::l2) -> (a1, a2) :: combine l1 l2
   | (_, _) -> invalid_arg "List.combine"
 
+let rec combine3 l1 l2 l3 =
+  match (l1, l2, l3) with
+    ([], [], []) -> []
+  | (a1::l1, a2::l2, a3::l3) -> (a1, a2, a3) :: combine3 l1 l2 l3
+  | (_, _, _) -> invalid_arg "List.combine3"
+
 (** sorting *)
 
 let rec merge cmp l1 l2 =
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/stdlib/list.mli	2005-10-25 19:34:07.000000000 +0100
+++ hashcaml/stdlib/list.mli	2006-04-24 12:23:13.000000000 +0100
@@ -232,6 +232,12 @@
    Raise [Invalid_argument] if the two lists
    have different lengths.  Not tail-recursive. *)
 
+val combine3 : 'a list -> 'b list -> 'c list -> ('a * 'b * 'c) list
+(** Transform a triple of lists into a list of triples:
+   [combine [a1; ...; an] [b1; ...; bn] [c1; ...; cn]] is
+   [[(a1,b1,c1); ...; (an,bn,cn)]].
+   Raise [Invalid_argument] if the lists
+   have different lengths.  Not tail-recursive. *)
 
 (** {6 Sorting} *)
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/stdlib/marshal.ml	2005-10-25 19:34:07.000000000 +0100
+++ hashcaml/stdlib/marshal.ml	2006-04-24 12:23:13.000000000 +0100
@@ -17,22 +17,36 @@
     No_sharing
   | Closures
 
-external to_channel: out_channel -> 'a -> extern_flags list -> unit
-    = "caml_output_value"
-external to_string: 'a -> extern_flags list -> string
-    = "caml_output_value_to_string"
-external to_buffer_unsafe:
-      string -> int -> int -> 'a -> extern_flags list -> int
-    = "caml_output_value_to_buffer"
+external make_package : 'a -> extern_flags list -> typerep -> string
+  = "caml_polymarshal_make_package"
+external extract_package : string -> int -> typerep -> 'a
+  = "caml_polymarshal_extract_package"
+
+external make_package_b : string -> int -> int ->
+                          ('a * extern_flags list * typerep) -> int
+  = "caml_polymarshal_make_package_buffer"
+
+let to_string v flags = make_package v flags (dyntype(v))
+let to_channel chn v flags =
+  let str = to_string v flags in
+    output_value chn str
+    
+let to_buffer_unsafe buff ofs len v flags =
+  make_package_b buff ofs len (v, flags, dyntype(v))
 
 let to_buffer buff ofs len v flags =
   if ofs < 0 || len < 0 || ofs > String.length buff - len
   then invalid_arg "Marshal.to_buffer: substring out of bounds"
   else to_buffer_unsafe buff ofs len v flags
 
-external from_channel: in_channel -> 'a = "caml_input_value"
-external from_string_unsafe: string -> int -> 'a
-                           = "caml_input_value_from_string"
+external caml_input_value : in_channel -> 'a = "caml_input_value"
+
+let from_string_unsafe str offset : 'a = extract_package str offset (rep('a))
+
+let from_channel chn =
+  let str = caml_input_value chn in
+    from_string_unsafe str 0
+
 external data_size_unsafe: string -> int -> int = "caml_marshal_data_size"
 
 let header_size = 20
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/stdlib/marshal.mli	2005-10-25 19:34:07.000000000 +0100
+++ hashcaml/stdlib/marshal.mli	2006-04-24 12:23:14.000000000 +0100
@@ -22,19 +22,6 @@
    into a data structure. The format for the byte sequences
    is compatible across all machines for a given version of Objective Caml.
 
-   Warning: marshaling is currently not type-safe. The type
-   of marshaled data is not transmitted along the value of the data,
-   making it impossible to check that the data read back possesses the
-   type expected by the context. In particular, the result type of
-   the [Marshal.from_*] functions is given as ['a], but this is
-   misleading: the returned Caml value does not possess type ['a]
-   for all ['a]; it has one, unique type which cannot be determined
-   at compile-type.  The programmer should explicitly give the expected
-   type of the returned value, using the following syntax:
-   - [(Marshal.from_channel chan : type)].
-   Anything can happen at run-time if the object in the file does not
-   belong to the given type.
-
    The representation of marshaled values is not human-readable,
    and uses bytes that are not printable characters. Therefore,
    input and output channels used in conjunction with [Marshal.to_channel]
@@ -79,8 +66,7 @@
    at un-marshaling time, using an MD5 digest of the code
    transmitted along with the code position.) *)
 
-external to_string :
-  'a -> extern_flags list -> string = "caml_output_value_to_string"
+val to_string : 'a -> extern_flags list -> string
 (** [Marshal.to_string v flags] returns a string containing
    the representation of [v] as a sequence of bytes.
    The [flags] argument has the same meaning as for
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/stdlib/printf.mli	2005-12-15 12:46:10.000000000 +0000
+++ hashcaml/stdlib/printf.mli	2006-04-24 12:23:14.000000000 +0100
@@ -72,7 +72,7 @@
      [out_channel -> unit]) and apply it to [outchan].
    - [\{ fmt %\}]: convert a format string argument. The argument must
      have the same type as the internal format string [fmt].
-   - [( fmt %)]: format string substitution. Takes a format string
+   - [\( fmt %\)]: format string substitution. Takes a format string
      argument and substitutes it to the internal format string [fmt]
      to print following arguments. The argument must have the same
      type as [fmt].
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/stdlib/scanf.ml	2006-01-03 17:32:43.000000000 +0000
+++ hashcaml/stdlib/scanf.ml	2006-04-24 12:23:14.000000000 +0100
@@ -958,17 +958,17 @@
     | 'B' | 'b' ->
         let _x = scan_bool max ib in
         scan_fmt (stack f (token_bool ib)) (i + 1)
-    | 'l' | 'n' | 'L' as typ ->
+    | 'l' | 'n' | 'L' as conv ->
         let i = i + 1 in
-        if i > lim then scan_fmt (stack f (get_count typ ib)) i else begin
+        if i > lim then scan_fmt (stack f (get_count conv ib)) i else begin
         match fmt.[i] with
         | 'd' | 'i' | 'o' | 'u' | 'x' | 'X' as conv ->
             let _x = scan_int_conv conv max ib in
-            begin match typ with
+            begin match conv with
             | 'l' -> scan_fmt (stack f (token_int32 conv ib)) (i + 1)
             | 'n' -> scan_fmt (stack f (token_nativeint conv ib)) (i + 1)
             | _ -> scan_fmt (stack f (token_int64 conv ib)) (i + 1) end
-        | c -> scan_fmt (stack f (get_count typ ib)) i end
+        | c -> scan_fmt (stack f (get_count conv ib)) i end
     | 'N' as conv ->
         scan_fmt (stack f (get_count conv ib)) (i + 1)
     | '!' ->
@@ -1029,18 +1029,15 @@
 
 let scanf fmt = bscanf Scanning.stdib fmt;;
 
-let bscanf_format ib fmt f =
-  let fmt = format_to_string fmt in
+let bscanf_format ib fmt2 f =
   let fmt1 = ignore (scan_String max_int ib); token_string ib in
-  if not (compatible_format_type fmt1 fmt) then
-    format_mismatch fmt1 fmt ib else
-  let fresh_fmt1 = String.copy fmt1 in
-  f (string_to_format fresh_fmt1);;
+  let fmt2 = format_to_string fmt2 in
+  if compatible_format_type fmt1 fmt2
+  then let fresh_fmt = String.copy fmt1 in f (string_to_format fresh_fmt)
+  else format_mismatch fmt1 fmt2 ib;;
 
 let sscanf_format s fmt =
   let fmt = format_to_string fmt in
-  let fmt1 = s in
-  if not (compatible_format_type fmt1 fmt) then
-    bad_input (format_mismatch_err fmt1 fmt) else
-  let fresh_fmt1 = String.copy fmt1 in
-  string_to_format fresh_fmt1;;
+  if compatible_format_type s fmt
+  then let fresh_fmt = String.copy s in string_to_format fresh_fmt
+  else bad_input (format_mismatch_err s fmt);;
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/stdlib/scanf.mli	2006-01-03 17:16:01.000000000 +0000
+++ hashcaml/stdlib/scanf.mli	2006-04-24 12:23:13.000000000 +0100
@@ -258,14 +258,12 @@
 val bscanf_format :
   Scanning.scanbuf -> ('a, 'b, 'c, 'd) format4 ->
     (('a, 'b, 'c, 'd) format4 -> 'e) -> 'e;;
-
-(** [bscanf_format ib fmt f] reads a format string token in buffer [ib],
-  according to the format string [fmt], and applies the function [f] to the
-  resulting format string value.
-  Raises [Scan_failure] if the format string value read has not the same type
-  as [fmt]. *)
+(** [bscanf_format ib fmt f] reads a [format] argument to the format
+  specified by the second argument. The [format] argument read in
+  buffer [ib] must have the same type as [fmt]. *)
 
 val sscanf_format :
   string -> ('a, 'b, 'c, 'd) format4 -> ('a, 'b, 'c, 'd) format4;;
-(** Same as {!Scanf.bscanf_format}, but converts the given string to a format
-  string. *)
+(** [sscanf_format ib fmt f] reads a [format] argument to the format
+  specified by the second argument and returns it. The [format]
+  argument read in string [s] must have the same type as [fmt]. *)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/stdlib/sys.ml	2006-01-04 13:05:49.000000000 +0000
+++ hashcaml/stdlib/sys.ml	2006-04-24 12:23:13.000000000 +0100
@@ -78,4 +78,4 @@
 
 (* OCaml version string, must be in the format described in sys.mli. *)
 
-let ocaml_version = "3.09.1";;
+let ocaml_version = "3.09.0";;
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/tools/Makefile	2005-11-17 14:26:37.000000000 +0000
+++ hashcaml/tools/Makefile	2006-04-24 12:23:19.000000000 +0100
@@ -23,8 +23,7 @@
 COMPFLAGS= -warn-error A $(INCLUDES)
 LINKFLAGS=$(INCLUDES)
 
-all: ocamldep ocamlprof ocamlcp ocamlmktop ocamlmklib scrapelabels addlabels \
-     dumpobj
+all: ocamldep ocamlprof ocamlcp ocamlmktop ocamlmklib scrapelabels addlabels 
 
 opt.opt: ocamldep.opt
 
@@ -33,7 +32,7 @@
 CAMLDEP_OBJ=depend.cmo ocamldep.cmo
 CAMLDEP_IMPORTS=misc.cmo config.cmo clflags.cmo terminfo.cmo \
   linenum.cmo warnings.cmo location.cmo longident.cmo \
-  syntaxerr.cmo parser.cmo lexer.cmo parse.cmo
+  syntaxerr.cmo asttypes.cmo parsetree.cmo parser.cmo lexer.cmo parse.cmo
 
 ocamldep: depend.cmi $(CAMLDEP_OBJ)
 	$(CAMLC) $(LINKFLAGS) -o ocamldep $(CAMLDEP_IMPORTS) $(CAMLDEP_OBJ)
@@ -58,7 +57,7 @@
 CSLPROF=ocamlprof.cmo
 CSLPROF_IMPORTS=misc.cmo config.cmo clflags.cmo terminfo.cmo \
   linenum.cmo warnings.cmo location.cmo longident.cmo \
-  syntaxerr.cmo parser.cmo lexer.cmo parse.cmo
+  syntaxerr.cmo asttypes.cmo parsetree.cmo parser.cmo lexer.cmo parse.cmo
 
 ocamlprof: $(CSLPROF) profiling.cmo
 	$(CAMLC) $(LINKFLAGS) -o ocamlprof $(CSLPROF_IMPORTS) $(CSLPROF)
@@ -116,7 +115,7 @@
 # Converter olabl/ocaml 2.99 to ocaml 3
 
 OCAML299TO3= lexer299.cmo ocaml299to3.cmo
-LIBRARY3= misc.cmo warnings.cmo linenum.cmo location.cmo
+LIBRARY3= misc.cmo warnings.cmo linenum.cmo terminfo.cmo location.cmo
 
 ocaml299to3: $(OCAML299TO3)
 	$(CAMLC) $(LINKFLAGS) -o ocaml299to3 $(LIBRARY3) $(OCAML299TO3)
@@ -150,7 +149,7 @@
 
 ADDLABELS_IMPORTS=misc.cmo config.cmo clflags.cmo terminfo.cmo \
   linenum.cmo warnings.cmo location.cmo longident.cmo \
-  syntaxerr.cmo parser.cmo lexer.cmo parse.cmo
+  syntaxerr.cmo asttypes.cmo parsetree.cmo parser.cmo lexer.cmo parse.cmo
 
 addlabels: addlabels.ml
 	$(CAMLC) $(LINKFLAGS) -w sl -o addlabels \
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/tools/addlabels.ml	2003-11-25 09:20:45.000000000 +0000
+++ hashcaml/tools/addlabels.ml	2006-04-24 12:23:19.000000000 +0100
@@ -276,8 +276,12 @@
   | Pexp_override lst ->
       List.iter lst ~f:(fun (_,e) -> add_labels_rec e)
   | Pexp_ident _ | Pexp_constant _ | Pexp_construct _ | Pexp_variant _
-  | Pexp_new _ | Pexp_assertfalse | Pexp_object _ ->
+  | Pexp_new _ | Pexp_assertfalse | Pexp_object _
+  | Pexp_namecoercion _ | Pexp_fieldname _ | Pexp_typerep _
+  | Pexp_typeof _ | Pexp_ifname _ | Pexp_fresh | Pexp_hashname _ ->
       ()
+  (* FIXME: might need to change for last two lines of cases *)
+
 
 let rec add_labels_class ~text ~classes ~values ~methods cl =
   match cl.pcl_desc with
@@ -435,7 +439,7 @@
     let ic = open_in file in
     let lexbuf = Lexing.from_channel ic in
     Location.init lexbuf file;
-    let impl = Parse.implementation lexbuf in
+    let impl = snd (Parse.implementation lexbuf) in
     close_in ic;
     add_labels ~intf ~impl ~file
   else prerr_endline (file ^ " is not an implementation")
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/tools/depend.ml	2005-03-23 03:08:37.000000000 +0000
+++ hashcaml/tools/depend.ml	2006-04-26 13:59:40.000000000 +0100
@@ -135,6 +135,8 @@
   | Pexp_array el -> List.iter (add_expr bv) el
   | Pexp_ifthenelse(e1, e2, opte3) ->
       add_expr bv e1; add_expr bv e2; add_opt add_expr bv opte3
+  | Pexp_ifname(e1, e2, e3, opte4) ->
+      add_expr bv e1; add_expr bv e2; add_expr bv e3; add_opt add_expr bv opte4
   | Pexp_sequence(e1, e2) -> add_expr bv e1; add_expr bv e2
   | Pexp_while(e1, e2) -> add_expr bv e1; add_expr bv e2
   | Pexp_for(_, e1, e2, _, e3) ->
@@ -156,6 +158,13 @@
   | Pexp_poly (e, t) -> add_expr bv e; add_opt add_type bv t
   | Pexp_object (pat, fieldl) ->
       add_pattern bv pat; List.iter (add_class_field bv) fieldl
+  | Pexp_typeof e -> add_expr bv e
+  | Pexp_typerep _ -> ()
+  | Pexp_fresh -> ()
+  | Pexp_fieldname _ -> ()
+  | Pexp_namecoercion (_, _, e) -> add_expr bv e
+  | Pexp_hashname (_, e) -> add_expr bv e
+  
 and add_pat_expr_list bv pel =
   List.iter (fun (p, e) -> add_pattern bv p; add_expr bv e) pel
 
@@ -208,7 +217,7 @@
 and add_module bv modl =
   match modl.pmod_desc with
     Pmod_ident l -> addmodule bv l
-  | Pmod_structure s -> ignore (add_structure bv s)
+  | Pmod_structure (_, s) -> ignore (add_structure bv s)
   | Pmod_functor(id, mty, modl) ->
       add_modtype bv mty;
       add_module (StringSet.add id bv) modl
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/tools/dumpobj.ml	2006-01-04 09:22:50.000000000 +0000
+++ hashcaml/tools/dumpobj.ml	2006-04-24 12:23:19.000000000 +0100
@@ -14,16 +14,15 @@
 
 (* Disassembler for executable and .cmo object files *)
 
-open Asttypes
+open Obj
+open Printf
 open Config
-open Emitcode
-open Instruct
+open Asttypes
 open Lambda
-open Location
-open Obj
+open Emitcode
 open Opcodes
+open Instruct
 open Opnames
-open Printf
 
 (* Read signed and unsigned integers *)
 
@@ -108,9 +107,6 @@
 
 (* Print an obj *)
 
-let same_custom x y =
-  Obj.field x 0 = Obj.field (Obj.repr y) 0
-
 let rec print_obj x =
   if Obj.is_block x then begin
     let tag = Obj.tag x in
@@ -126,13 +122,7 @@
           printf "%.12g" a.(i)
         done;
         printf "|]"
-    end else if tag = Obj.custom_tag && same_custom x 0l then
-        printf "%ldl" (Obj.magic x : int32)
-    else if tag = Obj.custom_tag && same_custom x 0n then
-        printf "%ndn" (Obj.magic x : nativeint)
-    else if tag = Obj.custom_tag && same_custom x 0L then
-        printf "%LdL" (Obj.magic x : int64)
-    else if tag < Obj.no_scan_tag then begin
+    end else if tag < Obj.no_scan_tag then begin
         printf "<%d>" (Obj.tag x);
         match Obj.size x with
           0 -> ()
@@ -398,11 +388,9 @@
 ];;
 
 let print_event ev =
-  let ls = ev.ev_loc.loc_start in
-  let le = ev.ev_loc.loc_end in
-  printf "File \"%s\", line %d, characters %d-%d:\n" ls.Lexing.pos_fname
-         ls.Lexing.pos_lnum (ls.Lexing.pos_cnum - ls.Lexing.pos_bol)
-         (le.Lexing.pos_cnum - ls.Lexing.pos_bol)
+  printf "File \"%s\", line %d, character %d:\n" ev.ev_char.Lexing.pos_fname
+         ev.ev_char.Lexing.pos_lnum
+         (ev.ev_char.Lexing.pos_cnum - ev.ev_char.Lexing.pos_bol)
 
 let print_instr ic =
   let pos = currpos ic in
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/tools/magic	2001-11-27 13:39:36.000000000 +0000
+++ hashcaml/tools/magic	2006-04-24 12:23:19.000000000 +0100
@@ -1,7 +1,7 @@
 # Here are some definitions that can be added to the /usr/share/magic
 # database so that the file(1) command recognizes OCaml compiled files.
 # Contributed by Sven Luther.
-0       string  Caml1999        Objective Caml
+0       string  Hash1999        HashCaml
 >8      string  X               bytecode executable
 >8      string  I               interface data (.cmi)
 >8      string  O               bytecode object data (.cmo)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/tools/make-package-macosx	2006-01-04 13:05:49.000000000 +0000
+++ hashcaml/tools/make-package-macosx	2006-04-24 12:23:19.000000000 +0100
@@ -103,8 +103,8 @@
 #                                         stop here -> |
 cat >resources/ReadMe.txt <<EOF
 This package installs Objective Caml version ${VERSION}.
-You need Mac OS X 10.4.x (Tiger), with X11 and the
-XCode tools (v2.2) installed.
+You need Mac OS X 10.3 (panther), with X11 and the
+XCode tools installed.
 
 Files will be installed in the following directories:
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/tools/ocaml-objcopy-macosx	2005-11-29 12:17:27.000000000 +0000
+++ hashcaml/tools/ocaml-objcopy-macosx	2006-04-24 12:23:19.000000000 +0100
@@ -12,12 +12,11 @@
 #                                                                       #
 #########################################################################
 
-# $Id: ocaml-objcopy-macosx,v 1.1.10.1 2005/11/29 12:17:27 doligez Exp $
+# $Id: ocaml-objcopy-macosx,v 1.1 2005/01/21 18:15:55 doligez Exp $
 
 
-TMP="${TMPDIR=/tmp}"
-TEMP="${TMP}"/ocaml-objcopy-$$.o
-UNDEF="${TMP}"/ocaml-objcopy-$$.sym
+TEMP=/tmp/ocaml-objcopy-$$.o
+UNDEF=/tmp/ocaml-objcopy-$$.sym
 
 usage () {
   echo "usage: objcopy {--redefine-sym <old>=<new>} file.o" >&2
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/tools/ocamlcp.ml	2005-05-09 14:39:17.000000000 +0100
+++ hashcaml/tools/ocamlcp.ml	2006-04-24 12:23:19.000000000 +0100
@@ -43,6 +43,7 @@
 
 module Options = Main_args.Make_options (struct
   let _a () = make_archive := true; option "-a" ()
+  let _allowmynames = option "-allowmynames"
   let _c = option "-c"
   let _cc s = option_with_arg "-cc" s
   let _cclib s = option_with_arg "-cclib" s
@@ -53,6 +54,8 @@
   let _dllpath = option_with_arg "-dllpath"
   let _dtypes = option "-dtypes"
   let _g = option "-g"
+  let _dnormtree = option "-dnormtree"
+  let _dnormtrans = option "-dnormtrans"
   let _i = option "-i"
   let _I s = option_with_arg "-I" s
   let _impl s = with_impl := true; option_with_arg "-impl" s
@@ -63,15 +66,19 @@
   let _make_runtime = option "-make-runtime"
   let _noassert = option "-noassert"
   let _nolabels = option "-nolabels"
+  let _nomlpoly = option "-nomlpoly"
+  let _nopolymarshal = option "-nopolymarshal"
   let _noautolink = option "-noautolink"
   let _nostdlib = option "-nostdlib"
   let _o s = option_with_arg "-o" s
   let _output_obj = option "-output-obj"
   let _pack = option "-pack"
+  let _pmdebug = option "-pmdebug"
   let _pp s = incompatible "-pp"
   let _principal = option "-principal"
   let _rectypes = option "-rectypes"
   let _thread () = option "-thread" ()
+  let _tupled_typereps = option "-tupledtrs"
   let _vmthread () = option "-vmthread" ()
   let _unsafe = option "-unsafe"
   let _use_prims s = option_with_arg "-use-prims" s
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/tools/ocamlprof.ml	2005-03-24 17:20:54.000000000 +0000
+++ hashcaml/tools/ocamlprof.ml	2006-04-24 12:23:19.000000000 +0100
@@ -285,6 +285,8 @@
   | Pexp_object (_, fieldl) ->
       List.iter (rewrite_class_field iflag) fieldl
 
+  | _ -> assert false (* FIXME *)
+
 and rewrite_ifbody iflag ghost sifbody =
   if !instr_if && not ghost then
     insert_profile rw_exp sifbody
@@ -354,7 +356,7 @@
 and rewrite_mod iflag smod =
   match smod.pmod_desc with
     Pmod_ident lid -> ()
-  | Pmod_structure sstr -> List.iter (rewrite_str_item iflag) sstr
+  | Pmod_structure (_, sstr) -> List.iter (rewrite_str_item iflag) sstr
   | Pmod_functor(param, smty, sbody) -> rewrite_mod iflag sbody
   | Pmod_apply(smod1, smod2) -> rewrite_mod iflag smod1; rewrite_mod iflag smod2
   | Pmod_constraint(smod, smty) -> rewrite_mod iflag smod
@@ -374,7 +376,7 @@
   let lb = Lexing.from_channel !inchan in
   Location.input_name := srcfile;
   Location.init lb srcfile;
-  List.iter (rewrite_str_item false) (Parse.implementation lb);
+  List.iter (rewrite_str_item false) (snd (Parse.implementation lb));
   final_rewrite add_function;
   close_in !inchan
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/toplevel/genprintval.ml	2005-06-13 05:55:53.000000000 +0100
+++ hashcaml/toplevel/genprintval.ml	2006-04-24 12:23:40.000000000 +0100
@@ -257,7 +257,7 @@
                         constr_args in
                     tree_of_constr_with_args (tree_of_constr env path)
                                            constr_name 0 depth obj ty_args
-                | {type_kind = Type_record(lbl_list, rep, priv)} ->
+                | {type_kind = Type_record(lbl_list, repr, priv)} ->
                     begin match check_depth depth obj ty with
                       Some x -> x
                     | None ->
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/toplevel/toploop.ml	2005-11-16 16:37:20.000000000 +0000
+++ hashcaml/toplevel/toploop.ml	2006-04-24 12:23:40.000000000 +0100
@@ -216,9 +216,14 @@
   match phr with
   | Ptop_def sstr ->
       let oldenv = !toplevel_env in
-      let _ = Unused_var.warn ppf sstr in
       Typecore.reset_delayed_checks ();
-      let (str, sg, newenv) = Typemod.type_structure oldenv sstr in
+      let (str', sg', newenv') = Typemod.type_structure oldenv sstr in
+      let (str, sg, newenv) =
+        if !Clflags.polymarshal then
+          Polymarshal.rewrite_structure str' sg' newenv'
+        else
+          (str', sg', newenv')
+      in
       Typecore.force_delayed_checks ();
       let lam = Translmod.transl_toplevel_definition str in
       Warnings.check_fatal ();
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/toplevel/topmain.ml	2005-01-28 17:52:58.000000000 +0000
+++ hashcaml/toplevel/topmain.ml	2006-04-24 12:23:40.000000000 +0100
@@ -56,14 +56,22 @@
        let dir = Misc.expand_directory Config.standard_library dir in
        include_dirs := dir :: !include_dirs),
            "<dir>  Add <dir> to the list of include directories";
+     "-allowmynames", Arg.Set allowmynames,
+           " Allows references to mynames (experts only)";
+     "-hashing", Arg.Set hashing, " Enable type hashing (implies -polymarshal)";
      "-init", Arg.String (fun s -> init_file := Some s),
            "<file>  Load <file> instead of default init file";
      "-labels", Arg.Clear classic, " Labels commute (default)";
+     "-mlpoly", Arg.Set mlpoly, " Use SML97-style value restriction";
      "-noassert", Arg.Set noassert, " Do not compile assertion checks";
      "-nolabels", Arg.Set classic, " Ignore labels and do not commute";
      "-noprompt", Arg.Set noprompt, " Suppress all prompts";
      "-nostdlib", Arg.Set no_std_include,
            " do not add default directory to the list of include directories";
+     "-pmdebug", Arg.Set pmdebug,
+           " Print debugging info for polymorphic marshalling";
+     "-polymarshal", Arg.Set polymarshal,
+           " Enable polymorphic marshalling (implies -mlpoly and -hashing)";
      "-principal", Arg.Set principal, " Check principality of type inference";
      "-rectypes", Arg.Set recursive_types, " Allow arbitrary recursive types";
      "-unsafe", Arg.Set fast, " No bound checking on array and string access";
@@ -96,5 +104,7 @@
      "-dinstr", Arg.Set dump_instr, " (undocumented)";
     ] file_argument usage;
   if not (prepare Format.err_formatter) then exit 2;
+  if !polymarshal || !hashing then
+    (mlpoly := true; hashing := true; polymarshal := true);
   Toploop.loop Format.std_formatter
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/toplevel/topstart.ml	2002-04-24 09:02:51.000000000 +0100
+++ hashcaml/toplevel/topstart.ml	2006-04-24 12:23:40.000000000 +0100
@@ -12,4 +12,6 @@
 
 (* $Id: topstart.ml,v 1.1 2002/04/24 08:02:51 xleroy Exp $ *)
 
-let _ = Topmain.main()
+let _ = print_endline "The toplevel system is not supported."; exit 0
+
+(*Topmain.main()*)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/btype.ml	2005-12-05 13:18:42.000000000 +0000
+++ hashcaml/typing/btype.ml	2006-04-24 12:23:35.000000000 +0100
@@ -252,9 +252,10 @@
   | Tobject(ty, {contents = Some (p, tl)})
                         -> Tobject (f ty, ref (Some(p, List.map f tl)))
   | Tobject (ty, _)     -> Tobject (f ty, ref None)
-  | Tvariant row        -> assert false (* too ambiguous *)
-  | Tfield (p, k, ty1, ty2) -> (* the kind is kept shared *)
-      Tfield (p, field_kind_repr k, f ty1, f ty2)
+  | Tvariant row        ->
+      let row = row_repr row in
+      Tvariant (copy_row f true row false (f row.row_more))
+  | Tfield (p, k, ty1, ty2) -> Tfield (p, copy_kind k, f ty1, f ty2)
   | Tnil                -> Tnil
   | Tlink ty            -> copy_type_desc f ty.desc
   | Tsubst ty           -> assert false
@@ -272,22 +273,10 @@
 let save_desc ty desc = 
   saved_desc := (ty, desc)::!saved_desc
 
-let saved_kinds = ref [] (* duplicated kind variables *)
-let new_kinds = ref []   (* new kind variables *)
-let dup_kind r =
-  (match !r with None -> () | Some _ -> assert false);
-  if not (List.memq r !new_kinds) then begin
-    saved_kinds := r :: !saved_kinds;
-    let r' = ref None in
-    new_kinds := r' :: !new_kinds;
-    r := Some (Fvar r')
-  end
-
 (* Restored type descriptions. *)
 let cleanup_types () =
   List.iter (fun (ty, desc) -> ty.desc <- desc) !saved_desc;
-  List.iter (fun r -> r := None) !saved_kinds;
-  saved_desc := []; saved_kinds := []; new_kinds := []
+  saved_desc := []
 
 (* Mark a type. *)
 let rec mark_type ty =
@@ -320,7 +309,7 @@
     Type_abstract -> ()
   | Type_variant (cstrs, priv) ->
       List.iter (fun (c, tl) -> List.iter unmark_type tl) cstrs
-  | Type_record(lbls, rep, priv) ->
+  | Type_record(lbls, _, priv) ->
       List.iter (fun (c, mut, t) -> unmark_type t) lbls
   end;
   begin match decl.type_manifest with
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/btype.mli	2005-12-05 13:18:43.000000000 +0000
+++ hashcaml/typing/btype.mli	2006-04-24 12:23:35.000000000 +0100
@@ -81,8 +81,6 @@
 
 val save_desc: type_expr -> type_desc -> unit
         (* Save a type description *)
-val dup_kind: field_kind option ref -> unit
-        (* Save a None field_kind, and make it point to a fresh Fvar *)
 val cleanup_types: unit -> unit
         (* Restore type descriptions *)
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/ctype.ml	2005-12-15 02:28:38.000000000 +0000
+++ hashcaml/typing/ctype.ml	2006-04-24 12:23:35.000000000 +0100
@@ -382,6 +382,7 @@
 
 exception Non_closed of type_expr * bool
 
+
 let free_variables = ref []
 
 let rec free_vars_rec real ty =
@@ -445,7 +446,7 @@
         ()
     | Type_variant(v, priv) ->
         List.iter (fun (_, tyl) -> List.iter closed_type tyl) v
-    | Type_record(r, rep, priv) ->
+    | Type_record(r, _, priv) ->
         List.iter (fun (_, _, ty) -> closed_type ty) r
     end;
     begin match decl.type_manifest with
@@ -564,6 +565,8 @@
   simple_abbrevs := Mnil;
   generalize_structure var_level ty
 
+let generalize_structure2 = generalize_structure
+
 (* let generalize_expansive ty = generalize_structure !nongen_level ty *)
 let generalize_global ty = generalize_structure !global_level ty
 let generalize_structure ty = generalize_structure !current_level ty
@@ -632,7 +635,7 @@
 
 (* Generalize and lower levels of contravariant branches simultaneously *)
 
-let rec generalize_expansive env var_level ty =
+let rec generalize_expansive_ocamlpoly env var_level ty =
   let ty = repr ty in
   if ty.level <> generic_level then begin
     if ty.level > var_level then begin
@@ -646,23 +649,31 @@
           List.iter2
             (fun (co,cn,ct) t ->
               if ct then update_level env var_level t
-              else generalize_expansive env var_level t)
+              else generalize_expansive_ocamlpoly env var_level t)
             variance tyl
       | Tarrow (_, t1, t2, _) ->
           update_level env var_level t1;
-          generalize_expansive env var_level t2
+          generalize_expansive_ocamlpoly env var_level t2
       | _ ->
-          iter_type_expr (generalize_expansive env var_level) ty
+          iter_type_expr (generalize_expansive_ocamlpoly env var_level) ty
     end
   end
 
-let generalize_expansive env ty =
+let generalize_expansive_ocamlpoly env ty =
   simple_abbrevs := Mnil;
   try
-    generalize_expansive env !nongen_level ty
+    generalize_expansive_ocamlpoly env !nongen_level ty
   with Unify [_, ty'] ->
     raise (Unify [ty, ty'])
 
+let generalize_expansive_smlpoly ty = generalize_structure2 !nongen_level ty
+
+let generalize_expansive env ty =
+  if !Clflags.mlpoly then
+    generalize_expansive_smlpoly ty
+  else
+    generalize_expansive_ocamlpoly env ty
+
 (* Correct the levels of type [ty]. *)
 let correct_levels ty =
   duplicate_type ty
@@ -698,9 +709,7 @@
       match ty.desc with
         Tvariant row ->
           let more = row_more row in
-          let lv = more.level in
-          if (lv < lowest_level || lv > !current_level)
-          && lv <> generic_level then set_level more generic_level
+          if more.level <> generic_level then generalize_parents more
       | _ -> ()
     end
   in
@@ -805,14 +814,6 @@
               (* Return a new copy *)
               Tvariant (copy_row copy true row keep more')
           end
-      | Tfield (p, k, ty1, ty2) ->
-          begin match field_kind_repr k with
-            Fabsent  -> Tlink (copy ty2)
-          | Fpresent -> copy_type_desc copy desc
-          | Fvar r ->
-              dup_kind r;
-              copy_type_desc copy desc
-          end
       | _ -> copy_type_desc copy desc
       end;
     t
@@ -1105,9 +1106,8 @@
   | _ ->
       assert false
 
-(* Fully expand the head of a type.
-   Raise Cannot_expand if the type cannot be expanded.
-   May raise Unify, if a recursion was hidden in the type. *)
+(* Fully expand the head of a type. Raise an exception if the type
+   cannot be expanded. *)
 let rec try_expand_head env ty =
   let ty = repr ty in
   match ty.desc with
@@ -1129,11 +1129,7 @@
 
 (* Fully expand the head of a type. *)
 let rec expand_head env ty =
-  let snap = Btype.snapshot () in
-  try try_expand_head env ty
-  with Cannot_expand | Unify _ -> (* expand_head shall never fail *)
-    Btype.backtrack snap;
-    repr ty
+  try try_expand_head env ty with Cannot_expand -> repr ty
 
 (* Make sure that the type parameters of the type constructor [ty]
    respect the type constraints *)
@@ -1463,6 +1459,8 @@
       abbreviated.  It would be possible to check whether some
       information is indeed lost, but it probably does not worth it.
 *)
+let bodge = ref false
+
 let rec unify env t1 t2 =
   (* First step: special cases (optimizations) *)
   if t1 == t2 then () else
@@ -1478,8 +1476,11 @@
     | (Tconstr _, Tvar) when deep_occur t2 t1 ->
         unify2 env t1 t2
     | (Tvar, _) ->
-        occur env t1 t2; occur_univar env t2;
-        update_level env t1.level t2;
+        (*occur env t1 t2; occur_univar env t2;*)
+        (if !bodge then () else begin
+          occur env t1 t2;
+          occur_univar env t2;
+          update_level env t1.level t2 end);
         link_type t1 t2
     | (_, Tvar) ->
         occur env t2 t1; occur_univar env t1;
@@ -1487,17 +1488,19 @@
         link_type t2 t1
     | (Tunivar, Tunivar) ->
         unify_univar t1 t2 !univar_pairs;
-        update_level env t1.level t2;
+        (if !bodge then () else update_level env t1.level t2);
         link_type t1 t2
-    | (Tconstr (p1, [], a1), Tconstr (p2, [], a2))
-          when Path.same p1 p2
+    | (Tconstr (p1, [], a1), Tconstr (p2, [], a2)) ->
+    
+          if Path.same p1 p2
             (* This optimization assumes that t1 does not expand to t2
                (and conversely), so we fall back to the general case
                when any of the types has a cached expansion. *)
             && not (has_cached_expansion p1 !a1
-                 || has_cached_expansion p2 !a2) ->
-        update_level env t1.level t2;
-        link_type t1 t2
+                 || has_cached_expansion p2 !a2) then begin
+        (if !bodge then () else update_level env t1.level t2);
+        link_type t1 t2 end else
+        unify2 env t1 t2
     | _ ->
         unify2 env t1 t2
   with Unify trace ->
@@ -1529,7 +1532,7 @@
   
   let create_recursion = (t2 != t2') && (deep_occur t1' t2) in
   occur env t1' t2;
-  update_level env t1'.level t2;
+  (if !bodge then () else update_level env t1'.level t2);
   link_type t1' t2;
 
   try
@@ -1543,7 +1546,7 @@
         if t1 == t1' then begin
           (* The variable must be instantiated... *)
           let ty = newty2 t1'.level d1 in
-          update_level env t2'.level ty;
+          (if !bodge then () else update_level env t2'.level ty);
           link_type t2' ty
         end else begin
           log_type t1';
@@ -1604,7 +1607,7 @@
           if not (closed_parameterized_type tl t2'') then
             link_type (repr t2) (repr t2')
       | _ ->
-          () (* t2 has already been expanded by update_level *)
+          assert false
     end
 
 (*
@@ -1821,7 +1824,7 @@
     Tvar ->
       begin try
         occur env t1 t2;
-        update_level env t1.level t2;
+        (if !bodge then () else update_level env t1.level t2);
         link_type t1 t2
       with Unify trace ->
         raise (Unify (expand_trace env ((t1,t2)::trace)))
@@ -3238,12 +3241,12 @@
                 Type_variant(List.map
                   (fun (c, tl) -> (c, List.map (nondep_type_rec env mid) tl))
                   cstrs, priv)
-            | Type_record(lbls, rep, priv) ->
+            | Type_record(lbls, rp, priv) ->
                 Type_record(
                   List.map
                     (fun (c, mut, t) -> (c, mut, nondep_type_rec env mid t))
                     lbls,
-                  rep, priv)
+                  rp, priv)
           with Not_found when is_covariant ->
             Type_abstract
           end;
@@ -3265,7 +3268,7 @@
       Type_abstract -> ()
     | Type_variant(cstrs, priv) ->
         List.iter (fun (c, tl) -> List.iter unmark_type tl) cstrs
-    | Type_record(lbls, rep, priv) ->
+    | Type_record(lbls, _, priv) ->
         List.iter (fun (c, mut, t) -> unmark_type t) lbls
     end;
     begin match decl.type_manifest with
@@ -3358,3 +3361,97 @@
 
 let collapse_conj_params env params =
   List.iter (collapse_conj env []) params
+
+let collect_univars = ref false 
+let free_generalized_variables = ref []
+
+let rec free_generalized_vars_rec real ty =
+  let ty = repr ty in
+  if ty.level >= lowest_level then begin
+    let level = ty.level in
+    ty.level <- pivot_level - ty.level;
+    begin match ty.desc with
+      Tvar when level = generic_level ->
+        free_generalized_variables :=
+          ty :: !free_generalized_variables
+    |  Tunivar when !collect_univars ->
+        free_generalized_variables :=
+          ty :: !free_generalized_variables
+    | Tvar -> ()
+(* Do not count "virtual" free variables
+    | Tobject(ty, {contents = Some (_, p)}) ->
+        free_generalized_vars_rec false ty; List.iter (free_generalized_vars_rec true) p
+*)
+    | Tobject (ty, _) ->
+        free_generalized_vars_rec false ty
+    | Tfield (_, _, ty1, ty2) ->
+        free_generalized_vars_rec true ty1; free_generalized_vars_rec false ty2
+    | Tvariant row ->
+        let row = row_repr row in
+        iter_row (free_generalized_vars_rec true) {row with row_bound = []};
+        if not (static_row row) then free_generalized_vars_rec false row.row_more
+    | _    ->
+        iter_type_expr (free_generalized_vars_rec true) ty
+    end;
+  end
+
+let free_generalized_variables_body ty =
+  free_generalized_variables := [];
+  free_generalized_vars_rec true ty;
+  let res = !free_generalized_variables in
+  free_generalized_variables := [];
+  unmark_type ty;
+  res
+
+let free_generalized_vars env ty =
+  collect_univars := false;
+  free_generalized_variables_body ty
+
+(* Calculate non-covariant generalized variables.
+
+   (a) collect all generalized variables (G)
+   (b) take instance of type
+   (c) mark covariant variables using generalize_expansive
+   (d) collect the covariant variables (V)
+   (e) return G \ V
+*)
+
+
+let free_contravariant_generalized_variables env ty =
+  collect_univars := true;
+  free_generalized_variables_body ty
+(* FIXME need more thought about co/contra stuff
+  let all_gen_vars = free_generalized_vars ty in
+  let fresh_vars = List.map (fun tyvar -> newvar2 tyvar.level) all_gen_vars in
+  let fresh_map = List.combine fresh_vars all_gen_vars in
+  let ty' = apply env all_gen_vars ty fresh_vars in
+  generalize_expansive env ty';
+  let covariant_vars = free_generalized_vars ty' in
+  print_string "all_gen_vars: ";
+  List.iter (fun tv -> print_int tv.id; print_string " ") all_gen_vars;
+  print_newline ();
+  print_string "covariant: ";
+  List.iter (fun tv -> print_int tv.id; print_string " ") covariant_vars;
+  print_newline ();
+  unmark_type ty';
+  let covariant_vars' = List.map (fun tv -> List.assoc tv fresh_map)
+                                 covariant_vars in
+  print_string "covariant': ";
+  List.iter (fun tv -> print_int tv.id; print_string " ") covariant_vars';
+  print_newline ();
+  let ret = List.filter (fun tv -> not (List.mem tv covariant_vars'))
+                        all_gen_vars in
+  print_string "ret: ";
+  List.iter (fun tv -> print_int tv.id; print_string " ") ret;
+  print_newline ();
+  ret
+*)
+let free_generalized_variables env ty =
+  collect_univars := false;
+  free_generalized_variables_body ty
+
+let is_function_type ty =
+  match (repr ty).desc with
+    Tarrow _ -> true
+  | _ -> false
+
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/ctype.mli	2004-12-09 12:40:53.000000000 +0000
+++ hashcaml/typing/ctype.mli	2006-04-24 12:23:35.000000000 +0100
@@ -17,6 +17,8 @@
 open Asttypes
 open Types
 
+val bodge : bool ref
+
 exception Unify of (type_expr * type_expr) list
 exception Tags of label * label
 exception Subtype of
@@ -42,6 +44,7 @@
 val newty: type_desc -> type_expr
 val newvar: unit -> type_expr
         (* Return a fresh variable *)
+val newvar2: int -> type_expr
 val new_global_var: unit -> type_expr
         (* Return a fresh variable, bound at toplevel
            (as type variables ['a] in type constraints). *)
@@ -219,6 +222,8 @@
         (* Check whether the given type scheme contains no non-generic
            type variables *)
 
+val free_contravariant_generalized_variables: Env.t -> type_expr -> type_expr list
+val free_generalized_variables: Env.t -> type_expr -> type_expr list
 val free_variables: type_expr -> type_expr list
 val closed_type_decl: type_declaration -> type_expr option
 type closed_class_failure =
@@ -237,3 +242,6 @@
 
 val collapse_conj_params: Env.t -> type_expr list -> unit
         (* Collapse conjunctive types in class parameters *)
+
+val is_function_type : type_expr -> bool
+
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/env.ml	2005-08-13 21:59:37.000000000 +0100
+++ hashcaml/typing/env.ml	2006-04-24 12:23:35.000000000 +0100
@@ -283,6 +283,8 @@
 let rec lookup_module_descr lid env =
   match lid with
     Lident s ->
+      if !Clflags.dnormtrans then
+        print_endline ("lookup module descr > Lident > " ^ s);
       begin try
         Ident.find_name s env.components
       with Not_found ->
@@ -291,6 +293,8 @@
         (Pident(Ident.create_persistent s), ps.ps_comps)
       end
   | Ldot(l, s) ->
+      if !Clflags.dnormtrans then
+        print_endline ("lookup module descr > Ldot > " ^ s);
       let (p, descr) = lookup_module_descr l env in
       begin match Lazy.force descr with
         Structure_comps c ->
@@ -311,6 +315,8 @@
       end
 
 and lookup_module lid env =
+  if !Clflags.dnormtrans then
+    print_endline ("lookup module");
   match lid with
     Lident s ->
       begin try
@@ -343,6 +349,8 @@
       end
 
 let lookup proj1 proj2 lid env =
+  if !Clflags.dnormtrans then
+    print_endline ("lookup");
   match lid with
     Lident s ->
       Ident.find_name s (proj1 env)
@@ -415,10 +423,10 @@
 
 let labels_of_type ty_path decl =
   match decl.type_kind with
-    Type_record(labels, rep, priv) ->
+    Type_record(labels, rp, priv) ->
       Datarepr.label_descrs
         (Btype.newgenty (Tconstr(ty_path, decl.type_params, ref Mnil)))
-        labels rep priv
+        labels rp priv
   | Type_variant _ | Type_abstract -> []
 
 (* Given a signature and a root path, prefix all idents in the signature
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/ident.ml	2004-01-04 14:32:34.000000000 +0000
+++ hashcaml/typing/ident.ml	2006-04-24 12:23:36.000000000 +0100
@@ -19,6 +19,11 @@
 let global_flag = 1
 let predef_exn_flag = 2
 
+(* the following is disgusting, but work is needed to make the comparisons
+   on identifiers work modulo a coercion flag if we don't do it like this
+   FIXME *)
+let coercion_wrappers = ref []
+
 (* A stamp of 0 denotes a persistent identifier *)
 
 let currentstamp = ref 0
@@ -34,10 +39,18 @@
 let create_persistent s =
   { name = s; stamp = 0; flags = global_flag }
 
+let create_typerep s =
+  { name = s; stamp = 99999; flags = 0 }
+
 let rename i =
   incr currentstamp;
   { i with stamp = !currentstamp }
 
+let make_coercion i =
+  coercion_wrappers := i.stamp :: !coercion_wrappers; i
+
+let is_coercion_wrapper i = List.mem i.stamp !coercion_wrappers
+
 let name i = i.name
 
 let stamp i = i.stamp
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/ident.mli	2004-01-04 14:32:34.000000000 +0000
+++ hashcaml/typing/ident.mli	2006-04-24 12:23:34.000000000 +0100
@@ -18,9 +18,13 @@
 
 val create: string -> t
 val create_persistent: string -> t
+val create_typerep: string -> t
 val create_predef_exn: string -> t
 val rename: t -> t
+val make_coercion: t -> t
+val is_coercion_wrapper: t -> bool
 val name: t -> string
+val stamp: t -> int
 val unique_name: t -> string
 val unique_toplevel_name: t -> string
 val persistent: t -> bool
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/includecore.ml	2005-08-08 06:40:52.000000000 +0100
+++ hashcaml/typing/includecore.ml	2006-04-24 12:23:35.000000000 +0100
@@ -29,7 +29,7 @@
     match (vd1.val_kind, vd2.val_kind) with
         (Val_prim p1, Val_prim p2) ->
           if p1 = p2 then Tcoerce_none else raise Dont_match
-      | (Val_prim p, _) -> Tcoerce_primitive p
+      | (Val_prim p, _) -> Tcoerce_primitive (p, vd2.val_type, env)
       | (_, Val_prim p) -> raise Dont_match
       | (_, _) -> Tcoerce_none
   end else
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/includemod.ml	2005-08-13 21:59:37.000000000 +0100
+++ hashcaml/typing/includemod.ml	2006-04-24 12:23:35.000000000 +0100
@@ -117,12 +117,15 @@
   let rec is_identity_coercion pos = function
   | [] ->
       true
-  | (n, c) :: rem ->
+  | (n, c, nvds) :: rem ->
+      nvds = None &&
       n = pos && c = Tcoerce_none && is_identity_coercion (pos + 1) rem in
   if is_identity_coercion 0 cc
   then Tcoerce_none
   else Tcoerce_structure cc
 
+let nonexact_value_descs = ref []
+
 (* Inclusion between module types. 
    Return the restriction that transforms a value of the smaller type
    into a value of the bigger type. *)
@@ -246,7 +249,17 @@
       let cc = value_descriptions env subst id1 valdecl1 valdecl2 in
       begin match valdecl2.val_kind with
         Val_prim p -> signature_components env subst rem
-      | _ -> (pos, cc) :: signature_components env subst rem
+      | _ ->
+        begin
+          let vd2 = Subst.value_description subst valdecl2 in
+          if Ctype.matches env valdecl1.val_type vd2.val_type then
+            (pos, cc, None) :: signature_components env subst rem
+          else
+          begin
+            (pos, cc, Some (id1, valdecl1, vd2, env)) ::
+              signature_components env subst rem
+          end
+        end
       end
   | (Tsig_type(id1, tydecl1, _), Tsig_type(id2, tydecl2, _), pos) :: rem ->
       type_declarations env subst id1 tydecl1 tydecl2;
@@ -254,17 +267,17 @@
   | (Tsig_exception(id1, excdecl1), Tsig_exception(id2, excdecl2), pos)
     :: rem ->
       exception_declarations env subst id1 excdecl1 excdecl2;
-      (pos, Tcoerce_none) :: signature_components env subst rem
+      (pos, Tcoerce_none, None) :: signature_components env subst rem
   | (Tsig_module(id1, mty1, _), Tsig_module(id2, mty2, _), pos) :: rem ->
       let cc =
         modtypes env subst (Mtype.strengthen env mty1 (Pident id1)) mty2 in
-      (pos, cc) :: signature_components env subst rem
+      (pos, cc, None) :: signature_components env subst rem
   | (Tsig_modtype(id1, info1), Tsig_modtype(id2, info2), pos) :: rem ->
       modtype_infos env subst id1 info1 info2;
       signature_components env subst rem
   | (Tsig_class(id1, decl1, _), Tsig_class(id2, decl2, _), pos) :: rem ->
       class_declarations env subst id1 decl1 decl2;
-      (pos, Tcoerce_none) :: signature_components env subst rem
+      (pos, Tcoerce_none, None) :: signature_components env subst rem
   | (Tsig_cltype(id1, info1, _), Tsig_cltype(id2, info2, _), pos) :: rem ->
       class_type_declarations env subst id1 info1 info2;
       signature_components env subst rem
@@ -305,6 +318,16 @@
 
 let _ = Env.check_modtype_inclusion := check_modtype_inclusion
 
+let nonexact_value_descs impl_name impl_sig intf_name intf_sig =
+  try
+  begin
+    nonexact_value_descs := [];
+    ignore(signatures Env.initial Subst.identity impl_sig intf_sig);
+    !nonexact_value_descs
+  end
+  with Error reasons ->
+    raise(Error(Interface_mismatch(impl_name, intf_name) :: reasons))
+
 (* Check that an implementation of a compilation unit meets its
    interface. *)
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/includemod.mli	2000-03-06 22:12:00.000000000 +0000
+++ hashcaml/typing/includemod.mli	2006-04-24 12:23:35.000000000 +0100
@@ -20,6 +20,9 @@
 
 val modtypes: Env.t -> module_type -> module_type -> module_coercion
 val signatures: Env.t -> signature -> signature -> module_coercion
+val nonexact_value_descs: string -> signature -> string -> signature ->
+                          ((Ident.t * value_description *
+                            value_description * Env.t) list)
 val compunit: string -> signature -> string -> signature -> module_coercion
 val type_declarations:
       Env.t -> Ident.t -> type_declaration -> type_declaration -> unit
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/parmatch.ml	2005-03-24 17:20:54.000000000 +0000
+++ hashcaml/typing/parmatch.ml	2006-04-24 12:23:35.000000000 +0100
@@ -136,7 +136,7 @@
 
 let rec get_record_labels ty tenv =
   match get_type_descr ty tenv with
-  | {type_kind = Type_record(lbls, rep, priv)} -> lbls
+  | {type_kind = Type_record(lbls, _, priv)} -> lbls
   | {type_manifest = Some _} ->
       get_record_labels (Ctype.expand_head_once tenv ty) tenv
   | _ -> fatal_error "Parmatch.get_record_labels"
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/path.ml	2003-07-01 14:05:43.000000000 +0100
+++ hashcaml/typing/path.ml	2006-04-24 12:23:35.000000000 +0100
@@ -42,8 +42,47 @@
   | Pdot(p, s, pos) -> name p ^ "." ^ s
   | Papply(p1, p2) -> name p1 ^ "(" ^ name p2 ^ ")"
 
+let rec name_with_pos = function
+    Pident id -> Ident.name id
+  | Pdot(p, s, pos) -> name_with_pos p ^ "." ^ (string_of_int pos)^ "-" ^ s
+  | Papply(p1, p2) -> name_with_pos p1 ^ "(" ^ name_with_pos p2 ^ ")"
+
 let rec head = function
     Pident id -> id
   | Pdot(p, s, pos) -> head p
   | Papply(p1, p2) -> assert false
 
+open Longident
+
+(* FIXME could there be problems losing stamps when translating back
+   to longidents? *)
+let rec path_to_longident p =
+  match p with
+    Pident id -> Lident (Ident.name id)
+  | Pdot (p', s, _) -> Ldot (path_to_longident p', s)
+  | Papply (p1, p2) -> Lapply (path_to_longident p1, path_to_longident p2)
+
+let to_longident = path_to_longident
+
+let rec split_body acc p =
+  match p with
+    Pdot (p', s, _) -> split_body (if acc = "" then s else s ^ "." ^ acc) p'
+  | _ -> (p, acc)
+
+let rec split p =
+ (* print_string ("split input is: " ^ (name p) ^ "\n");*)
+  match p with
+    Pident _ -> (path_to_longident p, None)
+  | Papply _ -> (path_to_longident p, None)
+  | _ ->
+      let (mod_part, rest) = split_body "" p in
+(*        print_string ("rest: " ^ rest ^ "\n");*)
+        (path_to_longident mod_part, Some rest)
+
+let rec split2 p =
+  match p with
+    Pident _ -> (p, None)
+  | Papply _ -> (p, None)
+  | _ ->
+      let (mod_part, rest) = split_body "" p in
+        (mod_part, Some rest)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/path.mli	2003-07-01 14:05:43.000000000 +0100
+++ hashcaml/typing/path.mli	2006-04-24 12:23:35.000000000 +0100
@@ -26,4 +26,9 @@
 val nopos: int
 
 val name: t -> string
+val name_with_pos: t -> string
 val head: t -> Ident.t
+
+val split : t -> Longident.t * (string option)
+val split2 : t -> t * (string option)
+val to_longident : t -> Longident.t
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/predef.ml	2004-01-04 14:32:34.000000000 +0000
+++ hashcaml/typing/predef.ml	2006-04-24 12:23:35.000000000 +0100
@@ -34,6 +34,8 @@
 and ident_int32 = Ident.create "int32"
 and ident_int64 = Ident.create "int64"
 and ident_lazy_t = Ident.create "lazy_t"
+and ident_name = Ident.create "name"
+and ident_typerep = Ident.create "typerep"
 
 let path_int = Pident ident_int
 and path_char = Pident ident_char
@@ -50,6 +52,13 @@
 and path_int32 = Pident ident_int32
 and path_int64 = Pident ident_int64
 and path_lazy_t = Pident ident_lazy_t
+and path_name = Pident ident_name
+and path_typerep = Pident ident_typerep
+
+let builtin_paths = [path_int; path_char; path_string; path_float; path_bool;
+                     path_unit; path_exn; path_array; path_list; path_format4;
+                     path_option; path_nativeint; path_int32; path_int64;
+                     path_lazy_t; path_name; path_typerep]
 
 let type_int = newgenty (Tconstr(path_int, [], ref Mnil))
 and type_char = newgenty (Tconstr(path_char, [], ref Mnil))
@@ -65,6 +74,8 @@
 and type_int32 = newgenty (Tconstr(path_int32, [], ref Mnil))
 and type_int64 = newgenty (Tconstr(path_int64, [], ref Mnil))
 and type_lazy_t t = newgenty (Tconstr(path_lazy_t, [t], ref Mnil))
+and type_name t = newgenty (Tconstr(path_name, [t], ref Mnil))
+let type_typerep = newgenty (Tconstr(path_typerep, [], ref Mnil))
 
 let ident_match_failure = Ident.create_predef_exn "Match_failure"
 and ident_out_of_memory = Ident.create_predef_exn "Out_of_memory"
@@ -79,10 +90,13 @@
 and ident_assert_failure = Ident.create_predef_exn "Assert_failure"
 and ident_undefined_recursive_module =
         Ident.create_predef_exn "Undefined_recursive_module"
+and ident_marshal_failure =
+        Ident.create_predef_exn "Marshal_type_mismatch"
 
 let path_match_failure = Pident ident_match_failure
 and path_assert_failure = Pident ident_assert_failure
 and path_undefined_recursive_module = Pident ident_undefined_recursive_module
+and path_marshal_failure = Pident ident_marshal_failure
 
 let build_initial_env add_type add_exception empty_env =
   let decl_abstr =
@@ -145,6 +159,13 @@
      type_kind = Type_abstract;
      type_manifest = None;
      type_variance = [true, false, false]}
+  and decl_name =
+    let tvar = newgenvar() in
+    {type_params = [tvar];
+     type_arity = 1;
+     type_kind = Type_abstract;
+     type_manifest = None;
+     type_variance = [true, false, false]}
   in
 
   add_exception ident_match_failure
@@ -162,6 +183,8 @@
                          [newgenty (Ttuple[type_string; type_int; type_int])] (
   add_exception ident_undefined_recursive_module
                          [newgenty (Ttuple[type_string; type_int; type_int])] (
+  add_exception ident_marshal_failure
+                         [newgenty (Ttuple[type_string; type_int; type_int])] (
   add_type ident_int64 decl_abstr (
   add_type ident_int32 decl_abstr (
   add_type ident_nativeint decl_abstr (
@@ -177,7 +200,9 @@
   add_type ident_string decl_abstr (
   add_type ident_char decl_abstr (
   add_type ident_int decl_abstr (
-    empty_env)))))))))))))))))))))))))))
+  add_type ident_name decl_name (
+  add_type ident_typerep decl_abstr (
+    empty_env))))))))))))))))))))))))))))))
 
 let builtin_values =
   List.map (fun id -> Ident.make_global id; (Ident.name id, id))
@@ -185,4 +210,5 @@
        ident_invalid_argument;
        ident_failure; ident_not_found; ident_sys_error; ident_end_of_file;
        ident_division_by_zero; ident_sys_blocked_io;
-       ident_assert_failure; ident_undefined_recursive_module ]
+       ident_assert_failure; ident_undefined_recursive_module;
+       ident_marshal_failure ]
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/predef.mli	2003-07-05 12:13:24.000000000 +0100
+++ hashcaml/typing/predef.mli	2006-04-24 12:23:35.000000000 +0100
@@ -30,6 +30,8 @@
 val type_int32: type_expr
 val type_int64: type_expr
 val type_lazy_t: type_expr -> type_expr
+val type_name: type_expr -> type_expr
+val type_typerep : type_expr
 
 val path_int: Path.t
 val path_char: Path.t
@@ -46,11 +48,16 @@
 val path_int32: Path.t
 val path_int64: Path.t
 val path_lazy_t: Path.t
+val path_name: Path.t
+val path_typerep : Path.t
 
+val path_marshal_failure: Path.t
 val path_match_failure: Path.t
 val path_assert_failure : Path.t
 val path_undefined_recursive_module : Path.t
 
+val builtin_paths : Path.t list
+
 (* To build the initial environment. Since there is a nasty mutual
    recursion between predef and env, we break it by parameterizing
    over Env.t, Env.add_type and Env.add_exception. *)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/printtyp.ml	2005-12-07 23:37:27.000000000 +0000
+++ hashcaml/typing/printtyp.ml	2006-04-24 12:23:35.000000000 +0100
@@ -96,7 +96,7 @@
 
 let rec list_of_memo = function
     Mnil -> []
-  | Mcons (p, t1, t2, rem) -> p :: list_of_memo rem
+  | Mcons (p, t1, t2, rem) -> (p,t1,t2) :: list_of_memo rem
   | Mlink rem -> list_of_memo !rem
 
 let visited = ref []
@@ -119,7 +119,9 @@
   | Tconstr (p, tl, abbrev) ->
       fprintf ppf "@[<hov1>Tconstr(@,%a,@,%a,@,%a)@]" path p
         raw_type_list tl
-        (raw_list path) (list_of_memo !abbrev)
+        (raw_list (fun ppf (p,t1,t2) ->
+          fprintf ppf "@[%a,@ %a,@ %a@]" path p raw_type t1 raw_type t2))
+        (list_of_memo !abbrev)
   | Tobject (t, nm) ->
       fprintf ppf "@[<hov1>Tobject(@,%a,@,@[<1>ref%t@])@]" raw_type t
         (fun ppf ->
@@ -192,6 +194,8 @@
     names := (t, name) :: !names;
     name
 
+let id_of_type t = "tyrep[" ^ string_of_int (t.id) ^ "]"
+
 let check_name_of_type t = ignore(name_of_type t)
 
 let non_gen_mark sch ty =
@@ -298,17 +302,19 @@
 let print_label ppf l =
   if !print_labels && l <> "" || is_optional l then fprintf ppf "%s:" l
 
+let nfn = ref name_of_type
+
 let rec tree_of_typexp sch ty =
   let ty = repr ty in
   let px = proxy ty in
   if List.mem_assq px !names && not (List.memq px !delayed) then
    let mark = is_non_gen sch ty in
-   Otyp_var (mark, name_of_type px) else
+   Otyp_var (mark, !nfn px) else
 
   let pr_typ () =
     match ty.desc with
     | Tvar ->
-        Otyp_var (is_non_gen sch ty, name_of_type ty)
+        Otyp_var (is_non_gen sch ty, !nfn ty)
     | Tarrow(l, ty1, ty2, _) ->
         let pr_arrow l ty1 ty2 =
           let lab =
@@ -449,11 +455,19 @@
 let typexp sch prio ppf ty =
   !Oprint.out_type ppf (tree_of_typexp sch ty)
 
-let type_expr ppf ty = typexp false 0 ppf ty
+let type_expr ppf ty = (nfn := name_of_type; typexp false 0 ppf ty)
 
-and type_sch ppf ty = typexp true 0 ppf ty
+and type_sch ppf ty = (nfn := name_of_type; typexp true 0 ppf ty)
 
-and type_scheme ppf ty = reset_and_mark_loops ty; typexp true 0 ppf ty
+and type_scheme ppf ty =
+  nfn := name_of_type;
+  reset_and_mark_loops ty;
+  typexp true 0 ppf ty
+
+and type_scheme_idents ppf ty =
+  nfn := id_of_type;
+  reset_and_mark_loops ty;
+  typexp true 0 ppf ty
 
 (* Maxence *)
 let type_scheme_max ?(b_reset_names=true) ppf ty = 
@@ -461,7 +475,11 @@
   typexp true 0 ppf ty
 (* Fin Maxence *)
 
-let tree_of_type_scheme ty = reset_and_mark_loops ty; tree_of_typexp true ty
+let tree_of_type_scheme ty =
+  nfn := name_of_type; reset_and_mark_loops ty; tree_of_typexp true ty
+  
+let tree_of_type_scheme_for_marshalling ty =
+  nfn := id_of_type; reset_and_mark_loops ty; tree_of_typexp true ty
 
 (* Print one type declaration *)
 
@@ -521,7 +539,7 @@
   | Type_variant ([], _) -> ()
   | Type_variant (cstrs, priv) ->
       List.iter (fun (_, args) -> List.iter mark_loops args) cstrs
-  | Type_record(l, rep, priv) ->
+  | Type_record(l, _, priv) ->
       List.iter (fun (_, _, ty) -> mark_loops ty) l
   end;
 
@@ -569,7 +587,7 @@
         end
     | Type_variant(cstrs, priv) ->
         tree_of_manifest (Otyp_sum (List.map tree_of_constructor cstrs)), priv
-    | Type_record(lbls, rep, priv) ->
+      | Type_record(lbls, _, priv) ->
         tree_of_manifest (Otyp_record (List.map tree_of_label lbls)), priv
   in
   (name, args, ty, priv, constraints)
@@ -589,7 +607,6 @@
 (* Print an exception declaration *)
 
 let tree_of_exception_declaration id decl =
-  reset_and_mark_loops_list decl; 
   let tyl = tree_of_typlist false decl in
   Osig_exception (Ident.name id, tyl)
 
@@ -788,14 +805,19 @@
 and tree_of_signature = function
   | [] -> []
   | Tsig_value(id, decl) :: rem ->
-      tree_of_value_description id decl :: tree_of_signature rem
+      let reserved =
+        let name = Ident.name id in
+        if name = "myname" then true else false in
+      if reserved then tree_of_signature rem
+      else tree_of_value_description id decl :: tree_of_signature rem
   | Tsig_type(id, _, _) :: rem when is_row_name (Ident.name id) ->
       tree_of_signature rem
   | Tsig_type(id, decl, rs) :: rem ->
       Osig_type(tree_of_type_decl id decl, tree_of_rec rs) ::
       tree_of_signature rem
   | Tsig_exception(id, decl) :: rem ->
-      tree_of_exception_declaration id decl :: tree_of_signature rem
+      Osig_exception (Ident.name id, tree_of_typlist false decl) ::
+      tree_of_signature rem
   | Tsig_module(id, mty, rs) :: rem ->
       Osig_module (Ident.name id, tree_of_modtype mty, tree_of_rec rs) ::
       tree_of_signature rem
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/printtyp.mli	2004-06-12 09:55:48.000000000 +0100
+++ hashcaml/typing/printtyp.mli	2006-04-24 12:23:36.000000000 +0100
@@ -29,7 +29,9 @@
 val reset_and_mark_loops_list: type_expr list -> unit
 val type_expr: formatter -> type_expr -> unit
 val tree_of_type_scheme: type_expr -> out_type
+val tree_of_type_scheme_for_marshalling: type_expr -> out_type
 val type_scheme: formatter -> type_expr -> unit
+val type_scheme_idents: formatter -> type_expr -> unit
 (* Maxence *)
 val reset_names: unit -> unit
 val type_scheme_max: ?b_reset_names: bool ->
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/subst.ml	2005-12-05 13:18:43.000000000 +0000
+++ hashcaml/typing/subst.ml	2006-04-24 12:23:36.000000000 +0100
@@ -132,8 +132,16 @@
               | None ->
                   Tvariant row
           end
-      | Tfield(label, kind, t1, t2) when field_kind_repr kind = Fabsent ->
+      | Tfield(label, kind, t1, t2) ->
+          begin match field_kind_repr kind with
+            Fpresent ->
+              Tfield(label, Fpresent, typexp s t1, typexp s t2)
+          | Fabsent ->
           Tlink (typexp s t2)
+          | Fvar _ (* {contents = None} *) as k ->
+              let k = if s.for_saving then Fvar(ref None) else k in
+              Tfield(label, k, typexp s t1, typexp s t2)
+          end
       | _ -> copy_type_desc (typexp s) desc
       end;
     ty'
@@ -159,11 +167,11 @@
               List.map (fun (n, args) -> (n, List.map (typexp s) args))
                        cstrs,
               priv)
-        | Type_record(lbls, rep, priv) ->
+        | Type_record(lbls, rp, priv) ->
             Type_record(
               List.map (fun (n, mut, arg) -> (n, mut, typexp s arg))
                        lbls,
-              rep, priv)
+              rp, priv)
         end;
       type_manifest =
         begin match decl.type_manifest with
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/typeclass.ml	2005-07-22 07:42:36.000000000 +0100
+++ hashcaml/typing/typeclass.ml	2006-04-24 12:23:35.000000000 +0100
@@ -520,7 +520,8 @@
   | Pcf_let (rec_flag, sdefs, loc) ->
       let (defs, val_env) =
         try
-          Typecore.type_let val_env rec_flag sdefs
+          let (x, env) = Typecore.type_let val_env rec_flag sdefs in
+            (List.map (fun (a, b, _) -> (a, b)) x, env)
         with Ctype.Unify [(ty, _)] ->
           raise(Error(loc, Make_nongen_seltype ty))
       in
@@ -866,7 +867,8 @@
   | Pcl_let (rec_flag, sdefs, scl') ->
       let (defs, val_env) =
         try
-          Typecore.type_let val_env rec_flag sdefs
+          let (x, env) = Typecore.type_let val_env rec_flag sdefs in
+            (List.map (fun (a, b, _) -> (a, b)) x, env)
         with Ctype.Unify [(ty, _)] ->
           raise(Error(scl.pcl_loc, Make_nongen_seltype ty))
       in
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/typecore.ml	2005-12-11 09:56:33.000000000 +0000
+++ hashcaml/typing/typecore.ml	2006-04-26 13:59:40.000000000 +0100
@@ -22,6 +22,14 @@
 open Btype
 open Ctype
 
+let type_to_string ty' =
+  let ty = Ctype.repr ty' in
+  let buf = Buffer.create 40 in
+  let formatter = Format.formatter_of_buffer buf in
+  let _ = Printtyp.type_scheme_idents formatter ty in
+  let _ = Format.pp_print_flush formatter () in
+    Buffer.contents buf
+
 type error =
     Unbound_value of Longident.t
   | Unbound_constructor of Longident.t
@@ -59,6 +67,8 @@
   | Not_a_variant_type of Longident.t
   | Incoherent_label_order
   | Less_general of string * (type_expr * type_expr) list
+  | Name_coercion_failure
+  | Bad_path_for_field_name
 
 exception Error of Location.t * error
 
@@ -580,13 +590,15 @@
 
 let rec is_nonexpansive exp =
   match exp.exp_desc with
-    Texp_ident(_,_) -> true
+    Texp_ident(_,_,_) -> true
   | Texp_constant _ -> true
   | Texp_let(rec_flag, pat_exp_list, body) ->
-      List.for_all (fun (pat, exp) -> is_nonexpansive exp) pat_exp_list &&
+      List.for_all (fun (pat, exp, _) -> is_nonexpansive exp) pat_exp_list &&
       is_nonexpansive body
   | Texp_function _ -> true
   | Texp_apply(e, (None,_)::el) ->
+      if !Clflags.mlpoly then false
+      else
       is_nonexpansive e && List.for_all is_nonexpansive_opt (List.map fst el)
   | Texp_tuple el ->
       List.for_all is_nonexpansive el
@@ -601,6 +613,10 @@
   | Texp_field(exp, lbl) -> is_nonexpansive exp
   | Texp_array [] -> true
   | Texp_ifthenelse(cond, ifso, ifnot) ->
+      if !Clflags.mlpoly then
+        is_nonexpansive cond && is_nonexpansive ifso &&
+          is_nonexpansive_opt ifnot
+      else
       is_nonexpansive ifso && is_nonexpansive_opt ifnot
   | Texp_new (_, cl_decl) when Ctype.class_type_arity cl_decl.cty_type > 0 ->
       true
@@ -618,7 +634,9 @@
       Vars.fold (fun _ (mut,_) b -> decr count; b && mut = Immutable)
         vars true &&
       !count = 0
-  | _ -> false
+  | Texp_typeof e -> is_nonexpansive e
+  | Texp_typerep _ -> true
+  | _ -> false  (* FIXME *)
 
 and is_nonexpansive_opt = function
     None -> true
@@ -851,17 +869,19 @@
 let self_coercion = ref ([] : (Path.t * Location.t list ref) list)
 
 (* Typing of expressions *)
-
-let unify_exp env exp expected_ty =
+let unify_exp' exp_loc env ty1 ty2 =
   (* Format.eprintf "@[%a@ %a@]@." Printtyp.raw_type_expr exp.exp_type
     Printtyp.raw_type_expr expected_ty; *)
   try
-    unify env exp.exp_type expected_ty
+    unify env ty1 ty2
   with
     Unify trace ->
-      raise(Error(exp.exp_loc, Expr_type_clash(trace)))
+      raise(Error(exp_loc, Expr_type_clash(trace)))
   | Tags(l1,l2) ->
-      raise(Typetexp.Error(exp.exp_loc, Typetexp.Variant_tags (l1, l2)))
+      raise(Typetexp.Error(exp_loc, Typetexp.Variant_tags (l1, l2)))
+
+let unify_exp env exp expected_ty =
+  unify_exp' exp.exp_loc env exp.exp_type expected_ty
 
 let rec type_exp env sexp =
   match sexp.pexp_desc with
@@ -880,11 +900,18 @@
                 let (path, _) =
                   Env.lookup_value (Longident.Lident ("self-" ^ cl_num)) env
                 in
-                Texp_ident(path, desc)
+                Texp_ident(path, desc, [])
             | Val_unbound ->
                 raise(Error(sexp.pexp_loc, Masked_instance_variable lid))
             | _ ->
-                Texp_ident(path, desc)
+                if !Clflags.polymarshal then
+                  let gen_tyvars =
+                    Ctype.free_generalized_variables env desc.val_type
+                  in
+                  let ids = List.map (fun tv -> tv.id) gen_tyvars in
+                    Texp_ident(path, desc, ids)
+                else
+                  Texp_ident(path, desc, [])
             end;
           exp_loc = sexp.pexp_loc;
           exp_type = instance desc.val_type;
@@ -1008,7 +1035,7 @@
         num_fields := Array.length label.lbl_all;
         if label.lbl_private = Private then
           raise(Error(sexp.pexp_loc, Private_type ty));
-        (label, {arg with exp_type = instance arg.exp_type}) in
+        (label, {arg with exp_type = (*instance*) arg.exp_type}) in (* FIXME *)
       let lbl_exp_list = type_label_a_list type_label_exp lid_sexp_list in
       let rec check_duplicates seen_pos lid_sexp lbl_exp =
         match (lid_sexp, lbl_exp) with
@@ -1122,6 +1149,38 @@
             exp_type = ifso.exp_type;
             exp_env = env }
       end
+  | Pexp_ifname(sexp1, sexp2, sifso, sifnot) ->
+      begin_def ();
+      let tyvar1 = newvar () in
+      let tyvar2 = newvar () in
+      let ty1 = instance (Predef.type_name tyvar1) in
+      let ty2 = instance (Predef.type_name tyvar2) in
+      let res = begin match sifnot with
+        None ->
+          let exp1 = type_expect env sexp1 ty1 in
+          let exp2 = type_expect env sexp2 ty2 in
+          let ifso = type_expect env sifso (instance Predef.type_unit) in
+          re {
+            exp_desc = Texp_ifname(exp1, exp2, ifso, None);
+            exp_loc = sexp.pexp_loc;
+            exp_type = instance Predef.type_unit;
+            exp_env = env }
+      | Some sifnot ->
+          let snapshot = Btype.snapshot () in
+          unify env ty1 ty2;
+          let ifso = type_exp env sifso in
+          Btype.backtrack snapshot;
+          let exp1 = type_expect env sexp1 ty1 in
+          let exp2 = type_expect env sexp2 ty2 in
+          let ifnot = type_expect env sifnot ifso.exp_type in
+          re {
+            exp_desc = Texp_ifname(exp1, exp2, ifso, Some ifnot);
+            exp_loc = sexp.pexp_loc;
+            exp_type = ifso.exp_type;
+            exp_env = env }
+      end in
+      end_def ();
+      res
   | Pexp_sequence(sexp1, sexp2) ->
       let exp1 = type_statement env sexp1 in
       let exp2 = type_exp env sexp2 in
@@ -1172,7 +1231,7 @@
             in
             let arg = type_exp env sarg in
             begin match arg.exp_desc, !self_coercion, (repr ty').desc with
-              Texp_ident(_, {val_kind=Val_self _}), (path,r) :: _,
+              Texp_ident(_, {val_kind=Val_self _}, _), (path,r) :: _,
               Tconstr(path',_,_) when Path.same path path' ->
                 r := sexp.pexp_loc :: !r;
                 force ()
@@ -1218,7 +1277,7 @@
       begin try
         let (exp, typ) =
           match obj.exp_desc with
-            Texp_ident(path, {val_kind = Val_self (meths, _, _, privty)}) ->
+            Texp_ident(path, {val_kind = Val_self (meths, _, _, privty)}, _) ->
               let (id, typ) =
                 filter_self_method env met Private meths privty
               in
@@ -1226,7 +1285,7 @@
                 Location.prerr_warning sexp.pexp_loc
                   (Warnings.Undeclared_virtual_method met);
               (Texp_send(obj, Tmeth_val id), typ)
-          | Texp_ident(path, {val_kind = Val_anc (methods, cl_num)}) ->
+          | Texp_ident(path, {val_kind = Val_anc (methods, cl_num)}, _) ->
               let method_id =
                 begin try List.assoc met methods with Not_found ->
                   raise(Error(e.pexp_loc, Undefined_inherited_method met))
@@ -1247,11 +1306,13 @@
                   unify env res_ty (instance typ);
                   (Texp_apply({ exp_desc = Texp_ident(Path.Pident method_id,
                                                      {val_type = method_type;
-                                                       val_kind = Val_reg});
+                                                       val_kind = Val_reg},
+                                                      [] (* FIXME *));
                                 exp_loc = sexp.pexp_loc;
                                 exp_type = method_type;
                                 exp_env = env },
-                              [Some {exp_desc = Texp_ident(path, desc);
+                              [Some {exp_desc = Texp_ident(path, desc,
+                                                           [] (* FIXME *));
                                      exp_loc = obj.exp_loc;
                                      exp_type = desc.val_type;
                                      exp_env = env },
@@ -1424,7 +1485,87 @@
         exp_env = env;
       }
   | Pexp_poly _ ->
-      assert false
+      assert false (* FIXME *)
+  | Pexp_typeof e ->
+       let arg = type_exp env e in
+       re {
+         exp_desc = Texp_typeof arg;
+         exp_loc = sexp.pexp_loc;
+         exp_type = instance Predef.type_typerep;
+         exp_env = env;
+       }
+  | Pexp_typerep ty ->
+       re {
+         exp_desc = Texp_typerep (Typetexp.transl_simple_type env false ty);
+         exp_loc = sexp.pexp_loc;
+         exp_type = instance Predef.type_typerep;
+         exp_env = env;
+       }
+  | Pexp_fresh ->
+       re {
+         exp_desc = Texp_fresh;
+         exp_loc = sexp.pexp_loc;
+         exp_type = instance (Predef.type_name (newvar ()));
+         exp_env = env
+       }
+  | Pexp_fieldname lident ->
+      begin try
+        let (path, vd) = Env.lookup_value lident env in
+        begin match path with
+          Path.Pident _ -> raise(Error(sexp.pexp_loc, Bad_path_for_field_name))
+        | _ ->
+          re {
+            exp_desc = Texp_fieldname path;
+            exp_loc = sexp.pexp_loc;
+            exp_type = instance (Predef.type_name (vd.val_type));
+            exp_env = env
+          }
+        end
+      with Not_found ->
+        raise(Error(sexp.pexp_loc, Unbound_value lident))
+      end
+  | Pexp_namecoercion (lident1, lident2, sexp1) ->
+      (* FIXME? this is rather tentative -- will allow casts between
+         ty name and ty' name iff ty and ty' have the same arity
+         (even if one is a record type and the other a variant, for
+         example). *)
+      begin try
+        let (path1, decl1) = Env.lookup_type lident1 env in
+          begin try
+            let (path2, decl2) = Env.lookup_type lident2 env in
+              if decl1.type_arity <> decl2.type_arity then
+                raise(Error(sexp.pexp_loc, Name_coercion_failure))
+              else
+                let tyvars = List.map (fun _ -> newvar ()) decl1.type_params in
+                assert (List.length tyvars = decl1.type_arity);
+                let input_type =
+                  (Predef.type_name (
+                    newty (Tconstr (path1, tyvars, ref Mnil)))) in
+                let output_type =
+                  (Predef.type_name (
+                    newty (Tconstr (path2, tyvars, ref Mnil)))) in
+                let exp = type_expect env sexp1 input_type in
+                re {
+                  exp_desc = Texp_namecoercion (path1, path2, exp);
+                  exp_loc = sexp.pexp_loc;
+                  exp_type = output_type;
+                  exp_env = env
+                }
+          with Not_found ->
+            raise(Error(sexp.pexp_loc, Unbound_value lident2))
+          end
+      with Not_found ->
+        raise(Error(sexp.pexp_loc, Unbound_value lident1))
+      end
+  | Pexp_hashname (ty, sexp) -> 
+      let exp = type_expect env sexp (instance Predef.type_string) in
+      let ty' = Typetexp.transl_simple_type env false ty in
+      re {
+        exp_desc = Texp_hashname (ty', exp);
+        exp_loc = sexp.pexp_loc;
+        exp_type = instance (Predef.type_name ty');
+        exp_env = env
+      }
 
 and type_argument env sarg ty_expected' =
   (* ty_expected' may be generic *)
@@ -1474,7 +1615,8 @@
         {pat_desc = Tpat_var id; pat_type = ty;
          pat_loc = Location.none; pat_env = env},
         {exp_type = ty; exp_loc = Location.none; exp_env = env; exp_desc =
-         Texp_ident(Path.Pident id,{val_type = ty; val_kind = Val_reg})}
+         Texp_ident(Path.Pident id,{val_type = ty; val_kind = Val_reg},
+                    [] (* FIXME *))}
       in
       let eta_pat, eta_var = var_pair "eta" ty_arg in
       let func texp =
@@ -1489,7 +1631,8 @@
       (* let-expand to have side effects *)
       let let_pat, let_var = var_pair "let" texp.exp_type in
       re { texp with exp_type = ty_fun; exp_desc =
-           Texp_let (Nonrecursive, [let_pat, texp], func let_var) }
+           Texp_let (Nonrecursive, [let_pat, texp,
+             Types.tyvar_id_memo_empty (* FIXME *)], func let_var) }
       end
   | _ ->
       type_expect env sarg ty_expected
@@ -1520,7 +1663,7 @@
               let t1 = newvar () and t2 = newvar () in
               let not_identity = function
                   Texp_ident(_,{val_kind=Val_prim
-                                  {Primitive.prim_name="%identity"}}) ->
+                                  {Primitive.prim_name="%identity"}},_) ->
                     false
                 | _ -> true
               in
@@ -1648,7 +1791,7 @@
   in
   match funct.exp_desc, sargs with
     (* Special case for ignore: avoid discarding warning *)
-    Texp_ident (_, {val_kind=Val_prim{Primitive.prim_name="%ignore"}}),
+    Texp_ident (_, {val_kind=Val_prim{Primitive.prim_name="%ignore"}}, _),
     ["", sarg] ->
       let ty_arg, ty_res = filter_arrow env (instance funct.exp_type) "" in
       let exp = type_expect env sarg ty_arg in
@@ -1918,7 +2061,7 @@
           {pat with pat_type = instance pat.pat_type})
         pat_list
     end else pat_list in
-  (* Polymoprhic variant processing *)
+  (* Polymorphic variant processing *)
   List.iter
     (fun pat ->
       if has_variants pat then begin
@@ -1946,7 +2089,10 @@
   List.iter
     (fun pat -> iter_pattern (fun pat -> generalize pat.pat_type) pat)
     pat_list;
-  (List.combine pat_list exp_list, new_env)
+  (* Having generalized, record the identifiers of generalized type variables
+     in the types of each pattern variable for later use. *)
+  let tyvar_memo_list = List.map Typedtree.pattern_to_tyvar_memo pat_list in
+    (List.combine3 pat_list exp_list tyvar_memo_list, new_env)
 
 (* Typing of toplevel bindings *)
 
@@ -2120,3 +2266,10 @@
       report_unification_error ppf trace
         (fun ppf -> fprintf ppf "This %s has type" kind)
         (fun ppf -> fprintf ppf "which is less general than")
+  | Name_coercion_failure ->
+      fprintf ppf "Name coercions are only permitted ";
+      fprintf ppf "between types of the same arity"
+  | Bad_path_for_field_name ->
+      fprintf ppf "`fieldname' can only be used on values whose path ";
+      fprintf ppf "is at least length two (for example M.x, M.N.x, etc.)"
+
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/typecore.mli	2005-03-04 14:51:31.000000000 +0000
+++ hashcaml/typing/typecore.mli	2006-04-24 12:23:36.000000000 +0100
@@ -23,11 +23,13 @@
 val type_binding:
         Env.t -> rec_flag ->
           (Parsetree.pattern * Parsetree.expression) list -> 
-          (Typedtree.pattern * Typedtree.expression) list * Env.t
+          (Typedtree.pattern * Typedtree.expression *
+           Ident.t tyvar_id_memo) list * Env.t
 val type_let:
         Env.t -> rec_flag ->
           (Parsetree.pattern * Parsetree.expression) list -> 
-          (Typedtree.pattern * Typedtree.expression) list * Env.t
+          (Typedtree.pattern * Typedtree.expression *
+           Ident.t tyvar_id_memo) list * Env.t
 val type_expression:
         Env.t -> Parsetree.expression -> Typedtree.expression
 val type_class_arg_pattern:
@@ -96,6 +98,8 @@
   | Not_a_variant_type of Longident.t
   | Incoherent_label_order
   | Less_general of string * (type_expr * type_expr) list
+  | Name_coercion_failure
+  | Bad_path_for_field_name
 
 exception Error of Location.t * error
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/typedecl.ml	2005-08-16 01:48:56.000000000 +0100
+++ hashcaml/typing/typedecl.ml	2006-04-24 12:23:35.000000000 +0100
@@ -159,11 +159,11 @@
                   let ty = transl_simple_type env true arg in
                   name, mut, match ty.desc with Tpoly(t,[]) -> t | _ -> ty)
                 lbls in
-            let rep =
+            let rp =
               if List.for_all (fun (name, mut, arg) -> is_float env arg) lbls'
               then Record_float
               else Record_regular in
-            Type_record(lbls', rep, priv)
+            Type_record(lbls', rp, priv)
         end;
       type_manifest =
         begin match sdecl.ptype_manifest with
@@ -202,7 +202,7 @@
       ()
   | Type_variant (v, priv) ->
       List.iter (fun (_, tyl) -> List.iter Ctype.generalize tyl) v
-  | Type_record(r, rep, priv) ->
+  | Type_record(r, _, priv) ->
       List.iter (fun (_, _, ty) -> Ctype.generalize ty) r
   end;
   begin match decl.type_manifest with
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/typedtree.ml	2003-11-25 09:20:43.000000000 +0000
+++ hashcaml/typing/typedtree.ml	2006-04-24 12:23:35.000000000 +0100
@@ -48,9 +48,10 @@
     exp_env: Env.t }
 
 and expression_desc =
-    Texp_ident of Path.t * value_description
+    Texp_ident of Path.t * value_description * (int list)
   | Texp_constant of constant
-  | Texp_let of rec_flag * (pattern * expression) list * expression
+  | Texp_let of rec_flag *
+      (pattern * expression * (Ident.t Types.tyvar_id_memo)) list * expression
   | Texp_function of (pattern * expression) list * partial
   | Texp_apply of expression * (expression option * optional) list
   | Texp_match of expression * (pattern * expression) list * partial
@@ -63,6 +64,7 @@
   | Texp_setfield of expression * label_description * expression
   | Texp_array of expression list
   | Texp_ifthenelse of expression * expression * expression option
+  | Texp_ifname of expression * expression * expression * expression option
   | Texp_sequence of expression * expression
   | Texp_while of expression * expression
   | Texp_for of
@@ -78,6 +80,12 @@
   | Texp_assertfalse
   | Texp_lazy of expression
   | Texp_object of class_structure * class_signature * string list
+  | Texp_typeof of expression
+  | Texp_typerep of type_expr
+  | Texp_fresh
+  | Texp_fieldname of Path.t
+  | Texp_namecoercion of Path.t * Path.t * expression
+  | Texp_hashname of type_expr * expression
 
 and meth =
     Tmeth_name of string
@@ -120,9 +128,11 @@
     mod_type: module_type;
     mod_env: Env.t }
 
+and myname_kind = Tmyname_hashed | Tmyname_fresh | Tmyname_cfresh
+
 and module_expr_desc =
     Tmod_ident of Path.t
-  | Tmod_structure of structure
+  | Tmod_structure of myname_kind * structure
   | Tmod_functor of Ident.t * module_type * module_expr
   | Tmod_apply of module_expr * module_expr * module_coercion
   | Tmod_constraint of module_expr * module_type * module_coercion
@@ -131,7 +141,7 @@
 
 and structure_item =
     Tstr_eval of expression
-  | Tstr_value of rec_flag * (pattern * expression) list
+  | Tstr_value of rec_flag * (pattern * expression * Ident.t tyvar_id_memo) list
   | Tstr_primitive of Ident.t * value_description
   | Tstr_type of (Ident.t * type_declaration) list
   | Tstr_exception of Ident.t * exception_declaration
@@ -146,9 +156,13 @@
 
 and module_coercion =
     Tcoerce_none
-  | Tcoerce_structure of (int * module_coercion) list
+  | Tcoerce_structure of
+      (int * module_coercion * (nonexact_value_info option)) list
   | Tcoerce_functor of module_coercion * module_coercion
-  | Tcoerce_primitive of Primitive.description
+  | Tcoerce_primitive of Primitive.description * type_expr * Env.t
+
+and nonexact_value_info =
+  Ident.t * value_description * value_description * Env.t
 
 (* Auxiliary functions over the a.s.t. *)
 
@@ -226,3 +240,26 @@
     end
 | d ->
     {p with pat_desc = map_pattern_desc (alpha_pat env) d}
+
+let memo = ref(Types.tyvar_id_memo_empty)
+
+let update_memo id env ty =
+  let gen_tyvars = Ctype.free_generalized_variables env ty in
+  let ids = List.map (fun tv -> tv.id) gen_tyvars in
+  let new_memo = Types.tyvar_id_memo_add id ids !memo in
+    memo := new_memo
+
+let rec bound_memo pat =
+  match pat.pat_desc with
+  | Tpat_var id -> update_memo id pat.pat_env pat.pat_type
+  | Tpat_alias(p, id) -> bound_memo p; update_memo id pat.pat_env pat.pat_type
+  | Tpat_or(p1, _, _) ->
+      (* Invariant : both arguments binds the same variables *)
+      bound_memo p1
+  | d -> iter_pattern_desc bound_memo d
+
+let pattern_to_tyvar_memo pat =
+  memo := Types.tyvar_id_memo_empty;
+  bound_memo pat;
+  let res = !memo in memo := Types.tyvar_id_memo_empty; res
+
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/typedtree.mli	2003-11-25 09:20:43.000000000 +0000
+++ hashcaml/typing/typedtree.mli	2006-04-24 12:23:35.000000000 +0100
@@ -47,9 +47,11 @@
     exp_env: Env.t }
 
 and expression_desc =
-    Texp_ident of Path.t * value_description
+    Texp_ident of Path.t * value_description * (int list)
   | Texp_constant of constant
-  | Texp_let of rec_flag * (pattern * expression) list * expression
+  | Texp_let of
+      rec_flag * (pattern * expression * (Ident.t tyvar_id_memo)) list *
+      expression
   | Texp_function of (pattern * expression) list * partial
   | Texp_apply of expression * (expression option * optional) list
   | Texp_match of expression * (pattern * expression) list * partial
@@ -62,6 +64,7 @@
   | Texp_setfield of expression * label_description * expression
   | Texp_array of expression list
   | Texp_ifthenelse of expression * expression * expression option
+  | Texp_ifname of expression * expression * expression * expression option
   | Texp_sequence of expression * expression
   | Texp_while of expression * expression
   | Texp_for of
@@ -77,6 +80,12 @@
   | Texp_assertfalse
   | Texp_lazy of expression
   | Texp_object of class_structure * class_signature * string list
+  | Texp_typeof of expression
+  | Texp_typerep of type_expr
+  | Texp_fresh
+  | Texp_fieldname of Path.t
+  | Texp_namecoercion of Path.t * Path.t * expression
+  | Texp_hashname of type_expr * expression
 
 and meth =
     Tmeth_name of string
@@ -121,9 +130,11 @@
     mod_type: module_type;
     mod_env: Env.t }
 
+and myname_kind = Tmyname_hashed | Tmyname_fresh | Tmyname_cfresh
+
 and module_expr_desc =
     Tmod_ident of Path.t
-  | Tmod_structure of structure
+  | Tmod_structure of myname_kind * structure
   | Tmod_functor of Ident.t * module_type * module_expr
   | Tmod_apply of module_expr * module_expr * module_coercion
   | Tmod_constraint of module_expr * module_type * module_coercion
@@ -132,7 +143,7 @@
 
 and structure_item =
     Tstr_eval of expression
-  | Tstr_value of rec_flag * (pattern * expression) list
+  | Tstr_value of rec_flag * (pattern * expression * Ident.t tyvar_id_memo) list
   | Tstr_primitive of Ident.t * value_description
   | Tstr_type of (Ident.t * type_declaration) list
   | Tstr_exception of Ident.t * exception_declaration
@@ -147,9 +158,13 @@
 
 and module_coercion =
     Tcoerce_none
-  | Tcoerce_structure of (int * module_coercion) list
+  | Tcoerce_structure of
+      (int * module_coercion * (nonexact_value_info option)) list
   | Tcoerce_functor of module_coercion * module_coercion
-  | Tcoerce_primitive of Primitive.description
+  | Tcoerce_primitive of Primitive.description * type_expr * Env.t
+
+and nonexact_value_info =
+  Ident.t * value_description * value_description * Env.t
 
 (* Auxiliary functions over the a.s.t. *)
 
@@ -159,6 +174,8 @@
 val let_bound_idents: (pattern * expression) list -> Ident.t list
 val rev_let_bound_idents: (pattern * expression) list -> Ident.t list
 
+val pattern_to_tyvar_memo : pattern -> Ident.t Types.tyvar_id_memo
+
 (* Alpha conversion of patterns *)
 val alpha_pat : (Ident.t * Ident.t) list -> pattern -> pattern
 
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/typemod.ml	2005-08-08 10:41:51.000000000 +0100
+++ hashcaml/typing/typemod.ml	2006-04-24 12:23:34.000000000 +0100
@@ -41,6 +41,11 @@
 
 exception Error of Location.t * error
 
+let munge_myname_type = function
+  Pmyname_hashed -> Tmyname_hashed
+| Pmyname_fresh -> Tmyname_fresh
+| Pmyname_cfresh -> Tmyname_cfresh
+
 (* Extract a signature from a module type *)
 
 let extract_sig env loc mty =
@@ -150,7 +155,6 @@
    making them abstract otherwise. *)
 
 let approx_modtype transl_mty init_env smty =
-
   let rec approx_mty env smty =
     match smty.pmty_desc with
       Pmty_ident lid ->
@@ -275,7 +279,7 @@
         raise(Error(smty.pmty_loc, Unbound_modtype lid))
       end
   | Pmty_signature ssg ->
-      Tmty_signature(transl_signature env ssg)
+      Tmty_signature (transl_signature env ssg)
   | Pmty_functor(param, sarg, sres) ->
       let arg = transl_modtype env sarg in
       let (id, newenv) = Env.enter_module param arg env in
@@ -384,7 +388,8 @@
                      Tsig_type(i', d', rs);
                      Tsig_type(i'', d'', rs)])
                  classes [rem])
-    in transl_sig env sg
+    in let sg = transl_sig env sg in
+    if !Clflags.hashing then Transig.tr_sig sg else sg
 
 and transl_modtype_info env sinfo =
   match sinfo with
@@ -439,7 +444,7 @@
 let check_nongen_scheme env = function
     Tstr_value(rec_flag, pat_exp_list) ->
       List.iter
-        (fun (pat, exp) ->
+        (fun (pat, exp, memo) ->
           if not (Ctype.closed_schema exp.exp_type) then
             raise(Error(exp.exp_loc, Non_generalizable exp.exp_type)))
         pat_exp_list
@@ -489,6 +494,13 @@
     None -> mty
   | Some p -> Mtype.enrich_modtype env (Pdot(p, name, nopos)) mty
 
+(* FIXME share with polymarshal.ml *)
+let make_var_pattern (id, ty) loc env =
+  { pat_desc = Tpat_var id;
+    pat_loc = loc;
+    pat_type = ty;
+    pat_env = env }
+
 (* Type a module value expression *)
 
 let rec type_module anchor env smod =
@@ -499,11 +511,11 @@
            mod_type = Mtype.strengthen env mty path;
            mod_env = env;
            mod_loc = smod.pmod_loc }
-  | Pmod_structure sstr ->
+  | Pmod_structure (kind, sstr) ->
       let (str, sg, finalenv) = type_structure anchor env sstr in
-      rm { mod_desc = Tmod_structure str;
+      rm { mod_desc = Tmod_structure (munge_myname_type kind, str);
            mod_type = Tmty_signature sg;
-           mod_env = env;
+           mod_env = finalenv;
            mod_loc = smod.pmod_loc }
   | Pmod_functor(name, smty, sbody) ->
       let mty = transl_modtype env smty in
@@ -572,13 +584,14 @@
         let (defs, newenv) =
           Typecore.type_binding env rec_flag sdefs in
         let (str_rem, sig_rem, final_env) = type_struct newenv srem in
-        let bound_idents = let_bound_idents defs in
+        let bound_idents =
+          let_bound_idents (List.map (fun (a, b, c) -> (a, b)) defs) in
         let make_sig_value id =
           Tsig_value(id, Env.find_value (Pident id) newenv) in
         (Tstr_value(rec_flag, defs) :: str_rem,
          map_end make_sig_value bound_idents sig_rem,
          final_env)
-    | {pstr_desc = Pstr_primitive(name, sdesc)} :: srem ->
+    | {pstr_desc = Pstr_primitive(name, sdesc); pstr_loc = loc} :: srem ->
         let desc = Typedecl.transl_value_decl env sdesc in
         let (id, newenv) = Env.enter_value name desc env in
         let (str_rem, sig_rem, final_env) = type_struct newenv srem in
@@ -717,11 +730,13 @@
         let (str_rem, sig_rem, final_env) = type_struct new_env srem in
         (Tstr_include (modl, bound_value_identifiers sg) :: str_rem,
          sg @ sig_rem,
-         final_env)
-  in
+         final_env) in
   if !Clflags.save_types
   then List.iter (function {pstr_loc = l} -> Stypes.record_phrase l) sstr;
-  type_struct env sstr
+  if !Clflags.hashing then begin
+    let (str, sg, finalenv) = type_struct env sstr in
+    (str, Transig.tr_sig sg, finalenv)
+  end else type_struct env sstr
 
 let type_module = type_module None
 let type_structure = type_structure None
@@ -776,20 +791,38 @@
   in
     simplif StringSet.empty StringSet.empty [] (List.rev sg)
 
+
 (* Typecheck an implementation file *)
 
-let type_implementation sourcefile outputprefix modulename initial_env ast =
+let type_implementation sourcefile outputprefix modulename initial_env
+                        (kind, ast) =
   Typecore.reset_delayed_checks ();
-  let (str, sg, finalenv) =
+  let (str', sg', finalenv') =
     Misc.try_finally (fun () -> type_structure initial_env ast)
                      (fun () -> Stypes.dump (outputprefix ^ ".annot"))
   in
   Typecore.force_delayed_checks ();
+  let kind' = munge_myname_type kind in
+  (* Make sure Normtrans is run before Polymarshal, since the latter has
+     an unsavoury habit of mucking up environments. *)
+  let str =
+    if !Clflags.hashing
+    then Normtrans.main modulename finalenv' kind' str'
+    else str'
+  in
+  (* N.B. type_structure does not add myname to structures but
+     does add it to signatures (!) *)
+  let (str, sg, finalenv) =
+    if !Clflags.polymarshal then
+      Polymarshal.rewrite_structure str sg' finalenv'
+    else
+      (str, sg', finalenv')
+  in
   if !Clflags.print_types then begin
     fprintf std_formatter "%a@." Printtyp.signature (simplify_signature sg);
-    (str, Tcoerce_none)
+    (str, Tcoerce_none, [])
   end else begin
-    let coercion =
+    let (str', coercion, id_map') =
       let sourceintf =
         Misc.chop_extension_if_any sourcefile ^ !Config.interface_suffix in
       if Sys.file_exists sourceintf then begin
@@ -799,15 +832,15 @@
           with Not_found ->
             raise(Error(Location.none, Interface_not_compiled sourceintf)) in
         let dclsig = Env.read_signature modulename intf_file in
-        Includemod.compunit sourcefile sg intf_file dclsig
+          (str, Includemod.compunit sourcefile sg intf_file dclsig, [])
       end else begin
-        check_nongen_schemes finalenv str;
-        normalize_signature finalenv sg;
+        check_nongen_schemes finalenv' str';
+        normalize_signature finalenv (sg : Types.signature);
         if not !Clflags.dont_write_files then
           Env.save_signature sg modulename (outputprefix ^ ".cmi");
-        Tcoerce_none
+        (str, Tcoerce_none, [])
       end in
-    (str, coercion)
+    (str', coercion, id_map')
   end
 
 (* "Packaging" of several compilation units into one unit
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/typemod.mli	2005-08-08 10:41:52.000000000 +0100
+++ hashcaml/typing/typemod.mli	2006-04-24 12:23:35.000000000 +0100
@@ -20,10 +20,13 @@
 val type_module:
         Env.t -> Parsetree.module_expr -> Typedtree.module_expr
 val type_structure:
-        Env.t -> Parsetree.structure -> Typedtree.structure * signature * Env.t
+        Env.t -> Parsetree.structure ->
+        Typedtree.structure * signature * Env.t
 val type_implementation:
-        string -> string -> string -> Env.t -> Parsetree.structure ->
-                               Typedtree.structure * Typedtree.module_coercion
+        string -> string -> string -> Env.t ->
+        (Parsetree.myname_type * Parsetree.structure) ->
+          Typedtree.structure * Typedtree.module_coercion *
+            ((Ident.t * Ident.t) list)
 val transl_signature:
         Env.t -> Parsetree.signature -> signature
 val check_nongen_schemes:
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/types.ml	2004-12-09 12:40:53.000000000 +0000
+++ hashcaml/typing/types.ml	2006-04-24 12:23:36.000000000 +0100
@@ -73,6 +73,29 @@
   let equal t1 t2 = t1 == t2
 end
 
+type 'a tyvar_id_memo = ('a * int list) list
+let tyvar_id_memo_empty = []
+let tyvar_id_memo_add a id memo = (a, id) :: memo
+let tyvar_id_memo_lookup a memo =
+  try Some (List.assoc a memo)
+  with Not_found -> None
+let tyvar_id_memo_append a1 a2 = a1 @ a2
+let tyvar_id_memo_dump memo =
+  List.iter (fun (id, tv_ids) ->
+               print_string (Ident.unique_name id);
+               print_string ": ";
+               List.iter (fun id -> print_int id; print_string " ") tv_ids)
+                 memo; print_newline ()
+let rec find_ident id xs = (* FIXME share with polymarshal *)
+  match xs with
+    [] -> raise Not_found
+  | (id', d)::xs -> if Ident.same id id' then d else find_ident id xs
+let tyvar_id_memo_rename ident_map memo =
+  List.map (fun (id, tv_ids) ->
+              try
+                (find_ident id ident_map, tv_ids)
+              with Not_found -> (id, tv_ids)) memo
+
 (* Maps of methods and instance variables *)
 
 module OrderedString = struct type t = string let compare = compare end
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/types.mli	2004-12-09 12:40:53.000000000 +0000
+++ hashcaml/typing/types.mli	2006-04-24 12:23:35.000000000 +0100
@@ -68,6 +68,16 @@
   | Cunknown
   | Clink of commutable ref
 
+type 'a tyvar_id_memo
+val tyvar_id_memo_empty : 'a tyvar_id_memo
+val tyvar_id_memo_add : 'a -> int list -> 'a tyvar_id_memo -> 'a tyvar_id_memo
+val tyvar_id_memo_lookup : 'a -> 'a tyvar_id_memo -> int list option
+val tyvar_id_memo_append :
+  'a tyvar_id_memo -> 'a tyvar_id_memo -> 'a tyvar_id_memo
+val tyvar_id_memo_rename :
+  (Ident.t * Ident.t) list -> Ident.t tyvar_id_memo -> Ident.t tyvar_id_memo
+val tyvar_id_memo_dump : Ident.t tyvar_id_memo -> unit
+
 module TypeOps : sig
   type t = type_expr
   val compare : t -> t -> int
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/unused_var.ml	2005-12-28 17:27:46.000000000 +0000
+++ hashcaml/typing/unused_var.ml	2006-04-26 13:59:40.000000000 +0100
@@ -152,7 +152,7 @@
   | Pexp_for (id, e1, e2, _, e3) ->
       expression ppf tbl e1;
       expression ppf tbl e2;
-      let defined = ([ (id, e.pexp_loc, ref true) ], []) in
+      let defined = ([ (id, e.pexp_loc, ref false) ], []) in
       add_vars tbl defined;
       expression ppf tbl e3;
       check_rm_vars ppf tbl defined;
@@ -172,6 +172,17 @@
   | Pexp_lazy e -> expression ppf tbl e;
   | Pexp_poly (e, _) -> expression ppf tbl e;
   | Pexp_object cs -> class_structure ppf tbl cs;
+  | Pexp_fresh -> ()
+  | Pexp_namecoercion (_, _, e) -> expression ppf tbl e
+  | Pexp_fieldname _ -> ()
+  | Pexp_typeof e -> expression ppf tbl e
+  | Pexp_typerep _ -> ()
+  | Pexp_ifname (e1, e2, e3, e4_opt) ->
+      expression ppf tbl e1;
+      expression ppf tbl e2;
+      expression ppf tbl e3;
+      expression_option ppf tbl e4_opt
+  | Pexp_hashname (_, e) -> expression ppf tbl e
 
 and expression_option ppf tbl eo =
   match eo with
@@ -214,7 +225,7 @@
 and module_expr ppf tbl me =
   match me.pmod_desc with
   | Pmod_ident _ -> ()
-  | Pmod_structure s -> structure ppf tbl s
+  | Pmod_structure (_, s) -> structure ppf tbl s
   | Pmod_functor (_, _, me) -> module_expr ppf tbl me
   | Pmod_apply (me1, me2) ->
       module_expr ppf tbl me1;
@@ -226,11 +237,9 @@
 and class_expr ppf tbl ce =
   match ce.pcl_desc with
   | Pcl_constr _ -> ()
-  | Pcl_structure cs -> class_structure ppf tbl cs;
-  | Pcl_fun (_, _, _, ce) -> class_expr ppf tbl ce;
-  | Pcl_apply (ce, lel) ->
-      class_expr ppf tbl ce;
-      List.iter (fun (_, e) -> expression ppf tbl e) lel;
+  | Pcl_structure cs -> class_structure ppf tbl cs
+  | Pcl_fun (_, _, _, ce) -> class_expr ppf tbl ce
+  | Pcl_apply (ce, _) -> class_expr ppf tbl ce
   | Pcl_let (recflag, pel, ce) ->
       let_pel ppf tbl recflag pel (Some (fun ppf tbl -> class_expr ppf tbl ce));
   | Pcl_constraint (ce, _) -> class_expr ppf tbl ce;
@@ -252,11 +261,11 @@
   | Pcf_init e -> expression ppf tbl e;
 ;;
 
-let warn ppf ast =
+let warn ppf (kind, ast) =
   if Warnings.is_active (w_suspicious "") || Warnings.is_active (w_strict "")
   then begin
     let tbl = Hashtbl.create 97 in
     structure ppf tbl ast;
   end;
-  ast
+  (kind, ast)
 ;;
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/typing/unused_var.mli	2005-11-16 16:37:20.000000000 +0000
+++ hashcaml/typing/unused_var.mli	2006-04-24 12:23:35.000000000 +0100
@@ -10,7 +10,8 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: unused_var.mli,v 1.1.4.1 2005/11/16 16:37:20 doligez Exp $ *)
+(* $Id: unused_var.mli,v 1.1 2005/10/26 12:39:02 doligez Exp $ *)
 
-val warn : Format.formatter -> Parsetree.structure -> Parsetree.structure;;
-(* Warn on unused variables; return the second argument. *)
+val warn : Format.formatter ->
+  (Parsetree.myname_type * Parsetree.structure) ->
+  (Parsetree.myname_type * Parsetree.structure);;
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/utils/clflags.ml	2005-08-01 16:51:09.000000000 +0100
+++ hashcaml/utils/clflags.ml	2006-04-24 12:23:44.000000000 +0100
@@ -56,6 +56,14 @@
 and dump_rawlambda = ref false          (* -drawlambda *)
 and dump_lambda = ref false             (* -dlambda *)
 and dump_instr = ref false              (* -dinstr *)
+and mlpoly = ref true                   (* -mlpoly *)
+and polymarshal = ref true              (* -polymarshal *)
+and allowmynames = ref false            (* -allowmynames *)
+and hashing = ref true                  (* -hashing *)
+and dnormtree = ref false               (* -dnormtree *)
+and dnormtrans = ref false              (* -dnormtrans *)
+and pmdebug = ref false                 (* -pmdebug *)
+and tupled_typereps = ref false         (* -tupledtrs *)
 
 let keep_asm_file = ref false           (* -S *)
 let optimize_for_speed = ref true       (* -compact *)
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/utils/clflags.mli	2005-10-26 14:23:27.000000000 +0100
+++ hashcaml/utils/clflags.mli	2006-04-24 12:23:44.000000000 +0100
@@ -71,5 +71,13 @@
 val native_code : bool ref
 val inline_threshold : int ref
 val dont_write_files : bool ref
+val mlpoly : bool ref
+val polymarshal : bool ref
+val allowmynames : bool ref
+val hashing : bool ref
+val dnormtree : bool ref
+val dnormtrans : bool ref
+val pmdebug : bool ref
+val tupled_typereps : bool ref
 val std_include_flag : string -> string
 val std_include_dir : unit -> string list
--- /Users/rs456/hashcaml/tmp//ocaml-3.09.1/utils/config.mlp	2005-08-01 16:51:09.000000000 +0100
+++ hashcaml/utils/config.mlp	2006-04-24 12:23:44.000000000 +0100
@@ -39,14 +39,14 @@
 let ranlib = "%%RANLIBCMD%%"
 let cc_profile = "%%CC_PROFILE%%"
 
-let exec_magic_number = "Caml1999X008"
-and cmi_magic_number = "Caml1999I010"
-and cmo_magic_number = "Caml1999O006"
-and cma_magic_number = "Caml1999A007"
-and cmx_magic_number = "Caml1999Y010"
-and cmxa_magic_number = "Caml1999Z010"
-and ast_impl_magic_number = "Caml1999M010"
-and ast_intf_magic_number = "Caml1999N009"
+let exec_magic_number = "Hash1999X008"
+and cmi_magic_number = "Hash1999I010"
+and cmo_magic_number = "Hash1999O006"
+and cma_magic_number = "Hash1999A007"
+and cmx_magic_number = "Hash1999Y010"
+and cmxa_magic_number = "Hash1999Z010"
+and ast_impl_magic_number = "Hash1999M010"
+and ast_intf_magic_number = "Hash1999N009"
 
 let load_path = ref ([] : string list)
 
