Table of Contents
1. cvx
Converts an object to have the executable attribute.
1.2. Stack Effects
| Level | Object |
|---|---|
0 |
|
| Level | Object |
|---|---|
0 |
|
1.3. Description
cvx (convert to executable) changes the attribute of the object on top of the operand stack from literal to executable.
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 executable
/add cvx % Result: add (executable)
Converting procedure
{ 1 2 add } cvx % Result: { 1 2 add } (executable)
String to executable
(1 2 add) cvx exec % Executes string contents
% Result: 3
1.7. Common Pitfalls
| Execution Context - Executable objects are executed when encountered by the interpreter. |
/proc { 1 2 add } def
proc % Executes (pushes 3)
/proc cvlit % Literal (pushes procedure)
| String Security - Converting arbitrary strings to executable and executing them can be dangerous. |
Most Procedures Already Executable - Procedures created with { } are already executable.
|
1.9. Implementation Notes
-
Only changes the executable/literal attribute bit
-
Does not create a new object
-
Works on any object type
-
Complementary to
cvlit