From: fred Date: Tue, 26 Mar 2002 21:28:59 +0000 (+0000) Subject: lilypond-1.1.3 X-Git-Tag: release/1.5.59~2784 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=170488bbe0462f7bffae7aa3a7f04d17c5eea23f;p=lilypond.git lilypond-1.1.3 --- 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/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 ce384d2617..9c38a76bfa 100644 --- a/init/lily.scm +++ b/init/lily.scm @@ -4,8 +4,10 @@ ; ; (c) 1998 Jan Nieuwenhuizen -;;; graphical lisp element -(define (add-column p) (display "adding column (in guile): ") (display p) (newline)) +; TODO +; - naming +; - ready ps code (draw_bracket) vs tex/ps macros/calls (pianobrace), +; all preparations from ps,tex to scm ;;; library funtions (define @@ -13,6 +15,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)) @@ -29,7 +33,7 @@ (define (number->dim-tex x) (string-append - (number->string x) "pt ")) + (number->string (chop-decimal x)) "pt ")) (define (control->string c) @@ -37,6 +41,30 @@ (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))) @@ -54,27 +82,23 @@ (define (beam-tex width slope thick) - (string-append - "\\embeddedps{" - (beam-ps width slope thick) - "}")) + (embedded-ps-tex (beam-ps width slope thick))) (define - (bracket o h) (empty o)) + (bracket o h) + ((invoke-output o "bracket") h)) (define - (char o n) - ((invoke-output o "char") n)) + (bracket-ps h) + (invoke-dim1-ps "draw_bracket" h)) (define - (char-ps n) - (string-append - "(\\" (inexact->string n 8) ") show")) + (bracket-tex h) + (embedded-ps-tex (bracket-ps h))) (define - (char-tex n) - (string-append - "\\char" (inexact->string n 10))) + (char o n) + ((invoke-output o "invoke-char") "show" n)) (define (dashed-slur o thick dash l) @@ -92,10 +116,11 @@ (define (dashed-slur-tex thick dash l) - (string-append - "\\embeddedps{" - (dashed-slur-ps 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) @@ -109,6 +134,9 @@ (empty-tex) "%\n\\empty%\n") +(define + (emptybar o h) (empty o)) + (define (end-output o) ((invoke-output o "end-output"))) @@ -132,7 +160,12 @@ (experimental-on-tex) "\\turnOnExperimentalFeatures") (define - (finishbar o h) (empty o)) + (fatdoublebar o h) + ((invoke-output o "invoke-dim1") "fatdoublebar" h)) + +(define + (finishbar o h) + ((invoke-output o "invoke-dim1") "finishbar" h)) (define (font i) @@ -143,8 +176,8 @@ (define (font-def o i s) - (empty o)) -; ((invoke-output o "font-def") i s)) + ((invoke-output o "font-def") i s)) +; (empty o)) (define (font-def-ps i s) @@ -225,20 +258,11 @@ (define (maatstreep o h) - ((invoke-output o "maatstreep") h)) - -(define - (maatstreep-ps h) - (string-append - (number->string h) " maatstreep " )) + ((invoke-output o "invoke-dim1") "maatstreep" h)) (define - (maatstreep-tex h) - (string-append - "\n\\maatstreep{" (number->dim-tex h) "}")) - -(define - (pianobrace o h) (empty o)) + (pianobrace o i) + ((invoke-output o "invoke-char") "pianobrace" i)) (define (placebox o x y b) @@ -256,7 +280,12 @@ (number->dim-tex y) "}{" (number->dim-tex x) "}{" s "}")) (define - (repeatbar o h) (empty o)) + (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) @@ -301,10 +330,18 @@ (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)) @@ -317,10 +354,7 @@ (define (slur-tex l) - (string-append - "\\embeddedps{" - (slur-ps l) - "}")) + (embedded-ps-tex (slur-ps l))) (define (stem o kern width height depth) @@ -356,7 +390,8 @@ "\\hbox{%\n")) (define - (startrepeat o h) (empty o)) + (startrepeat o h) + ((invoke-output o "invoke-dim1") "startrepeat" h)) (define (stop-line o) @@ -371,7 +406,8 @@ "}\\interscoreline") (define - (stoprepeat o h) (empty o)) + (stoprepeat o h) + ((invoke-output o "invoke-dim1") "stoprepeat" h)) (define (text-ps f s) 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/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;