summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-02-23Added comments in load-lang.test, which does not work. * ↵wip-load-langMatt Wette1-1/+22
test-suite/tests/load-lang.tests: added comments: The test is not working but execution repl does work.
2023-02-23multiple languages support via file extension or #lang headerMatt Wette4-6/+108
From scripts/compile pushed default assumption of #:from as 'scheme down into system/base/compile where filename and first line can be used to deduce intended "from" language. If first line of a file is of the form #lang ecmascript then the file is assumed consist of source language "ecmascript". * module/scripts/compile.scm (compile): changed default #:from to #f from 'scheme * module/system/base/compile.scm(lang-from-port, %file-extension-map, add-lang-extension, lang-extension-for): added global %file-extension-map with accessor lang-extension-for and updater add-lang-extension. Also, added lang-from-port to parse first line, looking for #lang. * test-suite/tests.scm: added "load-lang" test. * test-suite/Makefile.am(SCM_TESTS): added tests/load-lang.test
2023-01-17Doc: clarification on regexes and encodingsJean Abou Samra1-2/+6
* doc/ref/api-regex.texi: make it more obviously clear that regexp matching supports only characters supported by the locale encoding.
2023-01-17doc: Fix eval-when exampleJean Abou Samra1-11/+18
* doc/ref/api-macros.texi: make the macro expand to the literal date, not to a call to the date function. The example previously did not actually need eval-when and did not show the intended effect.
2023-01-16build: Avoid implicit 'int' return type in configure tests.Ludovic Courtès1-2/+2
Fixes <https://bugs.gnu.org/60022>. Reported by Florian Weimer <fweimer@redhat.com>. * configure.ac: Add missing implicit 'int' return type in tests.
2023-01-16Do not expand 'make-vector' primcall with wrong number of arguments.Ludovic Courtès2-5/+14
Fixes <https://bugs.gnu.org/60522>. Reported by Sascha Ziemann <ceving@gmail.com>. * module/language/tree-il/primitives.scm (make-vector): Return #f when passed an incorrect number of arguments. * test-suite/tests/peval.test ("partial evaluation"): Add tests.
2023-01-14Add 'bytevector-slice'.Ludovic Courtès8-5/+208
* module/rnrs/bytevectors/gnu.scm: New file. * am/bootstrap.am (SOURCES): Add it. * libguile/bytevectors.c (scm_bytevector_slice): New function. * libguile/bytevectors.h (scm_bytevector_slice): New declaration. * test-suite/tests/bytevectors.test ("bytevector-slice"): New tests. * doc/ref/api-data.texi (Bytevector Slices): New node.
2023-01-14Remove Gnulib generated file.Ludovic Courtès1-116/+0
This was inadvertently committed in edfca3b7e5931b5b5a83112e2a9813b068be99c2. * lib/stdbool.h: Delete.
2023-01-13Bump user-visible copyright years to 2023.Ludovic Courtès3-4/+4
* module/ice-9/command-line.scm (version-etc): * module/scripts/compile.scm (show-version): * module/system/repl/common.scm (*version*): Bump to 2023.
2023-01-13Reduce redundant 'close' calls when forking on some systems.Andrew Whatson2-3/+40
Fixes <https://bugs.gnu.org/59321>. Reported by <hylophile@posteo.de>. Some systems provide "/proc/self/fd" which is a directory containing an entry for each open file descriptor in the current process. We use this to limit the number of close() calls needed to ensure file descriptors aren't leaked to the child process when forking. * libguile/posix.c (close_inherited_fds_slow): (close_inherited_fds): New static helper functions. (scm_spawn_process): Attempt to close inherited file descriptors efficiently using 'close_inherited_fds', falling back to the brute-force approach in 'close_inherited_fds_slow'. * NEWS: Update.
2023-01-13Make 'system*' and 'piped-process' internally use 'spawn'.Josselin Poiret3-155/+101
Fixes <https://bugs.gnu.org/52835>. * libguile/posix.c (scm_system_star, scm_piped_process): Use do_spawn. (start_child): Remove function. * test-suite/tests/posix.test ("system*")["https://bugs.gnu.org/52835"]: New test. * NEWS: Update. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-01-13Add 'spawn'.Josselin Poiret5-10/+303
* libguile/posix.c: Include spawn.h from Gnulib. (do_spawn, scm_spawn_process): New functions. (kw_environment, hw_input, kw_output, kw_error, kw_search_path): New variables. * doc/ref/posix.texi (Processes): Document it. * test-suite/tests/posix.test ("spawn"): New test prefix. * NEWS: Update. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-01-12Update gnulib to 0.1.5414-8204d and add posix_spawn, posix_spawnp.Josselin Poiret531-3275/+16214
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-01-11Test for 'frame-local-ref' errors when printing backtrace.Andrew Whatson1-1/+22
This test reproduces the error from <https://bugs.gnu.org/56493>, and passes with the workaround which was merged in commit c7fa78fc751eb336bcfafbb5ac59c460ee2c5d7a. * test-suite/tests/eval.test ("avoid frame-local-ref out of range"): New test. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-12-21Recognize LoongArch compilation targets.Zhang Ning1-0/+2
* module/system/base/target.scm (cpu-endianness): Add case for "Loongarch" variants Signed-off-by: Zhang Ning <zhangn1985@outlook.com>
2022-12-21doc: fix documented keyword argument default to match code defaultVijay Marupudi1-1/+1
2022-12-21Patch for bug #60234Daniel Llorens1-1/+2
See https://debbugs.gnu.org/60234. gcc warns about the extra extern, but we get rid of the tls model mismatch error.
2022-12-20fix Apple Silicon JIT compilationAleix Conchillo Flaqué2-1/+27
* configure.ac: check for pthread_jit_write_protect_np. * libguile/jit.c: add support for Apple Silicon JIT compilation. Fixes https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44505
2022-12-11Doc: document that eq?, eqv? and equal? take any number of argumentsJean Abou Samra1-12/+14
2022-12-10doc: Lee Thomas suggested the name change.Arne Babenhauserheide1-1/+1
See (1994-11-04) https://groups.google.com/g/gnu.misc.discuss/c/0VtEf1fgEJk/m/IMBs2o-ftrgJ > If GEL and GUL and GLUE don't work for the name of the scripting > language, how about: > > GUILE - GNU's Universal Interpreted Language Extension > > (This also implies Scheme-ing, and means that the GNU's Universal > Interpreted Language Developers would be part of a ...) > -- > Lee Thomas and (1994-11-22) https://groups.google.com/g/gnu.misc.discuss/c/9pD9yVoRYFw/m/0z7SLYbx8loJ > Why "GUILE"? (GNU's Universal Interpreted Language Extension) > Two additional reasons: > > 1. It does not give deliberate offense to Dr. Ousterhout or his > supporters, thereby allowing the warring factions to eventually > make peace (along with some others, perhaps - Gloria's 'Usband Is > Linguistically Educated) and get back to work. > 2. By pronunciation it offers appreciation to one of the co-inventors > of Scheme. (Maybe a library package could be named "Scheme User > Supported System Macros And Native-code"? OK, that's a stretch ...) > -- > Lee Thomas, and https://groups.google.com/g/comp.lang.scheme/c/X5GrLVAvGLU/m/Xk11xCrbzCcJ > A while back, I started calling the language being built by the GNU Project > GEL. It turns out that GEL is a trademark of Sybase Inc. Therefore, > we must choose a new name. Please do not refer to the GNU language > as GEL. > > My favorite proposed name, posted recently to comp.lang.scheme, is GUILE. > I like the name, because i think programmers should be encouraged to use > GUILE when writing programs. The name may change yet again; but for now, > please refer to the GNU language as GUILE. > > -t
2022-12-09doc: Fix minor typosColin Woodbury2-2/+2
The spelling mistake is a clear fix, but the Arrays fix might not be as obvious. Previously, with the "arrays" alias, the @ref macro would render a superfluous period after the word "arrays", rendering (at least within Emacs) as: you may wish to use see arrays. instead. Signed-off-by: Mikael Djurfeldt <mikael@djurfeldt.com>
2022-12-01Fix peval bug when expand-primitives introduces lexicalsAndy Wingo2-3/+47
* module/language/tree-il/peval.scm (augment-var-table-with-externally-introduced-lexicals): New helper. * module/language/tree-il/peval.scm (peval): Augment store with any lexicals introduced by expand-primitives. * test-suite/tests/peval.test ("partial evaluation"): Add tests.
2022-12-01Fix order-of-side-effects bug in (eq? x y z) expansionAndy Wingo2-12/+45
* module/language/tree-il/primitives.scm (bind-lexicals): New helper. (expand-eq, expand-chained-comparisons): Ensure all arguments are eagerly evaluated. Previously an intermediate #f result would shortcut the evaluation. * test-suite/tests/compiler.test ("size effects in multi-arg eq / <"): Add test.
2022-11-29Avoid 'frame-local-ref' errors when printing backtrace.Andrew Whatson1-2/+10
Workaround for <https://bugs.gnu.org/57948>. * module/system/vm/frame.scm (frame-call-representation): Treat a binding as "unspecified" if its slot exceeds 'frame-num-locals'.
2022-11-29Add tests for warning locations.Andrew Whatson1-1/+47
These would have caught <https://bugs.gnu.org/56493>. * test-suite/tests/tree-il.test ("warnings")("location")["unused variable", "unbound variable (spaces)", "unbound variable (tabs)"]: New tests.
2022-11-20Fix possible deadlock in 'lock-mutex'.Olivier Dion1-9/+10
If we got interrupted while waiting on our condition variable, we unlock the kernel mutex momentarily while executing asynchronous operations before putting us back into the waiting queue. However, we have to retry acquiring the mutex before getting back into the queue, otherwise it's possible that we wait indefinitely since nobody could be the owner for a while. * libguile/threads.c (lock_mutex): Try acquring the mutex after signal interruption. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-11-20Work around unwanted stack retention when using prompts.Ludovic Courtès1-5/+12
Fixes <https://bugs.gnu.org/59021>. Previously, the stack allocated in 'capture_stack' and stored in 'p->stack_bottom' could be retained, leading to heap growth. * libguile/vm.c (capture_stack): Make a single 'scm_gc_malloc' call instead of two.
2022-11-01doc: Fix typo in VM instruction name.Ludovic Courtès1-2/+2
* doc/ref/vm.texi (Intrinsic Call Instructions): Fix name of 'call-scm<-thread'.
2022-11-01disassembler: Show intrinsic name for 'call-' instructions.Ludovic Courtès2-1/+51
* module/system/vm/disassembler.scm (code-annotation)[intrinsic-name]: New procedure. Add clauses for intrinsics. * NEWS: Update.
2022-10-21Update NEWS.Maxime Devos1-0/+12
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define Scheme bindings to ‘openat’ when available.Maxime Devos6-22/+168
* configure.ac: Detect if ‘openat’ is defined. * libguile/filesys.c (flags_to_mode): Extract from ... (scm_mode): ... here. (scm_open_fdes_at, scm_openat): Define the Scheme bindings. * libguile/filesys.h (scm_open_fdes_at, scm_openat): Make them part of the API. * doc/ref/posix.texi (File System): Document them. * test-suite/tests/filesys.test ("openat"): Test ‘openat’. * libguile/syscalls.h (openat_or_openat64): Decide between ‘openat’ and ‘openat64’. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define a Scheme binding to ‘fstatat’ when available.Maxime Devos6-2/+131
* configure.ac: Detect if ‘fstatat’ is defined. * libguile/filesys.c (scm_statat): Define a Scheme binding to ‘fstatat’. * libguile/filesys.h (scm_statat): Make it part of the C API. * doc/ref/posix.texi (File System): Document it. * libguile/syscalls.h (fstatat_or_fstatat64): Choose between ‘fstatat’ and ‘fstatat64’. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define a Scheme binding to ‘fchownat’ when it exists.Maxime Devos4-2/+49
* configure.ac: Detect whether ‘fchownat’ is available. * libguile/filesys.c (scm_chownat): Define a Scheme binding to ‘fchownat’ when available. * libguile/filesys.h (scm_chownat): Make it part of the API. * doc/ref/posix.texi (File System): Document it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define a Scheme binding to ‘unlinkat’ when it exists.Maxime Devos5-2/+107
‘unlinkat’ is used for both unlinking regular files and removing empty directories. * configure.ac: Detect if ‘unlinkat’ exists. * doc/ref/posix.texi (File System): Document why there is no ‘rmdirat’ procedure, and document the ‘delete-file-at’ procedure. * libguile/filesys.c (scm_rmdir): Adjust the docstring here as well. (scm_delete_file_at): Define a Scheme binding to ‘unlinkat’. * libguile/filesys.h (scm_delete_file_at): Make ‘scm_delete_file_at’ part of the C API. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define a Scheme binding to ‘fchmodat’ when it exists.Maxime Devos4-2/+92
* configure.ac: Detect existence of fchmodat. * libguile/filesys.c (scm_chmodat): New procedure. * libguile/filesys.h (scm_chmodat): Make it part of the API. * test-suite/tests/filesys.test ("chmodat"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define a Scheme binding to ‘renameat’ when it exists.Maxime Devos5-1/+149
* configure.ac: Detect if ‘renameat’ is defined. * libguile/filesys.c (scm_renameat): Define a Scheme binding to the ‘renameat’ system call. * doc/ref/posix.texi (File System): Document it. * libguile/filesys.h (scm_renameat): Make it part of the C API. * test-suite/tests/filesys.test ("rename-file-at"): New tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define AT_REMOVEDIR and others when available.Maxime Devos1-0/+6
* libguile/posix.c (scm_init_posix): Define (in Scheme) AT_REMOVEDIR and AT_EACCESS when defined (in C). Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Correct documentation of ‘mkdir’ w.r.t. the umask.Maxime Devos1-1/+2
* doc/ref/posix.texi (mkdir): Note that the umask is applied even if the mode argument is set. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define bindings to ‘mkdirat’ when the C function exists.Maxime Devos5-1/+71
* configure.ac: Detect if ‘mkdirat’ exists. * libguile/filesys.c (scm_mkdirat): Define the Scheme binding. * doc/ref/posix.texi (File System): Document it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define ‘symlinkat’ wrapper when supported.Maxime Devos5-1/+58
* configure.ac: Detect whether ‘symlinkat’ exists. * libguile/filesys.c (scm_symlinkat): Define a Scheme binding when it exists. * libguile/filesys.h: Make the binding part of the public C API. * doc/ref/posix.texi (File System): Document the binding. * test-suite/tests/filesys.test ("symlinkat"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Allow file ports in ‘utime’.Maxime Devos5-14/+106
Ports representing symbolic links are currently unsupported. * configure.ac: Detect 'futimens'. * doc/ref/posix.texi (utime): Update documentation. * libguile/posix.c (scm_utime): Support ports. * libguile/posix.h (scm_utime): Rename argument. * test-suite/tests/posix.test ("utime"): Add more tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Allow file ports in ‘readlink’.Maxime Devos4-12/+112
* configure.ac: Detect whether ‘readlinkat’ is defined. * libguile/filesys.c (scm_readlink): Support file ports when ‘readlinkat’ exists. (scm_init_filesys): Provide ‘chdir-ports’ when it exists. * doc/ref/posix.texi (File System): Document it. * test-suite/tests/filesys.test ("readlink"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Allow file ports in ‘chdir’ when supported.Maxime Devos5-4/+71
* configure.ac: Check for ‘fchdir’. * libguile/filesys.c (scm_chdir): Support file ports. (scm_init_filesys): Report support of file ports. * doc/ref/posix.texi (Processes): Update accordingly. * doc/ref/guile.texi: Add copyright line for new documentation in this patch and later patches. * test-suite/tests/filesys.test ("chdir"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-15Fixes arg type for scm_integer_from_mpzMichael Gran1-1/+1
The definition and the declaration for scm_integer_from_mpz do not match * libguile/integers.c (scm_integer_from_mpz): takes const mpz_t arg No callers need to be changed.
2022-10-14autoupdate acinclude.m4Michael Gran1-22/+18
Autoconf's autoupdates replaces AC_TRY_CPP, AC_TRY_LINK, AC_LANG_C * acinclude (GUILE_READLINE, GUILE_STRUCT_UTIMBUF, UTIMBUF_NEEDS_POSIX): updated using autoupdate
2022-10-14Presumes signal handler return voidMichael Gran2-18/+7
Since Guile requires a C99 compiler, we can rely on signal handlers returning void, not int. * configure.ac: remove AC_TYPE_SIGNAL * libguile/scmsigs.c (SIGRETTYPE): remove SIGRETTYPE (take_signal): returns void (scm_sigaction_for_thread): presumes handlers return void
2022-10-14Modernizes labels-as-values.m4Michael Gran1-7/+6
labels-as-values.m4 uses deprecated AC_TRY_COMPILE and has a K&R-type C function declaration * m4/labels-as-values.m4: updated
2022-10-14Remove special logic for the obscure CMU C library's libc.hMike Gran4-56/+1
* acinclude.m4 (GUILE_HEADER_LIBC_WITH_UNISTD): removed * configure.ac: remove GUILE_HEADER_LIBC_WITH_UNISTD, don't check for libc.h * libguile/filesys.c [LIBC_H_WITH_UNISTD_H]: remove libc.h inclusion * libguile/posix.c [LIBC_H_WITH_UNISTD_H]: remove libc.h inclusion
2022-10-14Presume time.h and sys/time.h don't conflict when includedMike Gran3-25/+5
Systems on which time.h and sys/time.h conflicted are obsolescent. * configure.ac: remove AC_HEADER_TIME. remove conditional in tm.tm_gmtoff test. * libguile/filesys.c [TIME_WITH_SYS_TIME]: remove conditional * libguile/posix.c [TIME_WITH_SYS_TIME]: remove conditional # Conflicts: # libguile/filesys.c
2022-10-14Presume ISO C90 functions are always availableMike Gran4-21/+5
* configure.ac: don't check for rename, setlocale, system, memcpy, and strcoll * libguile/i18n.c [HAVE_SETLOCALE] (setlocale): remove static setlocale Don't use HAVE_SETLOCALE * libguile/posix.c: include <locale.h>, remove HAVE_SETLOCALE (scm_setlocale): always include. remove HAVE_SETLOCALE * libguile/simpos.c (scm_system): always include. remove HAVE_SYSTEM