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.22 by root, Mon Apr 16 10:14:25 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
101 int 105 int
103 invisible 107 invisible
104 is_animated 108 is_animated
105 is_blind 109 is_blind
106 is_buildable 110 is_buildable
107 is_cauldron 111 is_cauldron
112 is_dust
108 is_floor 113 is_floor
109 is_hilly 114 is_hilly
110 is_lightable 115 is_lightable
111 is_thrown 116 is_thrown
112 is_turnable 117 is_turnable
153 no_pick 158 no_pick
154 no_skill_ident 159 no_skill_ident
155 no_steal 160 no_steal
156 no_strength 161 no_strength
157 nrof 162 nrof
163 obj_original
158 object 164 object
159 oid 165 oid
160 one_hit 166 one_hit
161 only_attack 167 only_attack
162 other_arch 168 other_arch
164 path_attuned 170 path_attuned
165 path_denied 171 path_denied
166 path_repelled 172 path_repelled
167 perm_exp 173 perm_exp
168 pick_up 174 pick_up
175 player_sold
169 pow 176 pow
170 protected 177 protected
171 race 178 race
172 random_move 179 random_move
173 random_movement 180 random_movement
223 str 230 str
224 subtype 231 subtype
225 tear_down 232 tear_down
226 title 233 title
227 tooltype 234 tooltype
228 treasure
229 type 235 type
230 unaggressive 236 unaggressive
231 undead 237 undead
232 unique 238 unique
233 unpaid 239 unpaid
234 use_content_on_gen 240 use_content_on_gen
241 uuid
235 value 242 value
236 vulnerable 243 vulnerable
237 was_wiz 244 was_wiz
238 wc 245 wc
239 weapontype 246 weapontype
242 wis 249 wis
243 wiz 250 wiz
244 x 251 x
245 xrays 252 xrays
246 y 253 y
254
255 maplore
256 endmaplore
257 enter_x
258 enter_y
259 width
260 height
261 reset_timeout
262 reset_time
263 swap_time
264 difficulty
265 darkness
266 fixed_resettime
267 per_player
268 per_party
269 region
270 shopitems
271 shopgreed
272 shopmin
273 shopmax
274 shoprace
275 outdoor
276 tile_path_1
277 tile_path_2
278 tile_path_3
279 tile_path_4
280
281 file_format_version
282
283 temp
284 pressure
285 humid
286 windspeed
287 winddir
288 sky
289
290 map
291 savebed_map
292 bed_x
293 bed_y
294 password
295 shoottype
296 bowtype
297 petmode
298 gen_hp
299 gen_sp
300 gen_grace
301 listening
302 peaceful
303 digestion
304 pickup
305 outputs_sync
306 outputs_count
307 usekeys
308 unapply
309 weapon_sp
310 lev_array
311 endplst
312
313 visibility
314 magicmap
315
316 match
317 parent
318 longname
319 jail_map
320 jail_x
321 jail_y
322 fallback
323 nomore
324
325 chance
326 mods
327 diff
328 saves
329 description
330 density
331 damage
332
333 anim
334 mina
335 facings
336 player
337
338 allowed
339 keycode
340 trans
341 yield
342 ingred
343 cauldron
344
345 Str
346 Dex
347 Con
348 Wis
349 Cha
350 Int
351 Pow
352
353 treasure
354 treasureone
355 list
356 change_name
357 change_title
358 change_slaying
359 yes
360 no
247); 361);
248 362
249open GPERF, "|-", "gperf -m50 >kw_hash.h" 363open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h"
250 or die "gperf: $!"; 364 or die "$ARGV{GPERF}: $!";
251 365
252print GPERF <<EOF; 366print GPERF <<EOF;
253%language=C++ 367%language=C++
254%enum 368%enum
255%define class-name kw_lex 369%define class-name kw_lex
256%define lookup-function-name match 370%define lookup-function-name match
257%struct-type 371%struct-type
258%compare-strncmp 372%compare-strncmp
259%ignore-case
260%delimiters=, 373%delimiters=,
261struct keyword_idx { const char *name; enum keyword index; }; 374struct keyword_idx { const char *name; enum keyword index; };
262%% 375%%
263EOF 376EOF
264 377
280print GPERF "};\n"; 393print GPERF "};\n";
281 394
282printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n", 395printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
283 join ", ", map length, @kw; 396 join ", ", map length, @kw;
284 397
398close GPERF
399 or die "$ARG{GPERF}: failed to run";
400
285open KW, ">", "keyword.h"; 401open KW, ">", "keyword.h";
286 402
287print KW <<EOF; 403print KW <<EOF;
288#ifndef KW_H__ 404#ifndef KW_H__
289#define KW_H__ 405#define KW_H__
290 406
291enum keyword { 407enum keyword {
292 KW_EOF, KW_ERROR, 408 KW_NULL = 0,
409 KW_EOF = 0,
410 KW_ERROR,
293EOF 411EOF
294 412
295for (@kw) { 413for (@kw) {
296 printf KW " %s,\n", "KW_$_", 414 printf KW " %s,\n", "KW_$_",
297} 415}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines