]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/output-tex.scm (output-scopes): don't dump fraction exactly.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 19 Feb 2004 20:01:33 +0000 (20:01 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 19 Feb 2004 20:01:33 +0000 (20:01 +0000)
* 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

15 files changed:
ChangeLog
Documentation/user/GNUmakefile
Documentation/user/lilypond.tely
Documentation/user/refman.itely
VERSION
input/regression/generic-output-property.ly
input/regression/instrument-name-markup.ly
lily/accidental-engraver.cc
lily/include/paper-outputter.hh
lily/paper-outputter.cc
lily/paper-score.cc
lily/parser.yy
ly/declarations-init.ly
ly/init.ly
scm/output-tex.scm

index e11510c82765cc40fbba050870afe40a47df6f54..4791a61dad9afe0b9c805900c574cf07d833707b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+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
index 09192b7e5a73f6caebee8dd6e0b469e798354b22..a9a3c97fa28e4b51a322505f447f865d111b5fb2 100644 (file)
@@ -68,6 +68,7 @@ $(outdir)/lilypond/lilypond.html: $(outdir)/lilypond.texi
        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/
 
index 3166eaa8c57b13cdd4b38f8c66f8e3c0a109f02b..8ca8673cfffe5ccc9420f2a507b38039773defd3 100644 (file)
@@ -130,7 +130,10 @@ Copyright 1999--2004 by the authors
 @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
 
index a31f1cabce3ee59869b101777ff1c8eabde49736..dad049a9051370a5e8b5477af534684ea4a20499 100644 (file)
@@ -429,8 +429,7 @@ note splitting (see @ref{Automatic note splitting}).
 
 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}.
diff --git a/VERSION b/VERSION
index eda89cd94b3f67374ac7204ccfb384b1c4406034..c753c9b86e21bd4f0b92fe2b9444742131cf0610 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,5 +2,5 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=1
 PATCH_LEVEL=25
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=hwn1
 
index 92f14fe7292c7240f37f963fb9fe5db27c96593a..95a4fdbf374ce8fc1e1eaa578053da9bee0a5a69 100644 (file)
@@ -10,16 +10,19 @@ setting the @code{extra-offset} of a grob.
 
 \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
index ffd694df1e33a61f91787819e2984d82c67b7ebf..4fb745ddaaa1d9e342c1612d2d9359151e57ce4e 100644 (file)
@@ -10,7 +10,7 @@ including alterations. "
 \version "2.1.22"
 
 
-textFlat = \markup {\smaller \semiflat}
+textFlat = \markup {\smaller \flat}
 
 \score {
   \notes \new Staff {
index 7b24e37cde3ea8ea75aae8a2682fa15b506071bd..e63c0354ac6f89b543e69d705453d93db9614562 100644 (file)
 #include "context.hh"
 #include "protected-scm.hh"
 
-/**
-
-The algorithm for accidentals should be documented, and made
-tweakable.
-
-*/
 
 struct Accidental_entry {
   bool done_;
@@ -259,23 +253,13 @@ Accidental_engraver::process_acknowledged_grobs ()
          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;
@@ -327,11 +311,11 @@ Accidental_engraver::process_acknowledged_grobs ()
 
              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++)
@@ -353,27 +337,13 @@ Accidental_engraver::process_acknowledged_grobs ()
          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)
                {
                  /*
@@ -382,6 +352,8 @@ Accidental_engraver::process_acknowledged_grobs ()
                  */
                  localsig = ly_assoc_front_x
                    (localsig, on_s, gh_cons (SCM_BOOL_T, barnum));
+
+                 change = true;
                }
              else
                {
@@ -390,9 +362,13 @@ Accidental_engraver::process_acknowledged_grobs ()
                    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_;
            }
        }
index 0f8ef616f6451e438e78827fa3d8dc6382310c21..14d357664e30bb636b2ed3d8c6c2311c5b3b52ba 100644 (file)
@@ -38,20 +38,9 @@ public:
   
   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
index a504341828d3342d87d5c3278e32d3109f8b8e31..561c830387d5bda41d73c3fe6ae8346f3fda849d 100644 (file)
 #include "ly-modules.hh"
 
 
-
-/*
-  TODO: this entire class should be implemented at Scheme level.
-
-
-  
- */
 Paper_outputter::Paper_outputter (String name)
 {
   if (safe_global_b)
@@ -43,14 +36,13 @@ Paper_outputter::Paper_outputter (String name)
   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 ()
@@ -59,46 +51,6 @@ 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)
 {
@@ -106,105 +58,26 @@ 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));
 }
index 31f2dd7a63c7d359df817c53a01faa1e93ce4663..202a16080a9db668d5c78162e25dbcb3546d6601 100644 (file)
@@ -81,7 +81,8 @@ Paper_score::process (String outname)
   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 ());
@@ -89,30 +90,33 @@ Paper_score::process (String outname)
     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);
index a7ba07ef8b49c299090f2594e3a39767ef163890..99d5e8feb4dcce8f49771cbe52e0bbfdd004c16c 100644 (file)
@@ -437,7 +437,7 @@ toplevel_expression:
                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 ())
                {
index 736fef3a87820b14ecc63d5b7a42837d23afb409..69510dbb9d07ab4fedf41fab98400b64c2ba8d5a 100644 (file)
@@ -49,11 +49,6 @@ melismaEnd = #(make-span-event 'ManualMelismaEvent STOP)
     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)
index 5894ad2c709978e1e95eea9b6e4554da0b806ba1..0b9331dd196e9864633761cf3751e3a22b248d99 100644 (file)
 
 
 %%
-%% 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)
index 2128cec4fe592babcd9fbc6840e75d1d96689624..b1b289fdc9c3701348bc1bed9c2a960982007760 100644 (file)
@@ -13,6 +13,7 @@
             (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)
   "")