From a84a28ec141e048ce6b53eaa688dbbe9aadea3bb Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 6 Nov 1998 00:10:46 +0100 Subject: [PATCH] patch::: 1.1.2.hwn1 pl 2.hwn1 - scm cleanups, chop-decimal - scarlatti clef. --- Generated by hanwen@cs.uu.nl using package-diff 0.62, From = lilypond-1.1.2, To = lilypond-1.1.2.hwn1 usage cd lilypond-source-dir; patch -E -p1 < lilypond-1.1.2.hwn1.diff Patches do not contain automatically generated files or (urg) empty directories, i.e., you should rerun autoconf, configure and possibly make outdirs. --state 1.1.2 1.1.2.hwn1 ++state --- Documentation/topdocs/README.yo | 2 +- NEWS | 16 +- VERSION | 2 +- flower/file-path.cc | 13 + flower/include/file-path.hh | 1 + init/engraver.ly | 4 +- init/lily.scm | 4 +- init/lily.scm.orig | 432 ++++++++++++++++++++++++++++++++ lily/clef-engraver.cc | 159 ++++++------ lily/clef-item.cc | 15 +- lily/include/clef-engraver.hh | 2 +- lily/include/clef-item.hh | 1 - lily/include/lily-guile.hh | 19 +- lily/include/protected-scm.hh | 2 +- lily/lily-guile.cc | 19 +- lily/lookup.cc | 84 ++++--- lily/paper-outputter.cc | 34 +-- mf/feta-klef.mf | 4 +- 18 files changed, 638 insertions(+), 175 deletions(-) create mode 100644 init/lily.scm.orig diff --git a/Documentation/topdocs/README.yo b/Documentation/topdocs/README.yo index 972df8af78..39b6dc56e3 100644 --- a/Documentation/topdocs/README.yo +++ b/Documentation/topdocs/README.yo @@ -68,7 +68,7 @@ criticism, comments, bugreports, patches, etc. and not to us personally. See file(Documentation/links.yo) for more info. -sect(DOZE) +sect(WINDOWS 32) If you have received this file as part of a DOS/Window32 distribution (package()-*.zip), then it is advisable to also download the source diff --git a/NEWS b/NEWS index 2c48432d46..b15d3c5308 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,18 @@ -pl 2.jcn2 +--- ../lilypond-1.1.2/NEWS Thu Nov 5 20:51:37 1998 +++ b/NEWS Fri Nov 6 00:10:46 1998 +@@ -1,6 +1,11 @@ +pl 2.hwn1 + - scm cleanups, chop-decimal + - scarlatti clef. + + + pl 1.mb1 + - Support for cautionary accidentals. , i.e. accidentals +- within parantheses. Syntax: 'cis?'. Try input/test/accid.fly + within parentheses. Syntax: 'cis?'. Try input/test/accid.fly + Note that the font has changed. + - bf: No unnecessary warnings about time signatures + - Added optional second argument of \key. Set to \major or \minor pl 2.jcn2 pl 2.jcn1 - commented-out Level-2 PostScript in lily.ps (J. Buehler) diff --git a/VERSION b/VERSION index b367271202..41a2aa4d95 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 PATCH_LEVEL=2 -MY_PATCH_LEVEL=jcn2 +MY_PATCH_LEVEL=hwn1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/flower/file-path.cc b/flower/file-path.cc index 89c05dfb16..61dbd64e9b 100644 --- a/flower/file-path.cc +++ b/flower/file-path.cc @@ -113,3 +113,16 @@ File_path::add (String s) { push (s); } + +String +File_path::str () const +{ + String s; + for (int i=0; i< size (); i++) + { + s = s + elem (i); + if (i < size () -1 ) + s += ":"; + } + return s; +} diff --git a/flower/include/file-path.hh b/flower/include/file-path.hh index d5fed491ff..69fd062c72 100644 --- a/flower/include/file-path.hh +++ b/flower/include/file-path.hh @@ -31,6 +31,7 @@ public: /// add to end of path. Array::push; + String str ()const; void add (String str); void parse_path (String); }; diff --git a/init/engraver.ly b/init/engraver.ly index 09df595038..47fb08f7fd 100644 --- a/init/engraver.ly +++ b/init/engraver.ly @@ -147,7 +147,7 @@ VoiceContext = \translator { ScoreContext = \translator { \type Score_engraver; \name Score; - defaultClef = violin; + defaultClef = treble; \consists "Timing_engraver"; @@ -231,7 +231,7 @@ OrchestralScoreContext= \translator { markScriptPadding = "4.0"; barColumnPriority = "-4"; markBreakPriority = "-4"; - defaultClef = violin; + defaultClef = treble; \consists "Timing_engraver"; \consists "Bar_column_engraver"; diff --git a/init/lily.scm b/init/lily.scm index fa5ca909e4..b66038f600 100644 --- a/init/lily.scm +++ b/init/lily.scm @@ -18,6 +18,8 @@ (apply string-append (map (lambda (n) (string-append (number->string n) " ")) l))) +(define (chop-decimal x) (if (< (abs x) 0.001) 0.0 x)) + (define (number->octal-string x) (let* ((n (inexact->exact x)) (n64 (quotient n 64)) @@ -34,7 +36,7 @@ (define (number->dim-tex x) (string-append - (number->string x) "pt ")) + (number->string (chop-decimal x)) "pt ")) (define (control->string c) diff --git a/init/lily.scm.orig b/init/lily.scm.orig new file mode 100644 index 0000000000..fa5ca909e4 --- /dev/null +++ b/init/lily.scm.orig @@ -0,0 +1,432 @@ +; lily.scm -- implement Scheme output routines for TeX and PostScript +; +; source file of the GNU LilyPond music typesetter +; +; (c) 1998 Jan Nieuwenhuizen + +; TODO +; - naming +; - ready ps code (draw_bracket) vs tex/ps macros/calls (pianobrace), +; all preparations from ps,tex to scm + +;;; graphical lisp element +(define (add-column p) (display "adding column (in guile): ") (display p) (newline)) + +;;; library funtions +(define + (numbers->string l) + (apply string-append + (map (lambda (n) (string-append (number->string n) " ")) l))) + +(define (number->octal-string x) + (let* ((n (inexact->exact x)) + (n64 (quotient n 64)) + (n8 (quotient (- n (* n64 64)) 8))) + (string-append + (number->string n64) + (number->string n8) + (number->string (remainder (- n (+ (* n64 64) (* n8 8))) 8))))) + +(define (inexact->string x radix) + (let ((n (inexact->exact x))) + (number->string n radix))) + +(define + (number->dim-tex x) + (string-append + (number->string x) "pt ")) + +(define + (control->string c) + (string-append + (string-append (number->string (car c)) " ") + (string-append (number->string (cadr c)) " "))) + +(define + (embedded-ps-tex s) + (string-append "\\embeddedps{" s "}")) + +(define + (invoke-char-ps s i) + (string-append + "(\\" (inexact->string i 8) ") " s " " )) + +(define + (invoke-char-tex s i) + (string-append + "\n\\" s "{" (inexact->string i 10) "}" )) + +(define + (invoke-dim1-ps s d) + (string-append + (number->string d) " " s )) + +(define + (invoke-dim1-tex s d) + (string-append + "\n\\" s "{" (number->dim-tex d) "}")) + +(define + (invoke-output o s) + (eval-string (string-append s "-" o))) + +;;; output definitions + +(define + (beam o width slope thick) + ((invoke-output o "beam") width slope thick)) + +(define + (beam-ps width slope thick) + (string-append + (numbers->string (list width slope thick)) " draw_beam " )) + +(define + (beam-tex width slope thick) + (embedded-ps-tex (beam-ps width slope thick))) + +(define + (bracket o h) + ((invoke-output o "bracket") h)) + +(define + (bracket-ps h) + (invoke-dim1-ps "draw_bracket" h)) + +(define + (bracket-tex h) + (embedded-ps-tex (bracket-ps h))) + +(define + (char o n) + ((invoke-output o "invoke-char") "show" n)) + +(define + (dashed-slur o thick dash l) + ((invoke-output o "dashed-slur") thick dash l)) + +(define + (dashed-slur-ps thick dash l) + (string-append + (apply string-append (map control->string l)) + (number->string thick) + " [ " + (if (> 1 dash) (number->string (- (* thick dash) thick)) "0") " " + (number->string (* 2 thick)) + " ] 0 draw_dashed_slur")) + +(define + (dashed-slur-tex thick dash l) + (embedded-ps-tex (dashed-slur-ps thick dash l))) + +(define + (doublebar o h) + ((invoke-output o "invoke-dim1") "doublebar" h)) + +(define + (empty o) + ((invoke-output o "empty"))) + +(define + (empty-ps) + "\n empty\n") + +(define + (empty-tex) + "%\n\\empty%\n") + +(define + (emptybar o h) (empty o)) + +(define + (end-output o) + ((invoke-output o "end-output"))) + +(define + (end-output-ps) + "\nshowpage\n") + +(define + (end-output-tex) + "\n\\EndLilyPondOutput") + +(define + (experimental-on o) + ((invoke-output o "experimental-on"))) + +(define + (experimental-on-ps) "") + +(define + (experimental-on-tex) "\\turnOnExperimentalFeatures") + +(define + (fatdoublebar o h) + ((invoke-output o "invoke-dim1") "fatdoublebar" h)) + +(define + (finishbar o h) + ((invoke-output o "invoke-dim1") "finishbar" h)) + +(define + (font i) + (string-append + "font" + (make-string 1 (integer->char (+ (char->integer #\A) i))) + )) + +(define + (font-def o i s) + ((invoke-output o "font-def") i s)) +; (empty o)) + +(define + (font-def-ps i s) + (string-append + "\n/" (font i) " {/" + (substring s 0 (- (string-length s) 3)) + " findfont 12 scalefont setfont} bind def\n")) + +(define + (font-def-tex i s) + (string-append + "\\font" (font-switch-tex i) "=" s "\n")) + +(define + (font-switch o i) + ((invoke-output o "font-switch") i)) + +(define + (font-switch-ps i) + (string-append (font i) " ")) + +(define + (font-switch-tex i) + (string-append + "\\" (font i) "\n")) + +(define + (generalmeter o num den) + ((invoke-output o "generalmeter") num den)) + +(define + (generalmeter-ps num den) + (string-append (number->string (inexact->exact num)) " " (number->string (inexact->exact den)) " generalmeter ")) + +(define + (generalmeter-tex num den) + (string-append + "\\generalmeter{" (number->string (inexact->exact num)) "}{" (number->string (inexact->exact den)) "}")) + +(define + (header o creator generate) + ((invoke-output o "header") creator generate)) + +(define + (header-ps creator generate) + (string-append + "%!PS-Adobe-3.0\n" + "%%Creator: " creator generate "\n")) + +(define + (header-tex creator generate) + (string-append + "%created by: " creator generate "\n")) + +(define + (header-end o) + ((invoke-output o "header-end"))) + +(define + (header-end-ps) "") + +(define + (header-end-tex) "\\turnOnPostScript") + +(define + (lily-def o key val) + ((invoke-output o "lily-def") key val)) + +(define + (lily-def-ps key val) + (string-append + "/" key " {" val "} bind def\n")) + +(define + (lily-def-tex key val) + (string-append + "\\def\\" key "{" val "}\n")) + +(define + (maatstreep o h) + ((invoke-output o "invoke-dim1") "maatstreep" h)) + +(define + (pianobrace o i) + ((invoke-output o "invoke-char") "pianobrace" i)) + +(define + (placebox o x y b) + ((invoke-output o "placebox") x y (b o))) + +(define + (placebox-ps x y s) + (string-append + (number->string x) " " (number->string y) " {" s "} placebox ")) + +(define + (placebox-tex x y s) + (string-append + "\\placebox{" + (number->dim-tex y) "}{" (number->dim-tex x) "}{" s "}")) + +(define + (repeatbar o h) + ((invoke-output o "invoke-dim1") "repeatbar" h)) + +(define + (repeatbarstartrepeat o h) + ((invoke-output o "invoke-dim1") "repeatbarstartrepeat" h)) + +(define + (rulesym o x y) + ((invoke-output o "rulesym") x y)) + +(define + (rulesym-ps x y) + (string-append + (number->string x) " " + (number->string y) " " + "rulesym")) + +(define + (rulesym-tex x y) + (string-append + "\\rulesym{" (number->dim-tex x) "}{" (number->dim-tex y) "}")) + +(define + (setbold o s) + ((invoke-output o "text") "bold" s)) + +(define + (setdynamic o s) (empty o)) + +(define + (setfinger o s) + ((invoke-output o "text") "finger" s)) + +(define + (sethuge o s) + ((invoke-output o "text") "huge" s)) + +(define + (setitalic o s) + ((invoke-output o "text") "italic" s)) + +(define + (setlarge o s) + ((invoke-output o "text") "large" s)) + +(define + (setLarge o s) + ((invoke-output o "text") "Large" s)) + +(define + (setnumber o s) + ((invoke-output o "text") "number" s)) + +(define + (settext o s) + ((invoke-output o "text") "text" s)) + +(define + (settypewriter o s) + ((invoke-output o "text") "typewriter" s)) + +(define + (slur o l) + ((invoke-output o "slur") l)) + +(define + (slur-ps l) + (string-append + (apply string-append (map control->string l)) + " draw_slur")) + +(define + (slur-tex l) + (embedded-ps-tex (slur-ps l))) + +(define + (stem o kern width height depth) + ((invoke-output o "stem") kern width height depth)) + +(define + (stem-ps kern width height depth) + (string-append (numbers->string (list kern width height depth)) + "draw_stem" )) + +(define + (stem-tex kern width height depth) + (string-append + "\\kern" (number->dim-tex kern) + "\\vrule width " (number->dim-tex width) + "depth " (number->dim-tex depth) + "height " (number->dim-tex height) " ")) + +(define + (start-line o) + ((invoke-output o "start-line"))) + +(define + (start-line-ps) + (string-append + (urg-fix-font-ps) + "\nstart_line {\n")) + +(define + (start-line-tex) + (string-append + (urg-fix-font-tex) + "\\hbox{%\n")) + +(define + (startrepeat o h) + ((invoke-output o "invoke-dim1") "startrepeat" h)) + +(define + (stop-line o) + ((invoke-output o "stop-line"))) + +(define + (stop-line-ps) + "}\nstop_line\n") + +(define + (stop-line-tex) + "}\\interscoreline") + +(define + (stoprepeat o h) + ((invoke-output o "invoke-dim1") "stoprepeat" h)) + +(define + (text-ps f s) + (string-append "(" s ") set" f " ")) + +(define + (text-tex f s) + (string-append "\\set" f "{" s "}")) + +(define + (urg-fix-font-ps) + "/fontA { /feta20 findfont 12 scalefont setfont} bind def fontA\n") + +(define + (urg-fix-font-tex) + "\\font\\fontA=feta20.afm\\fontA\n") + +(define + (urg-font-switch-ps i) + "\n/feta20 findfont 12 scalefont setfont \n") + diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 83e6eff1e6..b7dac5052b 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -20,7 +20,6 @@ Clef_engraver::Clef_engraver() { - clef_p_ = 0; clef_req_l_ = 0; clef_type_str_ = ""; c0_position_i_ = 0; @@ -28,6 +27,32 @@ Clef_engraver::Clef_engraver() octave_dir_ = CENTER; } +struct Clef_settings { + char const *name; + char const *cleftype; + int position; +} clef_settings[] = { + {"treble", "treble", -2}, + {"violin", "treble", -2}, + {"G", "treble", -2}, + {"G2", "treble", -2}, + {"scarlatti", "scarlatti", 0 }, + {"french", "treble",-4 }, + {"soprano", "alto",-4 }, + {"mezzosoprano", "alto",-2 }, + {"alto", "alto",0 }, + {"tenor", "alto",2 }, + {"baritone", "alto",4 }, + {"varbaritone", "bass",0 }, + {"bass" , "bass",2 }, + {"F", "bass", 2}, + {"subbass", "bass",4}, + {0,0,0} +}; + + + + /* Ugh. Should have support for Dictionaries in mudela. */ @@ -46,59 +71,18 @@ Clef_engraver::set_type (String s) } else octave_dir_ = CENTER; - if (s == "treble" || - s == "violin" || - s == "G" || s == "G2") - { - clef_type_str_ = "violin"; - clef_position_i_ = -2; - } - else if (s == "french") - { - clef_type_str_ = "violin"; - clef_position_i_ = -4; - } - else if (s == "soprano") - { - clef_type_str_ = "alto"; - clef_position_i_ = -4; - } - else if (s == "mezzosoprano") - { - clef_type_str_ = "alto"; - clef_position_i_ = -2; - } - else if (s == "alto") - { - clef_type_str_ = "alto"; - clef_position_i_ = 0; - } - else if (s == "tenor") - { - clef_type_str_ = "alto"; - clef_position_i_ = 2; - } - else if (s == "baritone") - { - clef_type_str_ = "alto"; - clef_position_i_ = 4; - } - else if (s == "varbaritone") - { - clef_type_str_ = "bass"; - clef_position_i_ = 0; - } - else if (s == "bass" || s == "F") - { - clef_type_str_ = "bass"; - clef_position_i_ = 2; - } - else if (s == "subbass") + + bool found = 0; + for (Clef_settings *c = clef_settings; !found && c->name; c++) { - clef_type_str_ = "bass"; - clef_position_i_ = 4; - } - else + if (c->name == s) + { + clef_type_str_ = c->cleftype; + clef_position_i_ = c->position; + found = 1; + } + } + if (!found) { switch(toupper (s[0])) { @@ -106,7 +90,7 @@ Clef_engraver::set_type (String s) clef_type_str_ = "bass"; break; case 'G': - clef_type_str_ = "violin"; + clef_type_str_ = "treble"; break; case 'C': clef_type_str_ = "alto"; @@ -116,15 +100,17 @@ Clef_engraver::set_type (String s) } clef_position_i_ = 2 * (s[1] - '0') - 6; } - if (clef_type_str_ == "violin") + + if (clef_type_str_ == "treble") c0_position_i_ = clef_position_i_ - 4; else if (clef_type_str_ == "alto") c0_position_i_ = clef_position_i_; else if (clef_type_str_ == "bass") c0_position_i_ = clef_position_i_ + 4; + else if (clef_type_str_ == "scarlatti") + c0_position_i_ = 0; else assert (false); - c0_position_i_ -= (int) octave_dir_ * 7; @@ -151,7 +137,11 @@ Clef_engraver::acknowledge_element (Score_element_info info) { create_clef(); if (!clef_req_l_) - clef_p_->default_b_ = true; + for (int i=0; i < clef_p_arr_.size (); i++) + { + clef_p_arr_[i]->default_b_ = true; + } + } /* ugh; should make Clef_referenced baseclass */ @@ -183,7 +173,9 @@ Clef_engraver::do_creation_processing() if (clef_type_str_.length_i ()) { create_clef(); - clef_p_->default_b_ = false; + for (int i=0; i < clef_p_arr_.size (); i++) + + clef_p_arr_[i]->default_b_ = false; } } @@ -204,34 +196,61 @@ Clef_engraver::do_try_request (Request * r_l) void Clef_engraver::create_clef() { - if (!clef_p_) + if (clef_type_str_ == "scarlatti") { - clef_p_ = new Clef_item; - clef_p_->break_priority_i_ = -2; // ugh - announce_element (Score_element_info (clef_p_,clef_req_l_)); + while (clef_p_arr_.size () < 2) + { + Clef_item *ct= new Clef_item; + ct->break_priority_i_ = -2; // UGH + announce_element (Score_element_info (ct, clef_req_l_)); + clef_p_arr_.push (ct); + } + clef_p_arr_[0]->symbol_ = "treble"; + clef_p_arr_[0]->y_position_i_ = 4; + clef_p_arr_[1]->symbol_ = "bass"; + clef_p_arr_[1]->y_position_i_ = -4; + } + else + { + if (!clef_p_arr_.size ()) + { + Clef_item *c= new Clef_item; + c->break_priority_i_ = -2; // ugh + announce_element (Score_element_info (c, clef_req_l_)); + clef_p_arr_.push (c); + } + + for (int i=0; i < clef_p_arr_.size (); i++) + { + clef_p_arr_[i]->symbol_ = clef_type_str_; + clef_p_arr_[i]->y_position_i_ = clef_position_i_; + clef_p_arr_[i]->octave_dir_ = octave_dir_; + } } - clef_p_->read (*this); } + void Clef_engraver::do_process_requests() { if (clef_req_l_) { create_clef(); - clef_p_->default_b_ = false; + for (int i=0; i < clef_p_arr_.size (); i++) + clef_p_arr_[i]->default_b_ = false; } } void Clef_engraver::do_pre_move_processing() { - if (clef_p_) + for (int i=0; i unlink (); - delete clef_p_; - clef_p_ =0; + assert (false); } } diff --git a/lily/clef-item.cc b/lily/clef-item.cc index 285d904a09..fd6e971b42 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -28,29 +28,26 @@ Clef_item::do_pre_processing() } } +/* + FIXME +*/ Clef_item::Clef_item() { breakable_b_ =true; default_b_ = false; change_b_ = true; octave_dir_ = CENTER; - symbol_ = "violin"; + symbol_ = "treble"; y_position_i_ = -2; // Ugh: This should be const, I guess. - octave_marker_td_p_.set_p (new Text_def()); + octave_marker_td_p_.set_p (new Text_def());// UGH! octave_marker_td_p_->text_str_ = "8"; octave_marker_td_p_->style_str_ = "italic"; } -void -Clef_item::read (Clef_engraver const &k) -{ - symbol_ = k.clef_type_str_; - y_position_i_ = k.clef_position_i_; - octave_dir_ = k.octave_dir_; -} + Molecule* Clef_item::brew_molecule_p() const diff --git a/lily/include/clef-engraver.hh b/lily/include/clef-engraver.hh index 813a153393..ca827b1583 100644 --- a/lily/include/clef-engraver.hh +++ b/lily/include/clef-engraver.hh @@ -17,7 +17,7 @@ /// where is c-0 in the staff? class Clef_engraver : public Engraver { - Clef_item *clef_p_; + Link_array clef_p_arr_; Clef_change_req * clef_req_l_; void create_clef(); void read_req (Clef_change_req*); diff --git a/lily/include/clef-item.hh b/lily/include/clef-item.hh index 54c5bf1a0c..10a3f21409 100644 --- a/lily/include/clef-item.hh +++ b/lily/include/clef-item.hh @@ -38,7 +38,6 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEMENT_CLONE(Clef_item); Clef_item(); - void read (Clef_engraver const&); }; #endif // CLEFITEM_HH diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index f4c468c65e..a992a28fc1 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -11,32 +11,21 @@ #include "config.hh" -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_LIBGUILE -extern "C" { -#include -} -#else -typedef long SCM; -#endif +#include +#include SCM ly_append (SCM a, SCM b); SCM ly_eval (SCM a); SCM ly_func_o (char const* name); SCM ly_lambda_o (); SCM ly_list1 (SCM a); -SCM ly_list2(SCM a, SCM b); SCM ly_quote (); +SCM ly_quote_scm (SCM s); -#ifdef __cplusplus -} -#endif #include "array.hh" #include "scalar.hh" + SCM lambda_scm (String str, Array args_arr); SCM lambda_scm (String str, Array args_arr); SCM lambda_scm (String str, Array args_arr); diff --git a/lily/include/protected-scm.hh b/lily/include/protected-scm.hh index e83593a537..5fa1f568ce 100644 --- a/lily/include/protected-scm.hh +++ b/lily/include/protected-scm.hh @@ -10,7 +10,7 @@ #ifndef PROTECTED_SCM_HH #define PROTECTED_SCM_HH -#include "lily-guile.hh" +#include /* Mix GUILE GC with C++ ctors and dtors. diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index e4be912288..6b1d186714 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -4,6 +4,8 @@ source file of the GNU LilyPond music typesetter (c) 1998 Jan Nieuwenhuizen + + Han-Wen Nienhuys */ #include @@ -11,10 +13,6 @@ #include "lily-guile.hh" #include "main.hh" -#ifdef __cplusplus -extern "C" { -#endif - SCM ly_append (SCM a, SCM b) { @@ -28,15 +26,15 @@ ly_list1 (SCM a) } SCM -ly_list2(SCM a, SCM b) +ly_quote () { - return gh_call2 (gh_eval_str ("list"), a, b); + return gh_eval_str ("'quote"); } SCM -ly_quote () +ly_quote_scm (SCM s) { - return gh_eval_str ("'quote"); + return gh_list (ly_quote (), s, SCM_UNDEFINED); } SCM @@ -54,14 +52,11 @@ ly_lambda_o () SCM ly_func_o (char const* name) { - char buf[200]; + char buf[200]; // ugh. snprintf (buf, 200, "'(%s o)", name); return gh_eval_str (buf); } -#ifdef __cplusplus -} -#endif SCM lambda_scm (String str, Array args_arr) diff --git a/lily/lookup.cc b/lily/lookup.cc index 8e1f4f1702..5fe4ba7802 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -150,30 +150,40 @@ Lookup::clef (String st) const return afm_find (String ("clefs") + String ("-") + st); } +SCM +offset2scm (Offset o) +{ + return gh_list (gh_double2scm (o[X_AXIS]), gh_double2scm(o[Y_AXIS]), SCM_UNDEFINED); +} + Atom Lookup::dashed_slur (Array controls, Real thick, Real dash) const { assert (controls.size () == 8); - - Real dx = controls[3].x () - controls[0].x (); - Real dy = controls[3].y () - controls[0].y (); + Offset d = controls[3] - controls[0]; + + Real dx = d[X_AXIS]; + Real dy = d[Y_AXIS]; Atom a; a.font_ = font_; a.dim_[X_AXIS] = Interval (0, dx); a.dim_[Y_AXIS] = Interval (0 ? dy); - // (lambda (o) (dashed-slur o '((0.1 0.2) (1.1 1.2) (2.1 2.2) (3.1 3.2)))) - a.lambda_ = ( - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o ("dashed-slur"), - gh_cons (gh_double2scm (thick), gh_cons (gh_double2scm (dash), - ly_list1 (ly_list2 (ly_quote (), - gh_cons (ly_list2 (gh_double2scm (controls[1].x ()), gh_double2scm (controls[1].y ())), - gh_cons (ly_list2 (gh_double2scm (controls[2].x ()), gh_double2scm (controls[2].y ())), - gh_cons (ly_list2 (gh_double2scm (controls[3].x ()), gh_double2scm (controls[3].y ())), - gh_cons (ly_list2 (gh_double2scm (controls[0].x ()), gh_double2scm (controls[0].y ())), - SCM_EOL)))))))))))); + SCM sc[4]; + for (int i=0; i< 4; i++) + { + sc[i] = offset2scm (controls[i]); + } + + // (lambda (o) (dashed-slur o thick dash '(stuff)) + a.lambda_ = gh_list (gh_append3 (ly_lambda_o (), + ly_func_o ("dashed-slur"), + gh_list (gh_double2scm (thick), + gh_double2scm (dash), + ly_quote_scm (gh_list (sc[0], sc[1], sc[2], sc[3], SCM_UNDEFINED)), + SCM_UNDEFINED) + ), SCM_UNDEFINED); a.str_ = "dashed_slur"; return a; @@ -373,8 +383,6 @@ Lookup::hairpin (Real width, bool decresc, bool continued) const + to_str (continued ? height/2 : 0) + + " draw_" + String (decresc ? "de" : "") + "cresc\n"; a.str_ = ps; - - a.dim_.x () = Interval (0, width); a.dim_.y () = Interval (-2*height, 2*height); a.font_ = font_; @@ -385,8 +393,7 @@ Atom Lookup::plet (Real dy , Real dx, Direction dir) const { String ps; - - + ps += String_convert::double_str (dx) + " " + String_convert::double_str (dy) + " " + String_convert::int_str ( (int)dir) + @@ -407,21 +414,32 @@ Lookup::slur (Array controls) const Real dx = controls[3].x () - controls[0].x (); Real dy = controls[3].y () - controls[0].y (); Atom a; - - // (lambda (o) (slur o '((0.1 0.2) (1.1 1.2) (2.1 2.2) (3.1 3.2) .. ))) - a.lambda_ = ( - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o ("slur"), - ly_list1 (ly_list2 (ly_quote (), - gh_cons (ly_list2 (gh_double2scm (controls[5].x ()), gh_double2scm (controls[5].y ())), - gh_cons (ly_list2 (gh_double2scm (controls[6].x ()), gh_double2scm (controls[6].y ())), - gh_cons (ly_list2 (gh_double2scm (controls[7].x ()), gh_double2scm (controls[7].y ())), - gh_cons (ly_list2 (gh_double2scm (controls[4].x ()), gh_double2scm (controls[4].y ())), - gh_cons (ly_list2 (gh_double2scm (controls[1].x ()), gh_double2scm (controls[1].y ())), - gh_cons (ly_list2 (gh_double2scm (controls[2].x ()), gh_double2scm (controls[2].y ())), - gh_cons (ly_list2 (gh_double2scm (controls[3].x ()), gh_double2scm (controls[3].y ())), - gh_cons (ly_list2 (gh_double2scm (controls[0].x ()), gh_double2scm (controls[0].y ())), - SCM_EOL)))))))))))))); + + SCM scontrols [8]; + int indices[] = {5,6,7,4,1,2,3,0}; + + for (int i= 0; i < 8; i++) + scontrols[i] = offset2scm (controls[indices[i]]); + + + a.lambda_ = + gh_append2 (ly_lambda_o (), + gh_list (gh_append2 (ly_func_o ("slur"), + gh_list (ly_quote_scm (gh_list (scontrols[0], + scontrols[1], + scontrols[2], + scontrols[3], + scontrols[4], + scontrols[5], + scontrols[6], + scontrols[7], + SCM_UNDEFINED)), + SCM_UNDEFINED) + ), + SCM_UNDEFINED) + ); + + a.str_ = "slur"; a.dim_[X_AXIS] = Interval (0, dx); diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 487b3d2b9a..bb7d6e3bfb 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -132,13 +132,7 @@ void Paper_outputter::output_scheme (SCM scm) { String o = String ("\'") + output_global_ch; -#ifndef NPRINT - if (check_debug && !monitor->silent_b ("Guile")) - { - gh_display (scm); gh_newline (); - } -#endif - // urg; temporary hack to debug scheme error #unknown + if (String (output_global_ch) == "scm") { static SCM port = 0; @@ -153,31 +147,23 @@ Paper_outputter::output_scheme (SCM scm) port = scm_standard_stream_to_port (file, "a", ""); scm_display (gh_str02scm ("(load 'lily.scm)\n"), port); } -#if 0 - *outstream_l_ << "(display ((eval "; - scm_write (scm, port); - *outstream_l_ << ") 'tex))\n"; -#else + scm_display (gh_str02scm ("(display ((eval "), port); scm_write (scm, port); scm_display (gh_str02scm (") 'tex))\n"), port); scm_newline (port); scm_fflush (port); -#endif + return; } - SCM str_scm = gh_call1 (ly_eval (scm), gh_eval_str (o.ch_l ())); - char* c = gh_scm2newstr (str_scm, NULL); -#ifndef NPRINT - if (check_debug && !monitor->silent_b ("Guile")) + else { - gh_display (str_scm); gh_newline (); + SCM str_scm = gh_call1 (ly_eval (scm), gh_eval_str (o.ch_l ())); + char* c = gh_scm2newstr (str_scm, NULL); + *outstream_l_ << c; + free (c); } -#endif - *outstream_l_ << c; - free (c); } - void Paper_outputter::output_string (String str) { @@ -214,8 +200,8 @@ void Paper_outputter::start_line () { SCM scm = - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o ("start-line"), SCM_EOL))); + gh_append2 (ly_lambda_o (), + gh_list (ly_func_o ("start-line"), SCM_UNDEFINED));; output_scheme (scm); } diff --git a/mf/feta-klef.mf b/mf/feta-klef.mf index 2e846acb43..db42af1a36 100644 --- a/mf/feta-klef.mf +++ b/mf/feta-klef.mf @@ -301,13 +301,13 @@ def draw_gclef (expr exact_center, reduction)= enddef; -fet_beginchar("G clef", "violin", "violinclef") +fet_beginchar("G clef", "treble", "trebleclef") if test = 1: draw_staff(-1,3); fi; draw_gclef((1.7 interline#,0), 1.0); fet_endchar; -fet_beginchar("G clef", "violin_change", "cviolinclef") +fet_beginchar("G clef", "treble_change", "ctrebleclef") draw_gclef((1.3 interline#,0), .8); fet_endchar; -- 2.39.5