ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/genkeywords
Revision: 1.1
Committed: Mon May 28 21:15:56 2007 UTC (17 years ago) by root
Branch: MAIN
Log Message:
- update copyrights in .h files, where applicable
- rename preprocess to genkeywords

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