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