%! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % @(#)MiCS.ps % Molecules in Cyber Space % Copyright (C) 1989. % By Don Hopkins. (don@brillig.umd.edu) % All rights reserved. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % You are free to redistribute this program. Please leave the comments % intact, add your own interpretations, views, hallucinations, navagation % aids, and pass it on to friends! The author is not responsible for any % time or brain cells wasted with this software. % % This is an almost totally rewritten version of the Pseudo Scientific % Visualizer (the browser for the other half of your brain). % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % We've got to have various classes defined... systemdict /PieMenu known not { (NeWS/piemenu.ps) LoadFile not { currentcursorlocation [(Need) (piemenu.ps)] popmsg pop currentprocess killprocess } if } if systemdict /PulloutPieMenu known not { (NeWS/pullout.ps) LoadFile not { currentcursorlocation [(Need) (pullout.ps)] popmsg pop currentprocess killprocess } if } if systemdict /OverlayWindow known not { (NeWS/overlay.ps) LoadFile not { currentcursorlocation [(Need) (overlay.ps)] popmsg pop currentprocess killprocess } if } if systemdict /pointing-hand known not { (NeWS/pointer.ps) LoadFile not { currentcursorlocation [(Need) (pointer.ps)] popmsg pop currentprocess killprocess } if } if systemdict /StillDict known not { (NeWS/distill.ps) LoadFile not { currentcursorlocation [(Need) (distill.ps)] popmsg pop currentprocess killprocess } if } if systemdict begin systemdict /growabledict known not { /growabledict { 5000 dict } def } if /MoleculeDict 200 dict def MoleculeDict begin /ColorHueFrob .3 def /ColorSaturationFrob .5 def /ColorBrightnessFrob .3 def /ScaleX .065 def /ScaleY {ScaleX} def /ShrinkX .55 def /ShrinkY {ShrinkX} def /ArraySpread 2.1 def /DictKeySpread 2.1 def /DictValueSpread 2.1 def % translate happens *after* scaling down /ProcessMax 10 def /ForkProb .8 def /DepthDraw 3 def /DepthTarget 999 def /Drain? false def /DoLines false def /UnOpenableDict growabledict def UnOpenableDict systemdict true put /MaxOpenLength 128 def /_Leaf_ { /DepthDraw MyDepth def } def /MagicKeys 50 dict def MagicKeys begin /TopCanvas //_Leaf_ def /BottomCanvas //_Leaf_ def /CanvasAbove //_Leaf_ def /Parent //_Leaf_ def /FrameMenu //_Leaf_ def /IconMenu //_Leaf_ def /ParentDict //_Leaf_ def /ParentDictArray //_Leaf_ def end /Types { nulltype integertype realtype booleantype colortype marktype operatortype nametype stringtype shapetype monitortype graphicsstatetype cursortype filetype arraytype dicttype fonttype canvastype processtype eventtype % X11/NeWS: savetype packedarraytype colormapentrytype environmenttype colormaptype pathtype visualtype vmtype } def /defaulttype { pop gsave _newpath -90 rotate 0 setlinecap .1 setlinewidth 0 -.8 .2 0 360 arc closepath _fill 0 -.5 moveto 0 .5 .5 -90 120 arc _stroke grestore } def /nulltype { pop gsave _newpath -90 rotate -1 -1 2 .7 rectpath 0 -.5 .6 180 0 arcn closepath _fill grestore } def /integertype { gsave _newpath abs 1 add ln dup 10000 mul cos 1 add 2 div cvfixed exch dup 1000 mul sin 1 add 2 div cvfixed exch 100 mul 10 add cos 1 add 2 div cvfixed setrgbcolor -.6 -.6 1.2 1.2 rectpath _fill grestore } def /realtype { integertype } def /booleantype { gsave _newpath .1 setlinewidth 0 setlinecap -90 rotate 0 0 .9 0 360 arc closepath { 0 -.9 moveto 0 .9 lineto -45 rotate 0 -.9 moveto 0 0 lineto .9 0 lineto } { -45 rotate 0 -.9 moveto 0 .9 lineto } ifelse _stroke grestore } def /colortype { gsave _newpath 0 0 .9 0 360 arc closepath gsave .1 setlinewidth 0 setgray _stroke grestore setcolor _fill grestore } def /marktype { pop gsave _newpath -90 rotate -1 -.3 translate 2 2 scale .2 0 moveto % Nick Turner's finger 0 .3 lineto .1 .5 lineto .2 .5 lineto .2 .55 lineto .3 .6 lineto .4 .55 lineto .4 .95 lineto .5 1 lineto .6 .95 lineto .6 .55 lineto .7 .6 lineto .8 .55 lineto .8 .5 lineto .9 .55 lineto 1 .5 lineto 1 .3 lineto .8 0 lineto closepath _fill grestore } def /operatortype { pop _newpath -.2 -.2 .4 .4 rectpath 0 0 .5 0 360 arc closepath _eofill } def /nametype { pop _newpath 0 -.5 moveto 1 0 lineto 0 .5 lineto closepath _eofill } def /stringtype { length 1 add _newpath -.5 -.1 % x y 3 -1 roll 5 div .5 add .2 % x y w h rectpath _fill } def /shapetype { defaulttype } def /monitortype { gsave _newpath -.8 -1 1.2 1 rectpath _fill 0 setlinecap .1 setlinewidth .7 1 moveto 0 exch monitorlocked 1.2 1.6 ifelse .7 0 180 arc closepath _stroke grestore } def /graphicsstatetype { pop _newpath -.5 -.5 moveto 1 -.4 lineto 1 -.2 lineto .8 -.2 lineto 1 .4 lineto 1 1 lineto .5 .3 lineto -.5 .5 lineto closepath _eofill } def /cursortype { defaulttype } def /filetype { pop gsave _newpath 90 rotate -.9 -.9 1.8 .4 ovalpath -.9 .5 1.8 .4 ovalpath -.9 -.7 moveto -.9 .7 lineto .9 -.7 moveto .9 .7 lineto _stroke grestore } def % Compound objects /OpenArrays? true def /arraytype { gsave _newpath dup length 0 ne DoLines and { .01 setlinewidth 360 1 index length div dup -2 div rotate 1 index length dup 64 gt { 16 idiv exch 16 mul exch .1 setlinewidth } if { 0 0 moveto ArraySpread 0 lineto dup rotate _stroke } repeat pop } if 0 0 1 0 360 arc closepath 0 0 .6 0 360 arc closepath _eofill grestore OpenArrays? { compoundtype } if } def /compoundtype { 20 dict begin gsave /obj 1 index def Selective? { make-target } if UnOpenableDict 1 index known not exch length MaxOpenLength le and MyDepth DepthDraw lt and { /pieces /obj load length def pieces 0 ne { /step 360 pieces div def step -2 div rotate /i -1 def /obj load { % element pause BailOut? {pop exit} if /i i 1 add def gsave ArraySpread 0 translate ShrinkX ShrinkY scale _begingroup visualize _endgroup grestore step rotate } forall } if } if end grestore } def /OpenDicts? true def /dicttype { gsave _newpath dup length 0 ne DoLines and { .05 setlinewidth 360 1 index length div dup -2 div rotate 1 index length dup 100 gt { 10 idiv exch 10 mul exch .2 setlinewidth } if { 0 0 moveto DictKeySpread 0 lineto dup rotate _stroke } repeat pop } if 0 0 1 0 360 arc closepath 0 0 .7 0 360 arc closepath 0 0 .3 0 360 arc closepath _eofill grestore OpenDicts? { dictoidtype } { pop } ifelse } def /dictoidtype { % obj => - 20 dict begin gsave /obj 1 index def Selective? { make-target } if UnOpenableDict 1 index known not exch length MaxOpenLength le and MyDepth DepthDraw lt and { /pieces /obj load length def pieces 0 ne { /step 360 pieces div def step -2 div rotate /obj load { % element pause BailOut? {pop pop exit} if gsave DictKeySpread 0 translate ShrinkX ShrinkY scale _begingroup 1 index visualize _endgroup DictValueSpread 0 translate _begingroup exch MagicKeys 1 index known { 10 dict begin MagicKeys exch get exec visualize end } { pop visualize } ifelse _endgroup grestore step rotate } forall } if } if end grestore } def % Bill Meine's Sunlogo: /Uchar { -.1 0 moveto 0 0 .1 180 360 arc 0 2.9 rlineto .8 0 rlineto 0 -2.9 rlineto 0 0 .9 0 180 arcn 0 2.9 rlineto .8 0 rlineto closepath } def /2Uchar { Uchar matrix currentmatrix 4 4 translate Uchar setmatrix } def /Sunlogo { % xcenter ycenter s = - 3 1 roll % s xcenter ycenter matrix currentmatrix 4 1 roll % matrix s xcenter ycenter translate % matrix s 16 dup mul 2 div sqrt div % s will now represent total height dup scale % matrix 0 3 dup mul 2 mul sqrt neg translate % new starting point from center 45 rotate 4 { 2Uchar 6 0 translate 90 rotate } repeat setmatrix % restore original CTM } def /fonttype { pop _newpath 0 0 2 Sunlogo _fill } def /OpenAllCanvases? false def /OpenCanvases? { OpenAllCanvases? true { dup /ParentDictArray known } ifelse } def /canvastype { gsave _newpath -.8 -.8 translate 2 { 0 0 moveto 1.8 0 rlineto currentpoint -.2 -.2 rlineto moveto -.2 .2 rlineto 90 rotate } repeat _stroke grestore OpenCanvases? { dictoidtype } { pop } ifelse } def /OpenProcesses? false def /processtype { gsave _newpath 90 rotate -1 -1 translate 2 1.8 scale 0.634 0.83 moveto 0.634 0.83 0.5 controlpoint 0.6762 0.836 0.5 controlpoint 0.7723 0.8271 0.5 controlpoint 0.8313 0.819 0.5 controlpoint 0.847 0.8101 0.5 controlpoint 0.86 0.7903 0.5 controlpoint 0.867 0.748 0.5 controlpoint 0.8684 0.737 0.5 controlpoint 0.8684 0.737 0.5 controlpoint 0.882 0.7393 0.5 controlpoint 0.894 0.734 0.5 controlpoint 0.9021 0.7252 0.5 controlpoint 0.916 0.711 0.5 controlpoint 0.9173 0.7 0.5 controlpoint 0.938 0.683 0.5 controlpoint 0.96 0.652 0.5 controlpoint 0.978 0.612 0.5 controlpoint 0.9831 0.584 0.5 controlpoint 0.9831 0.5523 0.5 controlpoint 0.973 0.53 0.5 controlpoint 0.96 0.5212 0.5 controlpoint 0.948 0.5212 0.5 controlpoint 0.948 0.5212 0.5 controlpoint 0.9443 0.4674 0.5 controlpoint 0.933 0.448 0.5 controlpoint 0.9123 0.442 0.5 controlpoint 0.889 0.4334 0.5 controlpoint 0.8583 0.431 0.5 controlpoint 0.8532 0.448 0.5 controlpoint 0.857 0.462 0.5 controlpoint 0.857 0.462 0.5 controlpoint 0.84 0.462 0.5 controlpoint 0.84 0.462 0.5 controlpoint 0.835 0.422 0.5 controlpoint 0.828 0.408 0.5 controlpoint 0.8043 0.371 0.5 controlpoint 0.7723 0.3512 0.5 controlpoint 0.7504 0.3512 0.5 controlpoint 0.732 0.357 0.5 controlpoint 0.712 0.377 0.5 controlpoint 0.693 0.4022 0.5 controlpoint 0.678 0.439 0.5 controlpoint 0.673 0.4674 0.5 controlpoint 0.673 0.4674 0.5 controlpoint 0.653 0.476 0.5 controlpoint 0.653 0.476 0.5 controlpoint 0.646 0.442 0.5 controlpoint 0.646 0.442 0.5 controlpoint 0.5581 0.456 0.5 controlpoint 0.422 0.456 0.5 controlpoint 0.361 0.4674 0.5 controlpoint 0.302 0.456 0.5 controlpoint 0.287 0.456 0.5 controlpoint 0.2782 0.456 0.5 controlpoint 0.2664 0.482 0.5 controlpoint 0.245 0.4362 0.5 controlpoint 0.216 0.3852 0.5 controlpoint 0.167 0.3852 0.5 controlpoint 0.135 0.439 0.5 controlpoint 0.115 0.4872 0.5 controlpoint 0.105 0.5184 0.5 controlpoint 0.105 0.578 0.5 controlpoint 0.091 0.513 0.5 controlpoint 0.0573 0.51 0.5 controlpoint 0.039 0.541 0.5 controlpoint 0.024 0.561 0.5 controlpoint 0.0134 0.5722 0.5 controlpoint 0.024 0.6232 0.5 controlpoint 0.054 0.68 0.5 controlpoint 0.088 0.7252 0.5 controlpoint 0.088 0.731 0.5 controlpoint 0.054 0.765 0.5 controlpoint 0.037 0.771 0.5 controlpoint 0.039 0.8271 0.5 controlpoint 0.0573 0.839 0.5 controlpoint 0.1483 0.8441 0.5 controlpoint 0.1483 0.836 0.5 controlpoint 0.1483 0.819 0.5 controlpoint 0.1483 0.796 0.5 controlpoint 0.162 0.7903 0.5 controlpoint 0.1652 0.819 0.5 controlpoint 0.179 0.839 0.5 controlpoint 0.2023 0.85 0.5 controlpoint 0.206 0.8271 0.5 controlpoint 0.216 0.8243 0.5 controlpoint 0.221 0.8441 0.5 controlpoint 0.26 0.898 0.5 controlpoint 0.2934 0.9121 0.5 controlpoint 0.336 0.932 0.5 controlpoint 0.4114 0.952 0.5 controlpoint 0.4603 0.9603 0.5 controlpoint 0.508 0.9603 0.5 controlpoint 0.528 0.958 0.5 controlpoint 0.543 0.941 0.5 controlpoint 0.597 0.881 0.5 controlpoint 0.624 0.85 0.5 controlpoint closepath _fill grestore OpenProcesses? { dictoidtype } { pop } ifelse } def /OpenAllEvents? true def /OpenEvents? { OpenAllEvents? true { dup /ParentDictArray known } ifelse } def /eventtype { _newpath -.8 -.8 1.6 1.6 rectpath -.8 .8 moveto 0 0 lineto -.8 -.8 lineto _stroke OpenEvents? { dictoidtype } { pop } ifelse } def /savetype { defaulttype } def /packedarraytype { arraytype } def /OpenColorMapEntries? false def /colormapentrytype { dup defaulttype OpenColormapEntries? { dictoidtype } { pop } ifelse } def /OpenEnvironments? false def /environmenttype { dup defaulttype OpenEnvironments? { dictoidtype } { pop } ifelse } def /OpenColormaps? false def /colormaptype { dup defaulttype OpenColormaps? { dictoidtype } { pop } ifelse } def /pathtype { defaulttype } def /OpenVisuals? false def /visualtype { dup defaulttype OpenVisuals? { dictoidtype } { pop } ifelse } def /vmtype { defaulttype } def end % MoleculeDict /PSVisualizerWindow OverlayWindow dictbegin /FrameLabel (The NeWS Pseudo-Scientific Visualizer!) def /IconLabel (PS Visualizer) def /IconImage /eye def /MyProcesses null def /MyThing null def /MyTop null def % /EventMgr null def /Canvases null def /TargetCanvases null def /OldCanvases null def /CheapIcon? false def % quickwin mod /Retained? true def /BorderLeft 8 def /BorderRight 8 def /BorderTop 8 def /BorderBottom 8 def /FrameFillColor .25 .25 .25 rgbcolor def /HilitedCan null def /MenuTarget null def /MenuTrigger null def /SpotRadius 28 def /ForkPaintClient? true def %/ForkPaintClient? false def /DictBase null def dictend classbegin /Interesting? true def /Selective? true def /SpaceSaturation .6 def /SpaceBrightness .6 def systemdict /fb_color known { fb_color /Color get } { framebuffer /Color get } ifelse { /SpaceColor { random SpaceSaturation SpaceBrightness hsbcolor self /SpaceColor 2 index put } def } { /SpaceColor 0 0 0 rgbcolor def } ifelse /MoleculeColor {random random .3 max sqrt random .3 max sqrt hsbcolor} def /FramePath { ovalpath } def /PaintFrame { FrameFillColor fillcanvas } def /PaintFocus { } def /ExitFrame { } def /EnterFrame { } def /MyDepth { countdictstack DictBase sub } def /new { /new super send begin /TargetCanvases growabledict store /Canvases growabledict store /OldCanvases growabledict store /MyThing exch def /MyTop /MyThing load def /MyProcesses 100 dict def currentdict end } def /destroy { % clean up zap-processes /MyThing null store /MyTop null store zap-canvases /destroy super send } def /zap-processes { % EventMgr type /processtype eq { % EventMgr killprocess % } if MyProcesses { dup currentprocess ne { killprocess } { % No owch! } ifelse MyProcesses exch undef } forall } def /zap-canvases { /HilitedCan null store Canvases null ne { Canvases { cleanoutdict dup /Mapped false put OldCanvases exch dup put random .2 lt { pause } if } forall Canvases cleanoutdict TargetCanvases cleanoutdict } if } def /drain { MoleculeDict /Drain? true put fart-around MoleculeDict /Drain? false put } def /fart-around { { MyProcesses length 0 eq { exit } if MyProcesses { pop exit } forall % Grab one process waitprocess pop } loop } def /ForkFrameEventMgr { /FrameEventMgr FrameInterests forkeventmgr def } def /CreateFrameInterests { /CreateFrameInterests super send FrameInterests begin /ClientDamageEvent /Damaged /FixClient null ClientCanvas eventmgrinterest def /ClientPointEvent PointButton {/pointat self send} DownTransition TrackCanvas eventmgrinterest def /ClientAdjustEvent AdjustButton {/adjustat self send} DownTransition TrackCanvas eventmgrinterest def /ClientMenuEvent MenuButton { /MenuTarget HilitedCan store /MenuTrigger 1 index store /showat ClientMenu send } DownTransition TrackCanvas eventmgrinterest def /ClientDragEvent /MouseDragged {/dragat self send} null TrackCanvas eventmgrinterest def /ClientTargetEvent [/EnterEvent /ExitEvent] {/target-event self send} null TargetCanvases eventmgrinterest def end } def /FixClient { { ClientCanvas setcanvas damagepath clipcanvas newpath clipcanvas repaint } fork pop } def /PaintClient { gsave FrameCanvas setcanvas damagepath clipcanvas newpath clipcanvas repaint grestore } def /repaint { FullColor BlackOverlay ColorCanvas setcanvas % EventMgr null ne { % EventMgr killprocess % /EventMgr null store % } if { clear newprocessgroup drain zap-processes zap-canvases SpaceColor fillcanvas MoleculeColor setcolor StillDict begin _stillbegin clippath pathbbox 4 2 roll pop pop /_output_tx 0 def /_output_ty 0 def /_output_sx 1 def /_output_sy 1 def MoleculeDict begin /DictBase countdictstack store scale .5 .5 translate ScaleX ScaleY scale { /MyThing load _begingroup visualize _endgroup MyProcesses currentprocess undef } fork MyProcesses exch dup put fart-around ColorCanvas setcanvas % EventMgr dup null ne exch currentprocess ne and { % EventMgr killprocess % % this is a futile attempt to get a new event manager process % % corpus, so we don't get any events destined for the old one. % % (see sjs's blankscreen comments) % { clear .1 sleep } fork pop % } if % [ Canvases { pop % [ /EnterEvent /ExitEvent ] % /target-event null 4 -1 roll eventmgrinterest % } forall % PointButton /point-background null TrackCanvas eventmgrinterest % /MouseDragged /drag-background null TrackCanvas eventmgrinterest % ] forkeventmgr end % MoleculeDict _stillend end % StillDict % /EventMgr exch store clear } fork pop newpath clipcanvas .1 60 div sleep fart-around } def /activate { map } def % /reshape { % /reshape super send % } def /hilite-can { % can => - lolite-hilited-can /HilitedCan 1 index def 1 exch HiliteCan } def /lolite-hilited-can { HilitedCan null ne { HilitedCan LoliteCan /HilitedCan null def } if } def /shimmer-hilited-can { HilitedCan ShimmerCan } def /dragat { % event => - HilitedCan null ne { Canvases HilitedCan known { random shimmer-hilited-can } if } if pop } def /point-background { % event => - { gsave CurrentEvent /Action get /DownTransition eq { DarkColor Canvases { % can dict begin Interesting? { random dup .5 lt { pause } if 2 div .5 add exch HiliteCan } { pop } ifelse end } forall } { % FullColor } ifelse grestore } fork pop pause pause pop } def % /smart-name { % see if smart-name from cyber is defined % % otherwise just be dumb % dup type (% %) sprintf % } ?def % % /quicksort where { pop } { % see if quicksort is defined (cyber or xnews) % % otherwise just be out of sorts % /quicksort { % array compare => array % pop % } def % } ifelse % /pointat { HilitedCan null eq { CurrentEvent point-background } { Canvases HilitedCan known { Canvases HilitedCan get /obj get select-object } if } ifelse } def /point-hand { MenuTarget null ne { Canvases MenuTarget known { Canvases MenuTarget get /obj get dup length 32 le { [ exch dup smart-name (%:) sprintf exch dup type dup /arraytype eq exch /packedarraytype eq or { 0 exch { smart-name 1 index ( %: %) sprintf exch 1 add } forall pop } { [ exch { smart-name exch ( %: %) sprintf } forall ] /gt load quicksort aload pop } ifelse ] } { smart-name } ifelse gsave DarkColor framebuffer setcanvas MenuTrigger begin XLocation YLocation end get-pointer-to 5 -1 roll pointmsg pop grestore } if } if } def /adjustat { HilitedCan null ne { Canvases HilitedCan known { Canvases HilitedCan get /obj get /MyThing exch store { repaint } fork pop } if } if } def /point-visualizer { MenuTarget null ne { Canvases MenuTarget known { Canvases MenuTarget get /obj get gsave framebuffer setcanvas MenuTrigger begin XLocation YLocation end grestore xy_start_visualizer } if } if } def /target-event-names 10 dict def target-event-names begin /EnterEvent { CurrentEvent /Canvas get dup hilite-can CurrentEvent /KeyState get length 0 ne { Canvases 1 index get /obj get select-object } if % canvastotop pop pause } def /ExitEvent { CurrentEvent /Canvas get HilitedCan null eq { pop } { HilitedCan lolite-hilited-can pause canvastobottom } ifelse pop } def end /target-event { % event => - gsave target-event-names CurrentEvent /Name get get exec grestore pop } def XNeWS? { /cvfixed {} def } { /maxint .5 minim div 1 sub def /cvfixed { 1024 mul floor maxint min cvi -10 bitshift } def } ifelse /wrap { dup floor sub cvfixed } def % This is useful for finding core leaks ... (Really!) /context-string { % => (string) () currentprocess /DictionaryStack get dup length 2 sub 2 exch getinterval { dup /obj known { begin i /obj load 3 -1 roll (%/%:%) sprintf end } {pop} ifelse } forall 1 index exch (% = %) sprintf } def /make-target { MyDepth DepthTarget le { OldCanvases length 0 eq { TrackCanvas newcanvas } { OldCanvases { pop exit } forall OldCanvases 1 index undef } ifelse /can exch def can /Transparent true put can /Retained false put 0 0 1 0 360 arc can reshapecanvas can /Mapped true put Canvases can currentdict put TargetCanvases can dup put } if } def /BailOut? { MyDepth DepthDraw gt Drain? or } def /visualize { % obj => - pause BailOut? { pop } { { gsave currenthsbcolor 3 -1 roll random ColorHueFrob mul sub wrap 3 -1 roll random ColorSaturationFrob mul sub wrap .4 max sqrt % Crank up the saturation! 3 -1 roll random ColorBrightnessFrob mul sub wrap .4 max sqrt sqrt % Crank up the brightness! sethsbcolor dup type cvx exec grestore } MyProcesses length ProcessMax lt random ForkProb lt and not { exec } { { exec MyProcesses currentprocess undef } fork MyProcesses exch dup put pop pop } ifelse } ifelse } def % Menu definitions /ColorFrobMenu [ [(0.0) (0.02) (0.05) (0.1) (0.2) (0.3) (0.4) (0.5) (0.6) (0.7) (0.8) (0.9) (1.0) (99)] ] [ (HueFrob) { MoleculeDict /ColorHueFrob getmenuarg cvr put } (BrightnessFrob) { MoleculeDict /ColorBrightnessFrob getmenuarg cvr put } (SaturationFrob) { MoleculeDict /ColorSaturationFrob getmenuarg cvr put } ] /new PulloutPieMenu send def /ThingMenu [ (Top) { {/MyThing /MyTop load store } ThisWindow send } (SendContexts) { ThisWindow /MyThing currentprocess /SendContexts get put } (Object) { ThisWindow /MyThing Object put } (rootmenu) { ThisWindow /MyThing rootmenu put } (DefaultMenu) { ThisWindow /MyThing DefaultMenu put } (userdict) { ThisWindow /MyThing userdict put } (PrimarySelection) { ThisWindow /MyThing /PrimarySelection getselection put } (ThisWindow) { ThisWindow /MyThing ThisWindow put } (PSVisualizerWindow) { ThisWindow /MyThing PSVisualizerWindow put } (MoleculeDict) { ThisWindow /MyThing MoleculeDict put } ] /new PieMenu send def /FlagsMenu [ (Lines On) {MoleculeDict /DoLines true put} (Distill On) {StillDict /_out? true put} (Lines Off) {MoleculeDict /DoLines false put} (Distill Off) {StillDict /_out? false put} ] /new PieMenu send def /OpenMenu [ (visualizer) { /point-visualizer ThisWindow send } (hand) { /point-hand ThisWindow send } ] /new PieMenu send def /ClientMenu [ [(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) (15) (16) (17) (18) (19) (20)] [] [(0) (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (9999)] [] [] [] [(0) (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (9999)] [] ] [ (MaxProcs) { MoleculeDict /ProcessMax getmenuarg cvi put } (Flags...) FlagsMenu (DrawDepth) { MoleculeDict /DepthDraw getmenuarg cvi put } (Frame...) /ClassFrameMenu DefaultWindow send (Open...) OpenMenu (Thing...) ThingMenu (TargetDepth) { MoleculeDict /DepthTarget getmenuarg cvi put } (ColorFrob...) ColorFrobMenu ] /new PulloutPieMenu send def % Hurray for you -- you're reading the source code! % To find core leaks, visualize objects in your application's userdict, % and look for the infinite regression of circular references. % (warning: magic dicts in systemdict get "unregistered" errors!) classend def /select-object { % obj => - 20 dict begin /SelectionType /object def /ContentsPostScript 1 index def /ContentsAscii exch (%) sprintf def /SelectionObjSize 1 def /SelectionResponder null def /Canvas currentcanvas def % XXX? /SelectionHolder currentprocess def % XXX? currentdict end /PrimarySelection setselection } ?def /start_visualizer { % thing => - gsave framebuffer setcanvas currentcursorlocation xy_start_visualizer grestore } def /xy_start_visualizer { % thing x y => { InteractionLock { framebuffer setcanvas newprocessgroup 3 -1 roll framebuffer /new PSVisualizerWindow send 3 1 roll fboverlay setcanvas { 2 copy lineto 16 0 rmoveto 16 0 360 arc stroke } getanimated waitprocess aload pop % centerx centery 2 copy { newpath % x y y0 sub dup mul exch x0 sub dup mul add sqrt % r 16 max x0 y0 3 -1 roll 0 360 arc } getanimated waitprocess aload pop % centerx centery edgex edgey 10 dict begin /ey exch def /ex exch def /cy exch def /cx exch def /r cx ex sub dup mul cy ey sub dup mul add sqrt 16 max def cx r sub cy r sub r dup add dup % x y w h end /reshape 5 index send % /SpaceColor where { % pop % gsave % SpaceColor setcolor % currenthsbcolor % 3 -1 roll random ColorHueFrob mul add wrap % 3 1 roll hsbcolor % 1 index exch % win win color % /SpaceColor exch put % win % grestore % } if } monitor /activate exch send } fork pop pop pop pop } def /visualize {start_visualizer} def end % systemdict % visualize command line args, if any. { clear { ($1 $2 $3 $4 $5 $6 $7 $8 $9) cvx exec } errored not { count 0 ne { start_visualizer } if } if } fork pop