X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/4764e399f58c2e035a482e18aea2bd8c44fd9083..5149cfce110f600477036b7ec146007b3c1a2ba8:/regcomp.pl diff --git a/regcomp.pl b/regcomp.pl index 3ba699b..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 <