[comp.text] pic bug

stevens@hsi.UUCP (Richard Stevens) (04/15/88)

I've encountered the following bug in pic, and was wondering if
anyone has a fix.  I'm using the pic that came with DWB 2.0.

Arrows in pic that go straight down or straight up have the head
of the arrow shifted slightly to the left.  For example,

         |                               |
         |                               |
       \ | /                            \|  /
        \|/                              \ /

      correct           this is what the bug produces (exaggerated)

The bug appears to be in the latest AT&T Release (i.e., DWB 2.0),
as I've found, [see also p. 345 of Bach "The Design of the UNIX
Operating System"] but was fixed sometime in Version 8 [see p. 313
of Kernighan and Pike for the bug, but see also p. 111 of Bentley's
"Programming Pearls" for a fixed version] and is fixed in Version 9
[see p. 173 of "The AWK Programming Language" by A. K. and W.].

Does anyone have a fix ??  Thanks.

	Richard Stevens
	Health Systems International, New Haven, CT
           { uunet | ihnp4 } ! hsi ! stevens

bb@wjh12.harvard.edu (Brent Byer) (04/15/88)

In article <921@hsi.UUCP> stevens@hsi.UUCP (Richard Stevens) writes:
>I've encountered the following bug in pic, and was wondering if
>anyone has a fix.  I'm using the pic that came with DWB 2.0.
>
>Arrows in pic that go straight down or straight up have the head
>of the arrow shifted slightly to the left.  For example,
>
>         |                               |
>         |                               |
>       \ | /                            \|  /
>        \|/                              \ /
>
>      correct           this is what the bug produces (exaggerated)

 ( I believe you will find the glitch factor to be even worse
   on angled shafts. )
The bug is not really in pic; anal analysis of pic's output
will show it to be correct.  So, the problem is actually
in some combination of ditroff and your post-processor.

>The bug appears to be in the latest AT&T Release (i.e., DWB 2.0),
>as I've found, [see also p. 345 of Bach "The Design of the UNIX
>Operating System"] but was fixed sometime in Version 8 [see p. 313
>of Kernighan and Pike for the bug, but see also p. 111 of Bentley's
>"Programming Pearls" for a fixed version] and is fixed in Version 9
>[see p. 173 of "The AWK Programming Language" by A. K. and W.].

The above observations appear valid, but because of the *actual*
nature of the problem, it may very well not have been fixed at all.

>Does anyone have a fix ??  Thanks.

Since Textware endeavors to deliver high-quality software to a
hopefully fussy audience, we have fixed this (and quite a few
other pic-related doo-dahs) in our Tplus product.  Remember, just
because a vendor *advertises* "full support for pic" doesn't mean they
are capable of delivering.

It's because of this tighter-than-you-thought inter-relationship of
{ pre-processors, formatter, and post-processor } that we recommend
that users get the entire set-up from a single (binary?) source.
Otherwise, support for a problem like this can be a futile nightmare.

> Richard Stevens
> Health Systems International, New Haven, CT { uunet | ihnp4 } ! hsi ! stevens

	Brent Byer   { ihnp4!ihesa , harvard!cca } !textware!brent
	Textware Intl.
	PO 14 - Harv Sq
	Cambridge, MA 02238
	  (617) 864-8398 (uni-text)

	"Leaners don't count, in typesetting."

jay@unm-la.UUCP (Jay Plett) (04/19/88)

In article <197@wjh12.harvard.edu>, bb@wjh12.harvard.edu (Brent Byer) writes:
> In article <921@hsi.UUCP> stevens@hsi.UUCP (Richard Stevens) writes:
> >I've encountered the following bug in pic, and was wondering if
> >anyone has a fix.  I'm using the pic that came with DWB 2.0.

   [ description of problem with misaligned arrowheads in pic output ]

> The bug is not really in pic; anal analysis of pic's output
> will show it to be correct.  So, the problem is actually
> in some combination of ditroff and your post-processor.

  [ commercial message deleted ]

> It's because of this tighter-than-you-thought inter-relationship of
> { pre-processors, formatter, and post-processor } ...
>        ... support for a problem like this can be a futile nightmare.

Can you please elaborate on this inter-relationship?
Each of the elements in your list (preprocessor, formatter,
postprocessor) is nothing more nor less than a translator.
If the input to one of them is correct, then either its
output is correct or else it contains a bug.  Where is there
an inter-relationship?  If one of the translators produces
incorrect output and depends on its successor to correct its
error, this might be deemed an "inter-relationship".  Trying
to make such relationships work correctly all the time would
indeed be a futile nightmare.  Better to fix the bug in the
first place, no?  What am I overlooking?

With older versions of pic there was the problem of device
dependencies.  But the DWB 2.0 pic outputs all motions and
dimensions in inches so it is device independent.  As a quick
check, I just ran through my pic an input file which produces
vertical and oblique lines with arrowheads at both ends.  I
ran the resulting output through 4 different versions of
ditroff (including DWB 2.0), and each of those through 4
separate postprocessors from 4 different vendors.  Not a
misaligned arrowhead in the bunch.
-- 
	Jay Plett
	UUCP:	{cmcl2,ihnp4}!lanl!unm-la!jay
		{ucbvax,gatech}!unmvax!unm-la!jay
	ARPA:	jxyp@lanl.gov

bb@wjh12.harvard.edu (Brent Byer) (04/19/88)

In article <720@unm-la.UUCP> jay@unm-la.UUCP (Jay Plett) writes:
>In article <197@wjh12.harvard.edu>, bb@wjh12.harvard.edu (Brent Byer) writes:
>> In article <921@hsi.UUCP> stevens@hsi.UUCP (Richard Stevens) writes:
>> >I've encountered the following bug in pic, and was wondering if
>> >anyone has a fix.  I'm using the pic that came with DWB 2.0.
>
>> >[ description of problem with misaligned arrowheads in pic output ]
>
>> The bug is not really in pic; anal analysis of pic's output
>> will show it to be correct.  So, the problem is actually
>> in some combination of ditroff and your post-processor.
>
>> ... It's because of this tighter-than-you-thought inter-relationship ...
>
>Can you please elaborate on this inter-relationship?

I wouldn't want to deprive you of the joy of discovery. :-) * 0.4999

>What am I overlooking?

A very small, but quite significant detail.

>...  I just ran through my pic an input file which produces
>vertical and oblique lines with arrowheads at both ends.  I
>ran the resulting output through 4 different versions of
>ditroff (including DWB 2.0), and each of those through 4
>separate postprocessors from 4 different vendors.  Not a
>misaligned arrowhead in the bunch.

Either you did not examine the output very closely, or
you were lucky in your choice of input file.

I suggest you create a more "random" pic input file.  Try this:

	.PS
	for i = 1 to 10 do X
	arrow down
	move up
	move right .357i
	X
	.PE

Since the problem will exist with any combination of ditroff
and post-processor, just choose one combo (to save time and resources).
Examine the resulting hard-copy carefully.  Once you notice the
discrepancy, work backwards examining the post-processor output file
and the ditroff output file.

Be warned that when you do discover the answer, the resulting flash
will be very bright; sunglasses may be advised. :-)

Another caution: the problem is generic to (but not in) pic,
not arrowheads specifically.  There is *no* perfect solution,
but some are (acceptably) more perfect than others.

[ Enjoy the challenge, Jay.   Dinner in six months? ]

	brent byer

hutch@lzaz.ATT.COM (R.HUTCHISON) (04/22/88)

In article <197@wjh12.harvard.edu>, bb@wjh12.harvard.edu (Brent Byer) writes:
[ In article <921@hsi.UUCP> stevens@hsi.UUCP (Richard Stevens) writes:
[ [I've encountered the following bug in pic, and was wondering if
[ [anyone has a fix.  I'm using the pic that came with DWB 2.0.
[ [
[ [Arrows in pic that go straight down or straight up have the head
[ [of the arrow shifted slightly to the left.  For example,
[ [
[ [         |                               |
[ [         |                               |
[ [       \ | /                            \|  /
[ [        \|/                              \ /
[ [
[ [      correct           this is what the bug produces (exaggerated)
[  [STUFF DELETED]
[ The bug is not really in pic; anal analysis of pic's output
[ will show it to be correct.  So, the problem is actually
> in some combination of ditroff and your post-processor.
> 

I've encountered the same problem but I don't think it is in the
postprocessor.  I say this because the same problem occurs when using
different postprocessors (PostScript, Imagen, proof).  If the pic output
is correct, then this would lead me to believe that it must be troff's
fault.  Just a thought.