Diff for /gforth/Attic/io.c between versions 1.2 and 1.6

version 1.2, 1994/05/31 10:55:11 version 1.6, 1994/11/29 16:22:41
Line 19 Line 19
 #endif  #endif
 #include <fcntl.h>  #include <fcntl.h>
 #include <sys/file.h>  #include <sys/file.h>
   #include <setjmp.h>
   #include "forth.h"
   #include "io.h"
   
 #if defined (__GNUC__)  #if defined (__GNUC__)
 #  define alloca __builtin_alloca  #  define alloca __builtin_alloca
Line 34 Line 37
   
 #define NEW_TTY_DRIVER  #define NEW_TTY_DRIVER
 #define HAVE_BSD_SIGNALS  #define HAVE_BSD_SIGNALS
   /*
 #ifndef DOMAINOS  #ifndef DOMAINOS
 #define USE_XON_XOFF  #define USE_XON_XOFF
 #endif  #endif
   */
   
   #define HANDLE_SIGNALS
   
 /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */  /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
 #if defined (USG) && !defined (hpux)  #if defined (USG) && !defined (hpux)
Line 45 Line 52
   
 /* System V machines use termio. */  /* System V machines use termio. */
 #if !defined (_POSIX_VERSION)  #if !defined (_POSIX_VERSION)
 #  if defined (USG) || defined (hpux) || defined (Xenix) || defined (sgi) || defined (DGUX) || defined (ultrix)  #  if defined (USG) || defined (hpux) || defined (Xenix) || defined (sgi) || defined (DGUX) || defined (ultrix) || defined (Solaris)
 #    undef NEW_TTY_DRIVER  #    undef NEW_TTY_DRIVER
 #    define TERMIO_TTY_DRIVER  #    define TERMIO_TTY_DRIVER
 #    include <termio.h>  #    include <termio.h>
Line 706  graceful_exit (int sig) Line 713  graceful_exit (int sig)
     fprintf (stderr, "\n\n%s.\n", sigmsg (sig));      fprintf (stderr, "\n\n%s.\n", sigmsg (sig));
   else    else
     fprintf (stderr, "\n\nSignal %d received, terminated.\n", sig);      fprintf (stderr, "\n\nSignal %d received, terminated.\n", sig);
   exit (sig);    exit (0x80|sig);
   }
   
   jmp_buf throw_jmp_buf;
   
   static void 
   signal_throw(int sig)
   {
     static int throw_codes[] = {
       -256,
       -28,
       -257,
       -258,
       -259,
       -260,
       -261,
       -55,
       -262,
       -23,
       -9,
       -263,
       -264,
       -265,
       -266,
       -267,
       -268,
     };
     signal(sig,signal_throw);
     longjmp(throw_jmp_buf,throw_codes[sig-1]); /* or use siglongjmp ? */
   }
   
   static void
   termprep (int sig)
   {
     terminal_prepped=0; prep_terminal();
     signal(sig,termprep);
 }  }
   
 void  void
Line 717  install_signal_handlers (void) Line 759  install_signal_handlers (void)
    but I would like something more automatic - anton */     but I would like something more automatic - anton */
 #define SIGS_TO_IGNORE  SIGCHLD  #define SIGS_TO_IGNORE  SIGCHLD
 #define SIGS_TO_ABORT   SIGINT, SIGILL, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2, \  #define SIGS_TO_ABORT   SIGINT, SIGILL, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2, \
                         SIGALRM, SIGEMT, SIGBUS, SIGSYS                          SIGALRM,  SIGBUS
 #define SIGS_TO_QUIT    SIGHUP, SIGQUIT, SIGABRT, SIGPIPE, \  #define SIGS_TO_QUIT    SIGHUP, SIGQUIT, SIGABRT, SIGPIPE, \
                         SIGTERM                           SIGTERM 
   #define SIGS_TO_TERMPREP    SIGCONT
   
   static short sigs_to_ignore [] = { SIGS_TO_IGNORE };    static short sigs_to_ignore [] = { SIGS_TO_IGNORE };
   static short sigs_to_abort [] = { SIGS_TO_ABORT };    static short sigs_to_abort [] = { SIGS_TO_ABORT };
   static short sigs_to_quit [] = { SIGS_TO_QUIT };    static short sigs_to_quit [] = { SIGS_TO_QUIT };
     static short sigs_to_termprep [] = { SIGS_TO_TERMPREP };
   int i;    int i;
   
 #define DIM(X)          (sizeof (X) / sizeof *(X))  #define DIM(X)          (sizeof (X) / sizeof *(X))
Line 731  install_signal_handlers (void) Line 775  install_signal_handlers (void)
     if (sigs_to_ignore [i])      if (sigs_to_ignore [i])
       signal (sigs_to_ignore [i], SIG_IGN);        signal (sigs_to_ignore [i], SIG_IGN);
   for (i = 0; i < DIM (sigs_to_abort); i++)    for (i = 0; i < DIM (sigs_to_abort); i++)
     signal (sigs_to_abort [i], graceful_exit); /* !! change to throw */      signal (sigs_to_abort [i], signal_throw); /* !! change to throw */
   for (i = 0; i < DIM (sigs_to_quit); i++)    for (i = 0; i < DIM (sigs_to_quit); i++)
     signal (sigs_to_quit [i], graceful_exit);      signal (sigs_to_quit [i], graceful_exit);
     for (i = 0; i < DIM (sigs_to_termprep); i++)
       signal (sigs_to_termprep [i], termprep);
 }  }
 /* end signal handling */  /* end signal handling */

Removed from v.1.2  
changed lines
  Added in v.1.6


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>