## twiki-dev

 [TWiki-Dev] [SVN] PeterThoeny r21096 - in twiki/trunk/SpreadSheetPlugin/lib/TWiki/Plugins: . SpreadSheetPlugin From: - 2011-04-26 06:50:47 ```Author: PeterThoeny Date: 2011-04-26 01:50:40 -0500 (Tue, 26 Apr 2011) New Revision: 21096 Trac url: http://develop.twiki.org/trac/changeset/21096 Modified: twiki/trunk/SpreadSheetPlugin/lib/TWiki/Plugins/SpreadSheetPlugin.pm twiki/trunk/SpreadSheetPlugin/lib/TWiki/Plugins/SpreadSheetPlugin/Calc.pm Log: Item6690: New functions BITXOR(), HEXDECODE(), HEXENCODE(), XOR() Modified: twiki/trunk/SpreadSheetPlugin/lib/TWiki/Plugins/SpreadSheetPlugin/Calc.pm =================================================================== --- twiki/trunk/SpreadSheetPlugin/lib/TWiki/Plugins/SpreadSheetPlugin/Calc.pm 2011-04-26 05:34:13 UTC (rev 21095) +++ twiki/trunk/SpreadSheetPlugin/lib/TWiki/Plugins/SpreadSheetPlugin/Calc.pm 2011-04-26 06:50:40 UTC (rev 21096) @@ -341,6 +341,22 @@ } } + } elsif( \$theFunc eq "XOR" ) { + my @arr = _getListAsInteger( \$theAttr ); + \$result = shift( @arr ); + if( scalar( @arr ) > 0 ) { + foreach \$i ( @arr ) { + \$result = ( \$result xor \$i ); + } + } else { + \$result = 0; + } + \$result = \$result ? 1 : 0; + + } elsif( \$theFunc eq "BITXOR" ) { + my \$ff = chr(255) x length( \$theAttr ); + \$result = \$theAttr ^ \$ff; + } elsif( \$theFunc eq "NOT" ) { \$result = 1; \$result = 0 if( _getNumber( \$theAttr ) ); @@ -1029,6 +1045,14 @@ } elsif ( \$theFunc eq "EXISTS" ) { \$result = TWiki::Func::topicExists( \$web, \$theAttr ); \$result = 0 unless( \$result ); + + } elsif ( \$theFunc eq "HEXENCODE" ) { + \$result = uc( unpack( "H*", \$theAttr ) ); + + } elsif ( \$theFunc eq "HEXDECODE" ) { + \$theAttr =~ s/[^0-9A-Fa-f]//g; # only hex numbers + \$theAttr =~ s/.\$// if( length( \$theAttr ) % 2 ); # must be set of two + \$result = pack( "H*", \$theAttr ); } TWiki::Func::writeDebug( "- SpreadSheetPlugin::Calc::_doFunc: \$theFunc( \$theAttr ) returns: \$result" ) if \$debug; Modified: twiki/trunk/SpreadSheetPlugin/lib/TWiki/Plugins/SpreadSheetPlugin.pm =================================================================== --- twiki/trunk/SpreadSheetPlugin/lib/TWiki/Plugins/SpreadSheetPlugin.pm 2011-04-26 05:34:13 UTC (rev 21095) +++ twiki/trunk/SpreadSheetPlugin/lib/TWiki/Plugins/SpreadSheetPlugin.pm 2011-04-26 06:50:40 UTC (rev 21096) @@ -30,7 +30,7 @@ # Plugin version \$VERSION = '\$Rev\$'; -\$RELEASE = '2011-04-06'; +\$RELEASE = '2011-04-25'; \$doInit = 0; @@ -82,6 +82,5 @@ TWiki::Plugins::SpreadSheetPlugin::Calc::CALC( @_ ); } +# ========================= 1; - -# EOF ```