]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4798/2: Prepare override/revert to deal with numeric subkeys
authorDavid Kastrup <dak@gnu.org>
Mon, 7 Mar 2016 11:13:06 +0000 (12:13 +0100)
committerDavid Kastrup <dak@gnu.org>
Sat, 19 Mar 2016 13:20:03 +0000 (14:20 +0100)
Those are fairly cosmetic changes (partly comments) to prepare for the
possibility of using override/revert with numeric subkeys while
retaining the necessity of using a symbol as the main property in a
Context.Grob.property.subproperties... n-tuple since the organization of
an "nalist" (an alist stack containing reversible subproperty overrides)
relies on a few special key values: currently pairs and booleans are
specially interpreted while the current implementation requires an
eq?-comparable first index for efficiency reasons.

lily/context-property.cc
lily/nested-property.cc

index 534fced49aacc813db06a76a0d63c4768516fc14..e0acae14557319223f253df2655caf80950796c0 100644 (file)
@@ -39,10 +39,11 @@ general_pushpop_property (Context *context,
                           SCM grob_property_path,
                           SCM new_value)
 {
+  // Numbers may appear, but not in first place
   if (!scm_is_symbol (context_property)
       || !scm_is_symbol (scm_car (grob_property_path)))
     {
-      warning (_ ("need symbol arguments for \\override and \\revert"));
+      warning (_ ("need symbol argument for \\override and \\revert"));
       if (do_internal_type_checking_global)
         assert (false);
     }
index ba43ae62f140098989e1f96761683dc4f9658368..edb7986a51e7e5127980eb13fd84134db18805a6 100644 (file)
@@ -171,7 +171,12 @@ set_nested_property (Grob *me, SCM big_to_small, SCM value)
 // This converts an alist with nested overrides in it to a proper
 // alist.  The number of nested overrides is known in advance,
 // everything up to the last nested override is copied, the tail is
-// shared
+// shared.
+//
+// The first nalist index has to be a symbol since the conversion
+// relies on eq? comparisons, uses some special non-symbol values for
+// special purposes, and does validity checking indexed by symbols.
+// Subindexing can be done with equal?-comparable indexes, however.
 
 SCM
 nalist_to_alist (SCM nalist, int nested)
@@ -206,7 +211,7 @@ nalist_to_alist (SCM nalist, int nested)
             scm_set_cdr_x (pair, scm_cons (elt, scm_cdr (pair)));
           continue;
         }
-
+      assert (scm_is_symbol (key));
       // plain override: apply any known corresponding partials
       SCM pair = assq_pop_x (key, &partials);
       if (scm_is_true (pair))