In preparation for future changes.
if (s/ \# \s* define \s+ ( _? RXf_ \w+ ) \s+ //xi) {
chomp;
my $define = $1;
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) {
# Replace any prior defined symbols by their values
foreach my $key (keys %definitions) {
next unless $_ =~ /<</; # Bit defines use left shift
if($val & $newval) {
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;
}
$val|=$newval;
$rxfv{$define}= $newval;
}
my %vrxf=reverse %rxfv;
printf $out "\t/* Bits in extflags defined: %s */\n", unpack 'B*', pack 'N', $val;
}
my %vrxf=reverse %rxfv;
printf $out "\t/* Bits in extflags defined: %s */\n", unpack 'B*', pack 'N', $val;
for (0..31) {
my $power_of_2 = 2**$_;
my $n=$vrxf{$power_of_2};
for (0..31) {
my $power_of_2 = 2**$_;
my $n=$vrxf{$power_of_2};
if (! $n) {
# Here, there was no name that matched exactly the bit. It could be
if (! $n) {
# Here, there was no name that matched exactly the bit. It could be
# that name, and all the bits it matches
foreach my $name (keys %rxfv) {
if ($rxfv{$name} & $power_of_2) {
# 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};
- $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;
"FOLD", /* 0x00000004 */
"EXTENDED", /* 0x00000008 */
"KEEPCOPY", /* 0x00000010 */
"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 */
"UNUSED_BIT_8", /* 0x00000100 */
"ANCH_BOL", /* 0x00000200 */
"ANCH_MBOL", /* 0x00000400 */