mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-15 16:20:17 +02:00
tweaks for printing programs
* module/system/vm/program.scm (program-bindings-as-lambda-list): Handle the bindings-is-null case too -- not sure how it comes about, though. A thunk with no let, perhaps. (write-program): Another default for the name: the source location at which it was defined. * libguile/programs.c (program_print): Add some "logic" to stop doing detailed prints if one print had a nonlocal exit -- preventing exceptions in backtraces.
This commit is contained in:
parent
e6fea61823
commit
0ba8bb7143
2 changed files with 8 additions and 2 deletions
|
@ -82,7 +82,7 @@
|
|||
(let ((bindings (program-bindings prog))
|
||||
(nargs (arity:nargs (program-arity prog)))
|
||||
(rest? (not (zero? (arity:nrest (program-arity prog))))))
|
||||
(if (not bindings)
|
||||
(if (or (null? bindings) (not bindings))
|
||||
(if rest? (cons (1- nargs) 1) (list nargs))
|
||||
(let ((arg-names (map binding:name (cdar bindings))))
|
||||
(if rest?
|
||||
|
@ -92,5 +92,7 @@
|
|||
(define (write-program prog port)
|
||||
(format port "#<program ~a ~a>"
|
||||
(or (program-name prog)
|
||||
(let ((s (program-sources prog)))
|
||||
(and (not (null? s)) (cdar s)))
|
||||
(number->string (object-address prog) 16))
|
||||
(program-bindings-as-lambda-list prog)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue