MicrOS
setjmp.h File Reference
#include <stdint.h>

Go to the source code of this file.

Typedefs

typedef uint32_t jmp_buf[5]
 Type to hold information to restore calling environment. Contains ebx, esi, edi, ebp, return address. More...
 

Functions

void longjmp (jmp_buf env, int val)
 Long jump. More...
 
int setjmp (jmp_buf env)
 Save calling environment for long jump. More...
 

Typedef Documentation

◆ jmp_buf

typedef uint32_t jmp_buf[5]

Type to hold information to restore calling environment. Contains ebx, esi, edi, ebp, return address.

Function Documentation

◆ longjmp()

void longjmp ( jmp_buf  env,
int  val 
)

Long jump.

Restores the environment to the state indicated by env, evaluating the setjmp expression that filled env as val.

Parameters
envObject of type jmp_buf filled by a previous call to setjmp that contains information to restore the environment to that point.
valValue to which the setjmp expression evaluates. If this is zero, the expression evaluates as 1.

◆ setjmp()

int setjmp ( jmp_buf  env)

Save calling environment for long jump.

Fills env with information about the current state of the calling environment in that point of code execution, so that it can be restored by a later call to longjmp.

Parameters
envObject of type jmp_buf where the environment information is stored.
Returns
This macro may return more than once: A first time, on its direct invocation; In this case it always returns zero. When longjmp is called with the information set to env, the macro returns again; this time it returns the value passed to longjmp as second argument if this is different from zero, or 1 if it is zero.