ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/genkeywords
Revision: 1.18
Committed: Fri Apr 22 06:10:33 2011 UTC (13 years, 1 month ago) by root
Branch: MAIN
Changes since 1.17: +2 -0 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 root 1.14 random_speed
210 root 1.1 randomitems
211     range
212     range_modifier
213     reflect_missile
214     reflect_spell
215     reflecting
216     resist_acid
217     resist_blind
218     resist_cancellation
219     resist_chaos
220     resist_cold
221     resist_confusion
222     resist_counterspell
223     resist_death
224     resist_deplete
225     resist_disease
226     resist_drain
227     resist_electricity
228     resist_fear
229     resist_fire
230     resist_ghosthit
231     resist_godpower
232     resist_holyword
233     resist_internal
234     resist_life_stealing
235     resist_magic
236     resist_paralyze
237     resist_physical
238     resist_poison
239     resist_slow
240     resist_turn_undead
241     resist_weaponmagic
242     run_away
243     scared
244     see_anywhere
245     see_invisible
246     skill
247     slaying
248     sleep
249     slow_move
250 root 1.5 sound
251 root 1.7 sound_destroy
252 root 1.1 smoothlevel
253     sp
254     speed
255     speed_left
256 root 1.14 sl
257 root 1.1 splitting
258     stand_still
259     startequip
260     state
261     stealth
262     str
263     subtype
264 root 1.9 tag
265 root 1.1 tear_down
266     title
267     treasure_env
268     type
269     unaggressive
270     undead
271     unique
272     unpaid
273     use_content_on_gen
274     uuid
275     value
276     vulnerable
277     wc
278     weapontype
279     weight
280     will_apply
281     wis
282     x
283     xrays
284     y
285    
286     maplore
287     endmaplore
288     enter_x
289     enter_y
290     width
291     height
292     reset_timeout
293     reset_time
294     swap_time
295     difficulty
296     darkness
297     fixed_resettime
298     per_player
299     per_party
300 root 1.2 no_reset
301 root 1.1 region
302     shopitems
303     shopgreed
304     shopmin
305     shopmax
306     shoprace
307     outdoor
308     tile_path_1
309     tile_path_2
310     tile_path_3
311     tile_path_4
312 root 1.18 tile_path_5
313     tile_path_6
314 root 1.1
315     file_format_version
316    
317     map
318     savebed_map
319     bed_x
320     bed_y
321     password
322     bowtype
323     petmode
324     gen_hp
325     gen_sp
326     gen_grace
327     listening
328     peaceful
329     digestion
330     pickup
331     outputs_sync
332     outputs_count
333     usekeys
334     unapply
335     weapon_sp
336     weapon_sp_left
337     lev_array
338     endplst
339    
340     visibility
341     magicmap
342    
343     parent
344     longname
345     jail_map
346     jail_x
347     jail_y
348     portal_map
349     fallback
350     nomore
351    
352     chance
353     mods
354     diff
355     saves
356     description
357     density
358     damage
359    
360     anim
361     mina
362     facings
363     player
364    
365     allowed
366     keycode
367     trans
368     yield
369     ingred
370     cauldron
371    
372     Str
373     Dex
374     Con
375     Wis
376     Cha
377     Int
378     Pow
379    
380     treasure
381     treasureone
382     list
383     change_name
384     change_title
385     change_slaying
386     yes
387     no
388 root 1.15
389     max_level
390 root 1.16
391     authour
392     size
393     index
394 root 1.1 );
395    
396     open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h"
397     or die "$ARGV{GPERF}: $!";
398    
399     print GPERF <<EOF;
400     %language=C++
401     %enum
402     %define class-name kw_lex
403     %define lookup-function-name match
404     %struct-type
405     %compare-strncmp
406     %delimiters=,
407     struct keyword_idx { const char *name; enum keyword index; };
408     %%
409     EOF
410    
411     for (@kw) {
412     printf GPERF "%s,%s\n", $_, "KW_$_";
413     }
414    
415     print GPERF <<EOF;
416     %%
417     extern const char *const keyword_str [] = {
418     "<EOF>",
419     "<ERROR>",
420     EOF
421    
422     for (@kw) {
423     printf GPERF " \"%s\",\n", $_;
424     }
425    
426     print GPERF "};\n";
427    
428     printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
429     join ", ", map length, @kw;
430    
431     close GPERF
432     or die "$ARG{GPERF}: failed to run";
433    
434     open KW, ">", "keyword.h";
435    
436     print KW <<EOF;
437     //
438     // AUTOGENERATED: this is a generated file
439     // edit include/genkeywords instead
440     //
441    
442     #ifndef KW_H__
443     #define KW_H__
444    
445     enum keyword {
446     KW_NULL = 0,
447     KW_EOF = 0,
448     KW_ERROR,
449     EOF
450    
451     for (@kw) {
452     printf KW " %s,\n", "KW_$_",
453     }
454    
455     print KW <<EOF;
456     NUM_KEYWORD,
457     };
458    
459     extern const char *const keyword_str [];
460     extern const unsigned char keyword_len [];
461    
462     EOF
463    
464     printf KW "#define MAX_KEYWORD_LEN %d\n", List::Util::max map length, @kw;
465    
466     print KW <<EOF;
467    
468     #endif
469    
470     EOF
471