[BACK]Return to lasergnu CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gnuplot

Annotation of OpenXM_contrib/gnuplot/lasergnu, Revision 1.1

1.1     ! maekawa     1: #!/bin/csh -f
        !             2: #
        !             3: # $Id: lasergnu,v 1.5 1994/01/29 16:27:12 alex Exp $
        !             4: #
        !             5: # Print gnuplot output on an Imagen or Postscript laser printer.
        !             6:
        !             7: set print_banner = on   # Print a banner page unless told otherwise.
        !             8: set input_files = ()    # the plot input command files
        !             9: set lpr_opts = ()       # options to lpr
        !            10:
        !            11: # Default printer set by shell variable PRINTER.
        !            12: if (! $?PRINTER) then
        !            13:     if ($?LASER) then
        !            14:         set PRINTER=$LASER
        !            15:     else
        !            16:         set PRINTER="lw0"
        !            17:     endif
        !            18: endif
        !            19: set printer = (-P$PRINTER)
        !            20:
        !            21: # File for plot commands, and for plot output
        !            22: set TMP=/tmp/plot$$
        !            23: set outfile=$TMP.out    # the output file
        !            24: onintr cleanup
        !            25:
        !            26: # default is Imagen mode for Imagen printer; see -p option
        !            27: set setterm="set terminal imagen"
        !            28: set LANG="-Limpress"
        !            29:
        !            30: # Loop through the command-line arguments.
        !            31:
        !            32: top:
        !            33:     if ($#argv > 0) then
        !            34:
        !            35:         switch ("$argv[1]")
        !            36:
        !            37:         case -b*:   # Do not print a banner page.
        !            38:         case -J*:   # Compatible with imprint.
        !            39:             set print_banner = off
        !            40:                 set lpr_opts=($lpr_opts -h)
        !            41:             shift argv
        !            42:             goto top
        !            43:
        !            44:         case -f?*:  # Specify file containing plot commands
        !            45:             set input_files = ($input_files `echo $argv[1] | sed 's/^-f//'`)
        !            46:             shift argv
        !            47:             goto top
        !            48:
        !            49:         case -f:    # Specify file containing plot commands
        !            50:             shift argv
        !            51:             if ($#argv > 0) then
        !            52:                 set input_files = ($input_files $argv[1])
        !            53:                 shift argv
        !            54:             else
        !            55:                 echo "Usage: -f file ..."
        !            56:                 echo "Type    lasergnu -help    for help."
        !            57:                 exit (1)
        !            58:             endif
        !            59:             goto top
        !            60:
        !            61:               case -F?*:              # Specify font
        !            62:                       set fontsize = `echo $argv[1] | sed 's/^-F//'`)
        !            63:                       shift argv
        !            64:                       goto top
        !            65:
        !            66:               case -F:        # Specify font
        !            67:                       shift argv
        !            68:                       if ($#argv > 0) then
        !            69:                               set font = $argv[1]
        !            70:                               shift argv
        !            71:                       else
        !            72:                               echo "Usage: -F font"
        !            73:                               echo "Type    lasergnu -help    for help."
        !            74:                               exit (1)
        !            75:                       endif
        !            76:                       goto top
        !            77:
        !            78:         case -t?*:  # Specify title of plot
        !            79:             echo set title \""`echo $argv[1] | sed 's/^-t//'`"\" >> $TMP
        !            80:             shift argv
        !            81:             goto top
        !            82:
        !            83:         case -t:    # Specify title of plot
        !            84:             shift argv
        !            85:             if ($#argv > 0) then
        !            86:                 echo set title \""$1"\" >> $TMP
        !            87:                 shift argv
        !            88:             else
        !            89:                 echo "Usage: -t title ..."
        !            90:                 echo "Type    lasergnu -help    for help."
        !            91:                 exit (1)
        !            92:             endif
        !            93:             goto top
        !            94:         case -help:
        !            95:                        goto usage
        !            96:
        !            97:         case -P?*:  # Set the printer, exactly as by itroff.
        !            98:             set printer = $argv[1]
        !            99:             shift argv
        !           100:             goto top
        !           101:
        !           102:         case -P:    # Set the printer, exactly as by itroff.
        !           103:             shift argv
        !           104:             if ($#argv > 0) then
        !           105:                 set printer = (-P$argv[1])
        !           106:                 shift argv
        !           107:             else
        !           108:                 echo "Usage: -P printer ..."
        !           109:                 echo "Type    lasergnu -help    for help."
        !           110:                 exit (1)
        !           111:             endif
        !           112:             goto top
        !           113:
        !           114:                 # use impress
        !           115:         case -I:
        !           116:              echo Imagen is the default mode now
        !           117:              shift argv
        !           118:              goto top
        !           119:
        !           120:                 # use postscript instead of impress language
        !           121:         case -p:
        !           122:              set setterm="set term postscript"
        !           123:              set LANG="-Lpostscript"
        !           124:              shift argv
        !           125:              goto top
        !           126:
        !           127:                case -s?*:      # Specify scale of plot
        !           128:                        echo set size `echo $argv[1] | sed 's/^-s//'` >> $TMP
        !           129:                        shift argv
        !           130:                        goto top
        !           131:
        !           132:                case -s:        # Specify scale of plot
        !           133:                        shift argv
        !           134:                        if ($#argv > 0) then
        !           135:                                echo set size "$1" >> $TMP
        !           136:                                shift argv
        !           137:                        else
        !           138:                                echo "Usage: -s xscale,yscale"
        !           139:                                echo "Type    lasergnu -help    for help."
        !           140:                                exit (1)
        !           141:                        endif
        !           142:                        goto top
        !           143:
        !           144:                case -w?*:      # Specify split page in multiplot (horiz,vertical)
        !           145:                        set windows=`echo "$argv[1]\]" | sed 's/^-s/[/'`
        !           146:                        shift argv
        !           147:                        goto top
        !           148:
        !           149:                case -w:        # Specify split page
        !           150:                        shift argv
        !           151:                        if ($#argv > 0) then
        !           152:                                set windows="[$argv[1]]"
        !           153:                                shift argv
        !           154:                        else
        !           155:                                echo "Usage: -w horiz,vertical"
        !           156:                                echo "Type    lasergnu -help    for help."
        !           157:                                exit (1)
        !           158:                        endif
        !           159:                        goto top
        !           160:
        !           161:                case -O:
        !           162:                         set orientation="portrait"
        !           163:                         shift argv
        !           164:                         goto top
        !           165:
        !           166:         case -?*:
        !           167:             echo "I do not recognize option $argv[1]."
        !           168:                        goto usage
        !           169:
        !           170:         default:
        !           171:               echo "$argv[1]"   >> $TMP
        !           172:             shift argv
        !           173:             goto top
        !           174:
        !           175:         endsw
        !           176:     endif
        !           177:
        !           178: # try to devine the printer type
        !           179: if ($printer =~ -Plw*) then
        !           180:     set setterm="set term postscript"
        !           181:     set LANG="-Lpostscript"
        !           182: endif
        !           183:
        !           184: if ($printer =~ -Pim*) then
        !           185:     set setterm="set term imagen $windows $orientation $font"
        !           186:     set LANG="-Limpress"
        !           187: endif
        !           188:
        !           189: # Set up input file
        !           190: echo "$setterm" > $TMP.plt
        !           191: echo set output \"$outfile\" >> $TMP.plt
        !           192: if (-e $TMP) cat $TMP >> $TMP.plt
        !           193: grep -v "set te" $input_files | grep -v "set o" >> $TMP.plt
        !           194: echo "quit" >> $TMP.plt
        !           195: # If input file is specified AND command line contains plot commands, then
        !           196: #   do command line args first, then plot commands in input file.
        !           197: gnuplot $TMP.plt < /dev/null
        !           198: #gnuplot $TMP.plt $input_files
        !           199:
        !           200: if ($status == 0 && -e $outfile && ! -z $outfile) then
        !           201:     # The printer is whatever printer was last specified,
        !           202:     # or the default printer if none was specified.
        !           203:     # Imagen terminal driver support the page header
        !           204:     if ($LANG == -Limpress) then
        !           205:         /usr/local/bin/ipr $LANG $printer \
        !           206:            -D"jobheader $print_banner" \
        !           207:            -D"pagereversal on" \
        !           208:            -D"program lasergnu" $outfile
        !           209:     else if ($LANG == -Lpostscript) then
        !           210:            lpr $lpr_opts $printer $outfile
        !           211:     endif
        !           212: else
        !           213:     echo "lasergnu: error in plotting or empty plot; nothing printed."
        !           214: endif
        !           215:
        !           216: cleanup:
        !           217: rm -f $TMP* $outfile
        !           218: exit
        !           219:
        !           220: usage:
        !           221: echo "usage: lasergnu [-Pprinter] [-F font] [-w nx,ny ] [-s xscale,yscale][-b] [-O] [-p] [-t title] [-f file] ['plot command']...."
        !           222: echo "  -O           : Orientation Portrait (default is Landscape)"
        !           223: echo "  -F font      : fontsize in points for imagen"
        !           224: echo "  -w nx,ny     : split page (nx and ny: no. plots horizontal and vertical)"
        !           225: echo "  -s xscale,yscale : scaling in horiz, vertical direction"
        !           226: echo "  -P printer   : Printer to send the plot"
        !           227: echo "  -p           : set gnuplot driver to postscript (default is Imagen)"
        !           228: echo "  -I           : set gnuplot terminal driver to imagen (default)"
        !           229: echo "  -b           : don't print jobheader page"
        !           230: echo ""

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>