summaryrefslogtreecommitdiff
path: root/module/srfi
AgeCommit message (Collapse)AuthorFilesLines
2025-02-28srfi-19: Fix ~V converter in date->string.Tomas Volf1-1/+22
The ~V is supposed to print ISO week number, not a week number. This commit fixes that. * module/srfi/srfi-19.scm (date-week-number-iso): New procedure taken from the reference implementation. (directives)<#\V>: Use it. * test-suite/tests/srfi-19.test ("date->string ~V"): Add tests taken from the reference test suite. * doc/ref/srfi-modules.texi (SRFI-19 Date to string): Mention ISO-8601 in description for ~V. Fixes <https://bugs.gnu.org/74841>. Edited by lloda <lloda@sarc.name>.
2025-01-16Fix bug in srfi-111 box printerDaniel Llorens1-1/+1
* module/srfi/srfi-111.scm: Add missing port. * test-suite/tests/srfi-111.test: Test.
2024-10-26srfi-64: Accept symbols as test group names.Tomas Volf1-2/+13
The specification mandates a string, but with rationale suggesting symbols would be a more natural fit. > In some ways using symbols would be preferable. However, we want > human-readable names, and standard Scheme does not provide a way to include > spaces or mixed-case text in literal symbols. Add support for symbols as an implementation extension and for backwards compatibility with the reference implementation. * module/srfi/srfi-64.scm (%cmp-group-name): New procedure. (test-end): Use it. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Reported-by: Daniel Llorens <lloda@sarc.name>
2024-10-20Replace SRFI-64 with a new implementation.Tomas Volf2-1079/+976
The bundled (reference) implementation was of somewhat mixed quality and it failed to follow standard in multiple places. This commit replaces it with a new one, written from scratch to follow the standard as close as possible. * module/srfi/srfi-64/testing.scm: Delete file. * module/srfi/srfi-64.scm: Replace with new implementation. * am/bootstrap.am (srfi/srfi-64.go): Remove extra dependencies. (NOCOMP_SOURCES): Remove srfi/srfi-64/testing.scm. * test-suite/tests/srfi-64-test.scm ("8.6.1. Simple (form 1) test-apply") ("8.6.2. Simple (form 2) test-apply"): Adjust tests to follow the specification. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-07-30Drop libguile srfi-1Rob Browning1-5/+0
...now that all of the C code has been migrated to Scheme. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): remove srfi-1.c. (DOC_X_FILES): Remove srfi-1.x. (DOT_DOC_FILES): Remove srfi-1.doc. (modinclude_HEADERS): Remove srfi-1.h. * libguile/init.c (scm_i_init_guile): Don't call scm_register_srfi_1. * libguile/srfi-1.c: Remove. * libguile/srfi-1.h: Remove. * module/srfi/srfi-1.scm: Don't load srfi-1 from libguile.
2024-07-30srfi-1 delete-duplicates: move from C to SchemeRob Browning1-0/+46
* libguile/srfi-1.c (scm_srfi1_delete-duplicates): delete. * libguile/srfi-1.h (scm_srfi1_delete-duplicates): delete. * module/srfi/srfi-1.scm: add delete-duplicates.
2024-07-30srfi-1 delete-duplicates!: move from C to SchemeRob Browning1-0/+39
* libguile/srfi-1.c (scm_srfi1_delete-duplicates_x): delete. * libguile/srfi-1.h (scm_srfi1_delete-duplicates_x): delete. * module/srfi/srfi-1.scm: add delete-duplicates!.
2024-07-30srfi-1 lset-difference: use removeRob Browning1-11/+25
* module/srfi/srfi-1.scm (lset-difference): rely on remove like lset-difference!; in addition to being simpler, this allows sharing a common tail.
2024-07-30srfi-1 lset-difference!: move from C to SchemeRob Browning1-0/+24
* libguile/srfi-1.c (scm_srfi1_lset-difference_x): delete. * libguile/srfi-1.h (scm_srfi1_lset-difference_x): delete. * module/srfi/srfi-1.scm: add lset-difference!. * test-suite/tests/srfi-1.test: extend lset-difference! tests to cover lset-difference.
2024-07-30srfi-1 partition!: move from C to SchemeRob Browning1-0/+21
* libguile/srfi-1.c (scm_srfi1_partition_x): delete. * libguile/srfi-1.h (scm_srfi1_partition_x): delete. * module/srfi/srfi-1.scm: add partition!.
2024-07-30srfi-1 partition: move from C to SchemeRob Browning1-0/+22
* libguile/srfi-1.c (scm_srfi1_partition): delete. * libguile/srfi-1.h (scm_srfi1_partition): delete. * module/srfi/srfi-1.scm: add partition.
2024-07-30srfi-1 count: move from C to SchemeRob Browning1-0/+21
* libguile/srfi-1.c (scm_srfi1_count): delete. * libguile/srfi-1.h (scm_srfi1_count): delete. * module/srfi/srfi-1.scm: add count.
2024-07-30srfi-1 length+: move from C to SchemeRob Browning1-0/+24
* libguile/srfi-1.c (scm_srfi1_length_plus): delete. * libguile/srfi-1.h (scm_srfi1_length_plus): delete. * module/srfi/srfi-1.scm: add length+.
2024-07-30srfi-1 append-reverse!: move from C to SchemeRob Browning1-0/+22
* libguile/srfi-1.c (scm_srfi1_append_reverse_x): delete. * libguile/srfi-1.h (scm_srfi1_append_reverse_x): delete. * module/srfi/srfi-1.scm: add append-reverse!.
2024-07-30srfi-1 append-reverse: move from C to SchemeRob Browning1-0/+17
* libguile/srfi-1.c (scm_srfi1_append_reverse): delete. * libguile/srfi-1.h (scm_srfi1_append_reverse): delete. * module/srfi/srfi-1.scm: add append-reverse.
2024-07-30srfi-1 concatenate concatenate!: move from C to SchemeRob Browning1-0/+19
* libguile/srfi-1.c (scm_srfi1_concatenate, scm_srfi1_concatenate_x): delete. * libguile/srfi-1.h (scm_srfi1_concatenate, scm_srfi1_concatenate_x): delete. * module/srfi/srfi-1.scm: add concatenate and concatenate!.
2024-07-30srfi-1 delete delete!: move from C to SchemeRob Browning1-0/+35
* libguile/srfi-1.c (scm_srfi1_delete, scm_srfi1_delete_x): delete. * libguile/srfi-1.h (scm_srfi1_delete, scm_srfi1_delete_x): delete. * module/srfi/srfi-1.scm: add delete and delete!.
2024-07-30srfi-1 remove!: move from C to SchemeRob Browning1-0/+21
* libguile/srfi-1.c (scm_srfi1_remove_x): delete. * libguile/srfi-1.h (scm_srfi1_remove_x): delete. * module/srfi/srfi-1.scm: add remove!.
2024-07-30srfi-1 remove: move from C to SchemeRob Browning1-0/+47
The Scheme implementation is an adapted version of the approach used by delete-duplicates, which allows sharing any common tail. * libguile/srfi-1.c (scm_srfi1_remove): delete. * libguile/srfi-1.h (scm_srfi1_remove): delete. * module/srfi/srfi-1.scm: add remove.
2024-07-30srfi-1 list-copy: move from C to SchemeRob Browning1-0/+18
* libguile/srfi-1.c (scm_srfi1_list_copy): delete. * libguile/srfi-1.h (scm_srfi1_list_copy): delete. * module/srfi/srfi-1.scm: add list-copy. * test-suite/tests/srfi-1.test: ensure copied spine is independent.
2024-05-06Fix error messages containing format stringsMichael Käppler1-2/+2
The builtin primitive procedure `error` takes an optional message and a list of arguments to include into the error message. These args are formatted with `~S` and appended to the error message, so that an example call of `(error "Wrong argument: " 42)` results in the output "Wrong argument: 42" If format strings occur in the message itself, however, they are escaped. Thus a call like `(error "Wrong argument: ~a" 42)` is rendered as "Wrong argument: ~a 42" Some callers did not take this behavior into account, leading to confusing error messages. Changing the behavior of `error` to be both backwards-compatible and accept also format strings inside messages is not straightforward, because it would have to handle escaped `~` characters as well. Therefore, fix `error` call sites using format strings to use `format` before calling out to `error`. The following files are affected: * module/ice-9/format.scm (format) * module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface) * module/oop/goops.scm (make) * module/srfi/srfi-37.scm (Comment at the beginning of file) * module/system/base/compile.scm (call-once) * module/system/repl/command.scm (break, tracepoint) * module/system/repl/common.scm (repl-default-options) * module/system/vm/traps.scm (arg-check, trap-at-source-location) There are a couple of further call sites that were left unchanged, either because they are using their own `error` procedure: * module/ice-9/read.scm * module/ice-9/command-line.scm or are not referenced from other modules: * module/system/base/lalr.upstream.scm: * module/sxml/upstream/assert.scm: * module/sxml/sxml-match.ss: Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-05-06Fix typos throughout codebase.Morgan Smith2-7/+7
* NEWS: * doc/ref/api-control.texi: * doc/ref/api-data.texi: * doc/ref/api-debug.texi: * doc/ref/api-deprecated.texi: * doc/ref/api-evaluation.texi: * doc/ref/api-foreign.texi: * doc/ref/api-i18n.texi: * doc/ref/api-io.texi: * doc/ref/api-languages.texi: * doc/ref/api-macros.texi: * doc/ref/api-memory.texi: * doc/ref/api-modules.texi: * doc/ref/api-options.texi: * doc/ref/api-peg.texi: * doc/ref/api-procedures.texi: * doc/ref/api-scheduling.texi: * doc/ref/api-undocumented.texi: * doc/ref/api-utility.texi: * doc/ref/expect.texi: * doc/ref/goops.texi: * doc/ref/misc-modules.texi: * doc/ref/posix.texi: * doc/ref/repl-modules.texi: * doc/ref/scheme-ideas.texi: * doc/ref/scheme-scripts.texi: * doc/ref/srfi-modules.texi: * gc-benchmarks/larceny/dynamic.sch: * gc-benchmarks/larceny/twobit-input-long.sch: * gc-benchmarks/larceny/twobit.sch: * libguile/gc.h: * libguile/ioext.c: * libguile/list.c: * libguile/options.c: * libguile/posix.c: * libguile/threads.c: * module/ice-9/boot-9.scm: * module/ice-9/optargs.scm: * module/ice-9/ports.scm: * module/ice-9/pretty-print.scm: * module/ice-9/psyntax.scm: * module/language/elisp/parser.scm: * module/language/tree-il/compile-bytecode.scm: * module/srfi/srfi-37.scm: * module/srfi/srfi-43.scm: * module/statprof.scm: * module/texinfo/reflection.scm: * test-suite/tests/eval.test: * test-suite/tests/fluids.test: Fix typos. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-04-13SRFI-19: Add support for ISO 8601 zones with a colon.Denis 'GNUtoo' Carikli1-0/+2
* module/srfi/srfi-19.scm (zone-reader): handle a colon in the zone. * test-suite/tests/srfi-19.test (SRFI date/time library test): Add test. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> [rlb@defaultvalue.org: adjust commit message; add NEWS]
2024-03-17Remove vestigial code from srfi-9Andy Wingo1-7/+1
* module/srfi/srfi-9.scm (%define-record-type): No need to define record-layout.
2023-08-24define-inlinable marks residualized procedure as maybe-unusedAndy Wingo1-4/+5
* module/ice-9/boot-9.scm (define-inlinable): * module/srfi/srfi-9.scm (define-tagged-inlinable): Add maybe-unused declaration. Also require at least one body expr, otherwise the metadata declaration could escape as the proc body.
2023-07-16Fix typos throughout codebase.Morgan Smith1-1/+1
* NEWS: * README: * doc/r5rs/r5rs.texi: * doc/ref/api-data.texi: * doc/ref/api-debug.texi: * doc/ref/api-evaluation.texi: * doc/ref/api-io.texi: * doc/ref/api-macros.texi: * doc/ref/api-procedures.texi: * doc/ref/api-scheduling.texi: * doc/ref/api-undocumented.texi: * doc/ref/libguile-concepts.texi: * doc/ref/posix.texi: * doc/ref/srfi-modules.texi: * doc/ref/vm.texi: * doc/ref/web.texi: * examples/box-dynamic-module/box.c: * examples/box-dynamic/box.c: * examples/box-module/box.c: * examples/box/box.c: * examples/safe/safe: * examples/scripts/README: * examples/scripts/hello: * gc-benchmarks/larceny/twobit-input-long.sch: * gc-benchmarks/larceny/twobit-smaller.sch: * gc-benchmarks/larceny/twobit.sch: * libguile/expand.c: * libguile/load.c: * libguile/net_db.c: * libguile/scmsigs.c: * libguile/srfi-14.c: * libguile/threads.c: * meta/guile.m4: * module/ice-9/match.upstream.scm: * module/ice-9/ports.scm: * module/language/cps/graphs.scm: * module/scripts/doc-snarf.scm: * module/srfi/srfi-19.scm: * module/system/repl/command.scm: * test-suite/tests/srfi-18.test: Fix typos. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-01srfi-35: Fix expansion of 'condition' for compound conditions.Ludovic Courtès1-3/+3
* module/srfi/srfi-35.scm (condition): Use 'make-exception' instead of 'make-compound-condition', which is unbound in this module. * test-suite/tests/srfi-35.test ("syntax")["compound condition, hygienic macro expansion"]: New test.
2021-12-06New function srfi-4-vector-type-size in (srfi srfi-4 gnu)Daniel Llorens2-3/+8
This patch removes the undocumented function make-srfi-4-vector from (guile). That function is still exported from (srfi srfi-4 gnu). * libguile/srfi-4.h (scm_init_srfi_4): Split into scm_bootstrap_srfi_4() and scm_init_srfi_4(), after the pattern of scm_init_bytevectors() and scm_bootstrap_bytevectors(). * libguile/init.c: Replace scm_init_srfi_4() call by scm_bootstrap_srfi_4(). * module/srfi/srfi-4.scm: Load newly defined srfi-4 extension. This provides undocumented make-srfi-4-vector. * module/srfi/srfi-4/gnu.scm: Export srfi-4-vector-type-size. * doc/ref/srfi-modules.texi: Document srfi-4-vector-type-size.
2021-10-21Provide xxvector-copy and xxvector-copy! for srfi-4 vectorsDaniel Llorens1-22/+98
These use the argument conventions of vector-copy!, string-copy!, etc. and not that of bytevector-copy! (which is from r6rs). * module/srfi/srfi-4/gnu.scm: As stated. * test-suite/tests/srfi-4.test: Tests. * doc/ref/srfi-modules.texi: Documentation. * libguile/bytevectors.c (bytevector-copy!): Add overlap note to docstring. * libguile/vectors.c (vector-copy!): Reuse text for the overlap note.
2021-09-20srfi-1: 'find-tail' passes 'check-arg' the right procedure name.Ludovic Courtès1-2/+2
* module/srfi/srfi-1.scm (find-tail): Pass 'find-tail' as the 3rd argument to 'check-arg'.
2021-08-06Add function vector-copy! to coreDaniel Llorens1-15/+2
This is up to 20%-30% faster than the previous versions in (scheme base) or (srfi srfi-43) that used vector-move-left!/vector-move-right!. * libguile/vectors.h: * libguile/vectors.c: As stated. * doc/ref/api-data.texi (vector-copy!): Document the new function. (vector-fill!): Document optional arguments. (vector-copy): Document optional arguments. * module/scheme/base.scm: Reuse core vector-copy!. * module/srfi/srfi-43.scm: Reuse core vector-copy!.
2021-08-06Extend core vector-copy to r7rs vector-copyDaniel Llorens1-15/+11
* libguile/vectors.h: Declare scm_vector_copy_partial. * libguile/vectors.c (scm_vector_copy_partial): As stated. (scm_vector_copy): Reuse scm_vector_copy_partial. * module/scheme/base.scm: Reuse core vector-copy. * module/srfi/srfi-43: Reuse core vector-copy. * test-suite/tests/vectors.test: Test vector-copy.
2021-05-05[srfi-64] Fix a bug with test-end removing globally installed test-runnerjakub-w1-4/+7
* testing.scm (%test-begin, %test-end): When (test-runner-current) is not set, create a new one like before but also add a finalizer that will remove it after the test is finished. Previously the test runner was getting unset unconditionally. See https://srfi-email.schemers.org/srfi-64/msg/16468240/
2021-03-12Fix hash-table-merge! bug.Ricardo G. Herdt1-1/+1
* module/srfi/srfi-69.scm : fold over second hash table.
2020-08-05Fix bug #42713: srfi-64: Reset test-runner-current if doneDaniel Llorens1-2/+3
Reported by Jérémy Korwin-Zmijowski (https://lists.gnu.org/archive/html/bug-guile/2020-08/msg00010.html). Fix from https://github.com/scheme-requests-for-implementation/srfi-64/commit/7cf4c010398850b45f5a6939bb73f747605a0513: Apply fix from Per Bothner. In Per's words: * testing.scm (%test-end): Reset test-runner-current if done. This fixes bug "Loading test source file multiple time without having report incrementing" reported to srfi-64 mailing list. * srfi-64-test.scm: Update due to recent srfi-64 implementation change.
2020-06-17srfi-1: Rewrite 'assoc' in Scheme.Ludovic Courtès1-0/+17
* libguile/srfi-1.c (scm_srfi1_assoc): Remove. * libguile/srfi-1.h (scm_srfi1_assoc): Likewise. * module/srfi/srfi-1.scm (assoc): New procedure.
2020-06-17srfi-1: Rewrite 'find-tail' in Scheme.Ludovic Courtès1-0/+11
* libguile/srfi-1.c (scm_srfi1_find_tail): Remove. * libguile/srfi-1.h (scm_srfi1_find_tail): Likewise. * module/srfi/srfi-1.scm (find-tail): New procedure.
2020-06-17srfi-1: Rewrite 'find' in Scheme.Ludovic Courtès1-1/+12
This halves the wall-clock time of: guile -c '(use-modules (srfi srfi-1)) (define lst (make-list 100000000 1)) (find zero? lst)' and yields an 18% speedup on: guile -c '(use-modules (srfi srfi-1)) (define lst (make-list 100000000 1)) (find (lambda (x) (= 2 x)) lst)' * libguile/srfi-1.c (scm_srfi1_find): Remove. * libguile/srfi-1.h (scm_srfi1_find): Likewise. * module/srfi/srfi-1.scm (find): New procedure. * doc/ref/srfi-modules.texi (SRFI-1 Searching): Adjust docstring.
2020-04-12Replace bit-count with bitvector-countAndy Wingo1-2/+2
The old name was wonky and had bad argument order. * NEWS: Add entry. * doc/ref/api-data.texi (Bit Vectors): Update. * libguile/bitvectors.h: * libguile/bitvectors.c (VALIDATE_BITVECTOR): New helper. (scm_bitvector_count): New function. * libguile/deprecated.h: * libguile/deprecated.c (scm_bit_count): Deprecate. * module/ice-9/sandbox.scm (bitvector-bindings): Replace bit-count with bitvector-count. * module/srfi/srfi-60.scm: No need to #:replace bit-count. * module/system/vm/frame.scm (available-bindings): Use bitvector-count. * test-suite/tests/bitvectors.test ("bitvector-count"): Add test.
2020-04-09Add #:declarative? #f to (srfi srfi-64)Daniel Llorens1-1/+2
This is needed for test-log-to-file to work.
2020-03-25Add SRFI-171 to guileLinus Björnstam3-0/+635
This adds SRFI-171 (transducers) to guile. The two guile-specific additions are powerful transducers which can be used to generalize transducers like tsegment. They are hard to get right, but powerful and useful enough to warrant inclusion. * doc/ref/srfi-modules.texi: added srfi-171 section * module/Makefile.am (SOURCES): * module/srfi/srfi-171.scm: * module/srfi/srfi-171/meta.scm: Add SRFI-171 * module/srfi/srfi-171/gnu.scm: Add 2 guile-specific extensions. * test-suite/Makefile.am (SCM_TESTS): * test-suite/tests/srfi-171.test: Add tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-01-12srfi-11: Do not expose variables to later clausesTim Gesthuizen1-1/+1
The current implementation of srfi-11s let-values allows later clauses to access and modify variables bound in earlier clauses when the clause is not a proper list. * module/srfi/srfi-11.scm (let-values): Fix switched variable names. * test-suite/tests/srfi-11.test (let-values): Add test checking that the variable cannot be changed in later clauses.
2020-01-10Re-implement `guard'Andy Wingo1-42/+6
* module/ice-9/exceptions.scm (guard): Add guard definition that re-propagates from original continuation, runs consequents in tail position in guard continuation, and doesn't rewind the stack. * module/srfi/srfi-34.scm: * module/rnrs/exceptions.scm (guard): Re-export from (ice-9 exceptions).
2020-01-03Extend core vector-fill! to handle a rangeDaniel Llorens1-30/+2
With this patch, these two lines (vector-fill! vec fill) (vector-fill! vec fill 0 end) run at the same speed; before, the second one was much slower. This patch also makes it an error to call vector-fill! with a non-vector array. The previous implementation did not work correctly in this case. * libguile/vectors.c (SCM_VALIDATE_MUTABLE_VECTOR): Better error message. (vector-fill!): Handle optional arguments start, end. Do not attempt to handle non-vector arrays. Rename the C binding to scm_vector_fill_partial_x. (scm_vector_fill_x): Reuse scm_vector_fill_partial_x. * module/srfi/srfi-43.scm (vector-fill!): Remove & re-export the core version instead.
2019-12-14srfi-35: Generate a unique binding for the constructor.Ludovic Courtès1-5/+14
Previously we'd get warnings like: t.scm:11:0: warning: shadows previous definition of `unused-constructor-51900bdce47d50c' at /tmp/t.scm:6:0 whenever 'define-condition-type' appeared more than once in a source file. * module/srfi/srfi-35.scm (define-condition-type): Rewrite as 'syntax-case' and generate UNUSED-CONSTRUCTOR as a function of TYPE.
2019-12-14srfi-35: Replace '&error'.Ludovic Courtès1-1/+1
* module/srfi/srfi-35.scm: Move '&error' to new #:re-export-and-replace clause.
2019-12-06Single definition of (iota)Daniel Llorens1-18/+12
* module/ice-9/boot-9.scm (iota): Fix to be SRFI-1 compatible. * module/srfi/srfi-1.scm: Re-export iota.
2019-11-29Associate #:replace info with modules, not variablesAndy Wingo2-3/+4
* doc/ref/api-modules.texi (Creating Guile Modules): Document #:re-export-and-replace. * module/ice-9/boot-9.scm (module-replacements): New module field. (make-module, make-autoload-interface): Initialize replacements to an empty hash table. (resolve-interface): Propagate replacement info when making custom interfaces. (define-module): Parse a #:re-export-and-replace keyword arg. (define-module*): Handle #:re-export-and-replace. (module-export!, module-re-export!): Add a keyword arg to indicate whether to replace or not. (module-replace!): Call module-export! with #:replace? #t. (duplicate-handlers): Update replace duplicate handler to look for replacement info on the interfaces. * module/srfi/srfi-18.scm (srfi): * module/srfi/srfi-34.scm (srfi): Update to #:re-export-and-replace raise-continuable as raise.
2019-11-14SRFI-18 uses core exceptionsAndy Wingo1-86/+60
* module/ice-9/boot-9.scm (exception-kind, exception-args): Export. * module/ice-9/exceptions.scm (exception-kind, exception-args): Re-export. * module/srfi/srfi-18.scm: Rewrite exception support in terms of core exceptions, not SRFI-34/35. * test-suite/tests/srfi-18.test: Since Guile doesn't expose the current exception handler as such, SRFI-18 captures it using delimited continuations. This means that we can't compare the result of (current-exception-handler) with the installed handler using eq?, even though the procedures are indeed equivalent. So, instead test handler behavior.
2019-11-13Rebase throw/catch on top of raise-exception/with-exception-handlerAndy Wingo1-32/+20
* libguile/exceptions.c: * libguile/exceptions.h: New files. * libguile.h: Add exceptions.h. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (DOT_X_FILES, DOT_DOC_FILES, modinclude_HEADERS): Add exceptions.c and exceptions.h. * libguile/init.c (scm_i_init_guile): Initialize exceptions. * libguile/threads.c (scm_spawn_thread): Use new names for scm_i_make_catch_handler and scm_c_make_thunk. * libguile/throw.c: Rewrite to be implemented in terms of with-exception-handler / raise-exception. * libguile/throw.h: Use data types from exceptions.h. Move scm_report_stack_overflow and scm_report_out_of_memory to exceptions.[ch]. * module/ice-9/boot-9.scm (&error, &programming-error) (&non-continuable, make-exception-from-throw, raise-exception) (with-exception-handler): New top-level definitions. (throw, catch, with-throw-handler): Rewrite in terms of with-exception-handler and raise-exception. : New top-level definitions. * module/ice-9/exceptions.scm: Adapt to re-export &error, &programming-error, &non-continuable, raise-exception, and with-exception-handler from boot-9. (make-quit-exception, guile-quit-exception-converter): New exception converters. (make-exception-from-throw): Override core binding. * test-suite/tests/eval.test ("inner trim with prompt tag"): Adapt to "with-exception-handler" being the procedure on the stack. ("outer trim with prompt tag"): Likewise. * test-suite/tests/exceptions.test (throw-test): Use pass-if-equal. * module/srfi/srfi-34.scm: Reimplement in terms of core exceptions, and make "guard" actually re-raise continuations with the original "raise" continuation.