discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] SWIG, current gr-howto structure and exception specif


From: Martin Braun
Subject: [Discuss-gnuradio] SWIG, current gr-howto structure and exception specifiers
Date: Fri, 11 May 2012 13:03:31 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

In the current state of gr-howto (which is also used in gr_modtool), the
SWIG stuff is done pretty intelligently by using the header files as
.i-files, which means there is no need to write a SWIG header for every
block.

One advantage of this was the possibility to add stuff in the .i-file
which weren't in the .h-file; specifically, exception specifiers.

Example (from gr-specest, specest_welch.i):
<snip>
GR_SWIG_BLOCK_MAGIC(specest,welch);

specest_welch_sptr
specest_make_welch(unsigned fft_len, int overlap, int ma_len, bool fft_shift, 
const std::vector<float> &window)
        throw(std::invalid_argument);

// And so on .
</snip>

If I don't declare the exception specifier, I can't catch the exception
in Python. If I simply include specest_welch.h in specest_swig.i, I need
to add the specifiers in the C++-code, which is not very popular (and I
think not future-compatible, and gcc doesn't handle that well).

Here's my question: is there a cool way to have SWIG know about the
exceptions without having to write a .i-file for every block that uses
exceptions? Can I 'tag' the source code in a way that gcc doesn't care,
but SWIG does?

Thanks for any nice ideas!

MB


-- 
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstra├če 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT -- University of the State of Baden-W├╝rttemberg and
National Laboratory of the Helmholtz Association

Attachment: pgpnIhTHV8K0_.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]