#include <stdio.h>
-#include "scm-option.hh"
+#include "book.hh"
#include "context-def.hh"
-#include "lily-guile.hh"
-#include "misc.hh"
-#include "my-lily-lexer.hh"
-#include "paper-def.hh"
-#include "midi-def.hh"
-#include "main.hh"
-#include "file-path.hh"
-#include "warn.hh"
#include "dimensions.hh"
-#include "my-lily-parser.hh"
-#include "score.hh"
-#include "input-file-results.hh"
+#include "event.hh"
+#include "file-path.hh"
+#include "input-smob.hh"
#include "input.hh"
+#include "lily-guile.hh"
#include "lilypond-input-version.hh"
-#include "scm-hash.hh"
#include "ly-module.hh"
-#include "music-sequence.hh"
-#include "input-smob.hh"
-#include "event.hh"
-#include "text-item.hh"
+#include "main.hh"
+#include "midi-def.hh"
+#include "misc.hh"
#include "music-list.hh"
+#include "music-sequence.hh"
+#include "my-lily-lexer.hh"
+#include "my-lily-parser.hh"
#include "paper-book.hh"
+#include "paper-def.hh"
+#include "scm-hash.hh"
+#include "scm-option.hh"
+#include "score.hh"
+#include "text-item.hh"
+#include "warn.hh"
#define MY_MAKE_MUSIC(x) make_music_by_name (ly_symbol2scm (x))
make_simple_markup (SCM encoding, SCM a)
{
SCM simple = ly_scheme_function ("simple-markup");
- if (gh_symbol_p (encoding))
- {
+ if (is_symbol (encoding))
return scm_list_3 (ly_scheme_function ("encoded-simple-markup"),
encoding, a);
- } else
- return scm_list_2 (simple, a);
-
- return markup;
+ return scm_list_2 (simple, a);
}
-
bool
-is_is_duration (int t)
+is_duration (int t)
{
return t && t == 1 << intlog2 (t);
}
%union {
+ Book *book;
+ Music_output_def *outputdef;
+ SCM scm;
String *string;
- Music *music;
- Score *score;
- Music_output_def *outputdef;
- SCM scm;
- int i;
+ Music *music;
+ Score *score;
+ int i;
}
%{
%token APPLYOUTPUT
%token AUTOCHANGE
%token BAR
+%token BOOK
%token BREATHE
%token CHANGE
%token CHORDMODIFIERS
%token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET CHORD_SLASH
%token FIGURE_SPACE
+%type <book> book_block book_body
%type <i> exclamations questions dots optional_rest
%type <i> bass_mod
%type <scm> grace_head
toplevel_expression:
lilypond_header {
- THIS->input_file_->header_ = $1;
+ THIS->header_ = $1;
}
| add_quote {
}
+ | book_block {
+ Book *book = $1;
+ SCM header = THIS->header_;
+ Path outname = split_path (THIS->output_basename_);
+ int *c = &THIS->book_count_;
+ if (*c)
+ outname.base += "-" + to_string (*c);
+ (*c)++;
+ Music_output_def *dp = unsmob_music_output_def
+ (THIS->lexer_->lookup_identifier ("$defaultpaper"));
+ book->process (outname.to_string (),
+ dp ? dp->clone () : new Paper_def, header);
+ scm_gc_unprotect_object (book->self_scm ());
+ }
| score_block {
Score *sc = $1;
-
- SCM head = is_module (sc->header_) ? sc->header_ : THIS->input_file_->header_.to_SCM ();
+ SCM head = is_module (sc->header_) ? sc->header_
+ : THIS->header_.to_SCM ();
Path p = split_path (THIS->output_basename_);
- int *c = &THIS->input_file_->score_count_;
+ int *c = &THIS->score_count_;
if (*c)
- {
p.base += "-" + to_string (*c);
- }
(*c)++;
SCM outname = scm_makfrom0str (p.to_string ().to_str0());
for (int i = 0; i < sc->defs_.size (); i++)
- default_rendering (sc->music_, sc->defs_[i]->self_scm (), head, outname);
+ default_rendering (sc->music_,
+ sc->defs_[i]->self_scm (), head,
+ outname);
if (sc->defs_.is_empty ())
{
}
;
-/*
- SCORE
-*/
+book_block:
+ BOOK {
+ THIS->push_spot ();
+ }
+ /*cont*/ '{' book_body '}' {
+ THIS->pop_spot ();
+ $$ = $4;
+ }
+ ;
+
+book_body:
+ {
+ $$ = new Book;
+ $$->set_spot (THIS->here_input ());
+ }
+ | book_body score_block {
+ $$->scores_.push ($2);
+ scm_gc_unprotect_object ($2->self_scm ());
+ }
+ | book_body error {
+ }
+ ;
+
score_block:
SCORE {
THIS->push_spot ();
/*cont*/ '{' score_body '}' {
THIS->pop_spot ();
$$ = $4;
-
}
;
steno_duration:
bare_unsigned dots {
int len = 0;
- if (!is_is_duration ($1))
+ if (!is_duration ($1))
THIS->parser_error (_f ("not a duration: %d", $1));
else
len = intlog2 ($1);
$$ = 0;
}
| ':' bare_unsigned {
- if (!is_is_duration ($2))
+ if (!is_duration ($2))
THIS->parser_error (_f ("not a duration: %d", $2));
$$ = $2;
}
#endif
}
-extern My_lily_parser *current_parser;
-
void
My_lily_parser::do_yyparse ()
{
- current_parser = this;;
yyparse ((void*)this);
}