PageRenderTime 53ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/rpython/translator/c/src/exception.h

https://bitbucket.org/pypy/pypy/
C Header | 43 lines | 25 code | 10 blank | 8 comment | 1 complexity | 58fb70e8ba351a1fad5197ff8f8872e4 MD5 | raw file
Possible License(s): AGPL-3.0, BSD-3-Clause, Apache-2.0
  1. /************************************************************/
  2. /*** C header subsection: exceptions ***/
  3. #ifdef HAVE_RTYPER // shrug, hopefully dies with PYPY_NOT_MAIN_FILE
  4. /* just a renaming, unless DO_LOG_EXC is set */
  5. #define RPyExceptionOccurred RPyExceptionOccurred1
  6. #define RPY_DEBUG_RETURN() /* nothing */
  7. #ifdef DO_LOG_EXC
  8. #undef RPyExceptionOccurred
  9. #undef RPY_DEBUG_RETURN
  10. #define RPyExceptionOccurred() RPyDebugException(" noticing a")
  11. #define RPY_DEBUG_RETURN() RPyDebugException("leaving with")
  12. #define RPyDebugException(msg) ( \
  13. RPyExceptionOccurred1() \
  14. ? (RPyDebugReturnShowException(msg, __FILE__, __LINE__, __FUNCTION__), 1) \
  15. : 0 \
  16. )
  17. #endif
  18. /* !DO_LOG_EXC: define the function anyway, so that we can shut
  19. off the prints of a debug_exc by remaking only testing_1.o */
  20. RPY_EXTERN
  21. void RPyDebugReturnShowException(const char *msg, const char *filename,
  22. long lineno, const char *functionname);
  23. /* Hint: functions and macros not defined here, like RPyRaiseException,
  24. come from exctransformer via the table in extfunc.py. */
  25. #define RPyFetchException(etypevar, evaluevar, type_of_evaluevar) do { \
  26. etypevar = RPyFetchExceptionType(); \
  27. evaluevar = (type_of_evaluevar)RPyFetchExceptionValue(); \
  28. RPyClearException(); \
  29. } while (0)
  30. /* prototypes */
  31. RPY_EXTERN
  32. void _RPyRaiseSimpleException(RPYTHON_EXCEPTION rexc);
  33. #endif