|
22 | 22 | (format (str "\"%s\" [id = \"%s\" %s] \n " |
23 | 23 | "\"%s\" -> \"%s\" [label = \"true\", id = \"%s\"] \n" |
24 | 24 | "\"%s\" -> \"%s\" [label=\"false\", id = \"%s\"]\n") |
25 | | - name (clean-id name) (if internal? "style=\"filled\" fillcolor=\"#CCCCCC\"" "") |
| 25 | + name (clean-id name) (if internal? "shape=\"octagon\" style=\"filled\" fillcolor=\"#CCCCCC\"" "") |
26 | 26 | name then (clean-id (str name "_" then)) |
27 | 27 | name else (clean-id (str name "_" else )))) |
28 | 28 | 'defaction |
|
57 | 57 | (defn rank-handler-groups [handlers] |
58 | 58 | (->> handlers |
59 | 59 | (group-by (fn [[name status]] (int (/ status 100)))) |
| 60 | + (remove #(#{4 5} (first %))) |
60 | 61 | vals |
61 | 62 | (map (fn [sg] (map first sg))) |
62 | 63 | (map rank-same) |
|
71 | 72 | decisions (->> nodes |
72 | 73 | (filter #(= 'defdecision (first %))) |
73 | 74 | (map second)) |
| 75 | + conneg-decisions (filter #(.endsWith (name %) "available?") |
| 76 | + decisions) |
74 | 77 | handlers (->> nodes |
75 | 78 | (filter #(= 'defhandler (first %))) |
76 | 79 | (map (fn [[_ name status _]] [name status]))) |
|
79 | 82 | (map second))] |
80 | 83 | {:nodes nodes |
81 | 84 | :decisions decisions |
| 85 | + :conneg-decisions conneg-decisions |
82 | 86 | :handlers handlers |
83 | 87 | :actions actions})) |
84 | 88 |
|
85 | 89 | (defn generate-graph-dot [] |
86 | | - (let [{:keys [nodes handlers actions]} (parse-source-definitions)] |
| 90 | + (let [{:keys [nodes conneg-decisions handlers actions]} (parse-source-definitions)] |
87 | 91 | (->> nodes |
88 | 92 | (map to-graph) |
89 | 93 | (remove nil?) |
90 | 94 | (concat (rank-handler-groups handlers)) |
91 | 95 | (concat (rank-same (remove #{'initialize-context} actions))) |
| 96 | + (concat (rank-same (remove #{'initialize-context} conneg-decisions))) |
92 | 97 | (apply str) |
93 | 98 | (format (str "digraph{\nid=\"trace\"; size=\"1000,1000\"; page=\"1000,1000\";\n\n" |
94 | 99 | "edge[fontname=\"sans-serif\"]\n" |
|
0 commit comments