1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-01 23:30:28 +02:00
Commit graph

9790 commits

Author SHA1 Message Date
Andy Wingo
4dedc48cfb Switch all users of SCM_SIMPLE_VECTOR_REF to scm_c_vector_ref
* libguile/arrays.c:
* libguile/eval.c:
* libguile/filesys.c:
* libguile/hashtab.c:
* libguile/intrinsics.c:
* libguile/memoize.c:
* libguile/modules.c:
* libguile/poll.c:
* libguile/ports-internal.h:
* libguile/posix.c:
* libguile/print.c:
* libguile/scmsigs.c:
* libguile/socket.c:
* libguile/stime.c:
* libguile/strports.c:
* libguile/vectors.c: Use C function instead of macro.
2025-06-24 10:32:14 +02:00
Andy Wingo
d73c675fa6 Switch all users of SCM_SIMPLE_VECTOR_LENGTH to scm_c_vector_length
* libguile/arrays.c:
* libguile/eval.c:
* libguile/filesys.c:
* libguile/hash.c:
* libguile/hashtab.c:
* libguile/memoize.c:
* libguile/modules.c:
* libguile/poll.c:
* libguile/posix.c:
* libguile/print.c:
* libguile/socket.c:
* libguile/stime.c: Use C function instead of macro.
2025-06-24 09:59:24 +02:00
Andy Wingo
0a5d2ffb1a Move foreign pointers off scm_words
* libguile/foreign.h: Give pointers a struct type.  Adapt to use it
internally.
* libguile/foreign.c: Allocate pointers with scm_allocate_tagged.
2025-06-24 09:27:44 +02:00
Andy Wingo
61af4d201a Syntax uses scm_allocate_tagged
* libguile/syntax.c: Define a "struct scm_syntax".  Use it instead of
scm_words and SCM_CELL_OBJECT.
2025-06-23 21:06:31 +02:00
Andy Wingo
a5f9d0da6a Vm creates values with scm_allocate_tagged
* libguile/vm-engine.c (halt): Make values with scm_allocate_tagged.
2025-06-23 20:45:00 +02:00
Andy Wingo
20fcb8ac12 Convert hash tables away from scm_cell
* libguile/hashtab.h (SCM_HASHTABLE_VECTOR):
(SCM_SET_HASHTABLE_VECTOR):
(SCM_HASHTABLE):
(SCM_HASHTABLE_N_ITEMS):
(SCM_SET_HASHTABLE_N_ITEMS):
(SCM_HASHTABLE_INCREMENT):
(SCM_HASHTABLE_DECREMENT):
(SCM_HASHTABLE_UPPER):
(SCM_HASHTABLE_LOWER):
(SCM_HASHTABLE_N_BUCKETS):
(SCM_HASHTABLE_BUCKET):
(SCM_SET_HASHTABLE_BUCKET): Remove these internal definitions from the
public interface.
(scm_t_hashtable): Add a tag, and add buckets.
(scm_is_hashtable):
(scm_to_hashtable):
(scm_from_hashtable): New helpers.
* libguile/modules.c (scm_module_reverse_lookup): Adapt to hash table
API change.
* libguile/hashtab.c: Rework to access hash table data through the typed
"struct scm_t_hashtable".
2025-06-23 20:44:55 +02:00
Andy Wingo
b25a743cf9 Get strings, symbols, stringbufs off scm_double_cell
* libguile/symbols.h (scm_is_symbol, scm_to_symbol, scm_from_symbol):
Define some helpers and a "struct scm_symbol".
* libguile/strings-internal.h (scm_i_string_data): Remove.
* libguile/print.c (write_char_in_string, write_narrow_string)
(write_wide_string): Refactor to avoid per-char narrow checks.
(write_character): Move up.
(iprin1): Adapt to call write_narrow_string / write_wide_string.
* libguile/srfi-13.c (scm_string_eq): Avoid scm_i_string_data.
* libguile/strings.c (scm_is_stringbuf, scm_to_stringbuf)
(scm_from_stringbuf, stringbuf_is_wide, stringbuf_is_narrow)
(stringbuf_is_mutable, stringbuf_set_mutable, stringbuf_length)
(as_narrow_stringbuf, as_wide_stringbuf, narrow_stringbuf_chars)
(wide_stringbuf_chars, scm_to_string, scm_from_string, string_is_read_only)
(string_is_shared, string_stringbuf, string_aliased_string, string_start)
(string_length): New inline function helpers, to replace a pile of
macros.  Adapt all users.
2025-06-23 15:00:09 +02:00
Andy Wingo
c8cd88b533 Remove SCM_IMMUTABLE_CELL, SCM_IMMUTABLE_DOUBLE_CELL
* libguile/snarf.h (SCM_IMMUTABLE_CELL):
(SCM_IMMUTABLE_DOUBLE_CELL): Remove.  No longer used.  Hopefully there
are no direct external users!
2025-06-23 15:00:09 +02:00
Andy Wingo
02c2516b35 Remove SCM_IMMUTABLE_POINTER
* libguile/foreign.h (SCM_IMMUTABLE_POINTER): Remove.  This was part of
the implementation of static subrs, a long long time ago, but hasn't
been used since 2013 (27337b6373).
2025-06-23 15:00:09 +02:00
Andy Wingo
c370d12d03 Better type-safety for snarfed immutable strings
* libguile/strings.h: Add struct types for stringbufs and strings.
(SCM_IMMUTABLE_STRINGBUF, SCM_IMMUTABLE_STRING): Use the new data types.
2025-06-23 15:00:04 +02:00
Andy Wingo
4702becf89 Move internal string interface definitions to internal header
* libguile/strings-internal.h: New file.
* libguile/strings.h: Gut.
* libguile/Makefile.am: Add new file.
* libguile/array-handle.c:
* libguile/bytevectors.c:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/hash.c:
* libguile/i18n.c:
* libguile/init.c:
* libguile/intrinsics.c:
* libguile/load.c:
* libguile/memoize.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/print.c:
* libguile/random.c:
* libguile/rdelim.c:
* libguile/read.c:
* libguile/rw.c:
* libguile/srfi-13.c:
* libguile/srfi-14.c:
* libguile/strings.c:
* libguile/strports.c:
* libguile/struct.c:
* libguile/symbols.c:
* libguile/throw.c: Include new file.
2025-06-23 08:44:24 +02:00
Andy Wingo
342a58ad36 scm_is_string is a normal inline function
* libguile/strings.h (scm_is_string): Change to be static inline.
* libguile/inline.c: No need to include strings.h
2025-06-23 08:44:24 +02:00
Andy Wingo
9fd851da65 Get fractions off scm_double_cell
* libguile/numbers.h (scm_t_double, scm_t_complex): Change type and pad
to scm_t_bits.
(struct scm_fraction): New type.
(scm_is_fraction, scm_to_fraction, scm_from_fraction)
(scm_fraction_numerator, scm_fraction_denominator): New helpers.
(SCM_FRACTIONP, SCM_FRACTION_NUMERATOR, SCM_FRACTION_DENOMINATOR): Use
new helpers.
* libguile/numbers.c (scm_i_make_ratio_already_reduced): Allocate using
scm_allocate_tagged.
2025-06-23 08:44:24 +02:00
Andy Wingo
7a749ef79c SCM_ALIGNED is always available
_Alignas is C11.

* libguile/scm.h (SCM_ALIGNED): Always present.
* libguile/snarf.h:
* libguile/strings.h:
* libguile/symbols.h: Always have SCM_ALIGNED available.
2025-06-20 22:18:46 +02:00
Andy Wingo
9290698977 Move atomic box off of scm_cell
* libguile/Makefile.am:
* libguile/atomic.h: Make private.  Define "struct scm_atomic_box".
* libguile/atomic.c: Allocate scm_atomic_box via scm_allocate_tagged.
2025-06-20 16:23:02 +02:00
Andy Wingo
796798b400 Move variables off of scm_cell
* libguile/variable.h:
* libguile/variable.c: Define a "struct scm_variable" and allocate it
via scm_allocate_tagged.
2025-06-20 16:11:07 +02:00
Andy Wingo
b262df6ca7 Move keywords off of scm_cell
* libguile/keywords-internal.h: New file.
* libguile/Makefile.am (noinst_HEADERS): Add new file.
* libguile/hash.c:
* libguile/init.c:
* libguile/keywords.c: Include new file.
(scm_symbol_to_keyword): Allocate via scm_allocate_tagged.
2025-06-20 15:57:37 +02:00
Andy Wingo
27caa4cb98 Move SCM_CARLOC, SCM_CDRLOC to pairs.h
* libguile/gc.h:
* libguile/pairs.h (scm_pair_car_loc, scm_pair_cdr_loc): New helpers.
(SCM_CARLOC, SCM_CDRLOC): Move here from gc.h.
* libguile/list.c (scm_list_1, scm_list_2, scm_list_3): Just use
scm_cons.
2025-06-20 15:46:57 +02:00
Andy Wingo
7997496a32 Move pairs off of scm_cell
* libguile/pairs.h: Remove inline scm_cons, scm_car, scm_cdr defnitions;
this is less important now with the VM.  Add a "struct scm_pair", and
make all SCM_CAR / SCM_CDR checks use it.  For now it does type checking
as well.
* libguile/pairs.c (scm_cons, scm_car, scm_cdr): Implement here.
* libguile/scm.h (SCM_DEBUG_PAIR_ACCESSES): No more macro!
2025-06-20 15:33:33 +02:00
Andy Wingo
fbbe5fa873 Move dynamic states off of scm_cell
* libguile/fluids-internal.h: Add struct scm_dynamic_state_snapshot
definition.
* libguile/fluids.h (scm_is_dynamic_state): Inline.
* libguile/fluids.c: Use "struct scm_dynamic_state_snapshot".
2025-06-20 14:56:28 +02:00
Andy Wingo
453fe41a26 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.
2025-06-20 14:43:10 +02:00
Andy Wingo
8141c35ec4 Change to not inline scm_cell / scm_double_cell / scm_words
* libguile/gc-malloc.c (scm_cell):
(scm_double_cell):
(scm_words): Implement here.
* libguile/gc.h:
* libguile/inline.c: Not here.
2025-06-20 14:23:56 +02:00
Andy Wingo
4bb5fc526b Remove unused variable in hashtab.c
* libguile/hashtab.c:
2025-06-20 14:22:39 +02:00
Andy Wingo
d8c1ea4049 Convert smobs to use scm_allocate_*
* libguile/smob.c (scm_new_smob, scm_new_double_smob): Use
scm_allocate_pointerless, scm_allocate_tagged, or scm_allocate_sloppy,
as appropriate.
2025-06-20 13:03:06 +02:00
Andy Wingo
c800496d27 Use alloca in change_option_setting
* libguile/options.c (change_option_setting): alloca instead of
scm_allocate_sloppy.
2025-06-20 12:48:07 +02:00
Andy Wingo
f2ad6525e6 Convert scm_gc_malloc* calls to scm_allocate*
* libguile/arrays.c:
* libguile/bitvectors.c:
* libguile/bytevectors.c:
* libguile/chooks.c:
* libguile/continuations.c:
* libguile/control.c:
* libguile/dynstack.c:
* libguile/ephemerons.c:
* libguile/filesys.c:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/frames.c:
* libguile/gsubr.c:
* libguile/hashtab.c:
* libguile/i18n.c:
* libguile/integers.c:
* libguile/intrinsics.c:
* libguile/load.c:
* libguile/loader.c:
* libguile/macros.c:
* libguile/numbers.c:
* libguile/options.c:
* libguile/ports.c:
* libguile/programs.h:
* libguile/random.c:
* libguile/read.c:
* libguile/regex-posix.c:
* libguile/smob.c:
* libguile/srfi-14.c:
* libguile/strings.c:
* libguile/struct.c:
* libguile/threads.c:
* libguile/threads.h:
* libguile/values.c:
* libguile/vm.c: Convert all calls to scm_gc_malloc_pointerless to
scm_allocate_pointerless.  Convert scm_gc_malloc to either
scm_allocate_tagged or scm_allocate_sloppy, depending on whether the
value can be precisely traced or not.
2025-06-20 11:40:01 +02:00
Andy Wingo
290a57b1b0 Add scm_allocate_{pointerless,tagged,sloppy}
* libguile/gc-inline.h (scm_inline_allocate_pointerless):
(scm_inline_allocate_tagged):
(scm_inline_allocate_sloppy):
* libguile/gc.h:
* libguile/gc-malloc.c (scm_allocate_pointerless):
(scm_allocate_tagged):
(scm_allocate_sloppy): New functions.
(scm_gc_malloc):
(scm_gc_malloc_pointerless): Dispatch to scm_allocate functions.
2025-06-20 11:07:34 +02:00
Andy Wingo
a793d371cd Move string-pointer-array handling to posix.c
* libguile/posix.c (free_string_pointers):
(free_string_pointers_on_unwind):
(allocate_string_pointers): Move here from string.c, and use malloc/free
instead of GC facilities. Adapt all users.
* libguile/strings.h:
* libguile/strings.c (scm_i_allocate_string_pointers): Remove.
2025-06-20 11:06:41 +02:00
Andy Wingo
ce2f7847e8 Avoid untagged traced allocation in make-struct/no-tail
* libguile/struct.c (scm_struct_init_1_default):
(scm_struct_init_1): New helpers.
(scm_struct_init_array): Use new helpers.
(scm_struct_init_list): New function.
(scm_make_struct_no_tail): Use scm_struct_init_list instead of mallocing.
2025-06-20 09:27:47 +02:00
Andy Wingo
4d15cb7e6d JIT uses malloc/free instead of gc_malloc
* libguile/jit.c (initialize_thread_jit_state):
(scm_jit_state_free): Use malloc/free, to avoid needing to mark things.
2025-06-19 16:56:30 +02:00
Andy Wingo
278ba99027 Allow precise tracing of dynstacks
Gosh this was a slog

* libguile/dynstack.c (dynstack_ensure_space): Use malloc and free.
Threads have off-heap dynstacks, with manual marking.
(scm_trace_dynstack): Implement tracing.
(trace_pinned_trampoline, scm_trace_dynstack_roots): Implement tracing
for active threads.
(scm_dynstack_capture): Tag dynstacks.
* libguile/dynstack.h (scm_t_dynstack): Add a tag.
(scm_t_dynstack_winder_flags): Add SCM_F_DYNSTACK_WINDER_MANAGED.
* libguile/dynwind.h (scm_t_wind_flags): Add SCM_F_WIND_MANAGED.
* libguile/dynwind.c (scm_dynwind_unwind_handler_with_scm)
(scm_dynwind_rewind_handler_with_scm): These values need to be traced by
GC.
* libguile/scm.h (scm_tc16_dynstack_slice): New typecode.  No need for
equality etc because it shouldn't escape to Scheme (currently).
* libguile/trace.h: Add trace decls.
* libguile/threads.c (scm_trace_thread_roots): Trace dynstacks
explicitly here, as they are off-heap.
2025-06-19 16:32:56 +02:00
Andy Wingo
923bfdc7ed String ports have managed streams
* libguile/strports.c (stream_bytevector, stream_pos, stream_len)
(stream_set_bytevector, stream_set_pos, stream_set_len)
(make_stream): New helpers.
* libguile/strports.c (string_port_read):
(string_port_write):
(string_port_seek):
(string_port_truncate):
(scm_mkstrport):
(scm_strport_to_string): Adapt.
(scm_make_string_port_type): Indicate that the stream is managed.
2025-06-18 16:33:36 +02:00
Andy Wingo
765245119b Rework representation of ports
Instead of a 4-word object that has a tag, stream, pt, and ptob, just
add tag, stream, and ptob fields to pt.  Also add a "stream mode",
indicating to the GC how the stream should be traced.

* libguile/custom-ports.c (scm_init_custom_ports): Indicate that streams
are managed.
* libguile/fports.c (scm_make_fptob): Streams are managed.
* libguile/ports-internal.h (scm_t_port_type): Add enum to indicate
stream management.
(scm_t_port): Add type-and-flags, stream, and ptob members.
* libguile/ports.c (scm_port_stream, scm_port_type): New helpers.
(scm_make_port_type): Init stream mode to CONSERVATIVE.
(scm_set_port_stream_mode): New API.
(scm_c_make_port_with_encoding): Adapt to new port representation.
(scm_init_ports): Void ports have unmanaged streams.
* libguile/ports.h (scm_is_port, scm_to_port, scm_from_port): New inline
functions.
(SCM_PORT, SCM_STREAM, SCM_PORT_TYPE): Rework in terms of new functions.
(SCM_SETSTREAM): Remove.
(enum scm_port_stream_mode): New.
(scm_set_port_stream_mode): New.
2025-06-18 16:30:03 +02:00
Andy Wingo
c74499a7e5 Add new API for declaring managed SMOB fields
* libguile/smob.h:
* libguile/smob.c (scm_make_managed_smob_type): New API, to declare that
a SMOB has a certain number of fields, all of which will be traced by
the GC.  0 indicates "unknown", and will disable evacuation.
(scm_make_smob_type): Call scm_make_managed_smob_type with 0 nfields.
(scm_set_smob_field_is_unmanaged): New API to indicate that a field is
unmanaged (and should not be traced by GC).
2025-06-18 14:59:03 +02:00
Andy Wingo
bc43d4f9a7 Locale have static tc16
* libguile/print.c (iprin1):
* libguile/eq.c (scm_equal_p): Add case for locales and also regexps
which we missed in the past.
* libguile/finalizers.h:
* libguile/finalizers.c (scm_i_add_locale_finalizer):
(run_finalizer): Add locale finalizers.
* libguile/scm.h (scm_tc16_locale): New tc16.
* module/oop/goops.scm:
* libguile/goops.c: Add locale class.
* libguile/i18n.c: Give locale objects their own tc16.
2025-06-18 12:18:24 +02:00
Andy Wingo
a5c70aa914 Simplify i18n.c to require POSIX 2008 newlocale, uselocale
* libguile/i18n.c: Remove shim for pre-POSIX 2008, given that gnulib
does appear to have newlocale/uselocale implementations.
* libguile/posix.c: No USE_GNU_LOCALE_API define.
* libguile/r6rs-ports.c: Remove stray include.
2025-06-18 12:02:41 +02:00
Andy Wingo
3f4048f6c8 Move transcoded ports implementation to Scheme
* libguile/r6rs-ports.c: Remove private transcoded ports implementation.
* module/ice-9/binary-ports.scm: Remove stale comment.
* module/rnrs/io/ports.scm (%make-transcoded-port): New implementation
based on custom ports.
2025-06-18 11:06:12 +02:00
Andy Wingo
6ba6fbdf64 Fix GOOPS for <regexp>
* module/oop/goops.scm (<regexp>):
* libguile/goops.c: (scm_class_of): Give regexps their own class; it
doesn't come from smobs.
2025-06-18 10:58:08 +02:00
Andy Wingo
2a015937ca Move bytevector input ports implementation to Scheme
* module/ice-9/binary-ports.scm (open-bytevector-input-port): New
implementation.
* libguile/r6rs-ports.c (scm_open_bytevector_input_port): Proxy to
Scheme.
2025-06-18 10:37:42 +02:00
Andy Wingo
2fc5ff5264 Move bytevector output ports implementation to Scheme
* module/ice-9/binary-ports.scm (bytevector-concatenate-reverse):
(bytevector-copy*): New helpers.
(open-bytevector-output-port): New implementation.
* libguile/r6rs-ports.c (scm_open_bytevector_output_port):
(init_bytevector_port_vars): Arrange to proxy to Scheme.
2025-06-18 10:13:10 +02:00
Andy Wingo
c3e8e9fa6d Remove needless smob.h includes
* libguile/continuations.c: Fix printer.
* libguile/async.c:
* libguile/debug.c:
* libguile/filesys.c:
* libguile/gc.c:
* libguile/init.c:
* libguile/inline.c:
* libguile/keywords.c:
* libguile/macros.c:
* libguile/modules.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/srfi-14.c:
* libguile/symbols.c:
* libguile/threads.c:
* libguile/threads.h:
* libguile/variable.c: Remove smob.h includes.
2025-06-17 15:03:32 +02:00
Andy Wingo
ace42e191e Convert regexps to use statically-allocated tc16
* libguile/scm.h: Allocate tc16.
* libguile/regex-posix.h:
* libguile/regex-posix.c:
* libguile/finalizers.h:
* libguile/finalizers.c: Adapt.
2025-06-17 14:35:51 +02:00
Andy Wingo
197345fa02 Fix texi-fragments-to-docstrings to import srfi-14
* libguile/texi-fragments-to-docstrings: Use srfi-14.
2025-06-17 14:35:13 +02:00
Andy Wingo
521662d8b7 Move make-regexp, regexp?, regexp-exec to (ice-9 regex)
Also deprecate the C interface.

* libguile/Makefile.am: Don't install regex-posix.h.
* libguile/deprecated.c:
* libguile/deprecated.h: Add deprecated shims for scm_make_regexp et al.
* libguile/init.c: Fix comment.
* libguile/regex-posix.c: Privatize some of the implementation details.
Arrange to install into (ice-9 regex) instead of default environment.
* module/ice-9/deprecated.scm: Add deprecation shims.
* module/ice-9/regex.scm: Add new definitions.
* module/ice-9/sandbox.scm:
* module/scripts/read-scheme-source.scm:
* module/system/repl/server.scm:
* module/texinfo/reflection.scm:
* test-suite/tests/r6rs-exceptions.test:
* test-suite/tests/srfi-10.test: Import (ice-9 regex).
2025-06-17 14:10:12 +02:00
Andy Wingo
ccaff3da39 Allocate a static tc16 for random states
* libguile/random.h (scm_t_rstate): Put a tag word in the beginning.
(scm_is_random_state, scm_to_random_state, scm_from_random_state): New
helpers.
(SCM_RSTATEP, SCM_RSTATE): Use the new helpers.
(scm_masktab): Make private.
* libguile/random.c: Adapt random states to not be a smob.
* libguile/eq.c:
* libguile/print.c:
* libguile/scm.h:
* module/oop/goops.scm: Add new random-state cases.  Fix a number of
classes for other types that were recently changed to not be smobs.
2025-06-17 10:45:27 +02:00
Andy Wingo
63317ff480 Move R5RS promises implementation to Scheme
* am/bootstrap.am (SOURCES):
* module/ice-9/promises.scm: New file.
* libguile/promises.h:
* libguile/promises.c: Delete.
* libguile/deprecated.h:
* libguile/deprecated.c: Add promises shims.
* libguile/init.c:
* libguile/Makefile.am:
* libguile.h: Remove promises mentions.
* module/ice-9/deprecated.scm: Add shims to include promises in the
default environment.
* module/ice-9/null.scm:
* module/ice-9/safe-r5rs.scm:
* module/ice-9/sandbox.scm:
* module/language/bytecode.scm:
* module/language/cps/guile-vm/reify-primitives.scm:
* module/language/elisp/parser.scm:
* module/rnrs/r5rs.scm:
* test-suite/tests/00-initial-env.test:
* test-suite/tests/eval.test:
* test-suite/tests/r4rs.test: Import (ice-9 promises).
2025-06-17 09:41:33 +02:00
Andy Wingo
3cf4ca187c Remove print state objects, and ports-with-print-state
The goal was that, as part of a print operation, all nested prints of
contained data would be able to use the same parameters (e.g. write or
not), and also detect cycles, highlight objects, etc.  The mechanism was
a heap-allocated data structure.  However, given that:

  1. Nobody accessed print states from Scheme

  2. `write` and `display` should move to Scheme anyway, in order to be
     suspendable

  3. The "fancyp" and "highlight" options were unused

  4. A simple stack-allocated data structure with a per-thread key could
     do the trick just as well, without needing the weird freelist
     structure

  5. Ports-with-print-states were a source of bugs

In the end we switch print states to be something completely internal to
print.c.  There are no more SCM print-state objects, and no more
ports-with-print-state.

* libguile/print.h: Remove print state from API.
* libguile/print.c (struct scm_print_state): Move definition here.
(scm_print_opts): Remove "highlight-prefix" and "highlight-suffix"
options, as they were not used.
(ENTER_NESTED_DATA): Remove "fancyp" case.
(init_print_state_key, get_print_state, push_print_state)
(maybe_push_print_state, pop_print_state): New facility to manage stack
of active print states.
(scm_iprin1, print_vector): No more fancyp.
(iprin1): Access "writingp" member directly.  Don't make ports with
print states.
(scm_prin1): Manage print state stack.
(scm_iprlist): No more fancyp.
(scm_valid_oport_value_p): Remove; valid outports are SCM_OPOUTPORTP.
* libguile/backtrace.c:
* libguile/filesys.c:
* libguile/fports.c:
* libguile/goops.c:
* libguile/ioext.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/promises.c:
* libguile/socket.c:
* libguile/struct.c: Remove cases that dealt with
ports-with-print-states.
* libguile/private-options.h: Remove highlight options.
* module/ice-9/ports.scm (inherit-print-state): Deprecate.
* libguile/deprecated.c:
* libguile/deprecated.h: Add deprecation shims for print states, as far
as that is possible.
2025-06-17 09:38:46 +02:00
Andy Wingo
d1b548033c Remove unused "malloc objects"
* libguile/mallocs.c:
* libguile/mallocs.h: Delete files.  These exposed a SMOB interface for
traced mallocs, which is not compatible with precise tracing, and was
unused and undocumented.
* libguile.h:
* libguile/Makefile.am:
* libguile/init.c: Remove mallocs.
* libguile/options.c:
* libguile/ports.c: Remove useless mallocs.h includes
2025-06-16 13:42:04 +02:00
Andy Wingo
383b67c9f1 Give syntax transformers a static tc16
* libguile/scm.h: Allocate a tc16 for syntax transformers.
* libguile/expand.c: Adapt to renamings.
* libguile/eq.c:
* libguile/goops.c:
* libguile/print.c: Add tc16 cases.
* libguile/macros.h:
* libguile/macros.c (scm_i_make_primitive_syntax_transformer):
(scm_i_primitive_syntax_transformer): Rename internal functions from
scm_i_make_primitive_macro, etc.  Use new representation.
(scm_make_syntax_transformer): Update for new representation.
2025-06-16 13:38:02 +02:00
Andy Wingo
f930af2737 Move implementation of hooks to Scheme module
* module/ice-9/hooks.scm: New file.
* am/bootstrap.am: Add new file.
* module/ice-9/deprecated.scm: Add trampolines to (ice-9 hooks).
* module/ice-9/scm-style-repl.scm:
* module/ice-9/session.scm:
* module/ice-9/top-repl.scm:
* module/scripts/scan-api.scm:
* guile-readline/ice-9/readline.scm:
* benchmark-suite/benchmark-suite/lib.scm:
* module/system/repl/command.scm:
* module/system/repl/common.scm:
* module/system/repl/debug.scm:
* module/system/repl/error-handling.scm:
* module/system/repl/hooks.scm:
* module/system/repl/reader.scm:
* module/system/repl/repl.scm:
* module/ice-9/history.scm:
* test-suite/tests/hooks.test: Use the new module.
* module/oop/goops.scm: Remove <hook> class definition.
* libguile/vm.c:
* libguile/init.c:
* libguile/Makefile.am:
* libguile.h: Remove hooks.h includes.
* libguile/hooks.c:
* libguile/hooks.h: Remove.
* libguile/deprecated.h:
* libguile/deprecated.c: Add deprecation shims for C API.
2025-06-16 13:11:28 +02:00