ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/genkeywords
Revision: 1.20
Committed: Sat May 7 17:14:41 2011 UTC (13 years ago) by root
Branch: MAIN
Changes since 1.19: +0 -7 lines
Log Message:
the deliantra perl module handles these

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