From c63f9101f8e6e02a1f034e202d8caa50183992d2 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Mon, 5 May 2025 16:07:30 +0200 Subject: Reimplement weak vectors in Scheme using ephemerons * module/ice-9/weak-vector.scm: New implementation, same interface. * doc/ref/api-memory.texi (Weak vectors): Default weak vector value was documented as empty list when it was actually unspecified, but #f is most useful, so we change documentation and code to match. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (DOT_X_FILES): (DOT_DOC_FILES): (noinst_HEADERS): (modinclude_HEADERS): * libguile.h: * libguile/deprecated.c: * libguile/deprecated.h: * libguile/init.c: * libguile/weak-vector.c: * libguile/weak-vector.h: Remove C weak vector implementation, replaced with deprecation stubs that call out to Scheme. * libguile/weak-set.c: * libguile/weak-table.c: * libguile/weak-list.h: Remove unused internal header. * libguile/eq.c: * libguile/evalext.c: * libguile/goops.c: * libguile/hash.c: * libguile/scm.h: * module/system/base/types.scm: * module/system/base/types/internal.scm: * module/system/vm/assembler.scm: Remove wvect tc7. --- libguile/print.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'libguile/print.c') diff --git a/libguile/print.c b/libguile/print.c index 937454158..17153ba8f 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -70,7 +70,6 @@ #include "vm.h" #include "weak-set.h" #include "weak-table.h" -#include "weak-vector.h" #include "print.h" @@ -564,8 +563,8 @@ scm_iprin1 (SCM exp, SCM port, scm_print_state *pstate) } static void -print_vector_or_weak_vector (SCM v, size_t len, SCM (*ref) (SCM, size_t), - SCM port, scm_print_state *pstate) +print_vector (SCM v, size_t len, SCM (*ref) (SCM, size_t), + SCM port, scm_print_state *pstate) { long i; long last = len - 1; @@ -710,8 +709,8 @@ iprin1 (SCM exp, SCM port, scm_print_state *pstate) break; case scm_tc7_values: scm_puts ("#", port); break; case scm_tc7_program: @@ -771,18 +770,11 @@ iprin1 (SCM exp, SCM port, scm_print_state *pstate) case scm_tc7_thread: scm_i_print_thread (exp, port, pstate); break; - case scm_tc7_wvect: - ENTER_NESTED_DATA (pstate, exp, circref); - scm_puts ("#w(", port); - print_vector_or_weak_vector (exp, scm_c_weak_vector_length (exp), - scm_c_weak_vector_ref, port, pstate); - EXIT_NESTED_DATA (pstate); - break; case scm_tc7_vector: ENTER_NESTED_DATA (pstate, exp, circref); scm_puts ("#(", port); - print_vector_or_weak_vector (exp, SCM_SIMPLE_VECTOR_LENGTH (exp), - scm_c_vector_ref, port, pstate); + print_vector (exp, SCM_SIMPLE_VECTOR_LENGTH (exp), scm_c_vector_ref, + port, pstate); EXIT_NESTED_DATA (pstate); break; case scm_tc7_port: -- cgit v1.2.3