You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ja...@apache.org on 2001/11/03 06:04:36 UTC

cvs commit: xml-xerces/perl postModule.pl

jasons      01/11/02 21:04:36

  Modified:    perl     postModule.pl
  Log:
  	* postModule.pl (Repository):
  	Added IDOM_Node::operator== and !=
  	the variable stubs code is now needed because of the UTF-8
  	   debugging flags
  	removed useless SWIG-1.1 cruft
  	Fixed XMLUri bug where constructor was calling tied() on a
  	  string.
  	Added forgotten cases to I?DOM_Node::serialize()
  
  Revision  Changes    Path
  1.21      +43 -45    xml-xerces/perl/postModule.pl
  
  Index: postModule.pl
  ===================================================================
  RCS file: /home/cvs/xml-xerces/perl/postModule.pl,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- postModule.pl	2001/10/12 04:35:42	1.20
  +++ postModule.pl	2001/11/03 05:04:36	1.21
  @@ -73,6 +73,17 @@
       if (/^package/) {
         ($CURR_CLASS) = m/package\s+XML::Xerces::([\w_]+);/;
         print TEMP;
  +      if ($CURR_CLASS eq 'IDOM_Node') {
  +	print TEMP <<'TEXT';
  +use overload
  +    "==" => sub { $_[0]->operator_equal_to($_[1])},
  +    "!=" => sub { $_[0]->operator_not_equal_to($_[1])},
  +    "fallback" => 1;
  +*operator_not_equal_to = *XML::Xercesc::IDOM_Node_operator_not_equal_to;
  +*operator_equal_to = *XML::Xercesc::IDOM_Node_operator_equal_to;
  +
  +TEXT
  +      }
         next;
       }
       # for some reason (I don't want to figure out) SWIG puts a bunch of
  @@ -85,16 +96,6 @@
         }
       }
   
  -    # swig also grabs some static variables from PlatformUtils.hpp
  -    # that don't work because we've ripped out the functionality 
  -    # of the primary XML::Xerces class
  -    if (/VARIABLE STUBS/) {
  -      while (<FILE>) {
  -	next unless /\#\#\#\#\#\#\#\#\#\#\#\#\#/;
  -	last;
  -      }
  -    }
  -
       # we're only keeping DESTROY for the parsers until we know better
       # we get core dumps if it's defined on some classes
       if (/sub DESTROY/) {
  @@ -126,10 +127,16 @@
       #
       #    CHANGE "$args[0] = tied(%{$args[0]})"
       #    TO     "$args[0] = tied(%{$args[0]}) || $args[0]"
  -    # split on multiple lines to be readable, using s{}{}x
  -    s{
  -      (\$args\[(\d+)\])\s*=\s*tied\(\%\{\$args\[\2\]\}\)
  -     }{$& || $1}x;
  +    #    then we wrap it in a defined $args[0] to remove the irritating warning
  +    if (m{\$args\[0\]\s+=\s+tied\(\%\{\$args\[0\]\}\)}) {
  +      print TEMP <<'EOT';
  +       if (defined $args[0]) {
  +	 $args[0] = tied(%{$args[0]}) || $args[0];
  +       }
  +EOT
  +      next;
  +    }
  +
   
       #   CHANGE "return undef if (!defined($result))"
       #   TO     "return $result unless ref($result) =~ m[XML::Xerces]"
  @@ -140,38 +147,11 @@
   
       #######################################################################
       #
  -    # MUNG NAMESPACE to XML::Xerces
  +    # Perl API specific changes
       #
  -    # this is for SWIG 1.1, because -package is broken
  -    s/([^:])\bXerces/$ {1}XML::Xerces/g;
  -    s/package\s+(?!XML::Xerces)([^\s;])/package XML::Xerces::$1/;
   
  -    # split on multiple lines to be readable, using s<><>x
  -    s<\@ISA\s*=\s*qw\s*\(\s*XML::Xerces\s*(?!XML::Xerces::)(\S+)\s*\)>
  -      <\@ISA = qw( XML::Xerces XML::Xerces::$1 )>x;
  -
  -    s/\$(?!XML::Xerces)(\w+)::OWNER/\$XML::Xerces::$1::OWNER/;
  -    s/bless(.*?)"(?!XML::Xerces)(.*?)"/bless$1"XML::Xerces::$2"/;
  -    s/tie(.*?)"(?!XML::Xerces)(.*?)"/tie$1"XML::Xerces::$2"/;
  -
  -    # bad SWIG
  -
  -    if (m/\$args\[0\]\s+=\s+tied\(\%\{\$args\[0\]\}\)\s+\|\|\s+\$args\[0\];/){
  -      print TEMP <<'EOT';
  -       if (defined $args[0]) {
  -	 $args[0] = tied(%{$args[0]}) || $args[0];
  -       }
  -EOT
  -      next;
  -    }
  -
  -     #######################################################################
  -     #
  -     # Perl API specific changes
  -     #
  -
  -     #   I?DOM_NodeList: automatically convert to perl list
  -     #      if called in a list context
  +    #   I?DOM_NodeList: automatically convert to perl list
  +    #      if called in a list context
       if (grep {/$CURR_CLASS/} @dom_node_list_methods) {
         if (my ($sub) = /^sub\s+([\w_]+)/) {
   	$sub = "$ {CURR_CLASS}::$sub";
  @@ -419,6 +399,7 @@
       if (scalar @args == 1) {
         $self = XML::Xercesc::new_XMLUri__constructor__uri(@args);
       } else {
  +      $args[0] = tied(%{$args[0]});
         $self = XML::Xercesc::new_XMLUri(@args);
       }
   EOT
  @@ -427,6 +408,7 @@
   		   qr/\$self = XML::Xercesc::new_/,
   		   $new,
   		   0,
  +		   $subst_func,
   		  );
   	next;
         }
  @@ -496,7 +478,11 @@
         } elsif (/^sub\s+new/) {
   	my $new = <<'EOT';
       if (ref($args[0])) {
  -      $self = XML::Xercesc::new_XMLURL__constructor__copy(@args);
  +      if (scalar @args == 1) {
  +        $self = XML::Xercesc::new_XMLURL__constructor__copy(@args);
  +      } else {
  +        $self = XML::Xercesc::new_XMLURL__constructor__url_base(@args);
  +      }
       } elsif (! scalar @args) {
         $self = XML::Xercesc::new_XMLURL();
       } elsif (scalar @args == 1) {
  @@ -894,6 +880,12 @@
   	if $node_type == $XML::Xerces::IDOM_Node::ENTITY_NODE;
     return _reinterpret_cast('XML::Xerces::IDOM_XMLDecl', $_[0])
   	if $node_type == $XML::Xerces::IDOM_Node::XML_DECL_NODE;
  +  return _reinterpret_cast('XML::Xerces::IDOM_Attr', $_[0])
  +	if $node_type == $XML::Xerces::IDOM_Node::ATTRIBUTE_NODE;
  +  return _reinterpret_cast('XML::Xerces::IDOM_DocumentFragment', $_[0])
  +	if $node_type == $XML::Xerces::IDOM_Node::DOCUMENT_FRAGMENT_NODE;
  +  return _reinterpret_cast('XML::Xerces::IDOM_Notation', $_[0])
  +	if $node_type == $XML::Xerces::IDOM_Node::NOTATION_NODE;
   
     return $_[0];
   }
  @@ -1095,6 +1087,12 @@
   	if $node_type == $XML::Xerces::DOM_Node::ENTITY_NODE;
     return _reinterpret_cast('XML::Xerces::DOM_XMLDecl', $_[0])
   	if $node_type == $XML::Xerces::DOM_Node::XML_DECL_NODE;
  +  return _reinterpret_cast('XML::Xerces::DOM_Attr', $_[0])
  +	if $node_type == $XML::Xerces::DOM_Node::ATTRIBUTE_NODE;
  +  return _reinterpret_cast('XML::Xerces::DOM_DocumentFragment', $_[0])
  +	if $node_type == $XML::Xerces::DOM_Node::DOCUMENT_FRAGMENT_NODE;
  +  return _reinterpret_cast('XML::Xerces::DOM_Notation', $_[0])
  +	if $node_type == $XML::Xerces::DOM_Node::NOTATION_NODE;
   
     return $_[0];
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org