jasons      2002/11/12 22:43:48

  Modified:    perl     postModule.pl
  Log:
        * postModule.pl (Repository):
        hack to handle SWIG multiple inheritance bug
  
  Revision  Changes    Path
  1.30      +88 -0     xml-xerces/perl/postModule.pl
  
  Index: postModule.pl
  ===================================================================
  RCS file: /home/cvs/xml-xerces/perl/postModule.pl,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- postModule.pl     19 Oct 2002 23:05:20 -0000      1.29
  +++ postModule.pl     13 Nov 2002 06:43:48 -0000      1.30
  @@ -180,6 +180,75 @@
         }
       }
   
  +
  +    # handle SWIG bug
  +    if ($CURR_CLASS eq 'DOMNode') {
  +      if (/^\*([a-z]\w+)/) {
  +     print TEMP <<"EOT";
  +sub $1 {
  +    my \@args = \@_;
  +    if (\$args[0]->isa('XML::Xerces::DOMDocument')) {
  +      \$args[0] = \$args[0]->toDOMNode();
  +    }
  +    my \$result = XML::Xercesc::DOMNode_$1(\@args);
  +    return \$result unless UNIVERSAL::isa(\$result,'XML::Xerces');
  +    my \%resulthash;
  +    tie \%resulthash, ref(\$result), \$result;
  +    return bless \\\%resulthash, ref(\$result);
  +}
  +EOT
  +     next;
  +      }
  +      if (/^sub\s+[a-z]/) {
  +     my $fix = <<'EOT';
  +    if ($args[0]->isa('XML::Xerces::DOMDocument')) {
  +      $args[0] = $args[0]->toDOMNode();
  +    }
  +EOT
  +     fix_method(\*FILE,
  +                \*TEMP,
  +                qr/my \@args/,
  +                $fix,
  +                1);
  +     next;
  +      }
  +    }
  +
  +    if ($CURR_CLASS eq 'DOMWriter') {
  +      if (/^\*writeNode/) {
  +     print TEMP <<'EOT';
  +sub writeNode {
  +    my @args = @_;
  +    if ($args[2]->isa('XML::Xerces::DOMDocument')) {
  +      $args[2] = $args[2]->toDOMNode();
  +    }
  +    my $result = XML::Xercesc::DOMWriter_writeNode(@args);
  +    return $result unless UNIVERSAL::isa($result,'XML::Xerces');
  +    my %resulthash;
  +    tie %resulthash, ref($result), $result;
  +    return bless \%resulthash, ref($result);
  +}
  +EOT
  +     next;
  +      }
  +      if (/^\*writeToString/) {
  +     print TEMP <<'EOT';
  +sub writeToString {
  +    my @args = @_;
  +    if ($args[1]->isa('XML::Xerces::DOMDocument')) {
  +      $args[1] = $args[1]->toDOMNode();
  +    }
  +    my $result = XML::Xercesc::DOMWriter_writeToString(@args);
  +    return $result unless UNIVERSAL::isa($result,'XML::Xerces');
  +    my %resulthash;
  +    tie %resulthash, ref($result), $result;
  +    return bless \%resulthash, ref($result);
  +}
  +EOT
  +     next;
  +      }
  +    }
  +
       # we need to fix setAttribute() so that undefined values don't
       # cause a core dump
       if ($CURR_CLASS =~ /DOMElement/) {
  @@ -341,6 +410,9 @@
         $XML::Xerces::DOMTreeWalker::OWNER{$self}->{__NODE_FILTER} = $callback;
       }
       my @args = ($self,$root,$what,$callback,$expand);
  +    if ($args[0]->isa('XML::Xerces::DOMDocument')) {
  +      $args[0] = $args[0]->toDOMDocumentTraversal();
  +    }
   EOT
        fix_method(\*FILE,
                   \*TEMP,
  @@ -363,6 +435,22 @@
         $XML::Xerces::DOMNodeIterator::OWNER{$self}->{__NODE_FILTER} = $callback;
       }
       my @args = ($self,$root,$what,$callback,$expand);
  +    if ($args[0]->isa('XML::Xerces::DOMDocument')) {
  +      $args[0] = $args[0]->toDOMDocumentTraversal();
  +    }
  +EOT
  +     fix_method(\*FILE,
  +                \*TEMP,
  +                qr/my \@args/,
  +                $fix,
  +                0);
  +     next;
  +      }
  +    }
  +
  +    if ($CURR_CLASS eq 'DOMWriter') {
  +      if (/^sub\s+createNodeIterator/) {
  +     my $fix = <<'EOT';
   EOT
        fix_method(\*FILE,
                   \*TEMP,
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to