Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!SUN.COM!owen From: owen@SUN.COM (Owen Densmore) Newsgroups: comp.windows.news Subject: Re: Why doesn't the following simple NeWS example work? Message-ID: <8804071639.AA15822@bigmac.sun.com> Date: 7 Apr 88 22:30:09 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 70 Below is the transcript from a psh session. Can someone tell me what the problem is (NeWS 1.1)? Welcome to NeWS Version 1.1 /msg framebuffer /new DefaultWindow send def /reshapefromuser msg send /map msg send /destroy msg send ***ERROR*** Process: 0x24FF44 Error: killprocess Stack: Executing: `killprocessgroup' At: {FrameEventMgr *`killprocessgroup'} In: {FrameEventMgr 'null' 'ne' array{2} *'if'} In: {DestroyFrame *DestroyClient} In: Reading file(?,W,R) ***** psh: NeWS server disconnected Process PostScript finished Thanks, Skip Montanaro (montanaro@sprite.steinmetz.ge.com, montanaro@ge-crd.arpa) The problem is that the /destroy message executes a "killprocessgroup", in which the psh is a member. The message is innocous, but you can avoid it by either subclassing the window to have the /destroy method be a no-op, or you can launch the window in it's own processgroup. Here's the former: /MyWindow DefaultWindow [] classbegin /destroy {/unmap self send} def classend def /msg framebuffer /new MyWindow send def /reshapefromuser msg send /map msg send /destroy msg send [Note: I do a unmap so that the window will disappear rather than waiting for garbage collection to take place when I re-define "msg".] I also find it convenienent to launch windows, and simple clients, from a psh. My solution is a somewhat odd "runprogram" procedure which executes a string as a psh script: /runprogram { % string => - (exececute the string as a psh program) (/tmp/pshscript) (w) file % str file dup 3 -1 roll % file file str writestring closefile % - (psh /tmp/pshscript) forkunix } def This survives the standard destroy just fine and really acts just like a client: ( /msg framebuffer /new DefaultWindow send def /reshapefromuser msg send /map msg send ) runprogram ..this window can be destroyed (zap menu) without the earlier message. (You might have /msg put in system dict so that you can use it from another interactive psh) Owen Densmore Sun Microsystems