diff options
author | Yves Orton <demerphq@gmail.com> | 2013-03-25 20:08:56 +0100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2013-03-27 08:38:00 +0100 |
commit | 6976c98688aafe67a4a8b88a77e48e96b8ea0fb9 (patch) | |
tree | ec4935a1417fc625118f2245472412db8d582adc | |
parent | 3f5e3f2f07f57709accec3bfe9c57bc97f48246c (diff) | |
download | perl-6976c98688aafe67a4a8b88a77e48e96b8ea0fb9.tar.gz |
Improve how regcomp.pl handles multibits
In preparation for future changes.
-rw-r--r-- | regen/regcomp.pl | 23 | ||||
-rw-r--r-- | regnodes.h | 6 |
2 files changed, 19 insertions, 10 deletions
diff --git a/regen/regcomp.pl b/regen/regcomp.pl index 5e1abfb24a..97719b00ec 100644 --- a/regen/regcomp.pl +++ b/regen/regcomp.pl @@ -266,7 +266,8 @@ foreach my $file ("op_reg_common.h", "regexp.h") { if (s/ \# \s* define \s+ ( _? RXf_ \w+ ) \s+ //xi) { chomp; my $define = $1; - s: / \s* \* .*? \* \s* / : :x; # Replace comments by a blank + my $orig= $_; + s{ /\* .*? \*/ }{ }x; # Replace comments by a blank # Replace any prior defined symbols by their values foreach my $key (keys %definitions) { @@ -282,7 +283,12 @@ foreach my $file ("op_reg_common.h", "regexp.h") { next unless $_ =~ /<</; # Bit defines use left shift if($val & $newval) { - die sprintf "Both $define and $reverse{$newval} use %08X", $newval; + my @names=($define, $reverse{$newval}); + s/PMf_// for @names; + if ($names[0] ne $names[1]) { + die sprintf "ERROR: both $define and $reverse{$newval} use 0x%08X (%s:%s)", $newval, $orig, $_; + } + next; } $val|=$newval; $rxfv{$define}= $newval; @@ -292,9 +298,11 @@ foreach my $file ("op_reg_common.h", "regexp.h") { } my %vrxf=reverse %rxfv; printf $out "\t/* Bits in extflags defined: %s */\n", unpack 'B*', pack 'N', $val; +my %multibits; for (0..31) { my $power_of_2 = 2**$_; my $n=$vrxf{$power_of_2}; + my $extra = ""; if (! $n) { # Here, there was no name that matched exactly the bit. It could be @@ -309,16 +317,17 @@ for (0..31) { # that name, and all the bits it matches foreach my $name (keys %rxfv) { if ($rxfv{$name} & $power_of_2) { - $n = $name; - $power_of_2 = $rxfv{$name}; + $n = $name . ( $multibits{$name}++ ); + $extra= sprintf qq{ : "%s" - 0x%08x}, $name, $rxfv{$name} + if $power_of_2 != $rxfv{$name}; last; } } } } - $n=~s/^RXf_(PMf_)?//; - printf $out qq(\t%-20s/* 0x%08x */\n), - qq("$n",),$power_of_2; + s/\bRXf_(PMf_)?// for $n, $extra; + printf $out qq(\t%-20s/* 0x%08x%s */\n), + qq("$n",),$power_of_2, $extra; } print $out <<EOP; diff --git a/regnodes.h b/regnodes.h index 433460deea..fd2102e9ec 100644 --- a/regnodes.h +++ b/regnodes.h @@ -656,9 +656,9 @@ EXTCONST char * const PL_reg_extflags_name[] = { "FOLD", /* 0x00000004 */ "EXTENDED", /* 0x00000008 */ "KEEPCOPY", /* 0x00000010 */ - "CHARSET", /* 0x000000e0 */ - "CHARSET", /* 0x000000e0 */ - "CHARSET", /* 0x000000e0 */ + "CHARSET0", /* 0x00000020 : "CHARSET" - 0x000000e0 */ + "CHARSET1", /* 0x00000040 : "CHARSET" - 0x000000e0 */ + "CHARSET2", /* 0x00000080 : "CHARSET" - 0x000000e0 */ "UNUSED_BIT_8", /* 0x00000100 */ "ANCH_BOL", /* 0x00000200 */ "ANCH_MBOL", /* 0x00000400 */ |