X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=keywords.pl;h=7ce010e609e502279b29af8b36b1ee5c8ddb37f5;hb=412147f664b7f5805591ad996d7e5a9e70b3d80f;hp=086a10956ab40423392c9f701b0c67c09967b7ce;hpb=c07a80fdfe3926b5eb0585b674aa5d1f57b32ade;p=p5sagit%2Fp5-mst-13.2.git diff --git a/keywords.pl b/keywords.pl index 086a109..7ce010e 100755 --- a/keywords.pl +++ b/keywords.pl @@ -1,22 +1,59 @@ -#!/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. -open(KW, ">keywords.h") || die "Can't create keywords.h: $!\n"; -select KW; +use strict; + +require 'regen_lib.pl'; + +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"; + +safer_close($kw); + +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; } @@ -24,21 +61,19 @@ sub tab { __END__ NULL -__LINE__ __FILE__ +__LINE__ +__PACKAGE__ __DATA__ __END__ AUTOLOAD BEGIN +UNITCHECK CORE DESTROY END -EQ -GE -GT -LE -LT -NE +INIT +CHECK abs accept alarm @@ -47,6 +82,7 @@ atan2 bind binmode bless +break caller chdir chmod @@ -64,6 +100,7 @@ cos crypt dbmclose dbmopen +default defined delete die @@ -120,6 +157,7 @@ getservbyport getservent getsockname getsockopt +given glob gmtime goto @@ -142,6 +180,7 @@ link listen local localtime +lock log lstat lt @@ -162,6 +201,7 @@ open opendir or ord +our pack package pipe @@ -173,6 +213,7 @@ prototype push q qq +qr quotemeta qw qx @@ -194,6 +235,7 @@ rewinddir rindex rmdir s +say scalar seek seekdir @@ -228,6 +270,7 @@ sprintf sqrt srand stat +state study sub substr @@ -235,6 +278,7 @@ symlink syscall sysopen sysread +sysseek system syswrite tell @@ -263,6 +307,7 @@ wait waitpid wantarray warn +when while write x