(dotcfg)
| 212 | } |
| 213 | |
| 214 | function dotify(dotcfg) { |
| 215 | |
| 216 | dotcfg = dotcfg || {}; |
| 217 | |
| 218 | var name = dotcfg.name || 'fsm', |
| 219 | states = dotcfg.states || [], |
| 220 | transitions = dotcfg.transitions || [], |
| 221 | rankdir = dotcfg.rankdir, |
| 222 | output = [], |
| 223 | n, max; |
| 224 | |
| 225 | output.push("digraph " + quote(name) + " {") |
| 226 | if (rankdir) |
| 227 | output.push(" rankdir=" + rankdir + ";") |
| 228 | for(n = 0, max = states.length ; n < max ; n++) |
| 229 | output.push(dotify.state(states[n])) |
| 230 | for(n = 0, max = transitions.length ; n < max ; n++) |
| 231 | output.push(dotify.edge(transitions[n])) |
| 232 | output.push("}") |
| 233 | return output.join("\n") |
| 234 | |
| 235 | } |
| 236 | |
| 237 | dotify.state = function(state) { |
| 238 | return " " + quote(state) + ";" |
no test coverage detected