blitz_ex.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef BLITZ_EX_H
  2. #define BLITZ_EX_H
  3. #include "blitz_types.h"
  4. #ifdef __cplusplus
  5. extern "C"{
  6. #endif
  7. #if __APPLE__
  8. #if __i386__
  9. #define BB_ARGP 1
  10. void* bbArgp( int offset );
  11. #endif
  12. #endif
  13. #ifdef __MINGW64__
  14. #if __clang__
  15. typedef jmp_buf BBExJmpBuf;
  16. #else
  17. typedef intptr_t BBExJmpBuf[5];
  18. #endif
  19. #else
  20. typedef jmp_buf BBExJmpBuf;
  21. #endif
  22. // bbExTry can't be a function due to how setjmp works, so a macro it is
  23. #ifdef __MINGW64__
  24. #ifdef __clang__
  25. #define bbExTry \
  26. BBExJmpBuf* buf = bbExEnter(); \
  27. switch(setjmp(*buf))
  28. #else
  29. #define bbExTry \
  30. BBExJmpBuf* buf = bbExEnter(); \
  31. int jmp_status = 0; \
  32. if(__builtin_setjmp(*buf)) jmp_status = bbExStatus(); \
  33. switch(jmp_status)
  34. #endif
  35. #elif __APPLE__
  36. #define bbExTry \
  37. BBExJmpBuf* buf = bbExEnter(); \
  38. switch(_setjmp(*buf))
  39. #else
  40. #define bbExTry \
  41. BBExJmpBuf* buf = bbExEnter(); \
  42. switch(setjmp(*buf))
  43. #endif
  44. BBExJmpBuf* bbExEnter();
  45. void bbExThrow( BBObject *p );
  46. void bbExThrowCString( const char *p );
  47. void bbExLeave();
  48. int bbExStatus();
  49. BBObject* bbExCatchAndReenter();
  50. BBObject* bbExCatch();
  51. //void _bbExEnter( void *_cpu_state );
  52. //void* _bbExThrow( void *_cpu_state,void *p );
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif