ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/genkeywords
Revision: 1.7
Committed: Wed Aug 1 19:15:49 2007 UTC (16 years, 9 months ago) by root
Branch: MAIN
Changes since 1.6: +1 -1 lines
Log Message:
be more generic

File Contents

# User Rev Content
1 root 1.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 root 1.3 gender
17 root 1.1 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     path_attuned
175     path_denied
176     path_repelled
177     perm_exp
178     pick_up
179     player_sold
180     pow
181     precious
182     protected
183     race
184     random_move
185     random_movement
186     randomitems
187     range
188     range_modifier
189     reflect_missile
190     reflect_spell
191     reflecting
192     resist_acid
193     resist_blind
194     resist_cancellation
195     resist_chaos
196     resist_cold
197     resist_confusion
198     resist_counterspell
199     resist_death
200     resist_deplete
201     resist_disease
202     resist_drain
203     resist_electricity
204     resist_fear
205     resist_fire
206     resist_ghosthit
207     resist_godpower
208     resist_holyword
209     resist_internal
210     resist_life_stealing
211     resist_magic
212     resist_paralyze
213     resist_physical
214     resist_poison
215     resist_slow
216     resist_turn_undead
217     resist_weaponmagic
218     run_away
219     scared
220     see_anywhere
221     see_invisible
222     skill
223     slaying
224     sleep
225     slow_move
226 root 1.5 sound
227 root 1.7 sound_destroy
228 root 1.1 smoothlevel
229     sp
230     speed
231     speed_left
232     splitting
233     stand_still
234     startequip
235     state
236     stealth
237     str
238     subtype
239     tear_down
240     title
241     tooltype
242     treasure_env
243     type
244     unaggressive
245     undead
246     unique
247     unpaid
248     use_content_on_gen
249     uuid
250     value
251     vulnerable
252     wc
253     weapontype
254     weight
255     will_apply
256     wis
257     x
258     xrays
259     y
260    
261     maplore
262     endmaplore
263     enter_x
264     enter_y
265     width
266     height
267     reset_timeout
268     reset_time
269     swap_time
270     difficulty
271     darkness
272     fixed_resettime
273     per_player
274     per_party
275 root 1.2 no_reset
276 root 1.1 region
277     shopitems
278     shopgreed
279     shopmin
280     shopmax
281     shoprace
282     outdoor
283     tile_path_1
284     tile_path_2
285     tile_path_3
286     tile_path_4
287    
288     file_format_version
289    
290     temp
291     pressure
292     humid
293     windspeed
294     winddir
295     sky
296    
297     map
298     savebed_map
299     bed_x
300     bed_y
301     password
302     bowtype
303     petmode
304     gen_hp
305     gen_sp
306     gen_grace
307     listening
308     peaceful
309     digestion
310     pickup
311     outputs_sync
312     outputs_count
313     usekeys
314     unapply
315     weapon_sp
316     weapon_sp_left
317     lev_array
318     endplst
319    
320     visibility
321     magicmap
322    
323     parent
324     longname
325     jail_map
326     jail_x
327     jail_y
328     portal_map
329     portal_x
330     portal_y
331     fallback
332     nomore
333    
334     chance
335     mods
336     diff
337     saves
338     description
339     density
340     damage
341    
342     anim
343     mina
344     facings
345     player
346    
347     allowed
348     keycode
349     trans
350     yield
351     ingred
352     cauldron
353    
354     Str
355     Dex
356     Con
357     Wis
358     Cha
359     Int
360     Pow
361    
362     treasure
363     treasureone
364     list
365     change_name
366     change_title
367     change_slaying
368     yes
369     no
370     );
371    
372     open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h"
373     or die "$ARGV{GPERF}: $!";
374    
375     print GPERF <<EOF;
376     %language=C++
377     %enum
378     %define class-name kw_lex
379     %define lookup-function-name match
380     %struct-type
381     %compare-strncmp
382     %delimiters=,
383     struct keyword_idx { const char *name; enum keyword index; };
384     %%
385     EOF
386    
387     for (@kw) {
388     printf GPERF "%s,%s\n", $_, "KW_$_";
389     }
390    
391     print GPERF <<EOF;
392     %%
393     extern const char *const keyword_str [] = {
394     "<EOF>",
395     "<ERROR>",
396     EOF
397    
398     for (@kw) {
399     printf GPERF " \"%s\",\n", $_;
400     }
401    
402     print GPERF "};\n";
403    
404     printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
405     join ", ", map length, @kw;
406    
407     close GPERF
408     or die "$ARG{GPERF}: failed to run";
409    
410     open KW, ">", "keyword.h";
411    
412     print KW <<EOF;
413     //
414     // AUTOGENERATED: this is a generated file
415     // edit include/genkeywords instead
416     //
417    
418     #ifndef KW_H__
419     #define KW_H__
420    
421     enum keyword {
422     KW_NULL = 0,
423     KW_EOF = 0,
424     KW_ERROR,
425     EOF
426    
427     for (@kw) {
428     printf KW " %s,\n", "KW_$_",
429     }
430    
431     print KW <<EOF;
432     NUM_KEYWORD,
433     };
434    
435     extern const char *const keyword_str [];
436     extern const unsigned char keyword_len [];
437    
438     EOF
439    
440     printf KW "#define MAX_KEYWORD_LEN %d\n", List::Util::max map length, @kw;
441    
442     print KW <<EOF;
443    
444     #endif
445    
446     EOF
447