# Get function prototypes
require 'regen/regen_lib.pl';
}
-#use Fatal qw(open close rename chmod unlink);
use strict;
open DESC, 'regcomp.sym';
$out_mask
};
#endif /* DOINIT */
-
EOP
}
-my $tmp_h = 'regnodes.h-new';
-
-unlink $tmp_h if -f $tmp_h;
-
-my $out = safer_open($tmp_h);
-
+my $out = open_new('regnodes.h', '>',
+ { by => 'regen/regcomp.pl', from => 'regcomp.sym' });
printf $out <<EOP,
-/* -*- buffer-read-only: t -*-
- !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
- This file is built by regen/regcomp.pl from regcomp.sym.
- Any changes made here will be lost!
-*/
-
/* Regops and State definitions */
#define %*s\t%d
foreach my $key (keys %definitions) {
s/\b$key\b/$definitions{$key}/g;
}
+
+ # Remove the U suffix from unsigned int literals
+ s/\b([0-9]+)U\b/$1/g;
+
my $newval = eval $_; # Get numeric definition
$definitions{$define} = $newval;
EOC
print $out process_flags('S', 'simple', <<'EOC');
+
/* The following always have a length of 1. U8 we can do strchr() on it. */
/* (Note that length 1 means "one character" under UTF8, not "one octet".) */
EOC
-print $out <<EOP;
-/* ex: set ro: */
-EOP
-safer_close($out);
-
-rename_if_different $tmp_h, 'regnodes.h';
+read_only_bottom_close_and_rename($out);