The FSF has a new address.
[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
79f55b7c 6/* Copyright (C) 1995,1996,1998,2000, 2003 Free Software Foundation, Inc.
0527e687 7 *
73be1d9e
MV
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
0527e687 12 *
73be1d9e 13 * This library is distributed in the hope that it will be useful,
0f2d19dd 14 * but 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
92205699 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
73be1d9e 21 */
0527e687 22
0f2d19dd 23\f
0527e687 24
b4309c3c 25#include "libguile/__scm.h"
0f2d19dd 26
dfc40e20 27#include "libguile/continuations.h"
dfc40e20 28#include "libguile/debug.h"
d0f6ceb8 29
0f2d19dd
JB
30\f
31
d0f6ceb8 32/* With debug options we have the possibility to disable stack checking.
39f1ef51 33 */
39f1ef51 34#define SCM_STACK_CHECKING_P SCM_STACK_LIMIT
39f1ef51
MD
35
36#ifdef STACK_CHECKING
6c4eb8e1 37# if SCM_STACK_GROWS_UP
39f1ef51 38# define SCM_STACK_OVERFLOW_P(s)\
79f55b7c 39 (SCM_STACK_PTR (s) \
9de87eea 40 > (SCM_I_CURRENT_THREAD->base + SCM_STACK_LIMIT))
0f2d19dd 41# else
39f1ef51 42# define SCM_STACK_OVERFLOW_P(s)\
79f55b7c 43 (SCM_STACK_PTR (s) \
9de87eea 44 < (SCM_I_CURRENT_THREAD->base - 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 /**/
39f1ef51 54#endif /* STACK_CHECKING */
0f2d19dd 55
33b001fd 56SCM_API int scm_stack_checking_enabled_p;
0f2d19dd
JB
57
58\f
0f2d19dd 59
33b001fd
MV
60SCM_API void scm_report_stack_overflow (void);
61SCM_API long scm_stack_size (SCM_STACKITEM *start);
62SCM_API void scm_stack_report (void);
63SCM_API 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*/