+pl 15.jcn4
+ - direct #... to scm parser (Tanks to Gary Houston)
+
pl 15.jcn3
- bf: smob fix?
- mutopia/doc target 'local-web':
MAJOR_VERSION=1
MINOR_VERSION=2
PATCH_LEVEL=15
-MY_PATCH_LEVEL=jcn3
+MY_PATCH_LEVEL=jcn4
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
--- /dev/null
+#(begin (newline)(display "hello world")(newline))\score{
+ \notes\relative c'{ c }
+}
+
SCM ly_append (SCM a, SCM b);
SCM ly_eval (SCM a);
SCM ly_func_o (char const* name);
+SCM ly_parse_scm (char const* s, int* n);
SCM ly_quote_scm (SCM s);
void ly_display_scm (SCM s);
String ly_scm2string (SCM s);
source file of the LilyPond music typesetter
- (c) 1996,1997 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1996--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include "my-lily-lexer.hh"
#include "array.hh"
#include "interval.hh"
+#include "lily-guile.hh"
#include "parser.hh"
#include "debug.hh"
#include "main.hh"
cerr << _ ("white expected") << endl;
exit (1);
}
+<INITIAL,chords,lyrics,notes># { //embedded scm
+ //char const* s = YYText () + 1;
+ char* s = (char*)YYText () + 1;
+ int n = 0;
+ if (!main_input_b_ && safe_global_b) {
+ error (_ ("Can't evaluate Scheme in safe mode"));
+ return SCM_EOL;
+ }
+ /*
+ urg: replace 0 char with original value
+ */
+ *s = (char)yyinput ();
+ yylval.scm = ly_parse_scm (s, &n);
+
+ if (!n)
+ unput (*s);
+ else
+ n--;
+ /*
+ urg, this
+ yyin->seekg (n, ios::cur);
+ doesn't work, is there no other way?
+ */
+ for (int i=0; i < n; i++)
+ yyinput ();
+ return SCM_T;
+}
<notes>{
{ALPHAWORD} {
return scan_bare_word (YYText ());
return gh_eval_str ((char*)c);
}
+
+/*
+ Pass string to scm parser, evaluate one expression.
+ Return result value and #chars read.
+
+ Thanks to Gary Houston <ghouston@freewire.co.uk>
+
+ Need guile-1.3.4 (>1.3 anyway) for ftell on str ports -- jcn
+*/
+SCM
+ly_parse_scm (char const* s, int* n)
+{
+ SCM str = gh_str02scm ((char*)s);
+ SCM port = scm_mkstrport (SCM_INUM0, str, SCM_OPN | SCM_RDNG,
+ "scm_eval_0str");
+ SCM from = scm_ftell (port);
+
+ SCM form;
+ SCM answer = SCM_UNSPECIFIED;
+
+ /* Read expression from port */
+ if (!SCM_EOF_OBJECT_P (form = scm_read (port)))
+ answer = scm_eval_x (form);
+
+ SCM to = scm_ftell (port);
+ *n = gh_scm2int (to) - gh_scm2int (from);
+
+ /* Don't close the port here; if we re-enter this function via a
+ continuation, then the next time we enter it, we'll get an error.
+ It's a string port anyway, so there's no advantage to closing it
+ early. */
+
+ return answer;
+}
+
/*
scm_m_quote doesn't use any env, but needs one for a good signature in GUILE.
*/
#include "notename-table.hh"
#include "interval.hh"
#include "identifier.hh"
+#include "lily-guile.hh"
#include "parser.hh"
#include "keyword.hh"
#include "my-lily-lexer.hh"
{"repeat", REPEAT},
{"repetitions", REPETITIONS},
{"addlyrics", ADDLYRICS},
- {"scm", SCM_T},
- {"scmfile", SCMFILE},
{"score", SCORE},
{"script", SCRIPT},
{"shape", SHAPE},
#include "music-list.hh"
#include "musical-request.hh"
#include "command-request.hh"
+#include "lily-guile.hh"
#include "parser.hh"
#include "scope.hh"
#include "file-results.hh"
source file of the GNU LilyPond music typesetter
- (c) 1997 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
*/
Real real;
Request * request;
Scalar *scalar;
+ SCM scm;
String *string;
Tempo_req *tempo;
%token REPETITIONS
%token ADDLYRICS
%token SCM_T
-%token SCMFILE
%token SCORE
%token SCRIPT
%token SHAPE
%token <real> REAL
%token <string> DURATION RESTNAME
%token <string> STRING
+%token <scm> SCM_T
%token <i> UNSIGNED
%type <duration> duration_length
%type <scalar> scalar
+%type <scm> embedded_scm
%type <music> Music Sequential_music Simultaneous_music Music_sequence
%type <music> relative_music re_rhythmed_music
%type <music> property_def translator_change
Midi_def_identifier ($1, MIDI_IDENTIFIER);
THIS->lexer_p_->set_identifier ("$defaultmidi", id)
}
- | embedded_scm {
- }
+ | embedded_scm {
+ // junk value
+ }
;
embedded_scm:
- SCMFILE STRING semicolon {
- read_lily_scm_file (*$2);
- delete $2;
- }
- | SCM_T STRING semicolon {
- if (THIS->lexer_p_->main_input_b_ && safe_global_b)
- error (_("Can't evaluate Scheme in safe mode"));
- gh_eval_str ($2->ch_l ());
- delete $2;
- };
+ SCM_T
+ ;
chordmodifiers_block:
% 16' = S
%
-\scmfile "accordion-script.scm";
+#(primitive-load-path "accordion-script.scm")
accDiscant = \script "accDiscant"
accDiscantF = \script "accDiscantF"
-\scmfile "script.scm";
+#(primitive-load-path "script.scm")
"dash-hat" = "marcato"
"dash-plus" = "stopped"
upprall = \script "upprall"
downprall = \script "downprall"
segno = \script "segno"
-coda = \script "coda"
\ No newline at end of file
+coda = \script "coda"