#include <stdio.h>
#include "_scm.h"
-#include "genio.h"
#include "smob.h"
#include "alist.h"
#include "eval.h"
#include "stacks.h"
#include "fluids.h"
-#include "scm_validate.h"
+#include "validate.h"
#include "throw.h"
\f
/* the jump buffer data structure */
static int scm_tc16_jmpbuffer;
-#define SCM_JMPBUFP(O) (SCM_NIMP(O) && (SCM_TYP16(O) == scm_tc16_jmpbuffer))
-#define JBACTIVE(O) (SCM_CAR (O) & (1L << 16L))
-#define ACTIVATEJB(O) (SCM_SETOR_CAR (O, (1L << 16L)))
-#define DEACTIVATEJB(O) (SCM_SETAND_CAR (O, ~(1L << 16L)))
+#define SCM_JMPBUFP(OBJ) (SCM_NIMP(OBJ) && (SCM_TYP16(OBJ) == scm_tc16_jmpbuffer))
+
+#define JBACTIVE(OBJ) (SCM_UNPACK_CAR (OBJ) & (1L << 16L))
+#define ACTIVATEJB(OBJ) (SCM_SETOR_CAR (OBJ, (1L << 16L)))
+#define DEACTIVATEJB(OBJ) (SCM_SETAND_CAR (OBJ, ~(1L << 16L)))
#ifndef DEBUG_EXTENSIONS
-#define JBJMPBUF(O) ((jmp_buf*)SCM_CDR (O) )
+#define JBJMPBUF(OBJ) ((jmp_buf*)SCM_CDR (OBJ) )
#define SETJBJMPBUF SCM_SETCDR
#else
-#define SCM_JBDFRAME(O) ((scm_debug_frame*)SCM_CAR (SCM_CDR (O)) )
-#define JBJMPBUF(O) ((jmp_buf*)SCM_CDR (SCM_CDR (O)) )
-#define SCM_SETJBDFRAME(O,X) SCM_SETCAR (SCM_CDR (O), (SCM)(X))
-#define SETJBJMPBUF(O,X) SCM_SETCDR(SCM_CDR (O), X)
+#define SCM_JBDFRAME(OBJ) ((scm_debug_frame*)SCM_CAR (SCM_CDR (OBJ)) )
+#define JBJMPBUF(OBJ) ((jmp_buf*)SCM_CDR (SCM_CDR (OBJ)) )
+#define SCM_SETJBDFRAME(OBJ,X) SCM_SETCAR (SCM_CDR (OBJ), (SCM)(X))
+#define SETJBJMPBUF(OBJ,X) SCM_SETCDR(SCM_CDR (OBJ), X)
static scm_sizet
freejb (SCM jbsmob)
{
scm_puts ("#<jmpbuffer ", port);
scm_puts (JBACTIVE(exp) ? "(active) " : "(inactive) ", port);
- scm_intprint((SCM) JBJMPBUF(exp), 16, port);
+ scm_intprint(SCM_UNPACK ( JBJMPBUF(exp) ), 16, port);
+
scm_putc ('>', port);
return 1 ;
}
BODY is a pointer to a C function which runs the body of the catch;
this is the code you can throw from. We call it like this:
- BODY (BODY_DATA, JMPBUF)
+ BODY (BODY_DATA)
where:
BODY_DATA is just the BODY_DATA argument we received; we pass it
through to BODY as its first argument. The caller can make
BODY_DATA point to anything useful that BODY might need.
- JMPBUF is the Scheme jmpbuf object corresponding to this catch,
- which we have just created and initialized.
HANDLER is a pointer to a C function to deal with a throw to TAG,
should one occur. We call it like this:
}
#define SCM_LAZY_CATCH_P(obj) \
- (SCM_NIMP (obj) && (SCM_CAR (obj) == tc16_lazy_catch))
+ (SCM_NIMP (obj) && (SCM_UNPACK_CAR (obj) == tc16_lazy_catch))
/* Exactly like scm_internal_catch, except:
}
#undef FUNC_NAME
-
SCM
scm_ithrow (SCM key, SCM args, int noreturn)
{
void
scm_init_throw ()
{
-#ifdef DEBUG_EXTENSIONS
scm_tc16_jmpbuffer = scm_make_smob_type_mfpe ("jmpbuffer",
+#ifdef DEBUG_EXTENSIONS
sizeof (scm_cell),
NULL, /* mark */
freejb,
- printjb,
- NULL);
#else
- scm_tc16_jmpbuffer = scm_make_smob_type_mfpe ("jmpbuffer",
0,
NULL, /* mark */
- NULL
+ NULL,
+#endif
printjb,
NULL);
-#endif
tc16_lazy_catch = scm_make_smob_type_mfpe ("lazy-catch", 0,
NULL,