Newsgroups: comp.sys.apple2.gno Path: blue.weeg.uiowa.edu!news.uiowa.edu!hobbes.physics.uiowa.edu!math.ohio-state.edu!howland.reston.ans.net!ix.netcom.com!netcom.com!bazyar From: bazyar@netcom.com (Jawaid Bazyar) Subject: Re: Restartability and GNO Message-ID: Organization: NETCOM On-line Communication Services (408 261-4700 guest) References: <3et7g7$jn6@muss.cis.McMaster.CA> Date: Wed, 11 Jan 1995 03:40:19 GMT Lines: 22 u8902848@muss.cis.McMaster.CA (J.S. Rand) writes: > I have a quick question on how to make a C program restartable >under GNO. I have RTFM'ed and the manual talks about an rexit call >which sets the right quit parameter (0x4000 right) to signal the >code as restartable. I have not been able to find this function >anywhere else in the manual, in any of the .h files or anywhere. I forgot to include it in the library. int rexit(int exitcode) { SYSTEMQUITFLAGS(0x4000); SYSTEMQUITPATH(NULL); exit(exitcode); } -- Jawaid Bazyar | Like UNIX? Like your Apple IIGS? Then ask Procyon, Inc. | me about GNO/ME for the Apple IIgs! bazyar@netcom.com | P.O Box 620334 --Apple II Forever!-- | Littleton, CO 80162-0334 (303) 781-3273 Path: blue.weeg.uiowa.edu!news.uiowa.edu!hobbes.physics.uiowa.edu!newsrelay.iastate.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!news.sprintlink.net!tequesta.gate.net!not-for-mail From: stever@news.gate.net (Steve Reeves) Newsgroups: comp.sys.apple2.gno Subject: Re: Restartability and GNO Date: 11 Jan 1995 02:58:46 -0500 Organization: CyberGate, Inc. Florida Lines: 58 Message-ID: <3f033m$o6r@seminole.gate.net> References: <3et7g7$jn6@muss.cis.mcmaster.ca> Reply-To: stever@gate.net NNTP-Posting-Host: seminole.gate.net In article <3et7g7$jn6@muss.cis.mcmaster.ca>, J.S. Rand wrote: > So, how do I do it? I looked at all the sources I have and it >seems that I only have examples of restartability with ASM prgrams. Here is some C source for rexit(): /* rexit.c - rexit() works just like the normal C exit() function, but it sets the restart flag when calling QuitGS */ #include extern pascal void SystemQuitFlags(unsigned); extern pascal void SystemQuitPath(GSString255Ptr); void rexit(int x_code) { SYSTEMQUITFLAGS(restartable); SYSTEMQUITPATH(NULL); exit(x_code); } Phil Vandry wrote this bit of assembly that I like to use instead: keep rexit case on * Linking this little bit of code in with a program causes exit() to behave * like rexit(). This way, you can actually code the program using exit() * and if it ever gets ported and rexit() must be dropped, just drop this file ~QUIT start pha jsl SYSIOSHUTDOWN jsl SYSTEMSANESHUTDOWN jsl SYSTEMMMSHUTDOWN pla jsl $e100a8 dc i'$2029' dc a4'qtrec' qtrec dc i'2' dc a4'0' dc i'$4000' end >Also, I make sure that I explicitly set each global in my C program. >Is there anything else I should be aware of in making my C code >restartable? Oh yeah, this is C v2.0.3 so the libraries are >supposed to be restartable. If you're using getopt(), you have to call getopt_restart() first. I'm always forgetting this. -- Steve Reeves stever@gate.net