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.9 by root, Sat Dec 30 10:16:10 2006 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(
92 has_ready_rod 94 has_ready_rod
93 has_ready_scroll 95 has_ready_scroll
94 has_ready_skill 96 has_ready_skill
95 has_ready_wand 97 has_ready_wand
96 has_ready_weapon 98 has_ready_weapon
99 has_ready_range
97 hitback 100 hitback
98 hp 101 hp
99 identified 102 identified
100 immune 103 immune
101 int 104 int
103 invisible 106 invisible
104 is_animated 107 is_animated
105 is_blind 108 is_blind
106 is_buildable 109 is_buildable
107 is_cauldron 110 is_cauldron
111 is_dust
108 is_floor 112 is_floor
109 is_hilly 113 is_hilly
110 is_lightable 114 is_lightable
111 is_thrown 115 is_thrown
112 is_turnable 116 is_turnable
164 path_attuned 168 path_attuned
165 path_denied 169 path_denied
166 path_repelled 170 path_repelled
167 perm_exp 171 perm_exp
168 pick_up 172 pick_up
173 player_sold
169 pow 174 pow
170 protected 175 protected
171 race 176 race
172 random_move 177 random_move
173 random_movement 178 random_movement
230 unaggressive 235 unaggressive
231 undead 236 undead
232 unique 237 unique
233 unpaid 238 unpaid
234 use_content_on_gen 239 use_content_on_gen
240 uuid
235 value 241 value
236 vulnerable 242 vulnerable
237 was_wiz 243 was_wiz
238 wc 244 wc
239 weapontype 245 weapontype
242 wis 248 wis
243 wiz 249 wiz
244 x 250 x
245 xrays 251 xrays
246 y 252 y
253
254 Object
255 Str
256 Dex
257 Con
258 Wis
259 Cha
260 Int
261 Pow
262 More
263
264 maplore
265 endmaplore
266 enter_x
267 enter_y
268 width
269 height
270 reset_timeout
271 reset_time
272 swap_time
273 difficulty
274 darkness
275 fixed_resettime
276 per_player
277 per_party
278 region
279 shopitems
280 shopgreed
281 shopmin
282 shopmax
283 shoprace
284 outdoor
285 tile_path_1
286 tile_path_2
287 tile_path_3
288 tile_path_4
289
290 file_format_version
291
292 temp
293 pressure
294 humid
295 windspeed
296 winddir
297 sky
247); 298);
248 299
249open GPERF, "|-", "gperf -m50 >kw_hash.h" 300open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h"
250 or die "gperf: $!"; 301 or die "$ARGV{GPERF}: $!";
251 302
252print GPERF <<EOF; 303print GPERF <<EOF;
253%language=C++ 304%language=C++
254%enum 305%enum
255%define class-name kw_lex 306%define class-name kw_lex
256%define lookup-function-name match 307%define lookup-function-name match
257%struct-type 308%struct-type
258%compare-strncmp 309%compare-strncmp
259%ignore-case
260%delimiters=, 310%delimiters=,
261struct keyword_idx { const char *name; enum keyword index; }; 311struct keyword_idx { const char *name; enum keyword index; };
262%% 312%%
263EOF 313EOF
264 314
280print GPERF "};\n"; 330print GPERF "};\n";
281 331
282printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n", 332printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
283 join ", ", map length, @kw; 333 join ", ", map length, @kw;
284 334
335close GPERF
336 or die "$ARG{GPERF}: failed to run";
337
285open KW, ">", "keyword.h"; 338open KW, ">", "keyword.h";
286 339
287print KW <<EOF; 340print KW <<EOF;
288#ifndef KW_H__ 341#ifndef KW_H__
289#define KW_H__ 342#define KW_H__
290 343
291enum keyword { 344enum keyword {
292 KW_EOF, KW_ERROR, 345 KW_NULL = 0,
346 KW_EOF = 0,
347 KW_ERROR,
293EOF 348EOF
294 349
295for (@kw) { 350for (@kw) {
296 printf KW " %s,\n", "KW_$_", 351 printf KW " %s,\n", "KW_$_",
297} 352}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines