Commit 82689f8e authored by erwan's avatar erwan
Browse files

Use Bytes instead of String so that it works with ocaml 4.06.0

parent ce64ac1a
OASISFormat: 0.4
Name: Lutin
Version: 2.28
Version: 2.29
Authors: Erwan Jahier
Maintainers: erwan.jahier@imag.fr
License: PROP
......@@ -32,7 +32,7 @@ Library lutin
XMETADescription: Provides an API to call Lutin from ocaml (and rdbg)
Path: lutin/src
Modules: LutinRun
BuildDepends: camlp4,lutin-utils,ezdl,gbddml,polka,camlidl
BuildDepends: camlp4,lutin-utils,ezdl,gbddml,polka,camlidl,lutils
Install:true
CompiledObject: native
XMETAEnable: true
......
# OASIS_START
# DO NOT EDIT (digest: 8f15becd0ae55cf03260d080626a66b2)
# DO NOT EDIT (digest: 913199b6a516197e43dd95dd089af5f0)
# 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
......@@ -70,6 +70,7 @@ true: annot, bin_annot
# Library lutin
"lutin/src/lutin.cmxs": use_lutin
"lutin/src/lutin.cmxa": oasis_library_lutin_dlllib
<lutin/src/*.ml{,i,y}>: package(lutils)
# Executable lurettetop_exe
<ltop/src/*.ml{,i,y}>: oasis_executable_lurettetop_exe_ccopt
"ltop/src/lurettetop.native": oasis_executable_lurettetop_exe_cclib
......@@ -80,6 +81,7 @@ true: annot, bin_annot
"ltop/src/lurettetop.native": package(dynlink)
"ltop/src/lurettetop.native": package(gmp)
"ltop/src/lurettetop.native": package(lustre-v6)
"ltop/src/lurettetop.native": package(lutils)
"ltop/src/lurettetop.native": package(num)
"ltop/src/lurettetop.native": package(str)
"ltop/src/lurettetop.native": package(unix)
......
......@@ -29,7 +29,7 @@ test.rif:$(EXPDIR) rabbit.cmxs
rm -f test.rif0 .lurette_rc
$(LURETTETOP) -go --output test.rif0 \
-rp "sut:ocaml:rabbit.cmxs:" \
-rp 'env:lutin:rabbit.lut:-main:rabbit:-seed:34:-L:libm.so:-loc' && \
-rp 'env:lutin:rabbit.lut:-main:rabbit:-seed:34:-L:libm.so.6:-loc' && \
grep -v "lurette chronogram" test.rif0 | \
grep -v "lurette Version" | \
grep -v "#seed" | \
......
......@@ -13,9 +13,9 @@ ifeq ($(HOSTTYPE),mac)
endif
# XXX pack all those modules into one
CMXA_LIB = unix.cmxa nums.cmxa str.cmxa \
CMXA_LIB = dynlink.cmxa unix.cmxa nums.cmxa str.cmxa \
ezdl.cmxa gbddml.cmxa polka.cmxa \
rdbg-plugin.cmxa lutils.cmxa lutin-utils.cmxa lutin.cmxa
lutils.cmxa rdbg-plugin.cmxa lutin-utils.cmxa lutin.cmxa
CLIB= `ocamlfind query -r rdbg-plugin -i-format` \
`ocamlfind query -r lutin -i-format` \
......
......@@ -40,16 +40,18 @@ let bufpos = ref 0
let reset_buffer () = buffer := initial_buffer; bufpos := 0
let store c =
if !bufpos >= String.length !buffer then
if !bufpos >= Bytes.length !buffer then
begin
let newbuffer = String.create (2 * !bufpos) in
String.blit !buffer 0 newbuffer 0 !bufpos; buffer := newbuffer
let newbuffer = Bytes.create (2 * !bufpos) in
Bytes.blit !buffer 0 newbuffer 0 !bufpos; buffer := newbuffer
end;
String.set !buffer !bufpos c;
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 !buffer 0 !bufpos in
buffer := initial_buffer;
Bytes.to_string s
(* The lexer *)
......
......@@ -532,7 +532,7 @@ let rec (to_src_info: CoIdent.src_stack -> Event.src_info_atom) =
| (lxm,_,Some ve)::tl ->
let line_b, line_e, col_b, col_e, char_b, char_e = cstr_src_info_of_val_exp ve in
let file = lxm.Lexeme.file in
let filecontent = Util.readfile file in
let filecontent = Mypervasives.readfile file in
{
Event.str =
(try String.sub filecontent char_b (char_e - char_b + 1)
......
......@@ -141,74 +141,13 @@ let _ = assert (power_2 0 = 1)
let _ = assert (power_2 1 = 2)
let _ = assert (power_2 29 = int_of_float (2. ** 29.))
(*************************************************************************)
(**
[readfile file] outputs a string containing the whole content of [file].
*)
let (readfile_hide: string -> string) =
fun file ->
try
let rec (readfile_ic : in_channel -> string) =
fun ic ->
let ic_l = in_channel_length ic in
let str_buf = String.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
with
e ->
print_string ((Printexc.to_string e) ^ ": ");
output_string stdout (
"Error when reading " ^ file ^ ".\n");
flush stdout;
raise Not_found
(* A variant by Maxence Guesdon from the Share lib *)
let (readfile: string -> string) =
fun name ->
let chanin = open_in_bin name in
let len = 1024 in
let s = String.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;
iter ()
)
with
End_of_file -> ()
in
let str =
iter ();
close_in chanin;
Buffer.contents buf
in
str
let (readfile_rm_crtl_m: string -> string) =
fun file ->
let remove_control_m str =
Str.global_replace (Str.regexp "\013") "" str
in
remove_control_m (readfile file)
remove_control_m (Mypervasives.readfile file)
(*************************************************************************)
......
let str="2.28"
let sha="dbb5c44"
let str="2.29"
let sha="ce64ac1"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment