Skip to content

Commit

Permalink
release 1.81
Browse files Browse the repository at this point in the history
  • Loading branch information
backtracking committed Oct 17, 2011
1 parent 6728fcb commit b84c600
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

version 1.81, October 17, 2011
------------------------------
o module Gmap now has a signature for edges (E_SRC) compatible with
Sig, so that it is easier to apply functor Gmap.Edge
(contributed by Markus W. Weissmann <[email protected]>)
o new module Fixpoint to compute fixpoints using the work-list
algorithm, e.g. for data flow analysis
(contributed by Markus W. Weissmann <[email protected]>)
Expand Down
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ graph.cmo: $(CMI) $(CMO)
graph.cmx: $(CMI) $(CMX)
$(OCAMLOPT) $(INCLUDES) -pack -o $@ $^

VERSION=1.8
VERSION=1.81

src/version.ml: Makefile
rm -f $@
Expand Down
34 changes: 27 additions & 7 deletions src/gmap.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ module type V_DST = sig
end

module Vertex(G_Src : V_SRC)(G_Dst : V_DST ) = struct

module H = Hashtbl.Make(G_Src.V)
let vertices = H.create 97

let convert_vertex f x =
try
try
H.find vertices x
with Not_found ->
let x' = f x in
Expand All @@ -48,7 +48,7 @@ module Vertex(G_Src : V_SRC)(G_Dst : V_DST ) = struct
let map f g =
H.clear vertices;
G_Src.fold_vertex
(fun x g -> G_Dst.add_vertex g (convert_vertex f x))
(fun x g -> G_Dst.add_vertex g (convert_vertex f x))
g (G_Dst.empty ())

end
Expand All @@ -57,7 +57,7 @@ end

module type E_SRC = sig
type t
module E : Sig.HASHABLE
module E : Sig.ORDERED_TYPE
val fold_edges_e : (E.t -> 'a -> 'a) -> t -> 'a -> 'a
end

Expand All @@ -68,7 +68,27 @@ module type E_DST = sig
val add_edge_e : t -> edge -> t
end

module Edge(G_Src: E_SRC)(G_Dst: E_DST) =
module Edge(G_Src: E_SRC)(G_Dst: E_DST) = struct
module M = Map.Make(G_Src.E)
let edges = ref M.empty

let convert_edge f x =
try
M.find x !edges
with Not_found ->
let x' = f x in
edges := M.add x x' !edges;
x'

let map f g =
edges := M.empty;
G_Src.fold_edges_e
(fun x g -> G_Dst.add_edge_e g (convert_edge f x))
g (G_Dst.empty ())
end

(*
Vertex
(struct include G_Src module V = E let fold_vertex = fold_edges_e end)
(struct include G_Dst type vertex = edge let add_vertex = add_edge_e end)
(struct include G_Src module V = E let fold_vertex = fold_edges_e end)
(struct include G_Dst type vertex = edge let add_vertex = add_edge_e end)
*)
2 changes: 1 addition & 1 deletion src/gmap.mli
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ end
(** Signature for the source graph. *)
module type E_SRC = sig
type t
module E : Sig.HASHABLE
module E : Sig.ORDERED_TYPE
val fold_edges_e : (E.t -> 'a -> 'a) -> t -> 'a -> 'a
end

Expand Down

0 comments on commit b84c600

Please sign in to comment.