[Pkg-ocaml-maint-commits] [ocaml-text] 04/11: New upstream version 0.8

Stéphane Glondu glondu at moszumanska.debian.org
Tue Jul 18 09:25:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

glondu pushed a commit to branch master
in repository ocaml-text.

commit 113c765a10d6761535d14ed503971ed7bfd56c78
Author: Stephane Glondu <steph at glondu.net>
Date:   Tue Jul 18 10:22:22 2017 +0200

    New upstream version 0.8
---
 .gitignore             |   1 +
 _oasis                 |   1 +
 _tags                  |  25 +++--
 configure              |   4 +-
 myocamlbuild.ml        | 106 ++++++++++--------
 opam                   |  11 ++
 setup.ml               | 287 +++++++++++++++++++++++++++----------------------
 src/META               |   3 +-
 src/ml_text.c          |   5 +-
 src/ml_text_bigarray.c |   5 +-
 src/text.ml            |  42 ++++----
 11 files changed, 281 insertions(+), 209 deletions(-)

diff --git a/.gitignore b/.gitignore
index dc08681..78e6805 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 _build
+setup.exe
 setup.data
 setup.log
 manual
diff --git a/_oasis b/_oasis
index d99b87a..3775dfe 100644
--- a/_oasis
+++ b/_oasis
@@ -32,6 +32,7 @@ Flag pcre
 Library text
   Path: src
   Install: true
+  BuildDepends: bytes
   Modules: Text, Encoding
   CSources: ml_text.c, common.h
 
diff --git a/_tags b/_tags
index 341cf8d..7210736 100644
--- a/_tags
+++ b/_tags
@@ -4,10 +4,11 @@
 <src/*>: use_iconv
 
 # OASIS_START
-# DO NOT EDIT (digest: d50f1b05b7e5413b67a11bc53bca8e69)
+# DO NOT EDIT (digest: 4e0f9df4e481ad80c07cec09691a505f)
 # 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
+true: annot, bin_annot
 <**/.svn>: -traverse
 <**/.svn>: not_hygienic
 ".bzr": -traverse
@@ -21,23 +22,29 @@
 # Library text
 "src/text.cmxs": use_text
 <src/text.{cma,cmxa}>: use_libtext_stubs
+"src/ml_text.c": pkg_bytes
 # Library bigarray
 "src/bigarray.cmxs": use_bigarray
 <src/bigarray.{cma,cmxa}>: use_libbigarray_stubs
-<src/*.ml{,i}>: pkg_bigarray
+<src/*.ml{,i,y}>: pkg_bigarray
 "src/ml_text_bigarray.c": pkg_bigarray
+"src/ml_text_bigarray.c": pkg_bytes
 "src/ml_text_bigarray.c": use_text
 # Library pcre
 "src/pcre.cmxs": use_pcre
-<src/*.ml{,i}>: pkg_pcre
-<src/*.ml{,i}>: use_text
+<src/*.ml{,i,y}>: pkg_bytes
+<src/*.ml{,i,y}>: pkg_pcre
+<src/*.ml{,i,y}>: use_text
 # Library pcre-syntax
 "syntax/pcre-syntax.cmxs": use_pcre-syntax
-<syntax/*.ml{,i}>: pkg_camlp4
-<syntax/*.ml{,i}>: pkg_camlp4.extend
-<syntax/*.ml{,i}>: pkg_camlp4.quotations.o
-<syntax/*.ml{,i}>: use_text
+<syntax/*.ml{,i,y}>: pkg_bytes
+<syntax/*.ml{,i,y}>: pkg_camlp4
+<syntax/*.ml{,i,y}>: pkg_camlp4.extend
+<syntax/*.ml{,i,y}>: pkg_camlp4.quotations.o
+<syntax/*.ml{,i,y}>: use_text
 # Executable test
+<tests/test.{native,byte}>: pkg_bytes
 <tests/test.{native,byte}>: use_text
-<tests/*.ml{,i}>: use_text
+<tests/*.ml{,i,y}>: pkg_bytes
+<tests/*.ml{,i,y}>: use_text
 # OASIS_STOP
diff --git a/configure b/configure
index 42fb4c3..d2a26d1 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 # OASIS_START
-# DO NOT EDIT (digest: 82230d61386befb40bc7377608e1f16e)
+# DO NOT EDIT (digest: 6f7b8221311e800a7093dc3b793f67ca)
 set -e
 
 FST=true
@@ -23,5 +23,5 @@ for i in "$@"; do
   esac
 done
 
-make configure CONFIGUREFLAGS="$@"
+make configure CONFIGUREFLAGS="$*"
 # OASIS_STOP
diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index f146083..5d202db 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -8,7 +8,7 @@
  *)
 
 (* OASIS_START *)
-(* DO NOT EDIT (digest: 9d66b72ae06fb14a247bc59ed377ec24) *)
+(* DO NOT EDIT (digest: 0d3ee811b8ff2dae0e7af52092a7e05d) *)
 module OASISGettext = struct
 (* # 22 "src/oasis/OASISGettext.ml" *)
 
@@ -48,10 +48,10 @@ module OASISExpr = struct
   open OASISGettext
 
 
-  type test = string 
+  type test = string
 
 
-  type flag = string 
+  type flag = string
 
 
   type t =
@@ -61,10 +61,10 @@ module OASISExpr = struct
     | EOr of t * t
     | EFlag of flag
     | ETest of test * string
-    
 
 
-  type 'a choices = (t * 'a) list 
+
+  type 'a choices = (t * 'a) list
 
 
   let eval var_get t =
@@ -258,6 +258,9 @@ module MyOCamlbuildFindlib = struct
     *)
   open Ocamlbuild_plugin
 
+  type conf =
+    { no_automatic_syntax: bool;
+    }
 
   (* these functions are not really officially exported *)
   let run_and_read =
@@ -324,7 +327,7 @@ module MyOCamlbuildFindlib = struct
 
   (* This lists all supported packages. *)
   let find_packages () =
-    List.map before_space (split_nl & run_and_read "ocamlfind list")
+    List.map before_space (split_nl & run_and_read (exec_from_conf "ocamlfind" ^ " list"))
 
 
   (* Mock to list available syntaxes. *)
@@ -347,7 +350,7 @@ module MyOCamlbuildFindlib = struct
   ]
 
 
-  let dispatch =
+  let dispatch conf =
     function
       | After_options ->
           (* By using Before_options one let command line options have an higher
@@ -366,31 +369,39 @@ module MyOCamlbuildFindlib = struct
            * -linkpkg *)
           flag ["ocaml"; "link"; "program"] & A"-linkpkg";
 
-          (* For each ocamlfind package one inject the -package option when
-           * compiling, computing dependencies, generating documentation and
-           * linking. *)
-          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" ||
-                   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;
-              flag ["ocaml"; "doc";      "pkg_"^pkg] & S args;
-              flag ["ocaml"; "link";     "pkg_"^pkg] & S base_args;
-              flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S args;
-            end
-            (find_packages ());
+          if not (conf.no_automatic_syntax) then begin
+            (* For each ocamlfind package one inject the -package option when
+             * compiling, computing dependencies, generating documentation and
+             * linking. *)
+            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, pargs) =
+                  (* 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, syn_args)
+                  else
+                    (base_args, [])
+                in
+                flag ["ocaml"; "compile";  "pkg_"^pkg] & S args;
+                flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args;
+                flag ["ocaml"; "doc";      "pkg_"^pkg] & S args;
+                flag ["ocaml"; "link";     "pkg_"^pkg] & S base_args;
+                flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S args;
+
+                (* TODO: Check if this is allowed for OCaml < 3.12.1 *)
+                flag ["ocaml"; "compile";  "package("^pkg^")"] & S pargs;
+                flag ["ocaml"; "ocamldep"; "package("^pkg^")"] & S pargs;
+                flag ["ocaml"; "doc";      "package("^pkg^")"] & S pargs;
+                flag ["ocaml"; "infer_interface"; "package("^pkg^")"] & S pargs;
+              end
+              (find_packages ());
+          end;
 
           (* Like -package but for extensions syntax. Morover -syntax is useless
            * when linking. *)
@@ -439,10 +450,10 @@ module MyOCamlbuildBase = struct
   module OC = Ocamlbuild_pack.Ocaml_compiler
 
 
-  type dir = string 
-  type file = string 
-  type name = string 
-  type tag = string 
+  type dir = string
+  type file = string
+  type name = string
+  type tag = string
 
 
 (* # 62 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
@@ -457,7 +468,7 @@ module MyOCamlbuildBase = struct
          * directory.
          *)
         includes:  (dir * dir list) list;
-      } 
+      }
 
 
   let env_filename =
@@ -555,12 +566,13 @@ module MyOCamlbuildBase = struct
 
                    (* When ocaml link something that use the C library, then one
                       need that file to be up to date.
+                      This holds both for programs and for libraries.
                     *)
-                   dep ["link"; "ocaml"; "program"; tag_libstubs lib]
-                     [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)];
+  		 dep ["link"; "ocaml"; tag_libstubs lib]
+  		     [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)];
 
-                   dep  ["compile"; "ocaml"; "program"; tag_libstubs lib]
-                     [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)];
+  		 dep  ["compile"; "ocaml"; tag_libstubs lib]
+  		      [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)];
 
                    (* TODO: be more specific about what depends on headers *)
                    (* Depends on .h files *)
@@ -589,18 +601,18 @@ module MyOCamlbuildBase = struct
             ()
 
 
-  let dispatch_default t =
+  let dispatch_default conf t =
     dispatch_combine
       [
         dispatch t;
-        MyOCamlbuildFindlib.dispatch;
+        MyOCamlbuildFindlib.dispatch conf;
       ]
 
 
 end
 
 
-# 594 "myocamlbuild.ml"
+# 606 "myocamlbuild.ml"
 open Ocamlbuild_plugin;;
 let package_default =
   {
@@ -621,9 +633,11 @@ let package_default =
   }
   ;;
 
-let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;;
+let conf = {MyOCamlbuildFindlib.no_automatic_syntax = false}
+
+let dispatch_default = MyOCamlbuildBase.dispatch_default conf package_default;;
 
-# 618 "myocamlbuild.ml"
+# 632 "myocamlbuild.ml"
 (* OASIS_STOP *)
 
 open Ocamlbuild_plugin
diff --git a/opam b/opam
new file mode 100644
index 0000000..193508c
--- /dev/null
+++ b/opam
@@ -0,0 +1,11 @@
+opam-version: "1.2"
+name: "text"
+maintainer: "vb at luminar.eu.org"
+build: [
+  ["./configure" "--%{pcre:enable}%-pcre"]
+  [make]
+  [make "install"]
+]
+remove: [["ocamlfind" "remove" "text"]]
+depends: ["ocamlfind" {build} "base-bytes"]
+depopts: ["pcre"]
\ No newline at end of file
diff --git a/setup.ml b/setup.ml
index 67af673..15c2553 100644
--- a/setup.ml
+++ b/setup.ml
@@ -8,9 +8,9 @@
  *)
 
 (* OASIS_START *)
-(* DO NOT EDIT (digest: c5bc4bd95f2fc5b92b4288a373231840) *)
+(* DO NOT EDIT (digest: accafa1ae06ad235d9eeddf57e24958f) *)
 (*
-   Regenerated by OASIS v0.4.4
+   Regenerated by OASIS v0.4.5
    Visit http://oasis.forge.ocamlcore.org for more information and
    documentation about functions used in this file.
 *)
@@ -249,11 +249,9 @@ module OASISString = struct
 
 
   let replace_chars f s =
-    let buf = String.make (String.length s) 'X' in
-      for i = 0 to String.length s - 1 do
-        buf.[i] <- f s.[i]
-      done;
-      buf
+    let buf = Buffer.create (String.length s) in
+    String.iter (fun c -> Buffer.add_char buf (f c)) s;
+    Buffer.contents buf
 
 
 end
@@ -746,7 +744,7 @@ module OASISVersion = struct
   type s = string
 
 
-  type t = string 
+  type t = string
 
 
   type comparator =
@@ -757,7 +755,7 @@ module OASISVersion = struct
     | VLesserEqual of t
     | VOr of  comparator * comparator
     | VAnd of comparator * comparator
-    
+
 
 
   (* Range of allowed characters *)
@@ -952,17 +950,17 @@ module OASISLicense = struct
 
 
 
-  type license = string 
+  type license = string
 
 
-  type license_exception = string 
+  type license_exception = string
 
 
   type license_version =
     | Version of OASISVersion.t
     | VersionOrLater of OASISVersion.t
     | NoVersion
-    
+
 
 
   type license_dep_5_unit =
@@ -971,19 +969,19 @@ module OASISLicense = struct
       excption:  license_exception option;
       version:   license_version;
     }
-    
+
 
 
   type license_dep_5 =
     | DEP5Unit of license_dep_5_unit
     | DEP5Or of license_dep_5 list
     | DEP5And of license_dep_5 list
-    
+
 
   type t =
     | DEP5License of license_dep_5
     | OtherLicense of string (* URL *)
-    
+
 
 
 end
@@ -998,10 +996,10 @@ module OASISExpr = struct
   open OASISGettext
 
 
-  type test = string 
+  type test = string
 
 
-  type flag = string 
+  type flag = string
 
 
   type t =
@@ -1011,10 +1009,10 @@ module OASISExpr = struct
     | EOr of t * t
     | EFlag of flag
     | ETest of test * string
-    
 
 
-  type 'a choices = (t * 'a) list 
+
+  type 'a choices = (t * 'a) list
 
 
   let eval var_get t =
@@ -1096,9 +1094,9 @@ module OASISText = struct
     | Para of string
     | Verbatim of string
     | BlankLine
-    
 
-  type t = elt list 
+
+  type t = elt list
 
 end
 
@@ -1109,40 +1107,40 @@ module OASISTypes = struct
 
 
 
-  type name          = string 
-  type package_name  = string 
-  type url           = string 
-  type unix_dirname  = string 
-  type unix_filename = string 
-  type host_dirname  = string 
-  type host_filename = string 
-  type prog          = string 
-  type arg           = string 
-  type args          = string list 
-  type command_line  = (prog * arg list) 
+  type name          = string
+  type package_name  = string
+  type url           = string
+  type unix_dirname  = string
+  type unix_filename = string
+  type host_dirname  = string
+  type host_filename = string
+  type prog          = string
+  type arg           = string
+  type args          = string list
+  type command_line  = (prog * arg list)
 
 
-  type findlib_name = string 
-  type findlib_full = string 
+  type findlib_name = string
+  type findlib_full = string
 
 
   type compiled_object =
     | Byte
     | Native
     | Best
-    
+
 
 
   type dependency =
     | FindlibPackage of findlib_full * OASISVersion.comparator option
     | InternalLibrary of name
-    
+
 
 
   type tool =
     | ExternalTool of name
     | InternalExecutable of name
-    
+
 
 
   type vcs =
@@ -1155,7 +1153,7 @@ module OASISTypes = struct
     | Arch
     | Monotone
     | OtherVCS of url
-    
+
 
 
   type plugin_kind =
@@ -1183,7 +1181,7 @@ module OASISTypes = struct
       ]
 
 
-  type 'a plugin = 'a * name * OASISVersion.t option 
+  type 'a plugin = 'a * name * OASISVersion.t option
 
 
   type all_plugin = plugin_kind plugin
@@ -1195,7 +1193,7 @@ module OASISTypes = struct
 (* # 115 "src/oasis/OASISTypes.ml" *)
 
 
-  type 'a conditional = 'a OASISExpr.choices 
+  type 'a conditional = 'a OASISExpr.choices
 
 
   type custom =
@@ -1203,7 +1201,7 @@ module OASISTypes = struct
         pre_command:  (command_line option) conditional;
         post_command: (command_line option) conditional;
       }
-      
+
 
 
   type common_section =
@@ -1212,7 +1210,7 @@ module OASISTypes = struct
         cs_data: PropList.Data.t;
         cs_plugin_data: plugin_data;
       }
-      
+
 
 
   type build_section =
@@ -1232,7 +1230,7 @@ module OASISTypes = struct
         bs_byteopt:         args conditional;
         bs_nativeopt:       args conditional;
       }
-      
+
 
 
   type library =
@@ -1243,28 +1241,28 @@ module OASISTypes = struct
         lib_findlib_parent:     findlib_name option;
         lib_findlib_name:       findlib_name option;
         lib_findlib_containers: findlib_name list;
-      } 
+      }
 
 
   type object_ =
       {
         obj_modules:            string list;
         obj_findlib_fullname:   findlib_name list option;
-      } 
+      }
 
 
   type executable =
       {
         exec_custom:          bool;
         exec_main_is:         unix_filename;
-      } 
+      }
 
 
   type flag =
       {
         flag_description:  string option;
         flag_default:      bool conditional;
-      } 
+      }
 
 
   type source_repository =
@@ -1276,7 +1274,7 @@ module OASISTypes = struct
         src_repo_branch:      string option;
         src_repo_tag:         string option;
         src_repo_subdir:      unix_filename option;
-      } 
+      }
 
 
   type test =
@@ -1287,7 +1285,7 @@ module OASISTypes = struct
         test_working_directory:  unix_filename option;
         test_run:                bool conditional;
         test_tools:              tool list;
-      } 
+      }
 
 
   type doc_format =
@@ -1298,7 +1296,7 @@ module OASISTypes = struct
     | Info of unix_filename
     | DVI
     | OtherDoc
-    
+
 
 
   type doc =
@@ -1314,7 +1312,7 @@ module OASISTypes = struct
         doc_format:      doc_format;
         doc_data_files:  (unix_filename * unix_filename option) list;
         doc_build_tools: tool list;
-      } 
+      }
 
 
   type section =
@@ -1325,7 +1323,7 @@ module OASISTypes = struct
     | SrcRepo    of common_section * source_repository
     | Test       of common_section * test
     | Doc        of common_section * doc
-    
+
 
 
   type section_kind =
@@ -1370,7 +1368,7 @@ module OASISTypes = struct
         disable_oasis_section:  unix_filename list;
         schema_data:            PropList.Data.t;
         plugin_data:            plugin_data;
-      } 
+      }
 
 
 end
@@ -1736,6 +1734,13 @@ module OASISFeatures = struct
       (fun () ->
         s_ "Allows the OASIS section comments and digest to be omitted in \
             generated files.")
+
+  let no_automatic_syntax =
+    create "no_automatic_syntax" alpha
+      (fun () ->
+         s_ "Disable the automatic inclusion of -syntax camlp4o for packages \
+             that matches the internal heuristic (if a dependency ends with \
+             a .syntax or is a well known syntax).")
 end
 
 module OASISUnixPath = struct
@@ -2106,16 +2111,6 @@ module OASISLibrary = struct
         lst
     in
 
-    (* The headers that should be compiled along *)
-    let headers =
-      if lib.lib_pack then
-        []
-      else
-        find_modules
-          lib.lib_modules
-          "cmi"
-    in
-
     (* The .cmx that be compiled along *)
     let cmxs =
       let should_be_built =
@@ -2141,12 +2136,32 @@ module OASISLibrary = struct
       []
     in
 
+    (* The headers and annot/cmt files that should be compiled along *)
+    let headers =
+      let sufx =
+        if lib.lib_pack
+        then [".cmti"; ".cmt"; ".annot"]
+        else [".cmi"; ".cmti"; ".cmt"; ".annot"]
+      in
+      List.map
+        begin
+          List.fold_left
+            begin fun accu s ->
+              let dot = String.rindex s '.' in
+              let base = String.sub s 0 dot in
+              List.map ((^) base) sufx @ accu
+            end
+            []
+        end
+        (find_modules lib.lib_modules "cmi")
+    in
+
     (* Compute what libraries should be built *)
     let acc_nopath =
       (* Add the packed header file if required *)
       let add_pack_header acc =
         if lib.lib_pack then
-          [cs.cs_name^".cmi"] :: acc
+          [cs.cs_name^".cmi"; cs.cs_name^".cmti"; cs.cs_name^".cmt"] :: acc
         else
           acc
       in
@@ -2506,13 +2521,13 @@ module OASISFindlib = struct
     in
 
     let library_name_of_findlib_name =
-      Lazy.lazy_from_fun
-        (fun () ->
-           (* Revert findlib_name_of_library_name. *)
-           MapString.fold
-             (fun k v mp -> MapString.add v k mp)
-             fndlb_name_of_lib_name
-             MapString.empty)
+      lazy begin
+        (* Revert findlib_name_of_library_name. *)
+        MapString.fold
+          (fun k v mp -> MapString.add v k mp)
+          fndlb_name_of_lib_name
+          MapString.empty
+      end
     in
     let library_name_of_findlib_name fndlb_nm =
       try
@@ -2882,7 +2897,7 @@ module OASISFileUtil = struct
 end
 
 
-# 2878 "setup.ml"
+# 2893 "setup.ml"
 module BaseEnvLight = struct
 (* # 22 "src/base/BaseEnvLight.ml" *)
 
@@ -2987,7 +3002,7 @@ module BaseEnvLight = struct
 end
 
 
-# 2983 "setup.ml"
+# 2998 "setup.ml"
 module BaseContext = struct
 (* # 22 "src/base/BaseContext.ml" *)
 
@@ -5398,7 +5413,7 @@ module BaseSetup = struct
 end
 
 
-# 5394 "setup.ml"
+# 5409 "setup.ml"
 module InternalConfigurePlugin = struct
 (* # 22 "src/plugins/internal/InternalConfigurePlugin.ml" *)
 
@@ -5834,6 +5849,17 @@ module InternalInstallPlugin = struct
           lst
     in
 
+    let make_fnames modul sufx =
+      List.fold_right
+        begin fun sufx accu ->
+          (String.capitalize modul ^ sufx) ::
+          (String.uncapitalize modul ^ sufx) ::
+          accu
+        end
+        sufx
+        []
+    in
+
     (** Install all libraries *)
     let install_libs pkg =
 
@@ -5854,27 +5880,29 @@ module InternalInstallPlugin = struct
                   OASISHostPath.of_unix bs.bs_path
                 in
                   List.fold_left
-                    (fun acc modul ->
-                       try
-                         List.find
-                           OASISFileUtil.file_exists_case
-                           (List.map
-                              (Filename.concat path)
-                              [modul^".mli";
-                               modul^".ml";
-                               String.uncapitalize modul^".mli";
-                               String.capitalize   modul^".mli";
-                               String.uncapitalize modul^".ml";
-                               String.capitalize   modul^".ml"])
-                         :: acc
-                       with Not_found ->
-                         begin
-                           warning
-                             (f_ "Cannot find source header for module %s \
-                                  in library %s")
-                             modul cs.cs_name;
-                           acc
-                         end)
+                    begin fun acc modul ->
+                      begin
+                        try
+                          [List.find
+                            OASISFileUtil.file_exists_case
+                            (List.map
+                               (Filename.concat path)
+                               (make_fnames modul [".mli"; ".ml"]))]
+                        with Not_found ->
+                          warning
+                            (f_ "Cannot find source header for module %s \
+                                 in library %s")
+                            modul cs.cs_name;
+                          []
+                      end
+                      @
+                      List.filter
+                        OASISFileUtil.file_exists_case
+                        (List.map
+                           (Filename.concat path)
+                           (make_fnames modul [".annot";".cmti";".cmt"]))
+                      @ acc
+                    end
                     acc
                     lib.lib_modules
               in
@@ -5922,27 +5950,29 @@ module InternalInstallPlugin = struct
                   OASISHostPath.of_unix bs.bs_path
                 in
                   List.fold_left
-                    (fun acc modul ->
-                       try
-                         List.find
-                           OASISFileUtil.file_exists_case
-                           (List.map
-                              (Filename.concat path)
-                              [modul^".mli";
-                               modul^".ml";
-                               String.uncapitalize modul^".mli";
-                               String.capitalize   modul^".mli";
-                               String.uncapitalize modul^".ml";
-                               String.capitalize   modul^".ml"])
-                         :: acc
-                       with Not_found ->
-                         begin
-                           warning
-                             (f_ "Cannot find source header for module %s \
-                                  in object %s")
-                             modul cs.cs_name;
-                           acc
-                         end)
+                    begin fun acc modul ->
+                      begin
+                        try
+                          [List.find
+                             OASISFileUtil.file_exists_case
+                             (List.map
+                                (Filename.concat path)
+                                (make_fnames modul [".mli"; ".ml"]))]
+                        with Not_found ->
+                          warning
+                            (f_ "Cannot find source header for module %s \
+                                 in object %s")
+                            modul cs.cs_name;
+                          []
+                      end
+                      @
+                      List.filter
+                        OASISFileUtil.file_exists_case
+                        (List.map
+                           (Filename.concat path)
+                           (make_fnames modul [".annot";".cmti";".cmt"]))
+                      @ acc
+                    end
                     acc
                     obj.obj_modules
               in
@@ -6247,7 +6277,7 @@ module InternalInstallPlugin = struct
 end
 
 
-# 6243 "setup.ml"
+# 6273 "setup.ml"
 module OCamlbuildCommon = struct
 (* # 22 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" *)
 
@@ -6264,7 +6294,7 @@ module OCamlbuildCommon = struct
 
 
 
-  type extra_args = string list 
+  type extra_args = string list
 
 
   let ocamlbuild_clean_ev = "ocamlbuild-clean"
@@ -6305,6 +6335,11 @@ module OCamlbuildCommon = struct
         else
           [];
 
+        if bool_of_string (tests ()) then
+          ["-tag"; "tests"]
+        else
+          [];
+
         if bool_of_string (profile ()) then
           ["-tag"; "profile"]
         else
@@ -6581,7 +6616,7 @@ module OCamlbuildDocPlugin = struct
     {
       extra_args: string list;
       run_path: unix_filename;
-    } 
+    }
 
 
   let doc_build run pkg (cs, doc) argv =
@@ -6620,7 +6655,7 @@ module OCamlbuildDocPlugin = struct
 end
 
 
-# 6616 "setup.ml"
+# 6651 "setup.ml"
 module CustomPlugin = struct
 (* # 22 "src/plugins/custom/CustomPlugin.ml" *)
 
@@ -6643,7 +6678,7 @@ module CustomPlugin = struct
         cmd_main:      command_line conditional;
         cmd_clean:     (command_line option) conditional;
         cmd_distclean: (command_line option) conditional;
-      } 
+      }
 
 
   let run  = BaseCustom.run
@@ -6768,7 +6803,7 @@ module CustomPlugin = struct
 end
 
 
-# 6764 "setup.ml"
+# 6799 "setup.ml"
 open OASISTypes;;
 
 let setup_t =
@@ -6947,7 +6982,7 @@ let setup_t =
                       bs_install = [(OASISExpr.EBool true, true)];
                       bs_path = "src";
                       bs_compiled_object = Best;
-                      bs_build_depends = [];
+                      bs_build_depends = [FindlibPackage ("bytes", None)];
                       bs_build_tools = [ExternalTool "ocamlbuild"];
                       bs_c_sources = ["ml_text.c"; "common.h"];
                       bs_data_files = [];
@@ -7221,8 +7256,8 @@ let setup_t =
           plugin_data = []
        };
      oasis_fn = Some "_oasis";
-     oasis_version = "0.4.4";
-     oasis_digest = Some "\239\169\170\201S\143\005')\175\131%\014G8W";
+     oasis_version = "0.4.5";
+     oasis_digest = Some "h\251\144\022\1879u\190\230\218\199,\158.\202\192";
      oasis_exec = None;
      oasis_setup_args = [];
      setup_update = false
@@ -7230,7 +7265,7 @@ let setup_t =
 
 let setup () = BaseSetup.setup setup_t;;
 
-# 7227 "setup.ml"
+# 7262 "setup.ml"
 (* OASIS_STOP *)
 
 (* List of paths to search for iconv *)
diff --git a/src/META b/src/META
index 2c352f7..21ab5aa 100644
--- a/src/META
+++ b/src/META
@@ -1,7 +1,8 @@
 # OASIS_START
-# DO NOT EDIT (digest: 7d039e7e35f4fea9f120eddf532b5c20)
+# DO NOT EDIT (digest: 73eda264e5285750a38263859be858c4)
 version = "0.7"
 description = "ocaml-text"
+requires = "bytes"
 archive(byte) = "text.cma"
 archive(byte, plugin) = "text.cma"
 archive(native) = "text.cmxa"
diff --git a/src/ml_text.c b/src/ml_text.c
index 339510f..fe0b107 100644
--- a/src/ml_text.c
+++ b/src/ml_text.c
@@ -15,6 +15,7 @@
 #include <strings.h>
 #include <wctype.h>
 #include <stdio.h>
+#include <stdint.h>
 
 #include <caml/alloc.h>
 #include <caml/memory.h>
@@ -107,7 +108,7 @@ CAMLprim value ml_text_decode(value cd_val, value buf_val, value pos_val, value
 {
   CAMLparam4(cd_val, buf_val, pos_val, len_val);
 
-  uint32 code;
+  uint32_t code;
   size_t len = Long_val(len_val);
   size_t in_left = len;
   char *in_bytes = String_val(buf_val) + Long_val(pos_val);
@@ -152,7 +153,7 @@ CAMLprim value ml_text_encode(value cd_val, value buf_val, value pos_val, value
 {
   CAMLparam5(cd_val, buf_val, pos_val, len_val, code_val);
 
-  uint32 code = Int_val(code_val);
+  uint32_t code = Int_val(code_val);
   size_t len = Long_val(len_val);
   size_t in_left = 4;
   char *in_bytes = (char*)&code;
diff --git a/src/ml_text_bigarray.c b/src/ml_text_bigarray.c
index a498e5f..c68560e 100644
--- a/src/ml_text_bigarray.c
+++ b/src/ml_text_bigarray.c
@@ -10,6 +10,7 @@
 #include <errno.h>
 #include <iconv.h>
 #include <string.h>
+#include <stdint.h>
 
 #include <caml/bigarray.h>
 #include <caml/alloc.h>
@@ -23,7 +24,7 @@ CAMLprim value ml_text_decode_bigarray(value cd_val, value buf_val, value pos_va
 {
   CAMLparam4(cd_val, buf_val, pos_val, len_val);
 
-  uint32 code;
+  uint32_t code;
   size_t len = Long_val(len_val);
   size_t in_left = len;
   char *in_bytes = (char*)Caml_ba_data_val(buf_val) + Long_val(pos_val);
@@ -47,7 +48,7 @@ CAMLprim value ml_text_encode_bigarray(value cd_val, value buf_val, value pos_va
 {
   CAMLparam5(cd_val, buf_val, pos_val, len_val, code_val);
 
-  uint32 code = Int_val(code_val);
+  uint32_t code = Int_val(code_val);
   size_t len = Long_val(len_val);
   size_t in_left = 4;
   char *in_bytes = (char*)&code;
diff --git a/src/text.ml b/src/text.ml
index fb9ae95..b1c5589 100644
--- a/src/text.ml
+++ b/src/text.ml
@@ -17,12 +17,12 @@ let fail str pos msg = raise (Invalid(Printf.sprintf "at position %d: %s" pos ms
    +-----------------------------------------------------------------+ *)
 
 let byte str i = Char.code (String.unsafe_get str i)
-let set_byte str i n = String.unsafe_set str i (Char.unsafe_chr n)
+let set_byte str i n = Bytes.unsafe_set str i (Char.unsafe_chr n)
 
 let unsafe_sub str ofs len =
-  let res = String.create len in
+  let res = Bytes.create len in
   String.unsafe_blit str ofs res 0 len;
-  res
+  Bytes.unsafe_to_string res
 
 (* +-----------------------------------------------------------------+
    | UTF-8 validation                                                |
@@ -330,27 +330,27 @@ let char code =
   if code < 0 then
     invalid_arg "Text.char"
   else if code < 0x80 then begin
-    let s = String.create 1 in
+    let s = Bytes.create 1 in
     set_byte s 0 code;
-    s
+    Bytes.unsafe_to_string s
   end else if code <= 0x800 then begin
-    let s = String.create 2 in
+    let s = Bytes.create 2 in
     set_byte s 0 ((code lsr 6) lor 0xc0);
     set_byte s 1 ((code land 0x3f) lor 0x80);
-    s
+    Bytes.unsafe_to_string s
   end else if code <= 0x10000 then begin
-    let s = String.create 3 in
+    let s = Bytes.create 3 in
     set_byte s 0 ((code lsr 12) lor 0xe0);
     set_byte s 1 (((code lsr 6) land 0x3f) lor 0x80);
     set_byte s 2 ((code land 0x3f) lor 0x80);
-    s
+    Bytes.unsafe_to_string s
   end else if code <= 0x10ffff then begin
-    let s = String.create 4 in
+    let s = Bytes.create 4 in
     set_byte s 0 ((code lsr 18) lor 0xf0);
     set_byte s 1 (((code lsr 12) land 0x3f) lor 0x80);
     set_byte s 2 (((code lsr 6) land 0x3f) lor 0x80);
     set_byte s 3 ((code land 0x3f) lor 0x80);
-    s
+    Bytes.unsafe_to_string s
   end else
     invalid_arg "Text.char"
 
@@ -382,22 +382,22 @@ let splice txt a b repl =
   if a > b then
     invalid_arg "Text.slice"
   else begin
-    let res = String.create (a + String.length repl + String.length txt - b) in
+    let res = Bytes.create (a + String.length repl + String.length txt - b) in
     String.unsafe_blit txt 0 res 0 a;
     String.unsafe_blit repl 0 res a (String.length repl);
     String.unsafe_blit txt b res (a + String.length repl) (String.length txt - b);
-    res
+    Bytes.unsafe_to_string res
   end
 
 let repeat n txt =
   let len = String.length txt in
-  let res = String.create (n * len) in
+  let res = Bytes.create (n * len) in
   let ofs = ref 0 in
   for i = 1 to n do
     String.unsafe_blit txt 0 res !ofs len;
     ofs := !ofs + len
   done;
-  res
+  Bytes.unsafe_to_string res
 
 let rec iter_rec f txt ofs =
   if ofs <> String.length txt then begin
@@ -420,7 +420,7 @@ let rev_iter f txt = rev_iter_rec f txt (String.length txt)
 let rev txt =
   let len = String.length txt in
   let ofs_src = ref len and ofs_dst = ref 0 in
-  let res = String.create len in
+  let res = Bytes.create len in
   while !ofs_src > 0 do
     let ofs = unsafe_prev txt !ofs_src in
     let len = !ofs_src - ofs in
@@ -428,7 +428,7 @@ let rev txt =
     ofs_src := ofs;
     ofs_dst := !ofs_dst + len
   done;
-  res
+  Bytes.unsafe_to_string res
 
 let init n f =
   let buf = Buffer.create n in
@@ -452,7 +452,7 @@ let concat sep l =
     | x :: l ->
         let sep_len = String.length sep in
         let len = List.fold_left (fun len str -> len + sep_len + String.length str) (String.length x) l in
-        let res = String.create len in
+        let res = Bytes.create len in
         String.unsafe_blit x 0 res 0 (String.length x);
         ignore
           (List.fold_left
@@ -463,7 +463,7 @@ let concat sep l =
                 String.unsafe_blit str 0 res ofs len;
                 ofs + len)
              (String.length x) l);
-        res
+        Bytes.unsafe_to_string res
 
 let rev_concat sep l =
   match l with
@@ -472,7 +472,7 @@ let rev_concat sep l =
     | x :: l ->
         let sep_len = String.length sep in
         let len = List.fold_left (fun len str -> len + sep_len + String.length str) (String.length x) l in
-        let res = String.create len in
+        let res = Bytes.create len in
         let ofs = len - String.length x in
         String.unsafe_blit x 0 res ofs (String.length x);
         ignore
@@ -485,7 +485,7 @@ let rev_concat sep l =
                 String.unsafe_blit str 0 res ofs len;
                 ofs)
              ofs l);
-        res
+        Bytes.unsafe_to_string res
 
 let explode txt =
   let l = ref [] in

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/ocaml-text.git



More information about the Pkg-ocaml-maint-commits mailing list