This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In regen/*.pl, refactor the repeated code for close and rename if different.
[perl5.git] / regen / keywords.pl
CommitLineData
eada5d41 1#!/usr/bin/perl -w
6294c161
DM
2#
3# Regenerate (overwriting only if changed):
4#
5# keywords.h
6#
7# from information stored in the DATA section of this file.
8#
9# Accepts the standard regen_lib -q and -v args.
10#
11# This script is normally invoked from regen.pl.
12
eada5d41 13use strict;
a0d0e21e 14
af001346 15require 'regen/regen_lib.pl';
b6b9a099 16
f038801a 17my $kw = safer_open('keywords.h-new', 'keywords.h');
424a4936 18select $kw;
a0d0e21e 19
78102347
NC
20print read_only_top(lang => 'C', by => 'regen/keywords.pl', from => 'its data',
21 file => 'keywords.h', style => '*',
22 copyright => [1994 .. 1997, 1999 .. 2002, 2005 .. 2007]);
d6376244 23
a0d0e21e
LW
24# Read & print data.
25
eada5d41 26my $keynum = 0;
a0d0e21e
LW
27while (<DATA>) {
28 chop;
29 next unless $_;
30 next if /^#/;
eada5d41 31 my ($keyword) = split;
a0d0e21e
LW
32 print &tab(5, "#define KEY_$keyword"), $keynum++, "\n";
33}
34
424a4936 35print $kw "\n/* ex: set ro: */\n";
37442d52 36
f038801a 37close_and_rename($kw);
b6b9a099 38
a0d0e21e
LW
39###########################################################################
40sub tab {
eada5d41 41 my ($l, $t) = @_;
a0d0e21e
LW
42 $t .= "\t" x ($l - (length($t) + 1) / 8);
43 $t;
44}
45###########################################################################
46__END__
47
48NULL
a0d0e21e 49__FILE__
68dc0745 50__LINE__
51__PACKAGE__
e50aee73 52__DATA__
a0d0e21e
LW
53__END__
54AUTOLOAD
55BEGIN
3c10abe3 56UNITCHECK
a0d0e21e
LW
57CORE
58DESTROY
59END
7d07dbc2 60INIT
7d30b5c4 61CHECK
a0d0e21e
LW
62abs
63accept
64alarm
65and
66atan2
67bind
68binmode
69bless
0d863452 70break
a0d0e21e
LW
71caller
72chdir
73chmod
74chomp
75chop
76chown
77chr
78chroot
79close
80closedir
81cmp
82connect
83continue
84cos
85crypt
86dbmclose
87dbmopen
0d863452 88default
a0d0e21e
LW
89defined
90delete
91die
92do
93dump
94each
95else
96elsif
97endgrent
98endhostent
99endnetent
100endprotoent
101endpwent
102endservent
103eof
104eq
105eval
106exec
107exists
108exit
109exp
110fcntl
111fileno
112flock
113for
114foreach
115fork
116format
117formline
118ge
119getc
120getgrent
121getgrgid
122getgrnam
123gethostbyaddr
124gethostbyname
125gethostent
126getlogin
127getnetbyaddr
128getnetbyname
129getnetent
130getpeername
131getpgrp
132getppid
133getpriority
134getprotobyname
135getprotobynumber
136getprotoent
137getpwent
138getpwnam
139getpwuid
140getservbyname
141getservbyport
142getservent
143getsockname
144getsockopt
0d863452 145given
a0d0e21e
LW
146glob
147gmtime
148goto
149grep
150gt
151hex
152if
153index
154int
155ioctl
156join
157keys
158kill
159last
160lc
161lcfirst
162le
163length
164link
165listen
166local
167localtime
c0329465 168lock
a0d0e21e
LW
169log
170lstat
171lt
172m
173map
174mkdir
175msgctl
176msgget
177msgrcv
178msgsnd
179my
180ne
181next
182no
183not
184oct
185open
186opendir
187or
188ord
77ca0c92 189our
a0d0e21e
LW
190pack
191package
192pipe
193pop
194pos
195print
196printf
c07a80fd 197prototype
a0d0e21e
LW
198push
199q
200qq
8782bef2 201qr
a0d0e21e
LW
202quotemeta
203qw
204qx
205rand
206read
207readdir
208readline
209readlink
210readpipe
211recv
212redo
213ref
214rename
215require
216reset
217return
218reverse
219rewinddir
220rindex
221rmdir
222s
0d863452 223say
a0d0e21e
LW
224scalar
225seek
226seekdir
227select
228semctl
229semget
230semop
231send
232setgrent
233sethostent
234setnetent
235setpgrp
236setpriority
237setprotoent
238setpwent
239setservent
240setsockopt
241shift
242shmctl
243shmget
244shmread
245shmwrite
246shutdown
247sin
248sleep
249socket
250socketpair
251sort
252splice
253split
254sprintf
255sqrt
256srand
257stat
952306ac 258state
a0d0e21e
LW
259study
260sub
261substr
262symlink
263syscall
c07a80fd 264sysopen
a0d0e21e 265sysread
137443ea 266sysseek
a0d0e21e
LW
267system
268syswrite
269tell
270telldir
271tie
c07a80fd 272tied
a0d0e21e
LW
273time
274times
275tr
276truncate
277uc
278ucfirst
279umask
280undef
281unless
282unlink
283unpack
284unshift
285untie
286until
287use
288utime
289values
290vec
291wait
292waitpid
293wantarray
294warn
0d863452 295when
a0d0e21e
LW
296while
297write
298x
299xor
300y