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( |
… | |
… | |
66 | cursed |
68 | cursed |
67 | custom_name |
69 | custom_name |
68 | dam |
70 | dam |
69 | dam_modifier |
71 | dam_modifier |
70 | damned |
72 | damned |
|
|
73 | destroy_on_death |
71 | dex |
74 | dex |
72 | direction |
75 | direction |
73 | duration |
76 | duration |
74 | duration_modifier |
77 | duration_modifier |
75 | editable |
78 | editable |
… | |
… | |
92 | has_ready_rod |
95 | has_ready_rod |
93 | has_ready_scroll |
96 | has_ready_scroll |
94 | has_ready_skill |
97 | has_ready_skill |
95 | has_ready_wand |
98 | has_ready_wand |
96 | has_ready_weapon |
99 | has_ready_weapon |
|
|
100 | has_ready_range |
97 | hitback |
101 | hitback |
98 | hp |
102 | hp |
99 | identified |
103 | identified |
100 | immune |
104 | immune |
101 | int |
105 | int |
… | |
… | |
103 | invisible |
107 | invisible |
104 | is_animated |
108 | is_animated |
105 | is_blind |
109 | is_blind |
106 | is_buildable |
110 | is_buildable |
107 | is_cauldron |
111 | is_cauldron |
|
|
112 | is_dust |
108 | is_floor |
113 | is_floor |
109 | is_hilly |
114 | is_hilly |
110 | is_lightable |
115 | is_lightable |
111 | is_thrown |
116 | is_thrown |
112 | is_turnable |
117 | is_turnable |
… | |
… | |
153 | no_pick |
158 | no_pick |
154 | no_skill_ident |
159 | no_skill_ident |
155 | no_steal |
160 | no_steal |
156 | no_strength |
161 | no_strength |
157 | nrof |
162 | nrof |
|
|
163 | obj_original |
158 | object |
164 | object |
159 | oid |
165 | oid |
160 | one_hit |
166 | one_hit |
161 | only_attack |
167 | only_attack |
162 | other_arch |
168 | other_arch |
… | |
… | |
164 | path_attuned |
170 | path_attuned |
165 | path_denied |
171 | path_denied |
166 | path_repelled |
172 | path_repelled |
167 | perm_exp |
173 | perm_exp |
168 | pick_up |
174 | pick_up |
|
|
175 | player_sold |
169 | pow |
176 | pow |
170 | protected |
177 | protected |
171 | race |
178 | race |
172 | random_move |
179 | random_move |
173 | random_movement |
180 | random_movement |
… | |
… | |
244 | wiz |
251 | wiz |
245 | x |
252 | x |
246 | xrays |
253 | xrays |
247 | y |
254 | y |
248 | |
255 | |
249 | Object |
256 | maplore |
|
|
257 | endmaplore |
|
|
258 | enter_x |
|
|
259 | enter_y |
|
|
260 | width |
|
|
261 | height |
|
|
262 | reset_timeout |
|
|
263 | reset_time |
|
|
264 | swap_time |
|
|
265 | difficulty |
|
|
266 | darkness |
|
|
267 | fixed_resettime |
|
|
268 | per_player |
|
|
269 | per_party |
|
|
270 | region |
|
|
271 | shopitems |
|
|
272 | shopgreed |
|
|
273 | shopmin |
|
|
274 | shopmax |
|
|
275 | shoprace |
|
|
276 | outdoor |
|
|
277 | tile_path_1 |
|
|
278 | tile_path_2 |
|
|
279 | tile_path_3 |
|
|
280 | tile_path_4 |
|
|
281 | |
|
|
282 | file_format_version |
|
|
283 | |
|
|
284 | temp |
|
|
285 | pressure |
|
|
286 | humid |
|
|
287 | windspeed |
|
|
288 | winddir |
|
|
289 | sky |
|
|
290 | |
|
|
291 | map |
|
|
292 | savebed_map |
|
|
293 | bed_x |
|
|
294 | bed_y |
|
|
295 | password |
|
|
296 | shoottype |
|
|
297 | bowtype |
|
|
298 | petmode |
|
|
299 | gen_hp |
|
|
300 | gen_sp |
|
|
301 | gen_grace |
|
|
302 | listening |
|
|
303 | peaceful |
|
|
304 | digestion |
|
|
305 | pickup |
|
|
306 | outputs_sync |
|
|
307 | outputs_count |
|
|
308 | usekeys |
|
|
309 | unapply |
|
|
310 | weapon_sp |
|
|
311 | lev_array |
|
|
312 | endplst |
|
|
313 | |
|
|
314 | visibility |
|
|
315 | magicmap |
|
|
316 | |
|
|
317 | match |
|
|
318 | parent |
|
|
319 | longname |
|
|
320 | jail_map |
|
|
321 | jail_x |
|
|
322 | jail_y |
|
|
323 | fallback |
|
|
324 | nomore |
|
|
325 | |
|
|
326 | chance |
|
|
327 | mods |
|
|
328 | diff |
|
|
329 | saves |
|
|
330 | description |
|
|
331 | density |
|
|
332 | damage |
|
|
333 | |
|
|
334 | anim |
|
|
335 | mina |
|
|
336 | facings |
|
|
337 | player |
|
|
338 | |
|
|
339 | allowed |
|
|
340 | keycode |
|
|
341 | trans |
|
|
342 | yield |
|
|
343 | ingred |
|
|
344 | cauldron |
|
|
345 | |
250 | Str |
346 | Str |
251 | Dex |
347 | Dex |
252 | Con |
348 | Con |
253 | Wis |
349 | Wis |
254 | Cha |
350 | Cha |
255 | Int |
351 | Int |
256 | Pow |
352 | Pow |
257 | More |
|
|
258 | ); |
353 | ); |
259 | |
354 | |
260 | open GPERF, "|-", "gperf -m50 >kw_hash.h" |
355 | open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h" |
261 | or die "gperf: $!"; |
356 | or die "$ARGV{GPERF}: $!"; |
262 | |
357 | |
263 | print GPERF <<EOF; |
358 | print GPERF <<EOF; |
264 | %language=C++ |
359 | %language=C++ |
265 | %enum |
360 | %enum |
266 | %define class-name kw_lex |
361 | %define class-name kw_lex |
… | |
… | |
290 | print GPERF "};\n"; |
385 | print GPERF "};\n"; |
291 | |
386 | |
292 | printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n", |
387 | printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n", |
293 | join ", ", map length, @kw; |
388 | join ", ", map length, @kw; |
294 | |
389 | |
|
|
390 | close GPERF |
|
|
391 | or die "$ARG{GPERF}: failed to run"; |
|
|
392 | |
295 | open KW, ">", "keyword.h"; |
393 | open KW, ">", "keyword.h"; |
296 | |
394 | |
297 | print KW <<EOF; |
395 | print KW <<EOF; |
298 | #ifndef KW_H__ |
396 | #ifndef KW_H__ |
299 | #define KW_H__ |
397 | #define KW_H__ |
300 | |
398 | |
301 | enum keyword { |
399 | enum keyword { |
302 | KW_EOF, KW_ERROR, |
400 | KW_NULL = 0, |
|
|
401 | KW_EOF = 0, |
|
|
402 | KW_ERROR, |
303 | EOF |
403 | EOF |
304 | |
404 | |
305 | for (@kw) { |
405 | for (@kw) { |
306 | printf KW " %s,\n", "KW_$_", |
406 | printf KW " %s,\n", "KW_$_", |
307 | } |
407 | } |