%!PS %%% From bloom-beacon!husc6!cmcl2!nrl-cmf!ames!pasteur!ucbvax!decvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!enea!liuida!andwi Fri Jan 29 03:30:47 EST 1988 %%% Article 330 of comp.lang.postscript: %%% Path: bloom-beacon!husc6!cmcl2!nrl-cmf!ames!pasteur!ucbvax!decvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!enea!liuida!andwi %%% >From: andwi@butterix.liu.se (Andreas Wickberg) %%% Newsgroups: comp.lang.postscript %%% Subject: PS reference %%% Message-ID: <707@butterix.liu.se> %%% Date: 26 Jan 88 17:33:13 GMT %%% Organization: CIS Dept, Univ of Linkoping, Sweden %%% Lines: 368 %%% %%% %%% Here is a PostScript reference chart a la Reference Manual. It's not %%% the first, but if nothing else it might serve as an example of how to %%% do formating in PostScript. %%% %%% I've only tried it with Swedish A4-size paper, you might need to %%% adjust the 120 -10 t in main. Notice there should be a blank line in %%% the end. %%% %%% --- cut here --- % pm.ps - PostScript short reference % (C) 1988 Andreas Wickberg % You may use this for non-profit, non-military purposes, % Sweden is a neutral country... /D { bind def } bind def /main { 120 -20 t /tblw 270 def /tbltop 790 def pschart /NewCenturySchlbk-Roman findfont [48 0 0 30 0 0] makefont setfont -140 42 m ( PostScript ) gsave 0 28 M 0 -40 L dup stringwidth L gsave stroke grestore 0 40 L closepath 0 setlinewidth stroke grestore gsave dup show grestore -1 -1 rmoveto 1 setgray show showpage } D /fsiz 8 def /ls 10 def /fntn /Helvetica findfont fsiz scalefont def /fn { fntn setfont } D /fntb /Helvetica-Bold findfont fsiz scalefont def /fb { fntb setfont } D /fnti /Helvetica-Oblique findfont fsiz scalefont def /fi { fnti setfont } D /fntx /Helvetica findfont fsiz .8 mul scalefont def /fx { fntx setfont } D /fnth /Helvetica findfont 12 scalefont def /fh { fnth setfont } D /ldef { load def } D /m /moveto ldef /M /rmoveto ldef /cp /currentpoint ldef /t /translate ldef /l /lineto ldef /L /rlineto ldef /c /curveto ldef /C /rcurveto ldef /s 100 string def /sp ( ) def /spw fb sp stringwidth pop def /pschart { 0 tbltop m /left true def { currentfile s readline { dup length 0 eq { pop -80 -10 M currentfile s readline not { pop exit } if fh show 0 cp exch pop 14 sub m } { ( ) search { exch pop exch (,) search { xp dup xsw spw add neg 0 M xsh pop exch fb sp show show sp show (:) search { fi gsave (If ) show dup show exch dup show exch 3 -1 roll (,) search not { quit } if xp fn xsh pop 3 1 roll grestore 0 ls neg M (If not ) show show show } if xp fn xsh } { quit } ifelse 0 cp exch pop ls sub dup 40 le { left { tblw 0 t } { tblw neg 0 t gsave showpage grestore } ifelse /left left not def pop tbltop } if m } { pop exit } ifelse } ifelse } { pop exit } ifelse } loop } D /xp { [ exch { (") search { 3 1 roll pop } { exit } ifelse } loop ] } D /xsh { /flg true def { flg { fn show } { 0 -2 M fx show 0 2 M } ifelse /flg flg not def } forall } D /xsw { /flg true def 0 exch { flg { fn stringwidth pop add } { fx stringwidth pop add } ifelse /flg flg not def } forall } D main Operand stack manipulation operators pop any,- exch any"1" any"2",any"2" any"1" dup any,any any copy any"1" .. any"n" n,any"1" .. any"n" any"1" .. any"n" index any"n" .. any"0" n,any"n" .. any"0" any"n" roll any"n-1" .. any"0" n j,any"(j-1) mod n" .. any"0" any"n-1" .. any"j mod n" clear # any"1" .. any"n",# count # any"1" .. any"n",# any"1" .. any"n" n mark -,mark cleartomark mark any"1" .. any"n",- counttomark mark obj"1" .. obj"n",mark obj"1" .. obj"n" n Arithmetic and math operators add num"1" num"2",num"3" div num"1" num"2",num"3" idiv int"1" int"2",int"3" mod int"1" int"2",reminder mul num"1" num"2",num"3" sub num"1" num"2",num"3" abs num"1",num"2" neg num"1",num"2" ceiling num"1",num"2" floor num"1",num"2" round num"1",num"2" truncate num"1",num"2" sqrt num"1",num"2" atan num den,angle cos angle,real sin angle,real exp base exponent,real ln num,real log num,real rand -,int srand int,- rrand -,int Array operators array int,arry [ -,mark ] mark obj"0" .. obj"n-1",array length array,int get array index,any put array index any,- getinterval array index count,subarry putinterval arry"1" index arry"2",- aload array,array"0" .. array"n-1" array astore any"0" .. any"n-1" array,arry copy array"1" array"2",subarray"2" forall array proc,- Dictionary operators dict int,dict length dict,int maxlength dict,int begin dict,- end -,- def key value,- load key,value store key value,- get dict key,any put dict key any,- known dict key,bool where key,found: dict true, false copy dict"1" dict"2",dict"2" forall dict proc,- errordict -,dict systemdict -,dict userdict -,dict currentdict -,dict countdictstack -,int dictstack array,subarray String operators string int,string length string,int get string index,int put string index int,- getinterval string index count,substring putinterval string"1" index string"2",- copy string"1" string"2",substring"2" forall string proc,- anchorsearch string seek,found: post match true, string false search string seek,found: post match pre true, string false token string,found: post any true, false Relational, boolean, and bitwise operators eq any"1" any"2",bool ne any"1" any"2",bool ge num"1"|string"1" num"2"|string"2",bool gt num"1"|string"1" num"2"|string"2",bool le num"1"|string"1" num"2"|string"2",bool lt num"1"|string"1" num"2"|string"2",bool and bool"1"|int"1" bool"2"|int"2",bool"3"|int"3" not bool"1"|int"1",bool"2"|int"2" or bool"1"|int"1" bool"2"|int"2",bool"3"|int"3" xor bool"1"|int"1" bool"2"|int"2",bool"3"|int"3" true -,true false -,false bitshift int"1" shift,int"2" Control operators exec any,- if bool proc,- ifelse bool proc"1" proc"2",- for init incr limit proc,- repeat count proc,- loop proc,- exit -,- stop -,- stopped any,bool countexecstack -,int execstack array,subarray quit -,- start -,- Type, attribute, and conversion operators type any,name cvlit any,any cvx any,any xcheck any,bool executeonly array|file|string,array|file|string noaccess array|dict|file|string,array|dict|file|string readonly array|dict|file|string,array|dict|file|string rcheck array|dict|file|string,bool wcheck array|dict|file|string,bool cvi num,int cvn string,name cvr num|string,real cvs any string,substring cvrs num radix string,substring File operators file string"1" string"2",file closefile file,- read file,end-of-file: byte true, false write file int,- readhexstring file string,substring bool writehexstring file string,- readstring file string,substring bool writestring file string,- readline file string,substring bool token file,found: any true, false bytesavailable file,int flush -,- flushfile file,- resetfile file,- status file,bool run string,- currentfile -,file print string,- = any,- stack # any"1" .. any"n",# any"1" .. any"n" == any,- pstack # any"1" any"n",# any"1" any"n" prompt -,- echo bool,- Virtual memory operators save -,save restore save,- vmstatus -,level used maximum Miscellaneous operators bind proc,proc null -,null usertime -,int version -,string Graphics state operators gsave -,- grestore -,- grestoreall -,- initgraphics -,- setlinewidth num,- currentlinewidth -,num setlinecap int,- currentlinecap -,int setlinejoin int,- currentlinejoin -,int setmiterlimit num,- curentmiterlimit -,num setdash array offset,- currentdash -,array offset setflat num,- currentflat -,num setgray num,- currentgray -,num sethsbcolor hue satur bright,- currenthsbcolor -,hue satur bright setrgbcolor red green blue,- currentrgbcolor -,red green blue setscreen frequency rotation proc,- currentscreen -,frequency rotation proc settransfer proc,- currenttransfer -,proc Coordinate system and matrix operators matrix -,matrix initmatrix -,- identmatrix matrix,matrix defaultmatrix matrix,matrix currentmatrix matrix,matrix setmatrix matrix,- translate t"x" t"y",- translate t"x" t"y" matrix,matrix scale s"x" s"y",- scale s"x" s"y" matrix,matrix rotate angle,- rotate angle matrix,matrix concat matrix,- concatmatrix matrix"1" matrix"2" matrix"3",matrix"3" transform x y,x' y' transform x y matrix,x' y' dtransform xd yd,xd' yd' dtransform xd yd matrix,xd' yd' itransform x' y',x y itransform x' y' matrix,x y idtransform xd' yd',xd yd idtransform xd' yd' matrix,xd yd invertmatrix matrix"1" matrix"2",matrix"2" Path construction operators newpath -,- currentpoint -,x y moveto x y,- rmoveto d"x" d"y",- lineto x y,- rlineto d"x" d"y",- arc x y r ang"1" ang"2",- arcn x y r ang"1" ang"2",- arcto x"1" y"1" x"2" y"2" r,xt"1" yt"1" xt"2" yt"2" curveto x"1" y"1" x"2" y"2" x"3" y"3",- rcurveto dx"1" dy"1" dx"2" dy"2" dx"3" dy"3",- closepath -,- flattenpath -,- reversepath -,- strokepath -,- charpath string bool,- clippath -,- pathbbox -,ll"x" ll"y" ur"x" ur"y" pathforall move line curve close,- initclip -,- clip -,- eoclip -,- Painting operators erasepage -,- fill -,- eofill -,- stroke -,- image width height bits/sample matrix proc,- imagemask width height invert matrix proc,- Device setup and output operators showpage -,- copypage -,- banddevice matrix width height proc,- framedevice matrix width height proc,- nulldevice -,- renderbands proc,- Character and font operators definefont key font,font findfont key,font scalefont font num,font' makefont font matrix,font' setfont font,- currentfont -,font show string,- ashow a"x" a"y" string,- widthshow c"x" c"y" char a"x" a"y" string,- awidthshow c"x" c"y" char a"x" a"y" string,- kshow proc string,- stringwidth string,w"x" w"y" FontDirectory -,dict StandardEncoding -,array Font cache operators cachestatus -,bsz bmx msz mmx csz cmx maxbits setcachedevice w"x" w"y" ll"x" ll"y" ur"x" ur"y",- setcharwidth w"x" w"y",- setcachelimit num,-