[Pkg-ocaml-maint-commits] [cduce] 01/02: Port to OCaml 4.02.3 (Closes: #802268)
Mehdi Dogguy
mehdi at moszumanska.debian.org
Mon Dec 21 22:37:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
mehdi pushed a commit to branch master
in repository cduce.
commit f2d4c82f8b8ac39f47e1ff74b55ff8b11f0c8ce0
Author: Mehdi Dogguy <mehdi at debian.org>
Date: Mon Dec 21 22:15:58 2015 +0100
Port to OCaml 4.02.3 (Closes: #802268)
---
debian/changelog | 1 +
debian/patches/0001-Port-to-OCaml-4.02.3.patch | 210 +++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 212 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index d8af130..43b5a33 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ cduce (0.6.0-2) UNRELEASED; urgency=medium
[ Mehdi Dogguy ]
* Add ocaml-best-compilers as a build dependency
+ * Port to OCaml 4.02.3 (Closes: #802268)
-- Stéphane Glondu <glondu at debian.org> Tue, 16 Jun 2015 10:05:42 +0200
diff --git a/debian/patches/0001-Port-to-OCaml-4.02.3.patch b/debian/patches/0001-Port-to-OCaml-4.02.3.patch
new file mode 100644
index 0000000..afdb2e6
--- /dev/null
+++ b/debian/patches/0001-Port-to-OCaml-4.02.3.patch
@@ -0,0 +1,210 @@
+From: Mehdi Dogguy <mehdi at debian.org>
+Date: Mon, 21 Dec 2015 22:12:54 +0100
+Subject: Port to OCaml 4.02.3
+
+See https://git.cduce.org/cduce@57cf0c69ea3230604489824c6e85b374a5d397e8 for
+reference.
+---
+ ocamliface/Makefile | 8 +++++++-
+ ocamliface/ast_mapper.ml | 5 +++++
+ ocamliface/location.ml | 23 +++++++++++++++++++++++
+ ocamliface/mltypes.ml | 29 +++++++++++++++++------------
+ ocamliface/parsetree.ml | 3 +++
+ runtime/value.ml | 2 +-
+ 6 files changed, 56 insertions(+), 14 deletions(-)
+ create mode 100644 ocamliface/ast_mapper.ml
+ create mode 100644 ocamliface/parsetree.ml
+
+diff --git a/ocamliface/Makefile b/ocamliface/Makefile
+index 838fcc6..c9c7bfb 100644
+--- a/ocamliface/Makefile
++++ b/ocamliface/Makefile
+@@ -20,6 +20,8 @@ ocaml_files:
+ mkdir ocaml_files
+ $(HIDE)cp $(patsubst %,$(OCAML_SRC)/%, $(COPY_FILES)) ocaml_files/
+ cp location.ml ocaml_files/location.ml
++ cp ast_mapper.ml ocaml_files/ast_mapper.ml
++ cp parsetree.ml ocaml_files/parsetree.ml
+ cp ocaml_files/asttypes.mli ocaml_files/asttypes.ml
+ sed s=STDLIB=$(STDLIB)= config.ml > ocaml_files/config.ml
+ grep cmi_magic $(OCAML_SRC)/utils/config.mlp | head -1 >> ocaml_files/config.ml
+@@ -43,7 +45,8 @@ clean:
+ COPY_FILES=\
+ typing/annot.mli \
+ utils/misc.ml utils/tbl.ml \
+- utils/consistbl.ml utils/warnings.ml utils/terminfo.ml utils/clflags.ml \
++ utils/consistbl.ml utils/warnings.ml utils/terminfo.ml utils/clflags.mli \
++ utils/clflags.ml \
+ parsing/asttypes.mli parsing/location.mli \
+ parsing/longident.ml \
+ typing/outcometree.mli \
+@@ -57,9 +60,12 @@ COPY_FILES=\
+ COMPILE_FILES=\
+ warnings.ml location.mli asttypes.mli outcometree.mli annot.mli asttypes.ml \
+ config.ml misc.ml tbl.ml \
++ clflags.mli \
+ clflags.ml consistbl.ml terminfo.ml \
+ location.ml longident.ml \
+ ident.ml path.ml \
++ parsetree.ml \
++ ast_mapper.ml \
+ primitive.ml types.ml \
+ btype.ml oprint.ml \
+ subst.ml predef.ml \
+diff --git a/ocamliface/ast_mapper.ml b/ocamliface/ast_mapper.ml
+new file mode 100644
+index 0000000..9f44559
+--- /dev/null
++++ b/ocamliface/ast_mapper.ml
+@@ -0,0 +1,5 @@
++open Parsetree
++type mapper = { location : mapper -> Location.t -> Location.t;
++ attributes : mapper -> attribute list -> attribute list }
++let default_mapper = { location = (fun _ x -> x);
++ attributes = (fun _ x -> x); }
+diff --git a/ocamliface/location.ml b/ocamliface/location.ml
+index 4a79b18..ae3b240 100644
+--- a/ocamliface/location.ml
++++ b/ocamliface/location.ml
+@@ -4,7 +4,15 @@
+ open Lexing
+ type t = { loc_start: position; loc_end: position; loc_ghost: bool }
+ type 'a loc = { txt: 'a; loc: t }
++type error =
++ {
++ loc: t;
++ msg: string;
++ sub: error list;
++ if_highlight: string; (* alternative message if locations are highlighted *)
++ }
+
++exception Error of error
+ let none = { loc_start = dummy_pos; loc_end = dummy_pos; loc_ghost = true }
+ let dummy x = assert false
+ let in_file = dummy
+@@ -30,3 +38,18 @@ let print_loc = dummy
+ let print_filename = dummy
+ let show_filename = dummy
+ let absname = ref true
++let report_exception = dummy
++let report_error = dummy
++let register_error_of_exn _ = ()
++let error_of_exn = dummy
++let error_of_printer_file = dummy
++let error_of_printer = dummy
++let error ?(loc=none) ?(sub=[]) ?(if_highlight="") = dummy
++let errorf = error
++let raise_errorf = error
++let absolute_path = dummy
++let default_error_reporter = dummy
++let error_reporter = ref (fun _ _ -> ())
++let default_warning_printer = dummy
++let warning_printer = ref (fun _ _ _ -> ())
++let formatter_for_warnings = ref Format.std_formatter
+diff --git a/ocamliface/mltypes.ml b/ocamliface/mltypes.ml
+index de44660..eabe623 100644
+--- a/ocamliface/mltypes.ml
++++ b/ocamliface/mltypes.ml
+@@ -8,7 +8,7 @@ open Caml_cduce.Types
+
+ exception PolyAbstract of string
+
+-let ocaml_env = ref Env.initial
++let ocaml_env = ref Env.initial_unsafe_string
+
+ type t = { uid : int; mutable recurs : int; mutable def : def }
+ and def =
+@@ -169,20 +169,24 @@ let rec unfold_constr env p args =
+ | Type_variant (cstrs), _ ->
+ let cstrs =
+ (* TODO: Check this solution *)
+- List.map (function (cst,f,Some o)
+- -> (cst,List.map (unfold env) f,Some (unfold env o))
+- | (cst,f,None) -> (cst,List.map (unfold env) f,None)) cstrs in
++ List.map (function c_decl ->
++ let { cd_id = cst; cd_args = f; cd_res = o; _ } = c_decl in
++ (cst,List.map (unfold env) f,
++ match o with Some o -> Some (unfold env o)
++ | None -> None))
++ cstrs in
+ (*OLD: (fun (cst,f) -> (cst,List.map (unfold env) f)) cstrs in *)
+ Variant (prefix, cstrs, true)
+ | Type_record (f,_), _ ->
+- let f = List.map (fun (l,_,t) -> (l,unfold env t)) f in
++ let f = List.map (fun {ld_id = l; ld_type = t; _ } -> (l,unfold env t)) f in
+ Record (prefix, f, true)
+ | Type_abstract, Some t ->
+ Link (unfold env t)
+ | Type_abstract, None ->
+ (match args with
+ | [] -> Abstract pn
+- | l ->raise (PolyAbstract pn)));
++ | l ->raise (PolyAbstract pn))
++ | Type_open, _ -> raise (PolyAbstract pn) );
+ slot
+
+ and unfold env ty =
+@@ -242,8 +246,8 @@ let has_cmi name =
+ let find_value v =
+ Config.load_path := Config.standard_library :: !Loc.obj_path;
+ let li = Longident.parse v in
+- ocaml_env := Env.initial;
+- let (_,vd) = Env.lookup_value li Env.initial in
++ ocaml_env := Env.initial_unsafe_string;
++ let (_,vd) = Env.lookup_value li Env.initial_unsafe_string in
+ unfold vd.val_type
+
+ let values_of_sig name sg =
+@@ -264,8 +268,9 @@ let values_of_sig name sg =
+ let load_module name =
+ Config.load_path := Config.standard_library :: !Loc.obj_path;
+ let li = Longident.parse name in
+- ocaml_env := Env.initial;
+- let (_,mty) = Env.lookup_module li Env.initial in
++ ocaml_env := Env.initial_unsafe_string;
++ let path = Env.lookup_module ~load:false li Env.initial_unsafe_string in
++ let mty = Env.find_modtype_expansion path Env.initial_unsafe_string in
+ match mty with
+ | Mty_signature sg -> values_of_sig name sg
+ | _ -> raise (Loc.Generic
+@@ -290,7 +295,7 @@ let read_cmi name =
+ Config.load_path := Config.standard_library :: !Loc.obj_path;
+ let filename = Misc.find_in_path_uncap !Config.load_path (name ^ ".cmi") in
+ let sg = Env.read_signature name filename in
+- ocaml_env := Env.add_signature sg Env.initial;
++ ocaml_env := Env.add_signature sg Env.initial_unsafe_string;
+ let buf = Buffer.create 1024 in
+ let ppf = Format.formatter_of_buffer buf in
+ let values = ref [] in
+@@ -304,7 +309,7 @@ let read_cmi name =
+ Format.fprintf ppf "%a at ."
+ !Oprint.out_sig_item (Printtyp.tree_of_type_declaration id t rs);
+ | Sig_value _ -> unsupported "external value"
+- | Sig_exception _ -> unsupported "exception"
++ | Sig_typext _ -> unsupported "extensible type"
+ | Sig_module _ -> unsupported "module"
+ | Sig_modtype _ -> unsupported "module type"
+ | Sig_class _ -> unsupported "class"
+diff --git a/ocamliface/parsetree.ml b/ocamliface/parsetree.ml
+new file mode 100644
+index 0000000..e5a20dc
+--- /dev/null
++++ b/ocamliface/parsetree.ml
+@@ -0,0 +1,3 @@
++
++type attribute = (string Location.loc * string)
++type attributes = attribute list
+diff --git a/runtime/value.ml b/runtime/value.ml
+index 368b095..a3e24ee 100644
+--- a/runtime/value.ml
++++ b/runtime/value.ml
+@@ -169,7 +169,7 @@ let rec flatten = function
+ | q -> q
+
+ let eval_lazy_concat v =
+- let accu = Obj.magic (Pair (nil,Absent)) in
++ let accu = Obj.(magic (dup (repr (Pair (nil, Absent))))) in
+ let rec aux accu = function
+ | Concat (x,y) -> aux (append_cdr accu x) y
+ | v -> set_cdr accu v
+--
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..a06cc00
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-Port-to-OCaml-4.02.3.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/cduce.git
More information about the Pkg-ocaml-maint-commits
mailing list