32-way branching in intmap.scm, not 16-way
[bpt/guile.git] / libguile / stacks.h
1 /* classes: h_files */
2
3 #ifndef SCM_STACKS_H
4 #define SCM_STACKS_H
5
6 /* Copyright (C) 1995,1996,2000,2001, 2004, 2006, 2008 Free Software Foundation, Inc.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
23
24 \f
25
26 #include "libguile/__scm.h"
27 #include "libguile/frames.h"
28
29 /* {Frames and stacks}
30 */
31
32 SCM_API SCM scm_stack_type;
33
34 #define SCM_STACK_LAYOUT \
35 "pw" /* len */ \
36 "pw" /* id */ \
37 "pw" /* frame */
38
39 #define SCM_STACKP(obj) (SCM_STRUCTP (obj) && scm_is_eq (SCM_STRUCT_VTABLE (obj), scm_stack_type))
40 #define SCM_STACK_LENGTH(obj) (scm_to_long (SCM_STRUCT_SLOT_REF (obj,0)))
41 #define SCM_SET_STACK_LENGTH(obj,f) (SCM_STRUCT_SLOT_SET (obj,0,scm_from_long (f)))
42 #define SCM_STACK_ID(obj) (SCM_STRUCT_SLOT_REF (obj,1))
43 #define SCM_SET_STACK_ID(obj,f) (SCM_STRUCT_SLOT_SET (obj,1,f))
44 #define SCM_STACK_FRAME(obj) (SCM_STRUCT_SLOT_REF (obj,2))
45 #define SCM_SET_STACK_FRAME(obj,f) (SCM_STRUCT_SLOT_SET (obj,2,f))
46
47 #define SCM_FRAMEP(obj) (SCM_VM_FRAME_P (obj))
48
49
50 \f
51
52 SCM_API SCM scm_stack_p (SCM obj);
53 SCM_API SCM scm_make_stack (SCM obj, SCM args);
54 SCM_API SCM scm_stack_id (SCM stack);
55 SCM_API SCM scm_stack_ref (SCM stack, SCM i);
56 SCM_API SCM scm_stack_length (SCM stack);
57
58 SCM_INTERNAL void scm_init_stacks (void);
59
60 #endif /* SCM_STACKS_H */
61
62 /*
63 Local Variables:
64 c-file-style: "gnu"
65 End:
66 */