From 629879ec25c18399171a37014f6964690f9de66a Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Fri, 21 Mar 2014 23:38:57 +0100 Subject: [PATCH] Bidir module, early draft of bidirectional iterators --- _oasis | 2 +- _tags | 39 +++++---- bidir.ml | 135 +++++++++++++++++++++++++++++ bidir.mli | 86 +++++++++++++++++++ containers.mlpack | 3 +- containers.odocl | 3 +- myocamlbuild.ml | 93 +++++++++++++------- setup.ml | 214 +++++++++++++++++++++++++--------------------- 8 files changed, 422 insertions(+), 153 deletions(-) create mode 100644 bidir.ml create mode 100644 bidir.mli diff --git a/_oasis b/_oasis index baacc92f..949e1029 100644 --- a/_oasis +++ b/_oasis @@ -40,7 +40,7 @@ Library "containers" Vector, Bij, PiCalculus, Bencode, Sexp, RAL, MultiSet, UnionFind, SmallSet, Leftistheap, AbsSet, CSM, MultiMap, ActionMan, BV, QCheck, BencodeOnDisk, Show, TTree, - HGraph, Automaton, Conv, Levenshtein + HGraph, Automaton, Conv, Levenshtein, Bidir BuildDepends: unix Library "containers_thread" diff --git a/_tags b/_tags index d288cafb..41b61360 100644 --- a/_tags +++ b/_tags @@ -1,5 +1,5 @@ # OASIS_START -# DO NOT EDIT (digest: fd301883fcfa23aed3844fd6b7def7d7) +# DO NOT EDIT (digest: 903b251284f5204ecda731d6cf74152b) # Ignore VCS directories, you can use the same kind of rule outside # OASIS_START/STOP if you want to exclude directories that contains # useless stuff for the build process @@ -55,63 +55,64 @@ "automaton.cmx": for-pack(Containers) "conv.cmx": for-pack(Containers) "levenshtein.cmx": for-pack(Containers) +"bidir.cmx": for-pack(Containers) # Library containers_thread "threads/containers_thread.cmxs": use_containers_thread -: use_containers : package(threads) : package(unix) +: use_containers # Library containers_lwt "containers_lwt.cmxs": use_containers_lwt "behavior.cmx": for-pack(Containers_lwt) "lwt_automaton.cmx": for-pack(Containers_lwt) -<*.ml{,i}>: use_containers <*.ml{,i}>: package(lwt) <*.ml{,i}>: package(lwt.unix) <*.ml{,i}>: package(unix) +<*.ml{,i}>: use_containers # Library containers_cgi "cgi/containers_cgi.cmxs": use_containers_cgi -: use_containers : package(CamlGI) : package(unix) +: use_containers # Executable benchs -"tests/benchs.native": use_containers "tests/benchs.native": package(bench) "tests/benchs.native": package(unix) +"tests/benchs.native": use_containers : package(bench) # Executable bench_conv -"tests/bench_conv.native": use_containers "tests/bench_conv.native": package(benchmark) "tests/bench_conv.native": package(unix) +"tests/bench_conv.native": use_containers : package(benchmark) # Executable test_levenshtein -"tests/test_levenshtein.native": use_containers "tests/test_levenshtein.native": package(qcheck) "tests/test_levenshtein.native": package(unix) +"tests/test_levenshtein.native": use_containers : package(qcheck) # Executable run_tests -"tests/run_tests.native": use_containers -"tests/run_tests.native": package(threads) -"tests/run_tests.native": package(oUnit) "tests/run_tests.native": package(lwt) "tests/run_tests.native": package(lwt.unix) +"tests/run_tests.native": package(oUnit) +"tests/run_tests.native": package(threads) "tests/run_tests.native": package(unix) -: use_containers -: package(threads) -: package(oUnit) +"tests/run_tests.native": use_containers : package(lwt) : package(lwt.unix) +: package(oUnit) +: package(threads) : package(unix) +: use_containers # Executable web_pwd -"examples/cgi/web_pwd.byte": use_containers_cgi -"examples/cgi/web_pwd.byte": use_containers -"examples/cgi/web_pwd.byte": package(threads) "examples/cgi/web_pwd.byte": package(CamlGI) +"examples/cgi/web_pwd.byte": package(threads) "examples/cgi/web_pwd.byte": package(unix) -: use_containers_cgi -: use_containers -: package(threads) +"examples/cgi/web_pwd.byte": use_containers +"examples/cgi/web_pwd.byte": use_containers_cgi : package(CamlGI) +: package(threads) : package(unix) +: use_containers +: use_containers_cgi # OASIS_STOP : thread : thread diff --git a/bidir.ml b/bidir.ml new file mode 100644 index 00000000..3ba5d687 --- /dev/null +++ b/bidir.ml @@ -0,0 +1,135 @@ + +(* +copyright (c) 2013, simon cruanes +all rights reserved. + +redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. redistributions in binary +form must reproduce the above copyright notice, this list of conditions and the +following disclaimer in the documentation and/or other materials provided with +the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*) + +(** {1 Bidirectional Iterators} + +Iterators that can be traversed in both directions *) + +type 'a t = + | Nil + | Cons of (unit -> 'a t) * 'a * (unit -> 'a t) + +let nil = Nil + +let ret_nil () = Nil + +let insert_before x = function + | Nil -> Cons (ret_nil, x, ret_nil) + | Cons (l, y, r) -> + let rec cur() = + Cons (l, x, (fun () -> Cons (cur, y, r))) + in cur() + +let insert_after x = function + | Nil -> Cons (ret_nil, x, ret_nil) + | Cons (l, y, r) -> + let rec cur() = + Cons (l, y, (fun () -> Cons (cur, x, r))) + in cur() + +let left = function + | Nil -> Nil + | Cons (l, _, _) -> l() + +let right = function + | Nil -> Nil + | Cons (_, _, r) -> r() + +let graft_before ~inner outer = + match outer with + | Nil -> inner + | Cons (l_out, x_out, r_out) -> + let rec right ret_left inner () = match inner () with + | Nil -> Cons(ret_left, x_out, r_out) (* yield x_out *) + | Cons (_, x_in, r_in) -> + let rec cur() = + Cons (ret_left, x_in, right cur r_in) + in cur() + and left ret_right inner () = match inner () with + | Nil -> l_out() (* yield same as l_out *) + | Cons (l_in, x_in, _) -> + let rec cur() = + Cons (left cur l_in, x_in, ret_right) + in cur() + and start() = match inner with + | Nil -> outer + | Cons (l, x, r) -> Cons (left start l, x, right start r) + in + start() + +let graft_after ~inner outer = + graft_before ~inner (right outer) + +let rev = function + | Nil -> Nil + | Cons (l, x, r) -> + Cons (r, x, l) + +(** {2 Right-iteration} *) + +let rec fold f acc = function + | Nil -> acc + | Cons (_, x, l) -> + let acc = f acc x in + fold f acc (l ()) + +let to_rev_list l = + fold (fun acc x -> x::acc) [] l + +let to_list l = + List.rev (to_rev_list l) + +let rec __of_list prev l () = match l with + | [] -> Nil + | x::l -> + let rec cur() = + Cons (prev, x, __of_list cur l) + in cur() + +let of_list l = __of_list ret_nil l () + +(** {2 Full constructor} *) + +let of_lists l x r = + let rec cur() = + Cons (__of_list cur l, x, __of_list cur r) + in cur() + +(** {2 Moves} *) + +let left_n n b = + let rec traverse acc n b = match n, b with + | 0, _ + | _, Nil -> acc, b + | _, Cons (l, x, _) -> traverse (x::acc) (n-1) (l()) + in traverse [] n b + +let right_n n b = + let rec traverse acc n b = match n, b with + | 0, _ + | _, Nil -> acc, b + | _, Cons (_, x, r) -> traverse (x::acc) (n-1) (r()) + in traverse [] n b diff --git a/bidir.mli b/bidir.mli new file mode 100644 index 00000000..dee7b0e9 --- /dev/null +++ b/bidir.mli @@ -0,0 +1,86 @@ + +(* +copyright (c) 2013, simon cruanes +all rights reserved. + +redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. redistributions in binary +form must reproduce the above copyright notice, this list of conditions and the +following disclaimer in the documentation and/or other materials provided with +the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*) + +(** {1 Bidirectional Iterators} + +Iterators that can be traversed in both directions *) + +type 'a t = + | Nil + | Cons of (unit -> 'a t) * 'a * (unit -> 'a t) + +val nil : 'a t + (** Empty iterator *) + +val insert_before : 'a -> 'a t -> 'a t + (** Insert the given element before the current slot in the + * given iterator *) + +val insert_after : 'a -> 'a t -> 'a t + (** Insert the element right after the current one *) + +val left : 'a t -> 'a t + (** Go left once. Doesn't do anything on empty iterator. *) + +val right : 'a t -> 'a t + (** Go right once. Doesn't do anything on empty iterator. *) + +val graft_before : inner:'a t -> 'a t -> 'a t + (** [insert ~inner outer] grafts [inner] just before the current element of + [outer]. *) + +val graft_after : inner:'a t -> 'a t -> 'a t + +val rev : 'a t -> 'a t + (** Reverse the order of iteration *) + +(** {2 Right-iteration} +traverse the right part of the iterator. traversing the left is +easily done with {!rev}. *) + +val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a + (** Fold on elements starting from the current one, to the right end *) + +val to_rev_list : 'a t -> 'a list + (** To reverse list *) + +val to_list : 'a t -> 'a list + (** Conversion to list. Only traverse the right part. *) + +val of_list : 'a list -> 'a t + (** Iterate on the list *) + +(** {2 Full constructor} *) + +val of_lists : 'a list -> 'a -> 'a list -> 'a t + +(** {2 Moves} *) + +val left_n : int -> 'a t -> 'a list * 'a t + (** Move left n times, and return the n elements traversed (at most), + from left-most one to right_most one.*) + +val right_n : int -> 'a t -> 'a list * 'a t diff --git a/containers.mlpack b/containers.mlpack index 817cba7a..50fab8d8 100644 --- a/containers.mlpack +++ b/containers.mlpack @@ -1,5 +1,5 @@ # OASIS_START -# DO NOT EDIT (digest: 38e5fd431c40c173ee89b060fc69bed7) +# DO NOT EDIT (digest: ad1a5d1dbb926223a57d547d5e717146) Cache Deque Gen @@ -40,4 +40,5 @@ HGraph Automaton Conv Levenshtein +Bidir # OASIS_STOP diff --git a/containers.odocl b/containers.odocl index 817cba7a..50fab8d8 100644 --- a/containers.odocl +++ b/containers.odocl @@ -1,5 +1,5 @@ # OASIS_START -# DO NOT EDIT (digest: 38e5fd431c40c173ee89b060fc69bed7) +# DO NOT EDIT (digest: ad1a5d1dbb926223a57d547d5e717146) Cache Deque Gen @@ -40,4 +40,5 @@ HGraph Automaton Conv Levenshtein +Bidir # OASIS_STOP diff --git a/myocamlbuild.ml b/myocamlbuild.ml index 500eb530..0e01f1a8 100644 --- a/myocamlbuild.ml +++ b/myocamlbuild.ml @@ -1,5 +1,5 @@ (* OASIS_START *) -(* DO NOT EDIT (digest: e5b7778fcec1af4e8956e90e19fccd18) *) +(* DO NOT EDIT (digest: 5aa8431a34ac4b8eb107bbd4e50b9c49) *) module OASISGettext = struct (* # 22 "src/oasis/OASISGettext.ml" *) @@ -204,26 +204,27 @@ module BaseEnvLight = struct end - let var_get name env = - let rec var_expand str = - let buff = - Buffer.create ((String.length str) * 2) - in - Buffer.add_substitute - buff - (fun var -> - try - var_expand (MapString.find var env) - with Not_found -> - failwith - (Printf.sprintf - "No variable %s defined when trying to expand %S." - var - str)) - str; - Buffer.contents buff + let rec var_expand str env = + let buff = + Buffer.create ((String.length str) * 2) in - var_expand (MapString.find name env) + Buffer.add_substitute + buff + (fun var -> + try + var_expand (MapString.find var env) env + with Not_found -> + failwith + (Printf.sprintf + "No variable %s defined when trying to expand %S." + var + str)) + str; + Buffer.contents buff + + + let var_get name env = + var_expand (MapString.find name env) env let var_choose lst env = @@ -233,7 +234,7 @@ module BaseEnvLight = struct end -# 236 "myocamlbuild.ml" +# 237 "myocamlbuild.ml" module MyOCamlbuildFindlib = struct (* # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *) @@ -306,6 +307,22 @@ module MyOCamlbuildFindlib = struct let find_syntaxes () = ["camlp4o"; "camlp4r"] + let well_known_syntax = [ + "camlp4.quotations.o"; + "camlp4.quotations.r"; + "camlp4.exceptiontracer"; + "camlp4.extend"; + "camlp4.foldgenerator"; + "camlp4.listcomprehension"; + "camlp4.locationstripper"; + "camlp4.macro"; + "camlp4.mapgenerator"; + "camlp4.metagenerator"; + "camlp4.profiler"; + "camlp4.tracer" + ] + + let dispatch = function | Before_options -> @@ -331,13 +348,17 @@ module MyOCamlbuildFindlib = struct List.iter begin fun pkg -> let base_args = [A"-package"; A pkg] in + (* TODO: consider how to really choose camlp4o or camlp4r. *) let syn_args = [A"-syntax"; A "camlp4o"] in let args = - (* Heuristic to identify syntax extensions: whether they end in - * ".syntax"; some might not *) - if Filename.check_suffix pkg "syntax" - then syn_args @ base_args - else base_args + (* Heuristic to identify syntax extensions: whether they end in + ".syntax"; some might not. + *) + if Filename.check_suffix pkg "syntax" || + List.mem pkg well_known_syntax then + syn_args @ base_args + else + base_args in flag ["ocaml"; "compile"; "pkg_"^pkg] & S args; flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args; @@ -368,7 +389,11 @@ module MyOCamlbuildFindlib = struct flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]); flag ["ocaml"; "pkg_threads"; "doc"] (S[A "-I"; A "+threads"]); flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]); - flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]) + flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]); + flag ["ocaml"; "package(threads)"; "compile"] (S[A "-thread"]); + flag ["ocaml"; "package(threads)"; "doc"] (S[A "-I"; A "+threads"]); + flag ["ocaml"; "package(threads)"; "link"] (S[A "-thread"]); + flag ["ocaml"; "package(threads)"; "infer_interface"] (S[A "-thread"]); | _ -> () @@ -527,10 +552,14 @@ module MyOCamlbuildBase = struct (* Add flags *) List.iter (fun (tags, cond_specs) -> - let spec = - BaseEnvLight.var_choose cond_specs env + let spec = BaseEnvLight.var_choose cond_specs env in + let rec eval_specs = + function + | S lst -> S (List.map eval_specs lst) + | A str -> A (BaseEnvLight.var_expand str env) + | spec -> spec in - flag tags & spec) + flag tags & (eval_specs spec)) t.flags | _ -> () @@ -547,7 +576,7 @@ module MyOCamlbuildBase = struct end -# 550 "myocamlbuild.ml" +# 579 "myocamlbuild.ml" open Ocamlbuild_plugin;; let package_default = { @@ -566,6 +595,6 @@ let package_default = let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;; -# 570 "myocamlbuild.ml" +# 599 "myocamlbuild.ml" (* OASIS_STOP *) Ocamlbuild_plugin.dispatch dispatch_default;; diff --git a/setup.ml b/setup.ml index 3abd6b76..dd6377ea 100644 --- a/setup.ml +++ b/setup.ml @@ -1,9 +1,9 @@ (* setup.ml generated for the first time by OASIS v0.3.0 *) (* OASIS_START *) -(* DO NOT EDIT (digest: 5453440881a31ee76ccdea04c48398ff) *) +(* DO NOT EDIT (digest: 003d579056475b6add45efd6e0e9b852) *) (* - Regenerated by OASIS v0.4.0 + Regenerated by OASIS v0.4.2 Visit http://oasis.forge.ocamlcore.org for more information and documentation about functions used in this file. *) @@ -52,6 +52,7 @@ module OASISContext = struct type t = { + (* TODO: replace this by a proplist. *) quiet: bool; info: bool; debug: bool; @@ -88,19 +89,31 @@ module OASISContext = struct {!default with quiet = true} - let args () = + let fspecs () = + (* TODO: don't act on default. *) + let ignore_plugins = ref false in ["-quiet", Arg.Unit (fun () -> default := {!default with quiet = true}), - (s_ " Run quietly"); + s_ " Run quietly"; "-info", Arg.Unit (fun () -> default := {!default with info = true}), - (s_ " Display information message"); + s_ " Display information message"; "-debug", Arg.Unit (fun () -> default := {!default with debug = true}), - (s_ " Output debug message")] + s_ " Output debug message"; + + "-ignore-plugins", + Arg.Set ignore_plugins, + s_ " Ignore plugin's field."; + + "-C", + (* TODO: remove this chdir. *) + Arg.String (fun str -> Sys.chdir str), + s_ "dir Change directory before running."], + fun () -> {!default with ignore_plugins = !ignore_plugins} end module OASISString = struct @@ -286,6 +299,13 @@ module OASISUtils = struct Hashtbl.hash (String.lowercase s) end) + module SetStringCsl = + Set.Make + (struct + type t = string + let compare = compare_csl + end) + let varname_of_string ?(hyphen='_') s = if String.length s = 0 then @@ -920,7 +940,6 @@ module OASISLicense = struct | DEP5And of license_dep_5 list - type t = | DEP5License of license_dep_5 | OtherLicense of string (* URL *) @@ -1614,6 +1633,12 @@ module OASISFeatures = struct create "section_object" beta (fun () -> s_ "Implement an object section.") + + + let dynrun_for_release = + create "dynrun_for_release" alpha + (fun () -> + s_ "Make '-setup-update dynamic' suitable for releasing project.") end module OASISUnixPath = struct @@ -2757,7 +2782,7 @@ module OASISFileUtil = struct end -# 2760 "setup.ml" +# 2785 "setup.ml" module BaseEnvLight = struct (* # 22 "src/base/BaseEnvLight.ml" *) @@ -2832,26 +2857,27 @@ module BaseEnvLight = struct end - let var_get name env = - let rec var_expand str = - let buff = - Buffer.create ((String.length str) * 2) - in - Buffer.add_substitute - buff - (fun var -> - try - var_expand (MapString.find var env) - with Not_found -> - failwith - (Printf.sprintf - "No variable %s defined when trying to expand %S." - var - str)) - str; - Buffer.contents buff + let rec var_expand str env = + let buff = + Buffer.create ((String.length str) * 2) in - var_expand (MapString.find name env) + Buffer.add_substitute + buff + (fun var -> + try + var_expand (MapString.find var env) env + with Not_found -> + failwith + (Printf.sprintf + "No variable %s defined when trying to expand %S." + var + str)) + str; + Buffer.contents buff + + + let var_get name env = + var_expand (MapString.find name env) env let var_choose lst env = @@ -2861,15 +2887,15 @@ module BaseEnvLight = struct end -# 2864 "setup.ml" +# 2890 "setup.ml" module BaseContext = struct (* # 22 "src/base/BaseContext.ml" *) - + (* TODO: get rid of this module. *) open OASISContext - let args = args + let args () = fst (fspecs ()) let default = default @@ -5000,11 +5026,14 @@ module BaseSetup = struct s_ " Don't try to update setup.ml, even if _oasis has changed.") + let default_oasis_fn = "_oasis" + + let update_setup_ml t = let oasis_fn = match t.oasis_fn with | Some fn -> fn - | None -> "_oasis" + | None -> default_oasis_fn in let oasis_exec = match t.oasis_exec with @@ -5102,7 +5131,8 @@ module BaseSetup = struct try match t.oasis_digest with | Some dgst -> - if Sys.file_exists oasis_fn && dgst <> Digest.file "_oasis" then + if Sys.file_exists oasis_fn && + dgst <> Digest.file default_oasis_fn then begin do_update (); true @@ -5268,7 +5298,7 @@ module BaseSetup = struct end -# 5271 "setup.ml" +# 5301 "setup.ml" module InternalConfigurePlugin = struct (* # 22 "src/plugins/internal/InternalConfigurePlugin.ml" *) @@ -6117,7 +6147,7 @@ module InternalInstallPlugin = struct end -# 6120 "setup.ml" +# 6150 "setup.ml" module OCamlbuildCommon = struct (* # 22 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" *) @@ -6129,10 +6159,15 @@ module OCamlbuildCommon = struct open OASISGettext open BaseEnv open BaseStandardVar + open OASISTypes - let ocamlbuild_clean_ev = - "ocamlbuild-clean" + + + type extra_args = string list + + + let ocamlbuild_clean_ev = "ocamlbuild-clean" let ocamlbuildflags = @@ -6255,27 +6290,7 @@ module OCamlbuildPlugin = struct ref (fun lst -> lst) - type ocamlbuild_plugin = - { - plugin_tags: string option; - extra_args: string list; - } - - - let check_ocaml_version version pkg = - match pkg.ocaml_version with - | Some ocaml_version -> - let min_ocaml_version = OASISVersion.version_of_string version in - OASISVersion.comparator_ge min_ocaml_version ocaml_version - | None -> - false - - - let ocamlbuild_supports_ocamlfind = check_ocaml_version "3.12.1" - let ocamlbuild_supports_plugin_tags = check_ocaml_version "4.01" - - - let build t pkg argv = + let build extra_args pkg argv = (* Return the filename in build directory *) let in_build_dir fn = Filename.concat @@ -6419,33 +6434,13 @@ module OCamlbuildPlugin = struct (BaseBuilt.register bt bnm lst) in - let cond_targets = - (* Run the hook *) - !cond_targets_hook cond_targets - in + (* Run the hook *) + let cond_targets = !cond_targets_hook cond_targets in - let extra_args = - match t.plugin_tags with - | Some tags -> "-plugin-tags" :: ("'" ^ tags ^ "'") :: t.extra_args - | None -> t.extra_args - in - let extra_args = - if ocamlbuild_supports_ocamlfind pkg then - "-use-ocamlfind" :: extra_args - else - extra_args - in - - (* Run a list of target... *) - run_ocamlbuild - (List.flatten - (List.map snd cond_targets) - @ extra_args) - argv; - (* ... and register events *) - List.iter - check_and_register - (List.flatten (List.map fst cond_targets)) + (* Run a list of target... *) + run_ocamlbuild (List.flatten (List.map snd cond_targets) @ extra_args) argv; + (* ... and register events *) + List.iter check_and_register (List.flatten (List.map fst cond_targets)) let clean pkg extra_args = @@ -6482,12 +6477,18 @@ module OCamlbuildDocPlugin = struct + type run_t = + { + extra_args: string list; + run_path: unix_filename; + } - let doc_build path pkg (cs, doc) argv = + + let doc_build run pkg (cs, doc) argv = let index_html = OASISUnixPath.make [ - path; + run.run_path; cs.cs_name^".docdir"; "index.html"; ] @@ -6496,11 +6497,11 @@ module OCamlbuildDocPlugin = struct OASISHostPath.make [ build_dir argv; - OASISHostPath.of_unix path; + OASISHostPath.of_unix run.run_path; cs.cs_name^".docdir"; ] in - run_ocamlbuild [index_html] argv; + run_ocamlbuild (index_html :: run.extra_args) argv; List.iter (fun glb -> BaseBuilt.register @@ -6511,7 +6512,7 @@ module OCamlbuildDocPlugin = struct ["*.html"; "*.css"] - let doc_clean t pkg (cs, doc) argv = + let doc_clean run pkg (cs, doc) argv = run_clean argv; BaseBuilt.unregister BaseBuilt.BDoc cs.cs_name @@ -6519,7 +6520,7 @@ module OCamlbuildDocPlugin = struct end -# 6522 "setup.ml" +# 6523 "setup.ml" module CustomPlugin = struct (* # 22 "src/plugins/custom/CustomPlugin.ml" *) @@ -6667,15 +6668,13 @@ module CustomPlugin = struct end -# 6670 "setup.ml" +# 6671 "setup.ml" open OASISTypes;; let setup_t = { BaseSetup.configure = InternalConfigurePlugin.configure; - build = - OCamlbuildPlugin.build - {OCamlbuildPlugin.plugin_tags = None; extra_args = []}; + build = OCamlbuildPlugin.build ["-use-ocamlfind"]; test = [ ("all", @@ -6687,7 +6686,15 @@ let setup_t = cmd_distclean = [(OASISExpr.EBool true, None)] }) ]; - doc = [("containers", OCamlbuildDocPlugin.doc_build ".")]; + doc = + [ + ("containers", + OCamlbuildDocPlugin.doc_build + { + OCamlbuildDocPlugin.extra_args = ["-use-ocamlfind"]; + run_path = "." + }) + ]; install = InternalInstallPlugin.install; uninstall = InternalInstallPlugin.uninstall; clean = [OCamlbuildPlugin.clean]; @@ -6702,7 +6709,15 @@ let setup_t = cmd_distclean = [(OASISExpr.EBool true, None)] }) ]; - clean_doc = [("containers", OCamlbuildDocPlugin.doc_clean ".")]; + clean_doc = + [ + ("containers", + OCamlbuildDocPlugin.doc_clean + { + OCamlbuildDocPlugin.extra_args = ["-use-ocamlfind"]; + run_path = "." + }) + ]; distclean = []; distclean_test = [ @@ -6887,7 +6902,8 @@ let setup_t = "HGraph"; "Automaton"; "Conv"; - "Levenshtein" + "Levenshtein"; + "Bidir" ]; lib_pack = true; lib_internal_modules = []; @@ -7272,8 +7288,8 @@ let setup_t = plugin_data = [] }; oasis_fn = Some "_oasis"; - oasis_version = "0.4.0"; - oasis_digest = Some "\243\1810yk\175ZZ\026\212L]\250\023S\177"; + oasis_version = "0.4.2"; + oasis_digest = Some "\185\132z\234t\214f\1660(}\175\179\t\218\195"; oasis_exec = None; oasis_setup_args = []; setup_update = false @@ -7281,6 +7297,6 @@ let setup_t = let setup () = BaseSetup.setup setup_t;; -# 7285 "setup.ml" +# 7301 "setup.ml" (* OASIS_STOP *) let () = setup ();;