Commit 5364aefd authored by erwan's avatar erwan
Browse files

New: Add a get_graph_attributes function to the sasa API (closes #12)

parent d599f741
Pipeline #26562 failed with stages
in 9 minutes and 10 seconds
(* Time-stamp: <modified the 02/07/2019 (at 17:19) by Erwan> *)
(* Time-stamp: <modified the 03/07/2019 (at 10:17) by Erwan Jahier> *)
open Sasacore
......@@ -76,5 +76,5 @@ let (register : 's to_register -> unit) =
let card = Register.card
let get_graph_attributes = Register.get_graph_attributes
let get_graph_attribute = Register.get_graph_attribute
(* Time-stamp: <modified the 02/07/2019 (at 17:16) by Erwan> *)
(* Time-stamp: <modified the 03/07/2019 (at 10:17) by Erwan Jahier> *)
(** Process programmer API *)
type 's neighbor = {
......@@ -50,4 +50,4 @@ val card : unit -> int
(* val degree : unit -> int *)
(* val diameter : unit -> int *)
val get_graph_attributes : string -> string
val get_graph_attribute : string -> string
(* Time-stamp: <modified the 03/07/2019 (at 10:04) by Erwan Jahier> *)
(* Time-stamp: <modified the 03/07/2019 (at 10:17) by Erwan Jahier> *)
type 's neighbor = {
state: 's ;
......@@ -138,11 +138,11 @@ let (to_string : 's -> string) =
fun v ->
(get_value_to_string ()) v
let (get_graph_attributes : string -> string) =
let (get_graph_attribute : string -> string) =
fun str ->
try Hashtbl.find tbls.graph_attributes str
with Not_found ->
failwith (Printf.sprintf "The graph attribute %s does not seem to exist" str)
let (set_graph_attributes : string -> string -> unit) =
let (set_graph_attribute : string -> string -> unit) =
Hashtbl.replace tbls.graph_attributes
(* Time-stamp: <modified the 03/07/2019 (at 10:03) by Erwan Jahier> *)
(* Time-stamp: <modified the 03/07/2019 (at 10:18) by Erwan Jahier> *)
type 's neighbor = {
state: 's ;
......@@ -39,7 +39,7 @@ val card : unit -> int
(* val degree : unit -> int *)
(* val diameter : unit -> int *)
val get_graph_attributes : string -> string
val set_graph_attributes : string -> string -> unit
val get_graph_attribute : string -> string
val set_graph_attribute : string -> string -> unit
val verbose_level: int ref
(* Time-stamp: <modified the 03/07/2019 (at 10:09) by Erwan Jahier> *)
(* Time-stamp: <modified the 03/07/2019 (at 10:18) by Erwan Jahier> *)
open Graph
open Graph.Dot_ast
......@@ -67,7 +67,7 @@ let rec (get_weight: Dot_ast.attr -> int option ) =
let (do_graph_attr : (Dot_ast.id * Dot_ast.id option) list -> unit) =
fun l ->
let f = function
| id, Some v -> Register.set_graph_attributes (of_id id) (of_id v)
| id, Some v -> Register.set_graph_attribute (of_id id) (of_id v)
| _, None -> ()
in
List.iter f l
......
Supports Markdown
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