diff options
author | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 1997-03-07 21:42:32 +0000 |
---|---|---|
committer | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 1997-03-07 21:42:32 +0000 |
commit | e3c37929e09fb2e73f54fefd64193e8e1d175163 (patch) | |
tree | b691a02166a21608cc5a1690916d2a66994c910b | |
parent | bc6b266af003f6985f112b218dfff17ab916ce44 (diff) | |
download | guile-e3c37929e09fb2e73f54fefd64193e8e1d175163.tar.gz |
* * backtrace.c (scm_display_application): New procedure:
display-application; Set fancy printing parameters individually
for different types of display (backtrace, error, application).
(These should of course be customizable!)
-rw-r--r-- | libguile/backtrace.c | 70 |
1 files changed, 54 insertions, 16 deletions
diff --git a/libguile/backtrace.c b/libguile/backtrace.c index aec7c1622..6451775d4 100644 --- a/libguile/backtrace.c +++ b/libguile/backtrace.c @@ -231,8 +231,6 @@ display_frame_expr (hdr, exp, tlr, indentation, sport, port, pstate) SCM port; scm_print_state *pstate; { - pstate->level = 2; - pstate->length = 3; if (SCM_NIMP (exp) && SCM_CONSP (exp)) { scm_iprlist (hdr, exp, tlr[0], port, pstate); @@ -243,6 +241,57 @@ display_frame_expr (hdr, exp, tlr, indentation, sport, port, pstate) scm_gen_putc ('\n', port); } +static void display_application SCM_P ((SCM frame, int indentation, SCM sport, SCM port, scm_print_state *pstate)); +static void +display_application (frame, indentation, sport, port, pstate) + SCM frame; + int indentation; + SCM sport; + SCM port; + scm_print_state *pstate; +{ + SCM proc = SCM_FRAME_PROC (frame); + SCM name = (SCM_NFALSEP (scm_procedure_p (proc)) + ? scm_procedure_name (proc) + : SCM_BOOL_F); + display_frame_expr ("[", + scm_cons (SCM_NFALSEP (name) ? name : proc, + SCM_FRAME_ARGS (frame)), + SCM_FRAME_EVAL_ARGS_P (frame) ? " ..." : "]", + indentation, + sport, + port, + pstate); +} + +SCM_PROC(s_display_application, "display-application", 1, 1, 0, scm_display_application); + +SCM +scm_display_application (SCM frame, SCM port) +{ + if (SCM_UNBNDP (port)) + port = scm_cur_outp; + if (SCM_FRAME_PROC_P (frame)) + /* Display an application. */ + { + SCM print_state; + scm_print_state *pstate; + + /* Create a print state for printing of frames. */ + print_state = scm_make_print_state (); + pstate = SCM_PRINT_STATE (print_state); + pstate->writingp = 1; + pstate->fancyp = 1; + pstate->level = 2; + pstate->length = 9; + + display_application (frame, 0, SCM_BOOL_F, port, pstate); /*fixme*/ + return SCM_BOOL_T; + } + else + return SCM_BOOL_F; +} + static void display_frame SCM_P ((SCM frame, int nfield, int indentation, SCM sport, SCM port, scm_print_state *pstate)); static void display_frame (frame, nfield, indentation, sport, port, pstate) @@ -280,20 +329,7 @@ display_frame (frame, nfield, indentation, sport, port, pstate) if (SCM_FRAME_PROC_P (frame)) /* Display an application. */ - { - SCM proc = SCM_FRAME_PROC (frame); - SCM name = (SCM_NFALSEP (scm_procedure_p (proc)) - ? scm_procedure_name (proc) - : SCM_BOOL_F); - display_frame_expr ("[", - scm_cons (SCM_NFALSEP (name) ? name : proc, - SCM_FRAME_ARGS (frame)), - SCM_FRAME_EVAL_ARGS_P (frame) ? " ..." : "]", - nfield + 1 + indentation, - sport, - port, - pstate); - } + display_application (frame, nfield + 1 + indentation, sport, port, pstate); else /* Display a special form. */ { @@ -382,6 +418,8 @@ scm_display_backtrace (stack, port, first, depth) pstate = SCM_PRINT_STATE (print_state); pstate->writingp = 1; pstate->fancyp = 1; + pstate->level = 2; + pstate->length = 3; /* First find out if it's reasonable to do indentation. */ if (SCM_BACKWARDS_P) |