[net.text] TranScript bug

jjhnsn@ut-ngp.UTEXAS (J. Lee Johnson) (10/29/85)

In laser-lovers, ned%UPenn-Grasp%upenn.csnet@CSNET-RELAY.arpa says:
> 
> We've just started using TranScript here, and we seem to have found an
> annoying bug in psdit. The last word in the file isn't output! ...
> It seems like a buffer flushing problem, and we could probably fix it, but
> we're pretty surprised to have found it.

He's correct, there is a buffer flushing problem in psdit. There are also
some integer divisions where psdit truncates rather than rounds. The
following is a diff file to correct these problems. Use "patch" to
apply it to psdit.c.
--
James Lee Johnson, U.T. Computation Center, Austin, Texas 78712
ARPA:  jjhnsn@ut-ngp.UTEXAS.EDU
UUCP:  ihnp4!ut-ngp!jjhnsn  allegra!ut-ngp!jjhnsn  gatech!ut-ngp!jjhnsn
       seismo!ut-sally!jjhnsn  harvard!ut-sally!jjhnsn
#
#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar:	Shell Archiver
#	Run the following text with /bin/sh to create:
#	psdit.patch
# This archive created: Mon Oct 28 13:33:19 1985
echo shar: extracting psdit.patch '(2393 characters)'
sed 's/^XX//' << \SHAR_EOF > psdit.patch
XX*** psdit.c.dist	Fri Jul  5 11:28:57 1985
XX--- psdit.c	Mon Oct 28 12:35:24 1985
XX***************
XX*** 85,90
XX  #define ErrorTolerance 100
XX  #define PSWID 0x00000FFF
XX  #define ISPSPROC 0x000FF000
XX  
XX  /* we maintain PS coords with 16 times the precision */
XX  /* current PS state is: */
XX
XX--- 85,91 -----
XX  #define ErrorTolerance 100
XX  #define PSWID 0x00000FFF
XX  #define ISPSPROC 0x000FF000
XX+ #define PSscale(x)	((x)+2250)/4500  /* equiv. to  ( x*16 / 72000 ) +0.5 */
XX  
XX  /* we maintain PS coords with 16 times the precision */
XX  /* current PS state is: */
XX***************
XX*** 816,821
XX  
XX  private t_trailer()
XX  {
XX      printf("\n%%%%Trailer\n");
XX      printf("xt\n");
XX  }
XX
XX--- 817,823 -----
XX  
XX  private t_trailer()
XX  {
XX+     FlushShow();FlushFont();MoveTo();DoMove();
XX      printf("\n%%%%Trailer\n");
XX      printf("xt\n");
XX  }
XX***************
XX*** 905,911
XX  	pswid = psinfo & PSWID;
XX  	if ((psinfo & ISPSPROC) && (psinfo != -1)) {
XX  	    showspecial (s, code, pswid);
XX! 	    PSx += (pswid * fontsize * 16 * dres) / (72 * 1000);
XX  	}
XX  	else {
XX  	    showchar (code);
XX
XX--- 907,913 -----
XX  	pswid = psinfo & PSWID;
XX  	if ((psinfo & ISPSPROC) && (psinfo != -1)) {
XX  	    showspecial (s, code, pswid);
XX! 	    PSx += PSscale(pswid * fontsize * dres);
XX  	}
XX  	else {
XX  	    showchar (code);
XX***************
XX*** 910,916
XX  	else {
XX  	    showchar (code);
XX  	    if (pswid > 0) {
XX! 		PSshowlen += (pswid * fontsize * 16 * dres) / (72 * 1000);
XX  	    }
XX  	}
XX      }
XX
XX--- 912,918 -----
XX  	else {
XX  	    showchar (code);
XX  	    if (pswid > 0) {
XX! 	        PSshowlen += PSscale(pswid * fontsize * dres);
XX  	    }
XX  	}
XX      }
XX***************
XX*** 919,925
XX  	pswid = psinfo & PSWID;
XX  	if ((psinfo & ISPSPROC) && (psinfo != -1)) {
XX  	    showspecial (s, code, pswid);
XX! 	    PSx += (pswid * fontsize * 16 * dres) / (72 * 1000);
XX  	}
XX  	else {
XX  	    showchar (code);
XX
XX--- 921,927 -----
XX  	pswid = psinfo & PSWID;
XX  	if ((psinfo & ISPSPROC) && (psinfo != -1)) {
XX  	    showspecial (s, code, pswid);
XX! 	    PSx += PSscale(pswid * fontsize * dres);
XX  	}
XX  	else {
XX  	    showchar (code);
XX***************
XX*** 924,930
XX  	else {
XX  	    showchar (code);
XX  	    if (pswid > 0) {
XX! 		PSshowlen += (pswid * fontsize * 16 * dres) / (72 * 1000);
XX  	    }
XX  	}
XX      }
XX
XX--- 926,932 -----
XX  	else {
XX  	    showchar (code);
XX  	    if (pswid > 0) {
XX! 	        PSshowlen += PSscale(pswid * fontsize * dres);
XX  	    }
XX  	}
XX      }
SHAR_EOF
if test 2393 -ne "`wc -c psdit.patch`"
then
echo shar: error transmitting psdit.patch '(should have been 2393 characters)'
fi
#	End of shell archive
exit 0