%!PS %From ut-ngp!ut-sally!topaz!ll-xn!nike!ucbcad!ucbvax!ulowell.UUCP!ckatsaou %Sat Jul 5 11:53:39 CDT 1986 % % % Here's a pocket-sized PostScript reference manual. It is not detailled %but hopefully a handy reminder for most of the PostScript operators' syntax. %Its format is: % % (operator) argument argument >> result left on the operant stack % %(It is not explanatory - I had to keep it short otherwise it wouldn't be % pocket-sized) % %The manual's source code is in PostScript & it comes in two parts: one for % each side of the output page. % % Comments & corrections will be appreciated. % % Thanks, % Chris Katsaounis % % % ********************************************************************** % -- S I D E A -- % ********************************************************************** % ********************* PAGE #1 *************************** % ******************************************************************* gsave 30 20 translate 90 rotate newpath 0 0 moveto 235 0 lineto 1 setlinewidth stroke /Times-Bold findfont 11 scalefont setfont 3 3 moveto (1) show /Times-Italic findfont 7.5 scalefont setfont 138 3 moveto (PostScript Reference List) show % ********************************************************************* grestore gsave 30 20 translate 90 rotate 0 0 moveto /ln {show /Times-Bold findfont 7 scalefont setfont currentpoint exch pop 9 sub 0 exch moveto} def /tab {show /Times-Roman findfont 7 scalefont setfont currentpoint exch pop 85 exch moveto} def /Times-Bold findfont 7 scalefont setfont currentpoint exch pop 9 sub 0 exch moveto % ******************** LIST OF COMMANDS ************************* (abs) tab ( num >> |num| )ln (add) tab (num1 num2 >> \(num1+num2\)) ln (aload) tab (array >> elem1..elem2.. array)ln (anchorsearch) tab ( string seek >> found: spost smatch true)ln ( ) tab ( not found: string false)ln (and) tab ( a b >> aANDb \(bitwise if a,b are integers\))ln (arc) tab (x y r ang1 ang2 >> --)ln (arcn) tab (x y r ang1 ang2 >> --)ln (arcto) tab (x1 y1 x2 y2 r >> xt1 yt1 xt2 yt2)ln (array) tab (int >> arry-of-size-int)ln (ashow) tab (ax ay string >> --)ln (astore) tab (elem1..elem2.. arry-size >> arry\[elem1..elem2\])ln (atan) tab (a b >> angle-whose-tang-is-(a/b))ln (awidthshow) tab (ax ay string >> --)ln (begin) tab (dict >> --)ln (bitshift)tab (int shift >> int-shifted \(right: +, left: -\))ln (bytesavailable) tab (file >> int \(-1 if cannot be determ\))ln (cachestatus) tab (-- >> bsize bmax msize mmax csize cmax maxbits)ln (ceiling) tab (number >> least-integ-grtr-than-or-eq-to)ln (charpath) tab (string strokepath-bool >> --)ln (clear) tab (a..b..c.. >> ....)ln (cleartomark) tab (mark a..b..c.. >> --)ln (clip) tab (-- >> --)ln (clippath) tab (-- >> --)ln (closefile) tab ( file >> --)ln (closepath) tab (-- >> --)ln (concat) tab (matrix >> --)ln (concatmatrix) tab (mtrx1 mtrx2 mtrx3 >> mtrx3 \(=mtrx1*mtrx2\))ln (copy) tab (a..b..c.. int >> a..b..c.. a..b..c.. \(top -int- elem\))ln (copypage) tab (-- >> --)ln (cos) tab (a >> cosine\(a\))ln (count) tab (a..b..c.. >> a..b..c..count)ln (countdictstack) tab (-- >> count)ln (countexecstack) tab (-- >> count)ln (counttomark) tab (mark a..b..c.. >> mark a..b..c..count)ln (currentdash) tab (-- >> array offset)ln (currentdict) tab (-- >> dict)ln (currentfile) tab (-- >> file)ln (currentflat) tab (-- >> number)ln (currentfont) tab (-- >> font-dict)ln (currentgray) tab (-- >> number)ln (currenthsbcolor) tab (-- >> hue satur bright)ln (currentlinecap) tab (-- >> integer)ln (currentlinejoin) tab (-- >> integer)ln (currentlinewidth) tab (-- >> number)ln (currentmatrix) tab (matrix >> CTM-matrix)ln % ***************************************************************** % ********** PAGE #2 ************** % ***************************************************************** grestore gsave 30 280 translate 90 rotate newpath 0 0 moveto 235 0 lineto 1 setlinewidth stroke /Times-Bold findfont 11 scalefont setfont 3 3 moveto (2) show /Times-Italic findfont 7.5 scalefont setfont 138 3 moveto (PostScript Reference List) show % ********************************************************************* grestore gsave 30 280 translate 90 rotate 0 0 moveto % ********************************************************************** /Times-Bold findfont 7 scalefont setfont currentpoint exch pop 9 sub 0 exch moveto % ******************************************************************** (curentmiterlimit) tab (-- >> number)ln (currentpoint) tab (-- >> x y)ln (currentrgbcolor) tab (-- >> red green blue)ln (currentscreen) tab (-- >> freq rot spot-funct)ln (currenttransfer) tab (-- >> gray-tansf-funct)ln (curveto) tab (x0 y0 x1 y1 x2 y2 >> --)ln (cvi) tab (num >> integ or strng >> int)ln (cvlit) tab (a >> literal \(not-exec\))ln (cvn) tab (string >> name)ln (cvr) tab (num >> real)ln (cvrs) tab (num base string >> substring)ln (cvs) tab (a string >> substring)ln (cvx) tab (a >> executable)ln (def) tab (key value >> --)ln (defaultmatrix) tab (matrix >> def-matrix)ln (definefont) tab (key dict >> font-dict)ln (dict) tab (int >> dict \(maximum-capacity: int\))ln (dictstack) tab (array >> subarray)ln (div) tab (num1 num2 >> \(num1/num2\))ln (dtransform) tab (xd yd >> xdt ydt)ln ( ) tab (or xd yd matrix >> xdt ydt)ln (dup) tab (a >> a a)ln (echo) tab (bool >> --)ln (end) tab (-- >> --)ln (eoclip) tab (-- >> --)ln (eofill) tab (-- >> --)ln (eq) tab (a b >> bool \(true if a=b)ln (erasepage) tab (-- >> --)ln (exch) tab (a b >> b a)ln (exec) tab (a >> --)ln (execstack) tab (array >> subarray)ln (executeonly) tab (arry >> exec-only-arry \(or string\))ln (exit) tab (-- >> --)ln (exp) tab (num1 num2 >> num1-to-the-num2-pwr)ln (false) tab (-- >> false)ln (file) tab (string1 string2 >> file \(str2: r, w\))ln (fill) tab (-- >> --)ln (findfont) tab (key >> font-dict)ln (flattenpath) tab (-- >> --)ln (floor) tab (number >> greatest-int-less-than-or-eq-to)ln (flush) tab (-- >> --)ln (flushfile) tab (file >> --)ln (for) tab (init incr limit proc >> --)ln (forall) tab (array proc >> elem1..elem2.. \(& executes proc\))ln (framedevice) tab ( mtrx wid height proc >> --)ln (ge) tab (num1 num2 >> bool \(true if num1>=num2\))ln % ***************************************************************** % ********** PAGE #3 ************** % ***************************************************************** grestore gsave 30 540 translate 90 rotate newpath 0 0 moveto 235 0 lineto 1 setlinewidth stroke /Times-Bold findfont 11 scalefont setfont 3 3 moveto (3) show /Times-Italic findfont 7.5 scalefont setfont 138 3 moveto (PostScript Reference List) show % ********************************************************************* grestore gsave 30 540 translate 90 rotate 0 0 moveto % ********************************************************************** /Times-Bold findfont 7 scalefont setfont currentpoint exch pop 9 sub 0 exch moveto % ********************************************************************** (get) tab (array index >> element)ln (getinterval) tab (arry beg len >> subarry)ln (grestore) tab (-- >> --)ln (grestoreall) tab (-- >> --)ln (gsave) tab (-- >> --)ln (gt) tab (num1 num2 >> bool \(true if num1>num2\))ln (identmatrix) tab (matrix >> id-transf-mtrx)ln (idiv) tab (int1 int2 >> int-part-of\(int1/int2\))ln (idtransform) tab (xdt ydt >> xd yd \(xdt ydt mtrx >> xd yd\))ln (if) tab (bool proc >> --)ln (ifelse) tab (bool proc1 proc2 >> --)ln (image) tab (scan-len scan-lns bits/pixl mtrx proc >> --)ln (imagemask) tab (scan-len scan-lns invrt mtrx proc >> --)ln (index) tab (a1..a2..a3...ak t >> a1..a2..a3..ak a\(k-t\))ln (initclip) tab (-- >> --)ln (initgraphics) tab (-- >> --)ln (initmatrix) tab (-- >> --)ln (invertmatrix) tab (mtrx1 mtrx >> mtrx \(contents-of-mtrx1-inverted\))ln (itransform) tab (xt yt >> x y \(xt yt mtrx >> x y\))ln (known) tab (dict key >> bool)ln (kshow) tab (proc strinng >> --)ln (le) tab (num1 num2 >> bool \(true if num1<=num2\))ln (length) tab (array >> length-of-arry)ln (lineto) tab (x y >> --)ln (ln) tab (num >> natural-logar-of-num)ln (load) tab (key >> value)ln (log) tab (num >> common-logar-of-num)ln (loop) tab (proc >> --)ln (lt) tab (num1 num2 >> bool \(true if num1> transformed-font-dict)ln (mark) tab (-- >> mark)ln (matrix) tab (-- >> matrix)ln (maxlength) tab (dict >> int)ln (mod) tab (int1 int2 >> int1MODint2)ln (moveto) tab (x y >> --)ln (mul) tab (num1 num2 >> num1*num2)ln (ne) tab (num1 num2 >> bool \(false if num1=num2\))ln (neg) tab (num >> -num)ln (newpath) tab (-- >> --)ln (not) tab (a >> NOTa \(bitwise if a is integer\))ln (null) tab (-- >> null)ln (nulldevice) tab (-- >> --)ln (or) tab (a b >> aORb \(bitwise if a,b are integers\))ln (pathbbox) tab (-- >> lo-left-x lo-le-y upr-rgt-x upr-rgt-y)ln (pathforall) tab (mveto-proc lneto-proc crveto-proc clsepth-proc >> --)ln (pop) tab (a >> --)ln showpage % ********************************************************************** % END OF SIDE A % ********************************************************************** % ******************************************************************** % -- S I D E B -- % ******************************************************************** % ****************************************************************** % C O V E R P A G E % ****************************************************************** /box {newpath 0 0 moveto 240 0 lineto 240 100 lineto 0 100 lineto closepath }def /hor {newpath 0 0 moveto 750 0 lineto } def /ver { newpath 0 0 moveto 0 950 lineto } def gsave 440 530 translate 90 rotate .4 setlinewidth 1 1 100 { hor stroke 0 5 translate } for grestore gsave 440 530 translate 90 rotate .4 setlinewidth 1 1 80 { ver stroke 5 0 translate } for % *********************************************************** grestore gsave 420 540 translate 90 rotate box .75 setgray fill grestore gsave 390 550 translate 90 rotate /Times-Bold findfont [45 0 0 90 0 0] makefont setfont 0 0 moveto (PostScript)show grestore gsave 350 755 translate 90 rotate /Times-Bold findfont [9 0 0 18 0 0] makefont setfont 0 0 moveto (TM) show grestore gsave 410 550 translate 90 rotate /Times-Bold findfont [12 0 0 14 0 0] makefont setfont 0 0 moveto (Reference List)show grestore gsave 140 530 translate 90 rotate /Helvetica-Bold findfont [40 0 30 sin 30 cos div 90 mul 90 0 0] makefont setfont .15 setgray 0 0 moveto (ULowell) show grestore gsave 165 565 translate 90 rotate /Helvetica findfont [15 0 -30 sin -30 cos div 30 mul 30 0 0] makefont setfont 0 0 moveto .10 setgray (CS Department) show % ***************************************************************** % ********** PAGE #4 ************** % ***************************************************************** grestore gsave 30 20 translate 90 rotate newpath 0 0 moveto 235 0 lineto 1 setlinewidth stroke /Times-Bold findfont 11 scalefont setfont 3 3 moveto (4) show /Times-Italic findfont 7.5 scalefont setfont 138 3 moveto (PostScript Reference List) show % ********************************************************************* grestore gsave 30 20 translate 90 rotate 0 0 moveto % ********************************************************************** /ln {show /Times-Bold findfont 7 scalefont setfont currentpoint exch pop 9 sub 0 exch moveto} def /tab {show /Times-Roman findfont 7 scalefont setfont currentpoint exch pop 85 exch moveto} def /Times-Bold findfont 7 scalefont setfont currentpoint exch pop 9 sub 0 exch moveto % ********************************************************************** (print) tab (string >> --)ln (prompt) tab (-- >> --)ln (pstack) tab (a..b..c.. >> --)ln (put) tab (array index value >> --)ln (putinterval) tab (arry1 beg arry2 >> arry1)ln (quit) tab (-- >> --)ln (rand) tab (-- >> int)ln (rcheck) tab (array >> bool \(true if readable\))ln (rcurveto) tab (dx0 dy0 dx1 dy1 dx2 dy2 >> --)ln (read) tab (file >> byte bool \(false if EOF\))ln (readhexstring) tab (file string >> substring bool)ln (readline) tab (file string >> substring bool)ln (readonly) tab (array >> ReadOnly-array)ln (readstring) tab (file string >> substr bool \(false if EOF\))ln (repeat) tab (count proc >> --)ln (restore) tab (save-objct >> --)ln (reversepath) tab (-- >> --)ln (rlineto) tab (dx dy >> --)ln (rmoveto) tab (dx dy >> --)ln (roll) tab (a..b..c.. N R >> a..b..c.. \(top N elems rolled by R\))ln (rotate) tab (angle >> -- \(or, angle mtrx >> mtrx\))ln (round) tab (num >> num-rounded)ln (rrand) tab (-- >> current-random-nr-seed-state)ln (run) tab (string >> --)ln (save) tab (-- >> save-object)ln (scale) tab (sx sy >> -- or sx sy mtrx >> mtrx)ln (scalefont) tab (font-dict number >> transformed-font-dict)ln (search) tab (string seek-string >> ) () tab ( if found: post-str match-str pre-str true)ln () tab ( not found: string false)ln (setcachedevice) tab (wx wy llx lly urx ury >> --)ln (setcachelimit) tab (maxbytes >> --)ln (setcharwidth) tab (wx wy >> --)ln (setdash) tab (array offset >> --)ln (setflat) tab (num >> --)ln (setfont) tab (font-dict >> --)ln (setgray) tab (num >> --)ln (sethsbcolor) tab (hue satur bright >> --)ln (setlinecap) tab (integer >> --)ln (setlinejoin) tab (integer >> --)ln (setlinewidth) tab (num >> --)ln (setmatrix) tab (matrix >> --)ln (setmiterlimit) tab (num >> --)ln (setrgbcolor) tab (red green blue >> --)ln (setscreen) tab (freq rotation spot-function >> --)ln (showpage) tab (-- >> --)ln % ***************************************************************** % ********** PAGE #5 ************** % ***************************************************************** grestore gsave 30 280 translate 90 rotate newpath 0 0 moveto 235 0 lineto 1 setlinewidth stroke /Times-Bold findfont 11 scalefont setfont 3 3 moveto (5) show /Times-Italic findfont 7.5 scalefont setfont 138 3 moveto (PostScript Reference List) show % ********************************************************************* grestore gsave 30 280 translate 90 rotate 0 0 moveto % ********************************************************************** /Times-Bold findfont 7 scalefont setfont currentpoint exch pop 9 sub 0 exch moveto % ********************************************************************** (settransfer) tab (gray-transfer-funct >> --)ln (show) tab (string >> --)ln (sin) tab (num >> sine\(num\))ln (sqrt) tab (num >> square-root-of-num)ln (srand) tab (int >> --)ln (stack) tab (a..b..c.. >> a..b..c..)ln (start) tab (-- >> --)ln (status) tab (file >> bool \(true if open\))ln (stop) tab (-- >> --)ln (stopped) tab (a >> bool \(false if a was terminated normaly\))ln (store) tab (key value >> --)ln (string) tab (int >> string)ln (stringwidth) tab (string >> wx wy)ln (stroke) tab (-- >> --)ln (strokepath) tab (-- >> --)ln (sub) tab (num1 num2 >> num1-num2)ln (systemdict) tab (-- >> system-dict)ln (token) tab (file >> bool \(true if found\))ln (token) tab (string >> if found: s-post token true)ln ( ) tab ( not found: false)ln (transform) tab (x y >> xt xy or x y mtrx >> xt yt)ln (translate) tab (tx ty >> -- or tx ty mtrx >> mtrx)ln (true) tab (-- >> true)ln (truncate) tab (num >> num-truncated)ln (type) tab (a >> type-name-of-a)ln (userdict) tab (-- >> user-dict)ln (usertime) tab (-- >> time-in-msecs)ln (version) tab (-- >> soft-&-hard-version-string)ln (vmstatus) tab (-- >> level-of-save bytes-used total-bytes-avail)ln (wcheck) tab (array >> bool \(if writeable: true\))ln (where) tab (key >> if found: dict true)ln ( ) tab ( not found: false)ln (widthshow) tab (dx dy char-code string >> --)ln (write) tab (file byte >> --)ln (writehexstring) tab (file strig >> --)ln (writestring) tab (file string >> --)ln (xcheck) tab (a >> bool \(true if a is executable\))ln (xor) tab (a b >> aXORb \(bitwise if a,b are integers\))ln (=) tab (a..b..c.. >> --)ln (==) tab (a..b..c.. >> --)ln % ************************************************************************ grestore gsave newpath 450 0 moveto 450 900 lineto .5 setlinewidth stroke /Helvetica-Bold findfont 7 scalefont setfont 470 350 moveto 90 rotate (CUT ALONG THIS LINE)show grestore gsave newpath 453 530 moveto 950 530 lineto .5 setlinewidth stroke newpath 453 260 moveto 950 260 lineto .5 setlinewidth stroke /Helvetica-Bold findfont 7 scalefont setfont 460 540 moveto (FOLD ALONG THIS LINE) show grestore gsave /Helvetica-Bold findfont 7 scalefont setfont 460 270 moveto (FOLD ALONG THIS LINE) show showpage % ********************************************************************** % END OF SIDE B % **********************************************************************