setjmp.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * setjmp.h
  3. *
  4. * Declarations supporting setjmp and longjump, a method for avoiding
  5. * the normal function call return sequence. (Bleah!)
  6. *
  7. * This file is part of the Mingw32 package.
  8. *
  9. * Contributors:
  10. * Created by Colin Peters <[email protected]>
  11. *
  12. * THIS SOFTWARE IS NOT COPYRIGHTED
  13. *
  14. * This source code is offered for use in the public domain. You may
  15. * use, modify or distribute it freely.
  16. *
  17. * This code is distributed in the hope that it will be useful but
  18. * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
  19. * DISCLAIMED. This includes but is not limited to warranties of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  21. *
  22. * $Revision: 1.2 $
  23. * $Author: bellard $
  24. * $Date: 2005/04/17 13:14:29 $
  25. *
  26. */
  27. #ifndef _SETJMP_H_
  28. #define _SETJMP_H_
  29. /* All the headers include this file. */
  30. #include <_mingw.h>
  31. #ifndef RC_INVOKED
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. /*
  36. * The buffer used by setjmp to store the information used by longjmp
  37. * to perform it's evil goto-like work. The size of this buffer was
  38. * determined through experimentation; it's contents are a mystery.
  39. * NOTE: This was determined on an i386 (actually a Pentium). The
  40. * contents could be different on an Alpha or something else.
  41. */
  42. #define _JBLEN 16
  43. #define _JBTYPE int
  44. typedef _JBTYPE jmp_buf[_JBLEN];
  45. /*
  46. * The function provided by CRTDLL which appears to do the actual work
  47. * of setjmp.
  48. */
  49. int _setjmp (jmp_buf);
  50. #define setjmp(x) _setjmp(x)
  51. /*
  52. * Return to the last setjmp call and act as if setjmp had returned
  53. * nVal (which had better be non-zero!).
  54. */
  55. void longjmp (jmp_buf, int);
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif /* Not RC_INVOKED */
  60. #endif /* Not _SETJMP_H_ */