From olav@jordforsk.nlh.no Sun Jan 23 18:16:15 1994
Return-Path: <bug-gnuplot-request@wildcat.dartmouth.edu>
From: olav@jordforsk.nlh.no (Hans Olav Eggestad)
Date: Mon, 20 Dec 93 16:32:11 GMT
To: bug-gnuplot@Dartmouth.EDU
Subject: timeseries, lasergnu.3.5.patch

*** lasergnu.orig	Wed Nov 10 12:43:28 1993
--- lasergnu	Wed Dec 15 09:02:25 1993
***************
*** 1,19 ****
  #!/bin/csh -f
  #
! # $Id: lasergnu%v 3.50 1993/07/09 05:35:24 woo Exp $
  #
  # Print gnuplot output on an Imagen or Postscript laser printer.
  
! set print_banner = on   # Print a banner page unless told otherwise.
  set input_files = ()    # the plot input command files
! set lpr_opts = ()       # options to lpr
  
  # Default printer set by shell variable PRINTER.
! if (! $?PRINTER) then
      if ($?LASER) then
!         set PRINTER=$LASER
      else
!         set PRINTER="lw0"
      endif
  endif
  set printer = (-P$PRINTER)
--- 1,43 ----
  #!/bin/csh -f
  #
! # $Id: lasergnu,v 3.38 1992/05/28 03:31:19 woo Exp $
  #
+ # $Log: lasergnu,v $
+ # Revision 3.37  1992/05/28  03:31:19  woo
+ # bug fix of runaway gnuplot_x11.c, SUN util.c, xlib driver & new hidden line removal routines
+ #
+ # Revision 3.37  1992/05/28  03:31:19  woo
+ # bug fix of runaway gnuplot_x11.c, SUN util.c, xlib driver & new hidden line removal routines
+ #
+ # Revision 3.35  1992/03/31  04:49:54  woo
+ # BETA 1 of version 3.3 - bug fixes to binary routines
+ #
+ # Revision 3.35  1992/03/31  04:49:54  woo
+ # BETA 1 of version 3.3 - bug fixes to binary routines
+ #
+ # Revision 3.24  1992/02/29  16:23:41  woo
+ # gnuplot3.2, beta 4
+ #
+ # Revision 3.23  1992/02/21  20:18:16  woo
+ # gnuplot3.2, beta 3
+ #
+ #
+ #
  # Print gnuplot output on an Imagen or Postscript laser printer.
  
! set print_banner = off	# Print a banner page unless told otherwise.
  set input_files = ()    # the plot input command files
! set lpr_opts = ()	    # options to lpr
! set font = ()
! set orientation = ()		# Orientation, landscape | portrait
! set windows = ()		# multiplot pr page
  
  # Default printer set by shell variable PRINTER.
! if (! $?PRINTER) then 
      if ($?LASER) then
!    	   set PRINTER=$LASER
      else
!     	   set PRINTER="lw0"
      endif
  endif
  set printer = (-P$PRINTER)
***************
*** 20,26 ****
  
  # File for plot commands, and for plot output
  set TMP=/tmp/plot$$
! set outfile=$TMP.out    # the output file
  onintr cleanup
  
  # default is Imagen mode for Imagen printer; see -p option
--- 44,50 ----
  
  # File for plot commands, and for plot output
  set TMP=/tmp/plot$$
! set outfile=$TMP.out	# the output file
  onintr cleanup
  
  # default is Imagen mode for Imagen printer; see -p option
***************
*** 27,128 ****
  set setterm="set terminal imagen"
  set LANG="-Limpress"
  
- set usage="usage: lasergnu [-Pprinter] [-b] [-p] [-t title] [-f file] ['plot command']...."
- 
  # Loop through the command-line arguments.
  
  top:
!     if ($#argv > 0) then
  
!         switch ("$argv[1]")
  
!         case -b*:   # Do not print a banner page.
!         case -J*:   # Compatible with imprint.
!             set print_banner = off
!                 set lpr_opts=($lpr_opts -h)
!             shift argv
!             goto top
  
!         case -f?*:  # Specify file containing plot commands
!             set input_files = ($input_files `echo $argv[1] | sed 's/^-f//'`)
!             shift argv
!             goto top
  
!         case -f:    # Specify file containing plot commands
!             shift argv
!             if ($#argv > 0) then
!                 set input_files = ($input_files $argv[1])
!                 shift argv
!             else
!                 echo "Usage: -f file ..."
!                 echo "Type    lasergnu -help    for help."
!                 exit (1)
!             endif
!             goto top
  
!         case -t?*:  # Specify title of plot
!             echo set title \""`echo $argv[1] | sed 's/^-t//'`"\" >> $TMP
!             shift argv
!             goto top
  
!         case -t:    # Specify title of plot
!             shift argv
!             if ($#argv > 0) then
!                 echo set title \""$1"\" >> $TMP
!                 shift argv
!             else
!                 echo "Usage: -t title ..."
!                 echo "Type    lasergnu -help    for help."
!                 exit (1)
!             endif
!             goto top
!         case -help:
!             echo "$usage"
!             exit(1)
  
!         case -P?*:  # Set the printer, exactly as by itroff.
!             set printer = $argv[1]
!             shift argv
!             goto top
  
!         case -P:    # Set the printer, exactly as by itroff.
!             shift argv
!             if ($#argv > 0) then
!                 set printer = (-P$argv[1])
!                 shift argv
!             else
!                 echo "Usage: -P printer ..."
!                 echo "Type    lasergnu -help    for help."
!                 exit (1)
!             endif
!             goto top
  
!                 # use impress
!         case -I:
!              echo Imagen is the default mode now
!              shift argv
!              goto top
  
                  # use postscript instead of impress language
!         case -p:
!              set setterm="set term postscript"
!              set LANG="-Lpostscript"
!              shift argv
!              goto top
  
!         case -?*:
!             echo "I do not recognize option $argv[1]."
!             echo "$usage"
!             exit (1)
  
!         default:
!               echo "$argv[1]"   >> $TMP
!             shift argv
!             goto top
  
!         endsw
!     endif
  
  # try to devine the printer type
  if ($printer =~ -Plw*) then
      set setterm="set term postscript"
--- 51,207 ----
  set setterm="set terminal imagen"
  set LANG="-Limpress"
  
  # Loop through the command-line arguments.
  
  top:
! 	if ($#argv > 0) then
  
! 		switch ("$argv[1]")
  
! 		case -b*:	# Do not print a banner page.
! 		case -J*:	# Compatible with imprint.
! 			set print_banner = off
!     	   	  	set lpr_opts=($lpr_opts -h)
! 			shift argv
! 			goto top
  
! 		case -f?*:	# Specify file containing plot commands
! 			set input_files = ($input_files `echo $argv[1] | sed 's/^-f//'`)
! 			shift argv
! 			goto top
  
! 		case -f:	# Specify file containing plot commands
! 			shift argv
! 			if ($#argv > 0) then
! 				set input_files = ($input_files $argv[1])
! 				shift argv
! 			else
! 				echo "Usage: -f file ..."
! 				echo "Type    lasergnu -help    for help."
! 				exit (1)
! 			endif
! 			goto top
  
! 		case -F?*:		# Specify font 
! 			set fontsize = `echo $argv[1] | sed 's/^-F//'`)
! 			shift argv
! 			goto top
  
! 		case -F:	# Specify font 
! 			shift argv
! 			if ($#argv > 0) then
! 				set font = $argv[1]
! 				shift argv
! 			else
! 				echo "Usage: -F font"
! 				echo "Type    lasergnu -help    for help."
! 				exit (1)
! 			endif
! 			goto top
  
! 		case -t?*:	# Specify title of plot
! 			echo set title \""`echo $argv[1] | sed 's/^-t//'`"\" >> $TMP
! 			shift argv
! 			goto top
  
! 		case -t:	# Specify title of plot
! 			shift argv
! 			if ($#argv > 0) then
! 				echo set title \""$1"\" >> $TMP
! 				shift argv
! 			else
! 				echo "Usage: -t title ..."
! 				echo "Type    lasergnu -help    for help."
! 				exit (1)
! 			endif
! 			goto top
!           case -help:
! 			#echo "$usage"
! 			goto usage
! 			#exit(1)
  
! 		case -P?*:	# Set the printer, exactly as by itroff.
! 			set printer = $argv[1]
! 			shift argv
! 			goto top
  
+ 		case -P:	# Set the printer, exactly as by itroff.
+ 			shift argv
+ 			if ($#argv > 0) then
+ 				set printer = (-P$argv[1])
+ 				shift argv
+ 			else
+ 				echo "Usage: -P printer ..."
+ 				echo "Type    lasergnu -help    for help."
+ 				exit (1)
+ 			endif
+ 			goto top
+ 
+                 # use impress 
+     	   case -I:
+ 	   		 echo Imagen is the default mode now
+ 			 shift argv
+ 	   		 goto top
+ 
                  # use postscript instead of impress language
!     	   case -p:
! 	   		 set setterm="set term postscript"
! 	   		 set LANG="-Lpostscript"
! 			 shift argv
! 	   		 goto top
  
! 		case -s?*:	# Specify scale of plot
! 			echo set size `echo $argv[1] | sed 's/^-s//'` >> $TMP
! 			shift argv
! 			goto top
  
! 		case -s:	# Specify scale of plot
! 			shift argv
! 			if ($#argv > 0) then
! 				echo set size "$1" >> $TMP
! 				shift argv
! 			else
! 				echo "Usage: -s xscale,yscale"
! 				echo "Type    lasergnu -help    for help."
! 				exit (1)
! 			endif
! 			goto top
  
! 		case -w?*:	# Specify split page in multiplot (horiz,vertical)
! 			set windows=`echo "$argv[1]\]" | sed 's/^-s/[/'`
! 			shift argv
! 			goto top
  
+ 		case -w:	# Specify split page
+ 			shift argv
+ 			if ($#argv > 0) then
+ 				set windows="[$argv[1]]"
+ 				shift argv
+ 			else
+ 				echo "Usage: -w horiz,vertical"
+ 				echo "Type    lasergnu -help    for help."
+ 				exit (1)
+ 			endif
+ 			goto top
+ 
+     	   	case -O:
+ 	   		 set orientation="portrait"
+ 			 shift argv
+ 	   		 goto top
+ 
+ 		case -?*:
+ 			echo "I do not recognize option $argv[1]."
+ 			#echo "$usage"
+ 			goto usage
+ 
+ 		default:
+ 	          echo "$argv[1]"	>> $TMP
+ 			shift argv
+ 			goto top
+ 
+ 		endsw
+ 	endif
+ 
  # try to devine the printer type
  if ($printer =~ -Plw*) then
      set setterm="set term postscript"
***************
*** 130,159 ****
  endif
  
  if ($printer =~ -Pim*) then
!     set setterm="set term imagen"
      set LANG="-Limpress"
  endif
  
  # Set up input file
! echo $setterm > $TMP.plt
  echo set output \"$outfile\" >> $TMP.plt
  if (-e $TMP) cat $TMP >> $TMP.plt
! 
  # If input file is specified AND command line contains plot commands, then
! #   do command line args first, then plot commands in input file.
! gnuplot $TMP.plt $input_files
  
  if ($status == 0 && -e $outfile && ! -z $outfile) then
      # The printer is whatever printer was last specified,
      # or the default printer if none was specified.
!     if ($LANG == -Limpress) then
!         /usr/local/bin/ipr $LANG $printer \
!            -D"jobheader $print_banner" \
!            -D"pagereversal on" \
!            -D"program lasergnu" $outfile
!     else if ($LANG == -Lpostscript) then
!            lpr $lpr_opts $printer $outfile
!     endif
  else
      echo "lasergnu: error in plotting or empty plot; nothing printed."
  endif
--- 209,241 ----
  endif
  
  if ($printer =~ -Pim*) then
!     set setterm="set term imagen $windows $orientation $font"
      set LANG="-Limpress"
  endif
  
  # Set up input file
! echo "$setterm" > $TMP.plt
  echo set output \"$outfile\" >> $TMP.plt
  if (-e $TMP) cat $TMP >> $TMP.plt
! grep -v "set te" $input_files | grep -v "set o" >> $TMP.plt
! echo "quit" >> $TMP.plt
  # If input file is specified AND command line contains plot commands, then
! #	do command line args first, then plot commands in input file.
! gnuplot $TMP.plt < /dev/null 
! #gnuplot $TMP.plt $input_files
  
  if ($status == 0 && -e $outfile && ! -z $outfile) then
      # The printer is whatever printer was last specified,
      # or the default printer if none was specified.
!     # Imagen terminal driver support the page header
!     #if ($LANG == -Limpress) then
!         #/usr/local/bin/ipr $LANG $printer \
!     	   #-D"jobheader $print_banner" \
!     	   #-D"pagereversal on" \
!     	   #-D"program lasergnu" $outfile
!     #else if ($LANG == -Lpostscript) then
!     	   lpr $lpr_opts $printer $outfile
!     #endif
  else
      echo "lasergnu: error in plotting or empty plot; nothing printed."
  endif
***************
*** 160,162 ****
--- 242,257 ----
  
  cleanup:
  rm -f $TMP* $outfile
+ exit
+ 
+ usage:
+ echo "usage: lasergnu [-Pprinter] [-F font] [-w nx,ny ] [-s xscale,yscale][-b] [-O] [-p] [-t title] [-f file] ['plot command']...."
+ echo "  -O           : Orientation Portrait (default is Landscape)"
+ echo "  -F font      : fontsize in points for imagen"
+ echo "  -w nx,ny     : split page (nx and ny: no. plots horizontal and vertical)"
+ echo "  -s xscale,yscale : scaling in horiz, vertical direction"
+ echo "  -P printer   : Printer to send the plot"
+ echo "  -p           : set gnuplot driver to postscript (default is Imagen)"
+ echo "  -I           : set gnuplot terminal driver to imagen (default)"
+ echo "  -b           : don't print jobheader page"
+ echo ""


