[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Accessing Grob properties
From: |
David Kastrup |
Subject: |
Re: Accessing Grob properties |
Date: |
Fri, 22 Jan 2016 21:54:03 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Urs Liska <address@hidden> writes:
> It seems I'm now at a similar point in C++ Guile (scm_whatsoever) as I
> was with Guile Scheme at an earlier stage :-(
>
> SCM subdivide_details =
> scm_assq_ref (beam_settings_, ly_symbol2scm ("subdivide-details"));
>
> seems to fetch the right thing, namely something like
> '((beam-count . metric))
>
> But then I start to get lost.
> I would expect
>
> SCM beam_count_prop =
> scm_assq_ref (subdivide_details, ly_symbol2scm ("beam-count"));
>
> to assign beam_count_prop a symbol "metric" - as I get when I do the
> same thing in Scheme.
It does.
> 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.
> I would have expected that
>
> beaming_options_.subdivided_beam_count_ =
> (scm_eqv_p (ly_symbol2scm("one"), ly_symbol2scm("one")))
> ? ONE
> : (scm_eqv_p (subdiv_beam_count_prop,
> ly_symbol2scm("base-moment")))
> ? BASE_MOMENT
> : METRIC;
>
> would assing the (new) member subdivided_beam_count one out of the three
> constants, depending on the value of the property:
This isn't Emacs Lisp (which has a clever definition of nil, which in
Lisp serves both the functions of #f and '()). SCM_BOOL_F as a C
condition is _true_ rather than false.
--
David Kastrup
- Re: Handling of subdivisions with shortened beams, (continued)
- Re: Handling of subdivisions with shortened beams, Kieren MacMillan, 2016/01/18
- Re: Handling of subdivisions with shortened beams, Urs Liska, 2016/01/18
- Re: Handling of subdivisions with shortened beams, Simon Albrecht, 2016/01/18
- Re: Handling of subdivisions with shortened beams, Kieren MacMillan, 2016/01/18
- Re: Handling of subdivisions with shortened beams, Urs Liska, 2016/01/18
- Accessing Grob properties (was: Handling of subdivisions with shortened beams), Urs Liska, 2016/01/22
- Re: Accessing Grob properties, David Kastrup, 2016/01/22
- Re: Accessing Grob properties, Urs Liska, 2016/01/22
- Re: Accessing Grob properties, Urs Liska, 2016/01/22
- Re: Accessing Grob properties,
David Kastrup <=
- Re: Accessing Grob properties, Urs Liska, 2016/01/22
- Re: Accessing Grob properties, Paul Morris, 2016/01/24