[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New format for autobeaming rules
From: |
Neil Puttock |
Subject: |
Re: New format for autobeaming rules |
Date: |
Fri, 24 Jul 2009 22:56:45 +0100 |
2009/7/24 Carl Sorensen <address@hidden>:
>> type check also for settings?
>
> Settings needs a list? type check, and I haven't seen one available
> in c++. It shouldn't segfault, because we do a pair check before we
> use it.
ly_is_list (which is a wrapper for scm_list_p) (but see below)
>
> I can't use a pair check for the argument, because '() is valid for
> settings.
>
> I could use pair_or_empty, but it doesn't exist
You could use ly_cheap_is_list, which does exactly this.
, and when I tried to
> add it to flower/include/guile-compatibility.hh, where all the rest of
> the types are defined, it gave me errors.
You'd need to add it to lily-guile.hh. guile-compatibility.hh is for
compatibility with guile 1.6.
>> type checks?
>
> Put in for time_signature, rule_type.
>
> Can't do one for beam_type, because it needs to be pair-or-symbol,
> and I couldn't figure out how to add it.
The long way:
Add this to lily-guile.hh,
inline bool ly_is_symbol_or_pair (SCM x) { return scm_is_symbol (x) ||
scm_is_pair (x); }
and this to init_func_doc () in function-documentation.cc,
ly_add_type_predicate ((void*) &ly_is_symbol_or_pair, "symbol or pair");
then you can use LY_ASSERT_TYPE with the new predicate:
LY_ASSERT_TYPE (ly_is_symbol_or_pair, beam_type, 4);
The shorter way (and better since this is unlikely to be used
elsewhere) is to do this:
SCM_ASSERT_TYPE (scm_is_symbol (beam_type) || scm_is_pair (beam_type),
beam_type, SCM_ARG4, __FUNCTION__, "symbol or pair");
>> sort
> But I couldn't find the header file that defined SCM through git
> grep. Do you know which file I need to include?
I think it's libguile.h, which is included in lily-guile.hh.
The following works for me:
beam-setting-scheme.cc:
#include "beam-settings.hh"
#include "context.hh"
beam-settings.hh:
(inside #define)
#include "lily-guile.hh"
>> decided not to restore original setting?
>
> I had decided to restore it in a different form. 1/8 beams are (6), which
> is equivalent to (3) in (3 . 4). All shorter beams will be (1 1 1).
Ah, so it is. I'll get the hang of the new settings eventually. :)
Regards,
Neil
- Re: New format for autobeaming rules, (continued)
Re: New format for autobeaming rules, n . puttock, 2009/07/15
Re: New format for autobeaming rules, joeneeman, 2009/07/21
Re: New format for autobeaming rules, Carl . D . Sorensen, 2009/07/22
Re: New format for autobeaming rules, joeneeman, 2009/07/22
Re: New format for autobeaming rules, n . puttock, 2009/07/22