---- ../lilypond-1.1.8/NEWS Sat Nov 21 12:21:29 1998
+--- ../lilypond-1.1.8.hwn1/NEWS Sun Nov 22 20:43:39 1998
+++ b/NEWS Wed Nov 25 14:00:43 1998
+@@ -1,4 +1,8 @@
+pl 8.hwn2
+ - more output revamping.
+
+ pl 8.hwn1
+ - Scheme output stuff
+ - tutorial fixes.
+
+ pl 8--- ../lilypond-1.1.8/NEWS Sat Nov 21 12:21:29 1998
++ b/NEWS Mon Nov 23 21:47:36 1998
@@ -1,3 +1,8 @@
pl 8.jcn1
MAJOR_VERSION=1
MINOR_VERSION=1
PATCH_LEVEL=8
-MY_PATCH_LEVEL=jcn1
+MY_PATCH_LEVEL=hwn2
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
;;;;;;;; TeX
-
-
(define (tex-scm action-name)
(define (unknown)
"%\n\\unknown%\n")
-
(define (beam width slope thick)
(embedded-ps ((ps-scm 'beam) width slope thick)))
"\\placebox{"
(number->dim y) "}{" (number->dim x) "}{" s "}"))
+ (define (pianobrace y)
+ (define step 1.0)
+ (define minht mudelapaperstaffheight)
+ (define maxht (* 6 minht))
+ (string-append
+ "{\\bracefont " (char (/ (- (max y (- maxht step)) minht) step)) "}"))
+
(define (rulesym h w)
(string-append
"\\vrule height " (number->dim (/ h 2))
(define experimental-on ,experimental-on)
(define char ,char)
(define maatstreep ,maatstreep)
+ (define pianobrace ,pianobrace)
))
((eq? action-name 'experimental-on) experimental-on)
)
-(define
- (unknown-ps)
- "\n unknown\n")
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; output definitions
}
- "beamslopes" = \table {
- "slope" "beamslope" 2 2.0\pt 64.0\pt 0.0\pt 0.0\pt
- "horizontal" "rulesym" 2
- }
}
"stem" "stem" 2
"fill" "hbox{}" 0
}
-
- "beamslopes" = \table {
- "slope" "beamslope" 2 2.0\pt 64.0\pt 0.0\pt 0.0\pt
- "horizontal" "rulesym" 2
- }
}
Text_def * td_p = new Text_def;
td_p->align_dir_ = CENTER;
String loud = absd->loudness_str ();
- td_p->text_str_ = paper ()->lookup_l (0)->dynamic (loud).str_; // ugh
+ td_p->text_str_ = paper ()->lookup_l (0)->dynamic (loud).str_; // ugh
td_p->style_str_ = "dynamic";
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_quote ();
SCM ly_quote_scm (SCM s);
#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);
-
void read_lily_scm_file (String);
Paper_outputter (Paper_stream *);
~Paper_outputter ();
+ 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 (Scope*, String prefix);
+ void output_version ();
void output_font_def (int i, String str);
void output_font_switch (int i);
void output_header ();
void output_molecule (Molecule const *, Offset, char const *);
void output_comment (String s);
void output_scheme (SCM scm);
- void output_string (String s);
void start_line ();
void stop_line ();
void switch_to_font (String fontname);
#include "simple-file-storage.hh"
#include "file-path.hh"
-SCM
-ly_list1 (SCM a)
-{
- return gh_list (a, SCM_UNDEFINED);
-}
-
/*
scm_m_quote doesn't use any env, but needs one for a good signature in GUILE.
}
-SCM
-ly_eval (SCM a)
-{
- return gh_call1 (gh_eval_str ("eval"), a);
-}
-
-SCM
-ly_lambda_o ()
-{
- return gh_eval_str ("'(lambda (o))");
-}
-
-SCM
-ly_func_o (char const* name)
-{
- char buf[200]; // ugh.
- snprintf (buf, 200, "'(%s o)", name);
- return gh_eval_str (buf);
-}
-
/*
See: libguile/symbols.c
return gh_car (scm_intern (name.ch_C(), name.length_i()));
}
-SCM
-lambda_scm (String str, Array<int> args_arr)
-{
- if (str.empty_b ())
- {
- str = "empty";
- args_arr.clear ();
- }
- SCM args_scm = SCM_EOL;
- for (int i = args_arr.size () - 1; i >= 0; i--)
- args_scm = gh_cons (gh_int2scm (args_arr[i]), args_scm);
- args_scm = gh_cons (ly_symbol (str.ch_l ()), args_scm);
- return args_scm;
-}
-
-// scm_top_level_env(SCM_CDR(scm_top_level_lookup_closure_var)))
-SCM
-lambda_scm (String str, Array<Scalar> args_arr)
-{
- if (str.empty_b ())
- {
- str = "empty";
- args_arr.clear ();
- }
- SCM args_scm = SCM_EOL;
- for (int i = args_arr.size (); i--; )
- args_scm = gh_cons (gh_str02scm (args_arr[i].ch_l ()), args_scm);
- args_scm = gh_cons (ly_symbol (str.ch_l ()), args_scm);
- return args_scm;
-}
-
-SCM
-lambda_scm (String str, Array<Real> args_arr)
-{
- if (str.empty_b ())
- {
- str = "empty";
- args_arr.clear ();
- }
- SCM args_scm = SCM_EOL;
- for (int i = args_arr.size (); i--; )
- args_scm = gh_cons (gh_double2scm (args_arr[i]), args_scm);
-
- args_scm = gh_cons (ly_symbol (str.ch_l ()), args_scm);
- return args_scm;
-}
-
/**
Read a file, and shove it down GUILE. GUILE also has file read
#include "main.hh"
#include "lily-guile.hh"
+SCM
+array_to_list (SCM *a , int l)
+{
+ SCM list = SCM_EOL;
+ for (int i= l; i--; )
+ {
+ list = gh_cons (a[i], list);
+ }
+ return list;
+}
+
Lookup::Lookup ()
{
a.dim_ = m.B_;
a.dim_[X_AXIS] *= 1 / 1000.0;
a.dim_[Y_AXIS] *= 1 / 1000.0;
- Array<Real> arr;
- arr.push (m.code ());
a.lambda_ = gh_list (ly_symbol ("char"),
Atom
Lookup::bar (String str, Real h) const
{
- Array<Real> arr;
- arr.push (h);
+
Atom a = (*symtables_p_) ("bars")->lookup (str);
Real min_y = (0 <? height) - thick/2;
Real max_y = (0 >? height) + thick/2;
- Array<Real> arr;
- arr.push (width);
- arr.push (slope);
- arr.push (thick);
-
Atom a;
- a.lambda_ = (lambda_scm ("beam", arr));
- a.str_ = "beam";
+ a.lambda_ = gh_list (ly_symbol ("beam"),
+ gh_double2scm (width),
+ gh_double2scm (slope),
+ gh_double2scm (thick),
+ SCM_UNDEFINED);
+
a.dim_[X_AXIS] = Interval (0, width);
a.dim_[Y_AXIS] = Interval (min_y, max_y);
return a;
sc[i] = offset2scm (controls[i]);
}
- // (lambda (o) (dashed-slur o thick dash '(stuff))
a.lambda_ =
gh_list (ly_symbol ("dashed-slur"),
gh_double2scm (thick),
gh_double2scm (dash),
- gh_list (sc[1], sc[2], sc[3], sc[0], SCM_UNDEFINED),
+ ly_quote_scm (array_to_list (sc, 4)),
SCM_UNDEFINED);
a.str_ = "dashed_slur";
Lookup::extender (Real width) const
{
Atom a = (*symtables_p_) ("param")->lookup ("extender");
- Array<Real> arr;
- arr.push (width);
- a.lambda_ = (lambda_scm (a.str_, arr));
+ a.lambda_ = gh_list (ly_symbol (a.str_),
+ gh_double2scm (width),
+ SCM_UNDEFINED);
a.str_ = "extender";
a.font_ = font_;
return a;
a.dim_.x () = Interval (0,0);
a.dim_.y () = Interval (y1,y2);
- Array<Real> arr;
-
Real stem_width = paper_l_->get_var ("stemthickness");
- gh_list (ly_symbol ("stem"),
- gh_double2scm(-stem_width /2),
- gh_double2scm(stem_width),
- gh_double2scm(y2),
- gh_double2scm(-y1),
- SCM_UNDEFINED);
+ a.lambda_ = gh_list (ly_symbol ("stem"),
+ gh_double2scm(-stem_width /2),
+ gh_double2scm(stem_width),
+ gh_double2scm(y2),
+ gh_double2scm(-y1),
+ SCM_UNDEFINED);
a.font_ = font_;
return a;
Atom
Lookup::text (String style, String text) const
{
- Array<Scalar> arr;
-
- arr.push (text);
Atom a = (*symtables_p_) ("style")->lookup (style);
- a.lambda_ = lambda_scm (a.str_, arr);
+
+ a.lambda_ = gh_list(ly_symbol (a.str_),
+ gh_str02scm (text.ch_C()),
+ SCM_UNDEFINED);
+
Real font_w = a.dim_.x ().length ();
Real font_h = a.dim_.y ().length ();
-// urg
-// if (!cmr_dict.length_i ())
if (!cmr_dict.elem_b ("roman"))
{
//brrrr
}
DOUT << "\n" << to_str (w) << "\n";
a.dim_.x () = Interval (0, w);
- a.str_ = "text";
a.font_ = font_;
return a;
}
Lookup::time_signature (Array<int> a) const
{
Atom s ((*symtables_p_) ("param")->lookup ("time_signature"));
- s.lambda_ = (lambda_scm (s.str_, a));
-
+ s.lambda_ = gh_list (ly_symbol (s.str_),
+ gh_int2scm (a[0]),
+ gh_int2scm (a[1]),
+ SCM_UNDEFINED);
return s;
}
-/*
- should be handled via Tex_ code and Lookup::bar ()
- */
Atom
Lookup::vbrace (Real &y) const
{
- Atom a = (*symtables_p_) ("param")->lookup ( "brace");
- Interval ydims = a.dim_[Y_AXIS];
- Real min_y = ydims[LEFT];
- Real max_y = ydims[RIGHT];
- Real step = 1.0 PT;
-
- if (y < min_y)
- {
- warning (_ ("piano brace")
- + " " + _ ("too small") + " (" + print_dimen (y) + ")");
- y = min_y;
- }
- if (y > max_y)
- {
- warning (_ ("piano brace")
- + " " + _ ("too big") + " (" + print_dimen (y) + ")");
- y = max_y;
- }
-
-
- int idx = int (rint ( (y- min_y)/step)) + 1;
-
- Array<Real> arr;
- arr.push (idx);
- a.lambda_ = (lambda_scm (a.str_, arr));
- a.str_ = "brace";
+ Atom a;
+ a.lambda_ = gh_list (ly_symbol ("pianobrace"),
+ gh_double2scm (y),
+ SCM_UNDEFINED
+ );
a.dim_[Y_AXIS] = Interval (-y/2,y/2);
a.font_ = font_;
return a;
{
Atom a;
Real height = paper_l_->staffheight_f () / 6;
- Array<Real> arr;
- arr.push (width);
- arr.push (height);
- arr.push (continued ? height/2 : 0);
+
String hairpin = String (decresc ? "de" : "") + "crescendo\n";
- a.lambda_ = lambda_scm (hairpin, arr);
- a.str_ = "hairpin";
+ a.lambda_ = gh_list (ly_symbol (hairpin),
+ gh_double2scm (width),
+ gh_double2scm (height),
+ gh_double2scm (continued ? height/2 : 0.0),
+ SCM_UNDEFINED);
a.dim_.x () = Interval (0, width);
a.dim_.y () = Interval (-2*height, 2*height);
a.font_ = font_;
Atom
Lookup::plet (Real dy , Real dx, Direction dir) const
{
- Array<Real> arr;
- arr.push (dx);
- arr.push (dy);
- arr.push (dir);
Atom a;
- a.lambda_ = (lambda_scm ("tuplet", arr));
- a.str_ = "plet";
+ a.lambda_ = gh_list(ly_symbol ("tuplet"),
+ gh_double2scm (dx),
+ gh_double2scm (dy),
+ gh_int2scm (dir));
return a;
}
-SCM
-array_to_list (SCM *a , int l)
-{
- SCM list = SCM_EOL;
- for (int i= l; i--; )
- {
- list = gh_cons (a[i], list);
- }
- return list;
-}
Atom
Lookup::slur (Array<Offset> controls) const
a.lambda_ =gh_list (ly_symbol ("slur"),
- array_to_list (scontrols, 8),
+ ly_quote_scm (array_to_list (scontrols, 8)),
SCM_UNDEFINED);
a.dim_[X_AXIS] = Interval (0, dx);
+ " " + _ ("too small") + " (" + print_dimen (y) + ")");
// y = min_y;
}
- Array<Real> arr;
- arr.push (y);
- a.lambda_ = (lambda_scm ("bracket", arr));
+
+ a.lambda_ = gh_list (ly_symbol ("bracket"),
+ gh_double2scm (y),
+ SCM_UNDEFINED);
a.str_ = "vbracket";
a.dim_[Y_AXIS] = Interval (-y/2,y/2);
a.dim_[X_AXIS] = Interval (0,4 PT);
Atom
Lookup::volta (Real w, bool last_b) const
{
- Array<Real> arr;
- arr.push (w);
- arr.push (last_b);
Atom a;
- a.lambda_ = (lambda_scm ("volta", arr));
+ a.lambda_ = gh_list (ly_symbol ("volta"),
+ gh_double2scm (w),
+ gh_int2scm (last_b),
+ SCM_UNDEFINED);
a.str_ = "volta";
return a;
}
Paper_score::~Paper_score ()
{
-#if 0
- for (int i=0; i< line_l_arr_.size (); i++)
- line_l_arr_[i]->unlink_all ();
-
- for (PCursor<Score_element*> i(elem_p_list_.top()); i.ok(); i++)
- {
-
- if (i->linked_b())
- i->unlink ();
- assert (! i->linked_b ());
- }
-#endif
}
void
default_count_i_ = 0;
}
-//urg
extern char const* lily_version_number_sz ();
-void
-output_def (Paper_outputter* p, String key, String val)
-{
- SCM args_scm = gh_list (ly_symbol ("lily-def"),
- gh_str02scm (key.ch_l ()),
- gh_str02scm (val.ch_l ()), SCM_UNDEFINED);
- p->output_scheme (args_scm);
-}
-
-void
-output_header (Paper_outputter* p, Scope *head)
-{
- if (!head)
- return;
-
- String id_str = "Lily was here";
- if (no_timestamps_global_b)
- id_str += ".";
- else
- id_str += String (", ") + lily_version_number_sz ();
- output_def (p, "LilyIdString", id_str);
-
- for (Dictionary_iter<Identifier*> i (*head); i.ok (); i++)
- {
- if (!i.val ()->access_content_String (false))
- continue;
-
- String val = *i.val()->access_content_String (false);
- output_def (p, "mudela" + i.key (), val);
- }
-}
-
-void
-Paper_def::output_settings (Paper_outputter* p) const
-{
- for (Dictionary_iter<Identifier*> i (*scope_p_); i.ok (); i++)
- output_def (p, String ("mudelapaper") + i.key (), i.val ()->str ());
- p->output_string (*scope_p_->elem (String (output_global_ch) + "setting")->access_content_String (false));
-}
-
Paper_outputter*
Paper_def::paper_outputter_p (Paper_stream* os_p, Header* header_l, String origin_str) const
{
Paper_outputter* p = new Paper_outputter (os_p);
- output_header (p, header_global_p);
-#if 0
// for now; breaks -fscm output
p->output_comment (_ ("outputting Score, defined at: "));
p->output_comment (origin_str);
-#endif
- output_header (p, header_l);
-
- output_settings (p);
+ p->output_version();
+ if (header_global_p)
+ p->output_scope (header_global_p, "mudela");
+ if (header_l)
+ p->output_scope (header_l, "mudela");
+ if (scope_p_)
+ p->output_scope (scope_p_, "mudelapaper");
+
+ if (output_global_ch == String("tex"))
+ {
+ *p->outstream_l_ << *scope_p_->elem ("texsetting")->access_content_String (false);
+ }
+
SCM scm = gh_list (ly_symbol ("experimental-on"), SCM_UNDEFINED);
p->output_scheme (scm);
if (outname != "-")
outname += String (".") + output_global_ch;
*mlog << _f ("Paper output to %s...",
- outname == "-" ? String ("<stdout>") : outname ) << endl;
+ outname == "-" ? String ("<stdout>") : outname) << endl;
+
target_str_global_array.push (outname);
return new Paper_stream (outname);
}
#include <time.h>
#include <fstream.h>
+#include "dictionary-iter.hh"
#include "virtual-methods.hh"
#include "paper-outputter.hh"
#include "paper-stream.hh"
#include "debug.hh"
#include "lookup.hh"
#include "main.hh"
+#include "scope.hh"
+#include "identifier.hh"
Paper_outputter::Paper_outputter (Paper_stream *s)
{
{
String s = String ("(eval (") + output_global_ch + "-scm 'all-definitions))";
gh_eval_str (s.ch_C());
-
String creator;
if (no_timestamps_global_b)
free (c);
}
}
+
+void
+Paper_outputter::output_scope (Scope *scope, String prefix)
+{
+ for (Dictionary_iter<Identifier*> i (*scope); i.ok (); i++)
+ {
+ if (dynamic_cast<String_identifier*> (i.val ()))
+ {
+ String val = *i.val()->access_content_String (false);
+
+ output_String_def (prefix + i.key (), val);
+ }
+ else if(dynamic_cast<Real_identifier*> (i.val ()))
+ {
+ Real val = *i.val ()->access_content_Real (false);
+
+ output_Real_def (prefix + i.key (), val);
+ }
+ else if (dynamic_cast<int_identifier*> (i.val ()))
+ {
+ int val = *i.val ()->access_content_int (false);
+
+ output_int_def (prefix + i.key (), val);
+ }
+ }
+}
+
void
-Paper_outputter::output_string (String str)
+Paper_outputter::output_version ()
{
- // urg
- *outstream_l_ << str;
+ String id_str = "Lily was here";
+ if (no_timestamps_global_b)
+ id_str += ".";
+ else
+ id_str += String (", ") + get_version_str ();
+ output_String_def ( "LilyIdString", id_str);
}
void
void
Paper_outputter::output_font_def (int i, String str)
{
- SCM scm =gh_list (ly_symbol ("font-def"),
- gh_int2scm (i),
- gh_str02scm (str.ch_l ()),
- SCM_UNDEFINED);
-
+ SCM scm = gh_list (ly_symbol ("font-def"),
+ gh_int2scm (i),
+ gh_str02scm (str.ch_l ()),
+ SCM_UNDEFINED);
+
+ output_scheme (scm);
+}
+
+void
+Paper_outputter::output_Real_def (String k, Real v)
+{
+
+ SCM scm = gh_list (ly_symbol ("lily-def"),
+ gh_str02scm (k.ch_l ()),
+ gh_str02scm (to_str(v).ch_l ()),
+ SCM_UNDEFINED);
+ output_scheme (scm);
+
+ gh_define (k.ch_l (), gh_double2scm (v));
+}
+
+void
+Paper_outputter::output_String_def (String k, String v)
+{
+
+ SCM scm = gh_list (ly_symbol ("lily-def"),
+ gh_str02scm (k.ch_l ()),
+ gh_str02scm (v.ch_l ()),
+ SCM_UNDEFINED);
output_scheme (scm);
+
+ gh_define (k.ch_l (), gh_str02scm (v.ch_l ()));
+}
+
+void
+Paper_outputter::output_int_def (String k, int v)
+{
+ SCM scm = gh_list (ly_symbol ("lily-def"),
+ gh_str02scm (k.ch_l ()),
+ gh_str02scm (to_str (v).ch_l ()),
+ SCM_UNDEFINED);
+ output_scheme (scm);
+
+ gh_define (k.ch_l (), gh_int2scm (v));
}
void
Molecule *mol_p =new Molecule;
Drul_array<Real> stem_y = yextent_drul_;
Real dy = paper ()->internote_f ();
-
Real head_wid = 0;
if (head_l_arr_.size ())