* lily/paper-score.cc (process): dump header only once.
* lily/paper-outputter.cc (Paper_outputter): move logic into
Scheme.
* scm/output-tex.scm (output-scopes): new function.
(output-paper-def): new function
(tex-string-def): new function
(symbol->tex-key): new function
+2004-02-19 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * scm/output-tex.scm (output-scopes): don't dump fraction exactly.
+
+ * lily/paper-score.cc (process): dump header only once.
+
+ * lily/paper-outputter.cc (Paper_outputter): move logic into
+ Scheme.
+
+ * scm/output-tex.scm (output-scopes): new function.
+ (output-paper-def): new function
+ (tex-string-def): new function
+ (symbol->tex-key): new function
+
+ * scripts/convert-ly.py (conv): add rule for | ~
+
2004-02-19 Heikki Junes <hjunes@cc.hut.fi>
* input/regression/{many}.ly: refresh, trying to guess how
mkdir -p $(dir $@)
$(MAKEINFO) -I$(outdir) --output=$(outdir)/lilypond --html $<
$(MAKEINFO) -I$(outdir) --output=$@ --html --no-split --no-headers $<
+ sed -i 's!../lilypond-internals!lilypond-internals/!g' $(outdir)/lilypond.html
rm -f $(outdir)/lilypond/*.png $(outdir)/lilypond/*.ly
-ln -f $(outdir)/*.png $(outdir)/*.ly $(outdir)/lilypond/
@top GNU LilyPond --- The music typesetter
@c HJJ: Info needs `@top', which is a synonym for `@unnumbered' in TeX.
-This is the user manual for GNU LilyPond 2.1.0.
+This is the user manual for GNU LilyPond 2.1.x series.
+@ifhtml
+(See the bottom of this page for the exact version number).
+@end ifhtml
@cindex web site
In this manual: @ref{Automatic note splitting}.
-Internals: @internalsref{TieEvent}, @internalsref{NewTieEvent},
-@internalsref{Tie} @c
+Internals: @internalsref{TieEvent}, @internalsref{Tie}.
Examples: if you want less ties created for a chord, see
@inputfileref{input/test,tie-sparse.ly}.
MAJOR_VERSION=2
MINOR_VERSION=1
PATCH_LEVEL=25
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=hwn1
\score{
\notes\relative c''{
- \applyoutput #(outputproperty-compatibility (make-type-checker 'note-head-interface) 'extra-offset '(2 . 3))
- c2
- c
- \context Score {
- \applyoutput #(outputproperty-compatibility (make-type-checker 'mark-interface) 'extra-offset '(-1 . 4))
- }
- \mark A
- d1
- \mark \default
- e
+ \context Bottom
+ \applyoutput #(outputproperty-compatibility
+ (make-type-checker 'note-head-interface)
+ 'extra-offset '(2 . 3))
+ c2
+ c
+ \context Score {
+ \applyoutput #(outputproperty-compatibility (make-type-checker 'mark-interface) 'extra-offset '(-1 . 4))
+ }
+ \mark A
+ d1
+ \mark \default
+ e
}
\paper{
raggedright = ##t
\version "2.1.22"
-textFlat = \markup {\smaller \semiflat}
+textFlat = \markup {\smaller \flat}
\score {
\notes \new Staff {
#include "context.hh"
#include "protected-scm.hh"
-/**
-
-The algorithm for accidentals should be documented, and made
-tweakable.
-
-*/
struct Accidental_entry {
bool done_;
bool different = num < 0;
num = abs (num);
- /* see if there's a tie that "changes" the accidental */
- /* works because if there's a tie, the note to the left
- is of the same pitch as the actual note */
-
+ /* See if there's a tie that makes the accidental disappear */
Grob *tie_break_reminder = 0;
bool tie_changes = false;
for (int j = 0; j < ties_.size (); j++)
if (support == Tie::head (ties_[j], RIGHT))
{
tie_changes = different;
-
- /* Enable accidentals for broken tie
-
- We only want an accidental on a broken tie,
- if the tie changes the accidental.
-
- Maybe check property noTieBreakForceAccidental? */
if (different)
tie_break_reminder = ties_[j];
break;
a->set_grob_property ("accidentals", accs);
accidentals_[i].accidental_ = a;
- /*
- We add the accidentals to the support of the arpeggio, so it is put left of the
- accidentals.
-
- */
+
+ /*
+ We add the accidentals to the support of the arpeggio,
+ so it is put left of the accidentals.
+ */
for (int i = 0; i < left_objects_.size (); i++)
Side_position_interface::add_support (left_objects_[i], a);
for (int i = 0; i < right_objects_.size (); i++)
int a = pitch->get_alteration ();
SCM on_s = gh_cons (scm_int2num (o), scm_int2num (n));
- /*
- TODO: Speed this up!
-
- Perhaps only check translators mentioned in the auto-accidentals?
- -rz
-
- TODO: profile this.
-
- I'd be surprised if the impact of this would be
- measurable. Anyway, it seems localsig doesn't change
- every time-step, but a set_property() is done every
- time. We could save on that, probably.
-
- --hwn.
-
-
- */
-
while (origin)
{
+ /*
+ huh? we set props all the way to the top?
+ */
SCM localsig = origin->get_property ("localKeySignature");
+ bool change = false;
if (tie_changes)
{
/*
*/
localsig = ly_assoc_front_x
(localsig, on_s, gh_cons (SCM_BOOL_T, barnum));
+
+ change = true;
}
else
{
noteheads with the same notename.
*/
localsig = ly_assoc_front_x
- (localsig, on_s, gh_cons (scm_int2num (a), barnum));
+ (localsig, on_s, gh_cons (scm_int2num (a), barnum));
+
+ change = true;
}
- origin->set_property ("localKeySignature", localsig);
+
+ if (change)
+ origin->set_property ("localKeySignature", localsig);
origin = origin->daddy_context_;
}
}
void dump_scheme (SCM);
- void output_int_def (String k, int v);
- void output_Real_def (String k, Real v);
- void output_String_def (String k, String v);
- void output_scope (SCM, String prefix);
- void output_version ();
- void output_font_def (int i, String str);
- void output_font_switch (int i);
- void output_header ();
- void output_comment (String s);
- void output_string (SCM s);
+ void output_metadata (SCM);
+ void output_music_output_def (Music_output_def* odef);
void output_scheme (SCM scm);
-
- void write_header_field_to_file (String filename, SCM, SCM);
- void write_header_fields_to_file (SCM);
};
#endif // PAPER_OUTPUTTER_HH
#include "ly-modules.hh"
-
-/*
- TODO: this entire class should be implemented at Scheme level.
-
-
-
- */
Paper_outputter::Paper_outputter (String name)
{
if (safe_global_b)
file_ = scm_open_file (scm_makfrom0str (name.to_str0 ()),
scm_makfrom0str ("w"));
- /*
- ugh.
- */
- SCM exp = scm_list_n (ly_symbol2scm ("find-dumper"),
- scm_makfrom0str (output_format_global.to_str0 ()),
- SCM_UNDEFINED);
+ static SCM find_dumper;
+ if (!find_dumper)
+ find_dumper = scm_c_eval_string ("find-dumper");
- output_func_ = scm_primitive_eval (exp);
+
+ output_func_ = scm_call_1 (find_dumper,scm_makfrom0str (output_format_global.to_str0 ()));
+ output_scheme (gh_cons (ly_symbol2scm ("top-of-file"), SCM_EOL));
}
Paper_outputter::~Paper_outputter ()
file_ = SCM_EOL;
}
-
-/*
- TODO: move this to Scheme
- */
-void
-Paper_outputter::output_header ()
-{
- time_t t (time (0));
- String generate = ctime (&t);
- generate = generate.left_string (generate.length () - 1) + " " + *tzname;
-
- /* Fixed length time stamp */
- generate = generate + to_string (' ', (50 - generate.length ()) >? 0);
-
- /* Fixed length creator string */
- String creator = gnu_lilypond_version_string ();
- creator += " (http://lilypond.org)";
- creator = creator + to_string (' ', (50 - creator.length ()) >? 0);
-
- SCM args_scm = scm_list_n (scm_makfrom0str (creator.to_str0 ()),
- scm_makfrom0str (generate.to_str0 ()),
- SCM_UNDEFINED);
-
-
- SCM scm = gh_cons (ly_symbol2scm ("header"), args_scm);
-
- output_scheme (scm);
-}
-
-
-
-void
-Paper_outputter::output_comment (String str)
-{
- output_scheme (scm_list_n (ly_symbol2scm ("comment"),
- scm_makfrom0str ((char*)str.to_str0 ()),
- SCM_UNDEFINED)
- );
-}
-
void
Paper_outputter::output_scheme (SCM scm)
{
}
void
-Paper_outputter::output_scope (SCM mod, String prefix)
+Paper_outputter::output_metadata (SCM scopes)
{
- if (!SCM_MODULEP (mod))
- return ;
+ SCM fields = SCM_EOL;
+ for (int i = dump_header_fieldnames_global.size (); i--;)
+ fields = gh_cons (ly_symbol2scm (dump_header_fieldnames_global[i].to_str0 ()),
+ fields);
- SCM al = ly_module_to_alist (mod);
- for (SCM s = al ; gh_pair_p (s); s = ly_cdr (s))
- {
- SCM k = ly_caar (s);
- SCM v = ly_cdar (s);
- String s = ly_symbol2string (k);
-
- if (gh_string_p (v))
- {
- output_String_def (prefix + s, ly_scm2string (v));
- }
- else if (scm_integer_p (v) == SCM_BOOL_T && scm_exact_p (v) == SCM_BOOL_T)
- {
- output_int_def (prefix + s, gh_scm2int (v));
- }
- else if (gh_number_p (v))
- {
- output_Real_def (prefix + s, gh_scm2double (v));
- }
- }
-}
-
-void
-Paper_outputter::output_version ()
-{
- String id_string = "Engraved by LilyPond";
- id_string += String_convert::pad_to (String (", ") + version_string (), 40);
-
- output_String_def ("lilypondtagline", id_string);
- output_String_def ("LilyPondVersion", version_string ());
- output_String_def ("lilypondpaperunit", String (INTERNAL_UNIT));
-}
-
-
-void
-Paper_outputter::output_Real_def (String k, Real v)
-{
-
- SCM scm = scm_list_n (ly_symbol2scm ("lily-def"),
- scm_makfrom0str (k.get_str0 ()),
- scm_makfrom0str (to_string (v).get_str0 ()),
- SCM_UNDEFINED);
- output_scheme (scm);
-}
-
-void
-Paper_outputter::output_String_def (String k, String v)
-{
-
- SCM scm = scm_list_n (ly_symbol2scm ("lily-def"),
- scm_makfrom0str (k.get_str0 ()),
- scm_makfrom0str (v.get_str0 ()),
- SCM_UNDEFINED);
- output_scheme (scm);
-}
-
-void
-Paper_outputter::output_int_def (String k, int v)
-{
- SCM scm = scm_list_n (ly_symbol2scm ("lily-def"),
- scm_makfrom0str (k.get_str0 ()),
- scm_makfrom0str (to_string (v).get_str0 ()),
- SCM_UNDEFINED);
- output_scheme (scm);
-}
-
-void
-Paper_outputter::write_header_field_to_file (String filename, SCM key, SCM value)
-{
- output_scheme (scm_list_n (ly_symbol2scm ("header-to-file"),
- scm_makfrom0str (filename.to_str0 ()),
- ly_quote_scm (key), value,
+ output_scheme (scm_list_n (ly_symbol2scm ("output-scopes"),
+ scm_list_n (ly_symbol2scm ("quote"),
+ scopes, SCM_UNDEFINED),
+ scm_list_n (ly_symbol2scm ("quote"),
+ fields, SCM_UNDEFINED),
+ scm_makfrom0str (basename_.to_str0 ()),
SCM_UNDEFINED));
}
+
void
-Paper_outputter::write_header_fields_to_file (SCM mod)
+Paper_outputter::output_music_output_def (Music_output_def* odef)
{
- if (ly_module_p (mod)&&
- dump_header_fieldnames_global.size ())
- {
- SCM fields = ly_module_to_alist (mod);
- for (int i = 0; i < dump_header_fieldnames_global.size (); i++)
- {
- String key = dump_header_fieldnames_global[i];
- SCM val = gh_assoc (ly_symbol2scm (key.to_str0 ()), fields);
- String s;
- /* Only write header field to file if it exists */
- if (gh_pair_p (val) && gh_string_p (ly_cdr (val)))
- {
- s = ly_scm2string (ly_cdr (val));
- /* Always write header field file, even if string is empty ... */
- write_header_field_to_file (basename_ , ly_car (val), ly_cdr (val));
- }
- }
- }
+ output_scheme (scm_list_n (ly_symbol2scm ("output-paper-def"),
+ odef->self_scm (), SCM_UNDEFINED));
}
progress_indication (_ ("Preprocessing graphical objects...") + " ");
/*
- Be sure to set breakability on first & last column.
+ Check out why we need this - removing gives assertion failures
+ down the road.
*/
{ /* doubly, also done in Score_engraver */
Link_array<Grob> pc (system_->columns ());
pc[0]->set_grob_property ("breakable", SCM_BOOL_T);
pc.top ()->set_grob_property ("breakable", SCM_BOOL_T);
}
+
system_->pre_processing ();
Array<Column_x_positions> breaking = calc_breaking ();
system_->break_into_pieces (breaking);
outputter_ = paper_->get_paper_outputter (outname);
- outputter_->output_header ();
- outputter_->output_version ();
progress_indication ("\n");
- if (global_input_file->header_)
- {
- outputter_->output_scope (global_input_file->header_, "lilypond");
- outputter_->write_header_fields_to_file (global_input_file->header_);
- }
-
+ SCM scopes = SCM_EOL;
+
+ /*
+ Last one first.
+ */
if (header_)
{
- outputter_->output_scope (header_, "lilypond");
- outputter_->write_header_fields_to_file (header_);
+ scopes = scm_cons (header_, scopes);
}
- outputter_->output_scope (paper_->scope_, "lilypondpaper");
+ if (global_input_file->header_ && global_input_file->header_ != header_)
+ {
+ scopes = scm_cons (global_input_file->header_, scopes);
+ }
+
+ outputter_->output_metadata (scopes);
+ outputter_->output_music_output_def (paper_);
SCM scm = scm_list_n (ly_symbol2scm ("header-end"), SCM_UNDEFINED);
outputter_->output_scheme (scm);
SCM outname = scm_makfrom0str (p.to_string ().to_str0());
for (int i=0; i < sc->defs_.size (); i++)
- default_rendering (sc->music_, sc->defs_[i]->self_scm(),head, outname);
+ default_rendering (sc->music_, sc->defs_[i]->self_scm(), head, outname);
if (sc->defs_.is_empty ())
{
pt = #(/ in 72.27)
cm = #(* 10 mm)
- texsetting = ""
- pssetting = ""
- scmsetting = "(lilyponddefs.ps) findlibfile {exch pop //systemdict /run get exec} { /undefinedfilename signalerror } ifelse\n"% UGH.
-
-
#(define font-defaults
'((font-family . music)
(font-shape . upright)
%%
-%% above message is to compensate for look ahead of the parser.
+%% above and below message is to compensate for look ahead of the parser.
%%
#(if (and (ly:get-option 'old-relative)
(not (ly:get-option 'old-relative-used)))
(ly:warn (string-append
"\n"
- input-file-name ": old relative compatibility was not used.")))
+ input-file-name ": old relative compatibility was not used."
+ )))% there is a problem at the end of the input file
+
#(if (ly:get-option 'verbose)
(ice-9 string-fun)
(ice-9 format)
(guile)
+ (srfi srfi-13)
(lily)
)
(define (unknown)
"%\n\\unknown\n")
+(define (symbol->tex-key sym)
+ (regexp-substitute/global
+ #f "_" (output-tex-string (symbol->string sym)) 'pre "X" 'post) )
+
+(define (tex-string-def prefix key str)
+ (if (equal? "" (sans-surrounding-whitespace (output-tex-string str)))
+ (string-append "\\let\\" prefix (symbol->tex-key key) "\\undefined%\n")
+ (string-append "\\def\\" prefix (symbol->tex-key key) "{" (output-tex-string str) "}%\n")
+ ))
+
+(define (output-paper-def pd)
+ (apply
+ string-append
+ (module-map
+ (lambda (sym var)
+ (let
+ ((val (variable-ref var))
+ (key (symbol->tex-key sym))
+ )
+
+ (cond
+ ((string? val)
+ (tex-string-def "lilypondpaper" sym val))
+ ((number? val)
+ (string-append "\\def\\lilypondpaper" key "{"
+ (if (integer? val)
+ (number->string val)
+ (number->string (exact->inexact val)))
+ "}%\n"))
+ (else ""))
+ ))
+
+ (ly:output-def-scope pd))
+ ))
+
+(define (output-scopes scopes fields basename)
+ (define (output-scope scope)
+ (apply
+ string-append
+ (module-map
+ (lambda (sym var)
+ (let
+ ((val (variable-ref var))
+ (tex-key (symbol->string sym))
+ )
+
+ (cond
+ ((memq sym fields)
+ (header-to-file basename sym val))
+ ((string? val)
+ (tex-string-def "lilypond" sym val) )
+ ((number? val)
+ (string-append "\\def\\" tex-key "{"
+ (if (integer? val)
+ (number->string val)
+ (number->string (exact->inexact val)))
+ "}"))
+ (else "") )
+
+ ))
+ scope)
+ ))
+
+ (apply string-append
+ (map output-scope scopes)) )
+
+
(define (select-font name-mag-pair)
(let*
(
(string-append "\\" (cddr c)))))
+(define (top-of-file)
+ (comment
+ (string-append
+ "generated by LilyPond "
+ (lilypond-version) " (http://lilypond.org)." )
+ ))
+
(define (blank)
"")