X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=utils%2Fparallel%2Fgp-ext-imp.pl;fp=utils%2Fparallel%2Fgp-ext-imp.pl;h=fa7c4e06d8abff8799a560082382a95c4ca9961c;hb=0065d5ab628975892cea1ec7303f968c3338cbe1;hp=0000000000000000000000000000000000000000;hpb=28a464a75e14cece5db40f2765a29348273ff2d2;p=ghc-hetmet.git diff --git a/utils/parallel/gp-ext-imp.pl b/utils/parallel/gp-ext-imp.pl new file mode 100644 index 0000000..fa7c4e0 --- /dev/null +++ b/utils/parallel/gp-ext-imp.pl @@ -0,0 +1,86 @@ +#!/usr/local/bin/perl +# ############################################################################# +# +# Usage: gp-ext-imp [options] [] [] +# +# A small script to produce half-useful bar graphs from the PostScript +# output produced by gnuplot. +# Translation is done in the X axis automatically, and should +# be `good enough' for graphs with smallish numbers of bars. +# +# Original version: Bryan O'Sullivan 09.94 +# New and improved version: Hans Wolfgang Loidl +# +# Options: +# -w ... width of vertical bars +# -g ... set gray-level (between 0 and 1; 0 means black) +# -m ... move the graph pixels to the right +# -h ... help; print this text +# -v ... verbose mode +# +# ############################################################################# + +require "getopts.pl"; + +&Getopts('hvm:w:g:'); + +if ( $opt_h ) { + open(ME,$0) || die "Can't open myself ($0)"; + $n = 0; + while () { + last if $_ =~ /^$/; + print $_; + $n++; + } + close(ME); + + exit ; +} + +$size = $opt_w ? $opt_w : 200; +$gray = $opt_g ? $opt_g : 0; +$move = $opt_m ? $opt_m : 150; + +$from = $#ARGV >= 0 ? $ARGV[0] : "-"; +$to = $#ARGV >= 1 ? $ARGV[1] : "-"; + +if ( $opt_v ) { + print 70 x "-" . "\n"; + print "\nSetup: \n"; + print " Input file: $from Output file: $to\n"; + print " Width: $size Gray level: $gray Move is " . + ($opt_m ? "ON" : "OFF") . " with value $move\n"; + print 70 x "-" . "\n"; +} + +open(FROM, "<$from") || die "$from: $!"; +open(TO, ">$to") || die "$to: $!"; + +$l = -1; + +foreach () { + if ($l >= 0) { + $l--; + } + if ($l == 0) { + if ( $opt_m ) { + # This seems to shift everything a little to the right; + print TO "$move 0 translate\n"; + } + print TO "$gray setgray\n"; + print TO "$size setlinewidth\n"; + } + if (/^LT0$/) { + $l = 3; + } elsif (/^LT1$/) { + print TO "-150 0 translate\n"; + } + print TO; +} + + + + + + +