]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parser.yy
* lily/include/lily-guile.hh: rename ly_c_X_p -> ly_is_X
[lilypond.git] / lily / parser.yy
index 8d1cbb643ba4bf6aeba47cc508c7dbd96a495729..78d54517a3682916b08ce276dc75a936fa040c69 100644 (file)
@@ -41,9 +41,9 @@ FIXME:
 #include "paper-book.hh"
 #include "output-def.hh"
 #include "scm-hash.hh"
-#include "scm-option.hh"
+#include "program-option.hh"
 #include "score.hh"
-#include "text-item.hh"
+#include "text-interface.hh"
 #include "warn.hh"
 
 #define MY_MAKE_MUSIC(x)  make_music_by_name (ly_symbol2scm (x))
@@ -84,7 +84,7 @@ tag_music (Music *m, SCM tag, Input ip)
        SCM tags = m->get_property ("tags");
        if (scm_is_symbol (tag))
                tags = scm_cons (tag, tags);
-       else if (ly_c_list_p (tag))
+       else if (ly_is_list (tag))
                tags = ly_append2 (tag, tags);
        else
                ip.warning (_ ("tag must be symbol or list of symbols"));
@@ -171,8 +171,8 @@ make_chord (SCM pitch, SCM dur, SCM modification_list)
 bool
 ly_input_procedure_p (SCM x)
 {
-       return ly_c_procedure_p (x)
-               || (scm_is_pair (x) && ly_c_procedure_p (scm_car (x)));
+       return ly_is_procedure (x)
+               || (scm_is_pair (x) && ly_is_procedure (scm_car (x)));
 }
 
 Music*
@@ -787,22 +787,24 @@ score_block:
        ;
 
 score_body:
-       /**/    {
-               $$ = new Score;
+       Music {
+               SCM m = $1->self_scm ();
+               scm_gc_unprotect_object (m);
+               SCM scorify = ly_lily_module_constant ("scorify-music");
+               SCM score = scm_call_2 (scorify, m, THIS->self_scm ());
+
+               // pass ownernship to C++ again. 
+               scm_gc_protect_object (score);
+               $$ = unsmob_score (score);
                $$->set_spot (@$);
        }
        | SCORE_IDENTIFIER {
-               $$ = new Score ( *unsmob_score ($1));
+               $$ = unsmob_score ($1);
                $$->set_spot (@$);
        }
        | score_body object_id_setting {
                $$->user_key_ = ly_scm2string ($2);
        }
-       | score_body Music {
-               SCM m = $2->self_scm ();
-               scm_gc_unprotect_object (m);
-               $$->set_music (m, THIS->self_scm ());
-       }
        | score_body lilypond_header    {
                $$->header_ = $2;
        }
@@ -994,10 +996,10 @@ Repeated_music:
                        r-> set_property ("element", beg->self_scm ());
                        scm_gc_unprotect_object (beg->self_scm ());
                        }
-               r->set_property ("repeat-count", scm_int2num (times >? 1));
+               r->set_property ("repeat-count", scm_int2num (max (times, 1)));
 
                r-> set_property ("elements",alts);
-               if (ly_c_equal_p ($2, scm_makfrom0str ("tremolo"))) {
+               if (ly_is_equal ($2, scm_makfrom0str ("tremolo"))) {
                        /*
                        TODO: move this code to Scheme.
                        */
@@ -2097,14 +2099,10 @@ optional_notemode_duration:
        {
                Duration dd = THIS->default_duration_;
                $$ = dd.smobbed_copy ();
-
-               THIS->beam_check ($$);
        }
        | multiplied_duration   {
                $$ = $1;
                THIS->default_duration_ = *unsmob_duration ($$);
-
-               THIS->beam_check ($$);
        }
        ;
 
@@ -2665,28 +2663,6 @@ Lily_parser::do_yyparse ()
 }
 
 
-/* FIXME: Should make this optional?  It will also complain at
-
-       [s4]
-
-which is entirely legitimate.
-
-Or we can scrap it.  Barchecks should detect wrong durations, and
-skipTypesetting speeds it up a lot.  */
-
-void
-Lily_parser::beam_check (SCM dur)
-{
-  Duration *d = unsmob_duration (dur);
-  if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
-    {
-      Music *m = unsmob_music (last_beam_start_);
-      m->origin ()->warning (_f ("suspect duration in beam: %s",
-      d->to_string ()));
-    }
-  last_beam_start_ = SCM_EOL;
-}
-
 
 
 
@@ -2780,7 +2756,7 @@ property_op_to_music (SCM op)
                bool itc = do_internal_type_checking_global;
                /* UGH.
                */
-               bool autobeam = ly_c_equal_p (symbol, ly_symbol2scm ("autoBeamSettings"));
+               bool autobeam = ly_is_equal (symbol, ly_symbol2scm ("autoBeamSettings"));
                if (autobeam)
                        do_internal_type_checking_global = false;
                m->set_property ("grob-property", grob_sym);