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.3 by root, Thu Aug 31 17:54:14 2006 UTC vs.
Revision 1.8 by root, Mon Dec 11 19:10:58 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(
9 no_pass
10 walk_on
11 walk_off
12 fly_on
13 fly_off
14 flying
15
7 ac 16 ac
8 activate_on_push 17 activate_on_push
9 activate_on_release 18 activate_on_release
10 alive 19 alive
11 anim_speed 20 anim_speed
85 has_ready_rod 94 has_ready_rod
86 has_ready_scroll 95 has_ready_scroll
87 has_ready_skill 96 has_ready_skill
88 has_ready_wand 97 has_ready_wand
89 has_ready_weapon 98 has_ready_weapon
99 has_ready_range
90 hitback 100 hitback
91 hp 101 hp
92 identified 102 identified
93 immune 103 immune
94 int 104 int
96 invisible 106 invisible
97 is_animated 107 is_animated
98 is_blind 108 is_blind
99 is_buildable 109 is_buildable
100 is_cauldron 110 is_cauldron
111 is_dust
101 is_floor 112 is_floor
102 is_hilly 113 is_hilly
103 is_lightable 114 is_lightable
104 is_thrown 115 is_thrown
105 is_turnable 116 is_turnable
157 path_attuned 168 path_attuned
158 path_denied 169 path_denied
159 path_repelled 170 path_repelled
160 perm_exp 171 perm_exp
161 pick_up 172 pick_up
173 player_sold
162 pow 174 pow
163 protected 175 protected
164 race 176 race
165 random_move 177 random_move
166 random_movement 178 random_movement
223 unaggressive 235 unaggressive
224 undead 236 undead
225 unique 237 unique
226 unpaid 238 unpaid
227 use_content_on_gen 239 use_content_on_gen
240 uuid
228 value 241 value
229 vulnerable 242 vulnerable
230 was_wiz 243 was_wiz
231 wc 244 wc
232 weapontype 245 weapontype
235 wis 248 wis
236 wiz 249 wiz
237 x 250 x
238 xrays 251 xrays
239 y 252 y
253
254 Object
255 Str
256 Dex
257 Con
258 Wis
259 Cha
260 Int
261 Pow
262 More
240); 263);
241 264
242open GPERF, "|-", "gperf -m50 >kw_hash.h" 265open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h"
243 or die "gperf: $!"; 266 or die "$ARGV{GPERF}: $!";
244 267
245print GPERF <<EOF; 268print GPERF <<EOF;
246%language=C++ 269%language=C++
247%enum 270%enum
248%define class-name kw_lex 271%define class-name kw_lex
272print GPERF "};\n"; 295print GPERF "};\n";
273 296
274printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n", 297printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
275 join ", ", map length, @kw; 298 join ", ", map length, @kw;
276 299
300close GPERF
301 or die "$ARG{GPERF}: failed to run";
302
277open KW, ">", "keyword.h"; 303open KW, ">", "keyword.h";
278 304
279print KW <<EOF; 305print KW <<EOF;
280#ifndef KW_H__ 306#ifndef KW_H__
281#define KW_H__ 307#define KW_H__
282 308
283enum keyword { 309enum keyword {
284 KW_EOF, KW_ERROR, 310 KW_NULL = 0,
311 KW_EOF = 0,
312 KW_ERROR,
285EOF 313EOF
286 314
287for (@kw) { 315for (@kw) {
288 printf KW " %s,\n", "KW_$_", 316 printf KW " %s,\n", "KW_$_",
289} 317}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines