From: Han-Wen Nienhuys Date: Thu, 18 Mar 2004 00:09:44 +0000 (+0000) Subject: * lily/global-context.cc (run_iterator_on_me): fix grace note X-Git-Tag: release/2.1.32~29 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7949941eb50f6243b76ded2dd331501027b68448;p=lilypond.git * lily/global-context.cc (run_iterator_on_me): fix grace note nesting by initting measurePosition. * lily/timing-translator.cc (initialize): do no init measurePosition * lily/include/music-output-def.hh (class Music_output_def): add input_origin_ field. * Documentation/user/changing-defaults.itely (Changing context properties on the fly): new node. * lily/include/ly-smobs.icc (free_smob): remove smobbed_self() function. Only have smobbed_copy (), and do not provide smobbed_copy() for non-simple smobs. Changes throughout. --- diff --git a/ChangeLog b/ChangeLog index cc1871de76..e44cc6877d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,34 @@ +2004-03-18 Han-Wen Nienhuys + + * lily/global-context.cc (run_iterator_on_me): fix grace note + nesting by initting measurePosition. + + * lily/timing-translator.cc (initialize): do no init + measurePosition + + * lily/include/music-output-def.hh (class Music_output_def): add + input_origin_ field. + + * Documentation/user/changing-defaults.itely (Changing context + properties on the fly): new node. + + * lily/include/ly-smobs.icc (free_smob): remove smobbed_self() + function. Only have smobbed_copy (), and do not provide + smobbed_copy() for non-simple smobs. Changes throughout. + +2004-03-17 Han-Wen Nienhuys + + * lily/auto-change-iterator.cc (class Auto_change_iterator): add + start_moment_. Fix by Doug A. Linhardt. + 2004-03-16 Han-Wen Nienhuys + * lily/accidental-engraver.cc (acknowledge_grob): don't suppress + accidentals for harmonic notes. + + * lily/note-collision.cc (check_meshing_chords): don't merge heads + fo different style. (Thanks to Doug Linhardt). + * Documentation/user/changing-defaults.itely (Scheme tutorial): new node. diff --git a/Documentation/user/changing-defaults.itely b/Documentation/user/changing-defaults.itely index 79a7c805b3..d892ff97f5 100644 --- a/Documentation/user/changing-defaults.itely +++ b/Documentation/user/changing-defaults.itely @@ -21,9 +21,12 @@ There are X areas where the default settings may be changed: @itemize @bullet @item Output: changing the appearance of individual - objects -@item Context: changing the translation from music events to - notation + objects. For example, changing stem directions, or the location of + subscripts. + +@item Context: changing aspects of the translation from music events to + notation. For example, giving each staff a separate time signature. + @item Global layout: changing the appearance of the spacing, line breaks and page dimensions. @end itemize @@ -33,16 +36,15 @@ Then, there are separate systems for typesetting text (like discusses these. Internally, LilyPond uses Scheme (a LISP dialect) to provide -infrastructure. Since overriding layout decisions in effect -accesses the program internals, it is necessary to learn a (very -small) subset of Scheme. That is why this chapter starts with -a short tutorial on entering numbers, lists, strings and symbols in -Scheme. +infrastructure. Overriding layout decisions in effect accesses the +program internals, so it is necessary to learn a (very small) subset +of Scheme. That is why this chapter starts with a short tutorial on +entering numbers, lists, strings and symbols in Scheme. @menu * Scheme tutorial:: -* Setting variables:: +* Context :: * Fine tuning layout:: * Tuning output:: * Text markup:: @@ -165,16 +167,21 @@ The quote mark @code{'} prevents Scheme interpreter from substituting @code{twentyFour}. This syntax will be used very frequently, since many of the layout -tweaks involve assigning (Scheme) values to variables, for example +tweaks involve assigning (Scheme) values to internal variables, for +example @example - \override Stem #'thickness = #2.5 + \override Stem #'thickness = #2.6 @end example -This instruction adjusts the appearance of stems. The value @code{2.5} +This instruction adjusts the appearance of stems. The value @code{2.6} is put into a the @code{thickness} variable of a @code{Stem} object. This makes stems almost twice as thick as their normal size. - +To distinguish between variables defined in input files (like +@code{twentyFour} in the example above), and internal variables, we +will call the latter ``properties.'' So, the stem object has a +@code{thickness} property. + Two-dimensional offsets (X and Y coordinates) as well as object sizes (intervals with a left and right point) are entered as @code{pairs}. A pair@footnote{In Scheme terminology, the pair is called @code{cons}, @@ -197,8 +204,8 @@ The two elements of a pair may be arbitrary values, for example #'("blah-blah" . 3.14159265) @end example -A list is entered by enclosing its elements in parentheses, and -adding a quote. . For example, +A list is entered by enclosing its elements in parentheses, and adding +a quote. For example, @example #'(1 2 3) #'(1 2 "string" #f) @@ -210,102 +217,112 @@ and 2). For entering lists, use a quote @code{'} and for calculations, do not use a quote. Inside a quoted list or pair, there is no need to quote anymore. The -following is a pair and a list of symbols respectively. +following is a pair of symbols, a list of symbols and a list of lists +respectively, + @example #'(stem . head) #'(staff clef key-signature) + #'((1) (2)) @end example +@node Context +@section Context + +When music is printed, a lot of things notation elements must be added +to the input, which is often bare bones. For example, compare the +input and output of the following example + +@lilypond[verbatim,relative=2] + cis4 cis2. g4 +@end lilypond + +The input is rather sparse, but in the output, bar lines, accidentals, +clef and time signature are added. LilyPond @emph{interprets} the +input. During this step, the musical information is inspected in time +order, similar to reading a score from left to right. While reading, +the program remembers where measure boundaries are, and what pitches +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. + @menu -* Inline Scheme:: +* Changing context properties on the fly :: +* context property defaults :: +* which properties to change:: @end menu -@node Inline Scheme -@subsection Inline Scheme +@node Changing context properties on the fly +@subsection Changing context properties on the fly -Scheme expressions can be entered in the input file by entering a -hash-sign (@code{#}). The expression following the hash-sign is -evaluated as Scheme. For example, the boolean value @var{true} is -@code{#t} in Scheme, so for LilyPond @var{true} looks like @code{##t}, -and can be used in property assignments: -@example - \set Staff.autoBeaming = ##f -@end example +Such variables 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} +@end quotation -@node Setting variables -@section Setting variables +For example, +@lilypond[verbatim,relative=2] + R1*2 + \set Score.skipBars = ##t + R1*2 +@end lilypond -When the music is converted from notes to print it is interpreted -in left-to-right order. This is similar to what happens when we read -music. During this step context-sensitive information such as the -accidentals to print, and where bar lines must be placed, are stored in -variables. These variables are called @emph{context properties}. -The properties can also be manipulated from input files. Consider this input: -@example -\set Staff.autoBeaming = ##f -@end example +This command skips measures that have no notes. The result is that +multi rests are condensed. The value assigned is a Scheme object. In +this case, it is @code{#t}, the boolean True value. -@noindent -It sets the property named @code{autoBeaming} in the current staff at -this point in the music to @code{##f}, which means `false'. This -property controls whether beams are printed automatically: -@c -@lilypond[relative=1,fragment,verbatim] +If the @var{context} argument is left out, then the current +bottom-most context (typically ChordNames, Voice or Lyrics) is used. +In this example, + +@lilypond[verbatim,relative=2] + c8 c c c + \set autoBeaming = ##f c8 c c c - \set Staff.autoBeaming = ##f - c8 c c c @end lilypond @noindent -LilyPond includes a built-in programming language, namely, a dialect -of Scheme. The argument to @code{\set}, @code{##f}, is an -expression in that language. The first hash-mark signals that a piece -of Scheme code follows. The second hash character is part of the -boolean value true (@code{#t}). Values of other types may be -entered as follows: -@itemize @bullet -@item a string, enclosed in double quotes, for example, -@example - \set Staff.instrument = #"French Horn" -@end example -@item a boolean: either @code{#t} or @code{#f}, for true and false -respectively, e.g. -@example - \set autoBeaming = ##f - \set Score.skipBars = ##t -@end example +the @var{context} argument to @code{\set} is left out, and the current +@internalsref{Voice} is used. Contexts are hierarchical, so if a +bigger context was specified, for example @code{Staff}, then the +change would apply to all Voices in the current stave. -@item a number, such as -@example - \set Score.currentBarNumber = #20 -@end example +There is also an @code{\unset} command, +@quotation + @code{\set }[@var{context}]@code{.}@var{prop} +@end quotation + +@noindent +which removes the definition of @var{prop}. This command only removes +definitions set in +@var{context}. in -@item a symbol, which is introduced by a quote character, as in @example - \set Staff.crescendoSpanner = #'dashed-line + \set staff.autobeaming = ##f + \unset voice.autobeaming @end example -@item a pair, which is also introduced by a quote character, like in -the following statements, which set properties to the pairs (-7.5, 6) -and (3, 4) respectively: +@noindent +the current voice does not have the property, and the definition at +staff level remains intact. -@example - \set Staff.minimumVerticalExtent = #'(-7.5 . 6) - \set Staff.timeSignatureFraction = #'(3 . 4) -@end example +@node context property defaults +@subsection context property defaults -@item a list, which is also introduced by a quote character. In the -following example, the @code{breakAlignOrder} property is set to a -list of symbols: -@example - \set Score.breakAlignOrder = - #'(left-edge time-signature key-signatures) -@end example -@end itemize +@node which properties to change +@subsection which properties to change + There are many different properties. Not all of them are listed in this manual. However, the program reference lists them all in the diff --git a/THANKS b/THANKS index f1b6588dff..5662f687c0 100644 --- a/THANKS +++ b/THANKS @@ -21,6 +21,7 @@ Dave Symonds David Bobroff Darius Delma Avers +Doug Linhardt Edward Sanford Sutton Eric Wurbel Erik Sandberg diff --git a/VERSION b/VERSION index 11e9092e69..b5127802c3 100644 --- a/VERSION +++ b/VERSION @@ -2,5 +2,5 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=1 PATCH_LEVEL=31 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=hwn1 diff --git a/input/test/title-markup.ly b/input/test/title-markup.ly index a1b999f0cd..17ce4ee7e4 100644 --- a/input/test/title-markup.ly +++ b/input/test/title-markup.ly @@ -78,7 +78,7 @@ spaceTest = \markup { "two space chars" } \score { \context Staff \notes \relative c' { - \repeat unfold 35 { a b c d \break } + \repeat unfold 135 { a b c d \break } c1 } } diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index 51c95b99c5..52b5c13e02 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -439,7 +439,13 @@ Accidental_engraver::acknowledge_grob (Grob_info info) if (note && note->is_mus_type ("note-event") && Rhythmic_head::has_interface (info.grob_) - && !gh_equal_p (info.grob_->get_property ("style"), ly_symbol2scm ("harmonic")) +#if 0 + /* + todo: make tunable. + */ + && !gh_equal_p (info.grob_->get_property ("style"), + ly_symbol2scm ("harmonic")) +#endif ) { Accidental_entry entry ; diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc index ad5d5437b1..69b2d890bb 100644 --- a/lily/auto-change-iterator.cc +++ b/lily/auto-change-iterator.cc @@ -28,6 +28,7 @@ private: SCM split_list_; Direction where_dir_; void change_to (Music_iterator* , SCM, String); + Moment start_moment_; }; @@ -93,9 +94,10 @@ Auto_change_iterator::process (Moment m) for (; gh_pair_p (split_list_); split_list_ = gh_cdr (split_list_)) { splitm = unsmob_moment (gh_caar (split_list_)); - if (*splitm > now) + if ((*splitm + start_moment_) > now) break ; + *splitm += start_moment_; SCM tag = gh_cdar (split_list_); Direction d = to_dir (tag); @@ -121,6 +123,7 @@ Auto_change_iterator::construct_children () { Music_wrapper_iterator::construct_children (); split_list_ = get_music ()->get_property ("split-list"); + start_moment_ = get_outlet ()->now_mom (); } IMPLEMENT_CTOR_CALLBACK (Auto_change_iterator); diff --git a/lily/duration.cc b/lily/duration.cc index 06149d48b6..a85bf11093 100644 --- a/lily/duration.cc +++ b/lily/duration.cc @@ -220,13 +220,6 @@ LY_DEFINE (compression_factor, "ly:duration-factor", return gh_cons (gh_int2scm (r.num ()), gh_int2scm (r.den ())); } -SCM -Duration::smobbed_copy () const -{ - Duration *p = new Duration (*this); - return p->smobbed_self (); -} - int Duration::duration_log () const { diff --git a/lily/global-context.cc b/lily/global-context.cc index 5c273a1893..53d60a549d 100644 --- a/lily/global-context.cc +++ b/lily/global-context.cc @@ -127,6 +127,16 @@ Global_context::run_iterator_on_me (Music_iterator * iter) if (w.main_part_.is_infinity ()) break ; + if (first) + { + /* + Need this to get grace notes at start of a piece correct. + */ + first = false; + set_property ("measurePosition", w.smobbed_copy ()); + } + + prepare (w); if (iter->ok ()) @@ -148,7 +158,6 @@ Global_context::run_iterator_on_me (Music_iterator * iter) } one_time_step (); - first = false; } } diff --git a/lily/global-translator.cc b/lily/global-translator.cc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/include/duration.hh b/lily/include/duration.hh index e20e28a5c8..6d8667febb 100644 --- a/lily/include/duration.hh +++ b/lily/include/duration.hh @@ -32,7 +32,6 @@ public: static int compare (Duration const&, Duration const&); - SCM smobbed_copy () const; DECLARE_SCHEME_CALLBACK (less_p, (SCM a, SCM b)); DECLARE_SIMPLE_SMOBS (Duration,); diff --git a/lily/include/ly-smobs.icc b/lily/include/ly-smobs.icc index 3875b2c4a1..7e93c837f3 100644 --- a/lily/include/ly-smobs.icc +++ b/lily/include/ly-smobs.icc @@ -31,7 +31,7 @@ ADD_SCM_INIT_FUNC (init_type_ ## CL, init_type_ ## CL) -#define IMPLEMENT_SIMPLE_SMOBS(CL) \ +#define IMPLEMENT_BASE_SMOBS(CL) \ scm_t_bits CL::smob_tag_; \ SCM \ CL::smob_p (SCM s) \ @@ -51,14 +51,6 @@ CL::init_smobs () \ scm_set_smob_print (smob_tag_, CL::print_smob); \ scm_set_smob_equalp (smob_tag_, CL::equal_p); \ } \ -SCM CL::smobbed_self () const \ -{ \ - SCM s; \ - s = gh_cons (SCM_PACK (CL::smob_tag_), SCM_PACK (this)); \ - scm_gc_register_collectable_memory ((CL*)this, sizeof (CL), #CL " smob"); \ - \ - return s; \ -} \ size_t \ CL::free_smob (SCM ses) \ { \ @@ -69,8 +61,22 @@ CL::free_smob (SCM ses) \ }\ ADD_SCM_INIT_FUNC (CL, CL::init_smobs) + +#define IMPLEMENT_SIMPLE_SMOBS(CL) \ +IMPLEMENT_BASE_SMOBS(CL);\ +SCM CL::smobbed_copy () const \ +{ \ + CL * ptr = new CL (*this);\ + SCM s; \ + s = gh_cons (SCM_PACK (CL::smob_tag_), SCM_PACK (ptr)); \ + scm_gc_register_collectable_memory ((CL*)this, sizeof (CL), #CL " smob"); \ + \ + return s; \ +} \ + + #define IMPLEMENT_SMOBS(CL) \ -IMPLEMENT_SIMPLE_SMOBS (CL) \ +IMPLEMENT_BASE_SMOBS (CL) \ SCM \ CL::smobify_self () \ { \ diff --git a/lily/include/moment.hh b/lily/include/moment.hh index 1cfd6a88ec..b735ce4c4d 100644 --- a/lily/include/moment.hh +++ b/lily/include/moment.hh @@ -46,7 +46,6 @@ public: /* Deliver a copy of THIS as a smobified SCM */ - SCM smobbed_copy () const; String to_string () const; static int compare (Moment const&, Moment const&); diff --git a/lily/include/music-output-def.hh b/lily/include/music-output-def.hh index 9bab78f80f..53c9bdcf65 100644 --- a/lily/include/music-output-def.hh +++ b/lily/include/music-output-def.hh @@ -15,15 +15,17 @@ #include "lily-guile.hh" #include "virtual-methods.hh" #include "smobs.hh" +#include "input.hh" /** Definition of how to output lilypond. */ -class Music_output_def +class Music_output_def { public: Scheme_hash_table * translator_tab_; - + Input input_origin_; + SCM scope_; SCM scaled_fonts_; diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 06b9761e79..71f0ad1cce 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -65,8 +65,6 @@ public: /* JUNKME */ Real get_realvar (SCM symbol) const; - SCM smobbed_copy () const; - friend int yyparse (void*); }; diff --git a/lily/include/paper-line.hh b/lily/include/paper-line.hh index 6dd51fa630..d0372d04fc 100644 --- a/lily/include/paper-line.hh +++ b/lily/include/paper-line.hh @@ -17,13 +17,12 @@ class Paper_line SCM stencils_; Offset dim_; bool is_title_; - DECLARE_SIMPLE_SMOBS (Paper_line,); + DECLARE_SMOBS (Paper_line,); public: Paper_line (Offset, SCM, bool = true); Offset dim () const; - SCM smobbed_copy () const; SCM stencils () const; bool is_title () const; }; diff --git a/lily/include/pitch.hh b/lily/include/pitch.hh index 8a7f276aba..db31415fad 100644 --- a/lily/include/pitch.hh +++ b/lily/include/pitch.hh @@ -61,7 +61,6 @@ public: int quartertone_pitch () const; String to_string () const; - SCM smobbed_copy () const; DECLARE_SCHEME_CALLBACK (less_p, (SCM a, SCM b)); DECLARE_SIMPLE_SMOBS (Pitch,); }; diff --git a/lily/include/smobs.hh b/lily/include/smobs.hh index c0155ee1fd..c9e96ae34a 100644 --- a/lily/include/smobs.hh +++ b/lily/include/smobs.hh @@ -100,9 +100,13 @@ */ #define DECLARE_SIMPLE_SMOBS(CL,dummy) \ -protected: \ +public: \ + SCM smobbed_copy () const; \ +DECLARE_BASE_SMOBS(CL) + + +#define DECLARE_BASE_SMOBS(CL) \ friend class Non_existant_class ; \ - SCM smobbed_self () const; \ private:\ static scm_t_bits smob_tag_; \ static SCM mark_smob (SCM); \ @@ -122,7 +126,7 @@ private: #define DECLARE_SMOBS(CL,dummy) \ - DECLARE_SIMPLE_SMOBS (CL,dammy) \ + DECLARE_BASE_SMOBS (CL) \ protected:\ virtual ~CL ();\ SCM unprotected_smobify_self ();\ diff --git a/lily/include/spring.hh b/lily/include/spring.hh index 951f61f29d..0decf664f7 100644 --- a/lily/include/spring.hh +++ b/lily/include/spring.hh @@ -23,7 +23,6 @@ struct Spring_smob DECLARE_SIMPLE_SMOBS(Spring_smob,dummy); public: - SCM smobbed_copy () const; Spring_smob(); }; DECLARE_UNSMOB(Spring_smob, spring); diff --git a/lily/include/stencil.hh b/lily/include/stencil.hh index 8f10fd6ba3..41f495e998 100644 --- a/lily/include/stencil.hh +++ b/lily/include/stencil.hh @@ -53,7 +53,6 @@ public: Stencil (); Offset origin () const; - SCM smobbed_copy () const; SCM get_expr () const; /** diff --git a/lily/moment.cc b/lily/moment.cc index 03bd7df4e1..57fc8b6535 100644 --- a/lily/moment.cc +++ b/lily/moment.cc @@ -23,12 +23,6 @@ Moment::mark_smob (SCM) } -SCM -Moment::smobbed_copy () const -{ - Moment * m = new Moment (*this); - return m->smobbed_self (); -} int diff --git a/lily/note-collision.cc b/lily/note-collision.cc index 1432c27564..3da3de58c9 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -71,6 +71,13 @@ check_meshing_chords (Grob *me, // FIXME: what's this? bool merge_possible = (ups[0] >= dps[0]) && (ups.top () >= dps.top ()); + + + /* Do not merge notes typeset in different style. */ + if ( !gh_equal_p (nu->get_property ("style"), + nd->get_property ("style") ) ) + merge_possible = false; + int upball_type = Note_head::get_balltype (nu); int dnball_type = Note_head::get_balltype (nd); diff --git a/lily/paper-book.cc b/lily/paper-book.cc index 83653b6804..edb4396d2d 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -29,8 +29,8 @@ stencil2line (Stencil* stil, bool is_title = false) z = scm_permanent_object (ly_offset2scm (Offset (0, 0))); Offset dim = Offset (stil->extent (X_AXIS).length (), stil->extent (Y_AXIS).length ()); - Paper_line pl (dim, scm_cons (stil->smobbed_copy (), SCM_EOL), is_title); - return pl.smobbed_copy (); + Paper_line * pl = new Paper_line (dim, scm_cons (stil->smobbed_copy (), SCM_EOL), is_title); + return pl->self_scm (); } /* Simplistic page interface */ @@ -100,13 +100,13 @@ Page::Page (Paper_def *paper, int number) SCM make_header = scm_primitive_eval (ly_symbol2scm ("make-header")); SCM make_footer = scm_primitive_eval (ly_symbol2scm ("make-footer")); - header_ = scm_call_2 (make_header, paper_->smobbed_copy (), + header_ = scm_call_2 (make_header, paper_->self_scm (), scm_int2num (number_)); // FIXME: why does this (generates Stencil) not trigger font load? if (get_header ()) get_header ()->align_to (Y_AXIS, UP); - footer_ = scm_call_2 (make_footer, paper_->smobbed_copy (), + footer_ = scm_call_2 (make_footer, paper_->self_scm (), scm_int2num (number_)); if (get_footer ()) get_footer ()->align_to (Y_AXIS, UP); @@ -284,14 +284,14 @@ Paper_book::init () SCM scopes = get_scopes (0); SCM make_tagline = scm_primitive_eval (ly_symbol2scm ("make-tagline")); - tagline_ = scm_call_2 (make_tagline, paper->smobbed_copy (), scopes); + tagline_ = scm_call_2 (make_tagline, paper->self_scm (), scopes); Real tag_height = 0; if (Stencil *s = unsmob_stencil (tagline_)) tag_height = s->extent (Y_AXIS).length (); height_ += tag_height; SCM make_copyright = scm_primitive_eval (ly_symbol2scm ("make-copyright")); - copyright_ = scm_call_2 (make_copyright, paper->smobbed_copy (), scopes); + copyright_ = scm_call_2 (make_copyright, paper->self_scm (), scopes); Real copy_height = 0; if (Stencil *s = unsmob_stencil (copyright_)) copy_height = s->extent (Y_AXIS).length (); diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 198cd00e6e..fec208899a 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -149,11 +149,4 @@ unsmob_paper (SCM x) { return dynamic_cast (unsmob_music_output_def (x)); } - -SCM -Paper_def::smobbed_copy () const -{ - Paper_def *p = new Paper_def (*this); - return p->smobbed_self (); -} diff --git a/lily/paper-line.cc b/lily/paper-line.cc index e4da3cb548..38572f48b7 100644 --- a/lily/paper-line.cc +++ b/lily/paper-line.cc @@ -14,6 +14,7 @@ Paper_line::Paper_line (Offset o, SCM stencils, bool is_title) dim_ = o; stencils_ = stencils; is_title_ = is_title; + smobify_self (); } Offset @@ -49,13 +50,10 @@ Paper_line::print_smob (SCM, SCM port, scm_print_state*) return 1; } -SCM -Paper_line::smobbed_copy () const +Paper_line::~Paper_line () { - Paper_line *line = new Paper_line (*this); - return line->smobbed_self (); } -IMPLEMENT_SIMPLE_SMOBS (Paper_line); +IMPLEMENT_SMOBS (Paper_line); IMPLEMENT_TYPE_P (Paper_line, "ly:paper-line?"); IMPLEMENT_DEFAULT_EQUAL_P (Paper_line); diff --git a/lily/parser.yy b/lily/parser.yy index ef4ee30632..2760ec2ae6 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -684,12 +684,15 @@ music_output_def_head: music_output_def_body: - music_output_def_head '{' { + music_output_def_head '{' { + $$ = $1; + $$->input_origin_. set_spot (THIS->here_input ()); } | music_output_def_head '{' MUSIC_OUTPUT_DEF_IDENTIFIER { scm_gc_unprotect_object ($1->self_scm ()); Music_output_def * o = unsmob_music_output_def ($3); + o->input_origin_.set_spot (THIS->here_input ()); $$ = o; THIS->lexer_->remove_scope (); THIS->lexer_->add_scope (o->scope_); diff --git a/lily/pitch.cc b/lily/pitch.cc index 415adef5b9..1867a0b532 100644 --- a/lily/pitch.cc +++ b/lily/pitch.cc @@ -396,12 +396,6 @@ LY_DEFINE (ly_pitch_diff, "ly:pitch-diff", return interval (*r, *p).smobbed_copy (); } -SCM -Pitch::smobbed_copy ()const -{ - Pitch *p = new Pitch (*this); - return p->smobbed_self (); -} int Pitch::get_octave ()const diff --git a/lily/spring-smob.cc b/lily/spring-smob.cc index 502fc13f71..591953b035 100644 --- a/lily/spring-smob.cc +++ b/lily/spring-smob.cc @@ -39,9 +39,3 @@ Spring_smob::equal_p (SCM a , SCM b) return a==b? SCM_BOOL_T : SCM_BOOL_F; } -SCM -Spring_smob::smobbed_copy ()const -{ - Spring_smob * p = new Spring_smob (*this); - return p->smobbed_self (); -} diff --git a/lily/stencil.cc b/lily/stencil.cc index 1a6f21e104..fade2d75ea 100644 --- a/lily/stencil.cc +++ b/lily/stencil.cc @@ -18,12 +18,6 @@ #include "ly-smobs.icc" -SCM -Stencil::smobbed_copy () const -{ - Stencil *s = new Stencil (*this); - return s->smobbed_self (); -} Offset Stencil::origin () const diff --git a/lily/system.cc b/lily/system.cc index 0434a75fcd..42285df913 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -430,8 +430,8 @@ System::get_line () Interval x (extent (this, X_AXIS)); Interval y (extent (this, Y_AXIS)); - Paper_line pl (Offset (x.length (), y.length ()), stencils); - return pl.smobbed_copy (); + Paper_line *pl = new Paper_line (Offset (x.length (), y.length ()), stencils); + return pl->self_scm (); } Link_array diff --git a/lily/timing-translator.cc b/lily/timing-translator.cc index 85bffc00b6..6c79df5455 100644 --- a/lily/timing-translator.cc +++ b/lily/timing-translator.cc @@ -55,7 +55,10 @@ Timing_translator::initialize () daddy_context_->set_property ("timeSignatureFraction", gh_cons (gh_int2scm (4), gh_int2scm (4))); - daddy_context_->set_property ("measurePosition", Moment (Rational (0)).smobbed_copy ()); + /* + Do not init measurePosition; this should be done from global + context. + */ daddy_context_->set_property ("measureLength", Moment (Rational (1)).smobbed_copy ()); daddy_context_->set_property ("beatLength", Moment (Rational (1,4)).smobbed_copy ()); } diff --git a/scm/lily.scm b/scm/lily.scm index cc54d9c961..6cdc3656c8 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -7,7 +7,7 @@ ;;; Library functions - +(set-debug-cell-accesses! #t) (use-modules (ice-9 regex) (ice-9 safe) (oop goops) @@ -371,9 +371,17 @@ L1 is copied, L2 not. (scm output-sodipodi) (scm output-pdftex)) + +(define output-tex-module + (make-module 1021 (list (resolve-interface '(scm new-output-tex))))) + +(define (new-tex-output-expression expr port) + (display (eval expr output-tex-module) port)) + (define output-alist `( ("tex" . ("TeX output. The default output form." ,tex-output-expression)) + ("safetex" . ("TeX output. The default output form." ,new-tex-output-expression)) ("scm" . ("Scheme dump: debug scheme stencil expressions" ,write)) ("sketch" . ("Bare bones Sketch output." ,sketch-output-expression)) ("sodipodi" . ("Bare bones Sodipodi output." ,sodipodi-output-expression)) diff --git a/scm/output-tex.scm b/scm/output-tex.scm index 41d48ef03b..afaa04021b 100644 --- a/scm/output-tex.scm +++ b/scm/output-tex.scm @@ -28,6 +28,7 @@ (display (eval expr output-ps) port)) ;;; Output interface entry + (define-public (tex-output-expression expr port) (display (eval expr this-module) port ))