]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parser.yy
* lily/note-column.cc (dir): idem.
[lilypond.git] / lily / parser.yy
index 8d1cbb643ba4bf6aeba47cc508c7dbd96a495729..1f2c0d863a1a0609041f280cf555eb209679e2d2 100644 (file)
@@ -28,7 +28,7 @@ FIXME:
 #include "book.hh"
 #include "context-def.hh"
 #include "dimensions.hh"
-#include "event.hh"
+#include "music.hh"
 #include "file-path.hh"
 #include "input-smob.hh"
 #include "input.hh"
@@ -41,10 +41,11 @@ 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"
+#include "music.hh"
 
 #define MY_MAKE_MUSIC(x)  make_music_by_name (ly_symbol2scm (x))
 
@@ -84,7 +85,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 +172,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 +788,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 +997,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.
                        */
@@ -1521,15 +1524,6 @@ scalar: string {
        }
        | bare_number {
                $$ = $1;
-/*             if (scm_integer_p ($1) == SCM_BOOL_T)
-               {
-                       int k = scm_to_int (scm_inexact_to_exact ($1));
-                       $$ = k;
-               } else
-               {
-                       THIS->parser_error (@1, _ ("need integer number arg"));
-                       $$ = 0;
-               }*/
        }
         | embedded_scm {
                $$ = $1;
@@ -2097,14 +2091,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 +2655,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;
-}
-
 
 
 
@@ -2717,8 +2685,11 @@ Lily_lexer::try_special_identifiers (SCM *destination, SCM sid)
                *destination = mus->self_scm ();
                unsmob_music (*destination)->
                        set_property ("origin", make_input (last_input_));
-               return dynamic_cast<Event*> (mus)
-                       ? EVENT_IDENTIFIER : MUSIC_IDENTIFIER;
+
+               bool is_event = scm_memq (ly_symbol2scm ("event"), mus->get_property ("types"))
+                       != SCM_BOOL_F;
+
+               return is_event ? EVENT_IDENTIFIER : MUSIC_IDENTIFIER;
        } else if (unsmob_duration (sid)) {
                *destination = unsmob_duration (sid)->smobbed_copy ();
                return DURATION_IDENTIFIER;
@@ -2780,7 +2751,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);