Commit 14dce59b authored by Benoit Barbot's avatar Benoit Barbot
Browse files

fix choice

parent 5e660610
Pipeline #2236 passed with stage
in 29 seconds
......@@ -230,7 +230,10 @@ let buff_attribute b = function
| `String s ->
Buffer.add_char b 'S';
buff_string b s
| `Choice sl -> buff_list b buff_string sl
| `Choice sl ->
Buffer.add_char b 'd';
buff_list b buff_string sl;
Buffer.add_char b 'd'
| `Check true ->
Buffer.add_char b 'B';
Buffer.add_char b 't'
......@@ -252,7 +255,8 @@ let attribute_buff b pos =
(p, `String s)
| 'd' ->
let p, s = list_buff b string_buff (pos + 1) in
(p, `Choice s)
assert (b.[p] = 'd');
(p + 1, `Choice s)
| 'B' when b.[pos + 1] = 't' -> (pos + 2, `Check true)
| 'B' when b.[pos + 1] = 'f' -> (pos + 2, `Check false)
| _ -> failwith "bad serialization"
......
......@@ -233,6 +233,7 @@ module GraphEditor (G : GRAPH) = struct
let attr = snd @@ G.get_node_attribute graph node in
buff_list buff write_attribute attr);
G.iter_arc graph (fun arc ->
print_endline "new arc";
let n1, n2 = G.nodes_of_arc graph arc in
Buffer.add_char buff 'A';
buff_int buff (Hashtbl.find map n1);
......@@ -294,7 +295,7 @@ module GraphEditor (G : GRAPH) = struct
( match found with
| Some v ->
if not (G.update_arc_attribute graph arc id (Some v)) then
print_endline ("Fail to update default attribute:" ^ str)
print_endline ("Fail to update default attribute:" ^ name)
| None -> () );
nl)
attrl cattr
......@@ -328,12 +329,14 @@ module GraphEditor (G : GRAPH) = struct
incr i;
pos := parse_exchange_node graph str p2 node
done;
(*print_endline (String.sub str !pos (String.length str - !pos));*)
while !pos + 7 <= length && str.[!pos] = 'A' do
let p1, nid1 = int_buff str (!pos + 1) in
let p2, nid2 = int_buff str p1 in
let n1 = Hashtbl.find map nid1 in
let n2 = Hashtbl.find map nid2 in
pos := parse_exchange_arc graph str p2 n1 n2
(*print_endline (String.sub str !pos (String.length str - !pos))*)
done;
pos := parse_exchange_node graph str (!pos + 1) `Empty;
graph
......
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