Skip to main content
Skip table of contents

(v13) statusdict file and device operators


This page applies to Harlequin v13.1r0 and later; both Harlequin Core and Harlequin MultiRIP.

The filename operator

TEXT
        file scratch filename name openflag

filename is a RIP extension that returns on the stack the name of the file to which the file object file refers, including the name of its device. The name is written into a substring of the string scratch supplied to filename, and that substring is pushed onto the stack as name. (If scratch is not long enough, it generates a rangecheck error.) In addition, a Boolean result, openflag, is pushed on the stack that indicates whether (true) or not (false) file is open. 

For example, consider the following job, transmitted using a channel of the serial input plugin (named Line 1 in the Input Controller, formerly Input Manager, of the GUI version):

CODE
(fonts/Helvetica) (r) file dup closefile 
256 string statusdict /filename get exec == == 
% prints false and (%os%fonts/Helvetica) 
currentfile 256 string statusdict /filename get exec == == 
% prints true and (%ip:Line 1%)

The filekind operator

TEXT
 file scratch filename name openflag

filekind is a RIP extension which returns on the stack the name type, indicating the type of the file object file. In addition, a Boolean result, openflag, is pushed on the stack that indicates whether (true) or not (false) file is open.

type is a name, one of the following: 15 Nov (pm): RESTART HERE...still 9.7.1 13.0r1 (pdf page 236)

realfile

file is a real file as opened with the file operator on an ordinary device. Note that this does not indicate that the file is actually a file on the operating system’s file system.

editfile

file is or was open on one of the pseudo-devices %lineedit% or %statementedit% —see (v13) Pseudo-devices.

filterfile

file is a filter, as opened with the filter operator.

stdfile

file is or was open on one of the pseudo-devices %stdin%, %stdout%, or %stderr% —see (v13) Pseudo-devices.

For example:

CODE
(%stdout%)(w) file statusdict /filekind get exec == ==
% prints true and /stdfile 
currentfile /NullEncode filter statusdict /filekind get exec == == 
% prints true and /filterfile

file filelinenumber line true

file filelinenumber false

If it can, filelinenumber, a RIP extension, returns an integer line on the stack, the number of lines (Including the partial current line) read so far from the file object file, and the value true. If it cannot, it just returns false. To be successful, the following must be the case:

  • file must not be a filter.
  • file must be open for reading.
  • The system parameter CountLines must have been set to true , which is not the default, since before the file was opened. This allows the RIP to count lines as files are read, but slows down interpretation significantly, especially when processing large images.

If file has been repositioned using setfileposition, the line number returned is the number of lines that have actually been read, not the line number at which the file is positioned. Also, the notion of lines is not very meaningful if file contains any binary data. A line is delimited by any of the line delimiters allowed in PostScript language: carriage return, linefeed, or carriage return immediately followed by linefeed (see [RB2], Section 3.8). The binary image data frequently contains such characters as part of the binary data; these are counted towards the line number total.

The main purpose of this operator is to aid debugging. For example, consider typing the following at the executive:

TEXT
            << /CountLines true /Password 0 >> setsystemparams
            /bad (%C%BAD.PS) (r) file def % file which generates an error 
            bad cvx exec % produces the error, but does not close the file
            /bad load statusdict /filelinenumber get exec pop ==

This would print the line number at which execution failed. However, note that this normally only gives a starting point for locating the failure, since it is likely to be in some procedure called (indirectly) from the line in question. (pstack is also likely to be useful at this point.)

Normally the scanner has advanced to the next line by the time a faulty token at the end of a line has been executed. However, filelinenumber takes this into account so the line number will be correct, even in this case.

The setstdio operator

rfile wfile setstdio -

The setstdio operator (an undocumented feature of most PostScript language compatible interpreters) associates the two file objects rfile (open for reading) and wfile (open for writing) with the pseudo-devices %stdin% and %stdout%, respectively. That is, opening a file on %stdin% or %stdout% and reading from or writing to it results in the file rfile or wfile being read or written.

setstdio is subject to save and restore. Note that the operands are file objects, not string file names.

See (v13) Pseudo-devices for more details.

The setstderr operator

wfile setstderr -

The setstderr operator is a RIP extension which associates the file wfile (open for writing) with the pseudo-device %stderr%. That is, opening a file on %stderr% and writing to it results in the file wfile being written.

setstderr is subject to save and restore. Note that the operand is a file object, not a string file name.

See (v13) Pseudo-devices for more details.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.