]> git.donarmstrong.com Git - lilypond.git/commitdiff
Syntax::property_operation -> Syntax::property_{override,revert,set,unset}
authorDavid Kastrup <dak@gnu.org>
Tue, 21 Jul 2015 15:11:18 +0000 (17:11 +0200)
committerDavid Kastrup <dak@gnu.org>
Mon, 27 Jul 2015 08:13:20 +0000 (10:13 +0200)
No point in joining and later splitting separate functions.  The
original motivation might have been to reduce name space pollution, but
(scm ly-syntax-constructors) is a separate module by now.

lily/include/lily-imports.hh
lily/lily-imports.cc
lily/parser.yy
scm/ly-syntax-constructors.scm

index 383896a021614e54b3fec2ec87399cafb6c0c2c4..c53ad421d8736ec184cba469c5c2b6d0356771cc 100644 (file)
@@ -121,7 +121,10 @@ namespace Syntax {
   extern Variable music_function_call_error;
   extern Variable partial_markup;
   extern Variable partial_music_function;
-  extern Variable property_operation;
+  extern Variable property_override;
+  extern Variable property_revert;
+  extern Variable property_set;
+  extern Variable property_unset;
   extern Variable repeat;
   extern Variable repetition_chord;
   extern Variable sequential_music;
index 3a694f9d10e23bd7d56314c955ca5736edb88080..16087513df5bd01df69c35c115bd46aefd7df204 100644 (file)
@@ -114,7 +114,10 @@ namespace Syntax {
   Variable music_function_call_error ("music-function-call-error");
   Variable partial_markup ("partial-markup");
   Variable partial_music_function ("partial-music-function");
-  Variable property_operation ("property-operation");
+  Variable property_override ("property-override");
+  Variable property_revert ("property-revert");
+  Variable property_set ("property-set");
+  Variable property_unset ("property-unset");
   Variable repeat ("repeat");
   Variable repetition_chord ("repetition-chord");
   Variable sequential_music ("sequential-music");
index 48ada375661dd85f2b44e46e298016c971af5905..552d699d25c87fa6bbb1106f749992a5943b5e19 100644 (file)
@@ -2639,29 +2639,21 @@ music_property_def:
        OVERRIDE grob_prop_path '=' scalar {
                if (SCM_UNBNDP ($2))
                        $$ = MAKE_SYNTAX (void_music, @$);
-               else {
-                       $$ = MAKE_SYNTAX (property_operation, @$,
+               else
+                       $$ = MAKE_SYNTAX (property_override, @$,
                                          scm_car ($2),
-                                         ly_symbol2scm ("OverrideProperty"),
-                                         scm_cadr ($2),
-                                         $4,
-                                         scm_cddr ($2));
-               }
+                                         scm_cdr ($2),
+                                         $4);
        }
        | REVERT simple_revert_context revert_arg {
-               $$ = MAKE_SYNTAX (property_operation, @$,
-                                 $2,
-                                 ly_symbol2scm ("RevertProperty"),
-                                 scm_car ($3),
-                                 scm_cdr ($3));
+               $$ = MAKE_SYNTAX (property_revert, @$, $2, $3);
        }
        | SET context_prop_spec '=' scalar {
                if (SCM_UNBNDP ($2))
                        $$ = MAKE_SYNTAX (void_music, @$);
                else
-                       $$ = MAKE_SYNTAX (property_operation, @$,
+                       $$ = MAKE_SYNTAX (property_set, @$,
                                          scm_car ($2),
-                                         ly_symbol2scm ("PropertySet"),
                                          scm_cadr ($2),
                                          $4);
        }
@@ -2669,9 +2661,8 @@ music_property_def:
                if (SCM_UNBNDP ($2))
                        $$ = MAKE_SYNTAX (void_music, @$);
                else
-                       $$ = MAKE_SYNTAX (property_operation, @$,
+                       $$ = MAKE_SYNTAX (property_unset, @$,
                                          scm_car ($2),
-                                         ly_symbol2scm ("PropertyUnset"),
                                          scm_cadr ($2));
        }
        ;
index 54cea850ec9bd52b089c09e95f80110711419177..0d37c0f766fad8b92d53203827d18b54077e2b34 100644 (file)
@@ -213,26 +213,38 @@ into a @code{MultiMeasureTextEvent}."
     (set-object-property! chain 'markup-signature (list markup?))
     chain))
 
-(define-public (property-operation ctx music-type symbol . args)
-  (let* ((props (case music-type
-                  ((PropertySet) (list 'value (car args)))
-                  ((PropertyUnset) '())
-                  ((OverrideProperty) (list 'grob-value (car args)
-                                            'grob-property-path (if (list? (cadr args))
-                                                                    (cadr args)
-                                                                    (cdr args))
-                                            'pop-first #t))
-                  ((RevertProperty)
-                   (if (list? (car args))
-                       (list 'grob-property-path (car args))
-                       (list 'grob-property-path args)))
-                  (else (ly:error (_ "Invalid property operation ~a") music-type))))
-         (m (ly:set-origin! (apply make-music music-type
-                                   'symbol symbol
-                                   props))))
-    (ly:set-origin! (make-music 'ContextSpeccedMusic
-                                'element m
-                                'context-type ctx))))
+(define-public (property-set context property value)
+  (ly:set-origin! (context-spec-music
+                   (ly:set-origin!
+                    (make-music 'PropertySet
+                                'symbol property
+                                'value value))
+                   context)))
+
+(define-public (property-unset context property)
+  (ly:set-origin! (context-spec-music
+                   (ly:set-origin!
+                    (make-music 'PropertyUnset
+                                'symbol property))
+                   context)))
+
+(define-public (property-override context path value)
+  (ly:set-origin! (context-spec-music
+                   (ly:set-origin!
+                    (make-music 'OverrideProperty
+                                'symbol (car path)
+                                'grob-property-path (cdr path)
+                                'grob-value value
+                                'pop-first #t))
+                   context)))
+
+(define-public (property-revert context path)
+  (ly:set-origin! (context-spec-music
+                   (ly:set-origin!
+                    (make-music 'RevertProperty
+                                'symbol (car path)
+                                'grob-property-path (cdr path)))
+                   context)))
 
 (define (get-first-context-id! mus)
   "Find the name of a ContextSpeccedMusic, possibly naming it"