ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/genkeywords
Revision: 1.13
Committed: Wed Nov 11 04:45:22 2009 UTC (14 years, 6 months ago) by root
Branch: MAIN
Changes since 1.12: +0 -1 lines
Log Message:
*** empty log message ***

File Contents

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