-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,250 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,71 @@ | ||
./coinst_common.cmi: repository.cmi quotient.cmi api.cmi | ||
./conflicts.cmo: repository.cmi quotient.cmi | ||
./conflicts.cmx: repository.cmx quotient.cmx | ||
./upgrade.cmo: util.cmi upgrade_common.cmi quotient.cmi graph.cmi file.cmi \ | ||
deb_lib.cmi | ||
./upgrade.cmx: util.cmx upgrade_common.cmx quotient.cmx graph.cmx file.cmx \ | ||
deb_lib.cmx | ||
./quotient.cmi: repository.cmi | ||
./common.cmo: util.cmi ./common.cmi | ||
./common.cmx: util.cmx ./common.cmi | ||
./upgrade_common.cmi: repository.cmi deb_lib.cmi | ||
./cudf_lib.cmi: api.cmi | ||
./rpm_lib.cmo: util.cmi solver.cmi common.cmi ./rpm_lib.cmi | ||
./rpm_lib.cmx: util.cmx solver.cmx common.cmx ./rpm_lib.cmi | ||
./task.cmo: | ||
./task.cmx: | ||
./bytearray.cmi: | ||
./file.cmo: ./file.cmi | ||
./file.cmx: ./file.cmi | ||
./debug.cmo: ./debug.cmi | ||
./debug.cmx: ./debug.cmi | ||
./comp.cmo: deb_lib.cmi | ||
./comp.cmx: deb_lib.cmx | ||
./upgrade_common.cmi: repository.cmi deb_lib.cmi | ||
./solver.cmi: | ||
./dgraph.cmo: ./dgraph.cmi | ||
./dgraph.cmx: ./dgraph.cmi | ||
./file.cmi: | ||
./util.cmo: ./util.cmi | ||
./util.cmx: ./util.cmi | ||
./debug.cmi: | ||
./graph.cmo: repository.cmi quotient.cmi conflicts.cmo ./graph.cmi | ||
./graph.cmx: repository.cmx quotient.cmx conflicts.cmx ./graph.cmi | ||
./api.cmi: solver.cmi | ||
./quotient.cmi: repository.cmi | ||
./rpm_lib.cmi: api.cmi | ||
./util.cmi: | ||
./coinst_common.cmi: repository.cmi quotient.cmi api.cmi | ||
./main.cmo: util.cmi rpm_lib.cmi repository.cmi quotient.cmi graph.cmi \ | ||
file.cmi deb_lib.cmi api.cmi | ||
./main.cmx: util.cmx rpm_lib.cmx repository.cmx quotient.cmx graph.cmx \ | ||
file.cmx deb_lib.cmx api.cmx | ||
./upgrade.cmo: util.cmi upgrade_common.cmi quotient.cmi graph.cmi file.cmi \ | ||
deb_lib.cmi | ||
./upgrade.cmx: util.cmx upgrade_common.cmx quotient.cmx graph.cmx file.cmx \ | ||
deb_lib.cmx | ||
./coinst_common.cmo: repository.cmi quotient.cmi api.cmi ./coinst_common.cmi | ||
./coinst_common.cmx: repository.cmx quotient.cmx api.cmx ./coinst_common.cmi | ||
./quotient.cmo: util.cmi repository.cmi ./quotient.cmi | ||
./quotient.cmx: util.cmx repository.cmx ./quotient.cmi | ||
./api.cmo: solver.cmi ./api.cmi | ||
./api.cmx: solver.cmx ./api.cmi | ||
./upgrade_common.cmo: util.cmi graph.cmi deb_lib.cmi coinst_common.cmi \ | ||
./upgrade_common.cmi | ||
./upgrade_common.cmx: util.cmx graph.cmx deb_lib.cmx coinst_common.cmx \ | ||
./upgrade_common.cmi | ||
./debug.cmo: ./debug.cmi | ||
./debug.cmx: ./debug.cmi | ||
./repository.cmi: util.cmi api.cmi | ||
./deb_lib.cmo: util.cmi solver.cmi common.cmi ./deb_lib.cmi | ||
./deb_lib.cmx: util.cmx solver.cmx common.cmx ./deb_lib.cmi | ||
./common.cmi: | ||
./repository.cmo: util.cmi api.cmi ./repository.cmi | ||
./repository.cmx: util.cmx api.cmx ./repository.cmi | ||
./rpm_lib.cmi: api.cmi | ||
./util.cmi: | ||
./dgraph.cmi: | ||
./solver.cmo: ./solver.cmi | ||
./solver.cmx: ./solver.cmi | ||
./rpm_lib.cmo: util.cmi solver.cmi common.cmi ./rpm_lib.cmi | ||
./rpm_lib.cmx: util.cmx solver.cmx common.cmx ./rpm_lib.cmi | ||
./quotient.cmo: util.cmi repository.cmi ./quotient.cmi | ||
./quotient.cmx: util.cmx repository.cmx ./quotient.cmi | ||
./debug.cmi: | ||
./bytearray.cmo: ./bytearray.cmi | ||
./bytearray.cmx: ./bytearray.cmi | ||
./parallel.cmo: task.cmi file.cmi deb_lib.cmi | ||
./parallel.cmx: task.cmx file.cmx deb_lib.cmx | ||
./file.cmi: | ||
./api.cmo: solver.cmi ./api.cmi | ||
./api.cmx: solver.cmx ./api.cmi | ||
./conflicts.cmo: repository.cmi quotient.cmi | ||
./conflicts.cmx: repository.cmx quotient.cmx | ||
./coinst_common.cmo: repository.cmi quotient.cmi debug.cmi api.cmi \ | ||
./coinst_common.cmi | ||
./coinst_common.cmx: repository.cmx quotient.cmx debug.cmx api.cmx \ | ||
./coinst_common.cmi | ||
./graph.cmi: repository.cmi quotient.cmi | ||
./cudf_lib.cmo: solver.cmi common.cmi ./cudf_lib.cmi | ||
./cudf_lib.cmx: solver.cmx common.cmx ./cudf_lib.cmi | ||
./common.cmo: util.cmi ./common.cmi | ||
./common.cmx: util.cmx ./common.cmi | ||
./transition.cmo: util.cmi upgrade_common.cmi repository.cmi file.cmi \ | ||
debug.cmi deb_lib.cmi | ||
./transition.cmx: util.cmx upgrade_common.cmx repository.cmx file.cmx \ | ||
debug.cmx deb_lib.cmx | ||
./task.cmi: | ||
./api.cmi: solver.cmi | ||
./upgrade_common.cmo: util.cmi graph.cmi debug.cmi deb_lib.cmi \ | ||
coinst_common.cmi ./upgrade_common.cmi | ||
./upgrade_common.cmx: util.cmx graph.cmx debug.cmx deb_lib.cmx \ | ||
coinst_common.cmx ./upgrade_common.cmi | ||
./task.cmo: util.cmi debug.cmi bytearray.cmi ./task.cmi | ||
./task.cmx: util.cmx debug.cmx bytearray.cmx ./task.cmi | ||
./deb_lib.cmi: util.cmi solver.cmi api.cmi | ||
./graph.cmi: repository.cmi quotient.cmi | ||
./repository.cmi: util.cmi api.cmi | ||
./dgraph.cmi: | ||
./repository.cmo: util.cmi api.cmi ./repository.cmi | ||
./repository.cmx: util.cmx api.cmx ./repository.cmi | ||
./dgraph.cmo: ./dgraph.cmi | ||
./dgraph.cmx: ./dgraph.cmi | ||
./util.cmo: ./util.cmi | ||
./util.cmx: ./util.cmi | ||
./common.cmi: | ||
./graph.cmo: repository.cmi quotient.cmi conflicts.cmo ./graph.cmi | ||
./graph.cmx: repository.cmx quotient.cmx conflicts.cmx ./graph.cmi | ||
./solver.cmi: | ||
./transition.cmo: util.cmi upgrade_common.cmi task.cmi repository.cmi \ | ||
file.cmi debug.cmi deb_lib.cmi | ||
./transition.cmx: util.cmx upgrade_common.cmx task.cmx repository.cmx \ | ||
file.cmx debug.cmx deb_lib.cmx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
(* Unison file synchronizer: src/bytearray.ml *) | ||
(* Copyright 1999-2010, Benjamin C. Pierce | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*) | ||
|
||
open Bigarray | ||
|
||
type t = (char, int8_unsigned_elt, c_layout) Array1.t | ||
|
||
let length = Bigarray.Array1.dim | ||
|
||
let create l = Bigarray.Array1.create Bigarray.char Bigarray.c_layout l | ||
|
||
(* | ||
let unsafe_blit_from_string s i a j l = | ||
for k = 0 to l - 1 do | ||
a.{j + k} <- s.[i + k] | ||
done | ||
let unsafe_blit_to_string a i s j l = | ||
for k = 0 to l - 1 do | ||
s.[j + k] <- a.{i + k} | ||
done | ||
*) | ||
|
||
external unsafe_blit_from_string : string -> int -> t -> int -> int -> unit | ||
= "ml_blit_string_to_bigarray" "noalloc" | ||
|
||
external unsafe_blit_to_string : t -> int -> string -> int -> int -> unit | ||
= "ml_blit_bigarray_to_string" "noalloc" | ||
|
||
let to_string a = | ||
let l = length a in | ||
if l > Sys.max_string_length then invalid_arg "Bytearray.to_string" else | ||
let s = String.create l in | ||
unsafe_blit_to_string a 0 s 0 l; | ||
s | ||
|
||
let of_string s = | ||
let l = String.length s in | ||
let a = create l in | ||
unsafe_blit_from_string s 0 a 0 l; | ||
a | ||
|
||
let sub a ofs len = | ||
if | ||
ofs < 0 || len < 0 || ofs > length a - len || len > Sys.max_string_length | ||
then | ||
invalid_arg "Bytearray.sub" | ||
else begin | ||
let s = String.create len in | ||
unsafe_blit_to_string a ofs s 0 len; | ||
s | ||
end | ||
|
||
let rec prefix_rec a i a' i' l = | ||
l = 0 || | ||
(a.{i} = a'.{i'} && prefix_rec a (i + 1) a' (i' + 1) (l - 1)) | ||
|
||
let prefix a a' i = | ||
let l = length a in | ||
let l' = length a' in | ||
i <= l' - l && | ||
prefix_rec a 0 a' i l | ||
|
||
let blit_from_string s i a j l = | ||
if l < 0 || i < 0 || i > String.length s - l | ||
|| j < 0 || j > length a - l | ||
then invalid_arg "Bytearray.blit_from_string" | ||
else unsafe_blit_from_string s i a j l | ||
|
||
let blit_to_string a i s j l = | ||
if l < 0 || i < 0 || i > length a - l | ||
|| j < 0 || j > String.length s - l | ||
then invalid_arg "Bytearray.blit_to_string" | ||
else unsafe_blit_to_string a i s j l | ||
|
||
external marshal : 'a -> Marshal.extern_flags list -> t | ||
= "ml_marshal_to_bigarray" | ||
|
||
external marshal_to_buffer : t -> int -> 'a -> Marshal.extern_flags list -> int | ||
= "ml_marshal_to_bigarray_buffer" | ||
|
||
external unmarshal : t -> int -> 'a | ||
= "ml_unmarshal_from_bigarray" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(* Unison file synchronizer: src/bytearray.mli *) | ||
(* Copyright 1999-2010, Benjamin C. Pierce (see COPYING for details) *) | ||
|
||
type t = | ||
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t | ||
|
||
val create : int -> t | ||
|
||
val length : t -> int | ||
|
||
val to_string : t -> string | ||
|
||
val of_string : string -> t | ||
|
||
val sub : t -> int -> int -> string | ||
|
||
val blit_from_string : string -> int -> t -> int -> int -> unit | ||
|
||
val blit_to_string : t -> int -> string -> int -> int -> unit | ||
|
||
val prefix : t -> t -> int -> bool | ||
|
||
val marshal : 'a -> Marshal.extern_flags list -> t | ||
|
||
val unmarshal : t -> int -> 'a | ||
|
||
val marshal_to_buffer : t -> int -> 'a -> Marshal.extern_flags list -> int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* Unison file synchronizer: src/bytearray_stubs.c */ | ||
/* Copyright 1999-2010 (see COPYING for details) */ | ||
|
||
#include <string.h> | ||
|
||
#include "caml/intext.h" | ||
#include "caml/bigarray.h" | ||
|
||
#define Array_data(a, i) (((char *) a->data) + Long_val(i)) | ||
|
||
CAMLprim value ml_marshal_to_bigarray(value v, value flags) | ||
{ | ||
char *buf; | ||
long len; | ||
output_value_to_malloc(v, flags, &buf, &len); | ||
return alloc_bigarray(BIGARRAY_UINT8 | BIGARRAY_C_LAYOUT | BIGARRAY_MANAGED, | ||
1, buf, &len); | ||
} | ||
|
||
CAMLprim value ml_marshal_to_bigarray_buffer(value b, value ofs, | ||
value v, value flags) | ||
{ | ||
struct caml_bigarray *b_arr = Bigarray_val(b); | ||
return Val_long(caml_output_value_to_block(v, flags, Array_data (b_arr, ofs), | ||
b_arr->dim[0] - Long_val(ofs))); | ||
} | ||
|
||
|
||
CAMLprim value ml_unmarshal_from_bigarray(value b, value ofs) | ||
{ | ||
struct caml_bigarray *b_arr = Bigarray_val(b); | ||
return input_value_from_block (Array_data (b_arr, ofs), | ||
b_arr->dim[0] - Long_val(ofs)); | ||
} | ||
|
||
CAMLprim value ml_blit_string_to_bigarray | ||
(value s, value i, value a, value j, value l) | ||
{ | ||
char *src = String_val(s) + Int_val(i); | ||
char *dest = Array_data(Bigarray_val(a), j); | ||
memcpy(dest, src, Long_val(l)); | ||
return Val_unit; | ||
} | ||
|
||
CAMLprim value ml_blit_bigarray_to_string | ||
(value a, value i, value s, value j, value l) | ||
{ | ||
char *src = Array_data(Bigarray_val(a), i); | ||
char *dest = String_val(s) + Long_val(j); | ||
memcpy(dest, src, Long_val(l)); | ||
return Val_unit; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.