ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/genkeywords
Revision: 1.10
Committed: Mon Sep 8 11:27:25 2008 UTC (15 years, 8 months ago) by root
Branch: MAIN
CVS Tags: rel-2_71
Changes since 1.9: +1 -0 lines
Log Message:
*** empty log message ***

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