2002-01-28 Stefan Jahn <stefan@lkcc.org>
[bpt/guile.git] / libguile / stacks.h
index b034bb3..cdef664 100644 (file)
@@ -1,19 +1,20 @@
 /* classes: h_files */
 
-#ifndef STACKSH
-#define STACKSH
-/*     Copyright (C) 1995,1996, 2000 Free Software Foundation
- * 
+#ifndef SCM_STACKS_H
+#define SCM_STACKS_H
+
+/* Copyright (C) 1995,1996,2000,2001 Free Software Foundation, Inc.
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -46,8 +47,6 @@
  * The author can be reached at djurfeldt@nada.kth.se
  * Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN */
 
-/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
-   gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
 \f
 
 #include "libguile/__scm.h"
@@ -74,20 +73,16 @@ typedef struct scm_t_stack {
   scm_t_info_frame tail[1];
 } scm_t_stack;
 
-#if (SCM_DEBUG_DEPRECATED == 0)
-# define scm_info_frame scm_t_info_frame
-# define scm_stack scm_t_stack
-#endif
-
-extern SCM scm_t_stackype;
+SCM_API SCM scm_stack_type;
 
-#define SCM_STACKP(obj) (SCM_STRUCTP (obj) && SCM_EQ_P (SCM_STRUCT_VTABLE (obj), scm_t_stackype))
+#define SCM_STACKP(obj) (SCM_STRUCTP (obj) && SCM_EQ_P (SCM_STRUCT_VTABLE (obj), scm_stack_type))
 #define SCM_STACK_LENGTH(stack) (SCM_STACK (stack) -> length)
 
-#define SCM_FRAMEP(obj) (SCM_CONSP (obj) \
-                        && SCM_STACKP (SCM_CAR (obj)) \
-                        && SCM_INUMP (SCM_CDR (obj))) \
-
+#define SCM_FRAMEP(obj) \
+  (SCM_CONSP (obj) && SCM_STACKP (SCM_CAR (obj)) \
+   && SCM_INUMP (SCM_CDR (obj)) && SCM_INUM (SCM_CDR (obj)) >= 0 \
+   && ((unsigned long int) SCM_INUM (SCM_CDR (obj)) \
+       < SCM_STACK_LENGTH (SCM_CAR (obj))))
 
 #define SCM_FRAME_REF(frame, slot) \
 (SCM_STACK (SCM_CAR (frame)) -> frames[SCM_INUM (SCM_CDR (frame))].slot) \
@@ -120,29 +115,28 @@ extern SCM scm_t_stackype;
 
 \f
 
-SCM scm_stack_p (SCM obj);
-SCM scm_make_stack (SCM obj, SCM args);
-SCM scm_stack_id (SCM stack);
-SCM scm_stack_ref (SCM stack, SCM i);
-SCM scm_stack_length (SCM stack);
-
-SCM scm_frame_p (SCM obj);
-SCM scm_last_stack_frame (SCM obj);
-SCM scm_frame_number (SCM frame);
-SCM scm_frame_source (SCM frame);
-SCM scm_frame_procedure (SCM frame);
-SCM scm_frame_arguments (SCM frame);
-SCM scm_frame_previous (SCM frame);
-SCM scm_frame_next (SCM frame);
-SCM scm_frame_real_p (SCM frame);
-SCM scm_frame_procedure_p (SCM frame);
-SCM scm_frame_evaluating_args_p (SCM frame);
-SCM scm_frame_overflow_p (SCM frame);
-
-
-void scm_init_stacks (void);
-
-#endif /* STACKSH */
+SCM_API SCM scm_stack_p (SCM obj);
+SCM_API SCM scm_make_stack (SCM obj, SCM args);
+SCM_API SCM scm_stack_id (SCM stack);
+SCM_API SCM scm_stack_ref (SCM stack, SCM i);
+SCM_API SCM scm_stack_length (SCM stack);
+
+SCM_API SCM scm_frame_p (SCM obj);
+SCM_API SCM scm_last_stack_frame (SCM obj);
+SCM_API SCM scm_frame_number (SCM frame);
+SCM_API SCM scm_frame_source (SCM frame);
+SCM_API SCM scm_frame_procedure (SCM frame);
+SCM_API SCM scm_frame_arguments (SCM frame);
+SCM_API SCM scm_frame_previous (SCM frame);
+SCM_API SCM scm_frame_next (SCM frame);
+SCM_API SCM scm_frame_real_p (SCM frame);
+SCM_API SCM scm_frame_procedure_p (SCM frame);
+SCM_API SCM scm_frame_evaluating_args_p (SCM frame);
+SCM_API SCM scm_frame_overflow_p (SCM frame);
+
+SCM_API void scm_init_stacks (void);
+
+#endif  /* SCM_STACKS_H */
 
 /*
   Local Variables: