[comp.lang.postscript] is this PostScript from fig2dev OK or not?

cca13@seq1.keele.ac.uk (G.D. Pratt) (09/25/90)

Hi,
I've been using xfig v2.0 to create a diagram and whenever I convert
the *.fig file to a *.ps file via f2ps or with the latest version of
transfig I get this error from the PostScript printer (Agfa PS400) 

> psif: seq1:gerry ps start - Mon Sep 24 16:28:26 1990
> %%[ Error: undefinedresult; OffendingCommand: arcto ]%%
> %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
> psif: end - Mon Sep 24 16:29:31 1990

*but* when I preview it with ralpage or GhostScript 2.0 it's OK.
Is this PostScript right or wrong? I've included a very
shortened version of the PostScript which displays the same symptom:-
Any help welcome in this my darkest hour -):

------------------------------------------------------------------------

%!
%%Title: stdin
%%Creator: fig2dev
%%CreationDate: Mon Sep 24 16:19:52 1990
%%For: gerry@ccsun1 (gerry pratt)
%%Pages: 1
%%BoundingBox: 54 234 558 558
%%EndComments
/$F2psDict 32 dict def $F2psDict begin	$F2psDict /mtrx matrix put
	end	/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def	/$F2psEnd {$F2psEnteredState restore end} def	%%EndProlog
$F2psBegin
1 setlinecap 1 setlinejoin
-54.000000 666.000000 translate 0.900 -0.900 scale
1.000 setlinewidth
	[4.000000] 0 setdash
% Polyline
newpath 302 388 moveto 295 388 295 391 7 arcto 4 {pop} repeat 295 398 306 398 7 arcto 4 {pop} repeat 313 398 313 395 7 arcto 4 {pop} repeat 313 388 302 388 7 arcto 4 {pop} repeat closepath stroke
% Polyline
newpath 302 379 moveto 295 379 295 381 7 arcto 4 {pop} repeat 295 388 306 388 7 arcto 4 {pop} repeat 313 388 313 386 7 arcto 4 {pop} repeat 313 379 302 379 7 arcto 4 {pop} repeat closepath stroke
% Polyline
newpath 239 321 moveto 232 321 232 321 7 arcto 4 {pop} repeat 232 328 244 328 7 arcto 4 {pop} repeat 251 328 251 328 7 arcto 4 {pop} repeat 251 321 239 321 7 arcto 4 {pop} repeat closepath stroke
% Polyline
newpath 239 310 moveto 232 310 232 314 7 arcto 4 {pop} repeat 232 321 244 321 7 arcto 4 {pop} repeat 251 321 251 317 7 arcto 4 {pop} repeat 251 310 239 310 7 arcto 4 {pop} repeat closepath stroke
% Polyline
newpath 162 237 moveto 155 237 155 238 7 arcto 4 {pop} repeat 155 245 167 245 7 arcto 4 {pop} repeat 174 245 174 244 7 arcto 4 {pop} repeat 174 237 162 237 7 arcto 4 {pop} repeat closepath stroke
% Polyline
newpath 162 222 moveto 155 222 155 226 7 arcto 4 {pop} repeat 155 233 167 233 7 arcto 4 {pop} repeat 174 233 174 229 7 arcto 4 {pop} repeat 174 222 162 222 7 arcto 4 {pop} repeat closepath stroke
newpath 149 211 moveto 149 211 lineto stroke
showpage
$F2psEnd
-- 
gerry pratt - workstation support - university of keele
email: cca13@uk.ac.keele.seq1 * tel: 0782 621111 x 3290

glenn@heaven.woodside.ca.us (Glenn Reid) (09/26/90)

In article <637@keele.keele.ac.uk> cca13@seq1.keele.ac.uk (G.D. Pratt) writes:
>Hi,
>I've been using xfig v2.0 to create a diagram and whenever I convert
>the *.fig file to a *.ps file via f2ps or with the latest version of
>transfig I get this error from the PostScript printer (Agfa PS400) 
>
>> psif: seq1:gerry ps start - Mon Sep 24 16:28:26 1990
>> %%[ Error: undefinedresult; OffendingCommand: arcto ]%%
>> %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
>> psif: end - Mon Sep 24 16:29:31 1990

I get the same error on my NeXT.  Upon inspection of the file, there
are a few instances where the X1,Y1 and X2,Y2 points passed to arcto
are identical.  It is these cases that raise the "undefinedresult"
error, which may be a divide by zero in computing the arctangent.

Here is a little redefinition for "arcto" which filters out the problem
cases and changes their values slightly.  It caused your example
program to start working, at least:

	/*arcto /arcto load def
	/arcto {
	    5 copy pop 3 -1 roll eq 3 1 roll eq and { %if
		exch 1 add exch 3 -1 roll 1 sub 3 1 roll
	    } if
	    *arcto
	} bind def

If you put this somewhere in the beginning of the file, after the
comments, it should "fix" the problem, although it is a hack.  If
the arguments to "arcto" are identical, it adds 1 to the Y value
and subtracts 1 from the X value of the second point :-)

/Glenn

-- 
 Glenn Reid				RightBrain Software
 glenn@heaven.woodside.ca.us		PostScript/NeXT developers
 ..{adobe,next}!heaven!glenn		415-851-1785
Newsgroups: comp.lang.postscript,comp.graphics,comp.windows.x
Subject: Re: is this PostScript from fig2dev OK or not?
Summary: 
Expires: 
References: <637@keele.keele.ac.uk>
Sender: 
Reply-To: glenn@heaven.woodside.ca.us (Glenn Reid)
Followup-To: 
Distribution: 
Organization: RightBrain Software, Woodside, CA
Keywords: PostScript xfig v2.0 pl8 transfig fig2dev arcto

In article <637@keele.keele.ac.uk> cca13@seq1.keele.ac.uk (G.D. Pratt) writes:
>Hi,
>I've been using xfig v2.0 to create a diagram and whenever I convert
>the *.fig file to a *.ps file via f2ps or with the latest version of
>transfig I get this error from the PostScript printer (Agfa PS400) 
>
>> psif: seq1:gerry ps start - Mon Sep 24 16:28:26 1990
>> %%[ Error: undefinedresult; OffendingCommand: arcto ]%%
>> %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
>> psif: end - Mon Sep 24 16:29:31 1990

I get the same error on my NeXT.  Upon inspection of the file, there
are a few instances where the X1,Y1 and X2,Y2 points passed to arcto
are identical.  It is these cases that raise the "undefinedresult"
error, which may be a divide by zero in computing the arctangent.

Here is a little redefinition for "arcto" which filters out the problem
cases and changes their values slightly.  It caused your example
program to start working, at least:

	/*arcto /arcto load def
	/arcto {
	    5 copy pop 3 -1 roll eq 3 1 roll eq and { %if
		exch 1 add exch 3 -1 roll 1 sub 3 1 roll
	    } if
	    *arcto
	} bind def

If you put this somewhere in the beginning of the file, after the
comments, it should "fix" the problem, although it is a hack.  If
the arguments to "arcto" are identical, it adds 1 to the Y value
and subtracts 1 from the X value of the second point :-)

/Glenn

-- 
 Glenn Reid				RightBrain Software
 glenn@heaven.woodside.ca.us		PostScript/NeXT developers
 ..{adobe,next}!heaven!glenn		415-851-1785

nbladt@aut.UUCP (Norbert Bladt) (09/26/90)

cca13@seq1.keele.ac.uk (G.D. Pratt) writes:

>Hi,
>I've been using xfig v2.0 to create a diagram and whenever I convert
>the *.fig file to a *.ps file via f2ps or with the latest version of
>transfig I get this error from the PostScript printer (Agfa PS400) 

>> psif: seq1:gerry ps start - Mon Sep 24 16:28:26 1990
>> %%[ Error: undefinedresult; OffendingCommand: arcto ]%%
>> %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
>> psif: end - Mon Sep 24 16:29:31 1990

>*but* when I preview it with ralpage or GhostScript 2.0 it's OK.
>Is this PostScript right or wrong? I've included a very
>shortened version of the PostScript which displays the same symptom:-

I saw the same problems with laser printers connected to a VMS
system. The printers can be configured to, e.g., 80 characters
per line (or 132). Now, Postscript is a progamming language
and not simply text to print ! So, if long lines get truncated (or wrapped,
which doesn't matter in this case) the result is an illegal
Postscript program ! I didn't count the number of characters up to
your "arcto" command, but isn't it possible ?

(This is just speculation:
What about a stupid PS Interpreter cutting off lines at 80 (or
whatever fixed number) of columns ?
>Any help welcome in this my darkest hour -):
Hope this helps.

[PS example deleted]
Norbert Bladt.
-- 
Please use this path as return address. DON'T USE THE RETURN PATH IN THE HEADER
Norbert Bladt, Ascom Autelca AG, Worbstr. 201, CH-3073 Guemligen, Switzerland
Phone: +41 31 52 92 14
EMail: ..!uunet!mcsun!chx400!hslrswi!bladt

envbvs@epb2.lbl.gov (Brian V. Smith) (09/26/90)

In article <805@aut.UUCP>, nbladt@aut.UUCP (Norbert Bladt) writes:
|> cca13@seq1.keele.ac.uk (G.D. Pratt) writes:
|> 
|> >Hi,
|> >I've been using xfig v2.0 to create a diagram and whenever I convert
|> >the *.fig file to a *.ps file via f2ps or with the latest version of
|> >transfig I get this error from the PostScript printer (Agfa PS400) 
|> 
|> >> psif: seq1:gerry ps start - Mon Sep 24 16:28:26 1990
|> >> %%[ Error: undefinedresult; OffendingCommand: arcto ]%%
|> >> %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
|> >> psif: end - Mon Sep 24 16:29:31 1990
|> 
|> >*but* when I preview it with ralpage or GhostScript 2.0 it's OK.
|> >Is this PostScript right or wrong? I've included a very
|> >shortened version of the PostScript which displays the same symptom:-
|> 
|> I saw the same problems with laser printers connected to a VMS
|> system. The printers can be configured to, e.g., 80 characters
|> per line (or 132). Now, Postscript is a progamming language
|> and not simply text to print ! So, if long lines get truncated (or wrapped,
|> which doesn't matter in this case) the result is an illegal
|> Postscript program ! I didn't count the number of characters up to
|> your "arcto" command, but isn't it possible ?
|> 
|> (This is just speculation:
|> What about a stupid PS Interpreter cutting off lines at 80 (or
|> whatever fixed number) of columns ?
|> >Any help welcome in this my darkest hour -):
|> Hope this helps.

I have emailed the solution to Mr. Pratt.
The problem is that he has drawn an arc-box with zero width AND height.
The postscript command that is generated from that object will give
undefined results.

--
Brian V. Smith    (bvsmith@lbl.gov)
Lawrence Berkeley Laboratory
I don't speak for LBL; they don't pay me enough for that.