bug#71684: [PATCH v2] Add peek-error, pke.

2024-10-28 Thread janneke
Janneke Nieuwenhuizen writes:

With #71684 merged, this needs an update.  New in this version:
* document it!

Greetings,
Janneke

>From c0a856ac60a672db53d3ab7df8098a323fbb999a Mon Sep 17 00:00:00 2001
From: Janneke Nieuwenhuizen 
Date: Fri, 3 Mar 2023 11:26:34 +0100
Subject: [PATCH v2] Add peek-error, pke.
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8

Debuging using `pk' is popular in Guile, but not really usable if the
program is as (pseudo-)filter, i.e., writing its output to stdout.

* module/ice-9/boot-9.scm (peek-error, pke): New procedures.
* doc/ref/api-debug.texi (Simple Debugging): Document them.
---
 doc/ref/api-debug.texi  | 13 ++---
 module/ice-9/boot-9.scm | 10 ++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/doc/ref/api-debug.texi b/doc/ref/api-debug.texi
index ca5175b35c..35092fbdaf 100644
--- a/doc/ref/api-debug.texi
+++ b/doc/ref/api-debug.texi
@@ -34,9 +34,10 @@ covered in the rest of this section and elsewhere in this manual
 (@pxref{Interactive Debugging}).  Here we deal with a more primitive
 approach, commonly called ``print debugging,'' which is a quick way to
 diagnose simple errors by printing values during a program's execution.
-Guile provides the @code{peek} procedure, more commonly known as
-@code{pk} (pronounced by naming the letters), as a convenient and
-powerful tool for this kind of debugging.
+Guile provides the @code{peek} and @code{peek-error} procedures, more
+commonly known as @code{pk} and @code{pke} respectively (pronounced by
+naming the letters), as a convenient and powerful tool for this kind of
+debugging.
 
 @deffn {Scheme Procedure} peek stuff @dots{}
 @deffnx {Scheme Procedure} pk stuff @dots{}
@@ -44,6 +45,12 @@ Print @var{stuff} to the current output port using @code{write}.  Return
 the last argument.
 @end deffn
 
+@deffn {Scheme Procedure} peek-error stuff @dots{}
+@deffnx {Scheme Procedure} pke stuff @dots{}
+Print @var{stuff} to the current error port using @code{write}.  Return
+the last argument.
+@end deffn
+
 @code{pk} improves on using @code{write} directly because it enables
 inspection of the state of code as it runs without breaking the normal
 code flow.  It is also sometimes more practical than a full debugger
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 04f84215c9..4b611f6a9d 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -183,6 +183,16 @@ This is handy for tracing function calls, e.g.:
 
 (define pk peek)
 
+(define (peek-error . stuff)
+  "Like PEEK (PK), writing to (CURRENT-ERROR-PORT)."
+  (newline (current-error-port))
+  (display " " (current-error-port))
+  (write stuff (current-error-port))
+  (newline (current-error-port))
+  (car (last-pair stuff)))
+
+(define pke peek-error)
+
 (define (warn . stuff)
   (newline (current-warning-port))
   (display ";;; WARNING " (current-warning-port))
-- 
Janneke Nieuwenhuizen   | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com


-- 
Janneke Nieuwenhuizen   | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com


bug#64723: [PATCH] Improve DLL search strategy for load-foreign-library

2023-09-08 Thread Janneke Nieuwenhuizen
Mike Gran via Bug reports for GUILE, GNU's Ubiquitous Extension Language writes:

Hello Mike,

>> 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.
>
> Hi All-
>
> This is the first of a dozen patches to make Win32 minimally viable
> again. This patch specifically removes a regression introduced in 3.0.6
> described above.
>
> If I hear no objection, I'm going to rebase and push
> in a week or two.

Very much appreciated!

Greetings,
Janneke

-- 
Janneke Nieuwenhuizen   | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com





bug#71684: [PATCH v3] doc: Document the peek and pk procedures.

2024-10-14 Thread Janneke Nieuwenhuizen
Juliana Sims via Bug reports for GUILE, GNU's Ubiquitous Extension Language 
writes:

> * doc/ref/api-debug.texi: Document the peek and pk procedures.
> ---
>
> Hey y'all,
>
> Thanks for the feedback!  I've incorporated both suggestions in this new 
> patch.
[..]

> +@lisp
> +(define fire 'burns)
> +
> +(pk fire)
> +@result{}
> +
> +;;; (burns)
> +burns
> +@end

These should read
@end lisp

--8<---cut here---start->8---
diff --git a/doc/ref/api-debug.texi b/doc/ref/api-debug.texi
index df109d390..ca5175b35 100644
--- a/doc/ref/api-debug.texi
+++ b/doc/ref/api-debug.texi
@@ -58,7 +58,7 @@ Here is a basic example:
 
 ;;; (burns)
 burns
-@end
+@end lisp
 
 Here is an example of inspecting a value in the midst of code flow:
 
@@ -74,7 +74,7 @@ Here is an example of inspecting a value in the midst of code 
flow:
 
 ;;; ("4")
 ("1" "2" "3" "4")
-@end
+@end lisp
 
 A common technique when using @code{pk} is to label values with symbols
 to keep track of where they're coming from.  There's no reason these
@@ -90,7 +90,7 @@ slightly more complex example demonstrating that pattern:
 
 ;;; (arg-to-identity 42)
 42
-@end
+@end lisp
 
 @code{pk} has one small quirk of note.  Currently, it only returns the
 first value returned from any multi-value returns.  So for example:
@@ -101,7 +101,7 @@ first value returned from any multi-value returns.  So for 
example:
 
 ;;; (vals 1)
 1
-@end
+@end lisp
 
 The way to get around this limitation is to bind such multi-value
 returns then inspect the results.  Still, @code{pk} can only return a
@@ -117,7 +117,7 @@ single value:
 
 ;;; (vals 1 2 3)
 3
-@end
+@end lisp
 
 
 @node Evaluation Model
--8<---cut here---end--->8---

Greetings,
Janneke

-- 
Janneke Nieuwenhuizen   | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com





bug#41716: [PATCH] reader: Use invalid rather than illegal.

2020-06-04 Thread Jan (janneke) Nieuwenhuizen
* libguile/read.c (scm_read_string_like_syntax): All characters are
permitted by law; some aren't valid in certain contexts.
---
 libguile/read.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libguile/read.c b/libguile/read.c
index 040a178348..122a643018 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -704,7 +704,7 @@ scm_read_string_like_syntax (int chr, SCM port, 
scm_t_read_opts *opts)
 break;
 bad_escaped:
   scm_i_input_error (FUNC_NAME, port,
- "illegal character in escape sequence: ~S",
+ "invalid character in escape sequence: ~S",
  scm_list_1 (SCM_MAKE_CHAR (c)));
 }
 }
-- 
2.26.2






bug#43814: [PATCH] Document write-line.

2020-10-05 Thread Jan (janneke) Nieuwenhuizen
* libguile/rdelim.c (SCM_DEFINE): Use "procedure" rather than
"function".
* doc/ref/api-io.texi (Line/Delimited): Use it to document 'write-line'.
---
 doc/ref/api-io.texi | 11 +++
 libguile/rdelim.c   |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/ref/api-io.texi b/doc/ref/api-io.texi
index ecbd35585a..a1781dfd6a 100644
--- a/doc/ref/api-io.texi
+++ b/doc/ref/api-io.texi
@@ -829,6 +829,17 @@ delimiter may be either a newline or the @var{eof-object}; 
if
 @code{(# . #)}.
 @end deffn
 
+@deffn {Scheme Procedure} write-line obj [port]
+@deffnx {C Function} scm_write_line (obj, port)
+Display @var{obj} and a newline character to @var{port}.  If
+@var{port} is not specified, @code{(current-output-port)} is
+used.  This procedure is equivalent to:
+@lisp
+(display obj [port])
+(newline [port])
+@end lisp
+@end deffn
+
 @node Default Ports
 @subsection Default Ports for Input, Output and Errors
 @cindex Default ports
diff --git a/libguile/rdelim.c b/libguile/rdelim.c
index 4a0b20954e..9d41712dd1 100644
--- a/libguile/rdelim.c
+++ b/libguile/rdelim.c
@@ -189,7 +189,7 @@ SCM_DEFINE (scm_write_line, "write-line", 1, 1, 0,
 (SCM obj, SCM port),
"Display @var{obj} and a newline character to @var{port}.  If\n"
"@var{port} is not specified, @code{(current-output-port)} is\n"
-   "used.  This function is equivalent to:\n"
+   "used.  This procedure is equivalent to:\n"
"@lisp\n"
"(display obj [port])\n"
"(newline [port])\n"
-- 
Jan Nieuwenhuizen  | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com