X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2FnodeSet.ml;h=fc0bb0e776093d85a3167939aa90fcebb205fbbd;hb=107df590ff69de765445e22caffd416ef13288d3;hp=c2265b2d7430f1ee5b4b4cbcc6971e04acdbee10;hpb=5c37235963ddd5fbfcb6ab86c1f8ccb78d48f0f1;p=SXSI%2Fxpathcomp.git
diff --git a/src/nodeSet.ml b/src/nodeSet.ml
index c2265b2..fc0bb0e 100644
--- a/src/nodeSet.ml
+++ b/src/nodeSet.ml
@@ -24,7 +24,7 @@ module type S =
val iter : ( elt -> unit) -> t -> unit
val fold : ( elt -> 'a -> 'a) -> t -> 'a -> 'a
val length : t -> int
- val serialize : string -> Tree.t -> t -> unit
+ val serialize : string -> bool -> Tree.t -> t -> unit
end
@@ -52,11 +52,12 @@ module Count : S with type t = int =
let fold _ _ _ = failwith "fold not implemented"
let map _ _ = failwith "map not implemented"
let length x = x
- let serialize f _ x =
+ let serialize f b _ x =
let o = open_out f in
- output_string o "\n";
+ if not b then output_string o "\n";
output_string o (string_of_int x);
- output_string o "\n\n";
+ output_char o '\n';
+ if not b then output_string o "\n";
close_out o
end
@@ -191,19 +192,19 @@ module Mat : S with type t = Tree.node mat =
let length l = l.length
- let serialize name v l =
+ let serialize name b v l =
let fd, finish =
if name = "-" then Unix.stdout, ignore
else
Unix.openfile name [ Unix.O_WRONLY; Unix.O_TRUNC; Unix.O_CREAT ] 0o666,
Unix.close
in
- ignore (Unix.write fd "\n" 0 13);
+ if not b then ignore (Unix.write fd "\n" 0 13);
if l.length > 0 then begin
iter (fun node -> Tree.print_xml v node fd) l;
Tree.flush v fd;
end;
- ignore (Unix.write fd "\n" 0 14);
+ if not b then ignore (Unix.write fd "\n" 0 14);
finish fd
end