delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/07/14/23:14:50

From: "Gary Oehlert" <gary AT umnstat DOT stat DOT umn DOT edu>
Subject: catching ctrl_c in djgpp
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Thu, 14 Jul 94 21:53:08 CDT

Hi,

I'm new to djgpp and this group, so please bear with me.  I'm also
much more of a Unix person than a DOS person, so I hope my questions
aren't too naive.

Here's the background.  I have a statistics package, the core of which
runs under Unix, DOS, and MacOS.  You may wish to interrupt long
computations.  In the Mac version, this is accomplished with a menu
selection and the event loop handler sets a global that eventually halts
the computation.  On Unix and DOS (Borland C), we've been catching 
interrupts (control_c's) and longjmp'ing to a restart location.

djgpp (bless it's soul) lets me ignore the 64K/640K stuff I've had to
accept in DOS.  But it quits on ctrl_c.  A little surgery on the go32
source (control.c and exhndler.c) lets me go on after a control_c has been
hit, but I want to notify the stat package that the interrupt was hit.

(Hold your nose, awful hack approaching.) One way to do this is to
set the INTERRUPT flag in the stat program directly from the exception
handler in go32 (using an absolute address and memput).  An alternative
is to set some global in go32, and then have the stat program read
that global (again, from an absolute address).  These approaches work
fine as long as my stat program prints (printf to screen) something
(anything really) every so often while polling the INTERRUPT flag.  If
there is just calculation and no printing, the INTERRUPT flag is
not recognized as set.

Now I don't think this really has anything to do with printing per se,
it must be some mode switch somewhere, or calling some interrupt
at some time.  What am I missing?

Thanks for the help.

Gary

(BTW, I'm using version 1.11)

-- 

Gary W. Oehlert					Voice: 612-625-4758
Dept. of Applied Statistics			Fax:   612-624-2719
University of Minnesota				
1994 Buford Ave.				gary AT umnstat DOT stat DOT umn DOT edu
St. Paul, MN 55108				

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019