src/gnuplot.awk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# parser for gnuplot commands in Literate C pages

BEGIN { nplots = 0 }

/^[ \t]*~~~/ {
    if (gnuplot) {
	gnuplot = 0;
	print "! mogrify -trim _plot" nplots++ ".png";
    }
}

{
    if (gnuplot)
	print $0;
    else
	print "#", $0;
}

/^[ \t]*~~~gnuplot/ {
    gnuplot = 1;
    print "set output '_plot" nplots ".png'";
}