X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=regcomp.pl;h=7fdbd1303fb46028a27e524ab532ef568a23cace;hb=115454352a978d4e8b08f627af1ad772bab2816b;hp=14c2eb7be2e672e940dea1bd978d7c1c430e13fb;hpb=5d458dd8ef53373c3f90d568f6668084b0ccbc62;p=p5sagit%2Fp5-mst-13.2.git diff --git a/regcomp.pl b/regcomp.pl index 14c2eb7..7fdbd13 100644 --- a/regcomp.pl +++ b/regcomp.pl @@ -1,3 +1,18 @@ +#!/usr/bin/perl +# +# Regenerate (overwriting only if changed): +# +# regnodes.h +# +# from information stored in +# +# regcomp.sym +# regexp.h +# +# Accepts the standard regen_lib -q and -v args. +# +# This script is normally invoked from regen.pl. + BEGIN { # Get function prototypes require 'regen_lib.pl'; @@ -64,15 +79,13 @@ close DESC; die "Too many regexp/state opcodes! Maximum is 256, but there are $lastregop in file!" if $lastregop>256; -my $tmp_h = 'tmp_reg.h'; +my $tmp_h = 'regnodes.h-new'; unlink $tmp_h if -f $tmp_h; -open OUT, ">$tmp_h"; -#*OUT=\*STDOUT; -binmode OUT; +my $out = safer_open($tmp_h); -printf 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 <