32-way branching in intmap.scm, not 16-way
[bpt/guile.git] / libguile / stackchk.h
CommitLineData
0f2d19dd
JB
1/* classes: h_files */
2
0527e687
DH
3#ifndef SCM_STACKCHK_H
4#define SCM_STACKCHK_H
5
7e2fd4e7 6/* Copyright (C) 1995,1996,1998,2000, 2003, 2006, 2008, 2009, 2010, 2011, 2014 Free Software Foundation, Inc.
0527e687 7 *
73be1d9e 8 * This library is free software; you can redistribute it and/or
53befeb7
NJ
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.
0527e687 12 *
53befeb7
NJ
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
73be1d9e
MV
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
0527e687 17 *
73be1d9e
MV
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
53befeb7
NJ
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301 USA
73be1d9e 22 */
0527e687 23
0f2d19dd 24\f
0527e687 25
b4309c3c 26#include "libguile/__scm.h"
0f2d19dd 27
dfc40e20 28#include "libguile/continuations.h"
dfc40e20 29#include "libguile/debug.h"
d0f6ceb8 30
0f2d19dd
JB
31\f
32
d0f6ceb8 33/* With debug options we have the possibility to disable stack checking.
39f1ef51 34 */
39f1ef51 35#define SCM_STACK_CHECKING_P SCM_STACK_LIMIT
39f1ef51 36
b9b9a028 37#if defined BUILDING_LIBGUILE
b95d76fc 38#include "libguile/private-options.h"
6c4eb8e1 39# if SCM_STACK_GROWS_UP
39f1ef51 40# define SCM_STACK_OVERFLOW_P(s)\
7c4a6456 41 ((SCM_STACK_PTR (s) - SCM_I_CURRENT_THREAD->base) > SCM_STACK_LIMIT)
0f2d19dd 42# else
39f1ef51 43# define SCM_STACK_OVERFLOW_P(s)\
7c4a6456 44 ((SCM_I_CURRENT_THREAD->base - SCM_STACK_PTR (s)) > SCM_STACK_LIMIT)
0f2d19dd
JB
45# endif
46# define SCM_CHECK_STACK\
47 {\
48 SCM_STACKITEM stack;\
39f1ef51 49 if (SCM_STACK_OVERFLOW_P (&stack) && scm_stack_checking_enabled_p)\
0f2d19dd
JB
50 scm_report_stack_overflow ();\
51 }
52#else
53# define SCM_CHECK_STACK /**/
46935a1f 54#endif
0f2d19dd 55
33b001fd 56SCM_API int scm_stack_checking_enabled_p;
0f2d19dd
JB
57
58\f
0f2d19dd 59
33b001fd
MV
60SCM_API long scm_stack_size (SCM_STACKITEM *start);
61SCM_API void scm_stack_report (void);
d8b6e191 62SCM_API SCM scm_sys_get_stack_size (void);
102dbb6f 63SCM_INTERNAL void scm_init_stackchk (void);
0f2d19dd 64
0527e687 65#endif /* SCM_STACKCHK_H */
89e00824
ML
66
67/*
68 Local Variables:
69 c-file-style: "gnu"
70 End:
71*/