lilypond-devel
[Top][All Lists]
Advanced

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

Re: Better pure height approximations for beamed rests. (issue 4860043)


From: address@hidden
Subject: Re: Better pure height approximations for beamed rests. (issue 4860043)
Date: Fri, 27 Apr 2012 21:01:04 +0200

On 27 avr. 2012, at 19:58, Keith OHara wrote:

> On Fri, 27 Apr 2012 03:02:51 -0700, address@hidden <address@hidden> wrote:
> 
>> On 27 avr. 2012, at 09:45, Keith OHara wrote:
>> 
>>> On Thu, 26 Apr 2012 23:44:24 -0700, <address@hidden> wrote:
>>> 
>>>> lily/beam.cc:1743: Beam::pure_rest_collision_callback (SCM smob, SCM
>>>> prev_offset,
>>>> 
>>>> You're right - this is an error.  Do you want me to fix it or are you
>>>> working on a patch into which the fix could be incorporated?
>>> 
>>> I am re-ordering the arguments in that one C function, but I don't read 
>>> Scheme so I am not sure if the observed order of the data is the intended 
>>> order, or the conventional order.
>>> 
>>> Your addition to the docs is pretty explicit that 'start' and 'end' are 
>>> always the last two arguments, even in a chained-offset-callback where 
>>> there are extra arguments.  On the other hand, call-pure-function seems to 
>>> put 'start' and 'end' in slots 2 and 3, with any other arguments attached 
>>> later.
>>> 
>> 
>> 
>> Call pure function puts start and end in the final two slots.  The optional 
>> arguments are passed in in slot two as a variable called `args' (check out 
>> lily/grob-property.cc and scm/define-grobs.scm).
>> 
> 
> I did check them out; that's how I know I don't read Scheme.
> 
> 326 SCM
> 327 call_pure_function (SCM unpure, SCM args, int start, int end)
> 328 {
> 329   SCM scm_call_pure_function = ly_lily_module_constant 
> ("call-pure-function");
> 330
> 331   return scm_apply_0 (scm_call_pure_function,
> 332                       scm_list_4 (unpure, args, scm_from_int (start), 
> scm_from_int (end)));
> 333 }
> 334
> 
> 2749 (define-public (call-pure-function unpure args start end)
> 2750   (if (ly:unpure-pure-container? unpure)
>           (...) ;; the true branch
> 2760       (if (ly:simple-closure? unpure)
> 2761           (ly:eval-simple-closure (car args) unpure start end)
> 2762           (if (not (procedure? unpure))
> 2763               unpure
> 2764               (if (memq unpure pure-functions)
> 2765                   (apply unpure args)
> 2766                   (let ((pure (assq unpure pure-conversions-alist)))
> 2767                     (if pure
> 2768                         (apply (cdr pure)
> 2769                                (append
> 2770                                 (list (car args) start end)
> 2771                                 (cdr args))))))))))
> 
> I think this assembles
> (,pure-chain-offset-callback (car args) start end (cdr args))
> 
> it seems the address register would hold the Grob* and the decrement register 
> a lists of remaining arguments (prev_offset in my case).
> 

Your right that, in the code above, the function gleaned from (cdr pure) gets 
passed (list (car args) start end (cdr args)).  I'm not exactly sure what that 
signifies, but that's what's going on.  When in doubt, I always just use pretty 
prints (format #t "foo ~a\n" args) to see what's going on.

Cheers,
MS




reply via email to

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