* Remove deprecated macros and typenames.
[bpt/guile.git] / libguile / continuations.h
CommitLineData
0f2d19dd
JB
1/* classes: h_files */
2
b29058ff
DH
3#ifndef SCM_CONTINUATIONS_H
4#define SCM_CONTINUATIONS_H
5
6/* Copyright (C) 1995,1996,2000,2001 Free Software Foundation, Inc.
7 *
0f2d19dd
JB
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
b29058ff 12 *
0f2d19dd
JB
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
b29058ff 17 *
0f2d19dd
JB
18 * You should have received a copy of the GNU General Public License
19 * along with this software; see the file COPYING. If not, write to
82892bed
JB
20 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
21 * Boston, MA 02111-1307 USA
0f2d19dd
JB
22 *
23 * As a special exception, the Free Software Foundation gives permission
24 * for additional uses of the text contained in its release of GUILE.
25 *
26 * The exception is that, if you link the GUILE library with other files
27 * to produce an executable, this does not by itself cause the
28 * resulting executable to be covered by the GNU General Public License.
29 * Your use of that executable is in no way restricted on account of
30 * linking the GUILE library code into it.
31 *
32 * This exception does not however invalidate any other reasons why
33 * the executable file might be covered by the GNU General Public License.
34 *
35 * This exception applies only to the code released by the
36 * Free Software Foundation under the name GUILE. If you copy
37 * code from other Free Software Foundation releases into a copy of
38 * GUILE, as the General Public License permits, the exception does
39 * not apply to the code that you add in this way. To avoid misleading
40 * anyone as to the status of such modified files, you must delete
41 * this exception notice from them.
42 *
43 * If you write modifications of your own for GUILE, it is your choice
44 * whether to permit this exception to apply to your modifications.
82892bed 45 * If you do not wish that, delete this exception notice. */
b29058ff 46
0f2d19dd 47\f
b29058ff 48
b4309c3c 49#include "libguile/__scm.h"
0f2d19dd
JB
50
51\f
52
5f144b10
GH
53/* a continuation SCM is a non-immediate pointing to a heap cell with:
54 word 0: bits 0-15: unused.
55 bits 16-31: smob type tag: scm_tc16_continuation.
92c2555f 56 word 1: malloc block containing an scm_t_contregs structure with a
5f144b10
GH
57 tail array of SCM_STACKITEM. the size of the array is stored
58 in the num_stack_items field of the structure.
59*/
60
92c2555f 61extern scm_t_bits scm_tc16_continuation;
5f144b10 62
0f2d19dd
JB
63typedef struct
64{
65 SCM throw_value;
66 jmp_buf jmpbuf;
67 SCM dynenv;
5f144b10 68 SCM_STACKITEM *base; /* base of the live stack, before it was saved. */
c014a02e
ML
69 size_t num_stack_items; /* size of the saved stack. */
70 unsigned long seq; /* dynamic root identifier. */
0f2d19dd
JB
71
72#ifdef DEBUG_EXTENSIONS
5f144b10
GH
73 /* the most recently created debug frame on the live stack, before
74 it was saved. */
92c2555f 75 struct scm_t_debug_frame *dframe;
0f2d19dd 76#endif
5f144b10 77 SCM_STACKITEM stack[1]; /* copied stack of size num_stack_items. */
92c2555f 78} scm_t_contregs;
1be6b49c 79
e841c3e0 80#define SCM_CONTINUATIONP(x) SCM_TYP16_PREDICATE (scm_tc16_continuation, x)
8b3bda20 81
92c2555f 82#define SCM_CONTREGS(x) ((scm_t_contregs *) SCM_CELL_WORD_1 (x))
8b3bda20 83
5f144b10
GH
84#define SCM_CONTINUATION_LENGTH(x) (SCM_CONTREGS (x)->num_stack_items)
85#define SCM_SET_CONTINUATION_LENGTH(x,n)\
86 (SCM_CONTREGS (x)->num_stack_items = (n))
8b3bda20
DH
87#define SCM_JMPBUF(x) ((SCM_CONTREGS (x))->jmpbuf)
88#define SCM_DYNENV(x) ((SCM_CONTREGS (x))->dynenv)
89#define SCM_THROW_VALUE(x) ((SCM_CONTREGS (x))->throw_value)
90#define SCM_BASE(x) ((SCM_CONTREGS (x))->base)
91#define SCM_SEQ(x) ((SCM_CONTREGS (x))->seq)
92#define SCM_DFRAME(x) ((SCM_CONTREGS (x))->dframe)
0f2d19dd
JB
93
94\f
95
5f144b10 96extern SCM scm_make_continuation (int *first);
7866a09b 97extern void scm_init_continuations (void);
0f2d19dd 98
b29058ff 99#endif /* SCM_CONTINUATIONS_H */
89e00824
ML
100
101/*
102 Local Variables:
103 c-file-style: "gnu"
104 End:
105*/