#!/bin/bash # base name of the bench # it reads $1.out # and generates $1.pdf global WHAT := $1 global bench := $2 global header := '"rev '" while read line { if test ! -z '$line' { global header := ""$header \"$line"\"" } } < $bench"_settings.txt" echo $header > $WHAT.out.header cat $WHAT.out >> $WHAT.out.header echo "set title '$WHAT'" > $WHAT.gnuplot echo "set key autotitle columnhead outside " >> $WHAT.gnuplot echo "set xtics rotate 1" >> $WHAT.gnuplot echo "set term pdf color rounded enhanced fontscale 0.35 size 7in,5in" >> $WHAT.gnuplot echo set output "'"$WHAT.pdf"'" >> $WHAT.gnuplot global col := $[cat settings.txt | wc -l] echo "plot for [col=2:$col+1] '$WHAT.out.header' using 0:col:xticlabels(1) with lines" >> $WHAT.gnuplot echo " " >> $WHAT.gnuplot gnuplot -persist < $WHAT.gnuplot # generate a png file # convert -background white -density 120 -rotate 90 -resize 800 +dither -colors 256 -quality 0 $WHAT.ps -background white -flatten .$WHAT.png # clean rm $WHAT.out.header $WHAT.gnuplot (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:WHAT) op:Equal rhs:{($ VSub_Number "$1")} spids:[13])] spids: [13] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:bench) op:Equal rhs:{($ VSub_Number "$2")} spids:[16])] spids: [16] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:header) op:Equal rhs:{(DQ ("rev "))} spids:[20])] spids: [20] ) (While cond: [(C {(read)} {(line)})] body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-z)} {(SQ <"$line">)} {(Lit_Other "]")}) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:header) op: Equal rhs: { (DQ ($ VSub_Name "$header") (" ") (EscapedLiteralPart token: ) ($ VSub_Name "$line") (EscapedLiteralPart token:) ) } spids: [52] ) ] spids: [52] ) ] spids: [-1 49] ) ] spids: [-1 62] ) ] spids: [31 64] ) redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {($ VSub_Name "$bench") (DQ (_settings.txt))} spids: [66] ) ] ) (SimpleCommand words: [{(echo)} {($ VSub_Name "$header")}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$WHAT") (.out.header)} spids: [78] ) ] ) (SimpleCommand words: [{(cat)} {($ VSub_Name "$WHAT") (.out)}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.out.header)} spids: [88] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ("set title '") ($ VSub_Name "$WHAT") ("'"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [103] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ("set key autotitle columnhead outside "))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [114] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ("set xtics rotate 1"))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [125] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ("set term pdf color rounded enhanced fontscale 0.35 size 7in,5in"))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [137] ) ] ) (SimpleCommand words: [{(echo)} {(set)} {(output)} {(DQ ("'")) ($ VSub_Name "$WHAT") (.pdf) (DQ ("'"))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [157] ) ] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:col) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [(C {(cat)} {(settings.txt)}) (C {(wc)} {(-l)})] negated: False ) ] ) left_token: spids: [164 174] ) } spids: [163] ) ] spids: [163] ) (SimpleCommand words: [ {(echo)} { (DQ ("plot for [col=2:") ($ VSub_Name "$col") ("+1] '") ($ VSub_Name "$WHAT") (".out.header' using 0:col:xticlabels(1) with lines") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [186] ) ] ) (SimpleCommand words: [{(echo)} {(DQ (" "))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [197] ) ] ) (SimpleCommand words: [{(gnuplot)} {(-persist)}] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [207] ) ] ) (C {(rm)} {($ VSub_Name "$WHAT") (.out.header)} {($ VSub_Name "$WHAT") (.gnuplot)}) ] )