lilypond-user
[Top][All Lists]
Advanced

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

Re: Accessing Grob properties


From: Paul Morris
Subject: Re: Accessing Grob properties
Date: Sun, 24 Jan 2016 11:31:16 -0500

> Am 22.01.2016 um 21:54 schrieb David Kastrup:
>>> However, from there I don't get any further, and it seems I totally
>>>> don't understand how the Scheme types are matched in C++.
>>>> Any attempt to compare the content of beam_count_prop with a set of
>>>> predefined values seems to fail, and even
>>>> 
>>>>    if (scm_equal_p (ly_symbol2scm ("one"), ly_symbol2scm ("two")))
>>>> 
>>>> returns true (using scm_equal_p equally as for the eq and eqv
>>>> versions.
>> It does not return true but SCM_BOOL_F.  Which you then convert to a
>> true C++ boolean since it is non-zero.
>> 
>> You want   if (scm_is_eq (... ))
>> instead: predicates with name xxx_is_yyy return a C (or C++) boolean.
>> Predicates with name xxx_p return an SCM boolean which you need to
>> convert to a C++ boolean using, for example, scm_is_true.
>> 
>> ...
>> 
>> SCM_BOOL_F as a C condition is _true_ rather than false. 
> 
> Thank you for this clear and general explanation that will serve me much
> further than simply solving the problem at hand. Of course this totally
> makes sense - and works perfectly.

This is indeed helpful info.  I checked the CG to see if it covers this kind of 
thing, and it looks like it does, although I didn’t check closely enough to see 
if it covers this exact example.  

http://lilypond.org/doc/v2.19/Documentation/contributor/comparison

-Paul


reply via email to

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