ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/genkeywords
Revision: 1.21
Committed: Sat May 7 20:03:28 2011 UTC (13 years ago) by root
Branch: MAIN
CVS Tags: rel-3_1
Changes since 1.20: +1 -0 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #!/opt/bin/perl
2
3 #
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 my %ARG = @ARGV;
26
27 use List::Util;
28
29 # todo: gather dynamically
30 my @kw = qw(
31 gender
32 hintmode
33 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_transparent_floor
135 is_hilly
136 is_lightable
137 is_thrown
138 is_turnable
139 is_used_up
140 is_water
141 is_wooded
142 item_power
143 known_cursed
144 known_magical
145 last_eat
146 last_grace
147 last_heal
148 last_sp
149 level
150 lifesave
151 lore
152 luck
153 magic
154 make_invisible
155 material
156 materialname
157 maxgrace
158 maxhp
159 maxsp
160 monster
161 more
162 move_allow
163 move_block
164 move_off
165 move_on
166 move_slow
167 move_slow_penalty
168 move_state
169 move_type
170 msg
171 name
172 name_pl
173 neutral
174 no_attack
175 no_damage
176 no_drop
177 no_magic
178 no_pick
179 no_skill_ident
180 no_steal
181 no_strength
182 nrof
183 obj_original
184 object
185 oid
186 one_hit
187 only_attack
188 other_arch
189 overlay_floor
190 owner
191 path_attuned
192 path_denied
193 path_repelled
194 perm_exp
195 pick_up
196 player_sold
197 pow
198 precious
199 protected
200 is_quad
201 race
202 random_move
203 random_movement
204 random_speed
205 randomitems
206 range
207 range_modifier
208 reflect_missile
209 reflect_spell
210 reflecting
211 resist_acid
212 resist_blind
213 resist_cancellation
214 resist_chaos
215 resist_cold
216 resist_confusion
217 resist_counterspell
218 resist_death
219 resist_deplete
220 resist_disease
221 resist_drain
222 resist_electricity
223 resist_fear
224 resist_fire
225 resist_ghosthit
226 resist_godpower
227 resist_holyword
228 resist_internal
229 resist_life_stealing
230 resist_magic
231 resist_paralyze
232 resist_physical
233 resist_poison
234 resist_slow
235 resist_turn_undead
236 resist_weaponmagic
237 run_away
238 scared
239 see_anywhere
240 see_invisible
241 skill
242 slaying
243 sleep
244 slow_move
245 sound
246 sound_destroy
247 smoothlevel
248 sp
249 speed
250 speed_left
251 sl
252 splitting
253 stand_still
254 startequip
255 state
256 stealth
257 str
258 subtype
259 tag
260 tear_down
261 title
262 treasure_env
263 type
264 unaggressive
265 undead
266 unique
267 unpaid
268 use_content_on_gen
269 uuid
270 value
271 vulnerable
272 wc
273 weapontype
274 weight
275 will_apply
276 wis
277 x
278 xrays
279 y
280
281 maplore
282 endmaplore
283 enter_x
284 enter_y
285 width
286 height
287 reset_timeout
288 reset_time
289 swap_time
290 difficulty
291 darkness
292 fixed_resettime
293 per_player
294 per_party
295 no_reset
296 region
297 shopitems
298 shopgreed
299 shopmin
300 shopmax
301 shoprace
302 outdoor
303 tile_path_1
304 tile_path_2
305 tile_path_3
306 tile_path_4
307 tile_path_5
308 tile_path_6
309
310 file_format_version
311
312 map
313 savebed_map
314 bed_x
315 bed_y
316 password
317 bowtype
318 petmode
319 gen_hp
320 gen_sp
321 gen_grace
322 listening
323 peaceful
324 digestion
325 pickup
326 outputs_sync
327 outputs_count
328 usekeys
329 unapply
330 weapon_sp
331 weapon_sp_left
332 lev_array
333 endplst
334
335 visibility
336 magicmap
337
338 parent
339 longname
340 jail_map
341 jail_x
342 jail_y
343 portal_map
344 fallback
345 nomore
346
347 chance
348 mods
349 diff
350 saves
351 description
352 density
353 damage
354
355 anim
356 mina
357 facings
358 player
359
360 allowed
361 keycode
362 trans
363 yield
364 ingred
365 cauldron
366
367 Str
368 Dex
369 Con
370 Wis
371 Cha
372 Int
373 Pow
374
375 treasure
376 treasureone
377 list
378 change_name
379 change_title
380 change_slaying
381 yes
382 no
383
384 max_level
385
386 authour
387 size
388 index
389 );
390
391 open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h"
392 or die "$ARGV{GPERF}: $!";
393
394 print GPERF <<EOF;
395 %language=C++
396 %enum
397 %define class-name kw_lex
398 %define lookup-function-name match
399 %struct-type
400 %compare-strncmp
401 %delimiters=,
402 struct keyword_idx { const char *name; enum keyword index; };
403 %%
404 EOF
405
406 for (@kw) {
407 printf GPERF "%s,%s\n", $_, "KW_$_";
408 }
409
410 print GPERF <<EOF;
411 %%
412 extern const char *const keyword_str [] = {
413 "<EOF>",
414 "<ERROR>",
415 EOF
416
417 for (@kw) {
418 printf GPERF " \"%s\",\n", $_;
419 }
420
421 print GPERF "};\n";
422
423 printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
424 join ", ", map length, @kw;
425
426 close GPERF
427 or die "$ARG{GPERF}: failed to run";
428
429 open KW, ">", "keyword.h";
430
431 print KW <<EOF;
432 //
433 // AUTOGENERATED: this is a generated file
434 // edit include/genkeywords instead
435 //
436
437 #ifndef KW_H__
438 #define KW_H__
439
440 enum keyword {
441 KW_NULL = 0,
442 KW_EOF = 0,
443 KW_ERROR,
444 EOF
445
446 for (@kw) {
447 printf KW " %s,\n", "KW_$_",
448 }
449
450 print KW <<EOF;
451 NUM_KEYWORD,
452 };
453
454 extern const char *const keyword_str [];
455 extern const unsigned char keyword_len [];
456
457 EOF
458
459 printf KW "#define MAX_KEYWORD_LEN %d\n", List::Util::max map length, @kw;
460
461 print KW <<EOF;
462
463 #endif
464
465 EOF
466