X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=regcomp.pl;h=7fdbd1303fb46028a27e524ab532ef568a23cace;hb=0b98bec9fd8d0513cb1904db85614d287298f7f8;hp=defbb5f7852ecd06f51b82cdfead402f7d1fb411;hpb=c8e4cf8b7082ad71ba42564a3d098566ed2a16ac;p=p5sagit%2Fp5-mst-13.2.git diff --git a/regcomp.pl b/regcomp.pl index defbb5f..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 <) { } } my %vrxf=reverse %rxfv; -printf OUT "\t/* Bits in extflags defined: %032b */\n",$val; +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), + printf $out qq(\t%-20s/* 0x%08x */\n), qq("$n",),2**$_; } -print OUT <