]> git.donarmstrong.com Git - lilypond.git/commitdiff
* Documentation/user/changing-defaults.itely (Creating contexts):
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 18 Mar 2004 13:51:07 +0000 (13:51 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 18 Mar 2004 13:51:07 +0000 (13:51 +0000)
new node.

* lily/grace-iterator.cc (process): descend to child for \grace.

* lily/timing-translator.cc (initialize): Timing_translator adds
Timing alias by itself.

* lily/context.cc (add_alias): new function.

* scm/lily.scm (tex-output-expression): new function, eval within
drawing API. Guards against eval vulnerabilities.

28 files changed:
ChangeLog
Documentation/topdocs/NEWS.texi
Documentation/user/changing-defaults.itely
Documentation/user/macros.itexi
Documentation/user/music-glossary.tely
Documentation/user/notation.itely
input/test/polymetric.ly
lily/axis-group-interface.cc
lily/beam.cc
lily/context-def.cc
lily/context.cc
lily/engraver-group-engraver.cc
lily/grace-iterator.cc
lily/grob-interface.cc
lily/grob.cc
lily/include/context-def.hh
lily/include/context.hh
lily/include/music-iterator.hh
lily/music-iterator.cc
lily/music.cc
lily/new-fingering-engraver.cc
lily/sequential-iterator.cc
lily/timing-engraver.cc
lily/timing-translator.cc
lily/translator-group.cc
ly/engraver-init.ly
scm/lily.scm
scripts/convert-ly.py

index 2dc04719fc72ae4ef0c162dd86158b71fd38834c..b319891d3057571654ee534917e64400bec3cd31 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2004-03-18  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * Documentation/user/changing-defaults.itely (Creating contexts):
+       new node.
+
+       * lily/grace-iterator.cc (process): descend to child for \grace.
+
+       * lily/timing-translator.cc (initialize): Timing_translator adds
+       Timing alias by itself.
+
+       * lily/context.cc (add_alias): new function.
+
        * scm/lily.scm (tex-output-expression): new function, eval within
        drawing API. Guards against eval vulnerabilities.
 
index ace6ed52f55b3d082733ecb6077bc53a72c3ed4f..bf4ac1541987f797ee576fdacf0fc3a1adec0d31 100644 (file)
@@ -8,10 +8,14 @@
 @unnumbered New features in 2.1 since 2.0
 
 @itemize @bullet
+
+@item The @code{Timing_engraver} now sets the @code{Timing} alias on
+its containing context automatically.
+
 @item The code for font selection has been rewritten. In addition to
 existing font selection properties, the property @code{font-encoding}
-has been added, which makes the switch between normal  @code{text} and other
-encodings like @code{braces},  @code{music} and @code{math}. 
+has been added, which makes the switch between normal @code{text} and
+other encodings like @code{braces}, @code{music} and @code{math}.
 
 @item The pmx2ly script has been removed from the distribution.
 
index 235519ce30f77a37621589ae5db48c6d7eb576e5..5749b70322848439725b071cc536f58709664b50 100644 (file)
@@ -248,23 +248,144 @@ need explicit accidentals.
 This information can be present on several levels.  For example, the
 effect of an accidental is limited to a single stave, while a bar line
 must be synchronized across the entire score.  To match this
-hierarchy, LilyPond's interpretation step is hierarchical. Properties
-are maintained `interpretation contexts', like Voice, Staff and Score,
-and each context can have different @emph{properties}, variables that
-are contained in a context.
+hierarchy, LilyPond's interpretation step is hierarchical.  There are
+interpretation contexts, like @context{Voice}, Staff and Score, and each level
+can maintain its own properties.
+
+Full description of all available contexts is in the program
+reference, see
+@ifhtml
+@internalsref{Contexts}
+@end ifhtml.
+@ifnothtml 
+Translation @arrow{} Context.
+@end ifnothtml
 
 @menu
+* Creating contexts::           
 * Changing context properties on the fly ::  
-* context property defaults ::  
+* Modifying context plug-ins::  
+* Defining context defaults ::  
 * which properties to change::  
 @end menu
 
+@node Creating contexts
+@subsection Creating contexts
+
+For simple scores, the correct contexts are created automatically. For
+more complex scores, it is necessary to instantiate them by hand.
+There are three commands to do this.
+
+The easiest command is @code{\new}, and it also the quickest to type.
+It is prepended to a  music expression, for example
+
+@example
+  \new @var{type} @var{music expression}
+@end example
+
+@noindent
+where @var{type} is a context name (like @code{Staff} or
+@code{Voice}).  This command creates a new context, and starts
+interpreting @var{music expression} with that.
+
+A practical application of @code{\new} is a score with many
+staves. Each part that should be on its own staff, gets a @code{\new
+Staff}.
+
+@lilypond[verbatim,relative=2,raggedright]
+  << \new Staff { c4 c }
+     \new Staff { d4 d }
+  >>
+@end lilypond
+
+
+The @code{\context} command also directs a music expression to a
+context object, but gives the context an extra name. The syntax is
+
+@example
+  \context @var{type} = @var{id} @var{music}
+@end example
+
+This form will search for an existing context of type @var{type}
+called @var{id}. If that context does not exist yet, it is created.
+This is useful if the context referred to later on. For example, when
+setting lyrics the melody is in a named context
+
+@example
+ \context Voice = "@b{tenor}" @var{music}
+@end example
+
+@noindent
+so the texts can be properly aligned to its notes,
+
+@example
+\new Lyrics \lyricsto "@b{tenor}" @var{lyrics} 
+@end example
+
+@noindent
+
+Another possibility is funneling two different music expressions into
+one context. In the following example, articulations and notes are
+entered separately,
+
+@example
+music = \notes { c4 c4 }
+arts = \notes  { s4-. s4-> }
+@end example
+
+They are combined by sending both to the same @context{Voice} context,
+
+@example
+  << \new Staff \context Voice = "A" \music
+     \context Voice = "A" \arts
+  >>
+@end example
+@lilypond[raggedright]
+music = \notes \context Voice = "one" { c4 c4 }
+arts = \notes \context Voice = "one"  { s4-. s4-> }
+\score {
+  << \new Staff \context Voice = "A" \music
+     \context Voice = "A" \arts
+  >>
+} 
+@end lilypond
+
+
+
+The third command for creating contexts is
+@example
+  \context @var{type} @var{music}
+@end example
+
+
+@noindent
+It is similar to @code{\context} with @code{= @var{id}}, but now it
+matches any context of type @var{type}, regardless of its given name.
+
+This variant is used with music expressions that can be interpreted at
+several levels. For example, the @code{\applyoutput} command (see
+@ref{Running a function on all layout objects}). Without an explicit
+@code{\context}, it is usually is applied to @context{Voice}
+
+@example
+  \applyoutput #@var{function}   % apply to Voice
+@end example
+
+To have it interpreted at @context{Score} or @context{Staff} level use
+these forms
+
+@example
+  \context Score \applyoutput #@var{function}
+  \context Staff \applyoutput #@var{function}
+@end example
+
+
 @node Changing context properties on the fly 
 @subsection Changing context properties  on the fly
 
-Context variables, properties, can be changed during the
-interpretation step.  This is achieved by inserting the @code{\set}
-command in the music,
+Each context can have different @emph{properties}, variables contained
+in that context. They can be changed during the interpretation step.
+This is achieved by inserting the @code{\set} command in the music,
 
 @quotation
   @code{\set }[@var{context}]@code{.}@var{prop}@code{ = #}@var{value} 
@@ -282,7 +403,7 @@ multi rests are condensed.  The value assigned is a Scheme object. In
 this case, it is @code{#t}, the boolean True value.
 
 If the @var{context} argument is left out, then the current
-bottom-most context (typically ChordNames, Voice or Lyrics) is used.
+bottom-most context (typically ChordNames, @context{Voice} or Lyrics) is used.
 In this example,
 
 @lilypond[verbatim,relative=2]
@@ -306,20 +427,19 @@ There is also an @code{\unset} command,
 
 @noindent
 which removes the definition of @var{prop}. This command only removes
-definitions  set in
-@var{context}. in
+the definition if it is set in @var{context}. In
 
 @example
-  \set staff.autoBeaming = ##f
-  \unset voice.autoBeaming
+  \set Staff.autoBeaming = ##f
+  \unset Voice.autoBeaming
 @end example
 
 @noindent
 the current voice does not have the property, and the definition at
 staff level remains intact.
 
-Settings that should only apply to a single time-step  can be entered
-easily with @code{\once}, for example in 
+Settings that should only apply to a single time-step can be entered
+easily with @code{\once}, for example in
 
 @lilypond[verbatim,relative=2]
   c4
@@ -330,9 +450,106 @@ easily with @code{\once}, for example in
 
 @code{fontSize} is unset after the third note.
 
+A full description of all available context properties is in the
+program reference, see
+@ifhtml
+@internalsref{Tunable-context-properties}.
+@end ifhtml
+@ifnothtml
+Translation @arrow{} Tunable context properties.
+@end ifnothtml
+
+
 @node Modifying context plug-ins
 @subsection Modifying context plug-ins
 
+Notation contexts (like Score and Staff) not only store properties,
+they also contain plug-ins, called ``engravers'' that create notation
+elements. For example, the Voice context contains a
+@code{Note_head_engraver} and the Staff context contains a
+@code{Key_signature_engraver}.
+
+For a full a description of each plug-in, see 
+@ifhtml
+@internalsref{Engravers}
+@end ifhtml
+@ifnothtml
+Program reference @arrow Translation @arrow{} Engravers.
+@end ifnothtml
+Every context described in
+@ifhtml
+@internalsref{Contexts}
+@end ifhtml.
+@ifnothtml 
+Program reference @arrow Translation @arrow{} Context.
+@end ifnothtml
+lists the engravers used for that context.
+
+
+It can be useful to shuffle around these plug-ins. This is done by
+starting a new context, with @code{\new} or @code{\context}, and
+modifying it like this, 
+
+@example
+ \new @var{context} \with @{
+   \consists @dots{}
+   \consists @dots{}
+   \remove  @dots{}
+   \remove @dots{}
+   @emph{etc.}
+ @}
+ @var{..music..}
+@end example
+
+where the @dots{} should be the name of an engraver. Here is a simple
+example which removes @code{Time_signature_engraver} and
+@code{Clef_engraver} from a @code{Staff} context,
+
+@lilypond[relative=1, verbatim]
+<< \new Staff {
+    f2 g
+  }
+  \new Staff \with {
+     \remove Time_signature_engraver
+     \remove Clef_engraver
+  } {
+    f2 g2
+  }
+>>
+@end example
+
+In the second stave there are no time signature or clef symbols.  This
+is a rather crude method of making objects disappear, it will affect
+the entire staff. More sophisticated method is shown in TODO.
+
+The next example shows a practical application.  Bar lines and time
+signatures are normally synchronized across the score.  This is done
+by the @code{Timing_engraver}. This plug-in keeps an administration of
+time signature, location within the measure, etc. By moving the
+@code{Timing_engraver} engraver from Score to Staff context, we can
+have score where each staff has its own time signature.
+
+@cindex polymetric scores
+
+
+@lilypond[relative=1,raggedright,verbatim]
+\new Score \with {
+  \remove Timing_engraver
+} <<
+  \new Staff \with {
+    \consists Timing_engraver
+  } {
+      \time 3/4
+      c4 c c c c c
+  }
+  \new Staff \with {
+    \consists Timing_engraver {
+  } {
+       \time 2/4
+       c4 c c c c c
+  }
+  >>
+@end lilypond
 
 
 @node Defining context defaults 
index d0d949645fc19ff1265949e31c97052dc4ea593e..10e299e5136d837bc0de4b4942baa08019dd739e 100644 (file)
@@ -42,6 +42,21 @@ $\\flat$%
 @end macro
 @end iftex
 
+@macro arrow{}
+@iftex
+@tex $\\Rightarrow$ @end tex@c
+@end iftex
+@ifhtml
+@html
+&rarr;
+@end html
+@end ifhtml
+@ifinfo
+-->
+@end ifinfo
+@end macro
+
+
 
 
 @iftex
@@ -145,6 +160,14 @@ internals document,  @internalsref{\NAME\}
 
 @end macro
 
+@ifhtml
+@macro context{NAME}
+@code{NAME}@c should use internalsref
+@cindex \NAME\@c
+@end macro
+
+
+
 
 @c
 @c ARGGGHHHHH! I want
@@ -156,10 +179,3 @@ internals document,  @internalsref{\NAME\}
 @cindex @code{\WHAT\}
 @code{\WHAT\}, 
 @end macro
-
-@macro syntax
-@noindent
-@subsubheading Syntax
-
-@end macro
-
index a005d1277326f1dacb13fc4f3cca48fef5c244f4..e0b1c7b126722fb69d49899f5f1a460fe9c7e3e9 100644 (file)
@@ -98,19 +98,8 @@ Copyright 1999--2004 by the authors
 @c @evenheading @thispage @| @|
 @c @oddheading @| @| @thispage @|
 
-@macro ar{}
-@iftex
-@tex $\\Rightarrow$ @end tex@c
-@end iftex
-@ifhtml
-@html
-&rarr;
-@end html
-@end ifhtml
-@ifinfo
--->
-@end ifinfo
-@end macro
+@include macros.itexi
+
 
 @ignore
 We do not use refs for Info:
@@ -125,7 +114,7 @@ they look too intrusive (says Han-Wen).
 @c arrowref
 @macro aref{word}
 @iftex
-@w{@ar{}@strong{\word\}}@c
+@w{@arrow{}@strong{\word\}}@c
 @end iftex
 @ifhtml
 @ar{}@ref{\word\, @strong{\word\}}@c
index 2c38f4efaf91a78afcb05a5799f5b823abad1702..7fd23609838b49b8663aa52f164a58f9182f7483 100644 (file)
@@ -2494,7 +2494,7 @@ With alternative endings:
 
 @refbugs
 
-If you do a nested repeat like
+A nested repeat like
 
 @example 
 \repeat @dots{}
@@ -2503,10 +2503,10 @@ If you do a nested repeat like
 @end example 
 
 @noindent
-then it is ambiguous to which @code{\repeat} the @code{\alternative}
-belongs. This ambiguity is resolved by always having the
-@code{\alternative} belong to the inner @code{\repeat}.  For clarity,
-it is advisable to use braces in such situations.
+is ambiguous, since it is is not clear to which @code{\repeat} the
+@code{\alternative} belongs. This ambiguity is resolved by always
+having the @code{\alternative} belong to the inner @code{\repeat}.
+For clarity, it is advisable to use braces in such situations.
 @cindex ambiguity
 
 @node Repeats and MIDI
index d8463e59869fa34d33152281d8fd4f0f4ba592b6..4840fc210d3c45aeade00f17bd26fa7343f28ed3 100644 (file)
@@ -1,4 +1,4 @@
-\version "2.1.30"
+\version "2.1.31"
 
 \header{ texidoc="@cindex Time Signature Multiple
 
@@ -42,7 +42,7 @@ lines seem to distort the regular spacing.
        \context{
            \StaffContext
            \consists "Timing_engraver"
-           \alias "Timing"
+           
        }
     }
 }
index 1362c1275e241435b5f01ce6117b2bd3d80034fe..eab8127652c51b89340dc17ec0e83088cb59ed4b 100644 (file)
@@ -76,8 +76,8 @@ Axis_group_interface::set_axes (Grob*me,Axis a1, Axis a2)
   SCM axes = me->get_property ("axes");
   
   if (!gh_pair_p (axes)
-      || scm_memq (sa1, axes) == SCM_BOOL_F
-      || scm_memq (sa2, axes) == SCM_BOOL_F)
+      || scm_c_memq (sa1, axes) == SCM_BOOL_F
+      || scm_c_memq (sa2, axes) == SCM_BOOL_F)
     {
       SCM ax = gh_cons (sa1, SCM_EOL);
       if (a1 != a2)
index 6f0da9d5a79599b29a18a903b4f6afca566b32b1..b63dd020b33b86e320006b2396f4238d753ce3d6 100644 (file)
@@ -212,7 +212,7 @@ position_with_maximal_common_beams (SCM left_beaming, SCM right_beaming,
       for ( SCM s = gh_car (right_beaming); gh_pair_p (s); s = gh_cdr (s))
        {
          int k = - right_dir * gh_scm2int (gh_car (s)) + i;
-         if (scm_memq (scm_int2num (k), left_beaming) != SCM_BOOL_F)
+         if (scm_c_memq (scm_int2num (k), left_beaming) != SCM_BOOL_F)
            count ++;
        }
 
@@ -380,7 +380,7 @@ Beam::print (SCM grob)
           gh_pair_p (s); s =gh_cdr (s))
        {
          int b = gh_scm2int (gh_car (s));
-         if (scm_memq (gh_car (s), right) != SCM_BOOL_F)
+         if (scm_c_memq (gh_car (s), right) != SCM_BOOL_F)
            {
              full_beams.push (b);
            }
@@ -393,7 +393,7 @@ Beam::print (SCM grob)
           gh_pair_p (s); s =gh_cdr (s))
        {
          int b = gh_scm2int (gh_car (s));
-         if (scm_memq (gh_car (s), left) == SCM_BOOL_F)
+         if (scm_c_memq (gh_car (s), left) == SCM_BOOL_F)
            {
              rfliebertjes.push (b);
            }
@@ -1227,7 +1227,7 @@ where_are_the_whole_beams (SCM beaming)
   
   for ( SCM s = gh_car (beaming); gh_pair_p (s) ; s = gh_cdr (s))
     {
-      if (scm_memq (gh_car (s), gh_cdr (beaming)) != SCM_BOOL_F)
+      if (scm_c_memq (gh_car (s), gh_cdr (beaming)) != SCM_BOOL_F)
        
        l.add_point (gh_scm2int (gh_car (s)));
     }
index ea09d1578fa06f77fcbe1c1302cc283a4302da96..fe7924f2342ebace339474a2c19edaacc321a0fa 100644 (file)
@@ -269,7 +269,6 @@ Context_def::instantiate (SCM ops)
   else
     tg = new Context ();
 
-  
   tg->definition_ = self_scm ();
 
   SCM trans_names = get_translator_names (ops); 
@@ -280,6 +279,7 @@ Context_def::instantiate (SCM ops)
   g->simple_trans_list_ = names_to_translators (trans_names, tg);
   tg->implementation_ = g->self_scm ();
   g->daddy_context_ = tg;
+  tg->aliases_ = context_aliases_ ;
   
   scm_gc_unprotect_object (g->self_scm ());
   
@@ -334,13 +334,3 @@ Context_def::to_alist () const
   return l;  
 }
 
-bool
-Context_def::is_alias (SCM sym) const
-{
-  bool b  = sym == context_name_;
-
-  for (SCM a = context_aliases_; !b && gh_pair_p (a); a = ly_cdr (a))
-    b = b || sym == ly_car (a);
-
-  return b;
-}
index e704a4463b9ea3645d50d5886fa523fc2f7c9094..ad20a3fe5f0c39b723e633c2622a42f9e914f9f4 100644 (file)
@@ -81,6 +81,7 @@ Context::Context ()
 {
   daddy_context_ = 0;
   init_ = false;
+  aliases_ = SCM_EOL;
   iterator_count_  = 0;
   implementation_ = SCM_EOL;
   properties_scm_ = SCM_EOL;
@@ -262,9 +263,20 @@ Context::is_alias (SCM sym) const
   if (sym == ly_symbol2scm ("Bottom")
       && !gh_pair_p (accepts_list_))
     return true;
-  return unsmob_context_def (definition_)->is_alias (sym);
+  if (sym == unsmob_context_def (definition_)->get_context_name ())
+    return true;
+  
+  return scm_c_memq (sym, aliases_) != SCM_BOOL_F;
+}
+
+void
+Context::add_alias (SCM sym)
+{
+  aliases_ = scm_cons (sym, aliases_);
 }
 
+
+
 void
 Context::internal_set_property (SCM sym, SCM val)
 {
@@ -400,6 +412,7 @@ Context::mark_smob (SCM sm)
   Context * me = (Context*) SCM_CELL_WORD_1 (sm);
   
   scm_gc_mark (me->context_list_);
+  scm_gc_mark (me->aliases_);
   scm_gc_mark (me->definition_);  
   scm_gc_mark (me->properties_scm_);  
   scm_gc_mark (me->accepts_list_);
index 76fd882088c14b78c598aa92300f9424394c4597..58cd338d1f216213acf44ef2277beb866a7dea15 100644 (file)
@@ -127,7 +127,7 @@ engraver_valid (Translator*tr, SCM ifaces)
   SCM ack_ifs = scm_assoc (ly_symbol2scm ("interfaces-acked"), tr->translator_description ());
   ack_ifs = gh_cdr (ack_ifs);
   for (SCM s = ifaces; ly_pair_p (s); s = ly_cdr (s))
-    if (scm_memq (ly_car (s), ack_ifs) != SCM_BOOL_F)
+    if (scm_c_memq (ly_car (s), ack_ifs) != SCM_BOOL_F)
       return true;
   return false;
 }
index 2c000114c0564ccf96aa709d865396aae237c5e6..a63ad5c814f7edd4c6e095bcd7cce9cf8b70d086 100644 (file)
@@ -20,6 +20,12 @@ Grace_iterator::process (Moment m)
   Moment main ;
   main.main_part_ = - start_mom_.grace_part_ + m.grace_part_;
   Music_wrapper_iterator::process (main);
+
+  /*
+    We can safely do this, since \grace should always be inside
+    sequential.
+   */
+  descend_to_child (child_iter_->get_outlet ());
 }
 
 Moment
index 28efdfc8b56480d757508e1b20d04e6a51d57c21..45374a3099dbde6d539a41d98f478620657d7d26 100644 (file)
@@ -71,7 +71,7 @@ check_interfaces_for_property (Grob const *me, SCM sym)
          continue;
        }
 
-      found= found || (scm_memq (sym, gh_caddr (iface)) != SCM_BOOL_F);
+      found= found || (scm_c_memq (sym, gh_caddr (iface)) != SCM_BOOL_F);
     }
 
   if (!found)
index 9bd0bfb3898bb8b1c537e53d5b037a52931301fb..0fd48933619f5d72a18d3105ca4bf4591665a320 100644 (file)
@@ -616,7 +616,7 @@ Grob::has_extent_callback (SCM cb, Axis a)const
 bool
 Grob::has_offset_callback (SCM cb, Axis a)const
 {
-  return scm_memq (cb, dim_cache_[a].offset_callbacks_) != SCM_BOOL_F;
+  return scm_c_memq (cb, dim_cache_[a].offset_callbacks_) != SCM_BOOL_F;
 }
 
 void
@@ -763,7 +763,7 @@ Grob::internal_has_interface (SCM k)
 {
   SCM ifs = get_property ("interfaces");
 
-  return scm_memq (k, ifs) != SCM_BOOL_F;
+  return scm_c_memq (k, ifs) != SCM_BOOL_F;
 }
 
 
index a1d9bc3d937581cc30b0cfa0b3e314fa24e5f46f..3760c044a62468043b9b83c36ea7c2f95909a6aa 100644 (file)
@@ -45,7 +45,6 @@ public:
   Context * instantiate (SCM extra_ops);
 
   SCM to_alist () const;
-  bool is_alias (SCM) const;
   static SCM make_scm () ;
 
   SCM clone_scm ()const;
index a47237fb03e5ab5a7ffe5aa3b60de0e90945e179..b9d08f196984bb07fc0f6cee94468125bf089f9f 100644 (file)
@@ -26,6 +26,8 @@ public:
   SCM properties_scm_;
   SCM context_list_;
   SCM accepts_list_;
+  SCM aliases_;
+
   Context * daddy_context_;
   
   Context ();
@@ -45,6 +47,7 @@ public:
   
   virtual Score_context * get_score_context () const;  
   bool is_alias (SCM) const;
+  void add_alias (SCM); 
   void add_context (Context *trans);
   bool is_bottom_context () const;
   bool is_removable () const;
index 5622e1660184976d52cc2255b2ce937bcba699c0..14f4aad5d15ff7ab9958773dc8025493a1eb4fc7 100644 (file)
@@ -111,6 +111,7 @@ public:
   Music * get_music () const;
 protected:
   virtual void do_quit();
+  void descend_to_child (Context*);
 private:
   Interpretation_context_handle handle_;
   Music  * music_;
index 02e6200abb9845a6bc53f43f8fb9d33867a0e40d..9fc288866e809fcee74294d2207d9c13bb71476e 100644 (file)
@@ -236,3 +236,22 @@ Music_iterator::run_always ()const
 {
   return false;
 }
+
+/*
+  move to context of child iterator if it is deeper down in the
+  hierarchy.
+  */
+void
+Music_iterator::descend_to_child (Context * child_report)
+{
+  Context * me_report = get_outlet ();
+
+  Context * c = child_report;
+  while (c && c != me_report)
+    {
+      c = c->daddy_context_;
+    }
+  
+  if (c == me_report)
+    set_translator (child_report);
+}
index e5776d8ead125b02743252c359d97ae0837ad0a7..81ff4f92a078dc2beadcab011ecbe18c75426e8d 100644 (file)
@@ -21,7 +21,7 @@ Music::internal_is_music_type (SCM k) const
 {
   SCM ifs = get_property ("types");
 
-  return scm_memq (k, ifs) != SCM_BOOL_F;
+  return scm_c_memq (k, ifs) != SCM_BOOL_F;
 }
 
 String
index 18103a3b4a701add17fc2006cabda9de4d8bcef5..7f21e6a954070900800d3e433c7ecadbfd2ef617 100644 (file)
@@ -200,10 +200,10 @@ New_fingering_engraver::position_scripts ()
   fingerings_.sort (&Finger_tuple::compare);
   SCM orientations = get_property ("fingeringOrientations");
 
-  bool up_p = scm_memq (ly_symbol2scm ("up"), orientations) != SCM_BOOL_F;
-  bool down_p = scm_memq (ly_symbol2scm ("down"), orientations) != SCM_BOOL_F;
-  bool left_p = scm_memq (ly_symbol2scm ("left"), orientations) != SCM_BOOL_F;
-  bool right_p = scm_memq (ly_symbol2scm ("right"), orientations) != SCM_BOOL_F;
+  bool up_p = scm_c_memq (ly_symbol2scm ("up"), orientations) != SCM_BOOL_F;
+  bool down_p = scm_c_memq (ly_symbol2scm ("down"), orientations) != SCM_BOOL_F;
+  bool left_p = scm_c_memq (ly_symbol2scm ("left"), orientations) != SCM_BOOL_F;
+  bool right_p = scm_c_memq (ly_symbol2scm ("right"), orientations) != SCM_BOOL_F;
   Direction hordir = (right_p) ? RIGHT : LEFT;
   if (left_p || right_p)
     {
index 39cc1a5bd56f49230a6f4cbd86c0afcc464bab18..9c88c4e88aa49e175da2763599e0aae5b4c2db27 100644 (file)
@@ -142,7 +142,7 @@ Sequential_iterator::construct_children ()
     iter_->ok () is tautology, but what the heck.
    */
   if (iter_ && iter_->ok ()) 
-    descend_to_child ();
+    descend_to_child (iter_->get_outlet ());
 }
 
 
@@ -194,25 +194,7 @@ Sequential_iterator::next_element (bool)
     iter_ = 0;
 }
 
-/*
-  move to context of child iterator if it is deeper down in the
-  hierarchy.
-  */
-void
-Sequential_iterator::descend_to_child ()
-{
-  Context * child_report = child_report = iter_->get_outlet ();
-  Context * me_report = get_outlet ();
 
-  Context * c = child_report;
-  while (c && c != me_report)
-    {
-      c = c->daddy_context_;
-    }
-  
-  if (c == me_report)
-    set_translator (child_report);
-}
 
 void
 Sequential_iterator::process (Moment until)
@@ -244,7 +226,7 @@ Sequential_iterator::process (Moment until)
       if (iter_->ok ())
        return ;
 
-      descend_to_child ();
+      descend_to_child (iter_->get_outlet ());
       next_element (true);
     }
 }
index 53b326cd511932ac76641ef7ba3e54cba303e3ac..2bf0e5f6527184024817b542340b1d7e03aa22d2 100644 (file)
@@ -89,7 +89,10 @@ ENTER_DESCRIPTION (Timing_engraver,
 /* descr */       " Responsible for synchronizing timing information from staves.  "
 "Normally in @code{Score}.  In order to create polyrhythmic music, "
 "this engraver should be removed from @code{Score} and placed in "
-"@code{Staff}.",
+"@code{Staff}. "
+"\n\nThis engraver adds the alias @code{Timing} to its containing context."
+
+                  ,
 /* creats*/       "",
 /* accepts */     "",
 /* acks  */      "",
index 6c79df545523a4fbc9d3d922a404b2146f71563e..10d09d3d9a4aa3798702718c65a3f44b22dc4f72 100644 (file)
@@ -49,7 +49,7 @@ Timing_translator::initialize ()
   /*
     move this to engraver-init.ly? 
    */
+  daddy_context_->add_alias (ly_symbol2scm ("Timing"));
   daddy_context_->set_property ("timing" , SCM_BOOL_T);  
   daddy_context_->set_property ("currentBarNumber" , gh_int2scm (1));
 
@@ -125,7 +125,8 @@ Timing_translator::start_translation_timestep ()
   else
     {
       measposp = now;
-      daddy_context_->set_property ("measurePosition", measposp.smobbed_copy ());
+      daddy_context_->set_property ("measurePosition",
+                                   measposp.smobbed_copy ());
     }
   
   measposp += dt;
@@ -151,4 +152,9 @@ Timing_translator::start_translation_timestep ()
   daddy_context_->set_property ("measurePosition", measposp.smobbed_copy ());
 }
 
-ENTER_DESCRIPTION (Timing_translator,"","","","","","");
+ENTER_DESCRIPTION (Timing_translator,
+                  "This engraver adds the alias "
+                  "@code{Timing} to its containing context."
+                  ,
+
+                  "","","","","");
index bd33135e10975935568de0ddfdb7b5790ea8b3d6..b50a62c952bd69cae37fa7c8af40e4ae969e448d 100644 (file)
@@ -49,7 +49,7 @@ translator_accepts_any_of (Translator*tr, SCM ifaces)
                           tr->translator_description ());
   ack_ifs = gh_cdr (ack_ifs);
   for (SCM s = ifaces; ly_pair_p (s); s = ly_cdr (s))
-    if (scm_memq (ly_car (s), ack_ifs) != SCM_BOOL_F)
+    if (scm_c_memq (ly_car (s), ack_ifs) != SCM_BOOL_F)
       return true;
   return false;
 }
index 6991aa835fcf7bf8693f10932d37bb68431c02ea..765abe36164889629a105a8d5530ed5f19a49ae9 100644 (file)
@@ -408,9 +408,7 @@ AncientRemoveEmptyStaffContext = \context {
 
                                % move the alias along with the engraver.
 
-    %% TODO? add this alias from Timing_engraver::initialize() ? 
     \consists "Timing_engraver"
-    \alias "Timing"
     
     \consists "Output_property_engraver"
     \consists "System_start_delimiter_engraver"
@@ -592,7 +590,6 @@ EasyNotation = \context {
 
     %% don't want to route anything out of here: 
     \alias "Staff"
-    \alias "Timing"
     \alias "Voice"
     \consists "Swallow_engraver"
     \description "Silently discards all musical information given to this context. "
index 639a2150918d7cb79358c02447adf71426e67314..0797a64e0a6d68c399ab703e8fc20531175ff47d 100644 (file)
@@ -7,8 +7,9 @@
 
 ;;; Library functions
 
-(if (defined? 'set-debug-cell-accesses!)
-    (set-debug-cell-accesses! #t))
+;(if (defined? 'set-debug-cell-accesses!)
+;    (set-debug-cell-accesses! #t))
+
 (use-modules (ice-9 regex)
             (ice-9 safe)
             (oop goops)
index f436120e3ebe66391102a121574978eb0be8eab7..fbf8fadf7183f8f6914d562ad01154f7b229170a 100644 (file)
@@ -2013,6 +2013,13 @@ ly:translator-find -> ly:context-find
 ly:get-stencil-extent -> ly:stencil-extent
 '''))
 
+def conv (str):
+       str = re.sub (r'\\alias\s*"?Timing"?', '', str)
+       return str
+
+conversions.append (((2,1,31), conv,
+                    '''remove \\alias Timing'''))
+
 ################################
 #      END OF CONVERSIONS      
 ################################