[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem calling scheme code from C++
From: |
Reinhold Kainhofer |
Subject: |
Problem calling scheme code from C++ |
Date: |
Wed, 20 Aug 2008 19:30:56 +0200 |
User-agent: |
KMail/1.9.9 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm having serious problems calling a scheme function from C++ code. In
particular:
In Stem::flag (Grob *me), I have (stripped-down):
~~~~~~~~~~~~~~~~~~~~~~~~~~~
SCM flag_style_scm = me->get_property ("flag-style");
SCM slog = scm_int2num(log);
SCM stc_scm = scm_call_2 (flag_style_scm,
me->self_scm(), slog);
return *unsmob_stencil (stc_scm);
~~~~~~~~~~~~~~~~~~~~~~~~~~~
and my .ly file is:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
#(define (test-flag grob log)
(ly:message "test-flag, grob=~a, log=~a" grob log)
empty-stencil)
{\autoBeamOff \override Stem #'flag-style = #test-flag
c'8 c'16 c'32 c'64
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~
However, when I run this file, I get the error:
ERROR: In procedure test-flag:
ERROR: Wrong number of arguments to #<procedure test-flag (grob log)>
I don't understand the error, since I call the function with two arguments..
If I change the signature of test-flag to (test-flag grob . log) I see that
log is indeed (). So, I suppose that slog is not a valid scheme object or is
not passed to the function for some reason... Does anyone know why?
However, even if I pass some other scheme object (or use the (test-flag grob .
log) signature), then I get the error:
ERROR: In procedure apply:
ERROR: Wrong type argument in position 1: #<Stencil >
I also don't understand this error message and where it might come from... It
is triggered in the scm_call_2 call, because even if I comment out the
assertion and the unsmobbing, I get that error. Strange enough, the test-flag
function IS executed (because the output on the command line is:
test-flag, grob=#<Grob Stem >, log=()
ERROR: In procedure apply:
ERROR: Wrong type argument in position 1: #<Stencil >
One other thing I don't know how to do is to call a scheme function with a
hard-coded name (e.g. I want to call the function (mensural-flag ...) with
scm_call_2). How can I call that function explicitly from C++?
Thanks,
Reinhold
- --
- ------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: address@hidden, http://reinhold.kainhofer.com/
* Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
* K Desktop Environment, http://www.kde.org, KOrganizer maintainer
* Chorvereinigung "Jung-Wien", http://www.jung-wien.at/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFIrFTWTqjEwhXvPN0RAtk1AJ9cgBs0o2lbaqdGAaVUoya+4URMGwCgrP6S
IRSBvy8+U1A+4PhrjYmZyJ8=
=Fwb8
-----END PGP SIGNATURE-----
- Problem calling scheme code from C++,
Reinhold Kainhofer <=