Commit 3be1f874 authored by bguillaum's avatar bguillaum

handle word order in PST through succ/prec field of node definition rather...

handle word order in PST through succ/prec field of node definition rather than in special edges __SUCC__/__PRED__

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@9094 7838e531-6607-4d57-9587-6c381814729c
parent 82f53a1b
......@@ -50,8 +50,6 @@ module G_edge = struct
let make ?loc ?domain string = Label.from_string ?loc ?domain string
let sub = make "__SUB__"
let succ = make "__SUCC__"
let prec = make "__PREC__"
let build ?domain (ast_edge, loc) =
match ast_edge.Ast.edge_label_cst with
......
......@@ -38,8 +38,6 @@ module G_edge: sig
val make: ?loc:Loc.t -> ?domain:Domain.t -> string -> t
val sub: t
val succ: t
val prec: t
val build: ?domain:Domain.t -> Ast.edge -> t
......
......@@ -421,13 +421,16 @@ module G_graph = struct
| [] | [_] -> map
| n1 :: n2 :: tail ->
let new_map = prec_loop map (n2 :: tail) in
let with_prec = map_add_edge new_map n1 G_edge.prec n2 in
let with_both = map_add_edge with_prec n2 G_edge.succ n1 in
with_both in
let map_with_prec = prec_loop map !leaf_list in
printf "n1=%s n2=%s\n%!" (Gid.to_string n1) (Gid.to_string n2);
{meta=[]; map=map_with_prec; fusion = []; highest_index = !cpt}
let node1 = Gid_map.find n1 new_map
and node2 = Gid_map.find n2 new_map in
new_map
|> (Gid_map.add n1 (G_node.set_succ n2 node1))
|> (Gid_map.add n2 (G_node.set_prec n1 node2)) in
{meta=[]; map=prec_loop map (List.rev !leaf_list); fusion = []; highest_index = !cpt}
(* -------------------------------------------------------------------------------- *)
let del_edge ?domain ?edge_ident loc graph id_src label id_tar =
......@@ -811,18 +814,24 @@ module G_graph = struct
Massoc_gid.iter
(fun tar g_edge ->
let deco = List.mem (id,g_edge,tar) deco.G_deco.edges in
match !Global.debug with
| true when g_edge = G_edge.succ ->
if g_edge = G_edge.sub
then bprintf buff " N_%s -> N_%s [dir=none];\n" (Gid.to_string id) (Gid.to_string tar)
else bprintf buff " N_%s -> N_%s%s;\n" (Gid.to_string id) (Gid.to_string tar) (G_edge.to_dot ?domain ~deco g_edge)
) (G_node.get_next node)
) graph.map;
Gid_map.iter
(fun id node ->
begin
match G_node.get_succ node with
| None -> ()
| Some s when !Global.debug ->
bprintf buff " N_%s -> N_%s [label=\"SUCC\", style=dotted, fontcolor=lightblue, color=lightblue]; {rank=same; N_%s; N_%s };\n"
(Gid.to_string id) (Gid.to_string tar) (Gid.to_string id) (Gid.to_string tar)
| false when g_edge = G_edge.succ ->
(Gid.to_string id) (Gid.to_string s) (Gid.to_string id) (Gid.to_string s)
| Some s ->
bprintf buff " N_%s -> N_%s [style=invis]; {rank=same; N_%s; N_%s };\n"
(Gid.to_string id) (Gid.to_string tar) (Gid.to_string id) (Gid.to_string tar)
| _ when g_edge = G_edge.prec -> ()
| _ when g_edge = G_edge.sub ->
bprintf buff " N_%s -> N_%s [dir=none];\n" (Gid.to_string id) (Gid.to_string tar)
| _ -> bprintf buff " N_%s -> N_%s%s;\n" (Gid.to_string id) (Gid.to_string tar) (G_edge.to_dot ?domain ~deco g_edge)
) (G_node.get_next node)
(Gid.to_string id) (Gid.to_string s) (Gid.to_string id) (Gid.to_string s)
end
) graph.map;
bprintf buff "}\n";
......
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