Table of Contents
1. cvlit
Converts an object to have the literal attribute.
1.2. Stack Effects
| Level | Object |
|---|---|
0 |
|
| Level | Object |
|---|---|
0 |
|
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.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.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.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