1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-06 07:30:28 +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:
Andy Wingo 2008-09-13 13:14:45 +02:00
parent e6fea61823
commit 0ba8bb7143
2 changed files with 8 additions and 2 deletions

View file

@ -129,15 +129,19 @@ program_apply (SCM program, SCM args)
static int
program_print (SCM program, SCM port, scm_print_state *pstate)
{
static int print_error = 0;
if (SCM_FALSEP (write_program))
write_program = scm_module_local_variable
(scm_c_resolve_module ("system vm program"),
scm_from_locale_symbol ("write-program"));
if (SCM_FALSEP (write_program))
if (SCM_FALSEP (write_program) || print_error)
return scm_smob_print (program, port, pstate);
print_error = 1;
scm_call_2 (SCM_VARIABLE_REF (write_program), program, port);
print_error = 0;
return 1;
}