home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue4 / SDL / gcc346 / !gcc / include / unixlib / h / setjmp < prev    next >
Encoding:
Text File  |  2006-09-17  |  2.5 KB  |  92 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/setjmp.h,v $
  4.  * $Date: 2005/03/12 10:33:40 $
  5.  * $Revision: 1.13 $
  6.  * $State: Exp $
  7.  * $Author: alex $
  8.  *
  9.  ***************************************************************************/
  10.  
  11. /* ANSI Standard 4.6: Non-Local Jumps <setjmp.h>.  */
  12.  
  13. #ifndef __SETJMP_H
  14. #define __SETJMP_H
  15.  
  16. #ifndef __UNIXLIB_FEATURES_H
  17. #include <features.h>
  18. #endif
  19.  
  20. #ifndef __UNIXLIB_TYPES_H
  21. #include <unixlib/types.h>
  22. #endif
  23.  
  24. __BEGIN_DECLS
  25.  
  26. /* Warning: if __JMP_BUF_SIZE is updated then lib1aof.s
  27.    and riscos-{aof/elf}.h in gcc/config/arm/ will also need changing.  */
  28. #ifdef __JMP_BUF_SIZE
  29. #if __JMP_BUF_SIZE < 25
  30. #undef __JMP_BUF_SIZE
  31. #endif
  32. #endif
  33.  
  34. #ifndef __JMP_BUF_SIZE
  35. #define __JMP_BUF_SIZE 25
  36. #endif
  37.  
  38. __BEGIN_NAMESPACE_STD
  39. typedef int jmp_buf[__JMP_BUF_SIZE];
  40.  
  41. /* Store the current execution state into env.  */
  42. extern int setjmp (jmp_buf __env) __THROW;
  43.  
  44. /* Jump to the state saved in 'env'. The setjmp call that
  45.    created 'env' will then return 'val'.  If val is zero, then
  46.    setjmp will return 1. */
  47. extern void longjmp (jmp_buf __env, int __val)
  48.      __THROW __attribute__ ((__noreturn__));
  49. __END_NAMESPACE_STD
  50.  
  51. /* We are in 4.3 BSD-compatibility mode in which `setjmp'
  52.    saves the signal mask like `sigsetjmp (ENV, 1)'.  We have to
  53.    define a macro since ISO C says `setjmp' is one.  */
  54. #define setjmp(env)    setjmp (env)
  55.  
  56. #ifdef __USE_POSIX
  57. /* POSIX details.  */
  58.  
  59. /* Calling environment, plus possibly a saved signal mask.  */
  60. typedef struct sigjmp_buf_struct
  61. {
  62.   /* Calling environment.  */
  63.   jmp_buf __jmpbuf;
  64.   /* Saved the signal mask ? */
  65.   int __mask_was_saved;
  66.   __sigset_t saved_mask;
  67.   int saved_currently_handling;
  68. } sigjmp_buf[1];
  69.  
  70.  
  71. /* Similar to setjmp. If save sigs is nonzero, the set of
  72.    blocked signals is saved in state and will be restored
  73.    if a siglongjmp is later performed with this state.  */
  74. extern int sigsetjmp (sigjmp_buf __state, int __savesigs) __THROW;
  75.  
  76. /* Jump to the environment saved in env, making the sigsetjmp
  77.    call there return val, or 1 if val is 0.  Restore the signal
  78.    mask if that sigsetjmp call saved it.  */
  79. extern void siglongjmp (sigjmp_buf __env, int __val)
  80.      __THROW __attribute__ ((__noreturn__));
  81. #endif
  82.  
  83. #ifdef __UNIXLIB_INTERNALS
  84. /* Internal functions.  */
  85. extern void __sigsetjmp_helper (sigjmp_buf __state, int __savesigs);
  86. extern void __siglongjmp_helper (const sigjmp_buf __state, int __savesigs);
  87. #endif
  88.  
  89. __END_DECLS
  90.  
  91. #endif
  92.