Ticket #401: patch

File patch, 1.8 KB (added by Richard Boulton, 15 years ago)

Patch to fix compile errors with Weight directors enabled

  • python/generate-python-exceptions

     
    4343    serialise
    4444);
    4545
     46my @weight_virtual_methods = qw(
     47    init
     48    name
     49    get_sumpart
     50    get_maxpart
     51    get_sumextra
     52    get_maxextra
     53);
     54
    4655open FD, ">except.i" or die $!;
    4756
    4857print FD <<"EOF";
     
    181190EOF
    182191}
    183192
     193for my $method (@weight_virtual_methods) {
     194    print FD <<"EOF";
     195%exception Xapian::Weight::${method} {
     196    try {
     197        \$action
     198    } catch (...) {
     199        Xapian::SetPythonException();
     200        SWIG_fail;
     201    }
     202}
     203EOF
     204}
     205
    184206print FD <<'EOF';
    185207%exception Xapian::Stopper::get_description {
    186208    try {
  • xapian.i

     
    456456%ignore Xapian::Registry::operator=;
    457457%include <xapian/registry.h>
    458458
    459 /* Generated code won't compile if directors are enabled.  Disable for now
    460  * while we investigate.
    461  *
    462  * The problem comes from having a private pure virtual clone() function in
    463  * the Weight class. Directors work by multiple inheritance from both
    464  * SWIG_Director and the class they're directing; constructors in the target
    465  * language are then redirected to the director class. However the director
    466  * mechanism doesn't generate a wrapper for the clone() function (presumably
    467  * because it's private). This is wrong, because the director is then
    468  * abstract, which the SWIG generated code can't cope with.
    469  *
    470  * Also having a factory method might be a problem?
    471  */
    472 
    473 //%feature("director") Weight;
     459%feature("director") Weight;
    474460%ignore Xapian::Weight::Internal;
    475461%ignore Xapian::Weight::operator=;
    476462%ignore Xapian::Weight::Weight(const Weight &);