GNU PIC で凡例付き DFD

GNU PIC で凡例付き DFD を書く。

GNU PIC で凡例付き DFD

.ps 14 # font size
.PS
scale = 2.54; # inch -> cm
arrowwid=0.25;

define storage {[
    box $1 wid $2 invisible;
    line from last box.nw to last box.ne;
    line from last box.sw to last box.se;
]}

define frame {
    top_mergin = $2;
    bottom_mergin = $3;
    left_mergin = $4;
    right_mergin = $5;

    line from $1.nw + (-left_mergin, top_mergin) to $1.ne + (right_mergin, top_mergin);
    line from $1.sw + (-left_mergin, -bottom_mergin) to $1.se + (right_mergin, -bottom_mergin);
    line from $1.nw + (-left_mergin, top_mergin) to $1.sw + (-left_mergin, -bottom_mergin);
    line from $1.ne + (right_mergin, top_mergin) to $1.se + (right_mergin, -bottom_mergin);
}

Graph: [
    IO1: box "order" width 2;

    arrow "order list" above 3;
    Process1: circle "accept" rad 1;

    arrow;
    Process2: circle "shipment" rad 1.1;

    arrow;
    IO2: box "delivery" width 3;

    arrow "add goods" rjust down from Process1.s;
    Storage: storage("goods list", 3);

    line "refer goods" ljust down from Process2.s to (Process2.s.x, Storage.e.y) <-;
    line from last line.end to Storage.e;
]

Legend: [
    box "Input/" "" "Output" wid 2.5 ht 2;
    right; move;
    circle "Function" rad 1;
    move;
    storage("File/DB", 3);
    move to last [].e; move;
    arrow "Flow" above 2;
] with .n at Graph.s + (0, -1.5);

frame(Legend, 1, 0.5, 0.5, 0.5);
"Legend" at Legend.n + (0, 0.4);
.PE