🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #31127

Re: <Control> C and autostarting GEM programs

#31127
From: Allan Pratt
Date: Mon, 07 Mar 1988 19:19
30 lines
1779 bytes
From article <167@bdt.UUCP>, by david@bdt.UUCP (David Beckemeyer):
> What happens to the stack?  How can the
> handler fix-up the stack?  A long-jump?  But then what happens in
> the above case where now the DTA points to a place that will be used
> again for new stack space.
> 
> Open files also remain open when the Pterm is called, so these must
> also be cleaned up.
> 
> My point is: don't be mislead into thinking that a Pterm handler is
> nothing more than a simple longjump.

It *is* just a simple longjmp! (Except that it gets executed in Super
mode -- but the handler can just consist of a longjmp.) If you have a
global pointer (like an extern or your DTA) pointing into your stack,
and you do a longjmp, it still points to your stack (or where the stack
will someday be).  It's up to you not to use those pointers -- in the
case where the ^C might occur while the DTA is on the stack, your
Pterm-recovery routine should reset the DTA to somewhere else. 

On the other hand, since the DTA is only used for Fsfirst/Fsnext, you
should explicitly set it before each round of calls.  Then you're sure
to be safe from DTA fever. 

Other globals have always had that problem, though: if you longjmp,
you have to be sure you reinitialize them.

============================================
Opinions expressed above do not necessarily	-- Allan Pratt, Atari Corp.
reflect those of Atari Corp. or anyone else.	  ...ames!atari!apratt
Technical Details
Message-ID: <1008@atari.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!portal!atari!apratt
References: <167@bdt.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!portal!atari!apratt
From: apratt@atari.UUCP (Allan Pratt)
Newsgroups: comp.sys.atari.st
Subject: Re: <Control> C and autostarting GEM programs
Message-ID: <1008@atari.UUCP>
Date: 7 Mar 88 19:19:59 GMT
References: <167@bdt.UUCP>
Organization: Atari Corp., Sunnyvale CA
Lines: 30