X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/952306aca140c014b38ba5eb2ed71dffaa548f0f..b4222fa9a30f89a491b9910b750d8aa7895a0e77:/keywords.pl diff --git a/keywords.pl b/keywords.pl index 441d04b..7ce010e 100755 --- a/keywords.pl +++ b/keywords.pl @@ -1,10 +1,21 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w +# +# Regenerate (overwriting only if changed): +# +# keywords.h +# +# from information stored in the DATA section of this file. +# +# Accepts the standard regen_lib -q and -v args. +# +# This script is normally invoked from regen.pl. + +use strict; require 'regen_lib.pl'; -safer_unlink ("keywords.h"); -open(KW, ">keywords.h") || die "Can't create keywords.h: $!\n"; -binmode KW; -select KW; + +my $kw = safer_open("keywords.h-new"); +select $kw; print <) { chop; next unless $_; next if /^#/; - ($keyword) = split; + my ($keyword) = split; print &tab(5, "#define KEY_$keyword"), $keynum++, "\n"; } -print KW "\n/* ex: set ro: */\n"; +print $kw "\n/* ex: set ro: */\n"; + +safer_close($kw); -close KW or die "Error closing keywords.h: $!"; +rename_if_different("keywords.h-new", "keywords.h"); ########################################################################### sub tab { - local($l, $t) = @_; + my ($l, $t) = @_; $t .= "\t" x ($l - (length($t) + 1) / 8); $t; } @@ -55,6 +68,7 @@ __DATA__ __END__ AUTOLOAD BEGIN +UNITCHECK CORE DESTROY END @@ -103,7 +117,6 @@ endpwent endservent eof eq -err eval exec exists