1. cvlit

Converts an object to have the literal attribute.

1.1. Syntax

any cvlit → any

1.2. Stack Effects

Table 1. Before
Level Object

0

any (any object)

Table 2. After
Level Object

0

any (same object with literal attribute)

1.3. Description

cvlit (convert to literal) changes the attribute of the object on top of the operand stack from executable to literal.

The object itself is unchanged - only its executable/literal attribute is modified. This affects how the PostScript interpreter treats the object when it is encountered during execution.

1.4. PostScript Level

Level 1 and later

1.5. Examples

Converting name to literal
/abc cvlit       % Result: /abc (literal name)
abc cvlit        % Result: /abc (was executable, now literal)
Converting procedure
{ 1 2 add } cvlit  % Result: { 1 2 add } (won't execute)
Already literal
/name cvlit      % Result: /name (no change)
123 cvlit        % Result: 123 (no change)

1.6. Common Use Cases

1.6.1. Preventing Execution

/proc { complicated code } def
proc cvlit       % Get procedure without executing
% ... later ...
cvx exec         % Execute when ready

1.6.2. Building Literal Arrays

[ /add /mul /sub ] {
  cvlit          % Make each operator literal
} forall
3 array astore
% Literal array of operator names

1.6.3. Name Table Inspection

currentdict {
  exch cvlit exch  % Convert key to literal
  % Process key-value pair
} forall

1.7. Common Pitfalls

Effect on Interpretation - Literal objects are not executed when encountered by the interpreter.
{ 1 2 add } cvlit exec  % Executes (push entire proc)
{ 1 2 add } exec        % Executes (pushes 3)
Most Objects Are Literal - Numbers, strings, arrays created with [ ], etc. are already literal.

1.8. Error Conditions

Error Condition

[stackunderflow]

No operand on stack

1.9. Implementation Notes

  • Only changes the executable/literal attribute bit

  • Does not create a new object (modifies in place)

  • Works on any object type

  • Complementary to cvx

1.10. Executable vs. Literal Comparison

Object Literal Behavior Executable Behavior

Name

Pushed on stack

Looked up and executed

Array/Procedure

Pushed on stack

Elements executed sequentially

Number/String

Pushed on stack

Pushed on stack (same)

Operator

Pushed on stack

Executed

1.11. See Also

  • cvx - Convert to executable

  • xcheck - Test if executable

  • type - Get object type


Back to top

Copyright © 2025 Ribose. PostScript is a trademark of Adobe. Distributed under the MIT License.