denemo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Denemo-devel] Scheme script debugging


From: Andreas Schneider
Subject: Re: [Denemo-devel] Scheme script debugging
Date: Wed, 22 May 2013 22:29:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12

Thank you for all the information and the correction of my script. I'm
currently doing some reading about scheme.

What I want to do in my script is to put markup right after a movement
(before the next movement starts), i.e. in the generated lilypond code
directly *after* the line
} %End of Movement
of the movement the script is attached to. (As you already pointed out,
at the moment the markup is put before the closing } of the movement,
which is not valid lilypond.) How can I do that?

I'm also wondering why the creation of a button in the movement titles
button bar does not work, although I followed the instructions in your
mail from April 1st (or so I think).

Andreas


Am 22.05.2013 11:05, schrieb Richard Shann:
> Denemo's script language is a superset of scheme, that is, it is scheme
> plus a bunch of procedures such as d-DirectiveGet-movementcontrol-prefix
> and so on.
> So when I referred to (let xxx () syntax, I just mean the scheme syntax
> for the "let" procedure.
> Scheme is well documented, with the official reference here:
> 
> http://www.gnu.org/software/guile/manual/html_node/index.html
> 
> Named "let" is documented at
> http://www.gnu.org/software/guile/manual/html_node/while-do.html#while-do
> 
> while the way "let" makes variables local to the let is documented at
> http://www.gnu.org/software/guile/manual/html_node/Local-Bindings.html#Local-Bindings
> 
> 
> Guile is the interpreter for scheme, and Denemo provides a CLI at the
> top of the scheme window.
> So if you want to check if a procedure name is correct you can type it
> in there and hit return and the output (in the console) will tell you
> what it is.
> 
> But, yes we could do with documentation on the Denemo procedures: there
> is ancient documentation on the Denemo directive fields in the manual,
> but things have moved on since then, and there are various easier-to-use
> procedures, for which I have to look in an existing script and/or look
> in the sources $PREFIX/actions/denemo-modules/*.scm to see if what I
> want is already defined (Nils wrote most of this stuff I think).
> 
> In your code I have changed the ((let to (set!, dropped the (disp ...)
> calls and balanced the closing parentheses and I get this:
> 
> ;;;MarkupAtEnd
> (let ((tag "MarkupAtEnd")(themarkup #f))
>         (d-DirectivePut-movementcontrol-override tag DENEMO_OVERRIDE_GRAPHIC)
>         (d-DirectivePut-movementcontrol-display tag "MarkupAtEnd")
>         (disp "checking previous markup ...")
>         (if (d-Directive-movementcontrol? tag)
>                 (set! themarkup (d-DirectiveGet-movementcontrol-postfix tag))
>               
>                 (set! themarkup (""))
>              
>         )
>         (set! themarkup (d-GetUserInput (_ "MarkupAtEnd") (_ "Edit markup:")
> themarkup))
>         (disp themarkup)
>         (d-DirectivePut-movementcontrol-postfix tag themarkup)
>         (d-DirectivePut-movementcontrol-override tag DENEMO_OVERRIDE_AFFIX)
>         (d-SetSaved #f)
> 
> 
> which does execute. The (disp xxx) procedures can't just be added in to
> the (if  xxx yyy) because "if" takes one or two arguments, so just
> putting in extra (disp zzz) gives too many arguments.
> Instead you need this
> 
> 
> (if a
>       (begin
>               (something for the if case)
>               (disp "a is true"))
>       (begin
>               (something for the else case)
>               (disp "a is #f)))
> 
> where the "if" has two arguments (begin ...) and (begin ...)
> The "begin" procedure just groups expressions together to make a single
> expression, so that the "if" gets two arguments.
> 
> But, as I say, this is scheme syntax, which, while there is not a lot of
> it, does need reading up first.
> 
> I hope you didn't feel I was being critical of your effort - I'm pleased
> to see you giving a try at writing a script.
> 
> Your script is placing markup at the end of the \score { ......} block
> before the closing }, which I don't think is allowed LilyPond syntax.
> To get the movementcontrol directive to put the postfix in the right
> place may require some adjustment to the override field. If you let me
> know what output LilyPond you are trying for I'm sure it can be done...
> 
> HTH
> 
> Richard



reply via email to

[Prev in Thread] Current Thread [Next in Thread]