Copyright (C) 2006 Grégoire Henry

  distributed under the terms of the LGPL (for librairies Ty and
  SafeUnmarshalling) and the QPL (for the compiler patch) with the same
  exceptions as the ones used by the Objective Caml distribution by INRIA.

diff -u -r1.29 ocaml/typing/predef.ml
--- ocaml.cvs/typing/predef.ml	4 Jan 2004 14:32:34 -0000	1.29
+++ ocaml/typing/predef.ml	23 May 2006 16:51:06 -0000
@@ -34,6 +34,7 @@
 and ident_int32 = Ident.create "int32"
 and ident_int64 = Ident.create "int64"
 and ident_lazy_t = Ident.create "lazy_t"
+and ident_tyrepr = Ident.create "tyrepr"
 
 let path_int = Pident ident_int
 and path_char = Pident ident_char
@@ -50,6 +51,7 @@
 and path_int32 = Pident ident_int32
 and path_int64 = Pident ident_int64
 and path_lazy_t = Pident ident_lazy_t
+and path_tyrepr = Pident ident_tyrepr
 
 let type_int = newgenty (Tconstr(path_int, [], ref Mnil))
 and type_char = newgenty (Tconstr(path_char, [], ref Mnil))
@@ -65,6 +67,7 @@
 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_tyrepr t = newgenty (Tconstr(path_tyrepr, [t], ref Mnil))
 
 let ident_match_failure = Ident.create_predef_exn "Match_failure"
 and ident_out_of_memory = Ident.create_predef_exn "Out_of_memory"
@@ -145,6 +148,13 @@
      type_kind = Type_abstract;
      type_manifest = None;
      type_variance = [true, false, false]}
+  and decl_tyrepr =
+    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
@@ -177,7 +187,8 @@
   add_type ident_string decl_abstr (
   add_type ident_char decl_abstr (
   add_type ident_int decl_abstr (
-    empty_env)))))))))))))))))))))))))))
+  add_type ident_tyrepr decl_tyrepr (
+  empty_env))))))))))))))))))))))))))))
 
 let builtin_values =
   List.map (fun id -> Ident.make_global id; (Ident.name id, id))
diff -u -r1.14 ocaml/typing/predef.mli
--- ocaml.cvs/typing/predef.mli	5 Jul 2003 11:13:24 -0000	1.14
+++ ocaml/typing/predef.mli	23 May 2006 16:51:06 -0000
@@ -30,6 +30,7 @@
 val type_int32: type_expr
 val type_int64: type_expr
 val type_lazy_t: type_expr -> type_expr
+val type_tyrepr: type_expr -> type_expr
 
 val path_int: Path.t
 val path_char: Path.t
@@ -46,6 +47,7 @@
 val path_int32: Path.t
 val path_int64: Path.t
 val path_lazy_t: Path.t
+val path_tyrepr: Path.t
 
 val path_match_failure: Path.t
 val path_assert_failure : Path.t
diff -Nur --exclude testlabl --exclude testasmcomp --exclude test --exclude test_stdlib --exclude config --exclude camlheader --exclude .cvsignore --exclude CVS --exclude Saved --exclude _darcs --exclude '*~' --exclude '.#*' --exclude version.sh --exclude version.h --exclude config.ml ocaml.cvs/driver/main_args.ml ocaml/driver/main_args.ml
--- ocaml.cvs/driver/main_args.ml	2005-12-28 18:27:03.000000000 +0100
+++ ocaml/driver/main_args.ml	2006-03-28 23:25:53.000000000 +0200
@@ -37,6 +37,7 @@
      val _noautolink : unit -> unit
      val _nolabels : unit -> unit
      val _nostdlib : unit -> unit
+     val _noty : unit -> unit
      val _o : string -> unit
      val _output_obj : unit -> unit
      val _pack : unit -> unit
@@ -104,6 +105,8 @@
     "-nolabels", Arg.Unit F._nolabels, " Ignore non-optional labels in types";
     "-nostdlib", Arg.Unit F._nostdlib,
            " do not add default directory to the list of include directories";
+    "-noty", Arg.Unit F._noty,
+           " Do not export type declaration";
     "-o", Arg.String F._o, "<file>  Set output file name to <file>";
     "-output-obj", Arg.Unit F._output_obj,
            " Output a C object file instead of an executable";
--- ocaml.cvs/driver/main_args.mli	2005-05-09 15:39:17.000000000 +0200
+++ ocaml/driver/main_args.mli	2006-03-28 23:25:53.000000000 +0200
@@ -37,6 +37,7 @@
       val _noautolink : unit -> unit
       val _nolabels : unit -> unit
       val _nostdlib : unit -> unit
+      val _noty : unit -> unit
       val _o : string -> unit
       val _output_obj : unit -> unit
       val _pack : unit -> unit
diff -Nur --exclude testlabl --exclude testasmcomp --exclude test --exclude test_stdlib --exclude config --exclude camlheader --exclude .cvsignore --exclude CVS --exclude Saved --exclude _darcs --exclude '*~' --exclude '.#*' --exclude version.sh --exclude version.h --exclude config.ml ocaml.cvs/driver/main.ml ocaml/driver/main.ml
--- ocaml.cvs/driver/main.ml	2005-05-09 15:39:17.000000000 +0200
+++ ocaml/driver/main.ml	2006-03-28 23:25:53.000000000 +0200
@@ -119,6 +119,7 @@
   let _principal = set principal
   let _rectypes = set recursive_types
   let _thread = set use_threads
+  let _noty = unset keep_type_decl
   let _vmthread = set use_vmthreads
   let _unsafe = set fast
   let _use_prims s = use_prims := s
diff -Nur --exclude testlabl --exclude testasmcomp --exclude test --exclude test_stdlib --exclude config --exclude camlheader --exclude .cvsignore --exclude CVS --exclude Saved --exclude _darcs --exclude '*~' --exclude '.#*' --exclude version.sh --exclude version.h --exclude config.ml ocaml.cvs/driver/optmain.ml ocaml/driver/optmain.ml
--- ocaml.cvs/driver/optmain.ml	2005-12-28 18:27:03.000000000 +0100
+++ ocaml/driver/optmain.ml	2006-03-28 23:25:53.000000000 +0200
@@ -137,6 +137,8 @@
        "-nolabels", Arg.Set classic, " Ignore non-optional labels in types";
        "-nostdlib", Arg.Set no_std_include,
            " do not add standard directory to the list of include directories";
+       "-noty", Arg.Clear keep_type_decl,
+           " Do not export type declaration";
        "-o", Arg.String(fun s -> output_name := Some s),
              "<file>  Set output file name to <file>";
        "-output-obj", Arg.Unit(fun () -> output_c_object := true),
diff -Nur --exclude testlabl --exclude testasmcomp --exclude test --exclude test_stdlib --exclude config --exclude camlheader --exclude .cvsignore --exclude CVS --exclude Saved --exclude _darcs --exclude '*~' --exclude '.#*' --exclude version.sh --exclude version.h --exclude config.ml ocaml.cvs/tools/ocamlcp.ml ocaml/tools/ocamlcp.ml
--- ocaml.cvs/tools/ocamlcp.ml	2005-05-09 15:39:17.000000000 +0200
+++ ocaml/tools/ocamlcp.ml	2006-03-28 23:25:56.000000000 +0200
@@ -65,6 +65,7 @@
   let _nolabels = option "-nolabels"
   let _noautolink = option "-noautolink"
   let _nostdlib = option "-nostdlib"
+  let _noty () = option "-noty" ()
   let _o s = option_with_arg "-o" s
   let _output_obj = option "-output-obj"
   let _pack = option "-pack"
diff -Nur --exclude testlabl --exclude testasmcomp --exclude test --exclude test_stdlib --exclude config --exclude camlheader --exclude .cvsignore --exclude CVS --exclude Saved --exclude _darcs --exclude '*~' --exclude '.#*' --exclude version.sh --exclude version.h --exclude config.ml ocaml.cvs/toplevel/topmain.ml ocaml/toplevel/topmain.ml
--- ocaml.cvs/toplevel/topmain.ml	2005-01-28 18:52:58.000000000 +0100
+++ ocaml/toplevel/topmain.ml	2006-03-28 23:25:56.000000000 +0200
@@ -64,6 +64,7 @@
      "-noprompt", Arg.Set noprompt, " Suppress all prompts";
      "-nostdlib", Arg.Set no_std_include,
            " do not add default directory to the list of include directories";
+     "-noty", Arg.Clear keep_type_decl, " Do not export type declaration";
      "-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";
--- ocaml.cvs/utils/clflags.ml	2005-08-01 17:51:09.000000000 +0200
+++ ocaml/utils/clflags.ml	2006-03-28 23:25:56.000000000 +0200
@@ -88,3 +88,5 @@
 let std_include_dir () =
   if !no_std_include then [] else [Config.standard_library]
 ;;
+
+let keep_type_decl = ref true		(* -ty *)
diff -Nur --exclude testlabl --exclude testasmcomp --exclude test --exclude test_stdlib --exclude config --exclude camlheader --exclude .cvsignore --exclude CVS --exclude Saved --exclude _darcs --exclude '*~' --exclude '.#*' --exclude version.sh --exclude version.h --exclude config.ml ocaml.cvs/utils/clflags.mli ocaml/utils/clflags.mli
--- ocaml.cvs/utils/clflags.mli	2005-10-26 15:23:27.000000000 +0200
+++ ocaml/utils/clflags.mli	2006-03-28 23:25:56.000000000 +0200
@@ -73,3 +73,4 @@
 val dont_write_files : bool ref
 val std_include_flag : string -> string
 val std_include_dir : unit -> string list
+val keep_type_decl : bool ref
