First public contribution.
1 /** @file ../include/setjmp.h
5 /** @fn longjmp(jmp_buf __jmpb, int __retval)
9 Refer to setjmp() for the documentation
18 /** @fn setjmp(jmp_buf __jmpb)
21 Note: This description also covers the following functions -
22 longjmp() _setjmp() _longjmp()
24 @return If the return is from a direct invocation, the setjmp function returns 0. If the return is from a call to longjmp(),
25 setjmp() returns a non-zero value.
26 After the longjmp is completed, program execution continues as if
27 the corresponding invocation of setjmp() had just returned the
28 value specified by __retval. If __retval is 0, setjmp() returns 1.
30 The setjmp, and _setjmp functions save their calling environment in __jmpb. Each of these functions returns 0.
32 The corresponding longjmp functions restore the environment saved by their most recent respective
34 of the setjmp function.
35 They then return so that program execution continues as if the corresponding
36 invocation of the setjmp call had just returned the value specified by __retval, instead of 0.
38 The longjmp routines may not be called after the routine which called the setjmp routines returns.
40 All accessible objects have values as of the time longjmp routine was called, except that the values of objects of automatic storage
41 invocation duration that do not have the volatile
42 type and have been changed between the setjmp invocation and longjmp call are indeterminate.
44 The setjmp / longjmp pairs save and restore the signal mask while _setjmp / _longjmp pairs save and restore only the register set and the stack.
52 static void f1( int, int, int );
53 static void f2( void );
54 static jmp_buf jmpbuffer;
62 count = 2; val = 3; sum = 4;
64 if ( setjmp( jmpbuffer ) != 0 )
66 printf("in main: count = %d, val = %d, sum = %d
76 static void f1 (int i, int j, int k )
78 printf("in f1: count = %d, val = %d, sum = %d
83 static void f2( void )
85 longjmp( jmpbuffer, 1 );
91 in f1: count = 97, val = 98, sum = 99
92 in main: count = 2, val = 3, sum = 4
98 The signal related functionalities aren't applicable to the Symbian
99 OS implementation as there is no support for signals. This means that the setjmp and _setjmp routines have the same functionality and so do longjmp and _longjmp .
104 @externallyDefinedApi
110 The _longjmp() and _setjmp() functions shall be equivalent to longjmp() and setjmp(), respectively, with the additional restriction that _longjmp() and _setjmp() shall not manipulate the signal mask.
113 @externallyDefinedApi
118 The _longjmp() and _setjmp() functions shall be equivalent to longjmp() and setjmp(), respectively, with the additional restriction that _longjmp() and _setjmp() shall not manipulate the signal mask.
121 @externallyDefinedApi