X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fbreak-substitution.cc;h=f6db741483a455caebdb3ee9191d741fa1f5b542;hb=59a6d1a06432fc0ca88c3023c646182f389ec1b5;hp=75053c34fd00ebe243eb32d23ece6b987b201c17;hpb=9e781b7dc83b60a543ce218aa1a5f139f74c760f;p=lilypond.git diff --git a/lily/break-substitution.cc b/lily/break-substitution.cc index 75053c34fd..f6db741483 100644 --- a/lily/break-substitution.cc +++ b/lily/break-substitution.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 2001--2014 Han-Wen Nienhuys + Copyright (C) 2001--2015 Han-Wen Nienhuys LilyPond is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,12 +19,13 @@ #include #include -using namespace std; #include "item.hh" #include "system.hh" #include "grob-array.hh" +using std::vector; + static SCM break_criterion; void set_break_subsititution (SCM criterion) @@ -51,7 +52,7 @@ substitute_grob (Grob *sc) else { System *line - = dynamic_cast (unsmob_grob (break_criterion)); + = unsmob (break_criterion); if (sc->get_system () != line) sc = sc->find_broken_piece (line); @@ -101,9 +102,9 @@ do_break_substitution (SCM src) { again: - if (unsmob_grob (src)) + if (unsmob (src)) { - Grob *new_ptr = substitute_grob (unsmob_grob (src)); + Grob *new_ptr = substitute_grob (unsmob (src)); return new_ptr ? new_ptr->self_scm () : SCM_UNDEFINED; } else if (scm_is_vector (src)) @@ -125,8 +126,8 @@ again: SCM newcar = do_break_substitution (scm_car (src)); SCM oldcdr = scm_cdr (src); - if (newcar == SCM_UNDEFINED - && (scm_is_pair (oldcdr) || oldcdr == SCM_EOL)) + if (SCM_UNBNDP (newcar) + && (scm_is_pair (oldcdr) || scm_is_null (oldcdr))) { /* This is tail-recursion, ie. @@ -408,13 +409,13 @@ Spanner::fast_substitute_grob_array (SCM sym, set_break_subsititution (l ? l->self_scm () : SCM_UNDEFINED); SCM newval = sc->internal_get_object (sym); - if (!unsmob_grob_array (newval)) + if (!unsmob (newval)) { newval = Grob_array::make_array (); sc->set_object (sym, newval); } - Grob_array *new_array = unsmob_grob_array (newval); + Grob_array *new_array = unsmob (newval); for (int k = 0; k < 2; k++) for (int j = (*arrs[k])[i][LEFT]; j <= (*arrs[k])[i][RIGHT]; j++) { @@ -461,7 +462,7 @@ substitute_object_alist (SCM alist, SCM dest) SCM sym = scm_caar (s); SCM val = scm_cdar (s); - if (Grob_array *orig = unsmob_grob_array (val)) + if (Grob_array *orig = unsmob (val)) { SCM handle = scm_assq (sym, dest); SCM newval @@ -469,7 +470,7 @@ substitute_object_alist (SCM alist, SCM dest) ? scm_cdr (handle) : Grob_array::make_array (); - Grob_array *new_arr = unsmob_grob_array (newval); + Grob_array *new_arr = unsmob (newval); substitute_grob_array (orig, new_arr); val = newval; @@ -477,7 +478,7 @@ substitute_object_alist (SCM alist, SCM dest) else val = do_break_substitution (val); - if (val != SCM_UNDEFINED) + if (!SCM_UNBNDP (val)) { /* for ly:grob? properties, SCM_UNDEFINED could leak out @@ -497,7 +498,7 @@ Spanner::substitute_one_mutable_property (SCM sym, Spanner *s = this; bool fast_done = false; - Grob_array *grob_array = unsmob_grob_array (val); + Grob_array *grob_array = unsmob (val); if (grob_array) fast_done = s->fast_substitute_grob_array (sym, grob_array); @@ -511,12 +512,12 @@ Spanner::substitute_one_mutable_property (SCM sym, if (grob_array) { SCM newval = sc->internal_get_object (sym); - if (!unsmob_grob_array (newval)) + if (!unsmob (newval)) { newval = Grob_array::make_array (); sc->set_object (sym, newval); } - substitute_grob_array (grob_array, unsmob_grob_array (newval)); + substitute_grob_array (grob_array, unsmob (newval)); } else {