~peter-pearse/ubuntu/natty/guile-1.8/prop001

« back to all changes in this revision

Viewing changes to libguile/stackchk.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Schepler
  • Date: 2006-11-09 03:11:16 UTC
  • Revision ID: james.westby@ubuntu.com-20061109031116-hu0q1jxqg12y6yeg
Tags: upstream-1.8.1+1
ImportĀ upstreamĀ versionĀ 1.8.1+1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* classes: h_files */
 
2
 
 
3
#ifndef SCM_STACKCHK_H
 
4
#define SCM_STACKCHK_H
 
5
 
 
6
/* Copyright (C) 1995,1996,1998,2000, 2003, 2006 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
 
10
 * License as published by the Free Software Foundation; either
 
11
 * version 2.1 of the License, or (at your option) any later version.
 
12
 *
 
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.
 
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 02110-1301 USA
 
21
 */
 
22
 
 
23
 
 
24
 
 
25
#include "libguile/__scm.h"
 
26
 
 
27
#include "libguile/continuations.h"
 
28
#include "libguile/debug.h"
 
29
 
 
30
 
 
31
 
 
32
/* With debug options we have the possibility to disable stack checking.
 
33
 */
 
34
#define SCM_STACK_CHECKING_P SCM_STACK_LIMIT
 
35
 
 
36
#ifdef STACK_CHECKING
 
37
# if SCM_STACK_GROWS_UP
 
38
#  define SCM_STACK_OVERFLOW_P(s)\
 
39
   (SCM_STACK_PTR (s) \
 
40
    > (SCM_I_CURRENT_THREAD->base + SCM_STACK_LIMIT))
 
41
# else
 
42
#  define SCM_STACK_OVERFLOW_P(s)\
 
43
   (SCM_STACK_PTR (s) \
 
44
    < (SCM_I_CURRENT_THREAD->base - SCM_STACK_LIMIT))
 
45
# endif
 
46
# define SCM_CHECK_STACK\
 
47
    {\
 
48
       SCM_STACKITEM stack;\
 
49
       if (SCM_STACK_OVERFLOW_P (&stack) && scm_stack_checking_enabled_p)\
 
50
         scm_report_stack_overflow ();\
 
51
    }
 
52
#else
 
53
# define SCM_CHECK_STACK /**/
 
54
#endif /* STACK_CHECKING */
 
55
 
 
56
SCM_API int scm_stack_checking_enabled_p;
 
57
 
 
58
 
 
59
 
 
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 void scm_init_stackchk (void);
 
64
 
 
65
#endif  /* SCM_STACKCHK_H */
 
66
 
 
67
/*
 
68
  Local Variables:
 
69
  c-file-style: "gnu"
 
70
  End:
 
71
*/