1 | #!/opt/bin/perl |
1 | #!/opt/bin/perl |
|
|
2 | |
|
|
3 | my %ARG = @ARGV; |
2 | |
4 | |
3 | use List::Util; |
5 | use List::Util; |
4 | |
6 | |
5 | # todo: gather dynamically |
7 | # todo: gather dynamically |
6 | my @kw = qw( |
8 | my @kw = qw( |
|
|
9 | no_pass |
|
|
10 | walk_on |
|
|
11 | walk_off |
|
|
12 | fly_on |
|
|
13 | fly_off |
|
|
14 | flying |
|
|
15 | |
7 | ac |
16 | ac |
8 | activate_on_push |
17 | activate_on_push |
9 | activate_on_release |
18 | activate_on_release |
10 | alive |
19 | alive |
11 | anim_speed |
20 | anim_speed |
… | |
… | |
59 | cursed |
68 | cursed |
60 | custom_name |
69 | custom_name |
61 | dam |
70 | dam |
62 | dam_modifier |
71 | dam_modifier |
63 | damned |
72 | damned |
|
|
73 | destroy_on_death |
64 | dex |
74 | dex |
65 | direction |
75 | direction |
66 | duration |
76 | duration |
67 | duration_modifier |
77 | duration_modifier |
68 | editable |
78 | editable |
… | |
… | |
85 | has_ready_rod |
95 | has_ready_rod |
86 | has_ready_scroll |
96 | has_ready_scroll |
87 | has_ready_skill |
97 | has_ready_skill |
88 | has_ready_wand |
98 | has_ready_wand |
89 | has_ready_weapon |
99 | has_ready_weapon |
|
|
100 | has_ready_range |
90 | hitback |
101 | hitback |
91 | hp |
102 | hp |
92 | identified |
103 | identified |
93 | immune |
104 | immune |
94 | int |
105 | int |
… | |
… | |
96 | invisible |
107 | invisible |
97 | is_animated |
108 | is_animated |
98 | is_blind |
109 | is_blind |
99 | is_buildable |
110 | is_buildable |
100 | is_cauldron |
111 | is_cauldron |
|
|
112 | is_dust |
101 | is_floor |
113 | is_floor |
102 | is_hilly |
114 | is_hilly |
103 | is_lightable |
115 | is_lightable |
104 | is_thrown |
116 | is_thrown |
105 | is_turnable |
117 | is_turnable |
… | |
… | |
146 | no_pick |
158 | no_pick |
147 | no_skill_ident |
159 | no_skill_ident |
148 | no_steal |
160 | no_steal |
149 | no_strength |
161 | no_strength |
150 | nrof |
162 | nrof |
|
|
163 | obj_original |
151 | object |
164 | object |
152 | oid |
165 | oid |
153 | one_hit |
166 | one_hit |
154 | only_attack |
167 | only_attack |
155 | other_arch |
168 | other_arch |
… | |
… | |
157 | path_attuned |
170 | path_attuned |
158 | path_denied |
171 | path_denied |
159 | path_repelled |
172 | path_repelled |
160 | perm_exp |
173 | perm_exp |
161 | pick_up |
174 | pick_up |
|
|
175 | player_sold |
162 | pow |
176 | pow |
163 | protected |
177 | protected |
164 | race |
178 | race |
165 | random_move |
179 | random_move |
166 | random_movement |
180 | random_movement |
… | |
… | |
223 | unaggressive |
237 | unaggressive |
224 | undead |
238 | undead |
225 | unique |
239 | unique |
226 | unpaid |
240 | unpaid |
227 | use_content_on_gen |
241 | use_content_on_gen |
|
|
242 | uuid |
228 | value |
243 | value |
229 | vulnerable |
244 | vulnerable |
230 | was_wiz |
245 | was_wiz |
231 | wc |
246 | wc |
232 | weapontype |
247 | weapontype |
… | |
… | |
235 | wis |
250 | wis |
236 | wiz |
251 | wiz |
237 | x |
252 | x |
238 | xrays |
253 | xrays |
239 | y |
254 | y |
|
|
255 | |
|
|
256 | Object |
|
|
257 | Str |
|
|
258 | Dex |
|
|
259 | Con |
|
|
260 | Wis |
|
|
261 | Cha |
|
|
262 | Int |
|
|
263 | Pow |
|
|
264 | More |
|
|
265 | |
|
|
266 | maplore |
|
|
267 | endmaplore |
|
|
268 | enter_x |
|
|
269 | enter_y |
|
|
270 | width |
|
|
271 | height |
|
|
272 | reset_timeout |
|
|
273 | reset_time |
|
|
274 | swap_time |
|
|
275 | difficulty |
|
|
276 | darkness |
|
|
277 | fixed_resettime |
|
|
278 | per_player |
|
|
279 | per_party |
|
|
280 | region |
|
|
281 | shopitems |
|
|
282 | shopgreed |
|
|
283 | shopmin |
|
|
284 | shopmax |
|
|
285 | shoprace |
|
|
286 | outdoor |
|
|
287 | tile_path_1 |
|
|
288 | tile_path_2 |
|
|
289 | tile_path_3 |
|
|
290 | tile_path_4 |
|
|
291 | |
|
|
292 | file_format_version |
|
|
293 | |
|
|
294 | temp |
|
|
295 | pressure |
|
|
296 | humid |
|
|
297 | windspeed |
|
|
298 | winddir |
|
|
299 | sky |
|
|
300 | |
|
|
301 | map |
|
|
302 | savebed_map |
|
|
303 | bed_x |
|
|
304 | bed_y |
|
|
305 | password |
|
|
306 | shoottype |
|
|
307 | bowtype |
|
|
308 | petmode |
|
|
309 | gen_hp |
|
|
310 | gen_sp |
|
|
311 | gen_grace |
|
|
312 | listening |
|
|
313 | peaceful |
|
|
314 | digestion |
|
|
315 | pickup |
|
|
316 | outputs_sync |
|
|
317 | outputs_count |
|
|
318 | usekeys |
|
|
319 | unapply |
|
|
320 | weapon_sp |
|
|
321 | lev_array |
|
|
322 | endplst |
|
|
323 | |
|
|
324 | color_fg |
|
|
325 | color_bg |
|
|
326 | visibility |
|
|
327 | magicmap |
|
|
328 | |
|
|
329 | parent |
|
|
330 | longname |
|
|
331 | jail_map |
|
|
332 | jail_x |
|
|
333 | jail_y |
|
|
334 | fallback |
|
|
335 | nomore |
|
|
336 | |
|
|
337 | chance |
|
|
338 | mods |
|
|
339 | diff |
|
|
340 | saves |
|
|
341 | description |
|
|
342 | density |
|
|
343 | damage |
|
|
344 | |
|
|
345 | anim |
|
|
346 | mina |
|
|
347 | facings |
|
|
348 | player |
240 | ); |
349 | ); |
241 | |
350 | |
242 | open GPERF, "|-", "gperf -m50 >kw_hash.h" |
351 | open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h" |
243 | or die "gperf: $!"; |
352 | or die "$ARGV{GPERF}: $!"; |
244 | |
353 | |
245 | print GPERF <<EOF; |
354 | print GPERF <<EOF; |
246 | %language=C++ |
355 | %language=C++ |
247 | %enum |
356 | %enum |
248 | %define class-name kw_lex |
357 | %define class-name kw_lex |
… | |
… | |
272 | print GPERF "};\n"; |
381 | print GPERF "};\n"; |
273 | |
382 | |
274 | printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n", |
383 | printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n", |
275 | join ", ", map length, @kw; |
384 | join ", ", map length, @kw; |
276 | |
385 | |
|
|
386 | close GPERF |
|
|
387 | or die "$ARG{GPERF}: failed to run"; |
|
|
388 | |
277 | open KW, ">", "keyword.h"; |
389 | open KW, ">", "keyword.h"; |
278 | |
390 | |
279 | print KW <<EOF; |
391 | print KW <<EOF; |
280 | #ifndef KW_H__ |
392 | #ifndef KW_H__ |
281 | #define KW_H__ |
393 | #define KW_H__ |
282 | |
394 | |
283 | enum keyword { |
395 | enum keyword { |
284 | KW_EOF, KW_ERROR, |
396 | KW_NULL = 0, |
|
|
397 | KW_EOF = 0, |
|
|
398 | KW_ERROR, |
285 | EOF |
399 | EOF |
286 | |
400 | |
287 | for (@kw) { |
401 | for (@kw) { |
288 | printf KW " %s,\n", "KW_$_", |
402 | printf KW " %s,\n", "KW_$_", |
289 | } |
403 | } |