Subject: argggh, I can't type.

From: Matthew Self <[email-masked]>
Date: Wed, 12 Oct 88 18:42:38 PDT

Date: Wed, 12 Oct 88 18:37:40 PDT
From: Mail Delivery Subsystem <postmaster>
Subject: Returned mail: Host unknown
To: self

   ----- Transcript of session follows -----
550 [email-masked]... Host unknown

   ----- Unsent message follows -----
Received: Wed, 12 Oct 88 18:37:40 PDT by bayes.arc.nasa.gov (5.59/1.6)
Date: Wed, 12 Oct 88 18:37:40 PDT
From: Matthew Self <self>
Message-Id: <[email-masked]>
To: [email-masked]
Subject: I always manage to forget something!

*** dvijep.c.orig	Wed Apr 27 17:13:59 1988
--- dvijep.c	Thu May 12 22:30:58 1988
***************
*** 147,152 ****
--- 147,158 ----
  	OUTF("\033*p+%dY",-(dely));\
  }
  
+ /* Push the current cursor position onto the stack */
+ #define PUSH_CURSOR_POSITION OUTS("\033&f0S")
+ 
+ /* Pop the current cursor position from the stack */
+ #define POP_CURSOR_POSITION OUTS("\033&f1S")
+ 
  /* Round a POSITIVE floating-point value to the nearest integer */
  #define ROUND(x) ((int)(x + 0.5))
  
***************
*** 1110,1116 ****
  #include "skgfspec.h"
  #include "skipfont.h"
  #include "skpkspec.h"
- #include "special.h"
  #include "strchr.h"
  #include "strcm2.h"
  #include "strid2.h"
--- 1116,1121 ----
***************
*** 1118,1120 ****
--- 1123,1291 ----
  #include "tctos.h"
  #include "usage.h"
  #include "warning.h"
+ 
+ /*-->special*/
+ /**********************************************************************/
+ /****************************** special *******************************/
+ /**********************************************************************/
+ 
+ /***********************************************************************
+ This driver now provides support for Sun rasterfile format bibtmaps.
+ 
+ This code was written by Matthew Self on May 11, 1988.  It represents
+ a merger of Tom Vijlbrief's "prraster" program which was obtained from
+ the Sun-spots archives on titan.rice.edu and Nelson Beebe's "dvialw"
+ which provides support for postscript \special commands.  To the best
+ of my knowledge, both the original programs may be freely redistributed,
+  and my work is not copyrighted and may be freely redistributed.  Enjoy.
+ 
+                        Matthew Self
+ 		 NASA Ames Research Center
+ 		  [email-masked]
+ 
+ The original header from prraster.c is reproduced below:
+ 
+ 
+    This filter converts Sun rasterfile to a format which
+    can be printed on HP printer and the HP laserjet
+ 
+    Tom Vijlbrief,  Dec 1987 ([email-masked] or uunet!mcvax!cogpsi!tom)
+ 
+ ***********************************************************************/
+ 
+ #include <rasterfile.h>         /* This will only compile on Suns! */
+ 
+ void
+ special(s)			/* process TeX \special{} string in s[] */
+ register char *s;
+ {
+     char line[MAXLINE+2];
+     FILE *specfile;
+     struct rasterfile header;
+     INT16 k;
+     int i;
+     int	n_lines;
+     int	n_bytes;
+     int	l_res = 300;
+ 
+ /***********************************************************************
+ The TeX \special{} command is expected to look like
+ 
+     \special{bitmap <filename>}
+ 
+ ***********************************************************************/
+ 
+     clearerr(plotfp);		/* VMS sets the error flag unexpectedly */
+ 
+     if ((strncmp("bitmap ",s,7) == 0))
+     {
+         k = 7;
+     }
+     else
+     {
+ 	NEWLINE(stderr);
+ 	(void)fprintf(stderr,
+ 	    "[TeX \\special{%s} not implemented in this driver]",s);
+ 	NEWLINE(stderr);
+ 	(void)fprintf(stderr,
+ 	    "Expected \\special{bitmap <filename>}");
+ 	NEWLINE(stderr);
+ 	(void)fprintf(stderr,
+             "\\special{%s} request ignored",s);
+ 	NEWLINE(stderr);
+ 	(void)fprintf(stderr,
+             "Current TeX page counters: [%s]",tctos());
+ 	NEWLINE(stderr);
+ 	return;
+     }
+     specfile = fopen(&s[k],"r");
+     DEBUG_OPEN(specfile,&s[k],"r");
+     if (specfile == (FILE *) NULL)
+     {
+ 	NEWLINE(stderr);
+ 	(void)fprintf(stderr,
+ 	    "Open failure on \\special file [%s]",&s[k]);
+ 	NEWLINE(stderr);
+ 	(void)fprintf(stderr,"\\special{%s} request ignored",s);
+ 	NEWLINE(stderr);
+ 	(void)fprintf(stderr,"Current TeX page counters: [%s]",tctos());
+ 	NEWLINE(stderr);
+ 	return;
+     }
+ 
+     (void)REWIND(specfile);		/* rewind file */
+ 
+     if ((fread(&header, sizeof(header), 1, specfile) != 1) ||
+ 	(header.ras_magic != 0x59a66a95))
+     {
+         NEWLINE(stderr);
+ 	(void)fprintf(stderr,
+ 	    "\\special file [%s] is not a valid Sun rasterfile", &s[k]);
+ 	NEWLINE(stderr);
+ 	(void)fprintf(stderr,"\\special{%s} request ignored",s);
+ 	NEWLINE(stderr);
+ 	(void)fprintf(stderr,"Current TeX page counters: [%s]",tctos());
+ 	NEWLINE(stderr);
+ 	return;
+     }
+     if ((header.ras_depth > 1) ||
+ 	(header.ras_maplength > 0) &&
+ 	(header.ras_maptype != RMT_NONE))
+     {
+         NEWLINE(stderr);
+ 	(void)fprintf(stderr,
+ 	    "\\special file [%s] is not a binary rasterfile", &s[k]);
+ 	NEWLINE(stderr);
+ 	(void)fprintf(stderr,"\\special{%s} request ignored",s);
+ 	NEWLINE(stderr);
+ 	(void)fprintf(stderr,"Current TeX page counters: [%s]",tctos());
+ 	NEWLINE(stderr);
+ 	return;
+     }
+ 
+     if (((n_bytes = (header.ras_width + 7) / 8)) & 1)
+         n_bytes++;                              /* even number of bytes */
+ 
+     NEWLINE(stderr);
+     (void)fprintf(stderr,"\t[\\special{%s}] ",s);
+     NEWLINE(stderr);
+ 
+     PUSH_CURSOR_POSITION;                       /* Here we go! */
+ 
+     BEGIN_RASTER_GRAPHICS;
+ 
+     for (n_lines = header.ras_height;
+ 	 (--n_lines >= 0) && fread(line, n_bytes, 1, specfile);)
+     {
+         TRANSFER_RASTER_GRAPHICS(n_bytes);
+ 
+ 	for (i = 0; i < n_bytes; i++)
+ 	    OUTC( (BYTE)line[i]);
+     }
+ 
+     END_RASTER_GRAPHICS;
+ 
+     POP_CURSOR_POSITION;                       /* Whew! That wasn't too bad */
+ 
+     if (n_lines >= 0)
+     {
+         NEWLINE(stderr);
+ 	(void)fprintf(stderr,
+ 	    "\\special file [%s] is too short", &s[k]);
+ 	NEWLINE(stderr);
+ 	(void)fprintf(stderr,"\\special{%s} request ignored",s);
+ 	NEWLINE(stderr);
+ 	(void)fprintf(stderr,"Current TeX page counters: [%s]",tctos());
+ 	NEWLINE(stderr);
+ 	return;
+     }
+ 
+     (void)fclose(specfile);
+     if (!quiet)
+     {
+ 	(void)fprintf(stderr," [OK]");
+ 	NEWLINE(stderr);
+     }
+     if (DISKFULL(plotfp))
+         (void)fatal("special():  Output error -- disk storage probably full");
+ }