The shadowop operator
This page applies to Harlequin v13.1r0 and later; both Harlequin Core and Harlequin MultiRIP.
dict shadowop -
Sets up one or more shadow operators. The keys in the dictionary dict are always names and the values are procedures or null
objects. The contents of dict are merged with those supplied in previous invocations of shadowop
(like the operands to setpagedevice
); where a key already exists, its definition is replaced. A null
value turns off shadowing for that name as if the name were not present at all. The operation is subject to save
and restore
.
Where the keys are names of operators (whatever dictionaries those operators appear in) any invocation of the operator causes the corresponding procedure set up by shadowop
to be executed instead. However, the shadowed operator will still retain the type operatortype
, rather than being of type arraytype
as it would have been if the redefinition had been performed by conventional means. Therefore the substitution is transparent to any subsequent code.
Once in a shadow procedure, shadowing is turned off. Any operator referenced in the shadow procedure, including the one redefined, will cause the real operator to be executed.
Beware that some of the GGS-supplied ProcSet
resources make use of shadowop
: for example, the calibration ProcSet
shadows setscreen
and related operators. If the shadowing for these operators is overridden, the procsets will not work as they should. You can examine the procsets to see which operators, if any, they shadow.
Where the key is not an operator name, shadowop
affects the behavior of the def
operator. If a def
is done on a shadowed name, the value given to shadowop
will be substituted for the value operand of the def
operator. This allows application-specific procedures to be replaced. When the key is an operator name, this substitution does not apply.
Shadowing procedures are stored in a dictionary called shadowproc
within internaldict
.