[EMAIL PROTECTED] writes:
> > >   \translator{\StaffContext }
> > 
> > OK, I also see some light. Maybe it would have been clearer if the
> > above line would have read
> > 
> >       \addtranslator \translator { \StaffContext }
> 
> Nope :-)
> 
> I still don't understand what it does.

parsing \translator { } only creates a  object (A malloced C++ object
that is).

Doing

        VARNAME  = \translator {
                 ..
                \name CONTEXTNAME;
        }

assigns that object to the variable named VARNAME.  Doing

        \translator {
                ..
                \name CONTEXTNAME;
        } 

within the paper block registers the context definition (the C++
object) with the paper definition. During interpretation, if the
expression

        \context CONTEXTNAME { ... }

is encountered, LilyPond asks the \paper block (or rather, the C++
object of type Paper_def that is constructed in \paper) for a context
definition called CONTEXTNAME.  So

        \translator {}

(Without a VARNAME =  prepended) registers the context definition so
it can be found during the interpretation phase.

In summary VARNAME = \translator {} makes VARNAME available to the
rest of the \paper block, while unadorned \translator { \name CNAME }
makes the context available during interpretation.


If you think this all is hairy, then you're entirely right. However, I
have the feeling that the majority of the users don't have to
understand this to use LilyPond effectively, so I don't feel a
pressing urge to rewrite this.

-- 

Han-Wen Nienhuys, [EMAIL PROTECTED] ** GNU LilyPond - The Music Typesetter 
      http://www.cs.uu.nl/people/hanwen/lilypond/index.html 

Reply via email to