6 /* Copyright (C) 1995,1996,1998,2000, 2003, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
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.
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.
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
26 #include "libguile/__scm.h"
28 #include "libguile/continuations.h"
29 #include "libguile/debug.h"
33 /* With debug options we have the possibility to disable stack checking.
35 #define SCM_STACK_CHECKING_P SCM_STACK_LIMIT
37 #if defined BUILDING_LIBGUILE
38 #include "libguile/private-options.h"
39 # if SCM_STACK_GROWS_UP
40 # define SCM_STACK_OVERFLOW_P(s)\
41 ((SCM_STACK_PTR (s) - SCM_I_CURRENT_THREAD->base) > SCM_STACK_LIMIT)
43 # define SCM_STACK_OVERFLOW_P(s)\
44 ((SCM_I_CURRENT_THREAD->base - SCM_STACK_PTR (s)) > SCM_STACK_LIMIT)
46 # define SCM_CHECK_STACK\
49 if (SCM_STACK_OVERFLOW_P (&stack) && scm_stack_checking_enabled_p)\
50 scm_report_stack_overflow ();\
53 # define SCM_CHECK_STACK /**/
56 SCM_API
int scm_stack_checking_enabled_p
;
60 SCM_API
void scm_report_stack_overflow (void);
61 SCM_API
long scm_stack_size (SCM_STACKITEM
*start
);
62 SCM_API
void scm_stack_report (void);
63 SCM_API SCM
scm_sys_get_stack_size (void);
64 SCM_INTERNAL
void scm_init_stackchk (void);
66 #endif /* SCM_STACKCHK_H */