Hello list,
the topic is somewhat over my head, but perhaps someone with more insight
can answer this question?
Alternatively, I have a scheme function returning a boolean. This
function has
to be called from inside some c++-routines, but this doesn't work yet
(see below).
TIA,
Marc
-------- Original-Nachricht --------
Betreff: Re: Questions about Issue 1320: Scheme bar line interface
(issue 6305115)
Datum: Wed, 4 Jul 2012 06:48:56 +0200
Von: m...@apollinemike.com <m...@apollinemike.com>
An: Marc Hohl <m...@hohlart.de>
Hey Mark,
This is because, in this instance, you need to pass the function a
pointer to a function and not a bool. You can accomplish this through
anonymous functions in C++11. What'd be ideal is to create a C++ macro
that takes a scheme function plus a number of arguments and returns a
C++ pointer to an anonymous function.
I'll have a look in the train today and write you a more detailed
response. In the meantime, ask the devel list if the gcc compiler can
handle the types of anonymous functions specified here:
http://en.wikipedia.org/wiki/Anonymous_function#C.2B.2B
All the best,
Mike
On 3 juil. 2012, at 22:17, Marc Hohl wrote:
Hi Mike,
thanks for your quick answer!
Am 03.07.2012 21:13, schrieb m...@apollinemike.com
<mailto:m...@apollinemike.com>:
[...]
Hey Marc,
If the function is reused three times, you can rewrite it in Scheme.
Sorry for not having picked up on that. You can do a module call-up
as you had suggested before.
I don't get it right, compilation fails
note-spacing.cc: In static member function 'static Spring
Note_spacing::get_spacing(Grob*, Item*, Real, Real)':
note-spacing.cc:96:72: error: no matching function for call to
'Pointer_group_interface::find_grob(Item*&, SCM, bool&)'
note-spacing.cc:96:72: note: candidate is:
./include/pointer-group-interface.hh:36:16: note: static Grob*
Pointer_group_interface::find_grob(Grob*, SCM, bool (*)(Grob*))
./include/pointer-group-interface.hh:36:16: note: no known
conversion for argument 3 from 'bool' to 'bool (*)(Grob*)'
make[1]: *** [out/note-spacing.o] Error 1
This is how I tried to include the bar-line::non-empty-barline
function, defined as
(define-public (bar-line::non-empty-barline grob)
(and (grob::has-interface grob 'bar-line)
(pair? (ly:grob-extent grob grob X))))
diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc
index 4772367..074ad8d 100644
--- a/lily/note-spacing.cc
+++ b/lily/note-spacing.cc
@@ -20,7 +20,6 @@
#include "note-spacing.hh"
#include "accidental-placement.hh"
-#include "bar-line.hh"
#include "directional-element-interface.hh"
#include "grob-array.hh"
#include "moment.hh"
@@ -90,9 +89,11 @@ Note_spacing::get_spacing (Grob *me, Item *right_col,
&& !skys[RIGHT].is_empty ()
&& to_boolean (me->get_property ("space-to-barline")))
{
+ bool non_empty_barline =
+ ly_scm2bool (scm_call_1 (ly_lily_module_constant
("bar-line::non-empty-barline"), right_col->self_scm ()));
Grob *bar = Pointer_group_interface::find_grob (right_col,
ly_symbol2scm
("elements"),
- Bar_line::non_empty_barline);
+ non_empty_barline);
if (bar)
{
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel