Re: [frogs] Changing subproperties with grob-set-property (working on bug #40)

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]


2009/11/1 Marc Hohl <marc@xxxxxxxxxx>:

> Staring at the code, I get a faint impression that it would be more
> difficult than I expected.
> But there is a file lily/nested-property.cc. Are there some functions that
> would do the job or
> at least something similar to it?

There's only one function in the file which will set a nested
property.  If you're still unsure, have a look at
new-dynamic-engraver.cc, which uses this function to set
'bound-details.

>
> At the moment, I think I understood the meaning of the arguments to
> LY_DEFINE:
> First comes the c++ name of the function, then the name used in scheme,
> then the number of required arguments, the number of optional arguments,
> then a zero (?? at least in every function I looked at), then a list of
> arguments (...)
> and the docstring.

You're on the right track. :)

The third number option sets a `rest' argument (see ly_format () for
an example).

> So the header of the definition could be
>
> LY_DEFINE (ly_grob_set_nested_property_x, "ly:grob-set-nested-property!",
>      3, 0, 0, (SCM grob, SCM symlist, SCM val),
>      "Set nested property @var{symlist} in grob @var{grob} to value
> @var{val}.")
> {
>  Grob *sc = unsmob_grob (grob);
>
>  LY_ASSERT_SMOB (Grob, grob, 1);
>  LY_ASSERT_TYPE (ly_is_list, symlist, 2);
>
> But that's more or less a guess...

Looks OK, though it's preferable to use ly_cheap_is_list for
typechecking symlist, since has a lower overhead.

Regards,
Neil

---

----
Join the Frogs!


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/