]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/paper-outputter.cc
release: 1.3.22
[lilypond.git] / lily / paper-outputter.cc
index fd53025c2c64b6e151d3e8e062fffc102ffac237..7c14708d7f28634f834ea68d72f26f70c963f002 100644 (file)
@@ -3,12 +3,13 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 #include <time.h>
 #include <fstream.h>
+#include <math.h>
 
 #include "dimensions.hh"
 #include "dictionary-iter.hh"
@@ -38,7 +39,7 @@ Paper_outputter::output_header ()
 {
   if (safe_global_b)
     {
-      //      ly_set_x ("security-paranoia", SCM_BOOL_T);
+
       gh_define ("security-paranoia", SCM_BOOL_T);      
     }
   String s = String ("(eval (") + output_global_ch + "-scm 'all-definitions))";
@@ -78,9 +79,9 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm)
       output_comment (nm);
     }
       
-  for (Cons<Atom> *ptr = m->atom_list_; ptr; ptr = ptr->next_)
+  for (SCM ptr = gh_cdr (m->atom_list_); ptr != SCM_EOL; ptr = gh_cdr (ptr))
     {
-      Atom * i = ptr->car_;
+      Atom * i = unsmob_atom (gh_car (ptr));
 
       Offset a_off = i->off_;
       a_off += o;
@@ -88,18 +89,19 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm)
       if (!i->func_)
        continue; 
 
-      if (a_off.length () > 100 CM)
+      Axis a = X_AXIS;
+      while (a < NO_AXES)
        {
-         programming_error ("improbable offset for object");
-         Axis a  =X_AXIS;
-         while (a < NO_AXES)
+         if (abs(a_off[a]) > 30 CM
+             || isinf (a_off[a]) || isnan (a_off[a]))
            {
-             if (abs(a_off[a]) > 30 CM)
-               a_off[a] = 30 CM;
-             incr (a);
+             programming_error ("Improbable offset for object: setting to zero");
+             a_off[a] =  0.0;
            }
+         incr (a);
        }
-       
+
+       
       SCM box_scm
        = gh_list (ly_symbol2scm ("placebox"),
                   gh_double2scm (a_off[X_AXIS]),