From cbe377fddae9700d850ecf1be0277f73288a9d87 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sat, 22 Jun 2002 12:53:52 +0000 Subject: [PATCH] '' --- lily/grob.cc | 14 ++++++-------- lily/lily-guile.cc | 18 ++++++++++++++++++ lily/score.cc | 32 +++++++++++++++++++++++++------- 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/lily/grob.cc b/lily/grob.cc index d8e4dbf438..eb42b0c497 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -394,8 +394,8 @@ SCM do_break_substitution (SCM src) { again: - Grob *sc = unsmob_grob (src); - if (sc) + + if (Grob *sc = unsmob_grob (src)) { if (SCM_INUMP (break_criterion)) { @@ -441,13 +441,12 @@ do_break_substitution (SCM src) return SCM_UNDEFINED; } } - else if (ly_pair_p (src)) // SCM_CONSP (src)) // huh? + else if (ly_pair_p (src)) { - SCM oldcar =ly_car (src); /* UGH! breaks on circular lists. */ - SCM newcar = do_break_substitution (oldcar); + SCM newcar = do_break_substitution (ly_car (src)); SCM oldcdr = ly_cdr (src); if (newcar == SCM_UNDEFINED @@ -456,7 +455,7 @@ do_break_substitution (SCM src) /* This is tail-recursion, ie. - return do_break_substution (cdr, break_criterion); + return do_break_substution (cdr); We don't want to rely on the compiler to do this. Without tail-recursion, this easily crashes with a stack overflow. */ @@ -464,8 +463,7 @@ do_break_substitution (SCM src) goto again; } - SCM newcdr = do_break_substitution (oldcdr); - return scm_cons (newcar, newcdr); + return scm_cons (newcar, do_break_substitution (oldcdr)); } else return src; diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 4170055924..e5595530ce 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -768,3 +768,21 @@ taint (SCM * foo) nop. */ } + +/* + display stuff without using stack + */ +SCM +display_list (SCM s) +{ + SCM p = scm_current_output_port(); + + scm_puts ("(", p); + for (; gh_pair_p(s); s =gh_cdr(s)) + { + scm_display (gh_car(s), p); + scm_puts (" ", p); + } + scm_puts (")", p); + return SCM_UNSPECIFIED; +} diff --git a/lily/score.cc b/lily/score.cc index d8887be29f..b66a3ca34c 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -6,6 +6,8 @@ (c) 1997--2002 Han-Wen Nienhuys */ +#include + #include "ly-smobs.icc" #include "score.hh" @@ -24,7 +26,6 @@ /* TODO: junkme. */ - Score::Score () : Input () { @@ -68,20 +69,38 @@ Score::~Score () } + +/* + should enable this to find weird mistakes? +*/ +#define PARANOIA + +#ifdef PARANOIA +#include +#endif + void Score::run_translator (Music_output_def *odef_l) { + + +#ifdef PARANOIA + if (verbose_global_b) + { + struct rlimit rls; + + getrlimit (RLIMIT_STACK, &rls); + progress_indication (_f("stack size cur %d, max %d\n" ,rls.rlim_cur, rls.rlim_max)); + } +#endif + /* We want to know if we want to store locations, since they take a lot of overhead. - - */ + */ store_locations_global_b = (gh_eval_str ("point-and-click") != SCM_BOOL_F); - Cpu_timer timer; - - Global_translator * trans_p = odef_l->get_global_translator_p (); if (!trans_p) { @@ -93,7 +112,6 @@ Score::run_translator (Music_output_def *odef_l) trans_p->final_mom_ = music->length_mom (); - Music_iterator * iter = Music_iterator::static_get_iterator_p (music); iter->init_translator (music, trans_p); -- 2.39.5