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.1 by root, Thu Aug 31 06:23:19 2006 UTC vs.
Revision 1.27 by root, Mon May 7 04:21:11 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 249 was_wiz
229 wc 250 wc
230 weapontype 251 weapontype
233 wis 254 wis
234 wiz 255 wiz
235 x 256 x
236 xrays 257 xrays
237 y 258 y
259
260 maplore
261 endmaplore
262 enter_x
263 enter_y
264 width
265 height
266 reset_timeout
267 reset_time
268 swap_time
269 difficulty
270 darkness
271 fixed_resettime
272 per_player
273 per_party
274 region
275 shopitems
276 shopgreed
277 shopmin
278 shopmax
279 shoprace
280 outdoor
281 tile_path_1
282 tile_path_2
283 tile_path_3
284 tile_path_4
285
286 file_format_version
287
288 temp
289 pressure
290 humid
291 windspeed
292 winddir
293 sky
294
295 map
296 savebed_map
297 bed_x
298 bed_y
299 password
300 bowtype
301 petmode
302 gen_hp
303 gen_sp
304 gen_grace
305 listening
306 peaceful
307 digestion
308 pickup
309 outputs_sync
310 outputs_count
311 usekeys
312 unapply
313 weapon_sp
314 lev_array
315 endplst
316
317 visibility
318 magicmap
319
320 match
321 parent
322 longname
323 jail_map
324 jail_x
325 jail_y
326 fallback
327 nomore
328
329 chance
330 mods
331 diff
332 saves
333 description
334 density
335 damage
336
337 anim
338 mina
339 facings
340 player
341
342 allowed
343 keycode
344 trans
345 yield
346 ingred
347 cauldron
348
349 Str
350 Dex
351 Con
352 Wis
353 Cha
354 Int
355 Pow
356
357 treasure
358 treasureone
359 list
360 change_name
361 change_title
362 change_slaying
363 yes
364 no
238); 365);
239 366
240open GPERF, "|-", "gperf -m50 >kw_hash.h" 367open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h"
241 or die "gperf: $!"; 368 or die "$ARGV{GPERF}: $!";
242 369
243print GPERF <<EOF; 370print GPERF <<EOF;
244%language=C++ 371%language=C++
245%enum 372%enum
246%define class-name kw_lex 373%define class-name kw_lex
247%define lookup-function-name match 374%define lookup-function-name match
248%struct-type 375%struct-type
249%compare-strncmp 376%compare-strncmp
250%delimiters=, 377%delimiters=,
251struct kw { const char *name; enum kw index; }; 378struct keyword_idx { const char *name; enum keyword index; };
252%% 379%%
253EOF 380EOF
254 381
255for (@kw) { 382for (@kw) {
256 printf GPERF "%s,%s\n", $_, "KW_" . uc; 383 printf GPERF "%s,%s\n", $_, "KW_$_";
257} 384}
258 385
259print GPERF <<EOF; 386print GPERF <<EOF;
260%% 387%%
261const char *const keyword_str [] = { 388extern const char *const keyword_str [] = {
262 "<EOF>", 389 "<EOF>",
263 "<ERROR>", 390 "<ERROR>",
264EOF 391EOF
265 392
266for (@kw) { 393for (@kw) {
267 printf GPERF " \"%s\",\n", $_; 394 printf GPERF " \"%s\",\n", $_;
268} 395}
269 396
270print GPERF "};\n\n"; 397print GPERF "};\n";
398
399printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
400 join ", ", map length, @kw;
401
402close GPERF
403 or die "$ARG{GPERF}: failed to run";
271 404
272open KW, ">", "keyword.h"; 405open KW, ">", "keyword.h";
273 406
274print KW <<EOF; 407print KW <<EOF;
275#ifndef KW_H__ 408#ifndef KW_H__
276#define KW_H__ 409#define KW_H__
277 410
278enum keyword { 411enum keyword {
279 KW_eof, KW_error, 412 KW_NULL = 0,
413 KW_EOF = 0,
414 KW_ERROR,
280EOF 415EOF
281 416
282for (@kw) { 417for (@kw) {
283 printf KW " %s,\n", "KW_" . uc; 418 printf KW " %s,\n", "KW_$_",
284} 419}
285 420
286print KW <<EOF; 421print KW <<EOF;
287 NUM_KEYWORD, 422 NUM_KEYWORD,
288}; 423};
289 424
290extern const char *const keyword_str []; 425extern const char *const keyword_str [];
426extern const unsigned char keyword_len [];
427
428EOF
429
430printf KW "#define MAX_KEYWORD_LEN %d\n", List::Util::max map length, @kw;
431
432print KW <<EOF;
291 433
292#endif 434#endif
293 435
294EOF 436EOF
295 437

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines