[mod.computers.laser-printers] transcript/pstext

Rudy.Nedved@H.CS.CMU.EDU.UUCP (01/09/87)

Hi. I don't know if this list is still active or not. We will see.

Anyhow, I have been occasionally looking at transcript problems because
of complaints of unprinted or garbaled files. At this point, I am even
thinking about changing the pscomm reader to cause the program to exit with
a failure if it receives a %%[ Error: .... ]%% so people will get notes
indicating their output was incompletely printed under 4.3BSD lpd.

Currently there is a race condition in the initial status check. If the
receiver starts up faster then the sender in pscomm you will occasionally
get "longjmp botch". In addition, old output from powerups and delayed
control-T's may confuse the initial status check and abort output. The
pscomm program should flush the input buffer on the async line before
creating the listener. I have not made any changes in either of these
two areas for fear of not understanding the situation completely...but
at least someone else will know what I have seen and believe to be a fix.

The primary purpose of this message is to report a bug in pstext. This
is the entity in Transcript v2 that converts a text file, one without
the leading "%!", into a PostScript file. If there is a possibility of
generating a blankpage, the resulting PostScript file will not work and
will get an "Error: undefined; Offending command: sv". The deal is that
a file is started with the prolog which defines StartPage and EndPage and
StartPage which is used at the beginning of a page defines "sv". When an
empty page occurs, the StartPage macro is not invoked which in turn does
not define the "sv" macro, when the EndPage macro which uses but does not
define "sv" is invoked, the error occurs.

The pstext code has a few variables: donepage, lineno and blankpage. When
a form feed is hit lineno is set to the length of the page. Later when
dumping a line out, if the line is blank and the first one and the one before
a formfeed (we read in while loading up the line) then the count for lineno
will exceed the length of page since it is incremented and will output a
EndPage macro independent of the state of donepage. The fix is to add a
test before the EndPage is output and before the page count is incremented
(npage) that outputs the standard StartPage string including the Page: 
comment.

Cheers,
-Rudy