-*- coding: raw-text -*- (setq last-kbd-macro (kbd ". M-\\ DEL ")) Operand stack manipulation operators ==================================== any pop - discard top element any1 any2 exch any2 any1 exchange top two elements any dup any any duplicate top element any1..anyn n copy any1..anyn any1..anyn duplicate top n elements anyn..any0 n index anyn..any0 anyn duplicate arbitrary element a(n-1)..a0 n j roll a(j-1%n)..a0 a(n-1)..a(j%n) roll n elements up j times any1..anyn clear discard all elements any1..anyn count any1..anyn n count elements on stack - mark mark push mark on stack mark obj1..objn cleartomark - discard elements down through mark mark obj1..objn counttomark mark obj1..objn n count elements down to mark Arithmetic and math operators ============================= num1 num2 add sum num1 plus num2 num1 num2 div quotient num1 divided by num2 int1 int2 idiv quotient integer divide int1 int2 mod remainder int1 mod int2 num1 num2 mul product num1 times num2 num1 num2 sub difference num1 minus num2 num1 abs num2 absolute value of num1 num1 neg num2 negative of num1 num1 ceiling num2 ceiling of num1 num1 floor num2 floor of num1 num1 round num2 round num1 to nearest integer num1 truncate num2 remove fractional part of num1 num sqrt real square root of num num den atan angle arctangent of num/den in degrees angle cos real cosine of angle (degrees) angle sin real sine of angle (degrees) base exponent exp real raise base to exponent power num ln real natural logarithm (base e) num log real logarithm (base 10) - rand int generate pseudo-random integer int srand - set random number seed - rrand int return random number seed Array operators =============== int array array create array of length int - [ mark start array construction mark obj0..obj(n-1) ] array end array construction array length int number of elements in array array index get any get array element indexed by index array index any put - put any into array at index array index count getinterval subarray subarray of array starting at index for count elements array1 index array2 putinterval - replace subarray of array1 starting at index by array2 array aload a0..a(n-1) array push all elements of array on stack any0..any(n-1) array astore array pop elements from stack into array array1 array2 copy subarray2 copy elements of array1 to initial subarray of array2 array proc forall - execute proc for each element of array Dictionary operators ==================== int dict dict create dictionary with capacity for int ele- ments dict length int number of key-value pairs in dict dict maxlength int capacity of dict dict begin - push dict on dict stack - end - pop dict stack key value def - associate key and value in current dict key load value search dict stack for key and return associ- ated value key value store - replace topmost definition of key dict key get any get value associated with key in dict dict key value put - associate key with value in dict dict key known bool test whether key is in dict key where dict true or false find dict in which key is defined dict1 dict2 copy dict2 copy contents of dict1 to dict2 dict proc forall - execute proc for each element of dict - errordict dict push errordict on operand stack - systemdict dict push systemdict on operand stack - userdict dict push userdict on operand stack - currentdict dict push current dict on operand stack - countdictstack int count elements on dict stack array dictstack subarray copy dict stack into array String operators ================ int string string create string of length int string length int number of elements in string string index get int get string element indexed by index string index int put - put int into string at index string index count getinterval substring substring of string starting at index for count elements string1 index string2 putinterval - replace substring of string1 starting at index by string2 string1 string2 copy substring2 copy elements of string1 to initial substring of string2 string proc forall - execute proc for each element of string string seek anchorsearch post match true or string false determine if seek is initial substring of string string seek search post match pre true or string false search for seek in string string token post token true or false read token from start of string Relational, boolean, and bitwise operators ========================================== any1 any2 eq bool test equal any1 any2 ne bool test not equal num1|str1 num2|str2 ge bool test greater or equal num1|str1 num2|str2 gt bool test greater than num1|str1 num2|str2 le bool test less or equal num1|str1 num2|str2 lt bool test less than bool1|int1 bool2|int2 and bool3|int3 logical | bitwise and bool1|int1 not bool2|int2 logical | bitwise not bool1|int1 bool2|int2 or bool3|int3 logical | bitwise inclusive or bool1|int1 bool2|int2 xor bool3|int3 logical | bitwise exclusive or - true true push boolean value true - false false push boolean value false int1 shift bitshift int2 bitwise shift of int1 (positive is left) Control operators ================= any exec - execute arbitrary object bool proc if - execute proc if bool is true bool proc1 proc2 ifelse - execute proc1 if bool is true, proc2 if bool is false init incr limit proc for - execute proc with values from init by steps of incr to limit int proc repeat - execute proc int times proc loop - execute proc an indefinite number of times - exit - exit innermost active loop - stop - terminate stopped context any stopped bool establish context for catching stop - countexecstack int count elements on exec stack array execstack subarray copy exec stack into array - quit - terminate interpreter - start - executed at interpreter startup Type, attribute, and conversion operators ========================================= any type name return name identifying any's type any cvlit any make object be literal any cvx any make object be executable any xcheck bool test executable attribute array|file|string executeonly array|file|string reduce access to execute-only array|dict|file|string noaccess array|dict|file|string disallow any access array|dict|file|string readonly array|dict|file|string reduce access to read-only array|dict|file|string rcheck bool test read access array|dict|file|string wcheck bool test write access num|string cvi int convert to integer string cvn name convert to name num|string cvr real convert to real num radix string cvrs substring convert to string with radix any string cvs substring convert to string File operators ============== string1 string2 file file open file identified by string1 with access string2 file closefile - close file file read int true or false read one character from file file int write - write one character to file file string readhexstring substring bool read hex from file into string file string writehexstring - write string to file as hex file string readstring substring bool read string from file file string writestring - write characters of string to file file string readline substring bool read line from file into string file token token true or false read token from file file bytesavailable int number of bytes available to read - flush - send buffered data to standard output file file flushfile - send buffered data or read to EOF file resetfile - discard buffered characters file status bool return status of file string run - execute contents of named file - currentfile file return file currently being executed string print - write characters of string to standard output file any = - write text representation of any to standard output file any1 .. anyn stack any1 .. anyn print stack nondestructively using = any == - write syntactic representation of any to standard output file any1 .. anyn pstack any1 .. anyn print stack nondestructively using == - prompt - executed when ready for interactive input bool echo - turn on/off echoing Virtual memory operators ======================== - save save create VM snapshot save restore - restore VM snapshot - vmstatus level used maximum report VM status Miscellaneous operators ======================= proc bind proc replace operator names in proc by operators - null null push null on operand stack - usertime int return time in milliseconds - version string interpreter version Graphics state operators ======================== - gsave - save graphics state - grestore - restore graphics state - grestoreall - restore to bottommost graphics state - initgraphics - reset graphics state parameters num setlinewidth - set line width - currentlinewidth num return current line width int setlinecap - set shape of line ends for stroke (0=butt, 1=round, 2=square) - currentlinecap int return current line cap int setlinejoin - set shape of corners for stroke (0=miter, 1=round, 2=bevel) - currentlinejoin int return current line join num setmiterlimit - set miter length limit - currentmiterlimit num return current miter limit array offset setdash - set dash pattern for stroking - currentdash array offset return current dash pattern num setflat - set flatness tolerance - currentflat num return current flatness num setgray - set color to gray value from 0 (black) to 1 (white) - currentgray num return current gray hue sat brt sethsbcolor - set color given hue, saturation, brightness - currenthsbcolor hue sat brt return current color hue, saturation, brightness red green blue setrgbcolor - set color given red, green, blue - currentrgbcolor red green blue return current color red, green, blue freq angle proc setscreen - set halftone screen - currentscreen freq angle proc return current halftone screen proc settransfer - set gray transfer function - currenttransfer proc return current transfer function Coordinate system and matrix operators ====================================== - matrix matrix create identity matrix - initmatrix - set CTM to device default matrix identmatrix matrix fill matrix with identity transform matrix defaultmatrix matrix fill matrix with device default matrix matrix currentmatrix matrix fill matrix with CTM matrix setmatrix - replace CTM by matrix tx ty translate - translate user space by (tx, ty) tx ty matrix translate matrix define translation by (tx, ty) sx sy scale - scale user space by sx and sy sx sy matrix scale matrix define scaling by sx and sy angle rotate - rotate user space by angle degrees angle matrix rotate matrix define rotation by angle degrees matrix concat - replace CTM by matrix × CTM matrix1 matrix2 matrix3 concatmatrix matrix3 fill matrix3 with matrix1 × matrix2 xy transform x' y' transform (x, y) by CTM x y matrix transform x' y' transform (x, y) by matrix dx dy dtransform dx' dy' transform distance (dx, dy) by CTM dx dy matrix dtransform dx' dy' transform distance (dx, dy) by matrix x' y' itransform x y inverse transform (x ', y ') by CTM x' y' matrix itransform x y inverse transform (x ', y ') by matrix dx' dy' idtransform dx dy inverse transform distance (dx ', dy ') by CTM dx' dy' matrix idtransform dx dy inverse transform distance (dx ', dy ') by matrix matrix1 matrix2 invertmatrix matrix2 fill matrix2 with inverse of matrix1 Path construction operators =========================== - newpath - initialize current path to be empty - currentpoint xy return current point coordinate xy moveto - set current point to (x, y) dx dy rmoveto - relative moveto xy lineto - append straight line to (x, y) dx dy rlineto - relative lineto x y r ang1 ang2 arc - append counterclockwise arc x y r ang1 ang2 arcn - append clockwise arc x1 y1 x2 y2 r arcto xt1 yt1 xt2 yt2 append tangent arc x1 y1 x2 y2 x3 y3 curveto - append Bezier cubic section dx1 dy1 dx2 dy2 dx3 dy3 rcurveto - relative curveto - closepath - connect subpath back to its starting point - flattenpath - convert curves to sequences of straight lines - reversepath - reverse direction of current path - strokepath - compute outline of stroked path string bool charpath - append character outline to current path - clippath - set current path to clipping path - pathbbox llx lly urx ury return bounding box of current path move line curve close pathforall - enumerate current path - initclip - set clip path to device default - clip - establish new clipping path - eoclip - clip using even-odd inside rule Painting operators ================== - erasepage - paint current page white - fill - fill current path with current color - eofill - fill using even-odd rule - stroke - draw line along current path width height bits/sample matrix proc image - render sampled image onto current page width height invert matrix proc imagemask - render mask onto current page Device setup and output operators ================================= - showpage - output and reset current page - copypage - output current page matrix width height proc banddevice - install band buffer device matrix width height proc framedevice - install frame buffer device - nulldevice - install no-output device proc renderbands - enumerate bands for output to device Character and font operators ============================ key font definefont font register font as a font dictionary key findfont font return font dict identified by key font scale scalefont font' scale font by scale to produce new font ' font matrix makefont font' transform font by matrix to produce new font ' font setfont - set font dictionary - currentfont font return current font dictionary string show - print characters of string on page ax ay string ashow - add (ax, ay) to width of each char while showing string cx cy char string widthshow - add (cx, cy) to width of char while showing string x cy char ax ay string awidthshow - combined effects of ashow and widthshow proc string kshow - execute proc between characters shown from string string stringwidth wx wy width of string in current font - FontDirectory dict dictionary of font dictionaries - StandardEncoding array standard font encoding vector Font cache operators ==================== - cachestatus bsize bmax msize mmax csize cmax blimit return cache status and parameters wx wy llx lly urx ury setcachedevice - declare cached character metrics w x wy setcharwidth - declare uncached character metrics num setcachelimit - set max bytes in cached character Errors ====== dictfull no more room in dictionary dictstackoverflow too many begins dictstackunderflow too many ends execstackoverflow exec nesting too deep handleerror called to report error information interrupt external interrupt request (e.g., control-C) invalidaccess attempt to violate access attribute invalidexit exit not in loop invalidfileaccess unacceptable access string invalidfont invalid font name or dict invalidrestore improper restore ioerror input/output error occurred limitcheck implementation limit exceeded nocurrentpoint current point is undefined rangecheck operand out of bounds stackoverflow operand stack overflow stackunderflow operand stack underflow syntaxerror syntax error in POSTSCRIPT program text timeout time limit exceeded typecheck operand of wrong type undefined name not known undefinedfilename file not found undefinedresult over/underflow or meaningless result unmatchedmark expected mark not on stack unregistered internal error VMerror VM exhausted