6 /* Copyright (C) 1995,1996,1998,2000 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
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "libguile/__scm.h"
27 #include "libguile/continuations.h"
28 #include "libguile/debug.h"
32 /* With debug options we have the possibility to disable stack checking.
34 #define SCM_STACK_CHECKING_P SCM_STACK_LIMIT
37 # if SCM_STACK_GROWS_UP
38 # define SCM_STACK_OVERFLOW_P(s)\
39 (s > ((SCM_STACKITEM *) SCM_BASE (scm_rootcont) + SCM_STACK_LIMIT))
41 # define SCM_STACK_OVERFLOW_P(s)\
42 (s < ((SCM_STACKITEM *) SCM_BASE (scm_rootcont) - SCM_STACK_LIMIT))
44 # define SCM_CHECK_STACK\
47 if (SCM_STACK_OVERFLOW_P (&stack) && scm_stack_checking_enabled_p)\
48 scm_report_stack_overflow ();\
51 # define SCM_CHECK_STACK /**/
52 #endif /* STACK_CHECKING */
54 SCM_API
int scm_stack_checking_enabled_p
;
58 SCM_API
void scm_report_stack_overflow (void);
59 SCM_API
long scm_stack_size (SCM_STACKITEM
*start
);
60 SCM_API
void scm_stack_report (void);
61 SCM_API
void scm_init_stackchk (void);
63 #endif /* SCM_STACKCHK_H */