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.24 by root, Sat Apr 28 17:51:58 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(
66 cursed 68 cursed
67 custom_name 69 custom_name
68 dam 70 dam
69 dam_modifier 71 dam_modifier
70 damned 72 damned
73 destroy_on_death
71 dex 74 dex
72 direction 75 direction
73 duration 76 duration
74 duration_modifier 77 duration_modifier
75 editable 78 editable
92 has_ready_rod 95 has_ready_rod
93 has_ready_scroll 96 has_ready_scroll
94 has_ready_skill 97 has_ready_skill
95 has_ready_wand 98 has_ready_wand
96 has_ready_weapon 99 has_ready_weapon
100 has_ready_range
97 hitback 101 hitback
98 hp 102 hp
99 identified 103 identified
100 immune 104 immune
105 inherit
101 int 106 int
102 inv_locked 107 inv_locked
103 invisible 108 invisible
104 is_animated 109 is_animated
105 is_blind 110 is_blind
106 is_buildable 111 is_buildable
107 is_cauldron 112 is_cauldron
113 is_dust
108 is_floor 114 is_floor
109 is_hilly 115 is_hilly
110 is_lightable 116 is_lightable
111 is_thrown 117 is_thrown
112 is_turnable 118 is_turnable
153 no_pick 159 no_pick
154 no_skill_ident 160 no_skill_ident
155 no_steal 161 no_steal
156 no_strength 162 no_strength
157 nrof 163 nrof
164 obj_original
158 object 165 object
159 oid 166 oid
160 one_hit 167 one_hit
161 only_attack 168 only_attack
162 other_arch 169 other_arch
164 path_attuned 171 path_attuned
165 path_denied 172 path_denied
166 path_repelled 173 path_repelled
167 perm_exp 174 perm_exp
168 pick_up 175 pick_up
176 player_sold
169 pow 177 pow
178 precious
170 protected 179 protected
171 race 180 race
172 random_move 181 random_move
173 random_movement 182 random_movement
174 randomitems 183 randomitems
223 str 232 str
224 subtype 233 subtype
225 tear_down 234 tear_down
226 title 235 title
227 tooltype 236 tooltype
228 treasure 237 treasure_env
229 type 238 type
230 unaggressive 239 unaggressive
231 undead 240 undead
232 unique 241 unique
233 unpaid 242 unpaid
234 use_content_on_gen 243 use_content_on_gen
244 uuid
235 value 245 value
236 vulnerable 246 vulnerable
237 was_wiz 247 was_wiz
238 wc 248 wc
239 weapontype 249 weapontype
242 wis 252 wis
243 wiz 253 wiz
244 x 254 x
245 xrays 255 xrays
246 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 shoottype
299 bowtype
300 petmode
301 gen_hp
302 gen_sp
303 gen_grace
304 listening
305 peaceful
306 digestion
307 pickup
308 outputs_sync
309 outputs_count
310 usekeys
311 unapply
312 weapon_sp
313 lev_array
314 endplst
315
316 visibility
317 magicmap
318
319 match
320 parent
321 longname
322 jail_map
323 jail_x
324 jail_y
325 fallback
326 nomore
327
328 chance
329 mods
330 diff
331 saves
332 description
333 density
334 damage
335
336 anim
337 mina
338 facings
339 player
340
341 allowed
342 keycode
343 trans
344 yield
345 ingred
346 cauldron
347
348 Str
349 Dex
350 Con
351 Wis
352 Cha
353 Int
354 Pow
355
356 treasure
357 treasureone
358 list
359 change_name
360 change_title
361 change_slaying
362 yes
363 no
247); 364);
248 365
249open GPERF, "|-", "gperf -m50 >kw_hash.h" 366open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h"
250 or die "gperf: $!"; 367 or die "$ARGV{GPERF}: $!";
251 368
252print GPERF <<EOF; 369print GPERF <<EOF;
253%language=C++ 370%language=C++
254%enum 371%enum
255%define class-name kw_lex 372%define class-name kw_lex
256%define lookup-function-name match 373%define lookup-function-name match
257%struct-type 374%struct-type
258%compare-strncmp 375%compare-strncmp
259%ignore-case
260%delimiters=, 376%delimiters=,
261struct keyword_idx { const char *name; enum keyword index; }; 377struct keyword_idx { const char *name; enum keyword index; };
262%% 378%%
263EOF 379EOF
264 380
280print GPERF "};\n"; 396print GPERF "};\n";
281 397
282printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n", 398printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
283 join ", ", map length, @kw; 399 join ", ", map length, @kw;
284 400
401close GPERF
402 or die "$ARG{GPERF}: failed to run";
403
285open KW, ">", "keyword.h"; 404open KW, ">", "keyword.h";
286 405
287print KW <<EOF; 406print KW <<EOF;
288#ifndef KW_H__ 407#ifndef KW_H__
289#define KW_H__ 408#define KW_H__
290 409
291enum keyword { 410enum keyword {
292 KW_EOF, KW_ERROR, 411 KW_NULL = 0,
412 KW_EOF = 0,
413 KW_ERROR,
293EOF 414EOF
294 415
295for (@kw) { 416for (@kw) {
296 printf KW " %s,\n", "KW_$_", 417 printf KW " %s,\n", "KW_$_",
297} 418}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines