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.4 by root, Sun Sep 3 22:45:56 2006 UTC vs.
Revision 1.25 by root, Mon Apr 30 04:25:30 2007 UTC

1#!/opt/bin/perl 1#!/opt/bin/perl
2
3my %ARG = @ARGV;
2 4
3use List::Util; 5use List::Util;
4 6
5# todo: gather dynamically 7# todo: gather dynamically
6my @kw = qw( 8my @kw = qw(
8 walk_on 10 walk_on
9 walk_off 11 walk_off
10 fly_on 12 fly_on
11 fly_off 13 fly_off
12 flying 14 flying
15
16 attack_skill
17 ranged_skill
13 18
14 ac 19 ac
15 activate_on_push 20 activate_on_push
16 activate_on_release 21 activate_on_release
17 alive 22 alive
66 cursed 71 cursed
67 custom_name 72 custom_name
68 dam 73 dam
69 dam_modifier 74 dam_modifier
70 damned 75 damned
76 destroy_on_death
71 dex 77 dex
72 direction 78 direction
73 duration 79 duration
74 duration_modifier 80 duration_modifier
75 editable 81 editable
92 has_ready_rod 98 has_ready_rod
93 has_ready_scroll 99 has_ready_scroll
94 has_ready_skill 100 has_ready_skill
95 has_ready_wand 101 has_ready_wand
96 has_ready_weapon 102 has_ready_weapon
103 has_ready_range
97 hitback 104 hitback
98 hp 105 hp
99 identified 106 identified
100 immune 107 immune
108 inherit
101 int 109 int
102 inv_locked 110 inv_locked
103 invisible 111 invisible
104 is_animated 112 is_animated
105 is_blind 113 is_blind
106 is_buildable 114 is_buildable
107 is_cauldron 115 is_cauldron
116 is_dust
108 is_floor 117 is_floor
109 is_hilly 118 is_hilly
110 is_lightable 119 is_lightable
111 is_thrown 120 is_thrown
112 is_turnable 121 is_turnable
153 no_pick 162 no_pick
154 no_skill_ident 163 no_skill_ident
155 no_steal 164 no_steal
156 no_strength 165 no_strength
157 nrof 166 nrof
167 obj_original
158 object 168 object
159 oid 169 oid
160 one_hit 170 one_hit
161 only_attack 171 only_attack
162 other_arch 172 other_arch
164 path_attuned 174 path_attuned
165 path_denied 175 path_denied
166 path_repelled 176 path_repelled
167 perm_exp 177 perm_exp
168 pick_up 178 pick_up
179 player_sold
169 pow 180 pow
181 precious
170 protected 182 protected
171 race 183 race
172 random_move 184 random_move
173 random_movement 185 random_movement
174 randomitems 186 randomitems
223 str 235 str
224 subtype 236 subtype
225 tear_down 237 tear_down
226 title 238 title
227 tooltype 239 tooltype
228 treasure 240 treasure_env
229 type 241 type
230 unaggressive 242 unaggressive
231 undead 243 undead
232 unique 244 unique
233 unpaid 245 unpaid
234 use_content_on_gen 246 use_content_on_gen
247 uuid
235 value 248 value
236 vulnerable 249 vulnerable
237 was_wiz 250 was_wiz
238 wc 251 wc
239 weapontype 252 weapontype
242 wis 255 wis
243 wiz 256 wiz
244 x 257 x
245 xrays 258 xrays
246 y 259 y
260
261 maplore
262 endmaplore
263 enter_x
264 enter_y
265 width
266 height
267 reset_timeout
268 reset_time
269 swap_time
270 difficulty
271 darkness
272 fixed_resettime
273 per_player
274 per_party
275 region
276 shopitems
277 shopgreed
278 shopmin
279 shopmax
280 shoprace
281 outdoor
282 tile_path_1
283 tile_path_2
284 tile_path_3
285 tile_path_4
286
287 file_format_version
288
289 temp
290 pressure
291 humid
292 windspeed
293 winddir
294 sky
295
296 map
297 savebed_map
298 bed_x
299 bed_y
300 password
301 bowtype
302 petmode
303 gen_hp
304 gen_sp
305 gen_grace
306 listening
307 peaceful
308 digestion
309 pickup
310 outputs_sync
311 outputs_count
312 usekeys
313 unapply
314 weapon_sp
315 lev_array
316 endplst
317
318 visibility
319 magicmap
320
321 match
322 parent
323 longname
324 jail_map
325 jail_x
326 jail_y
327 fallback
328 nomore
329
330 chance
331 mods
332 diff
333 saves
334 description
335 density
336 damage
337
338 anim
339 mina
340 facings
341 player
342
343 allowed
344 keycode
345 trans
346 yield
347 ingred
348 cauldron
349
350 Str
351 Dex
352 Con
353 Wis
354 Cha
355 Int
356 Pow
357
358 treasure
359 treasureone
360 list
361 change_name
362 change_title
363 change_slaying
364 yes
365 no
247); 366);
248 367
249open GPERF, "|-", "gperf -m50 >kw_hash.h" 368open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h"
250 or die "gperf: $!"; 369 or die "$ARGV{GPERF}: $!";
251 370
252print GPERF <<EOF; 371print GPERF <<EOF;
253%language=C++ 372%language=C++
254%enum 373%enum
255%define class-name kw_lex 374%define class-name kw_lex
256%define lookup-function-name match 375%define lookup-function-name match
257%struct-type 376%struct-type
258%compare-strncmp 377%compare-strncmp
259%ignore-case
260%delimiters=, 378%delimiters=,
261struct keyword_idx { const char *name; enum keyword index; }; 379struct keyword_idx { const char *name; enum keyword index; };
262%% 380%%
263EOF 381EOF
264 382
280print GPERF "};\n"; 398print GPERF "};\n";
281 399
282printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n", 400printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
283 join ", ", map length, @kw; 401 join ", ", map length, @kw;
284 402
403close GPERF
404 or die "$ARG{GPERF}: failed to run";
405
285open KW, ">", "keyword.h"; 406open KW, ">", "keyword.h";
286 407
287print KW <<EOF; 408print KW <<EOF;
288#ifndef KW_H__ 409#ifndef KW_H__
289#define KW_H__ 410#define KW_H__
290 411
291enum keyword { 412enum keyword {
292 KW_EOF, KW_ERROR, 413 KW_NULL = 0,
414 KW_EOF = 0,
415 KW_ERROR,
293EOF 416EOF
294 417
295for (@kw) { 418for (@kw) {
296 printf KW " %s,\n", "KW_$_", 419 printf KW " %s,\n", "KW_$_",
297} 420}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines