mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 22:31:12 +02:00
* * 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!)
This commit is contained in:
parent
bc6b266af0
commit
e3c37929e0
1 changed files with 54 additions and 16 deletions
|
@ -231,8 +231,6 @@ display_frame_expr (hdr, exp, tlr, indentation, sport, port, pstate)
|
||||||
SCM port;
|
SCM port;
|
||||||
scm_print_state *pstate;
|
scm_print_state *pstate;
|
||||||
{
|
{
|
||||||
pstate->level = 2;
|
|
||||||
pstate->length = 3;
|
|
||||||
if (SCM_NIMP (exp) && SCM_CONSP (exp))
|
if (SCM_NIMP (exp) && SCM_CONSP (exp))
|
||||||
{
|
{
|
||||||
scm_iprlist (hdr, exp, tlr[0], port, pstate);
|
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);
|
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 SCM_P ((SCM frame, int nfield, int indentation, SCM sport, SCM port, scm_print_state *pstate));
|
||||||
static void
|
static void
|
||||||
display_frame (frame, nfield, indentation, sport, port, pstate)
|
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))
|
if (SCM_FRAME_PROC_P (frame))
|
||||||
/* Display an application. */
|
/* Display an application. */
|
||||||
{
|
display_application (frame, nfield + 1 + indentation, sport, port, 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) ? " ..." : "]",
|
|
||||||
nfield + 1 + indentation,
|
|
||||||
sport,
|
|
||||||
port,
|
|
||||||
pstate);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
/* Display a special form. */
|
/* Display a special form. */
|
||||||
{
|
{
|
||||||
|
@ -382,6 +418,8 @@ scm_display_backtrace (stack, port, first, depth)
|
||||||
pstate = SCM_PRINT_STATE (print_state);
|
pstate = SCM_PRINT_STATE (print_state);
|
||||||
pstate->writingp = 1;
|
pstate->writingp = 1;
|
||||||
pstate->fancyp = 1;
|
pstate->fancyp = 1;
|
||||||
|
pstate->level = 2;
|
||||||
|
pstate->length = 3;
|
||||||
|
|
||||||
/* First find out if it's reasonable to do indentation. */
|
/* First find out if it's reasonable to do indentation. */
|
||||||
if (SCM_BACKWARDS_P)
|
if (SCM_BACKWARDS_P)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue