ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/preprocess
(Generate patch)

Comparing deliantra/server/include/preprocess (file contents):
Revision 1.2 by root, Thu Aug 31 09:19:34 2006 UTC vs.
Revision 1.28 by root, Thu May 17 14:14:55 2007 UTC

1#!/opt/bin/perl 1#!/opt/bin/perl
2
3my %ARG = @ARGV;
4
5use List::Util;
2 6
3# todo: gather dynamically 7# todo: gather dynamically
4my @kw = qw( 8my @kw = qw(
9 no_pass
10 walk_on
11 walk_off
12 fly_on
13 fly_off
14 flying
15
16 attack_skill
17 ranged_skill
18
5 ac 19 ac
6 activate_on_push 20 activate_on_push
7 activate_on_release 21 activate_on_release
8 alive 22 alive
9 anim_speed 23 anim_speed
28 body_shoulder 42 body_shoulder
29 body_foot 43 body_foot
30 body_hand 44 body_hand
31 body_wrist 45 body_wrist
32 body_waist 46 body_waist
47 body_shield
48 body_combat
33 can_apply 49 can_apply
34 can_cast_spell 50 can_cast_spell
35 can_roll 51 can_roll
36 can_see_in_dark 52 can_see_in_dark
37 can_use_armour 53 can_use_armour
57 cursed 73 cursed
58 custom_name 74 custom_name
59 dam 75 dam
60 dam_modifier 76 dam_modifier
61 damned 77 damned
78 destroy_on_death
62 dex 79 dex
63 direction 80 direction
64 duration 81 duration
65 duration_modifier 82 duration_modifier
66 editable 83 editable
77 gen_sp_armour 94 gen_sp_armour
78 generator 95 generator
79 glow_radius 96 glow_radius
80 grace 97 grace
81 has_ready_bow 98 has_ready_bow
82 has_ready_horn
83 has_ready_rod
84 has_ready_scroll 99 has_ready_scroll
85 has_ready_skill 100 has_ready_skill
86 has_ready_wand
87 has_ready_weapon 101 has_ready_weapon
102 has_ready_range
88 hitback 103 hitback
89 hp 104 hp
90 identified 105 identified
91 immune 106 immune
107 inherit
92 int 108 int
93 inv_locked 109 inv_locked
94 invisible 110 invisible
95 is_animated 111 is_animated
96 is_blind 112 is_blind
97 is_buildable 113 is_buildable
98 is_cauldron 114 is_cauldron
115 is_dust
99 is_floor 116 is_floor
100 is_hilly 117 is_hilly
101 is_lightable 118 is_lightable
102 is_thrown 119 is_thrown
103 is_turnable 120 is_turnable
144 no_pick 161 no_pick
145 no_skill_ident 162 no_skill_ident
146 no_steal 163 no_steal
147 no_strength 164 no_strength
148 nrof 165 nrof
166 obj_original
149 object 167 object
150 oid 168 oid
151 one_hit 169 one_hit
152 only_attack 170 only_attack
153 other_arch 171 other_arch
155 path_attuned 173 path_attuned
156 path_denied 174 path_denied
157 path_repelled 175 path_repelled
158 perm_exp 176 perm_exp
159 pick_up 177 pick_up
178 player_sold
160 pow 179 pow
180 precious
161 protected 181 protected
162 race 182 race
163 random_move 183 random_move
164 random_movement 184 random_movement
165 randomitems 185 randomitems
214 str 234 str
215 subtype 235 subtype
216 tear_down 236 tear_down
217 title 237 title
218 tooltype 238 tooltype
219 treasure 239 treasure_env
220 type 240 type
221 unaggressive 241 unaggressive
222 undead 242 undead
223 unique 243 unique
224 unpaid 244 unpaid
225 use_content_on_gen 245 use_content_on_gen
246 uuid
226 value 247 value
227 vulnerable 248 vulnerable
228 was_wiz
229 wc 249 wc
230 weapontype 250 weapontype
231 weight 251 weight
232 will_apply 252 will_apply
233 wis 253 wis
234 wiz
235 x 254 x
236 xrays 255 xrays
237 y 256 y
257
258 maplore
259 endmaplore
260 enter_x
261 enter_y
262 width
263 height
264 reset_timeout
265 reset_time
266 swap_time
267 difficulty
268 darkness
269 fixed_resettime
270 per_player
271 per_party
272 region
273 shopitems
274 shopgreed
275 shopmin
276 shopmax
277 shoprace
278 outdoor
279 tile_path_1
280 tile_path_2
281 tile_path_3
282 tile_path_4
283
284 file_format_version
285
286 temp
287 pressure
288 humid
289 windspeed
290 winddir
291 sky
292
293 map
294 savebed_map
295 bed_x
296 bed_y
297 password
298 bowtype
299 petmode
300 gen_hp
301 gen_sp
302 gen_grace
303 listening
304 peaceful
305 digestion
306 pickup
307 outputs_sync
308 outputs_count
309 usekeys
310 unapply
311 weapon_sp
312 lev_array
313 endplst
314
315 visibility
316 magicmap
317
318 match
319 parent
320 longname
321 jail_map
322 jail_x
323 jail_y
324 fallback
325 nomore
326
327 chance
328 mods
329 diff
330 saves
331 description
332 density
333 damage
334
335 anim
336 mina
337 facings
338 player
339
340 allowed
341 keycode
342 trans
343 yield
344 ingred
345 cauldron
346
347 Str
348 Dex
349 Con
350 Wis
351 Cha
352 Int
353 Pow
354
355 treasure
356 treasureone
357 list
358 change_name
359 change_title
360 change_slaying
361 yes
362 no
238); 363);
239 364
240open GPERF, "|-", "gperf -m50 >kw_hash.h" 365open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h"
241 or die "gperf: $!"; 366 or die "$ARGV{GPERF}: $!";
242 367
243print GPERF <<EOF; 368print GPERF <<EOF;
244%language=C++ 369%language=C++
245%enum 370%enum
246%define class-name kw_lex 371%define class-name kw_lex
251struct keyword_idx { const char *name; enum keyword index; }; 376struct keyword_idx { const char *name; enum keyword index; };
252%% 377%%
253EOF 378EOF
254 379
255for (@kw) { 380for (@kw) {
256 printf GPERF "%s,%s\n", $_, "KW_" . uc; 381 printf GPERF "%s,%s\n", $_, "KW_$_";
257} 382}
258 383
259print GPERF <<EOF; 384print GPERF <<EOF;
260%% 385%%
261const char *const keyword_str [] = { 386extern const char *const keyword_str [] = {
262 "<EOF>", 387 "<EOF>",
263 "<ERROR>", 388 "<ERROR>",
264EOF 389EOF
265 390
266for (@kw) { 391for (@kw) {
267 printf GPERF " \"%s\",\n", $_; 392 printf GPERF " \"%s\",\n", $_;
268} 393}
269 394
270print GPERF "};\n\n"; 395print GPERF "};\n";
396
397printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
398 join ", ", map length, @kw;
399
400close GPERF
401 or die "$ARG{GPERF}: failed to run";
271 402
272open KW, ">", "keyword.h"; 403open KW, ">", "keyword.h";
273 404
274print KW <<EOF; 405print KW <<EOF;
275#ifndef KW_H__ 406#ifndef KW_H__
276#define KW_H__ 407#define KW_H__
277 408
278enum keyword { 409enum keyword {
279 KW_eof, KW_error, 410 KW_NULL = 0,
411 KW_EOF = 0,
412 KW_ERROR,
280EOF 413EOF
281 414
282for (@kw) { 415for (@kw) {
283 printf KW " %s,\n", "KW_" . uc; 416 printf KW " %s,\n", "KW_$_",
284} 417}
285 418
286print KW <<EOF; 419print KW <<EOF;
287 NUM_KEYWORD, 420 NUM_KEYWORD,
288}; 421};
289 422
290extern const char *const keyword_str []; 423extern const char *const keyword_str [];
424extern const unsigned char keyword_len [];
425
426EOF
427
428printf KW "#define MAX_KEYWORD_LEN %d\n", List::Util::max map length, @kw;
429
430print KW <<EOF;
291 431
292#endif 432#endif
293 433
294EOF 434EOF
295 435

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines