ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/genkeywords
Revision: 1.9
Committed: Mon Sep 10 12:44:06 2007 UTC (16 years, 8 months ago) by root
Branch: MAIN
CVS Tags: rel-2_6, rel-2_7, rel-2_4, rel-2_5, rel-2_2, rel-2_3, rel-2_54, rel-2_55, rel-2_56, rel-2_52, rel-2_53, rel-2_32, rel-2_61, rel-2_43, rel-2_42, rel-2_41
Changes since 1.8: +1 -0 lines
Log Message:
- implement tag keyword but do not use it yet
- skip_block now skips known types of sub-blocks
- print the decoded filename if possible

File Contents

# Content
1 #!/opt/bin/perl
2
3 my %ARG = @ARGV;
4
5 use List::Util;
6
7 # todo: gather dynamically
8 my @kw = qw(
9 no_pass
10 walk_on
11 walk_off
12 fly_on
13 fly_off
14 flying
15
16 gender
17 attack_skill
18 ranged_skill
19
20 ac
21 activate_on_push
22 activate_on_release
23 alive
24 anim_speed
25 animation
26 applied
27 arch
28 armour
29 attach
30 attack_movement
31 attacktype
32 auto_apply
33 been_applied
34 berserk
35 blocksview
36 body_range
37 body_arm
38 body_torso
39 body_head
40 body_neck
41 body_skill
42 body_finger
43 body_shoulder
44 body_foot
45 body_hand
46 body_wrist
47 body_waist
48 body_shield
49 body_combat
50 can_apply
51 can_cast_spell
52 can_roll
53 can_see_in_dark
54 can_use_armour
55 can_use_bow
56 can_use_horn
57 can_use_range
58 can_use_ring
59 can_use_rod
60 can_use_scroll
61 can_use_shield
62 can_use_skill
63 can_use_wand
64 can_use_weapon
65 carrying
66 casting_time
67 cha
68 changing
69 client_type
70 con
71 confused
72 connected
73 container
74 cursed
75 custom_name
76 dam
77 dam_modifier
78 damned
79 destroy_on_death
80 dex
81 direction
82 duration
83 duration_modifier
84 editable
85 editor_folder
86 elevation
87 end
88 endlore
89 endmsg
90 exp
91 expmul
92 face
93 food
94 friendly
95 gen_sp_armour
96 generator
97 glow_radius
98 grace
99 has_ready_bow
100 has_ready_scroll
101 has_ready_skill
102 has_ready_weapon
103 has_ready_range
104 hitback
105 hp
106 identified
107 immune
108 inherit
109 int
110 inv_locked
111 invisible
112 is_animated
113 is_blind
114 is_buildable
115 is_cauldron
116 is_dust
117 is_floor
118 is_hilly
119 is_lightable
120 is_thrown
121 is_turnable
122 is_used_up
123 is_water
124 is_wooded
125 item_power
126 known_cursed
127 known_magical
128 last_eat
129 last_grace
130 last_heal
131 last_sp
132 level
133 lifesave
134 lore
135 luck
136 magic
137 make_invisible
138 material
139 materialname
140 maxgrace
141 maxhp
142 maxsp
143 monster
144 more
145 move_allow
146 move_block
147 move_off
148 move_on
149 move_slow
150 move_slow_penalty
151 move_state
152 move_type
153 msg
154 name
155 name_pl
156 neutral
157 no_attack
158 no_damage
159 no_drop
160 no_fix_player
161 no_magic
162 no_pick
163 no_skill_ident
164 no_steal
165 no_strength
166 nrof
167 obj_original
168 object
169 oid
170 one_hit
171 only_attack
172 other_arch
173 overlay_floor
174 owner
175 path_attuned
176 path_denied
177 path_repelled
178 perm_exp
179 pick_up
180 player_sold
181 pow
182 precious
183 protected
184 race
185 random_move
186 random_movement
187 randomitems
188 range
189 range_modifier
190 reflect_missile
191 reflect_spell
192 reflecting
193 resist_acid
194 resist_blind
195 resist_cancellation
196 resist_chaos
197 resist_cold
198 resist_confusion
199 resist_counterspell
200 resist_death
201 resist_deplete
202 resist_disease
203 resist_drain
204 resist_electricity
205 resist_fear
206 resist_fire
207 resist_ghosthit
208 resist_godpower
209 resist_holyword
210 resist_internal
211 resist_life_stealing
212 resist_magic
213 resist_paralyze
214 resist_physical
215 resist_poison
216 resist_slow
217 resist_turn_undead
218 resist_weaponmagic
219 run_away
220 scared
221 see_anywhere
222 see_invisible
223 skill
224 slaying
225 sleep
226 slow_move
227 sound
228 sound_destroy
229 smoothlevel
230 sp
231 speed
232 speed_left
233 splitting
234 stand_still
235 startequip
236 state
237 stealth
238 str
239 subtype
240 tag
241 tear_down
242 title
243 tooltype
244 treasure_env
245 type
246 unaggressive
247 undead
248 unique
249 unpaid
250 use_content_on_gen
251 uuid
252 value
253 vulnerable
254 wc
255 weapontype
256 weight
257 will_apply
258 wis
259 x
260 xrays
261 y
262
263 maplore
264 endmaplore
265 enter_x
266 enter_y
267 width
268 height
269 reset_timeout
270 reset_time
271 swap_time
272 difficulty
273 darkness
274 fixed_resettime
275 per_player
276 per_party
277 no_reset
278 region
279 shopitems
280 shopgreed
281 shopmin
282 shopmax
283 shoprace
284 outdoor
285 tile_path_1
286 tile_path_2
287 tile_path_3
288 tile_path_4
289
290 file_format_version
291
292 temp
293 pressure
294 humid
295 windspeed
296 winddir
297 sky
298
299 map
300 savebed_map
301 bed_x
302 bed_y
303 password
304 bowtype
305 petmode
306 gen_hp
307 gen_sp
308 gen_grace
309 listening
310 peaceful
311 digestion
312 pickup
313 outputs_sync
314 outputs_count
315 usekeys
316 unapply
317 weapon_sp
318 weapon_sp_left
319 lev_array
320 endplst
321
322 visibility
323 magicmap
324
325 parent
326 longname
327 jail_map
328 jail_x
329 jail_y
330 portal_map
331 portal_x
332 portal_y
333 fallback
334 nomore
335
336 chance
337 mods
338 diff
339 saves
340 description
341 density
342 damage
343
344 anim
345 mina
346 facings
347 player
348
349 allowed
350 keycode
351 trans
352 yield
353 ingred
354 cauldron
355
356 Str
357 Dex
358 Con
359 Wis
360 Cha
361 Int
362 Pow
363
364 treasure
365 treasureone
366 list
367 change_name
368 change_title
369 change_slaying
370 yes
371 no
372 );
373
374 open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h"
375 or die "$ARGV{GPERF}: $!";
376
377 print GPERF <<EOF;
378 %language=C++
379 %enum
380 %define class-name kw_lex
381 %define lookup-function-name match
382 %struct-type
383 %compare-strncmp
384 %delimiters=,
385 struct keyword_idx { const char *name; enum keyword index; };
386 %%
387 EOF
388
389 for (@kw) {
390 printf GPERF "%s,%s\n", $_, "KW_$_";
391 }
392
393 print GPERF <<EOF;
394 %%
395 extern const char *const keyword_str [] = {
396 "<EOF>",
397 "<ERROR>",
398 EOF
399
400 for (@kw) {
401 printf GPERF " \"%s\",\n", $_;
402 }
403
404 print GPERF "};\n";
405
406 printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
407 join ", ", map length, @kw;
408
409 close GPERF
410 or die "$ARG{GPERF}: failed to run";
411
412 open KW, ">", "keyword.h";
413
414 print KW <<EOF;
415 //
416 // AUTOGENERATED: this is a generated file
417 // edit include/genkeywords instead
418 //
419
420 #ifndef KW_H__
421 #define KW_H__
422
423 enum keyword {
424 KW_NULL = 0,
425 KW_EOF = 0,
426 KW_ERROR,
427 EOF
428
429 for (@kw) {
430 printf KW " %s,\n", "KW_$_",
431 }
432
433 print KW <<EOF;
434 NUM_KEYWORD,
435 };
436
437 extern const char *const keyword_str [];
438 extern const unsigned char keyword_len [];
439
440 EOF
441
442 printf KW "#define MAX_KEYWORD_LEN %d\n", List::Util::max map length, @kw;
443
444 print KW <<EOF;
445
446 #endif
447
448 EOF
449