From 897231e8312a7abfdbbf6b8fba127b7c2dcad24a Mon Sep 17 00:00:00 2001
From: Erwan Jahier <erwan.jahier@univ-grenoble-alpes.fr>
Date: Thu, 30 Nov 2017 16:30:12 +0100
Subject: [PATCH] Use Bytes instead of String so that it works with ocaml
 4.06.0

---
 _oasis               |  2 +-
 doc/version.tex      |  6 +++---
 src/META             |  4 ++--
 src/gnuplotRif.ml    | 10 ++++++----
 src/localGenlex.ml   | 18 +++++++++---------
 src/lutilsVersion.ml |  4 ++--
 src/mypervasives.ml  | 10 +++++-----
 7 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/_oasis b/_oasis
index fafdcf7..33117fb 100644
--- a/_oasis
+++ b/_oasis
@@ -1,6 +1,6 @@
 OASISFormat: 0.4
 Name:        lutils
-Version:     1.16
+Version:     1.17
 Authors:     Erwan Jahier
 Maintainers: erwan.jahier@imag.fr
 License:     GPL-3
diff --git a/doc/version.tex b/doc/version.tex
index b1474dd..6999e04 100644
--- a/doc/version.tex
+++ b/doc/version.tex
@@ -1,4 +1,4 @@
-\newcommand{\version}{1.16}
-\newcommand{\sha}{d173d10}
+\newcommand{\version}{1.17}
+\newcommand{\sha}{f09e3ec}
 \newcommand{\versionname}{none}
-\newcommand{\versiondate}{24-11-17}
+\newcommand{\versiondate}{30-11-17}
diff --git a/src/META b/src/META
index 84cb445..8e06331 100644
--- a/src/META
+++ b/src/META
@@ -1,6 +1,6 @@
 # OASIS_START
-# DO NOT EDIT (digest: aed6f0fef5953ed458ecf15da3ba7c01)
-version = "1.16"
+# DO NOT EDIT (digest: 631f03c8500ab788a77a0b4e1034ad5a)
+version = "1.17"
 description = "shared by Verimag/synchronous tools (lustre, lutin, rdbg)."
 requires = "unix str camlp4 num"
 archive(byte) = "lutils.cma"
diff --git a/src/gnuplotRif.ml b/src/gnuplotRif.ml
index cb3e363..46d283e 100644
--- a/src/gnuplotRif.ml
+++ b/src/gnuplotRif.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 10/10/2017 (at 00:13) by Erwan Jahier> *)
+(* Time-stamp: <modified the 24/11/2017 (at 11:32) by Erwan Jahier> *)
 (*-----------------------------------------------------------------------
 ** This file may only be copied under the terms of the GNU Library General
 ** Public License
@@ -21,17 +21,18 @@ let vars_to_hide = ref []
 let vars_to_show = ref []
 
 (********************************************************************************)
+                       
 let (readfile: string -> string) = 
   fun name -> 
     let chanin = open_in_bin name in 
     let len = 1024 in 
-    let s = String.create len in 
+    let s = Bytes.create len in 
     let buf = Buffer.create len in 
     let rec iter () = 
       try 
 	     let n = input chanin s 0 len in 
 	       if n = 0 then () else ( 
-            Buffer.add_substring buf s 0 n; 
+            Buffer.add_subbytes buf s 0 n; 
             iter () 
           )
       with 
@@ -326,7 +327,8 @@ label_pos(i)=min + i*delta*1.7+delta*0.5
     (List.fold_left 
 	    (fun (i,sep) var -> 
          if to_hide var then (
-           print_debug ("\n Skipping hidden var "^var);
+           if !verbose then 
+             print_string ("\n Skipping hidden var "^var) ;
            (i+1,sep) 
          )
          else ( 
diff --git a/src/localGenlex.ml b/src/localGenlex.ml
index 444dc40..199e8cb 100644
--- a/src/localGenlex.ml
+++ b/src/localGenlex.ml
@@ -68,7 +68,7 @@ type token =
 
 (* The string buffering machinery *)
 
-let initial_buffer = String.create 32
+let initial_buffer = Bytes.create 32
 
 let buffer = ref initial_buffer
 let bufpos = ref 0
@@ -76,16 +76,16 @@ let bufpos = ref 0
 let reset_buffer () = buffer := initial_buffer; bufpos := 0
 
 let store c =
-  if !bufpos >= String.length !buffer then
-    begin
-      let newbuffer = String.create (2 * !bufpos) in
-      String.blit !buffer 0 newbuffer 0 !bufpos; buffer := newbuffer
-    end;
-  String.set !buffer !bufpos c;
+  if !bufpos >= Bytes.length !buffer then begin
+    let newbuffer = Bytes.create (2 * !bufpos) in
+    Bytes.blit !buffer 0 newbuffer 0 !bufpos;
+    buffer := newbuffer
+  end;
+  Bytes.set !buffer !bufpos c;
   incr bufpos
 
 let get_string () =
-  let s = String.sub !buffer 0 !bufpos in buffer := initial_buffer; s
+  let s = Bytes.sub_string !buffer 0 !bufpos in buffer := initial_buffer; s
 
 (* The lexer *)
 
@@ -243,4 +243,4 @@ let make_lexer keywords =
     | Some c -> Stream.junk strm__; comment strm__
     | _ -> raise Stream.Failure
   in
-  fun input -> Stream.from (fun count -> next_token input)
+  fun input -> Stream.from (fun _count -> next_token input)
diff --git a/src/lutilsVersion.ml b/src/lutilsVersion.ml
index 98b968a..e1cbf23 100644
--- a/src/lutilsVersion.ml
+++ b/src/lutilsVersion.ml
@@ -1,2 +1,2 @@
-let str="1.16"
-let sha="d173d10"
+let str="1.17"
+let sha="f09e3ec"
diff --git a/src/mypervasives.ml b/src/mypervasives.ml
index 8e766b3..69049e4 100644
--- a/src/mypervasives.ml
+++ b/src/mypervasives.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 14/04/2017 (at 11:27) by Erwan Jahier> *)
+(* Time-stamp: <modified the 24/11/2017 (at 16:59) by Erwan Jahier> *)
 (* Should rather be names misc or utils *)
 
 
@@ -14,22 +14,22 @@ let (string_to_string_list : string -> string list) =
 let usage_out speclist errmsg =
   Printf.printf "%s" (Arg.usage_string speclist errmsg)
 
-
+(* Taken from Maxence Guesdon from the Share lib *)
 let (readfile: ?verbose:bool ->string -> string) =
   fun ?(verbose=false) file ->
 	 if verbose then (Printf.eprintf "Reading %s...\n" file; flush stderr);
     try
-      let rec (readfile_ic : in_channel -> string) =
+      let rec (readfile_ic : in_channel -> bytes) =
 	     fun ic ->
 	       let ic_l = in_channel_length ic in
-	       let str_buf = String.make ic_l ' ' in
+	       let str_buf = Bytes.make ic_l ' ' in
 	       let _ = really_input ic str_buf 0 ic_l in
 	       str_buf
       in
       let ic = (open_in file) in
       let str = readfile_ic ic  in
 	   close_in ic;
-	   str
+	   (Bytes.to_string str)
     with
 	     e ->
 	       print_string ((Printexc.to_string e) ^ ": ");
-- 
GitLab