[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 07/08: Second argument of ‘unread-string’ is optional.
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] 07/08: Second argument of ‘unread-string’ is optional. |
Date: |
Mon, 6 May 2024 05:59:20 -0400 (EDT) |
civodul pushed a commit to branch main
in repository guile.
commit a222503a89a0ed81cdea49c13fb4f582b8924447
Author: Juliana Sims <juli@incana.org>
AuthorDate: Fri Nov 10 23:25:56 2023 -0500
Second argument of ‘unread-string’ is optional.
Fixes <https://bugs.gnu.org/67063>.
* doc/ref/api-io.texi (Venerable Port Interfaces): Bring unread-string
procedure documentation in line with other procedures in the section.
* libguile/ports.c (scm_unread_string): Make port argument optional.
* test-suite/tests/ports.test: Test unread-char and unread-string
without ports.
* NEWS: Update.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
NEWS | 2 ++
doc/ref/api-io.texi | 2 +-
libguile/ports.c | 2 +-
test-suite/tests/ports.test | 6 +++---
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index 8a61bf65d..3c4854ca9 100644
--- a/NEWS
+++ b/NEWS
@@ -59,6 +59,8 @@ files. See "Random Access" in the manual for details.
(<https://bugs.gnu.org/55356>)
** 'read-u8' in (scheme base) now defaults to (current-input-port)
(<https://bugs.gnu.org/62690>)
+** Second argument of 'unread-string' is now optional, as previously documented
+ (<https://bugs.gnu.org/67063>)
** 'ftw' now correctly deals with directory permissions
(<https://bugs.gnu.org/55344>)
** 'make-custom-port' now honors its #:conversion-strategy argument
diff --git a/doc/ref/api-io.texi b/doc/ref/api-io.texi
index d0076bf68..79bc9e9d6 100644
--- a/doc/ref/api-io.texi
+++ b/doc/ref/api-io.texi
@@ -2000,7 +2000,7 @@ The same as @code{unget-char}, except that @var{port}
defaults to the
current input port, and the arguments are swapped. @xref{Textual I/O}.
@end deffn
-@deffn {Scheme Procedure} unread-string str port
+@deffn {Scheme Procedure} unread-string str [port]
@deffnx {C Function} scm_unread_string (str, port)
The same as @code{unget-string}, except that @var{port} defaults to the
current input port, and the arguments are swapped. @xref{Textual I/O}.
diff --git a/libguile/ports.c b/libguile/ports.c
index d3f763400..d0e4e0c7f 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -2228,7 +2228,7 @@ SCM_DEFINE (scm_unread_char, "unread-char", 1, 1, 0,
}
#undef FUNC_NAME
-SCM_DEFINE (scm_unread_string, "unread-string", 2, 0, 0,
+SCM_DEFINE (scm_unread_string, "unread-string", 1, 1, 0,
(SCM str, SCM port),
"Place the string @var{str} in @var{port} so that its characters
will be\n"
"read in subsequent read operations. If called multiple times,
the\n"
diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test
index 27acf13b4..7b5b535e7 100644
--- a/test-suite/tests/ports.test
+++ b/test-suite/tests/ports.test
@@ -636,13 +636,13 @@
(with-input-from-string "walk on the moon\nmoon"
(lambda ()
(read-char)
- (unread-char #\a (current-input-port))
+ (unread-char #\a)
(pass-if "unread-char"
(char=? (read-char) #\a))
(read-line)
(let ((replacenoid "chicken enchilada"))
- (unread-char #\newline (current-input-port))
- (unread-string replacenoid (current-input-port))
+ (unread-char #\newline)
+ (unread-string replacenoid)
(pass-if "unread-string"
(string=? (read-line) replacenoid)))
(pass-if "unread residue"
- [Guile-commits] branch main updated (3b76a30e3 -> f36342f9a), Ludovic Courtès, 2024/05/06
- [Guile-commits] 01/08: ‘system*’ no longer changes SIGINT and SIGQUIT handlers., Ludovic Courtès, 2024/05/06
- [Guile-commits] 02/08: Update NEWS., Ludovic Courtès, 2024/05/06
- [Guile-commits] 05/08: build: Fix cross-compilation in out-of-tree-builds, Ludovic Courtès, 2024/05/06
- [Guile-commits] 03/08: Fix typos throughout codebase., Ludovic Courtès, 2024/05/06
- [Guile-commits] 04/08: build: Make sed invocation fully portable, Ludovic Courtès, 2024/05/06
- [Guile-commits] 06/08: Fix error messages containing format strings, Ludovic Courtès, 2024/05/06
- [Guile-commits] 07/08: Second argument of ‘unread-string’ is optional.,
Ludovic Courtès <=
- [Guile-commits] 08/08: guix: Use non-deprecated package name., Ludovic Courtès, 2024/05/06