mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 06:20:23 +02:00
* dynwind.c: changed the wind-guards representation to double
cell.
This commit is contained in:
parent
7cf1a27e9c
commit
bd47429edb
1 changed files with 8 additions and 27 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -135,27 +135,13 @@ SCM_DEFINE (scm_dynamic_wind, "dynamic-wind", 3, 0, 0,
|
||||||
* smob. Objects of this type are pushed onto the dynwind chain.
|
* smob. Objects of this type are pushed onto the dynwind chain.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct guardsmem {
|
#define SCM_GUARDSP(obj) SCM_SMOB_PREDICATE (tc16_guards, obj)
|
||||||
scm_guard_t before;
|
#define SCM_BEFORE_GUARD(obj) ((scm_guard_t) SCM_CELL_WORD (obj, 1))
|
||||||
scm_guard_t after;
|
#define SCM_AFTER_GUARD(obj) ((scm_guard_t) SCM_CELL_WORD (obj, 2))
|
||||||
void *data;
|
#define SCM_GUARD_DATA(obj) ((void *) SCM_CELL_WORD (obj, 3))
|
||||||
} guardsmem;
|
|
||||||
|
|
||||||
#define SCM_GUARDSMEM(obj) ((guardsmem *) SCM_CDR (obj))
|
|
||||||
#define SCM_BEFORE_GUARD(obj) (SCM_GUARDSMEM (obj)->before)
|
|
||||||
#define SCM_AFTER_GUARD(obj) (SCM_GUARDSMEM (obj)->after)
|
|
||||||
#define SCM_GUARD_DATA(obj) (SCM_GUARDSMEM (obj)->data)
|
|
||||||
#define SCM_GUARDSP(obj) (SCM_NIMP(obj) && (SCM_UNPACK_CAR (obj) == tc16_guards))
|
|
||||||
|
|
||||||
static long tc16_guards;
|
static long tc16_guards;
|
||||||
|
|
||||||
static scm_sizet
|
|
||||||
freeguards (SCM guards)
|
|
||||||
{
|
|
||||||
scm_must_free ((char *) SCM_CDR (guards));
|
|
||||||
return sizeof (guardsmem);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
printguards (SCM exp, SCM port, scm_print_state *pstate)
|
printguards (SCM exp, SCM port, scm_print_state *pstate)
|
||||||
{
|
{
|
||||||
|
@ -173,13 +159,8 @@ scm_internal_dynamic_wind (scm_guard_t before,
|
||||||
void *guard_data)
|
void *guard_data)
|
||||||
{
|
{
|
||||||
SCM guards, ans;
|
SCM guards, ans;
|
||||||
guardsmem *g;
|
|
||||||
before (guard_data);
|
before (guard_data);
|
||||||
g = (guardsmem *) scm_must_malloc (sizeof (*g), "guards");
|
SCM_NEWSMOB3 (guards, tc16_guards, before, after, guard_data);
|
||||||
g->before = before;
|
|
||||||
g->after = after;
|
|
||||||
g->data = guard_data;
|
|
||||||
SCM_NEWSMOB (guards, tc16_guards, g);
|
|
||||||
scm_dynwinds = scm_acons (guards, SCM_BOOL_F, scm_dynwinds);
|
scm_dynwinds = scm_acons (guards, SCM_BOOL_F, scm_dynwinds);
|
||||||
ans = inner (inner_data);
|
ans = inner (inner_data);
|
||||||
scm_dynwinds = SCM_CDR (scm_dynwinds);
|
scm_dynwinds = SCM_CDR (scm_dynwinds);
|
||||||
|
@ -288,7 +269,7 @@ scm_dowinds (SCM to, long delta)
|
||||||
void
|
void
|
||||||
scm_init_dynwind ()
|
scm_init_dynwind ()
|
||||||
{
|
{
|
||||||
tc16_guards = scm_make_smob_type_mfpe ("guards", sizeof (struct guardsmem),
|
tc16_guards = scm_make_smob_type_mfpe ("guards", 0,
|
||||||
NULL, freeguards, printguards, NULL);
|
NULL, scm_free0, printguards, NULL);
|
||||||
#include "dynwind.x"
|
#include "dynwind.x"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue