home *** CD-ROM | disk | FTP | other *** search
- /* Kevo -- a prototype-based object-oriented language */
- /* (c) Antero Taivalsaari 1991-1993 */
- /* Some parts (c) Antero Taivalsaari 1986-1988 */
- /* signals.c: Signal and exception handling */
-
- #include "global.h"
- #include "portGlobal.h"
-
- /* ---------------------------------------------------------------------------- */
- /* Keyboard interrupt */
-
- /* Note: keyboard interrupts are not trivial to handle, because interrupt
- requests may well arrive even when Kevo is executing a completely
- different task than the one to which the interrupt is targeted.
- */
- void doCancel()
- {
- /* Ensure that possible trace mode will be terminated */
- traceMode = QUITTRACE;
- debugTask = NIL;
-
- /* yyy warning: reference to 'theTask' is non-portable */
- /* 'theTask' designates the selected task in the user interface */
-
- if (up != theTask) {
- /* The task to be cancelled is not the one which is currently executing */
- if (theTask && isActivated(theTask)) {
- /* Cancel the task in the current window if it is running */
- TASK** tempUp = up;
- int** tempRp = returnSp;
-
- /* Set the keyboard task to execute the error vector */
- /* Context and data stacks will NOT be emptied (yet). */
- /* Higher-level code ('error') should initialize them. */
- up = theTask;
-
- fprintf(confile, "== Cancel request received (interrupt pending)."); showTaskID();
- ownPrintf("-- Cancel");
-
- returnSp = (*up)->rpStore;
- topReturn = (int*)((*up)->errorVector->mfa);
-
- up = tempUp;
- returnSp = tempRp;
-
- return;
- }
- else {
- fprintf(confile, "== Current window has no active task which could be cancelled ==\n");
- return;
- }
- }
- else {
- /* Cancel the currently executing (and currently selected) task */
-
- /* Ensure that the menu hilighting will be off */
- /* (must be done because this command can be invoked from the menu) */
- HiliteMenu(FALSE);
-
- ownPrintf("-- Cancel");
-
- /* Return to inner interpreter (starting from 'error') */
- execute((*up)->errorVector);
- ownLongJmp();
- }
- }
-
-
- /* initSignals(): set the handler for the most commonly occurring signals */
- /* Signal handling is not used in Mac */
- void initSignals()
- {
- signal(SIGINT, doCancel);
- /*
- signal(SIGABRT, handler);
- signal(SIGFPE, handler);
- signal(SIGILL, handler);
- signal(SIGINT, handler);
- signal(SIGSEGV, handler);
- signal(SIGTERM, handler);
- */
- }
-
-
- /* threeBeeps()
- Sound the bell three times to notify the user that something
- serious has happened.
- */
- void threeBeeps()
- {
- SysBeep(1);
- SysBeep(1);
- SysBeep(1);
- }
-
-
- /* reportIntegrityError():
- This operation is included in all the places in the system
- in which system integrity checks are being performed.
- */
- void reportIntegrityError()
- {
- threeBeeps();
- if (!supervisor) {
- ownPrintf("-- System integrity error detected (see console)");
- execute((*up)->errorVector);
- }
- }
-
-