9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Russ Cox <rsc@swtch.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] pic
Date: Tue, 24 May 2011 12:22:49 -0400	[thread overview]
Message-ID: <BANLkTinKJTG1RnAwrvM8rXM7bKPM4DWN9g@mail.gmail.com> (raw)
In-Reply-To: <BANLkTikeF72zgdTYWhAuUieYO0m6WL4jAQ@mail.gmail.com>

>> Otherwise, I've found that it is always worth the time to
>> program the drawings (pic macros, postscript functions,
>> metapost, whatever), because then editing them is possible.
>
> out of interest, which of these do you use yourself by preference?

I don't think I have one that I would say I prefer,
but they're all preferable to using a WYSIWYG editor
and then having to go back and change all the diagrams
in the same way.

> http://2.bp.blogspot.com/_ZnVhQ3NyEx0/S4NfiL9UgZI/AAAAAAAAAB0/mW2hZr-Ay5k/s400/gorace4.png
>
> getting those curves right can't be that easy if you're working
> out the parameters manually, and doing the collision avoidance
> programmatically can't be too easy either...

This was pic, with copy-and-paste but only around 60 lines.
It's a one-off.

.sp
.PS
.fp 5 CW LucidaSansCW83
texty=0.015
dx=0.3
dy=0.3
"\X'PS 4 setlinewidth'"
"\f5"
rx=0.015

boxwid=0.4
boxht=0.15

IP: [
	Box: box ht 3*boxht
	line from 0.333<Box.sw,Box.nw> to 0.333<Box.se,Box.ne>
	line from 0.667<Box.sw,Box.nw> to 0.667<Box.se,Box.ne>
	Ptr: circle fill rad 0.01 at 0.167<Box.n,Box.s>
	"0" at 0.5<Box.n,Box.s>
	"7" at 0.833<Box.n,Box.s>
	"\s-2\fIptr \fP\s+2" rjust at 0.833<Box.sw,Box.nw>-(rx,texty)
	"\s-2\fIoff \fP\s+2" rjust at 0.5<Box.sw,Box.nw>-(rx,texty)
	"\s-2\fIlen \fP\s+2" rjust at 0.167<Box.sw,Box.nw>-(rx,texty)
]

JP: [
	Box: box ht 3*boxht
	line from 0.333<Box.sw,Box.nw> to 0.333<Box.se,Box.ne>
	line from 0.667<Box.sw,Box.nw> to 0.667<Box.se,Box.ne>
	Ptr: circle fill rad 0.01 at 0.167<Box.n,Box.s>
	"1" at 0.5<Box.n,Box.s>
	"2" at 0.833<Box.n,Box.s>
	"\s-2\fIptr \fP\s+2" rjust at 0.833<Box.sw,Box.nw>-(rx,texty)
	"\s-2\fIoff \fP\s+2" rjust at 0.5<Box.sw,Box.nw>-(rx,texty)
	"\s-2\fIlen \fP\s+2" rjust at 0.167<Box.sw,Box.nw>-(rx,texty)
] with .n at IP.s + (0, -0.5)

I: [
	Box: box ht 2*boxht invis
	"\X'PS 0.8 0.3 0.3 setrgbcolor 20 setlinewidth'" at Box
	box ht 2*boxht at Box
	"\X'PS 0 0 0 setrgbcolor 4 setlinewidth'" at Box
	box ht 2*boxht at Box

	line from Box.w to Box.e
	"\s-2\fIbase \fP\s+2" rjust at 0.25<Box.nw,Box.sw>-(rx,texty)
	"\s-2\fIcap \fP\s+2" rjust at 0.75<Box.nw,Box.sw>-(rx,texty)
	Base: circle fill rad 0.01 at 0.25<Box.n,Box.s>
	BaseData: "[1, 2, 3, 4, 5, 6, 7]" ljust at 0.25<Box.ne,Box.se>+(dx*2/3,0)
	"7" at 0.5<Box,Box.s>-(0,texty)
	line -> from Base to BaseData.w
] with .nw at IP.ne + (0.5,-0.25)

spline -> from IP.Ptr to I.Box.nw+(-0.2,0.2) to I.Box.nw
spline -> from JP.Ptr to JP.Ptr+(0.75,0) to I.Box.nw-(0.5,0.1) to I.Box.nw

"x := []int{1,2,3,4,5,6,7}" ljust "" at IP.Box.nw
"" "[]int" ljust at IP.Box.sw

"y := x[1:3]" ljust "" at JP.Box.nw
"" "[]int" ljust at JP.Box.sw
.PE

Steve said a load of complex diagrams, though, and for that
I think it's more important to be able to go back and
fix things.  The diagrams in the regexp articles are also
pic but with macros for drawing each kind of node.

	A: [ circa(b, 0, 0, , "\v'-0.02i'\*(q8", ) box invis ht 0.15 wid 0 ]
	B: [ circa(b, 0, 0, , "\v'-0.02i'\*(q9", ) box invis ht 0.15 wid 0 ]
with .n at A.s-(0,dy)
	S: [ circ(0, "", "\v'-0.02i'\*(q6,\*(q7", "") ] at 0.5<A.w,B.w>-(dx,0)
	SS: [ circa(a,1,0,"\*(q1,", "\v'-0.05i'\*(q2, \*(q3", )
	       circa(b,1,0,,"\v'-0.02i'\*(q4,\*(q5",) ] with .e at S.w
	F: [ final(0,,"\v'-0.02i'\*(qA", ) ] at 0.5<A.e,B.e>
	start(SS)
	spline -> from S.n up (dd-r) then right (dd-r) then to A.w
	spline -> from S.s down (dd-r) then right (dd-r) then to B.w
	spline -> from B.e-(dx,0) right (dx-dd+r) then right (dd-r) then to F.s
	spline -> from A.e-(dx,0) right (dx-dd+r) then right (dd-r) then to F.n
	"\f(CWa\fP" "" at A.w-(dx/2,0)
	"\f(CWb\fP" "" at B.w-(dx/2,0)

The diagrams in this paper were all hand-written PostScript.
http://publications.csail.mit.edu/lcs/pubs/pdf/MIT-LCS-TM-650.pdf

%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 105 80
%%DocumentNeededFonts: Times-Italic Helvetica-Bold
%%Pages: 1
%%EndComments

@include osdi2-ex.inc
10 I
10 30 translate
/skew 2 def
timecaption

gsave
10 -10 moveto
70 -10
70 -30 arcstart
10 -30 arccont arcfinish
lightgray fill
grestore

0 20 moveto (A) cshow right 4 timeline
	square arrowdown
	right square
	right square
	right square

0 0 moveto (B) cshow right 4 timeline
	right square
	right square arrowdown
	right square

0 -20 moveto (C) cshow right 4 timeline
	right right right square
%%Trailer
%%EOF


  parent reply	other threads:[~2011-05-24 16:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 22:56 Steve Simon
2011-05-23 23:05 ` Skip Tavakkolian
2011-05-23 23:19   ` Venkatesh Srinivas
2011-05-24  1:19 ` Iruatã Souza
2011-05-24  2:26 ` Anthony Sorace
2011-05-24 16:11   ` Anthony Sorace
2011-05-24  2:53 ` Russ Cox
2011-05-24 15:32   ` roger peppe
2011-05-24 15:48     ` simon softnet
2011-05-24 16:22     ` Russ Cox [this message]
2011-05-24  5:03 ` tlaronde
  -- strict thread matches above, loose matches on Subject: below --
2003-10-13 19:48 Skip Tavakkolian
2003-10-13 20:12 ` Russ Cox
2003-10-15  5:51 ` Charles Forsyth
2003-10-15  7:31   ` Skip Tavakkolian
2003-10-16 22:03     ` Charles Forsyth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTinKJTG1RnAwrvM8rXM7bKPM4DWN9g@mail.gmail.com \
    --to=rsc@swtch.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).