Michael Gran [Tue, 20 Jun 2023 23:04:59 +0000 (16:04 -0700)]
Windows 11: for fport input from the console, ignore terminal returns
There is an apparent bug in Windows 11 (not Windows 10) where,
when reading from an fd backed by the Console, a single
return character will always be available.
* libguile/posix-w32.c (console_has_return_keyevent_w32): new procedure
* libguile/posix-w32.h: declare console_has_return_keyevent_w32
* libguile/fports.c [__MINGW32__](fport_input_waiting): ignore return keyevent
Michael Gran [Tue, 20 Jun 2023 22:46:35 +0000 (15:46 -0700)]
Remove posix-w32 subsitutes that require access to process handles
Now that Guile uses the posix_spawn gnulib module, several of Guile's
custom w32 functions substitutes no longer work. Some functions
relied on populating and maintaining an internal PID-to-Handle database,
which is no longer possible.
kill, getpriority, setpriority, getaffinity and setaffinity
are removed. waitpid is simplified and does not handle ENOHANG.
* NEWS: updated
* libguile/posix-w32.c (struct proc_record, find_proc, proc_handle): removed
(record_proc, delete_proc, prepare_child_handle, compenv): removed
(prepare_envblk, lookup_cmd, prepare_cmdline, start_child): removed
(kill, getpriority, setpriority, sched_getaffinity): removed
(sched_setaffinity): removed
(waitpid): modified to just use _cwait. ENOHANG emlation removed.
* libguile/posix-w32.h (CPU_ZERO, CPU_ISSET, CPU_SET, CPU_SETSIZE): removed
(cpu_set_t, PRIO_PROCESS, PRIO_PGRP, PRIO_USER): removed
(HAVE_START_CHILD, HAVE_KILL, HAVE_GETPRIORITY): removed
(HAVE_SETPRIORITY, HAVE_SCHED_GETAFFINITY, HAVE_SCHED_SETAFFINITY): removed
declarations for waitpid, start_child, kill, getpriority: removed
declarations for setpriority, sched_getaffinity, sched_set_affinity: Removed
Michael Gran [Tue, 20 Jun 2023 22:28:09 +0000 (15:28 -0700)]
In piped_process, replace dprintf with more portable functions
dprint is missing on many non-glic platforms
* libguile/posix.c (piped_process): replace dprintf with sprintf+write
Michael Gran [Tue, 20 Jun 2023 22:38:54 +0000 (15:38 -0700)]
Allow piped-process and system* to exist when fork is undefined
piped-process only uses fork to match legacy behavior, but on systems
that never had fork, there is no need to match that behavior.
piped-process and system* can be provided without fork.
* libguile/posix.c (piped_process): allow function definition without HAVE_FORK,
but stub out internal dummy process with HAVE_FORK
(restore_sigaction, scm_dynwind_sigaction, scm_system_star): don't
require HAVE_FORK
(scm_init_popen): don't require HAVE_FORK
(scm_init_posix): don't require HAVE_FORK to add posix feature or
register popen extension
Michael Gran [Sun, 23 Mar 2025 00:42:41 +0000 (17:42 -0700)]
MinGW32: cast arguments to execvp
MinGW32's MSVCRT library requires strict casting for exec family functions
* libguile/posix.c (scm_execl, scm_execlp, scm_execle) [__MINGW32__]: cast
arguments
Michael Gran [Tue, 20 Jun 2023 22:22:21 +0000 (15:22 -0700)]
Add missing #include in syscalls.h
SCM_SYSCALL uses scm_async_tick.
* libguile/syscalls.h: include async.h
Michael Gran [Tue, 20 Jun 2023 22:21:10 +0000 (15:21 -0700)]
Add replacement for missing getpagesize() on MINGW
* libguile/posix-w32.c (getpagesize_w32): new procedure
* libguile/posix-w32.h: declaration of getpagesize_w32
* libguile/loader.c [__MINGW32__](scm_bootstrap_loader): use new procedure
* libguile/vm.c [__MINGW32__](scm_i_vm_prepare_stack): use new procedure
Michael Gran [Sat, 22 Mar 2025 18:26:20 +0000 (11:26 -0700)]
Fix NEWS for load-foreign-library
NEWS update was in wrong location. This fixes news entry
from
7b412940497394b0f73b29d8ceabf8312baf5cbe
* NEWS: update
Michael Gran [Wed, 25 Dec 2024 17:41:08 +0000 (09:41 -0800)]
Improve DLL search strategy for load-foreign-library
The new non-libltdl foreign library loading algorithm from 3.0.6
fails to cover common cases regarding how libtool names and installs
DLL files. Notably, it fails to recognize when libtool has added the
major version number into the filename itself, such as libfoo-1.dll
Also, it does not search in binary directories and the PATH for DLL
files, where libtool is likely to install DLLs.
This adds the option to search for dlls with major version numbers
in the filename, and modifies the search strategy for DLL-using
OSs to check bindir and PATH.
For MSYS, libraries are installed with the 'msys-' prefix. So this
modifies load-foreign-library to handle that prefix as well.
It changes the #:rename-on-cygwin? option to #:host-type-rename? to
better reflect that is works on both Cygwin and MSYS.
Partially based on a patch by Hannes Müller.
* NEWS: updated
* doc/ref/api-foreign.texi: document updates to load-foreign-library
and system-dll-path
* module/system/foreign-library.scm (is-integer-string?): new utility function
(dll-name-match?): new utility function
(find-best-dll-from-matches): new utility function
(dll-exists-with-version): new function that implements new dll search logic
(file-exists-with-extension): add flag argument to allow new dll search
(file-exists-in-path-with-extension): add flag argument to all new dll search
(system-dll-path): new parameter
(lib->msys): new helper function
(load-foreign-library): add new optarg flag #:allow-dll-version-suffix?
Pass new flag to library search functions.
Implement new search strategy for #:search-system-paths? on DLL systems'
replace #:rename-on-cygwin? with #:host-type-rename?
Use that option to rename both MSYS and Cygwin libraries.
(guile-system-extensions-path): prefer bindir to libdir on DLL systems
* test-suite/tests/foreign.test ("dll-name-match?"): new test category
("find-best-dll-from-matches"): new test category
("lib->msys"): new unit tests
Michael Gran [Wed, 25 Dec 2024 17:44:21 +0000 (09:44 -0800)]
Cygwin/MSYS: 00-socket.test: abstract sockets are unsupported
Binding to AF_UNIX abstract sockets is not supported on Cygwin and
presumably MSYS as well.
* test-suite/tests/00-socket.text ("AF_UNIX abstract"): throw unsupported
on Cygwin and MSYS
Michael Gran [Sat, 3 Jun 2023 01:57:06 +0000 (18:57 -0700)]
ports.test: catch pipe errors
Refactors a couple of the ports tests to catch errors in the test runner,
so that the test suite will print ERROR on failure.
* test-suite/tests/ports.test (pipe:write, pipe:read): modified
Michael Gran [Sat, 22 Mar 2025 12:33:49 +0000 (05:33 -0700)]
version.test: incorrect test logic
Since string-contains returns an integer on success, this test
was reporting unresolved instead of pass on success.
* test-suite/tests/version.test ("version reporting works"): fix
boolean check logic
Ludovic Courtès [Fri, 21 Mar 2025 17:10:07 +0000 (18:10 +0100)]
Provide ‘scm_i_is_finalizer_thread’ when building ‘--without-threads’.
Fixes a regression in ‘--without-threads’ builds introduced in
b8031fc9653a039c4ba8c07b93e649155351657a.
* libguile/finalizers.c (scm_i_is_finalizer_thread) [!SCM_USE_PTHREAD_THREADS]:
New function.
Arun Isaac [Mon, 6 Jul 2020 15:38:50 +0000 (21:08 +0530)]
Replace "either" with "either array" in make-shared-array docs
* doc/ref/api-data.texi (Shared Arrays): Replace "either" with "either
array" in make-shared-array documentation.
Closes: 42228
Arun Isaac [Mon, 6 Jul 2020 15:38:49 +0000 (21:08 +0530)]
Fix typo in transform-string docstring
* module/texinfo/string-utils.scm (transform-string): Replace "te" with
"the" in docstring.
Fixes: 42228
Rob Browning [Thu, 20 Mar 2025 17:50:29 +0000 (12:50 -0500)]
libguile/Makefile.am: move date -d arg before format string
This fixes a problem on at least NetBSD.
* libguile/Makefile.am (libpath.h): move date -d argument before format
string.
Thanks to Thomas Klausner for reporting the problem and proposing the
fix.
Closes: 26121
Rob Browning [Thu, 20 Mar 2025 17:44:33 +0000 (12:44 -0500)]
filesys.test: skip copy-file EACCES test when root
Accidentally omitted from
b3b74771281dd3d59b2d082d5fee91b1b99b966b.
* test-suite/tests/filesys.test: skip copy-file EACCES test when root.
Tomas Volf [Fri, 28 Feb 2025 01:10:18 +0000 (02:10 +0100)]
filesys.c: Use scm_sendfile to copy files
Use scm_sendfile instead of read-write loop. This moves the work into
the kernel, improving performance. This implements Ludovic's suggestion
from https://debbugs.gnu.org/68504
* libguile/filesys.c (scm_copy_file2): Use scm_sendfile.
[
[email protected]: add NEWS]
Rob Browning [Thu, 20 Mar 2025 01:32:53 +0000 (20:32 -0500)]
Add missing, read-only, and typical copy-file tests
* test-suite/guile-test: add call-with-temp-dir and exception-errno.
* test-suite/tests/filesys.test: add further copy-file tests.
Rob Browning [Tue, 18 Mar 2025 18:40:19 +0000 (13:40 -0500)]
piped_process: silence spurious -Wmaybe-uninitialized warnings
libguile/posix.c: initialize pipes to silence spurious warnings.
Rob Browning [Tue, 18 Mar 2025 17:56:31 +0000 (12:56 -0500)]
configure: add -Werror=array-bounds to CFLAGS when available
This would have prevented https://bugs.gnu.org/76907
* configure.ac: add -Werror=array-bounds to CFLAGS when available
Michael Gran [Sun, 9 Mar 2025 02:42:35 +0000 (18:42 -0800)]
Fixes potential buffer overflow in getsockopt for timevals
struct timeval is a possible return value of getsockopt (e.g. SO_RCVTIMEO
and SO_SNDTIMEO), but it is not included in the scm_t_getsockopt_result
union, which may then be too small (and is on Debian amd64).
* libguile/socket.c: add struct timeval to scm_t_getsockopt union
[
[email protected]: adjust commit message; add NEWS]
Closes: 76907
Zheng Junjie [Mon, 3 Mar 2025 12:48:23 +0000 (20:48 +0800)]
build: Mark JIT as supported on riscv64.
This is a followup to
5d3f561d7dbcee370dc764cd5ba4210c62ce13de.
* acinclude.m4 (GUILE_ENABLE_JIT): Mark riscv64 as JIT available.
Signed-off-by: Ludovic Courtès <[email protected]>
Rob Browning [Sun, 2 Mar 2025 19:51:17 +0000 (13:51 -0600)]
r6rs-ports.test: don't race with gc close in custom port tests
The tests share a "log" for custom port events and didn't always
explicitly close the test ports, so the close might come later, during
another test. Change the tests to always close their ports immediately,
and clear the log after checking for expected "inter-test" events.
test-suite/tests/r6rs-ports.test: don't race with gc close in custom
port tests.
Rob Browning [Sat, 1 Mar 2025 17:24:19 +0000 (11:24 -0600)]
configure.ac: enable -ffat-lto-objects with -flto when available
Without -ffat-lto-objects libguile.a ends up with no symbols, visible
via "nm t libguile.a".
cf. https://lintian.debian.org/tags/no-code-sections.html
* configure.ac: enable -ffat-lto-objects with -flto when available.
Rob Browning [Fri, 21 Feb 2025 02:55:36 +0000 (20:55 -0600)]
Note setlocale raises a system-error when locale doesn't exist
doc/ref/posix.texi: note setlocale raises a system-error when locale
doesn't exist
Thanks to Francesco P. Lovergine for suggesting the
addition (https://bugs.debian.org/
1078681).
Dale P. Smith [Fri, 28 Jan 2022 00:20:57 +0000 (19:20 -0500)]
Allow trailing "." in urls
Fixes https://debbugs.gnu.org/53201
* module/web/uri.scm (valid-host?): Allow trailing "." in URLs
* test-suite/tests/web-uri.test: Add tests for trailing "."
Ludovic Courtès [Fri, 28 Feb 2025 21:10:59 +0000 (22:10 +0100)]
Olivier Dion [Wed, 19 Feb 2025 01:40:41 +0000 (20:40 -0500)]
Warn about mutation of ‘environ’ when multi-threaded.
This is an amendment to
84bf84032208e21d20ad13f3033d4fca3a512014.
The warning was only emitted for calling `environ', even if only reading
and no mutation occurred.
However, it is correct to read the environment in a multi-threaded
process. It is however unsafe to mutate it.
The same logic also applies to `putenv'.
* libguile/posix.c
(maybe_warn_about_environ_mutation): New private procedure ...
(scm_environ): ... called here when mutating the environment ...
(scm_putenv): ... and here.
* NEWS: Update.
Signed-off-by: Ludovic Courtès <[email protected]>
Ludovic Courtès [Wed, 26 Feb 2025 14:48:41 +0000 (15:48 +0100)]
Exclude the finalizer thread from the ‘all-threads’ result.
Fixes <https://bugs.gnu.org/76343>.
Fixes a bug whereby “echo '(environ)' | guile” would wrongfully trigger
the multiple-thread warning.
* libguile/finalizers.c (finalizer_thread): New variable.
(finalization_thread_proc): Set it.
(scm_i_is_finalizer_thread): New function.
(run_finalization_thread): Clear FINALIZER_THREAD.
* libguile/finalizers.h (scm_i_is_finalizer_thread): New declaration.
* libguile/threads.c (scm_all_threads): Use it.
* NEWS: Update.
Reported-by: Simon Josefsson <[email protected]>
Maxim Cournoyer [Mon, 23 Dec 2024 01:10:08 +0000 (10:10 +0900)]
Remove lib/malloc/.dirstamp and register to .gitignore.
* lib/malloc/.dirstamp: Delete file.
* .gitignore: Register.
Signed-off-by: Ludovic Courtès <[email protected]>
Morgan Smith [Tue, 24 Dec 2024 00:48:33 +0000 (19:48 -0500)]
doc: Remove reference to long-gone tutorial.
The tutorial was removed in commit
f75c5849cdc6c863616facbb22b28d08da3fc09f.
* doc/README: Remove reference to a tutorial that no longer exists
Signed-off-by: Ludovic Courtès <[email protected]>
Morgan Smith [Tue, 24 Dec 2024 00:48:32 +0000 (19:48 -0500)]
HACKING: Update mailing list URL.
* HACKING: Update.
Signed-off-by: Ludovic Courtès <[email protected]>
Morgan Smith [Tue, 24 Dec 2024 00:48:31 +0000 (19:48 -0500)]
doc: Remove all remaining references to GDS.
This finished what this previous commit was meant to do:
767dbb1af30500cc0ad44d6bd0e0e179a1191ec6
* .gitignore: Remove "gds-test.debug" and "gds-test.transcript".
* doc/ref/Makefile.am (PICTURES): Remove "gds.eps", "gds.pdf", and "gds.txt".
* doc/ref/gds.dia:
* doc/ref/gds.eps:
* doc/ref/gds.pdf:
* doc/ref/gds.txt: Delete files
Signed-off-by: Ludovic Courtès <[email protected]>
Hannes Müller [Sat, 21 Dec 2024 18:20:17 +0000 (19:20 +0100)]
libguile/scm.h: Allow compilation with ‘-Werror=undef’.
* libguile/scm.h: BUILDING_LIBGUILE is not always defined. This is
signaled by -Werror=undef in code using libguile. This patch fixes
commit
dc3a3a84f908f4a16e95a2c3bb412861521960dc
* NEWS: Update.
Signed-off-by: Ludovic Courtès <[email protected]>
Hannes Müller [Sat, 21 Dec 2024 15:55:13 +0000 (16:55 +0100)]
Fix make-custom-port in case encoding is #f
* module/ice-9/custom-ports.scm (make-custom-port): Code fails if
(fluid-ref %default-port-encoding) returns #f. In fact this was the
case why readline support on MSYS2 failed for guile 3.0.10, ref.
https://github.com/msys2/MSYS2-packages/issues/5079
But later used canonicalize-encoding is prepared to handle #f for
encoding. So allow encoding to also handle this case.
Co-authored-by: Ludovic Courtès <[email protected]>
Werner Lemberg [Fri, 17 Jan 2025 10:10:26 +0000 (11:10 +0100)]
Add `LIB_GETRANDOM` to `Libs.private` in `.pc` files
The omission was discovered while cross-compiling LilyPond with mingw
11.0.1: without this addition, linking with libguile causes the error
undefined reference to `BCryptGenRandom'
* meta/Makefile.am (dependency_substitutions): Add ‘LIB_GETRANDOM’.
* meta/guile-3.0-uninstalled.pc.in (Libs.private): Likewise.
* meta/guile-3.0.pc.in (Libs.private): Likewise.
* NEWS: Update.
Signed-off-by: Ludovic Courtès <[email protected]>
Ludovic Courtès [Fri, 28 Feb 2025 19:51:40 +0000 (20:51 +0100)]
doc: Update ‘release.org’.
* doc/release.org: Update links to CI and the web site. Clarify what’s
optional. Remove references to discontinued services.
Tomas Volf [Fri, 24 Jan 2025 16:23:17 +0000 (17:23 +0100)]
srfi-19: Fix ~V converter in date->string.
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 <
[email protected]>.
Tomas Volf [Fri, 28 Feb 2025 00:02:29 +0000 (01:02 +0100)]
Fix typos in comments.
* module/sxml/xpath.scm: Fix typo in a comment.
* module/sxml/upstream/SXPath-old.scm: Same.
* doc/ref/sxml.texi (SXPath): Reflect in the documentation.
* doc/ref/texinfo.texi (string-utils): Fix same typo.
* module/texinfo/string-utils.scm (expand-tabs): Same.
Fixes <https://bugs.gnu.org/76621>.
Edited by lloda <
[email protected]>.
Andy Wingo [Thu, 20 Feb 2025 11:38:28 +0000 (12:38 +0100)]
Fix string-utf8-length to have unboxed representation
* module/language/cps/utils.scm (primcall-raw-representations): Add
string-utf8-length.
Andy Wingo [Wed, 29 Jan 2025 15:52:29 +0000 (16:52 +0100)]
Merge remote-tracking branch 'lightening/main'
Andy Wingo [Wed, 29 Jan 2025 15:43:49 +0000 (15:43 +0000)]
Merge branch 'main' into 'main'
RISC-V Support
See merge request wingo/lightening!14
Ekaitz Zarraga [Mon, 18 Nov 2024 20:12:03 +0000 (21:12 +0100)]
riscv: error if not little endian
Ekaitz Zarraga [Mon, 18 Nov 2024 20:08:41 +0000 (21:08 +0100)]
riscv: float/double call convention implementation
RISC-V uses a0-a7 registers for argument passing. Float/double arguments
use f0-f7 first and continue in a0-a7 if needed.
Once registers are consumed, stack is used.
This commit changes how lightening passes arguments in order to allow
this behavior.
Ekaitz Zarraga [Fri, 15 Nov 2024 20:51:39 +0000 (21:51 +0100)]
riscv: change stack alignment to 16
Ekaitz Zarraga [Fri, 15 Nov 2024 12:49:21 +0000 (13:49 +0100)]
riscv: fix hi20/lo12 calculations for negative numbers
Ekaitz Zarraga [Fri, 15 Nov 2024 12:09:45 +0000 (13:09 +0100)]
riscv: better `movi`
Ekaitz Zarraga [Fri, 15 Nov 2024 11:01:52 +0000 (12:01 +0100)]
riscv: movi: use addiw in RV64
Ekaitz Zarraga [Fri, 15 Nov 2024 11:01:23 +0000 (12:01 +0100)]
riscv: movi: sign extend hi
Ekaitz Zarraga [Thu, 14 Nov 2024 10:43:25 +0000 (11:43 +0100)]
riscv: fix load size for ldxi instructions
Ekaitz Zarraga [Thu, 14 Nov 2024 22:35:54 +0000 (23:35 +0100)]
riscv: simplify load from pool
Ekaitz Zarraga [Thu, 14 Nov 2024 18:35:43 +0000 (19:35 +0100)]
riscv: fix literal pool guard jump address calc
Ekaitz Zarraga [Thu, 14 Nov 2024 15:57:13 +0000 (16:57 +0100)]
riscv: add get_callr_temp
Ekaitz Zarraga [Thu, 14 Nov 2024 15:11:46 +0000 (16:11 +0100)]
riscv: fix the B and J type size check
Ekaitz Zarraga [Thu, 14 Nov 2024 12:24:48 +0000 (13:24 +0100)]
riscv: clean patch jumps
Ekaitz Zarraga [Thu, 14 Nov 2024 12:01:26 +0000 (13:01 +0100)]
riscv: don't pack veneers, use padding
Ekaitz Zarraga [Thu, 7 Nov 2024 18:51:37 +0000 (19:51 +0100)]
riscv: Pack the veneer struct
Ekaitz Zarraga [Tue, 8 Oct 2024 15:00:27 +0000 (17:00 +0200)]
riscv: Add fence
Ekaitz Zarraga [Wed, 19 Jan 2022 11:20:42 +0000 (12:20 +0100)]
Fix CI
Ekaitz Zarraga [Wed, 19 Jan 2022 10:09:20 +0000 (11:09 +0100)]
Add RISCV to CI and makefile
Ekaitz Zarraga [Sun, 9 May 2021 14:39:03 +0000 (16:39 +0200)]
RISC-V Support
Ekaitz Zarraga [Thu, 13 May 2021 15:52:28 +0000 (17:52 +0200)]
Makefile: RISCV support and optional vars
Optional variables are needed because the structure of the makefile
is prepared to run on Guix but Guix doesn't support RISCV yet, so it's
better to set them as optional and let the user decide how do they want
to compile this thing.
Andy Wingo [Wed, 29 Jan 2025 11:17:25 +0000 (11:17 +0000)]
Merge branch 'reinterpret' into 'main'
Add movr_f_i, movr_i_f, movr_d_l, movr_l_d
See merge request wingo/lightening!27
Andy Wingo [Wed, 29 Jan 2025 11:14:59 +0000 (12:14 +0100)]
Add movr_f_i, movr_i_f, movr_d_l, movr_l_d
These move values verbatim between FPRs and GPRs.
Andy Wingo [Mon, 27 Jan 2025 08:38:43 +0000 (09:38 +0100)]
Avoid accidentally-quadratic use of intmap-keys
* module/language/cps/utils.scm (compute-reachable-functions): Rework to
not call intmap-keys on a data structure that we are building up in a
loop.
Maxim Cournoyer [Mon, 23 Dec 2024 04:59:14 +0000 (13:59 +0900)]
doc/srfi-64: Fix typos and add examples.
* doc/ref/srfi-modules.texi (SRFI-64 Writing Basic Test Suites): Fix
typo. Add default test runner example. Add test-approximate and
test-error examples. Document valid error types in Guile for test-error.
(SRFI-64 Conditonal Test Suites and Other Advanced Features): Fix typo.
Fixes <https://bugs.gnu.org/75041>.
Suggested-by: Arne Babenhauserheide <[email protected]>
Rob Browning [Fri, 17 Jan 2025 17:45:26 +0000 (11:45 -0600)]
fport_print: handle ttyname ENODEV
In some situations, ttyname may return ENODEV even though isatty is
true. From ttyname(3):
A process that keeps a file descriptor that refers to a pts(4) device
open when switching to another mount namespace that uses a different
/dev/ptmx instance may still accidentally find that a device path of
the same name for that file descriptor exists. However, this device
path refers to a different device and thus can't be used to access the
device that the file descriptor refers to. Calling ttyname() or
ttyname_r() on the file descriptor in the new mount namespace will
cause these functions to return NULL and set errno to ENODEV.
Observed in a Debian riscv64 porterbox schroot.
When ttyname fails with ENODEV, just include the file descriptor integer
value instead. Call ttyname() directly to avoid having to catch the
ENODEV.
* libguile/fports.c (fport_print): fall back to the integer fd when
ttyname() fails with ENODEV.
Rob Browning [Wed, 22 Jan 2025 18:55:06 +0000 (12:55 -0600)]
Don't hold lock during scm_async_tick in readdir and ttyname
Only hold scm_i_misc_mutex while making the C calls. This also avoids
the need for a dynamic-wind. Add SCM_I_LOCKED_SYSCALL (similar to
SCM_SYSCALL) to handle the locking and EINTR loop.
libguile/filesys.c (scm_readdir): rely on SCM_I_LOCKED_SYSCALL to limit
locking.
libguile/filesys.c (scm_ttyname): rely on SCM_I_LOCKED_SYSCALL to limit
locking.
libguile/syscalls.h: add SCM_I_LOCKED_SYSCALL.
Andy Wingo [Wed, 22 Jan 2025 15:51:28 +0000 (16:51 +0100)]
Optimize ordering edges in fix-letrec
* module/language/tree-il/fix-letrec.scm (compute-sccs): Instead of
depending on all previous complex bindings, we can just depend on the
most recent one. Decreases the graph size.
Andy Wingo [Wed, 22 Jan 2025 15:50:52 +0000 (16:50 +0100)]
Use transient intset/intmap optimizations when computing SCCs
* module/language/cps/graphs.scm (compute-sorted-strongly-connected-components):
Use more transient data structures.
Andy Wingo [Wed, 22 Jan 2025 13:35:59 +0000 (14:35 +0100)]
Fix bad algorithmic growth in fix-letrec
We were using list sets, which when you end up with thousands of
bindings in an SCC reaches the point where we are off the quadratic end
of the curve. Fix to use intsets and intmaps instead.
* module/language/tree-il/fix-letrec.scm (compute-ids): New function.
(compute-referenced-and-assigned): Rename from analyze-lexicals, and
compute intsets.
(make-compute-free-variables): Rename from free-variables, return a
procedure instead of a hash table, and use intsets. Use a global cache
to avoid quadratic behavior with regard to binding depth.
(compute-complex): Compute a global set of "complex" variables, as an
intset.
(compute-sccs): Use intsets and intmaps to compute the free-variable and
ordering edges.
(fix-scc, fix-term): Refactorings.
(reorder-bindings): Avoid a linear search.
(fix-letrec): Refactor.
Andy Wingo [Wed, 22 Jan 2025 11:14:30 +0000 (12:14 +0100)]
Fix a check in the Tree-IL verifier
* module/language/tree-il/debug.scm (verify-tree-il): Fix
pattern-matching.
Yuval Langer [Fri, 3 Jan 2025 04:37:43 +0000 (06:37 +0200)]
Fix faulty SRFI-31 example.
Daniel Llorens [Thu, 16 Jan 2025 14:46:05 +0000 (15:46 +0100)]
Fix bug in srfi-111 box printer
* module/srfi/srfi-111.scm: Add missing port.
* test-suite/tests/srfi-111.test: Test.
Mikael Djurfeldt [Mon, 13 Jan 2025 21:51:35 +0000 (22:51 +0100)]
README: Add dependency on autopoint
Tomas Volf [Thu, 12 Dec 2024 20:35:00 +0000 (21:35 +0100)]
doc: srfi-19: Use `day' instead of `date' for `make-date'.
Looking at the SRFI-19 specification, the argument is called `day', not
`date'. Even the accessor is called `date-day'. So adjust the
documentation to match.
Also adjust the (web http) module, which was using `date' as well.
* doc/ref/srfi-modules.texi (SRFI-19 Date): Use `day' instead of `date'.
* module/web/http.scm (parse-rfc-822-date, parse-rfc-850-date)
(parse-asctime-date): Same.
Signed-off-by: Ludovic Courtès <[email protected]>
Maxim Cournoyer [Sun, 15 Sep 2024 04:25:46 +0000 (13:25 +0900)]
doc: Document SRFI-64.
This is an import of the 'Abstract', 'Rationale', and 'Specification'
sections from the upstream specification text, with some manual
adjustment.
* doc/ref/srfi-modules.texi (SRFI 64): New subsection.
Signed-off-by: Ludovic Courtès <[email protected]>
Ekaitz Zarraga [Thu, 5 Oct 2023 20:42:44 +0000 (22:42 +0200)]
doc: Add explanation on how to avoid escaping in SXML
* doc/ref/sxml.texi (Reading and Writing XML): Add explanation on using
a procedure to avoid escaping.
Signed-off-by: Ludovic Courtès <[email protected]>
Ekaitz Zarraga [Thu, 5 Oct 2023 20:41:36 +0000 (22:41 +0200)]
doc: Fix typo in SXML section.
* doc/ref/sxml.texi (Reading and Writing XML): Remove "."
Signed-off-by: Ludovic Courtès <[email protected]>
Ekaitz Zarraga [Sun, 22 Dec 2024 20:01:08 +0000 (21:01 +0100)]
PEG: string-peg: Add HTML5 grammar test.
* test-suite/tests/peg.test (comment-grammar): Z can be anything.
("simple comment with forbidden char"): Remove.
(html-grammar, html-example): New variables.
("parsing with complex grammars"): New test.
Signed-off-by: Ludovic Courtès <[email protected]>
Ekaitz Zarraga [Sun, 22 Dec 2024 20:01:07 +0000 (21:01 +0100)]
PEG: string-peg: Better support for escaping.
* module/ice-9/peg/string-peg.scm (peg-as-peg): Augment with rules for
hexadecimal digits, “\uXXX” for characters, “\t” for tabs, etc.
Signed-off-by: Ludovic Courtès <[email protected]>
Ekaitz Zarraga [Sun, 22 Dec 2024 20:01:06 +0000 (21:01 +0100)]
PEG: string-peg: Fix [^...] interpretation.
* module/ice-9/peg/string-peg.scm (NotInClass->defn): Adjust.
Signed-off-by: Ludovic Courtès <[email protected]>
Adam Faiz [Thu, 19 Dec 2024 21:36:38 +0000 (22:36 +0100)]
New line or field iteration procedures in (ice-9 rdelim)
* NEWS: Update
* module/ice-9/rdelim (for-rdelim-from-port, for-delimited-from-port,
for-line-in-file): New procedures.
* doc/ref/api-io.texi: Documentation of `for-rdelim-for-port`-related
procedures.
* test-suite/tests/rdelim.test: Tests for `for-rdelim-for-port`-related
procedures.
Signed-off-by: Mikael Djurfeldt <[email protected]>
Mikael Djurfeldt [Wed, 11 Dec 2024 21:43:17 +0000 (22:43 +0100)]
goops.test: Add tests for define-method*
Rob Browning [Mon, 1 Jul 2024 03:41:40 +0000 (22:41 -0500)]
scm_i_utf8_string_hash: don't overrun when len is zero
When the length is zero, the previous code would include the byte after
the end of the string in the hash. Fix that (the wide and narrow
hashers also guard against it via "case 0"), and don't bother mutating
length for the trailing bytes.
Since we already compute the char length, use that to detect all ASCII
strings and follow the same narrow string path that we do for latin-1.
libguile/hash.c (scm_i_utf8_string_hash): avoid overrun when len == 0.
Rob Browning [Wed, 11 Dec 2024 17:21:45 +0000 (11:21 -0600)]
scm_i_utf8_string_hash: switch to u8_mbtouc
libguile/hash.c (scm_i_utf8_string_hash): Switch from u8_mbtouc_unsafe
to u8_mbtouc since the unsafe variant is now the same (see the info
pages).
Mikael Djurfeldt [Mon, 9 Dec 2024 22:46:20 +0000 (23:46 +0100)]
Add clarification about the less predicate passed to merge and sort
Ekaitz Zarraga [Fri, 11 Oct 2024 12:24:30 +0000 (14:24 +0200)]
PEG: Add support for `not-in-range` and [^...]
Modern PEG supports inversed class like `[^a-z]` that would get any
character not in the `a-z` range. This commit adds support for that and
also for a new `not-in-range` PEG pattern for scheme.
* module/ice-9/peg/codegen.scm (cg-not-in-range): New function.
* module/ice-9/peg/string-peg.scm: Add support for `[^...]`
* test-suite/tests/peg.test: Test it.
* doc/ref/api-peg.texi: Document accordingly.
Signed-off-by: Ludovic Courtès <[email protected]>
Ekaitz Zarraga [Wed, 11 Sep 2024 19:19:26 +0000 (21:19 +0200)]
PEG: Add full support for PEG + some extensions
This commit adds support for PEG as described in:
<https://bford.info/pub/lang/peg.pdf>
It adds support for the missing features (comments, underscores in
identifiers and escaping) while keeping the extensions (dashes in
identifiers, < and <--).
The naming system tries to be as close as possible to the one proposed
in the paper.
* module/ice-9/peg/string-peg.scm: Rewrite PEG parser.
* test-suite/tests/peg.test: Fix import
Signed-off-by: Ludovic Courtès <[email protected]>
Mikael Djurfeldt [Fri, 6 Dec 2024 09:26:29 +0000 (10:26 +0100)]
Temporarily revert commit
7379049d3 (to make Guile bootstrap)
Rob Browning [Thu, 28 Nov 2024 19:01:01 +0000 (13:01 -0600)]
Eight byte align statically allocated stringbufs
Previously they were unaligned, unlike their parent strings, and so
could end up with the wrong pointer tag. Observed on i686-linux-gnu,
where they ended up tagged as immediates (SCM_IMP()), causing failures
in TYP7 related checks.
* libguile/strings.h (SCM_IMMUTABLE_STRINGBUF): align resulting buffer
via SCM_ALIGNED(8).
Mikael Djurfeldt [Thu, 28 Nov 2024 20:39:09 +0000 (21:39 +0100)]
Updated GOOPS sections of reference
* doc/ref/goops.texi: Insert reference to the "definition" of
next-method the first time next-method is mentioned. Place the
definition of next-method in index. Don't use capital methods in generic
function names (corrected only in one node). In section about
next-method, say that you can provide custom arguments (which we can now
due to the optimizing compiler). New node "Inheritance and accessors"
explaining how new accessor methods are created for subclasses.
Mikael Djurfeldt [Wed, 27 Nov 2024 13:59:04 +0000 (14:59 +0100)]
test-suite: Canonicalize path in test directory
* test-suite/tests/filesys.test: Canonicalize path in the chdir tests to
avoid false differences due to following links.
Mikael Djurfeldt [Wed, 27 Nov 2024 12:27:46 +0000 (13:27 +0100)]
Bugfix: Recursively use method*, not method, in method*
* module/oop/goops.scm (method*): Do not use method.
Mikael Djurfeldt [Tue, 26 Nov 2024 23:00:03 +0000 (00:00 +0100)]
Spell Tomas Volf's name correctly in NEWS
Mikael Djurfeldt [Tue, 26 Nov 2024 18:49:50 +0000 (19:49 +0100)]
Add comment about (oop goops keyword-formals)
Mikael Djurfeldt [Tue, 26 Nov 2024 18:02:07 +0000 (19:02 +0100)]
New module (oop goops keyword-formals)
This module replaces the method and define-method bindings with their
method* and define-method* counterparts, for use by users who prefer not
to use both kinds of syntactic forms.
* module/oop/goops/keyword-formals.scm: New module.
* am/bootstrap.am: Added
* doc/ref/goops.texi: Document this change.
Mikael Djurfeldt [Mon, 25 Nov 2024 20:44:06 +0000 (21:44 +0100)]
Update NEWS
Mikael Djurfeldt [Mon, 25 Nov 2024 20:35:43 +0000 (21:35 +0100)]
Document method* and define-method*