1: # include   "../ingres.h"
   2: 
   3: /*
   4: **  RUBOUT SIGNAL PROCESSORS
   5: **
   6: **	These routines control the status of the rubout signal.
   7: **	The external interface is through three routines:
   8: **		ruboff(why) -- called by user to turn rubouts
   9: **			off; 'why' is NULL or the name of a processor
  10: **			printed in a message when an interrupt is
  11: **			received.
  12: **		rubon() -- called by user to turn rubouts back on.
  13: **			If a rubout was received while they were
  14: **			turned off it will be processed now.
  15: **		rubproc() -- supplied by the user to do any rubout
  16: **			processing necessary.  At minimum it must
  17: **			call resyncpipes() to clear out the pipes.
  18: **	There are some restrictions, notably that it is not
  19: **	permissable to turn rubouts off when any pipe I/O might
  20: **	occur.
  21: */
  22: 
  23: int     Rubgot;     /* set for rubout encountered but not processed */
  24: extern      rubproc();  /* user rubout processing routine */
  25: char        *Rubwhy;    /* current processor */
  26: int     Rublevel;   /* depth of ruboff calls, -1 if off */
  27: 
  28: /*
  29: **  RUBCATCH -- rubout catching routine.
  30: **
  31: **	This routine catches the signal, and either files it for future
  32: **	reference, or processes.  Also, this routine can be called by
  33: **	rubon to process a previously caught signal.
  34: */
  35: 
  36: rubcatch()
  37: {
  38:     signal(2, 1);
  39: 
  40:     /* check current state */
  41:     if (Rublevel < 0)
  42:     {
  43:         /* error -- rubouts ignored */
  44:         syserr("rubcatch");
  45:     }
  46:     else if (Rublevel > 0)
  47:     {
  48:         /* save the rubout for future processing */
  49:         Rubgot++;
  50:         if (Rubwhy != NULL)
  51:         {
  52:             printf("Rubouts locked out (%s in progress) -- please be patient\n",
  53:                 Rubwhy);
  54:         }
  55:     }
  56:     else
  57:     {
  58:         /* do real rubout processing */
  59:         rubproc();
  60:         signal(2, &rubcatch);
  61:         reset();
  62:     }
  63: }
  64: 
  65: 
  66: 
  67: 
  68: 
  69: /*
  70: **  TURN RUBOUTS OFF
  71: **
  72: **	Further rubouts will be caught by rubsave.
  73: **	The parameter should be the name of the processor which
  74: **	insists that rubouts do not occur.
  75: */
  76: 
  77: ruboff(why)
  78: char    *why;
  79: {
  80:     /* check to see if this should be ignored */
  81:     if (Rublevel < 0 || Rublevel++ > 0)
  82:         return;
  83: 
  84:     /* set up to ignore interrupts */
  85:     Rubgot = 0;
  86:     Rubwhy = why;
  87: }
  88: 
  89: 
  90: 
  91: 
  92: 
  93: /*
  94: **  TURN RUBOUTS BACK ON
  95: **
  96: **	Rubout processing is restored to the norm (calling rubcatch).
  97: **	If any rubouts have occured while disabled, they are processed
  98: **	now.
  99: */
 100: 
 101: rubon()
 102: {
 103:     /* check to see if we should leave as-is */
 104:     if (Rublevel < 0 || --Rublevel > 0)
 105:         return;
 106: 
 107:     /* process any old interrupts */
 108:     if (Rubgot > 0)
 109:         rubcatch();
 110: 
 111:     /* reset state */
 112:     Rubwhy = NULL;
 113: }

Defined functions

rubcatch defined in line 36; used 6 times

Defined variables

Rubgot defined in line 23; used 3 times
Rublevel defined in line 26; used 6 times
Rubwhy defined in line 25; used 4 times
Last modified: 1980-12-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 652
Valid CSS Valid XHTML 1.0 Strict