home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 15 / AACD15.ISO / AACD / Programming / Python2 / Python20_source / Python / sigcheck.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-10-25  |  901 b   |  34 lines

  1.  
  2. /* Sigcheck is similar to intrcheck() but sets an exception when an
  3.    interrupt occurs.  It can't be in the intrcheck.c file since that
  4.    file (and the whole directory it is in) doesn't know about objects
  5.    or exceptions.  It can't be in errors.c because it can be
  6.    overridden (at link time) by a more powerful version implemented in
  7.    signalmodule.c. */
  8.  
  9. #include "Python.h"
  10.  
  11. #ifdef __SASC
  12. /* Replacement stack overflow routine for SAS/C */
  13. void __stdargs _CXOVF(void)
  14. {
  15.     PyErr_SetString(PyExc_MemoryError,"too deep recursion");
  16. }
  17. #endif /* __SASC */
  18.  
  19. /* ARGSUSED */
  20. int
  21. PyErr_CheckSignals(void)
  22. {
  23. #ifdef __SASC
  24. /* Amiga SAS/C: Explicit check of available stack */
  25. extern unsigned long stackavail(void);
  26. extern long __STKNEED;
  27. if(stackavail()<__STKNEED) return _CXOVF(),-1;
  28. #endif /* __SASC */
  29.     if (!PyOS_InterruptOccurred())
  30.         return 0;
  31.     PyErr_SetNone(PyExc_KeyboardInterrupt);
  32.     return -1;
  33. }
  34.