ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/genkeywords
Revision: 1.22
Committed: Fri Nov 18 20:20:05 2016 UTC (7 years, 5 months ago) by root
Branch: MAIN
CVS Tags: HEAD
Changes since 1.21: +9 -10 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #!/opt/bin/perl
2 #
3 # This file is part of Deliantra, the Roguelike Realtime MMORPG.
4 #
5 # Copyright (©) 2005,2006,2007,2008,2009,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
6 #
7 # Deliantra is free software: you can redistribute it and/or modify it under
8 # the terms of the Affero GNU General Public License as published by the
9 # Free Software Foundation, either version 3 of the License, or (at your
10 # option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the Affero GNU General Public License
18 # and the GNU General Public License along with this program. If not, see
19 # <http://www.gnu.org/licenses/>.
20 #
21 # The authors can be reached via e-mail to <support@deliantra.net>
22 #
23
24 my %ARG = @ARGV;
25
26 use List::Util;
27
28 # todo: gather dynamically
29 my @kw = qw(
30 gender
31 hintmode
32 attack_skill
33 ranged_skill
34
35 ac
36 activate_on_push
37 activate_on_release
38 alive
39 anim_speed
40 animation
41 applied
42 arch
43 armour
44 attach
45 attack_movement
46 attacktype
47 auto_apply
48 been_applied
49 berserk
50 blocksview
51 body_range
52 body_arm
53 body_torso
54 body_head
55 body_neck
56 body_skill
57 body_finger
58 body_shoulder
59 body_foot
60 body_hand
61 body_wrist
62 body_waist
63 body_shield
64 body_combat
65 can_apply
66 can_cast_spell
67 can_roll
68 can_see_in_dark
69 can_use_armour
70 can_use_bow
71 can_use_horn
72 can_use_range
73 can_use_ring
74 can_use_rod
75 can_use_scroll
76 can_use_shield
77 can_use_skill
78 can_use_wand
79 can_use_weapon
80 carrying
81 casting_time
82 cha
83 changing
84 client_type
85 con
86 confused
87 connected
88 container
89 cursed
90 custom_name
91 dam
92 dam_modifier
93 damned
94 destroy_on_death
95 dex
96 direction
97 duration
98 duration_modifier
99 editable
100 editor_folder
101 elevation
102 end
103 endlore
104 endmsg
105 exp
106 expmul
107 face
108 food
109 friendly
110 gen_sp_armour
111 generator
112 glow_radius
113 grace
114 has_ready_bow
115 has_ready_scroll
116 has_ready_skill
117 has_ready_weapon
118 has_ready_range
119 hitback
120 hp
121 identified
122 immune
123 inherit
124 int
125 inv_locked
126 invisible
127 is_animated
128 is_blind
129 is_buildable
130 is_cauldron
131 is_dust
132 is_floor
133 is_transparent_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 owner
190 path_attuned
191 path_denied
192 path_repelled
193 perm_exp
194 pick_up
195 player_sold
196 pow
197 precious
198 protected
199 is_quad
200 race
201 random_move
202 random_movement
203 random_speed
204 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 sound
245 sound_destroy
246 smoothlevel
247 sp
248 speed
249 speed_left
250 sl
251 splitting
252 stand_still
253 startequip
254 state
255 stealth
256 str
257 subtype
258 tag
259 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 no_reset
295 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 tile_path_5
307 tile_path_6
308
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
383 max_level
384
385 authour
386 size
387 index
388 );
389
390 open GPERF, "|-", "exec $ARG{GPERF} -m50 >include/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, ">", "include/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