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
{
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;
+}
/// add to end of path.
Array<String>::push;
+ String str ()const;
void add (String str);
void parse_path (String);
};
ScoreContext = \translator {
\type Score_engraver;
\name Score;
- defaultClef = violin;
+ defaultClef = treble;
\consists "Timing_engraver";
markScriptPadding = "4.0";
barColumnPriority = "-4";
markBreakPriority = "-4";
- defaultClef = violin;
+ defaultClef = treble;
\consists "Timing_engraver";
\consists "Bar_column_engraver";
;
; (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
-;;; 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
(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))
(define
(number->dim-tex x)
(string-append
- (number->string x) "pt "))
+ (number->string (chop-decimal x)) "pt "))
(define
(control->string c)
(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)))
(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)
(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)
(empty-tex)
"%\n\\empty%\n")
+(define
+ (emptybar o h) (empty o))
+
(define
(end-output o)
((invoke-output o "end-output")))
(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)
(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)
(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)
(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)
(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-tex l)
- (string-append
- "\\embeddedps{"
- (slur-ps l)
- "}"))
+ (embedded-ps-tex (slur-ps l)))
(define
(stem o kern width height depth)
"\\hbox{%\n"))
(define
- (startrepeat o h) (empty o))
+ (startrepeat o h)
+ ((invoke-output o "invoke-dim1") "startrepeat" h))
(define
(stop-line o)
"}\\interscoreline")
(define
- (stoprepeat o h) (empty o))
+ (stoprepeat o h)
+ ((invoke-output o "invoke-dim1") "stoprepeat" h))
(define
(text-ps f s)
Clef_engraver::Clef_engraver()
{
- clef_p_ = 0;
clef_req_l_ = 0;
clef_type_str_ = "";
c0_position_i_ = 0;
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.
*/
}
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]))
{
clef_type_str_ = "bass";
break;
case 'G':
- clef_type_str_ = "violin";
+ clef_type_str_ = "treble";
break;
case 'C':
clef_type_str_ = "alto";
}
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;
{
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 */
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;
}
}
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 <clef_p_arr_.size (); i++)
{
- typeset_element (clef_p_);
- clef_p_ = 0;
+ typeset_element (clef_p_arr_[i]);
}
+ clef_p_arr_.clear ();
}
+
void
Clef_engraver::do_post_move_processing()
{
void
Clef_engraver::do_removal_processing()
{
- if (clef_p_)
+ if (clef_p_arr_.size ())
{
- clef_p_->unlink ();
- delete clef_p_;
- clef_p_ =0;
+ assert (false);
}
}
}
}
+/*
+ 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
/// where is c-0 in the staff?
class Clef_engraver : public Engraver {
- Clef_item *clef_p_;
+ Link_array<Clef_item> clef_p_arr_;
Clef_change_req * clef_req_l_;
void create_clef();
void read_req (Clef_change_req*);
DECLARE_MY_RUNTIME_TYPEINFO;
SCORE_ELEMENT_CLONE(Clef_item);
Clef_item();
- void read (Clef_engraver const&);
};
#endif // CLEFITEM_HH
#include "config.hh"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef HAVE_LIBGUILE
-extern "C" {
-#include <guile/gh.h>
-}
-#else
-typedef long SCM;
-#endif
+#include <guile/gh.h>
+#include <libguile.h>
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<int> args_arr);
SCM lambda_scm (String str, Array<Real> args_arr);
SCM lambda_scm (String str, Array<Scalar> args_arr);
#ifndef PROTECTED_SCM_HH
#define PROTECTED_SCM_HH
-#include "lily-guile.hh"
+#include <guile/gh.h>
/*
Mix GUILE GC with C++ ctors and dtors.
source file of the GNU LilyPond music typesetter
(c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <stdio.h>
#include "lily-guile.hh"
#include "main.hh"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
SCM
ly_append (SCM a, SCM b)
{
}
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
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<int> args_arr)
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;
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)
{
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);
}
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;