]> git.donarmstrong.com Git - lilypond.git/commitdiff
''
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 22 Jun 2002 12:53:52 +0000 (12:53 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 22 Jun 2002 12:53:52 +0000 (12:53 +0000)
lily/grob.cc
lily/lily-guile.cc
lily/score.cc

index d8e4dbf438c84282070dd94b1d428a39d068554c..eb42b0c4973cd6246a3d7c149a6bfc6c41e6a7e1 100644 (file)
@@ -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;
index 41700559247079820e498a62f8a8c4c4379b101b..e5595530cef7cbf946e13a0ca716442d2ef4d6a4 100644 (file)
@@ -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;
+}
index d8887be29f72d0c1a78cef1bc488dedf4a37eebb..b66a3ca34c509aada6f8c20f4a40ce8f2cea1aec 100644 (file)
@@ -6,6 +6,8 @@
   (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
+#include <stdio.h>
+
 #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 <sys/resource.h>
+#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);