mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 01:00:20 +02:00
* dynwind.c (scm_dowinds): Handle fluids on the wind list.
* fluids.h (scm_internal_with_fluids, scm_with_fluids, scm_swap_fluids, scm_swap_fluids_reverse): New prototypes. * fluids.c (scm_internal_with_fluids, scm_with_fluids, scm_swap_fluids, scm_swap_fluids_reverse): New functions.
This commit is contained in:
parent
485cb6eb4f
commit
b3460a507a
3 changed files with 122 additions and 12 deletions
|
@ -44,12 +44,23 @@
|
|||
#include "_scm.h"
|
||||
#include "eval.h"
|
||||
#include "alist.h"
|
||||
#include "fluids.h"
|
||||
|
||||
#include "dynwind.h"
|
||||
|
||||
|
||||
/* {Dynamic wind}
|
||||
*/
|
||||
|
||||
Things that can be on the wind list:
|
||||
|
||||
(enter-proc . leave-proc) dynamic-wind
|
||||
(tag . jmpbuf) catch
|
||||
(tag . lazy-catch) lazy-catch
|
||||
tag is either a symbol or a boolean
|
||||
|
||||
((fluid ...) . (value ...)) with-fluids
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@ -94,10 +105,15 @@ scm_dowinds (to, delta)
|
|||
#endif
|
||||
{
|
||||
wind_key = SCM_CAR (wind_elt);
|
||||
if ( !(SCM_NIMP (wind_key) && SCM_SYMBOLP (wind_key))
|
||||
if (!(SCM_NIMP (wind_key) && SCM_SYMBOLP (wind_key))
|
||||
&& (wind_key != SCM_BOOL_F)
|
||||
&& (wind_key != SCM_BOOL_T))
|
||||
scm_apply (wind_key, SCM_EOL, SCM_EOL);
|
||||
{
|
||||
if (SCM_NIMP (wind_key) && SCM_CONSP (wind_key))
|
||||
scm_swap_fluids (wind_key, SCM_CDR (wind_elt));
|
||||
else
|
||||
scm_apply (wind_key, SCM_EOL, SCM_EOL);
|
||||
}
|
||||
}
|
||||
scm_dynwinds = to;
|
||||
}
|
||||
|
@ -119,10 +135,15 @@ scm_dowinds (to, delta)
|
|||
#endif
|
||||
{
|
||||
wind_key = SCM_CAR (wind_elt);
|
||||
if ( !(SCM_NIMP (wind_key) && SCM_SYMBOLP (wind_key))
|
||||
if (!(SCM_NIMP (wind_key) && SCM_SYMBOLP (wind_key))
|
||||
&& (wind_key != SCM_BOOL_F)
|
||||
&& (wind_key != SCM_BOOL_T))
|
||||
scm_apply (from, SCM_EOL, SCM_EOL);
|
||||
{
|
||||
if (SCM_NIMP (wind_key) && SCM_CONSP (wind_key))
|
||||
scm_swap_fluids_reverse (wind_key, from);
|
||||
else
|
||||
scm_apply (from, SCM_EOL, SCM_EOL);
|
||||
}
|
||||
}
|
||||
delta--;
|
||||
goto tail; /* scm_dowinds(to, delta-1); */
|
||||
|
@ -136,4 +157,3 @@ scm_init_dynwind ()
|
|||
{
|
||||
#include "dynwind.x"
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue