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

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

commit ec469846efae1bea9484e9dd937f8a3bd5e69f2d
Author: Stephane Glondu <st...@glondu.net>
Date:   Wed Aug 3 13:44:36 2016 +0200

    Imported Upstream version 7.1.2
---
 API.odocl             |  3 +-
 CHANGES.txt           |  3 ++
 INSTALL.txt           |  5 +--
 _oasis                |  7 ++--
 _tags                 | 14 ++++++--
 examples/cloc/cloc.ml | 12 ++++---
 lib/META              |  5 +--
 lib/pcre.ml           | 98 ++++++++++++++++++++++++++++-----------------------
 lib/pcre.mldylib      |  3 +-
 lib/pcre.mllib        |  3 +-
 lib/pcre_compat.ml    |  2 ++
 lib/pcre_compat312.ml |  2 ++
 lib/pcre_compat402.ml |  2 ++
 lib/pcre_stubs.c      |  4 +--
 setup.ml              | 31 ++++++++++++----
 15 files changed, 124 insertions(+), 70 deletions(-)

diff --git a/API.odocl b/API.odocl
index bbedec7..5ae3091 100644
--- a/API.odocl
+++ b/API.odocl
@@ -1,4 +1,5 @@
 # OASIS_START
-# DO NOT EDIT (digest: 0737cd5b0b209ea0a68006ea5f0cea6f)
+# DO NOT EDIT (digest: 1fccac817a4a90d09645de26a4001bb1)
+lib/Pcre_compat
 lib/Pcre
 # OASIS_STOP
diff --git a/CHANGES.txt b/CHANGES.txt
index f6cceb9..a31be79 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,6 @@
+2014-10-23:  Fixed string handling for new OCaml version 4.02 (String/Bytes
+             modules).  Requires new findlib version (>= 1.5).
+
 2014-07-06:  Moved to GitHub.
 
 2014-06-04:  Multiple bug fixes:
diff --git a/INSTALL.txt b/INSTALL.txt
index e18a60f..e055a98 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -1,5 +1,5 @@
 (* OASIS_START *)
-(* DO NOT EDIT (digest: 1e40b3eb93fd299ffda7513c651e8512) *)
+(* DO NOT EDIT (digest: 33107e1b27849d0dd7ab3df5fbd86340) *)
 
 This is the INSTALL file for the pcre-ocaml distribution.
 
@@ -12,7 +12,8 @@ Dependencies
 In order to compile this package, you will need:
 
 * ocaml (>= 3.12) for all, doc API
-* findlib (>= 1.3.1)
+* findlib (>= 1.5)
+* bytes for library pcre
 
 Installing
 ==========
diff --git a/_oasis b/_oasis
index 40ec8f1..75a8410 100644
--- a/_oasis
+++ b/_oasis
@@ -1,6 +1,6 @@
 OASISFormat:      0.4
 Name:             pcre-ocaml
-Version:          7.1.1
+Version:          7.1.2
 Synopsis:         pcre-ocaml - bindings to the Perl Compatibility Regular 
Expressions library
 Description:      pcre-ocaml offers library functions for string pattern 
matching and substitution, similar to the functionality offered by the Perl 
language.
 Authors:          Markus Mottl <markus.mo...@gmail.com>
@@ -9,7 +9,7 @@ Maintainers:      Markus Mottl <markus.mo...@gmail.com>
 LicenseFile:      COPYING.txt
 License:          LGPL-2.1+ with OCaml linking exception
 OCamlVersion:     >= 3.12
-FindlibVersion:   >= 1.3.1
+FindlibVersion:   >= 1.5
 Homepage:         http://mmottl.github.io/pcre-ocaml
 #Categories:
 #FilesAB:
@@ -26,8 +26,9 @@ Flag strict
 Library pcre
   Path:           lib
   FindlibName:    pcre
-  Modules:        Pcre
+  Modules:        Pcre_compat, Pcre
   CSources:       pcre_stubs.c
+  BuildDepends:   bytes
   CCOpt:          -g -O2 -fPIC -DPIC
   if flag(strict) && ccomp_type(cc)
     CCOpt+:       -Wall -pedantic -Wextra -Wunused -Wno-long-long
diff --git a/_tags b/_tags
index b4072b1..137110c 100644
--- a/_tags
+++ b/_tags
@@ -1,5 +1,5 @@
 # OASIS_START
-# DO NOT EDIT (digest: c60675dbf6679827b7140bf2f8bd409f)
+# DO NOT EDIT (digest: 7921ee7e2f586699a2e96170dbcd2955)
 # 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
@@ -18,24 +18,34 @@
 <lib/*.ml{,i}>: oasis_library_pcre_ccopt
 "lib/pcre_stubs.c": oasis_library_pcre_ccopt
 <lib/pcre.{cma,cmxa}>: use_libpcre_stubs
+<lib/*.ml{,i}>: pkg_bytes
+"lib/pcre_stubs.c": pkg_bytes
 # Executable cloc
+<examples/cloc/cloc.{native,byte}>: pkg_bytes
 <examples/cloc/cloc.{native,byte}>: use_pcre
+<examples/cloc/*.ml{,i}>: pkg_bytes
 <examples/cloc/*.ml{,i}>: use_pcre
 # Executable count_hash
+<examples/count_hash/count_hash.{native,byte}>: pkg_bytes
 <examples/count_hash/count_hash.{native,byte}>: use_pcre
+<examples/count_hash/*.ml{,i}>: pkg_bytes
 <examples/count_hash/*.ml{,i}>: use_pcre
 # Executable pcregrep
+<examples/pcregrep/pcregrep.{native,byte}>: pkg_bytes
 <examples/pcregrep/pcregrep.{native,byte}>: use_pcre
+<examples/pcregrep/*.ml{,i}>: pkg_bytes
 <examples/pcregrep/*.ml{,i}>: use_pcre
 # Executable subst
+<examples/subst/subst.{native,byte}>: pkg_bytes
 <examples/subst/subst.{native,byte}>: use_pcre
+<examples/subst/*.ml{,i}>: pkg_bytes
 <examples/subst/*.ml{,i}>: use_pcre
 # OASIS_STOP
 
 true: -traverse
 <{lib,examples}/**>: traverse
 
-<**/*.ml{,i}>: warn(Aer-44), strict_sequence, annot
+<**/*.ml{,i}>: warn(Aer-44), strict_sequence, safe_string, annot
 
 <lib/pcre.{cma,cmxa}>: oasis_library_pcre_cclib
 "lib/libpcre_stubs.lib": oasis_library_pcre_cclib
diff --git a/examples/cloc/cloc.ml b/examples/cloc/cloc.ml
index 81e18b6..4af3884 100644
--- a/examples/cloc/cloc.ml
+++ b/examples/cloc/cloc.ml
@@ -1,16 +1,18 @@
+open Pcre_compat
 open Pcre
 
 let read_whole_channel ch =
   let size = 4096 in
-  let strbuf = String.create size
-  and buf = Buffer.create 65536
-  and len = ref size in
+  let strbuf = Bytes.create size in
+  let buf = Buffer.create 65536 in
+  let len = ref size in
   while !len <> 0 do
     len := input ch strbuf 0 size;
-    Buffer.add_substring buf strbuf 0 !len; done;
+    buffer_add_subbytes buf strbuf 0 !len
+  done;
   Buffer.contents buf
 
-let _ =
+let () =
   let str = read_whole_channel stdin in
   let str = qreplace ~pat:"/\\*(.|\n)*?\\*/" str in
   let str = qreplace_first ~pat:"^(\n|\\s)+" str in
diff --git a/lib/META b/lib/META
index 83ed674..5972e00 100644
--- a/lib/META
+++ b/lib/META
@@ -1,8 +1,9 @@
 # OASIS_START
-# DO NOT EDIT (digest: 53cc30deb5448f0e6c35a8e1b54a8802)
-version = "7.1.1"
+# DO NOT EDIT (digest: e848c4c6cf4b09451ff44023a647fd1a)
+version = "7.1.2"
 description =
 "pcre-ocaml - bindings to the Perl Compatibility Regular Expressions library"
+requires = "bytes"
 archive(byte) = "pcre.cma"
 archive(byte, plugin) = "pcre.cma"
 archive(native) = "pcre.cmxa"
diff --git a/lib/pcre.ml b/lib/pcre.ml
index a96f6c6..56ddc51 100644
--- a/lib/pcre.ml
+++ b/lib/pcre.ml
@@ -22,6 +22,8 @@
 
 (* Public exceptions and their registration with the C runtime *)
 
+open Pcre_compat
+
 type error =
   | Partial
   | BadPartial
@@ -269,24 +271,30 @@ let regexp_or
   in
   regexp ?study ?limit ?limit_recursion ~iflags ?flags ?chtables big_pat
 
-let string_unsafe_sub s ofs len =
-  let r = String.create len in
-  String.unsafe_blit s ofs r 0 len;
-  r
+let bytes_unsafe_blit_string str str_ofs bts bts_ofs len =
+  let str_bts = Bytes.unsafe_of_string str in
+  Bytes.unsafe_blit str_bts str_ofs bts bts_ofs len
+
+let string_unsafe_sub str ofs len =
+  let res = Bytes.create len in
+  bytes_unsafe_blit_string str ofs res 0 len;
+  Bytes.unsafe_to_string res
 
 let quote s =
   let len = String.length s in
-  let buf = String.create (len lsl 1) in
+  let buf = Bytes.create (len lsl 1) in
   let pos = ref 0 in
   for i = 0 to len - 1 do
     match String.unsafe_get s i with
     | '\\' | '^' | '$' | '.' | '[' | '|'
     | '('  | ')' | '?' | '*' | '+' | '{' as c ->
-      String.unsafe_set buf !pos '\\'; incr pos;
-      String.unsafe_set buf !pos c; incr pos
-    | c -> String.unsafe_set buf !pos c; incr pos
+      Bytes.unsafe_set buf !pos '\\';
+      incr pos;
+      Bytes.unsafe_set buf !pos c;
+      incr pos
+    | c -> Bytes.unsafe_set buf !pos c; incr pos
   done;
-  string_unsafe_sub buf 0 !pos
+  string_unsafe_sub (Bytes.unsafe_to_string buf) 0 !pos
 
 
 (* Matching of patterns and subpattern extraction *)
@@ -579,17 +587,17 @@ let replace ?(iflags = 0) ?flags ?(rex = def_rex) ?pat
     then
       let postfix_len = max (subj_len - cur_pos) 0 in
       let left = pos + full_len in
-      let res = String.create (left + postfix_len) in
-      String.unsafe_blit subj 0 res 0 pos;
-      String.unsafe_blit subj cur_pos res left postfix_len;
+      let res = Bytes.create (left + postfix_len) in
+      bytes_unsafe_blit_string subj 0 res 0 pos;
+      bytes_unsafe_blit_string subj cur_pos res left postfix_len;
       let inner_coll ofs (templ, ix, len) =
-        String.unsafe_blit templ ix res ofs len; ofs + len in
+        bytes_unsafe_blit_string templ ix res ofs len; ofs + len in
       let coll ofs (res_len, trans_lst) =
         let new_ofs = ofs - res_len in
         let _ = List.fold_left inner_coll new_ofs trans_lst in
         new_ofs in
       let _ = List.fold_left coll left trans_lsts in
-      res
+      Bytes.unsafe_to_string res
     else
       let first = Array.unsafe_get ovector 0 in
       let len = first - cur_pos in
@@ -630,20 +638,20 @@ let qreplace ?(iflags = 0) ?flags ?(rex = def_rex) ?pat
     then
       let postfix_len = max (subj_len - cur_pos) 0 in
       let left = pos + full_len in
-      let res = String.create (left + postfix_len) in
-      String.unsafe_blit subj 0 res 0 pos;
-      String.unsafe_blit subj cur_pos res left postfix_len;
+      let res = Bytes.create (left + postfix_len) in
+      bytes_unsafe_blit_string subj 0 res 0 pos;
+      bytes_unsafe_blit_string subj cur_pos res left postfix_len;
       let coll ofs = function
         | Some (substr, ix, len) ->
             let new_ofs = ofs - len in
-            String.unsafe_blit substr ix res new_ofs len;
+            bytes_unsafe_blit_string substr ix res new_ofs len;
             new_ofs
         | None ->
             let new_ofs = ofs - templ_len in
-            String.unsafe_blit templ 0 res new_ofs templ_len;
+            bytes_unsafe_blit_string templ 0 res new_ofs templ_len;
             new_ofs in
       let _ = List.fold_left coll left subst_lst in
-      res
+      Bytes.unsafe_to_string res
     else
       let first = Array.unsafe_get ovector 0 in
       let len = first - cur_pos in
@@ -679,15 +687,15 @@ let substitute_substrings ?(iflags = 0) ?flags ?(rex = 
def_rex) ?pat
     then
       let postfix_len = max (subj_len - cur_pos) 0 in
       let left = pos + full_len in
-      let res = String.create (left + postfix_len) in
-      String.unsafe_blit subj 0 res 0 pos;
-      String.unsafe_blit subj cur_pos res left postfix_len;
+      let res = Bytes.create (left + postfix_len) in
+      bytes_unsafe_blit_string subj 0 res 0 pos;
+      bytes_unsafe_blit_string subj cur_pos res left postfix_len;
       let coll ofs (templ, ix, len) =
         let new_ofs = ofs - len in
-        String.unsafe_blit templ ix res new_ofs len;
+        bytes_unsafe_blit_string templ ix res new_ofs len;
         new_ofs in
       let _ = List.fold_left coll left subst_lst in
-      res
+      Bytes.unsafe_to_string res
     else
       let first = Array.unsafe_get ovector 0 in
       let len = first - cur_pos in
@@ -736,14 +744,14 @@ let replace_first ?(iflags = 0) ?flags ?(rex = def_rex) 
?pat ?(pos = 0)
     let first = Array.unsafe_get ovector 0 in
     let last = Array.unsafe_get ovector 1 in
     let rest = String.length subj - last in
-    let res = String.create (first + res_len + rest) in
-    String.unsafe_blit subj 0 res 0 first;
+    let res = Bytes.create (first + res_len + rest) in
+    bytes_unsafe_blit_string subj 0 res 0 first;
     let coll ofs (templ, ix, len) =
-      String.unsafe_blit templ ix res ofs len; ofs + len in
+      bytes_unsafe_blit_string templ ix res ofs len; ofs + len in
     let ofs = List.fold_left coll first trans_lst in
-    String.unsafe_blit subj last res ofs rest;
-    res
-  with Not_found -> String.copy subj
+    bytes_unsafe_blit_string subj last res ofs rest;
+    Bytes.unsafe_to_string res
+  with Not_found -> string_copy subj
 
 let qreplace_first ?(iflags = 0) ?flags ?(rex = def_rex) ?pat
                    ?(pos = 0) ?(templ = "") ?callout subj =
@@ -759,12 +767,12 @@ let qreplace_first ?(iflags = 0) ?flags ?(rex = def_rex) 
?pat
     let len = String.length templ in
     let rest = String.length subj - last in
     let postfix_start = first + len in
-    let res = String.create (postfix_start + rest) in
-    String.unsafe_blit subj 0 res 0 first;
-    String.unsafe_blit templ 0 res first len;
-    String.unsafe_blit subj last res postfix_start rest;
-    res
-  with Not_found -> String.copy subj
+    let res = Bytes.create (postfix_start + rest) in
+    bytes_unsafe_blit_string subj 0 res 0 first;
+    bytes_unsafe_blit_string templ 0 res first len;
+    bytes_unsafe_blit_string subj last res postfix_start rest;
+    Bytes.unsafe_to_string res
+  with Not_found -> string_copy subj
 
 let substitute_substrings_first ?(iflags = 0) ?flags ?(rex = def_rex) ?pat
                                 ?(pos = 0) ?callout ~subst subj =
@@ -782,12 +790,12 @@ let substitute_substrings_first ?(iflags = 0) ?flags 
?(rex = def_rex) ?pat
     let postfix_len = subj_len - last in
     let templ_len = String.length templ in
     let postfix_start = prefix_len + templ_len in
-    let res = String.create (postfix_start + postfix_len) in
-    String.unsafe_blit subj 0 res 0 prefix_len;
-    String.unsafe_blit templ 0 res prefix_len templ_len;
-    String.unsafe_blit subj last res postfix_start postfix_len;
-    res
-  with Not_found -> String.copy subj
+    let res = Bytes.create (postfix_start + postfix_len) in
+    bytes_unsafe_blit_string subj 0 res 0 prefix_len;
+    bytes_unsafe_blit_string templ 0 res prefix_len templ_len;
+    bytes_unsafe_blit_string subj last res postfix_start postfix_len;
+    Bytes.unsafe_to_string res
+  with Not_found -> string_copy subj
 
 let substitute_first ?iflags ?flags ?rex ?pat ?pos
                      ?callout ~subst:str_subst subj =
@@ -804,7 +812,7 @@ let substitute_first ?iflags ?flags ?rex ?pat ?pos
 let internal_psplit flags rex max pos callout subj =
   let subj_len = String.length subj in
   if subj_len = 0 then []
-  else if max = 1 then [String.copy subj]
+  else if max = 1 then [string_copy subj]
   else
     let subgroups2, ovector = make_ovector rex in
 
@@ -920,7 +928,7 @@ let full_split ?(iflags = 0) ?flags ?(rex = def_rex) ?pat
   let iflags = match flags with Some flags -> rflags flags | _ -> iflags in
   let subj_len = String.length subj in
   if subj_len = 0 then []
-  else if max = 1 then [Text (String.copy subj)]
+  else if max = 1 then [Text (string_copy subj)]
   else
     let subgroups2, ovector = make_ovector rex in
 
diff --git a/lib/pcre.mldylib b/lib/pcre.mldylib
index ff13968..c3a8c6d 100644
--- a/lib/pcre.mldylib
+++ b/lib/pcre.mldylib
@@ -1,4 +1,5 @@
 # OASIS_START
-# DO NOT EDIT (digest: d2be70e32871447e9e1b0d3afc6b287f)
+# DO NOT EDIT (digest: 59510830006151db103f26a9abea6342)
+Pcre_compat
 Pcre
 # OASIS_STOP
diff --git a/lib/pcre.mllib b/lib/pcre.mllib
index ff13968..c3a8c6d 100644
--- a/lib/pcre.mllib
+++ b/lib/pcre.mllib
@@ -1,4 +1,5 @@
 # OASIS_START
-# DO NOT EDIT (digest: d2be70e32871447e9e1b0d3afc6b287f)
+# DO NOT EDIT (digest: 59510830006151db103f26a9abea6342)
+Pcre_compat
 Pcre
 # OASIS_STOP
diff --git a/lib/pcre_compat.ml b/lib/pcre_compat.ml
new file mode 100644
index 0000000..dc9ef5a
--- /dev/null
+++ b/lib/pcre_compat.ml
@@ -0,0 +1,2 @@
+let string_copy str = str
+let buffer_add_subbytes = Buffer.add_subbytes
diff --git a/lib/pcre_compat312.ml b/lib/pcre_compat312.ml
new file mode 100644
index 0000000..3bbc749
--- /dev/null
+++ b/lib/pcre_compat312.ml
@@ -0,0 +1,2 @@
+let string_copy = String.copy
+let buffer_add_subbytes = Buffer.add_substring
diff --git a/lib/pcre_compat402.ml b/lib/pcre_compat402.ml
new file mode 100644
index 0000000..dc9ef5a
--- /dev/null
+++ b/lib/pcre_compat402.ml
@@ -0,0 +1,2 @@
+let string_copy str = str
+let buffer_add_subbytes = Buffer.add_subbytes
diff --git a/lib/pcre_stubs.c b/lib/pcre_stubs.c
index 7d067d1..e2fd6eb 100644
--- a/lib/pcre_stubs.c
+++ b/lib/pcre_stubs.c
@@ -552,8 +552,7 @@ CAMLprim value pcre_exec_stub(value v_opt, value v_rex, 
value v_pos,
       char *subj = caml_stat_alloc(sizeof(char) * len);
       int *ovec = caml_stat_alloc(sizeof(int) * subgroups3);
       int ret;
-      struct cod cod =
-        { subj_start, (value *) NULL, (value *) NULL, (value) NULL };
+      struct cod cod = { 0, (value *) NULL, (value *) NULL, (value) NULL };
       struct pcre_extra new_extra =
 #ifdef PCRE_EXTRA_MATCH_LIMIT_RECURSION
 # ifdef PCRE_EXTRA_MARK
@@ -569,6 +568,7 @@ CAMLprim value pcre_exec_stub(value v_opt, value v_rex, 
value v_pos,
         { PCRE_EXTRA_CALLOUT_DATA, NULL, 0, NULL, NULL };
 #endif
 
+      cod.subj_start = subj_start;
       memcpy(subj, ocaml_subj, len);
 
       Begin_roots4(v_rex, v_cof, v_substrings, v_ovec);
diff --git a/setup.ml b/setup.ml
index ce0705b..0b57ae9 100644
--- a/setup.ml
+++ b/setup.ml
@@ -1,7 +1,7 @@
 (* setup.ml generated for the first time by OASIS v0.3.0 *)
 
 (* OASIS_START *)
-(* DO NOT EDIT (digest: 42f84d31ecf1b40f0a6c2520b83d1f89) *)
+(* DO NOT EDIT (digest: 3bfa908443c327c2931963d6d884f765) *)
 (*
    Regenerated by OASIS v0.4.4
    Visit http://oasis.forge.ocamlcore.org for more information and
@@ -6644,11 +6644,11 @@ let setup_t =
        {
           oasis_version = "0.4";
           ocaml_version = Some (OASISVersion.VGreaterEqual "3.12");
-          findlib_version = Some (OASISVersion.VGreaterEqual "1.3.1");
+          findlib_version = Some (OASISVersion.VGreaterEqual "1.5");
           alpha_features = [];
           beta_features = [];
           name = "pcre-ocaml";
-          version = "7.1.1";
+          version = "7.1.2";
           license =
             OASISLicense.DEP5License
               (OASISLicense.DEP5Unit
@@ -6729,7 +6729,7 @@ let setup_t =
                       bs_install = [(OASISExpr.EBool true, true)];
                       bs_path = "lib";
                       bs_compiled_object = Best;
-                      bs_build_depends = [];
+                      bs_build_depends = [FindlibPackage ("bytes", None)];
                       bs_build_tools =
                         [ExternalTool "ocamldoc"; ExternalTool "ocamlbuild"];
                       bs_c_sources = ["pcre_stubs.c"];
@@ -6760,7 +6760,7 @@ let setup_t =
                       bs_nativeopt = [(OASISExpr.EBool true, [])]
                    },
                    {
-                      lib_modules = ["Pcre"];
+                      lib_modules = ["Pcre_compat"; "Pcre"];
                       lib_pack = false;
                       lib_internal_modules = [];
                       lib_findlib_parent = None;
@@ -6947,7 +6947,7 @@ let setup_t =
        };
      oasis_fn = Some "_oasis";
      oasis_version = "0.4.4";
-     oasis_digest = Some "\139�|�O\134#\153q�KFF��\130";
+     oasis_digest = Some "��\145�`\016�\015\151d����\148|";
      oasis_exec = None;
      oasis_setup_args = [];
      setup_update = false
@@ -6964,4 +6964,23 @@ let pcre_config =
     ~cli:BaseEnv.CLIAuto
     ~arg_help:" Full path to pcre-config executable"
 
+let () =
+  let ocaml_major, ocaml_minor =
+    Scanf.sscanf Sys.ocaml_version "%i.%i" (fun v1 v2 -> v1, v2) in
+  let cp_file src dst =
+    let ic = open_in src in
+    let oc = open_out dst in
+    try while true do output_string oc (input_line ic ^ "\n") done
+    with End_of_file ->
+      close_out oc;
+      close_in ic
+  in
+  let src =
+    if ocaml_major > 4 || (ocaml_major = 4 && ocaml_minor >= 2) then
+      "lib/pcre_compat402.ml"
+    else
+      "lib/pcre_compat312.ml"
+  in
+  cp_file src "lib/pcre_compat.ml"
+
 let () = setup ();;

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

_______________________________________________
Pkg-ocaml-maint-commits mailing list
Pkg-ocaml-maint-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits

Reply via email to