diff options
author | Stephane Glondu <steph@glondu.net> | 2019-08-12 06:29:43 +0200 |
---|---|---|
committer | Stephane Glondu <steph@glondu.net> | 2019-08-12 06:29:43 +0200 |
commit | fd0136a84bb97bbdc214e36c53c77292eb2d3f0a (patch) | |
tree | 5b9e37de77a73e80f615d5bc404ef2e96a8ed658 | |
parent | 7b088f6093ce141f8038e6cb98c3bf82a26be2f9 (diff) |
New upstream version 1.1.0
-rw-r--r-- | .gitignore | 17 | ||||
-rw-r--r-- | META.in | 7 | ||||
-rw-r--r-- | Makefile | 177 | ||||
-rw-r--r-- | VERSION | 1 | ||||
-rw-r--r-- | bin/bdump.ml (renamed from bdump.ml) | 0 | ||||
-rw-r--r-- | bin/jbuild | 7 | ||||
-rw-r--r-- | biniou.opam | 24 | ||||
-rw-r--r-- | src/bi_dump.ml (renamed from bi_dump.ml) | 0 | ||||
-rw-r--r-- | src/bi_inbuf.ml (renamed from bi_inbuf.ml) | 16 | ||||
-rw-r--r-- | src/bi_inbuf.mli (renamed from bi_inbuf.mli) | 2 | ||||
-rw-r--r-- | src/bi_io.ml (renamed from bi_io.ml) | 35 | ||||
-rw-r--r-- | src/bi_io.mli (renamed from bi_io.mli) | 0 | ||||
-rw-r--r-- | src/bi_outbuf.ml (renamed from bi_outbuf.ml) | 35 | ||||
-rw-r--r-- | src/bi_outbuf.mli (renamed from bi_outbuf.mli) | 2 | ||||
-rw-r--r-- | src/bi_share.ml (renamed from bi_share.ml) | 0 | ||||
-rw-r--r-- | src/bi_share.mli (renamed from bi_share.mli) | 0 | ||||
-rw-r--r-- | src/bi_stream.ml (renamed from bi_stream.ml) | 4 | ||||
-rw-r--r-- | src/bi_stream.mli (renamed from bi_stream.mli) | 0 | ||||
-rw-r--r-- | src/bi_util.ml (renamed from bi_util.ml) | 20 | ||||
-rw-r--r-- | src/bi_util.mli (renamed from bi_util.mli) | 0 | ||||
-rw-r--r-- | src/bi_vint.ml (renamed from bi_vint.ml) | 2 | ||||
-rw-r--r-- | src/bi_vint.mli (renamed from bi_vint.mli) | 0 | ||||
-rw-r--r-- | src/jbuild | 8 | ||||
-rw-r--r-- | test/jbuild | 10 | ||||
-rw-r--r-- | test/test_biniou.ml (renamed from test_biniou.ml) | 0 |
25 files changed, 119 insertions, 248 deletions
@@ -1,14 +1,3 @@ -*~ -*.cm[ioxat] -*.[oa] -*.cmx[as] -*.cmti -*.annot -META -bdump -test-stream.dat -test2.bin -*.byte -*.native -*.exe -test_biniou +_build +.merlin +*.install diff --git a/META.in b/META.in deleted file mode 100644 index 4a5788d..0000000 --- a/META.in +++ /dev/null @@ -1,7 +0,0 @@ -name = "biniou" -version = "@@VERSION@@" -description = "Extensible binary serialization format" -requires = "easy-format" -archive(byte) = "biniou.cma" -archive(native) = "biniou.cmxa" -archive(native,plugin) = "biniou.cmxs" @@ -1,175 +1,12 @@ -VERSION = 1.0.13 +all: + @jbuilder build -FLAGS = -g -annot -bin-annot -PACKS = easy-format +test: + @jbuilder runtest -ifeq "$(shell ocamlfind ocamlc -config |grep os_type)" "os_type: Win32" -EXE=.exe -else -EXE= -endif +check: test -BEST = $(shell \ - if ocamlfind ocamlopt 2>/dev/null; then \ - echo .native; \ - else \ - echo .byte; \ - fi \ -) - -NATDYNLINK = $(shell \ - if [ -f `ocamlfind ocamlc -where`/dynlink.cmxa ]; then \ - echo YES; \ - else \ - echo NO; \ - fi \ -) - -ifeq "${NATDYNLINK}" "YES" -CMXS=biniou.cmxs -endif - -.PHONY: default all byte opt install doc test -default: all test_biniou$(EXE) - -ifeq "$(BEST)" ".native" -all: byte opt doc META -else -all: byte doc META -endif - -byte: biniou.cma bdump.byte -opt: biniou.cmxa $(CMXS) bdump.native - -test: test_biniou$(EXE) - ./$< - -ifndef PREFIX - PREFIX = $(shell dirname $$(dirname $$(which ocamlfind))) - export PREFIX -endif - -ifndef BINDIR - BINDIR = $(PREFIX)/bin - export BINDIR -endif - -META: META.in Makefile - sed -e 's:@@VERSION@@:$(VERSION):' META.in > META - -SOURCES = bi_util.mli bi_util.ml \ - bi_share.mli bi_share.ml \ - bi_outbuf.mli bi_outbuf.ml bi_inbuf.mli bi_inbuf.ml \ - bi_vint.mli bi_vint.ml bi_io.mli bi_io.ml \ - bi_dump.ml bi_stream.mli bi_stream.ml - -MLI = $(filter %.mli, $(SOURCES)) -ML = $(filter %.ml, $(SOURCES)) -CMI = $(MLI:.mli=.cmi) -CMT = $(MLI:.mli=.cmt) -ANNOT = $(MLI:.mli=.annot) -CMO = $(ML:.ml=.cmo) -CMX = $(ML:.ml=.cmx) -O = $(ML:.ml=.o) - -biniou.cma: $(SOURCES) Makefile - ocamlfind ocamlc -a $(FLAGS) -o biniou.cma \ - -package "$(PACKS)" $(SOURCES) - -biniou.cmxa: $(SOURCES) Makefile - ocamlfind ocamlopt -a $(FLAGS) \ - -o biniou.cmxa -package "$(PACKS)" $(SOURCES) - -biniou.cmxs: biniou.cmxa - ocamlfind ocamlopt -shared -linkall -I . -o $@ $^ - -bdump.byte: biniou.cma bdump.ml - ocamlfind ocamlc -compat-32 -o $@ $(FLAGS) \ - -package $(PACKS) -linkpkg $^ - -bdump.native: biniou.cmxa bdump.ml - ocamlfind ocamlopt -o $@ $(FLAGS) \ - -package $(PACKS) -linkpkg $^ - -test_biniou.byte: biniou.cma test_biniou.ml - ocamlfind ocamlc -compat-32 -o $@ $(FLAGS) \ - -package "$(PACKS) unix" -linkpkg $^ - -test_biniou.native: biniou.cmxa test_biniou.ml - ocamlfind ocamlopt -o $@ $(FLAGS) \ - -package "$(PACKS) unix" -linkpkg $^ - -%$(EXE): %$(BEST) - cp $< $@ - -doc: doc/index.html -doc/index.html: $(MLI) - mkdir -p doc - ocamlfind ocamldoc -d doc -html -package easy-format $(MLI) - -install: META byte - if [ -f bdump.native ]; then \ - cp bdump.native $(BINDIR)/bdump$(EXE); \ - else \ - cp bdump.byte $(BINDIR)/bdump$(EXE); \ - fi - ocamlfind install biniou META \ - $(MLI) $(CMI) $(CMT) $(ANNOT) $(CMO) biniou.cma \ - -optional $(CMX) $(O) biniou.cmxa biniou.a biniou.cmxs - -uninstall: - rm -f $(BINDIR)/bdump{.exe,} - ocamlfind remove biniou - -.PHONY: clean +.PHONY: clean all check test clean: - rm -f *.o *.a *.cm[ioxa] *.cmxa *~ *.annot META - rm -f {bdump,test_biniou}{.exe,.byte,.native,} - rm -rf doc - rm -f test.bin test_channels.bin - -SUBDIRS = -SVNURL = svn://svn.forge.ocamlcore.org/svnroot/biniou/trunk/biniou - -.PHONY: archive -archive: - @echo "Making archive for version $(VERSION)" - @if [ -z "$$WWW" ]; then \ - echo '*** Environment variable WWW is undefined ***' >&2; \ - exit 1; \ - fi - @if [ -n "$$(svn status -q)" ]; then \ - echo "*** There are uncommitted changes, aborting. ***" >&2; \ - exit 1; \ - fi - $(MAKE) && ./bdump -help > $$WWW/bdump-help.txt - mkdir -p $$WWW/biniou-doc - $(MAKE) doc && cp doc/* $$WWW/biniou-doc/ - rm -rf /tmp/biniou /tmp/biniou-$(VERSION) && \ - cd /tmp && \ - svn co "$(SVNURL)" && \ - for x in "." $(SUBDIRS); do \ - rm -rf /tmp/biniou/$$x/.svn; \ - done && \ - cd /tmp && cp -r biniou biniou-$(VERSION) && \ - tar czf biniou.tar.gz biniou && \ - tar cjf biniou.tar.bz2 biniou && \ - tar czf biniou-$(VERSION).tar.gz biniou-$(VERSION) && \ - tar cjf biniou-$(VERSION).tar.bz2 biniou-$(VERSION) - mv /tmp/biniou.tar.gz /tmp/biniou.tar.bz2 ../releases - mv /tmp/biniou-$(VERSION).tar.gz \ - /tmp/biniou-$(VERSION).tar.bz2 ../releases - cp ../releases/biniou.tar.gz $$WWW/ - cp ../releases/biniou.tar.bz2 $$WWW/ - cp ../releases/biniou-$(VERSION).tar.gz $$WWW/ - cp ../releases/biniou-$(VERSION).tar.bz2 $$WWW/ - cd ../releases && \ - svn add biniou.tar.gz biniou.tar.bz2 \ - biniou-$(VERSION).tar.gz biniou-$(VERSION).tar.bz2 && \ - svn commit -m "biniou version $(VERSION)" - cp LICENSE $$WWW/biniou-license.txt - cp Changes $$WWW/biniou-changes.txt - cp biniou-format.txt $$WWW/biniou-format.txt - echo 'let biniou_version = "$(VERSION)"' \ - > $$WWW/biniou-version.ml + jbuilder clean @@ -0,0 +1 @@ +1.1.0
\ No newline at end of file diff --git a/bin/jbuild b/bin/jbuild new file mode 100644 index 0000000..f8aa517 --- /dev/null +++ b/bin/jbuild @@ -0,0 +1,7 @@ +(jbuild_version 1) + +(executable + ((name bdump) + (public_name bdump) + (package biniou) + (libraries (biniou))))
\ No newline at end of file diff --git a/biniou.opam b/biniou.opam new file mode 100644 index 0000000..037005d --- /dev/null +++ b/biniou.opam @@ -0,0 +1,24 @@ +opam-version: "1.2" +maintainer: "martin@mjambon.com" +authors: ["Martin Jambon"] + +homepage: "https://github.com/mjambon/biniou" +bug-reports: "https://github.com/mjambon/biniou/issues" +dev-repo: "https://github.com/mjambon/biniou.git" +license: "BSD-3-Clause" + +build: [ + ["jbuilder" "build" "-p" name "-j" jobs] +] + +build-test: [ + ["jbuilder" "runtest" "-p" name] +] + +depends: [ + "conf-which" {build} + "jbuilder" {build} + "easy-format" +] + +available: [ocaml-version >= "4.02.3"]
\ No newline at end of file diff --git a/bi_dump.ml b/src/bi_dump.ml index c967260..c967260 100644 --- a/bi_dump.ml +++ b/src/bi_dump.ml diff --git a/bi_inbuf.ml b/src/bi_inbuf.ml index d30ecb0..f67c481 100644 --- a/bi_inbuf.ml +++ b/src/bi_inbuf.ml @@ -1,5 +1,5 @@ type t = { - mutable i_s : string; + mutable i_s : bytes; mutable i_pos : int; mutable i_len : int; mutable i_offs : int; @@ -35,14 +35,14 @@ let read ib n = let read_char ib = let pos = ib.i_pos in if ib.i_len - pos > 0 then ( - let c = String.unsafe_get ib.i_s pos in + let c = Bytes.unsafe_get ib.i_s pos in ib.i_pos <- pos + 1; c ) else if try_preread ib 1 > 0 then let pos = ib.i_pos in - let c = String.unsafe_get ib.i_s pos in + let c = Bytes.unsafe_get ib.i_s pos in ib.i_pos <- pos + 1; c else @@ -51,16 +51,16 @@ let read_char ib = let peek ib = let pos = ib.i_pos in if ib.i_len - pos > 0 then ( - String.unsafe_get ib.i_s pos + Bytes.unsafe_get ib.i_s pos ) else if try_preread ib 1 > 0 then - String.unsafe_get ib.i_s ib.i_pos + Bytes.unsafe_get ib.i_s ib.i_pos else raise End_of_input let from_string ?(pos = 0) ?(shrlen = 16) s = { - i_s = s; + i_s = Bytes.of_string s; i_pos = pos; i_len = String.length s; i_offs = -pos; @@ -87,7 +87,7 @@ let refill_from_channel ic ib n = let rem_len = ib.i_len - ib.i_pos in if rem_len < n then let s = ib.i_s in - String.blit s ib.i_pos s 0 rem_len; + Bytes.blit s ib.i_pos s 0 rem_len; let to_read = n - rem_len in let really_read = not_really_input ic s rem_len to_read 0 in ib.i_offs <- ib.i_offs + ib.i_pos; @@ -96,7 +96,7 @@ let refill_from_channel ic ib n = ) let from_channel ?(len = 4096) ?(shrlen = 16) ic = { - i_s = String.create len; + i_s = Bytes.create len; i_pos = 0; i_len = 0; i_offs = 0; diff --git a/bi_inbuf.mli b/src/bi_inbuf.mli index 2998412..7a9e302 100644 --- a/bi_inbuf.mli +++ b/src/bi_inbuf.mli @@ -1,7 +1,7 @@ (** Input buffer *) type t = { - mutable i_s : string; + mutable i_s : bytes; (** This is the buffer string. It can be accessed for reading but should normally only be written to or replaced only by the [i_refill] function. @@ -89,13 +89,13 @@ let write_hashtag ob h has_arg = let h = mask_31bit h in let pos = Bi_outbuf.alloc ob 4 in let s = ob.o_s in - String.unsafe_set s (pos+3) (Char.chr (h land 0xff)); + Bytes.unsafe_set s (pos+3) (Char.chr (h land 0xff)); let h = h lsr 8 in - String.unsafe_set s (pos+2) (Char.chr (h land 0xff)); + Bytes.unsafe_set s (pos+2) (Char.chr (h land 0xff)); let h = h lsr 8 in - String.unsafe_set s (pos+1) (Char.chr (h land 0xff)); + Bytes.unsafe_set s (pos+1) (Char.chr (h land 0xff)); let h = h lsr 8 in - String.unsafe_set s pos ( + Bytes.unsafe_set s pos ( Char.chr ( if has_arg then h lor 0x80 else h @@ -109,7 +109,7 @@ let string_of_hashtag h has_arg = let read_hashtag ib cont = let i = Bi_inbuf.read ib 4 in - let s = ib.i_s in + let s = Bytes.to_string ib.i_s in let x0 = Char.code s.[i] in let has_arg = x0 >= 0x80 in let x1 = (x0 land 0x7f) lsl 24 in @@ -123,7 +123,7 @@ let read_hashtag ib cont = let read_field_hashtag ib = let i = Bi_inbuf.read ib 4 in - let s = ib.i_s in + let s = Bytes.to_string ib.i_s in let x0 = Char.code (String.unsafe_get s i) in if x0 < 0x80 then Bi_util.error "Corrupted data (invalid field hashtag)"; @@ -147,7 +147,8 @@ let write_numtag ob i has_arg = let read_numtag ib cont = let i = Bi_inbuf.read ib 1 in - let x = Char.code ib.i_s.[i] in + let s = Bytes.to_string ib.i_s in + let x = Char.code s.[i] in let has_arg = x >= 0x80 in cont ib (x land 0x7f) has_arg @@ -214,16 +215,16 @@ let float_endianness = lazy ( let read_untagged_float64 ib = let i = Bi_inbuf.read ib 8 in - let s = ib.i_s in + let s = Bytes.to_string ib.i_s in let x = Obj.new_block Obj.double_tag 8 in (match Lazy.force float_endianness with `Little -> for j = 0 to 7 do - String.unsafe_set (Obj.obj x) (7-j) (String.unsafe_get s (i+j)) + Bytes.unsafe_set (Obj.obj x) (7-j) (String.unsafe_get s (i+j)) done | `Big -> for j = 0 to 7 do - String.unsafe_set (Obj.obj x) j (String.unsafe_get s (i+j)) + Bytes.unsafe_set (Obj.obj x) j (String.unsafe_get s (i+j)) done ); (Obj.obj x : float) @@ -234,11 +235,11 @@ let write_untagged_float64 ob x = (match Lazy.force float_endianness with `Little -> for j = 0 to 7 do - String.unsafe_set s (i+j) (String.unsafe_get (Obj.magic x) (7-j)) + Bytes.unsafe_set s (i+j) (String.unsafe_get (Obj.magic x) (7-j)) done | `Big -> for j = 0 to 7 do - String.unsafe_set s (i+j) (String.unsafe_get (Obj.magic x) j) + Bytes.unsafe_set s (i+j) (String.unsafe_get (Obj.magic x) j) done ) @@ -525,13 +526,13 @@ let read_untagged_int8 ib = let read_untagged_int16 ib = let i = Bi_inbuf.read ib 2 in - let s = ib.i_s in + let s = Bytes.to_string ib.i_s in ((Char.code s.[i]) lsl 8) lor (Char.code s.[i+1]) let read_untagged_int32 ib = let i = Bi_inbuf.read ib 4 in - let s = ib.i_s in + let s = Bytes.to_string ib.i_s in let x1 = Int32.of_int (((Char.code s.[i ]) lsl 8) lor (Char.code s.[i+1])) in let x2 = @@ -565,7 +566,7 @@ let read_untagged_int64 ib = let read_untagged_string ib = let len = Bi_vint.read_uvint ib in - let str = String.create len in + let str = Bytes.create len in let pos = ref 0 in let rem = ref len in while !rem > 0 do @@ -573,13 +574,13 @@ let read_untagged_string ib = if bytes_read = 0 then Bi_util.error "Corrupted data (string)" else ( - String.blit ib.i_s ib.i_pos str !pos bytes_read; + Bytes.blit ib.i_s ib.i_pos str !pos bytes_read; ib.i_pos <- ib.i_pos + bytes_read; pos := !pos + bytes_read; rem := !rem - bytes_read ) done; - str + Bytes.to_string str let read_untagged_uvint = Bi_vint.read_uvint let read_untagged_svint = Bi_vint.read_svint diff --git a/bi_io.mli b/src/bi_io.mli index 979c9dc..979c9dc 100644 --- a/bi_io.mli +++ b/src/bi_io.mli diff --git a/bi_outbuf.ml b/src/bi_outbuf.ml index d49f80c..a10b949 100644 --- a/bi_outbuf.ml +++ b/src/bi_outbuf.ml @@ -1,5 +1,5 @@ type t = { - mutable o_s : string; + mutable o_s : bytes; mutable o_max_len : int; mutable o_len : int; mutable o_offs : int; @@ -21,23 +21,24 @@ let really_extend b n = else Sys.max_string_length in - let s = String.create slen in - String.blit b.o_s 0 s 0 b.o_len; + let s = Bytes.create slen in + Bytes.blit b.o_s 0 s 0 b.o_len; b.o_s <- s; b.o_max_len <- slen let flush_to_output abstract_output b n = - abstract_output b.o_s 0 b.o_len; + abstract_output (Bytes.to_string b.o_s) 0 b.o_len; b.o_offs <- b.o_offs + b.o_len; b.o_len <- 0; if n > b.o_max_len then really_extend b n -let flush_to_channel oc = flush_to_output (output oc) +let flush_to_channel oc = + flush_to_output (fun s start len -> output_string oc (String.sub s start len)) let create ?(make_room = really_extend) ?(shrlen = 16) n = { - o_s = String.create n; + o_s = Bytes.create n; o_max_len = n; o_len = 0; o_offs = 0; @@ -83,26 +84,26 @@ let add_string b s = let add_char b c = let pos = alloc b 1 in - b.o_s.[pos] <- c + Bytes.set b.o_s pos c let unsafe_add_char b c = let len = b.o_len in - b.o_s.[len] <- c; + Bytes.set b.o_s len c; b.o_len <- len + 1 let add_char2 b c1 c2 = let pos = alloc b 2 in let s = b.o_s in - String.unsafe_set s pos c1; - String.unsafe_set s (pos+1) c2 + Bytes.unsafe_set s pos c1; + Bytes.unsafe_set s (pos+1) c2 let add_char4 b c1 c2 c3 c4 = let pos = alloc b 4 in let s = b.o_s in - String.unsafe_set s pos c1; - String.unsafe_set s (pos+1) c2; - String.unsafe_set s (pos+2) c3; - String.unsafe_set s (pos+3) c4 + Bytes.unsafe_set s pos c1; + Bytes.unsafe_set s (pos+1) c2; + Bytes.unsafe_set s (pos+2) c3; + Bytes.unsafe_set s (pos+3) c4 @@ -112,10 +113,10 @@ let clear b = Bi_share.Wr.clear b.o_shared let reset b = - if String.length b.o_s <> b.o_init_len then - b.o_s <- String.create b.o_init_len; + if Bytes.length b.o_s <> b.o_init_len then + b.o_s <- Bytes.create b.o_init_len; b.o_offs <- 0; b.o_len <- 0; b.o_shared <- Bi_share.Wr.create b.o_shared_init_len -let contents b = String.sub b.o_s 0 b.o_len +let contents b = Bytes.to_string (Bytes.sub b.o_s 0 b.o_len) diff --git a/bi_outbuf.mli b/src/bi_outbuf.mli index fb1482b..6a93a21 100644 --- a/bi_outbuf.mli +++ b/src/bi_outbuf.mli @@ -1,7 +1,7 @@ (** Output buffer *) type t = { - mutable o_s : string; + mutable o_s : bytes; (** Buffer string *) mutable o_max_len : int; diff --git a/bi_share.ml b/src/bi_share.ml index b864ebb..b864ebb 100644 --- a/bi_share.ml +++ b/src/bi_share.ml diff --git a/bi_share.mli b/src/bi_share.mli index a27d3af..a27d3af 100644 --- a/bi_share.mli +++ b/src/bi_share.mli diff --git a/bi_stream.ml b/src/bi_stream.ml index 88f8d7b..775c57a 100644 --- a/bi_stream.ml +++ b/src/bi_stream.ml @@ -53,9 +53,9 @@ let rec read_chunk of_string ic = error (sprintf "Corrupted stream: excessive chunk length (%i bytes)" len); - let s = String.create len in + let s = Bytes.create len in really_input ic s 0 len; - Some (of_string s) + Some (of_string (Bytes.to_string s)) | '\000' -> None diff --git a/bi_stream.mli b/src/bi_stream.mli index 6233749..6233749 100644 --- a/bi_stream.mli +++ b/src/bi_stream.mli diff --git a/bi_util.ml b/src/bi_util.ml index 5b2e0da..9fb0583 100644 --- a/bi_util.ml +++ b/src/bi_util.ml @@ -8,18 +8,18 @@ let error s = raise (Error s) *) let string8_of_int x = - let s = String.create 8 in + let s = Bytes.create 8 in for i = 0 to 7 do - s.[7-i] <- Char.chr (0xff land (x lsr (8 * i))) + Bytes.set s (7-i) (Char.chr (0xff land (x lsr (8 * i)))) done; - s + Bytes.to_string s let string4_of_int x = - let s = String.create 4 in + let s = Bytes.create 4 in for i = 0 to 3 do - s.[3-i] <- Char.chr (0xff land (x lsr (8 * i))) + Bytes.set s (3-i) (Char.chr (0xff land (x lsr (8 * i)))) done; - s + Bytes.to_string s let print_bits ?(pos = 0) ?len s = let slen = String.length s in @@ -33,16 +33,16 @@ let print_bits ?(pos = 0) ?len s = else len in - let r = String.create (len * 9) in + let r = Bytes.create (len * 9) in for i = 0 to len - 1 do let k = i * 9 in let x = Char.code s.[pos+i] in for j = 0 to 7 do - r.[k+j] <- if (x lsr (7 - j)) land 1 = 0 then '0' else '1' + Bytes.set r (k+j) (if (x lsr (7 - j)) land 1 = 0 then '0' else '1') done; - r.[k+8] <- if (i + 1) mod 8 = 0 then '\n' else ' ' + Bytes.set r (k+8) (if (i + 1) mod 8 = 0 then '\n' else ' ') done; - r + Bytes.to_string r (* int size in bits *) let int_size = diff --git a/bi_util.mli b/src/bi_util.mli index 34d99d3..34d99d3 100644 --- a/bi_util.mli +++ b/src/bi_util.mli diff --git a/bi_vint.ml b/src/bi_vint.ml index 98be537..273532f 100644 --- a/bi_vint.ml +++ b/src/bi_vint.ml @@ -75,7 +75,7 @@ let svint_of_int ?buf i = let read_uvint ib = let avail = Bi_inbuf.try_preread ib max_vint_bytes in - let s = ib.i_s in + let s = Bytes.to_string ib.i_s in let pos = ib.i_pos in let x = ref 0 in (try diff --git a/bi_vint.mli b/src/bi_vint.mli index 5a4e247..5a4e247 100644 --- a/bi_vint.mli +++ b/src/bi_vint.mli diff --git a/src/jbuild b/src/jbuild new file mode 100644 index 0000000..b990f1c --- /dev/null +++ b/src/jbuild @@ -0,0 +1,8 @@ +(jbuild_version 1) + +(library + ((name biniou) + (public_name biniou) + (synopsis "Extensible binary serialization format") + (wrapped false) + (libraries (easy-format bytes)))) diff --git a/test/jbuild b/test/jbuild new file mode 100644 index 0000000..bb7db79 --- /dev/null +++ b/test/jbuild @@ -0,0 +1,10 @@ +(jbuild_version 1) + +(executable + ((name test_biniou) + (libraries (biniou unix)))) + +(alias + ((name runtest) + (deps (test_biniou.exe)) + (action (run ${<}))))
\ No newline at end of file diff --git a/test_biniou.ml b/test/test_biniou.ml index f75b46d..f75b46d 100644 --- a/test_biniou.ml +++ b/test/test_biniou.ml |