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