let vertex_attributes v =
let color_in = (`Fillcolor 0x6495ED) in
let color_out = (`Fillcolor 0x90EE90) in
let color_decl = (`Fillcolor 0xFFEFD5) in
let color_stmt = (`Fillcolor 0xCCCCCC) in
let color_call = (`Fillcolor 0xFF8A0F) in
let color_elem_call = (`Fillcolor 0xFFCA6E) in
let sh_box = (`Shape `Box) in
let key = Node.elem_key v in
let sh, col, txt = match key with
| PdgIndex.Key.VarDecl v ->
let txt =
Pretty_utils.sfprintf "@[Decl %a@]" !Ast_printer.d_ident v.vname
in
(`Shape `Box) , color_decl , txt
| PdgIndex.Key.SigKey k ->
let txt = Pretty_utils.sfprintf "%a"
PdgIndex.Signature.pretty_key k
in
let color = match k with | PdgIndex.Signature.Out _ -> color_out | _ -> color_in in
(`Shape `Box), color, txt
| PdgIndex.Key.Stmt s ->
let sh, txt = match s.skind with
| Switch (exp,_,_,_) | If (exp,_,_,_) ->
let txt = Pretty_utils.sfprintf "%a" !Ast_printer.d_exp exp in
(`Shape `Diamond), txt
| Loop _ ->
(`Shape `Doublecircle), "while"
| Block _ | UnspecifiedSequence _ ->
(`Shape `Doublecircle), "{}"
| Goto _ | Break _ | Continue _ ->
let txt = Pretty_utils.sfprintf "%a"
(Cil.defaultCilPrinter#pStmtKind s) s.skind
in (`Shape `Doublecircle), txt
| Return _ | Instr _ ->
let txt = Pretty_utils.sfprintf "%a"
(Cil.defaultCilPrinter#pStmtKind s) s.skind in
sh_box, txt
| _ -> sh_box, "???"
in sh, color_stmt, txt
| PdgIndex.Key.CallStmt call ->
let call_stmt = PdgIndex.Key.call_from_id call in
let txt = Pretty_utils.sfprintf "%a"
(Cil.defaultCilPrinter#pStmtKind call_stmt)
call_stmt.skind
in sh_box, color_call, txt
| PdgIndex.Key.SigCallKey (_call, sgn) ->
let txt =
Pretty_utils.sfprintf "%a" PdgIndex.Signature.pretty_key sgn
in
sh_box, color_elem_call, txt
| PdgIndex.Key.Label _ ->
let txt = Pretty_utils.sfprintf "%a" PdgIndex.Key.pretty key in
sh_box, color_stmt, txt
in sh :: col :: [`Label ( String.escaped txt)]