Changeset 1e8e9c in git


Ignore:
Timestamp:
Apr 22, 2005, 10:36:51 AM (18 years ago)
Author:
Kai Krüger <krueger@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
511c38c15926b98d83960bcfb7caea8f43aad986
Parents:
571fd10a7ece4806fc608f75612b18cdd3879808
Message:
Kommentare bei ifdef eingefuegt


git-svn-id: file:///usr/local/Singular/svn/trunk@7864 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/cntrlc.cc

    r571fd1 r1e8e9c  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: cntrlc.cc,v 1.42 2004-11-09 14:54:21 Singular Exp $ */
     4/* $Id: cntrlc.cc,v 1.43 2005-04-22 08:36:51 krueger Exp $ */
    55/*
    66* ABSTRACT - interupt handling
     
    4141
    4242#ifdef unix
    43 #ifndef hpux
    44 #include <unistd.h>
    45 #include <sys/types.h>
    46 
    47 #ifdef TIME_WITH_SYS_TIME
    48 # include <time.h>
    49 # ifdef HAVE_SYS_TIME_H
    50 #   include <sys/time.h>
    51 # endif
    52 #else
    53 # ifdef HAVE_SYS_TIME_H
    54 #   include <sys/time.h>
    55 # else
     43# ifndef hpux
     44#  include <unistd.h>
     45#  include <sys/types.h>
     46
     47#  ifdef TIME_WITH_SYS_TIME
    5648#   include <time.h>
    57 # endif
    58 #endif
    59 #ifdef HAVE_SYS_TIMES_H
    60 #include <sys/times.h>
    61 #endif
    62 
    63 #define INTERACTIVE 0
    64 #define STACK_TRACE 1
    65 #ifdef CALL_GDB
     49#   ifdef HAVE_SYS_TIME_H
     50#     include <sys/time.h>
     51#   endif
     52#  else
     53#   ifdef HAVE_SYS_TIME_H
     54#     include <sys/time.h>
     55#   else
     56#     include <time.h>
     57#   endif
     58#  endif
     59#  ifdef HAVE_SYS_TIMES_H
     60#   include <sys/times.h>
     61#  endif
     62
     63#  define INTERACTIVE 0
     64#  define STACK_TRACE 1
     65#  ifdef CALL_GDB
    6666static void debug (int);
    6767static void debug_stop (char **);
    68 #endif
    69 #ifndef __OPTIMIZE__
     68#  endif
     69#  ifndef __OPTIMIZE__
    7070static void stack_trace (char **);
    7171static void stack_trace_sigchld (int);
    72 #endif
    73 #endif
    74 #endif
     72#  endif
     73# endif /* !hpux */
     74#endif  /* unix */
    7575
    7676/* data */
     
    8585#ifndef MSDOS
    8686/* signals are not implemented in DJGCC */
    87 #ifndef macintosh
     87# ifndef macintosh
    8888/* signals are not right implemented in macintosh */
    8989void sigint_handler(int sig);
    90 #endif
     90# endif /* !macintosh */
    9191#endif
    9292
    9393#if defined(linux) && defined(__i386__)
    94 #if defined(HAVE_SIGCONTEXT) || defined(HAVE_ASM_SIGCONTEXT_H)
    95 #include <asm/sigcontext.h>
    96 #else
     94# if defined(HAVE_SIGCONTEXT) || defined(HAVE_ASM_SIGCONTEXT_H)
     95#  include <asm/sigcontext.h>
     96# else
    9797struct sigcontext_struct {
    9898        unsigned short gs, __gsh;
     
    119119        unsigned long cr2;
    120120};
    121 #endif
     121# endif
    122122typedef struct sigcontext_struct sigcontext;
    123123
     
    134134                   (int)s.eip,(int)s.cr2,siRandomStart);
    135135  }
    136 #ifdef __OPTIMIZE__
     136# ifdef __OPTIMIZE__
    137137  if(si_restart<3)
    138138  {
     
    142142    longjmp(si_start_jmpbuf,1);
    143143  }
    144 #endif
    145 #ifdef CALL_GDB
     144# endif
     145# ifdef CALL_GDB
    146146  if (sig!=SIGINT) debug(INTERACTIVE);
    147 #endif
     147# endif
    148148  exit(0);
    149149}
     
    158158}
    159159
    160 #ifdef PAGE_TEST
    161 #ifndef PAGE_INTERRUPT_TIME
    162 #define PAGE_INTERRUPT_TIME 1
    163 #endif
     160# ifdef PAGE_TEST
     161#  ifndef PAGE_INTERRUPT_TIME
     162#   define PAGE_INTERRUPT_TIME 1
     163#  endif
    164164void sig11_handler(int sig, sigcontext s)
    165165{
     
    191191  signal(SIGVTALRM,(si_hdl_typ)sigalarm_handler);
    192192}
    193 #endif
     193# endif /* PAGE_TEST */
    194194
    195195/*2
     
    199199{
    200200/*4 signal handler: linux*/
    201 #ifdef PAGE_TEST
     201# ifdef PAGE_TEST
    202202  signal(SIGSEGV,(si_hdl_typ)sig11_handler);
    203203  struct itimerval t,o;
     
    209209  setitimer(ITIMER_VIRTUAL,&t,&o);
    210210  signal(SIGVTALRM,(si_hdl_typ)sigalarm_handler);
    211 #else
     211# else /* PAGE_TEST */
    212212  if (SIG_ERR==signal(SIGSEGV,(si_hdl_typ)sigsegv_handler))
    213213  {
    214214    PrintS("cannot set signal handler for SEGV\n");
    215215  }
    216 #endif
     216# endif /* PAGE_TEST */
    217217  if (SIG_ERR==signal(SIGFPE, (si_hdl_typ)sigsegv_handler))
    218218  {
     
    235235}
    236236
    237 #else
    238 #ifdef SPARC_SUNOS_4
     237#else /* linux && __i386__ */
     238# ifdef SPARC_SUNOS_4
    239239/*2
    240240* signal handler for run time errors, sparc sunos 4 version
     
    250250                   (int)addr,siRandomStart);
    251251  }
    252 #ifdef __OPTIMIZE__
     252#  ifdef __OPTIMIZE__
    253253  if(si_restart<3)
    254254  {
     
    258258    longjmp(si_start_jmpbuf,1);
    259259  }
    260 #endif
    261 #ifdef CALL_GDB
     260#  endif /* __OPTIMIZE__ */
     261#  ifdef CALL_GDB
    262262  if (sig!=SIGINT) debug(STACK_TRACE);
    263 #endif
     263#  endif /* CALL_GDB */
    264264  exit(0);
    265265}
     
    279279  signal(SIGCHLD, (void (*)(int))SIG_IGN);
    280280}
    281 #else
     281# else /* SPARC_SUNOS_4 */
    282282
    283283/*2
    284284* signal handler for run time errors, general version
    285285*/
    286 #ifndef macintosh
     286# ifndef macintosh
    287287void sigsegv_handler(int sig)
    288288{
     
    295295                   siRandomStart);
    296296  }
    297 #ifdef __OPTIMIZE__
     297#  ifdef __OPTIMIZE__
    298298  if(si_restart<3)
    299299  {
     
    303303    longjmp(si_start_jmpbuf,1);
    304304  }
    305 #endif
    306 #ifdef unix
    307 #ifndef hpux
     305#  endif /* __OPTIMIZE__ */
     306#  ifdef unix
     307#   ifndef hpux
    308308/* debug(..) does not work under HPUX (because ptrace does not work..) */
    309 #ifdef CALL_GDB
    310 #ifndef MSDOS
     309#    ifdef CALL_GDB
     310#     ifndef MSDOS
    311311  if (sig!=SIGINT) debug(STACK_TRACE);
    312 #endif
    313 #endif
    314 #endif
    315 #endif
     312#     endif /* MSDOS */
     313#    endif /* CALL_GDB */
     314#   endif /* !hpux */
     315#  endif /* unix */
    316316  exit(0);
    317317}
    318 #endif
     318# endif /* !macintosh */
    319319
    320320/*2
     
    323323void init_signals()
    324324{
    325 #ifndef MSDOS
     325# ifndef MSDOS
    326326/* signals are not implemented in DJGCC */
    327 #ifndef macintosh
     327#  ifndef macintosh
    328328/* signals are temporaliy removed for macs. */
    329329/*4 signal handler:*/
    330330  signal(SIGSEGV,(void (*) (int))sigsegv_handler);
    331 #ifdef SIGBUS
     331#   ifdef SIGBUS
    332332  signal(SIGBUS, sigsegv_handler);
    333 #endif
    334 #ifdef SIGFPE
     333#   endif
     334#   ifdef SIGFPE
    335335  signal(SIGFPE, sigsegv_handler);
    336 #endif
    337 #ifdef SIGILL
     336#   endif
     337#   ifdef SIGILL
    338338  signal(SIGILL, sigsegv_handler);
    339 #endif
    340 #ifdef SIGIOT
     339#   endif
     340#   ifdef SIGIOT
    341341  signal(SIGIOT, sigsegv_handler);
    342 #endif
    343 #ifdef SIGXCPU
     342#   endif
     343#   ifdef SIGXCPU
    344344  signal(SIGXCPU, (void (*)(int))SIG_IGN);
    345 #endif
     345#   endif
    346346  signal(SIGINT ,sigint_handler);
    347347  signal(SIGCHLD, (void (*)(int))SIG_IGN);
    348 #endif
    349 #endif
     348#  endif
     349# endif
    350350}
    351351#endif
Note: See TracChangeset for help on using the changeset viewer.