(scm_frame_fluid): New.
authorMarius Vollmer <mvo@zagadka.de>
Wed, 7 Jan 2004 18:08:52 +0000 (18:08 +0000)
committerMarius Vollmer <mvo@zagadka.de>
Wed, 7 Jan 2004 18:08:52 +0000 (18:08 +0000)
libguile/fluids.c
libguile/fluids.h

index 32a5ffd..7be538f 100644 (file)
@@ -233,6 +233,23 @@ scm_c_with_fluid (SCM fluid, SCM value, SCM (*cproc) (), void *cdata)
 }
 #undef FUNC_NAME
 
+static void
+swap_fluid (SCM data)
+{
+  SCM f = SCM_CAR (data);
+  SCM t = scm_fluid_ref (f);
+  scm_fluid_set_x (f, SCM_CDR (data));
+  SCM_SETCDR (data, t);
+}
+
+void
+scm_frame_fluid (SCM fluid, SCM value)
+{
+  SCM data = scm_cons (fluid, value);
+  scm_frame_rewind_with_scm (swap_fluid, data, SCM_F_WIND_EXPLICITLY);
+  scm_frame_unwind_with_scm (swap_fluid, data, SCM_F_WIND_EXPLICITLY);
+}
+
 void
 scm_init_fluids ()
 {
index 07dce85..8a5150e 100644 (file)
@@ -76,6 +76,8 @@ SCM_API SCM scm_c_with_fluid (SCM fluid, SCM val,
                              SCM (*cproc)(void *), void *cdata);
 SCM_API SCM scm_with_fluids (SCM fluids, SCM vals, SCM thunk);
 
+SCM_API void scm_frame_fluid (SCM fluid, SCM value);
+
 SCM_API SCM scm_i_make_initial_fluids (void);
 SCM_API void scm_i_copy_fluids (scm_root_state *);
 SCM_API void scm_i_swap_fluids (SCM fluids, SCM vals);