Misc.ps
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Doug Wyatt, June 4, 1987 6:07:33 pm PDT
Starting an interpreter:
&streams ← ViewerIO.CreateViewerStreams["PostScript"]
PSLanguage1Impl.Create[&streams.in, &streams.out]
Undocumented primitives in systemdict:
clearinterrupt disableinterrupt enableinterrupt
packedarray currentpacking setpacking
currentcacheparams setcacheparams
cexec eexec setram setrom daytime internaldict makevm psdevice
Exploring dictionaries:
systemdict { dup type /operatortype eq { pop pop } { exch ==print ==print (def\n) = } ifelse } forall
userdict { exch ==print ==print (def\n) = } forall
% VM consumption by dictionaries:
/vmused { vmstatus pop exch pop } def
/vm { vmused = } def
/dictvm {
0 begin
/max exch def
/vcur vmused def
/dcur 0 def
1 1 max {
dup dict pop
/vprev vcur def
/dprev dcur def
/vcur vmused def
/dcur vcur vprev sub def
dup =print (: ) print
dcur =print (, ) print dcur dprev sub =print
( [) print dcur exch div =print (]\n) print
} for
end
} dup 0 10 dict put def
% VM consumption by arrays:
/vmused { vmstatus pop exch pop } def
/arrayvm {
0 begin
/max exch def
/vcur vmused def
/dcur 0 def
1 1 max {
dup array pop
/vprev vcur def
/dprev dcur def
/vcur vmused def
/dcur vcur vprev sub def
dup =print (: ) print
dcur =print (, ) print dcur dprev sub =print
( [) print dcur exch div =print (]\n) print
} for
end
} dup 0 10 dict put def
% VM consumption by packedarrays:
% small integers [-1..18] take 1 byte
% reals 0.0, 1.0, -1.0 take 1 byte
% booleans take 1 byte
% strings of length [1..32] take 3 bytes
% names take 2 bytes
% operators take 2 bytes
% everything else takes 9 bytes
/vmused { vmstatus pop exch pop } def
/packedarrayvm {
0 begin
/ob exch def
/max exch def
/vprev 0 def
/dprev 0 def
/dcur 0 def
/n 0 def
/vcur vmused def
1 1 max {
/n exch def
n { /ob load } repeat n packedarray pop
/vprev vcur def
/dprev dcur def
/vcur vmused def
/dcur vcur vprev sub def
n =print (: ) print
dcur =print (, ) print dcur dprev sub =print
( [) print dcur n div =print (]\n) print
} for
end
} dup 0 10 dict put def