home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1994 June / NEBULA_SE.ISO / SourceCode / libcs / include / del.h < prev   
Encoding:
C/C++ Source or Header  |  1990-12-12  |  2.2 KB  |  55 lines

  1. /*
  2.  * Copyright (c) 1990 Carnegie Mellon University
  3.  * All Rights Reserved.
  4.  * 
  5.  * Permission to use, copy, modify and distribute this software and its
  6.  * documentation is hereby granted, provided that both the copyright
  7.  * notice and this permission notice appear in all copies of the
  8.  * software, derivative works or modified versions, and any portions
  9.  * thereof, and that both notices appear in supporting documentation.
  10.  *
  11.  * THE SOFTWARE IS PROVIDED "AS IS" AND CARNEGIE MELLON UNIVERSITY
  12.  * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  13.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT
  14.  * SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR ANY SPECIAL, DIRECT,
  15.  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  16.  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
  17.  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  18.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  19.  *
  20.  * Users of this software agree to return to Carnegie Mellon any
  21.  * improvements or extensions that they make and grant Carnegie the
  22.  * rights to redistribute these changes.
  23.  *
  24.  * Export of this software is permitted only after complying with the
  25.  * regulations of the U.S. Deptartment of Commerce relating to the
  26.  * Export of Technical Data.
  27.  */
  28. /*  del  --  interrupt handling macros
  29.  *
  30.  * HISTORY
  31.  * $Log:    del.h,v $
  32.  * Revision 1.2  90/12/12  20:56:03  mja
  33.  *     Add copyright/disclaimer for distribution.
  34.  * 
  35.  * 17-Apr-85  Steven Shafer (sas) at Carnegie-Mellon University
  36.  *    Modified for 4.2 BSD.  Messages also moved to stderr instead of stdout.
  37.  *
  38.  */
  39.  
  40. #include <signal.h>
  41.  
  42. extern int del();
  43. extern int _del_;
  44. extern struct sigvec _del_vec;
  45.  
  46. #define ENABLEDEL {_del_=0; _del_vec.sv_handler=del; sigvec(SIGINT,&_del_vec,0);}
  47. #define DISABLEDEL {_del_=0; _del_vec.sv_handler=SIG_DFL; sigvec(SIGINT,&_del_vec,0);}
  48. #define IGNOREDEL {_del_=0; _del_vec.sv_handler=SIG_IGN; sigvec(SIGINT,&_del_vec,0);}
  49.  
  50. #define _DELNOTE_    _del_=0; fprintf (stderr,"  Break!\n"); fflush (stderr);
  51. #define DELBREAK    if (_del_) {_DELNOTE_ break;}
  52. #define DELRETURN    if (_del_) {_DELNOTE_ return;}
  53. #define DELRETN(x)    if (_del_) {_DELNOTE_ return (x);}
  54. #define DELCLEAR    if (_del_) {_del_=0; fprintf (stderr,"Break ignored.\n"); fflush (stderr);}
  55.