Please consider a donation to the Higher Intellect project. See https://preterhuman.net/donate.php or the Donate to Higher Intellect page for more info. |
Postscript symbols
Jump to navigation
Jump to search
Postscript symbols [ - [ mark pushes a mark object on the operand stack (see mark). The customary use of the [ operator is to mark the beginning of an indefinitely long sequence of objects that will eventually be formed into a new array object by the ] operator. ERRORS: stackoverflow SEE ALSO: ], mark, array, astore --------------------------------------------------------------------------- --------------------------------------------------------------------------- ] mark obj0 ... objn-1 ] array creates a new array of n elements, where n is the number of elements above the topmost mark on the operand stack; stores those elements into the array; and returns the array on the operand stack. The ] operator stores the topmost object from the stack into element n-1 of array and the bottommost one (the one immediately above the mark) into element 0 of array. It removes all the array elements from the stack, as well as the mark object. The array is allocated in local or global VM according to the current VM allocation mode. An invalidaccess error occurs if the array is in global VM and any of obj0 ... objn-1 are in local VM. EXAMPLE: [5 4 3] -> % a 3-element array, with elements 5, 4, 3 mark 5 4 3 counttomark array astore exch pop -> [5 4 3] [1 2 add] -> % a 1-element array, with element 3 The second line of the example has the same effect as the first, but uses lowerlevel array and stack manipulation primitives instead of [ and ] In the last line of the example, note that the PostScript interpreter acts on all of the array elements as it encounters them (unlike its behavior with the {...} syntax for executable array construction) so the add operator is executed before the array is constructed. ERRORS: stackoverflow, unmatchedmark, VMerror SEE ALSO: [, mark, array, astore --------------------------------------------------------------------------- --------------------------------------------------------------------------- << - << mark LEVEL 2 pushes a mark object on the operand stack (same as mark and [ operators). ERRORS: stackoverflow SEE ALSO: >>, mark --------------------------------------------------------------------------- --------------------------------------------------------------------------- >> mark key1 value1 ... keyn valuen >> dict LEVEL 2 creates and returns a dictionary containing the specified key-value pairs. The operands are a mark followed by an even number of objects, which the operator uses alternately as keys and values to be inserted into the dictionary. The dictionary is allocated space for precisely the number of key-value pairs supplied. The dictionary is allocated in local or global VM according to the current VM allocation mode. An invalidaccess error occurs if the dictionary is in global VM and any keys or values are in local VM. A rangecheck error occurs if there is an odd number of objects above the topmost mark on the stack. >> is equivalent to: counttomark 2 idiv dup dict begin {def} repeat pop currentdict end EXAMPLE: << /Duplex true /PageSize [612 792] /Collate false >> setpagedevice This example constructs a dictionary containing three key-value pairs, which it immediately passes to the setpagedevice operator. ERRORS: invalidaccess, rangecheck, unmatchedmark, VMerror SEE ALSO: <<, mark, dict --------------------------------------------------------------------------- --------------------------------------------------------------------------- = any = - pops an object from the operand stack, produces a text representation of that object's value, and writes the result followed by a newline character to the standard output file. The text is that produced by the cvs operator; thus, = prints the value of a number, boolean, string, name, or operator object and prints --nostringval-- for an object of any other type. The name = is not special. In PostScript language programs it must be delimited by white space or special characters the same as names composed of alphabetical characters. The value of = is not an operator, but rather a built-in procedure. ERRORS: stackunderflow SEE ALSO: ==, stack, cvs, print, flush --------------------------------------------------------------------------- --------------------------------------------------------------------------- == any == - pops an object from the operand stack, produces a text representation of that object followed by a newline character, and writes the result to the standard output file. == attempts to produce a result that resembles the PostScript syntax for creating the object. It precedes literal names by /, brackets strings with (...), and expands the values of arrays and packed arrays and brackets them with [...] or {...}. For an object with no printable representation, == produces the name of its type in the form -mark- or -dict-. For an operator object, it produces the operator's name in the form --add--. The name == is not special. In PostScript language programs it must be delimited by white space or special characters the same as names composed of alphabetical characters. The value of == is not an operator, but rather a built-in procedure. The == operator is intended for convenience in debugging. The details of how == formats its output are intentionally unspecified. A program requiring detailed control over output format should do its own formatting explicitly, using lowerlevel operators, such as cvs. Also, and writeobject (Level 2 features) may be more suitable for generating machine-readable output. ERRORS: stackunderflow SEE ALSO: =, print, pstack, flush --------------------------------------------------------------------------- --------------------------------------------------------------------------- $error - $error dict pushes the dictionary object $error on the operand stack . $error is not an operator; it is a name in systemdict associated with the dictionary object. ERRORS: stackoverflow SEE ALSO: errordict ---------------------------------------------------------------------------