Apple 310 manual Immediately Evaluated Names

Page 53

C H A P T E R 2

LaserWriter Select 310 Software

The second way to create a packed array is to build it explicitly by invoking the packedarray operator with a list of operands to be incorporated into a new packed array.

Immediately Evaluated Names

The PostScript language syntax has been extended to include a new kind of name token, the immediately evaluated name. When the scanner encounters the token //name,

(a name preceded by two slashes with no intervening spaces), it immediately looks up the name in the context of the current dictionary stack and substitutes the corresponding value for the name. If the name is not found, an undefined error occurs.

The substitution occurs immediately, regardless of whether or not the token appears inside an executable array delimited by {...}.

Note

This process is a substitution and not an execution. This means the name’s value is not executed but is substituted for the name itself, just as if the load operator had been applied to the name.

This substitution is related to the action performed by the bind operator. See the PostScript Language Reference Manual for further information. However, while bind substitutes only for those names with values that are operators, each occurrence of the //name syntax is replaced by the value associated with name, regardless of the value’s type. The following examples illustrate this.

/a 3 def

/b {(test) print} def //a =>3

//b => {(test) print}

{//a//b a /b}=> {3 {(test) print} a /b

Using immediately evaluated names serves a similar purpose to using the bind operator. That is, it causes names in procedures to be tightly bound to their values.

W AR N I N G

Indiscriminate use of immediately evaluated names may change the semantics of a program.

Specifically, when the interpreter encounters a procedure object directly, it simply pushes it onto the operand stack. When it encounters an object indirectly, by looking up an executable name, it executes the procedure. Therefore, execution of the program fragments {...b...} and {...//b...} may have different effects if the name of b is a procedure. See Section 3.6 of the PostScript Language Reference Manual, second edition, for further information.

The immediately evaluated name facility is present in all versions of the PostScript interpreter since version 25.0. Earlier versions of the interpreter will scan //name as two distinct tokens: / as a literal name with no text at all, and /name as a literal name with the text name.

PostScript Language Changes

41

Image 53
Contents Apple LaserWriter Select 310 Printer Limited Warranty on Media and Replacement Contents Page Communication Channels Page Figures and Tables Page What This Note Contains About This NoteOther Reference Material Conventions Used in This NoteApda For More InformationPage LaserWriter Select Hardware1 LaserWriter Select 310 Hardware ROM Serial Port for RS-232C Devices Communication Ports2An 8-pin serial port connector Centronics Parallel ConnectorPstrobe Signal Status Lights ROM Capability Memory CapabilitiesDram Expansion Batch ModeBasic Operation Types Interactive ModePaper Handling 7Paper handling options Page LaserWriter Select 310 Software PostScript Interpreter Software OverviewAdobe PostScript Programming Language Types LaserWriter Select 310 DriverSelects the paper tray containing A4-size paper and sets Product Strings Software ParametersCommunication Device Parameters Compatibility OperatorsStatusdict Setting Compatibility Operators Device Checkpassword Setting System ParametersDefaulttimeouts IdlefontsProduct PrinternameProductA RamsizeSetidlefonts SetdefaulttimeoutsSetpassword Defaultmultipurposetraysize Setting Page Device ParametersDefaultpapertray SetprinternameManualfeed ManualfeedtimeoutMargins PagestackorderPapertray SetdefaultmultipurposepapertraysizePapersize Setmargins SetdefaultpapertraySetdostartpage Setpapertray SetpagestackorderSetpagetype Jobtimeout Setting User ParametersSetjobtimeout JobnameSetsoftwareiomode Setting Device ParametersWaittimeout Packetbackchannel Setting Communication ParametersSoftwareiomode Setpacketbackchannel SccbatchDarkness Setting Engine Device ParametersSetsccbatch Setdarkness Setting Extensions to PostScript LevelCurrentcacheparams CurrentpackingSetcacheparams PackedarraySetpacking Printer Error ParameterPostScript Language Changes PrintererrorCreating Packed Arrays Packed ArraysPacked Arrays Versus Ordinary Arrays Immediately Evaluated Names Changes in Font Cache Operation Device Resolution ImagesEnd-of-Line Recognition New Operators TrueType FontsCommunication Channels Baud Rates Serial CommunicationDTR Flow Control Parity SettingsFlow Control XON/XOFF Flow Control SCC Operator EncodingSimple Communication Protocol Communication ProtocolsBinary Communication Protocol SOH CTL-A Parallel Interface Communicating with an IBM PCDTR Flow Control for PC Communication Serial InterfaceXON/XOFF Flow Control for PC Communication Communication DynamicsStatus Queries and Spontaneous Messages Errorerror OffendingCommand operator %%