+pl 15.jcn3
+ - try at scheme in Atom
+
pl 15.jcn2
- autoconf on guile
- graphical-lisp-element + silly half hook-up with autuplet
MAJOR_VERSION=1
MINOR_VERSION=0
PATCH_LEVEL=15
-MY_PATCH_LEVEL=jcn2
+MY_PATCH_LEVEL=jcn3
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
\include "property.ly"
+\include "scm.ly"
+
% music = "\melodic\relative c"
--- /dev/null
+\scm "
+(define (add-column p) (display \"adding column (in guile): \") (display p) (newline))
+(define (dashed-slur o l) (newline) (display \"output type: \") (display o) (newline) (display \"controls: \") (map display l) (newline))
+";
+
+% deze is blond
+% ((lambda (o) (dashed-slur o '((0.0 0.0) (17.2124966172942 -16.8303258151405) (161.324688856776 -15.2124966172942) (178.155014671916 2.0)))) 'ps)
+
But Atom is used as a simple type *everywhere*,
and we don't have virtual contructors.
*/
+ lambda_ = 0;
str_ = global_lookup_l->unknown_str ();
}
Atom::Atom (String s, Box b)
: dim_ (b)
{
+ lambda_ = 0;
str_ = s;
}
#ifndef ATOM_HH
#define ATOM_HH
+#include "lily-guile.hh"
#include "string.hh"
#include "box.hh"
#include "lily-proto.hh"
-
/// a symbol which can be translated, and freely copied
class Atom {
Offset off_;
public:
String str_;
String font_;
+ SCM lambda_;
Box dim_;
Offset offset () const;
Atom beam (Real,Real, Real) const;
virtual String character_str (int i) const;
Atom clef (String) const;
- virtual Atom dashed_slur (Array<Offset> controls, Real thick, Real dash) const = 0;
+// virtual Atom dashed_slur (Array<Offset> controls, Real thick, Real dash) const = 0;
+ virtual Atom dashed_slur (Array<Offset> controls, Real thick, Real dash) const;
Atom dots () const;
Atom dynamic (String) const;
Atom fill (Box b) const;
virtual Atom afm_find (String s) const;
virtual Atom* atom_p (String, int, Box) const;
virtual String character_str (int i) const;
- virtual Atom dashed_slur (Array<Offset> controls, Real thick, Real dash) const;
+// virtual Atom dashed_slur (Array<Offset> controls, Real thick, Real dash) const;
virtual Atom hairpin (Real width, bool decresc, bool continued) const;
virtual Lookup* lookup_p (Lookup const&) const;
virtual Lookup* lookup_p (Symtables const&) const;
virtual Atom afm_find (String s) const;
virtual String character_str (int i) const;
- virtual Atom dashed_slur (Array<Offset> controls, Real thick, Real dash) const;
+// virtual Atom dashed_slur (Array<Offset> controls, Real thick, Real dash) const;
virtual Atom* atom_p (String, int, Box) const;
Atom embed (Atom a) const;
virtual Atom hairpin (Real width, bool decresc, bool continued) const;
return afm_find (String ("clefs") + String ("-") + st);
}
+Atom
+Lookup::dashed_slur (Array<Offset> 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 ();
+
+ Atom a;
+ a.font_ = font_;
+ a.dim_[X_AXIS] = Interval (0, dx);
+ a.dim_[Y_AXIS] = Interval (0 <? dy, 0 >? dy);
+
+#if 0
+
+ for (int i = 1; i < 4; i++)
+ ps += String_convert::double_str (controls[i].x ()) + " "
+ + String_convert::double_str (controls[i].y ()) + " ";
+
+ ps += String_convert::double_str (controls[0].x ()) + " "
+ + String_convert::double_str (controls[0].y ()) + " ";
+
+ ps += String_convert::double_str (thick) + " ";
+ Real on = dash > 1? thick * dash - thick : 0;
+ Real off = 2 * thick;
+ ps += "[" + String_convert::double_str (on) + " ";
+ ps += String_convert::double_str (off) + "] ";
+ ps += String_convert::int_str (0) + " ";
+ ps += "draw_dashed_slur ";
+
+ Atom a;
+ a.str_ = ps;
+ a.font_ = font_;
+ a.dim_[X_AXIS] = Interval (0, dx);
+ a.dim_[Y_AXIS] = Interval (0 <? dy, 0 >? dy);
+
+ a.str_ = ps;
+
+#else
+
+ SCM list_scm = gh_eval_str ("list");
+ // ((0.1 0.2) (1.1 1.2) (2.1 2.2) (3.1 3.2))
+ SCM controls_scm =
+ gh_cons (gh_call2 (list_scm, gh_double2scm (controls[0].x ()), gh_double2scm (controls[0].y ())),
+ gh_cons (gh_call2 (list_scm, gh_double2scm (controls[1].x ()), gh_double2scm (controls[1].y ())),
+ gh_cons (gh_call2 (list_scm, gh_double2scm (controls[2].x ()), gh_double2scm (controls[2].y ())),
+ gh_cons (gh_call2 (list_scm, gh_double2scm (controls[3].x ()), gh_double2scm (controls[3].y ())),
+ SCM_EOL))));
+
+ gh_newline ();
+ gh_display (controls_scm);
+ gh_newline ();
+
+ SCM append_scm = gh_eval_str ("append");
+
+ // (dashed-slur o ((0.1 0.2) (1.1 1.2) (2.1 2.2) (3.1 3.2)))
+ SCM dashed_slur_scm =
+ gh_call1 (gh_eval_str ("list"),
+ gh_call2 (append_scm,
+ gh_eval_str ("cons '(dashed-slur o)"),
+ gh_call1 (gh_eval_str ("list"), controls_scm)));
+ gh_display (dashed_slur_scm);
+ gh_newline ();
+
+ // (lambda (o) dashed-slur o ((0.1 0.2) (1.1 1.2) (2.1 2.2) (3.1 3.2)))
+ a.lambda_ =
+ gh_call2 (append_scm, gh_eval_str ("'(lambda (o))"), dashed_slur_scm);
+ gh_display (a.lambda_);
+ gh_newline ();
+
+#endif
+
+ return a;
+}
+
Atom
Lookup::dots () const
{
*mlog << get_version_str () << endl;
}
+#if 0
void
guile_init ()
{
gh_eval_str ("(define (add-column p) (display \"adding column (in guile): \") (display p) (newline))");
}
+#endif
void
main_prog (int argc, char **argv)
{
- guile_init ();
+ //guile_init ();
// facilitate binary distributions
char const *env_lily = getenv ("LILYPONDPREFIX");
{"pt", PT_T},
{"relative", RELATIVE},
{"remove", REMOVE},
+ {"scm", SCHEME},
{"score", SCORE},
{"script", SCRIPT},
{"shape", SHAPE},
*/
#include <iostream.h>
+#include "lily-guile.hh"
#include "notename-table.hh"
#include "scalar.hh"
#include "translation-property.hh"
%token PT_T
%token RELATIVE
%token REMOVE
+%token SCHEME /* token vs typedef; can't be named SCM */
%token SCORE
%token SCRIPT
%token SHAPE
Midi_def_identifier ($1, MIDI_IDENTIFIER);
THIS->lexer_p_->set_identifier ("$defaultmidi", id)
}
+ | embedded_scm {
+ }
;
+embedded_scm:
+ SCHEME STRING ';' {
+ gh_eval_str ($2->ch_C ());
+ delete $2;
+ };
+
check_version:
VERSION STRING ';' {
Mudela_version ver (*$2);
return to_str (i, "(\\%03o)");
}
+#if 0
Atom
Ps_lookup::dashed_slur (Array<Offset> controls, Real thick, Real dash) const
{
a.font_ = font_;
return a;
}
+#endif
Atom
Ps_lookup::hairpin (Real width, bool decresc, bool continued) const
#include "array.hh"
#include "string-convert.hh"
#include "debug.hh"
+#include "lookup.hh"
+#include "main.hh"
Ps_outputter::Ps_outputter (Paper_stream *s)
:Paper_outputter (s)
if (check_debug)
*outstream_l_ << String ("\n%start: ") << nm << "\n";
+#if 0
Paper_outputter::output_molecule (m, o, nm, "% % {%}placebox \n");
+#else
+ String s = "% % {%}placebox \n";
+
+ if (check_debug)
+ *outstream_l_ << String ("\n%start: ") << nm << "\n";
+
+ for (PCursor <Atom*> i (m->atoms_); i.ok (); i++)
+ {
+ Offset a_off = i->offset ();
+ a_off += o;
+
+ switch_to_font (i->font_);
+
+ Array<String> a;
+ String r;
+
+ a.push (global_lookup_l->print_dimen (a_off.y()));
+ a.push (global_lookup_l->print_dimen (a_off.x()));
+ if (i->lambda_)
+ {
+ gh_call1 (i->lambda_, gh_eval_str ("'ps"));
+ // char* c = gh_scm2newstr (gh_call1 (i->lambda_, gh_eval_str ("'ps")), NULL);
+ // a.push (String (c));
+ // free (c);
+ }
+ else
+ a.push (i->str_);
+ r += global_lookup_l->substitute_args (s, a);
+ *outstream_l_ << r;
+ }
+#endif
}
void
return Lookup::character_str (i);
}
+#if 0
Atom
Tex_lookup::dashed_slur (Array<Offset> controls, Real thick, Real dash) const
{
return embed (Ps_lookup::dashed_slur (controls, thick, dash));
}
+#endif
Atom
Tex_lookup::embed (Atom a) const
1.0.15
1.0.15.jcn1
1.0.15.jcn2
+1.0.15.jcn3