net.awk 420 字节
Newer Older
D
dolphin8 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
BEGIN {
    print "digraph {"
}
/op:/ {
    id++
    op = $NF
    opname = op "_" id
    print opname "[\"label\"=\"" op " [" id "]" "\"]"
}
/input/ {
    type = "input"
}
/output/ {
    type = "output"
}
/argument/ {
    if (type == "output") {
        output[$NF] = opname
    } else if (type == "input") {
        if (output[$NF]) {
            print output[$NF] " -> " opname
        }
    }
}
END {
    print "}"
}