4 ms·
You only need a couple of line to plug in automatic m4 preprocessing in Makefile. And perhaps add a .SECONDARY line if you are debugging to prevent the intermed
by m000 6y ago
You only need a couple of line to plug in automatic m4 preprocessing in Makefile. And perhaps add a .SECONDARY line if you are debugging to prevent the intermediate .dot files from being deleted.
%.dot: %.dot.m4
m4 < $< > $@
I use m4 to implement something akin to css classes, only a bit more powerful because you can do pseudo-subclassing. E.g.
define(`base_node', `width=1.75, height=1.0, fontname="Menlo", fontsize=13')
define(`file',`base_node, shape=note')
define(`directory',`base_node, shape=folder')
define(`important', `fontname="Menlo Italic"')
...
tarball [file, label="foo.tar"];
vardir [directory, label="/var"];
etcdir [directory, important, label="/etc"];
- kragen 6y agoRight! That kind of crosscutting thing is tricky to do with the hierarchical nature of subgraphs. Without some kind of macro preprocessor you'd end up doing something like node [width=1.75, height=1.0, fontname="Menlo"]; subgraph files { node [shape=note]; tarball [label="foo.tar"]; subgraph importantfiles { node [fontname="Menlo Italic"]; ... } } subgraph dirs { node [shape=folder]; vardir [label="/var"]; subgraph importantdirs { node [fontname="Menlo Italic"]; etcdir [label="/etc"]; } } This obviously has the drawback that if you change the importance font, you have to change it twice instead of once, and you might forget. And clearly there are cases where that kind of duplication is a bigger problem than the difficulties with m4.