Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(308)

Issue 112044: Add $currentbook and $currentbookpart parser variables (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 7 months ago by Reinhold
Modified:
14 years, 7 months ago
Reviewers:
nicolas.sceaux
CC:
lilypond-devel_gnu.org
Visibility:
Public.

Description

Add $currentbook and $currentbookpart parser variables They allow us to properly add scores programmatically and mix them with explicit scores. There is still a problem with bookpart not using the $defaultheader starting with the second bookpart... Add a sample file to show how to add scores. This is there just for testing purposes and will be stripped down to a proper regression test prior to merging.

Patch Set 1 #

Total comments: 3

Patch Set 2 : Rename to $current-book[part]; use #f instead of '(); add (add-score..) function to lilypond #

Unified diffs Side-by-side diffs Delta from patch set Stats (+112 lines, -0 lines) Patch
A input/regression/scheme-book-scores.ly View 1 1 chunk +82 lines, -0 lines 0 comments Download
M lily/parser.yy View 1 4 chunks +6 lines, -0 lines 0 comments Download
M ly/init.ly View 1 chunk +2 lines, -0 lines 0 comments Download
M scm/lily-library.scm View 1 chunk +22 lines, -0 lines 0 comments Download

Messages

Total messages: 1
nicolas.sceaux
14 years, 7 months ago (2009-08-30 10:05:18 UTC) #1
I think $currentbook and $currentbookpart (which might be hyphenized)
ought to be initialized to #f in ly/init.ly, as $defaultheader is, and
set to #f and the end of \book* blocks.  It simplifies the test in add-score.

Concerning the issue:

  "There is still a problem with bookpart not using the $defaultheader
   starting with the second bookpart..."

The code is in book.cc, void Book::set_parent (Book *parent).
It was made on purpose, but as it turns out, that was probably a bad idea.

http://codereview.appspot.com/112044/diff/1/2
File input/regression/scheme-book-scores.ly (right):

http://codereview.appspot.com/112044/diff/1/2#newcode6
Line 6: ((not (null? (ly:parser-lookup parser '$currentbookpart)))
It's kind of awkward to test if the variable is a book with null?
If $currentbook* are initialized to #f, and set to #f at the end of a \book*
block, the test becomes:
  (cond ((ly:parser-lookup parser '$currentbookpart) ...
cond and the first test ought to be on the same line.

http://codereview.appspot.com/112044/diff/1/2#newcode24
Line 24: #(define add-one-note-score #f)
This would be better written:
#(define add-one-note-score
    (let ((pitch 0))
      (lambda (parser)
        ...

http://codereview.appspot.com/112044/diff/1/3
File lily/parser.yy (right):

http://codereview.appspot.com/112044/diff/1/3#newcode658
Line 658: PARSER->lexer_->set_identifier (ly_symbol2scm ("$currentbook"),
SCM_EOL);
The falsity is better expressed with #f. It simplifies testing.
$currentbook shall be initialized to #f in ly/init.ly (like $defaultheader is
for instance)
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b