#!/bin/bash global WHAT := $1 global DIR := $2 cat ../gnuplot_common_settings.hh > $(WHAT).gnuplot echo "set title " $[grep $(WHAT) ../action_settings.txt | head -n 1 | cut -d ";" -f 2] >> $WHAT.gnuplot echo "set xlabel " $[grep $(WHAT) ../action_settings.txt | head -n 1 | cut -d ";" -f 3] " offset 0,0" >> $WHAT.gnuplot echo "set xrange [" $[grep $(WHAT) ../action_settings.txt | head -n 1 | cut -d ";" -f 4] "]" >> $WHAT.gnuplot if test $Argc > 3 { if test $3 == "tiny" { echo "set xrange [2:16]" >> $WHAT.gnuplot echo "set nologscale" >> $WHAT.gnuplot } } global DATA_FILE := $[cat ../order_lib] echo set term postscript color rounded enhanced >> $WHAT.gnuplot echo set output "'"../$(DIR)/$WHAT.ps"'" >> $WHAT.gnuplot # echo set term svg color rounded enhanced >> $WHAT.gnuplot # echo "set terminal svg enhanced size 1000 1000 fname \"Times\" fsize 36" >> $WHAT.gnuplot # echo set output "'"../${DIR}/$WHAT.svg"'" >> $WHAT.gnuplot echo plot '\' >> $WHAT.gnuplot for FILE in [$DATA_FILE] { global LAST := $FILE } for FILE in [$DATA_FILE] { global BASE := $(FILE##*/) ; global BASE := $(FILE##*/) ; global AVANT := "bench_$(WHAT)_" ; global REDUC := $(BASE##*$AVANT) ; global TITLE := $(REDUC%.dat) echo "'"$FILE"'" $[grep $TITLE ../perlib_plot_settings.txt | head -n 1 | cut -d ";" -f 2] "\\" >> $WHAT.gnuplot if test $FILE != $LAST { echo ", \\" >> $WHAT.gnuplot } } echo " " >> $WHAT.gnuplot gnuplot -persist < $WHAT.gnuplot rm $WHAT.gnuplot ps2pdf ../$(DIR)/$WHAT.ps ../$(DIR)/$WHAT.pdf convert -background white -density 120 -rotate 90 -resize 800 +dither -colors 256 -quality 0 ../$(DIR)/$WHAT.ps -background white -flatten ../$(DIR)/$WHAT.png # pstoedit -rotate -90 -xscale 0.8 -yscale 0.8 -centered -yshift -50 -xshift -100 -f plot-svg aat.ps aat2.svg (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:WHAT) op:Equal rhs:{($ VSub_Number "$1")} spids:[3])] spids: [3] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:DIR) op:Equal rhs:{($ VSub_Number "$2")} spids:[6])] spids: [6] ) (SimpleCommand words: [{(cat)} {(../gnuplot_common_settings.hh)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(${ VSub_Name WHAT) (.gnuplot)} spids:[14]) ] ) (SimpleCommand words: [ {(echo)} {(DQ ("set title "))} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(grep)} {(${ VSub_Name WHAT)} {(../action_settings.txt)}) (C {(head)} {(-n)} {(1)}) (C {(cut)} {(-d)} {(DQ (";"))} {(-f)} {(2)}) ] negated: False ) ] ) left_token: spids: [28 58] ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [60] ) ] ) (SimpleCommand words: [ {(echo)} {(DQ ("set xlabel "))} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(grep)} {(${ VSub_Name WHAT)} {(../action_settings.txt)}) (C {(head)} {(-n)} {(1)}) (C {(cut)} {(-d)} {(DQ (";"))} {(-f)} {(3)}) ] negated: False ) ] ) left_token: spids: [71 101] ) } {(DQ (" offset 0,0"))} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [107] ) ] ) (SimpleCommand words: [ {(echo)} {(DQ ("set xrange ["))} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(grep)} {(${ VSub_Name WHAT)} {(../action_settings.txt)}) (C {(head)} {(-n)} {(1)}) (C {(cut)} {(-d)} {(DQ (";"))} {(-f)} {(4)}) ] negated: False ) ] ) left_token: spids: [118 148] ) } {(DQ ("]"))} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [154] ) ] ) (If arms: [ (if_arm cond: [ (Sentence child: (SimpleCommand words: [{(Lit_Other "[")} {($ VSub_Pound "$#")} {(Lit_Other "]")}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(3)} spids:[166])] ) terminator: ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Number "$3"))} {(Lit_Other "=") (Lit_Other "=")} {(DQ (tiny))} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("set xrange [2:16]"))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [203] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ("set nologscale"))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [215] ) ] ) ] spids: [-1 194] ) ] spids: [-1 221] ) ] spids: [-1 173] ) ] spids: [-1 223] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DATA_FILE) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(cat)} {(../order_lib)})]) left_token: spids: [229 233] ) } spids: [228] ) ] spids: [228] ) (SimpleCommand words: [{(echo)} {(set)} {(term)} {(postscript)} {(color)} {(rounded)} {(enhanced)}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [249] ) ] ) (SimpleCommand words: [ {(echo)} {(set)} {(output)} {(DQ ("'")) (../) (${ VSub_Name DIR) (/) ($ VSub_Name "$WHAT") (.ps) (DQ ("'"))} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [274] ) ] ) (SimpleCommand words: [{(echo)} {(plot)} {(EscapedLiteralPart token:)}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [296] ) ] ) (ForEach iter_name: FILE iter_words: [{($ VSub_Name "$DATA_FILE")}] do_arg_iter: False body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LAST) op: Equal rhs: {($ VSub_Name "$FILE")} spids: [313] ) ] spids: [313] ) ] spids: [310 316] ) spids: [307 -1] ) (ForEach iter_name: FILE iter_words: [{($ VSub_Name "$DATA_FILE")}] do_arg_iter: False body: (DoGroup children: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BASE) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_DPound arg_word:{("*") (Lit_Slash /)}) spids: [331 336] ) } spids: [330] ) ] spids: [330] ) terminator: ) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BASE) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_DPound arg_word:{("*") (Lit_Slash /)}) spids: [341 346] ) } spids: [340] ) ] spids: [340] ) terminator: ) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:AVANT) op: Equal rhs: {(bench_) (${ VSub_Name WHAT) (_)} spids: [350] ) ] spids: [350] ) terminator: ) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REDUC) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id: VOp1_DPound arg_word: {("*") ($ VSub_Name "$AVANT")} ) spids: [360 365] ) } spids: [359] ) ] spids: [359] ) terminator: ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TITLE) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(.dat)}) spids: [370 374] ) } spids: [369] ) ] spids: [369] ) (SimpleCommand words: [ {(echo)} {(DQ ("'")) ($ VSub_Name "$FILE") (DQ ("'"))} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(grep)} {($ VSub_Name "$TITLE")} {(../perlib_plot_settings.txt)}) (C {(head)} {(-n)} {(1)}) (C {(cut)} {(-d)} {(DQ (";"))} {(-f)} {(2)}) ] negated: False ) ] ) left_token: spids: [388 416] ) } {(DQ (EscapedLiteralPart token:))} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [422] ) ] ) (If arms: [ (if_arm cond: [ (C {(Lit_Other "[")} {($ VSub_Name "$FILE")} {(KW_Bang "!") (Lit_Other "=")} {($ VSub_Name "$LAST")} {(Lit_Other "]")} ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ (", ") (EscapedLiteralPart token:))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [452] ) ] ) ] spids: [-1 442] ) ] spids: [-1 458] ) ] spids: [327 460] ) spids: [324 -1] ) (SimpleCommand words: [{(echo)} {(DQ (" "))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [468] ) ] ) (SimpleCommand words: [{(gnuplot)} {(-persist)}] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {($ VSub_Name "$WHAT") (.gnuplot)} spids: [478] ) ] ) (C {(rm)} {($ VSub_Name "$WHAT") (.gnuplot)}) (C {(ps2pdf)} {(../) (${ VSub_Name DIR) (/) ($ VSub_Name "$WHAT") (.ps)} {(../) (${ VSub_Name DIR) (/) ($ VSub_Name "$WHAT") (.pdf)} ) (C {(convert)} {(-background)} {(white)} {(-density)} {(120)} {(-rotate)} {(90)} {(-resize)} {(800)} {(Lit_Other "+") (dither)} {(-colors)} {(256)} {(-quality)} {(0)} {(../) (${ VSub_Name DIR) (/) ($ VSub_Name "$WHAT") (.ps)} {(-background)} {(white)} {(-flatten)} {(../) (${ VSub_Name DIR) (/) ($ VSub_Name "$WHAT") (.png)} ) ] )