1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-02 23:50:47 +02:00

Move fluids off of scm_cell

* libguile/fluids-internal.h: New file for internal definitions.
* libguile/dynstack.c:
* libguile/init.c:
* libguile/intrinsics.c:
* libguile/modules.c:
* libguile/print.c:
* libguile/threads.c: Include new internal file.
* libguile/fluids.c: Use "struct scm_fluid".
* libguile/Makefile.am: Add new file.
This commit is contained in:
Andy Wingo 2025-06-20 14:43:10 +02:00
parent 8141c35ec4
commit 453fe41a26
10 changed files with 116 additions and 57 deletions

View file

@ -38,27 +38,19 @@
#define SCM_FLUID_P(x) (SCM_HAS_TYP7 (x, scm_tc7_fluid))
static inline int
scm_is_fluid (SCM x)
{
return SCM_FLUID_P (x);
}
#define SCM_VALIDATE_FLUID(pos, fluid) \
SCM_I_MAKE_VALIDATE_MSG2 (pos, fluid, scm_is_fluid, "fluid")
#ifdef BUILDING_LIBGUILE
# include <libguile/cache-internal.h>
struct scm_ephemeron_table;
struct scm_dynamic_state
{
SCM thread_local_values;
struct scm_ephemeron_table *values;
uint8_t has_aliased_values;
struct scm_cache cache;
};
#endif
SCM_API SCM scm_make_fluid (void);
SCM_API SCM scm_make_fluid_with_default (SCM dflt);
SCM_API SCM scm_make_unbound_fluid (void);
SCM_API SCM scm_make_thread_local_fluid (SCM dflt);
SCM_API int scm_is_fluid (SCM obj);
SCM_API SCM scm_fluid_p (SCM fl);
SCM_API SCM scm_fluid_thread_local_p (SCM fluid);
SCM_API SCM scm_fluid_ref (SCM fluid);
@ -67,11 +59,6 @@ SCM_API SCM scm_fluid_set_x (SCM fluid, SCM value);
SCM_API SCM scm_fluid_unset_x (SCM fluid);
SCM_API SCM scm_fluid_bound_p (SCM fluid);
SCM_INTERNAL SCM scm_i_fluid_ref (scm_thread *thread, SCM fluid);
SCM_INTERNAL void scm_swap_fluid (SCM fluid, SCM value_box,
scm_t_dynamic_state *dynamic_state);
SCM_API SCM scm_c_with_fluids (SCM fluids, SCM vals,
SCM (*cproc)(void *), void *cdata);
SCM_API SCM scm_c_with_fluid (SCM fluid, SCM val,
@ -89,12 +76,5 @@ SCM_API void scm_dynwind_current_dynamic_state (SCM state);
SCM_API void *scm_c_with_dynamic_state (SCM state,
void *(*func)(void *), void *data);
SCM_API SCM scm_with_dynamic_state (SCM state, SCM proc);
SCM_INTERNAL SCM scm_dynamic_state_ref (SCM state, SCM fluid, SCM dflt);
SCM_INTERNAL SCM scm_i_make_initial_dynamic_state (void);
SCM_INTERNAL void scm_i_fluid_print (SCM exp, SCM port, scm_print_state *pstate);
SCM_INTERNAL void scm_i_dynamic_state_print (SCM exp, SCM port, scm_print_state *pstate);
SCM_INTERNAL void scm_init_fluids (void);
#endif /* SCM_FLUIDS_H */