Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2875 dpurdie 1
#pragma force_top_level
2
#pragma include_only_once
3
 
4
/* setjmp.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.6 */
5
/* Copyright (C) Codemist Ltd., 1988                            */
6
/* Copyright (C) Advanced Risc Machines Ltd., 1991              */
7
/* version 0.04 */
8
 
9
/*
10
 * setjmp.h declares two functions and one type, for bypassing the normal
11
 * function call and return discipline (useful for dealing with unusual
12
 * conditions encountered in a low-level function of a program).
13
 */
14
 
15
#ifndef __setjmp_h
16
#define __setjmp_h
17
 
18
#ifdef __cplusplus
19
extern "C" {
20
#endif
21
 
22
#ifdef __JMP_BUF_SIZE
23
typedef int jmp_buf[__JMP_BUF_SIZE];
24
#else
25
typedef int jmp_buf[22];    /* size suitable for the ARM */
26
#endif                      /* an array type suitable for holding the data */
27
                            /* needed to restore a calling environment.    */
28
 
29
/* setjmp is a macro so that it cannot be used other than directly called. */
30
/* NB that ANSI declare that anyone who undefined the setjmp macro or uses */
31
/* (or defines) the name setjmp without including this header will get     */
32
/* what they deserve.                                                      */
33
 
34
#ifdef __STDC__
35
/* -pcc mode doesn't allow circular definitions... */
36
#define setjmp(jmp_buf) (setjmp(jmp_buf))
37
#endif
38
 
39
extern int setjmp(jmp_buf /*env*/);
40
   /* Saves its calling environment in its jmp_buf argument, for later use
41
    * by the longjmp function.
42
    * Returns: If the return is from a direct invocation, the setjmp function
43
    *          returns the value zero. If the return from a call to the longjmp
44
    *          function, the setjmp function returns a non zero value.
45
    */
46
 
47
extern void longjmp(jmp_buf /*env*/, int /*val*/);
48
   /* Restores the environment saved by the most recent call to setjmp in the
49
    * same invocation of the program, with the corresponding jmp_buf argument.
50
    * If there has been no such call, or if the function containing the call
51
    * to setjmp has terminated execution (eg. with a return statement) in the
52
    * interim, the behaviour is undefined.
53
    * All accessible objects have values as of the time longjmp was called,
54
    * except that the values of objects of automatic storage duration that do
55
    * not have volatile type and have been changed between the setjmp and
56
    * longjmp calls are indeterminate.
57
    * As it bypasses the usual function call and return mechanism, the longjmp
58
    * function shall execute correctly in contexts of interrupts, signals and
59
    * any of their associated functions. However, if the longjmp function is
60
    * invoked from a nested signal handler (that is, from a function invoked as
61
    * a result of a signal raised during the handling of another signal), the
62
    * behaviour is undefined.
63
    * Returns: After longjmp is completed, program execution continues as if
64
    *          the corresponding call to setjmp had just returned the value
65
    *          specified by val. The longjmp function cannot cause setjmp to
66
    *          return the value 0; if val is 0, setjmp returns the value 1.
67
    */
68
 
69
#ifdef __cplusplus
70
}
71
#endif
72
 
73
#endif
74
 
75
/* end of setjmp.h */