X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=regcomp.pl;h=239787ae554ea11a1aa7ff4a6e31a1712092a2c2;hb=0598b5ab3697b872539de6ed6dc1522b873602e1;hp=288497111583d10ee62cd9074e2011b751fc61ef;hpb=f9f4320a413e57e41ac9bf0d94d8c4e8dbe71ec8;p=p5sagit%2Fp5-mst-13.2.git diff --git a/regcomp.pl b/regcomp.pl index 2884971..239787a 100644 --- a/regcomp.pl +++ b/regcomp.pl @@ -48,19 +48,16 @@ while () { $ind++; $name[$ind]="$real$suffix"; $type[$ind]=$type; - $rest[$ind]="Regmatch state for $type"; + $rest[$ind]="state for $type"; } } } } } -my ($width,$rwidth,$twidth)=(0,0,0); -for (1..@name) { - $width=length($name[$_]) if $name[$_] and $width$tmp_h"; -#*OUT=\*STDOUT; -binmode OUT; +my $out = safer_open($tmp_h); -printf OUT < $tot - 1 ; -$ind = 0; -while (++$ind <= $tot) { + +for ($ind=1; $ind <= $lastregop ; $ind++) { my $oind = $ind - 1; - printf OUT "#define\t%*s\t%d\t/* %#04x %s */\n", + printf $out "#define\t%*s\t%d\t/* %#04x %s */\n", -$width, $name[$ind], $ind-1, $ind-1, $rest[$ind]; - print OUT "\n\t/* ------------ States ------------- */\n\n" - if $ind == $lastregop and $lastregop != $tot; +} +print $out "\t/* ------------ States ------------- */\n"; +for ( ; $ind <= $tot ; $ind++) { + printf $out "#define\t%*s\t(REGNODE_MAX + %d)\t/* %s */\n", + -$width, $name[$ind], $ind - $lastregop, $rest[$ind]; } -print OUT <) { + if (/#define\s+(RXf_\w+)\s+(0x[A-F\d]+)/i) { + my $newval = eval $2; + if($val & $newval) { + die sprintf "Both $1 and $reverse{$newval} use %08X", $newval; + } + $val|=$newval; + $rxfv{$1}= $newval; + $reverse{$newval} = $1; + } +} +my %vrxf=reverse %rxfv; +printf $out "\t/* Bits in extflags defined: %032b */\n",$val; +for (0..31) { + my $n=$vrxf{2**$_}||"UNUSED_BIT_$_"; + $n=~s/^RXf_(PMf_)?//; + printf $out qq(\t%-20s/* 0x%08x */\n), + qq("$n",),2**$_; +} + +print $out <