Fix problem with test47: addition is not bitwise OR

:diffsplit command used to include some flag value twice. If I was using bitwise
OR it would be OK, but I had addition here. Changed to use bitwise OR.
This commit is contained in:
ZyX 2014-06-14 17:02:05 +04:00
parent b8a32b6603
commit 1e11de5385
2 changed files with 530 additions and 598 deletions

View File

@ -1,70 +0,0 @@
#!/usr/bin/perl
use strict;
use warnings;
no utf8;
my $srcfname = shift @ARGV;
my $tgtfname = shift @ARGV;
if ($srcfname eq "--help") {
print << "EOF";
$0 path/to/ex_cmds_defs.h path/to/ex_cmds.lua
Translate Ex commands defines from old format to new one.
EOF
}
my $flag_const = qr((?:[A-Z]+[A-Z1-9]));
my $F;
open $F, "<", "$srcfname"
or die "Failed to open $srcfname";
my $T;
open $T, ">", "$tgtfname"
or die "Failed to open $tgtfname";
my ($enum_name, $cmd_name, $cmd_func);
my ($flags);
my $did_header = 0;
while (<$F>) {
if (/^#define\s+($flag_const)\s+(.*)/) {
my $const_name = $1;
my $const_value = $2;
$const_value =~ s@/\*.*|//.*@@g;
$const_value =~ s/\s+//g;
$const_value =~ s/\|/+/g;
$const_value =~ s/(?<=\d)L//g;
print $T "local $const_name = $const_value\n";
} elsif (/^\{/../^\}/) {
if (/^\s*EX\(\s*CMD_(\w+)\s*,\s*"((?:\\.|[^"\\])+)"\s*,\s*(\w+)\s*,\s*$/) {
$enum_name = $1;
$cmd_name = $2;
$cmd_func = $3;
} elsif (defined $enum_name and /^\s*($flag_const(?:\|$flag_const)*|0)/) {
if (not $did_header) {
print $T "return {\n";
$did_header = 1;
}
$flags = $1;
$flags =~ s/\|/+/g;
local $\ = "\n";
print $T " {";
print $T " command='$cmd_name',";
print $T " enum='CMD_$enum_name',"
if ($cmd_name ne $enum_name);
print $T " flags=$flags,";
print $T " func='$cmd_func',";
print $T " },";
undef $enum_name;
undef $cmd_name;
undef $cmd_func;
undef $flags;
} else {
next;
}
}
}
print $T "}\n";

File diff suppressed because it is too large Load Diff