ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/preprocess
Revision: 1.3
Committed: Thu Aug 31 17:54:14 2006 UTC (17 years, 8 months ago) by root
Branch: MAIN
Changes since 1.2: +17 -5 lines
Log Message:
rewrote object serialiser, parser is next

File Contents

# Content
1 #!/opt/bin/perl
2
3 use List::Util;
4
5 # todo: gather dynamically
6 my @kw = qw(
7 ac
8 activate_on_push
9 activate_on_release
10 alive
11 anim_speed
12 animation
13 applied
14 arch
15 armour
16 attach
17 attack_movement
18 attacktype
19 auto_apply
20 been_applied
21 berserk
22 blocksview
23 body_range
24 body_arm
25 body_torso
26 body_head
27 body_neck
28 body_skill
29 body_finger
30 body_shoulder
31 body_foot
32 body_hand
33 body_wrist
34 body_waist
35 can_apply
36 can_cast_spell
37 can_roll
38 can_see_in_dark
39 can_use_armour
40 can_use_bow
41 can_use_horn
42 can_use_range
43 can_use_ring
44 can_use_rod
45 can_use_scroll
46 can_use_shield
47 can_use_skill
48 can_use_wand
49 can_use_weapon
50 carrying
51 casting_time
52 cha
53 changing
54 client_type
55 con
56 confused
57 connected
58 container
59 cursed
60 custom_name
61 dam
62 dam_modifier
63 damned
64 dex
65 direction
66 duration
67 duration_modifier
68 editable
69 editor_folder
70 elevation
71 end
72 endlore
73 endmsg
74 exp
75 expmul
76 face
77 food
78 friendly
79 gen_sp_armour
80 generator
81 glow_radius
82 grace
83 has_ready_bow
84 has_ready_horn
85 has_ready_rod
86 has_ready_scroll
87 has_ready_skill
88 has_ready_wand
89 has_ready_weapon
90 hitback
91 hp
92 identified
93 immune
94 int
95 inv_locked
96 invisible
97 is_animated
98 is_blind
99 is_buildable
100 is_cauldron
101 is_floor
102 is_hilly
103 is_lightable
104 is_thrown
105 is_turnable
106 is_used_up
107 is_water
108 is_wooded
109 item_power
110 known_cursed
111 known_magical
112 last_eat
113 last_grace
114 last_heal
115 last_sp
116 level
117 lifesave
118 lore
119 luck
120 magic
121 make_invisible
122 material
123 materialname
124 maxgrace
125 maxhp
126 maxsp
127 monster
128 more
129 move_allow
130 move_block
131 move_off
132 move_on
133 move_slow
134 move_slow_penalty
135 move_state
136 move_type
137 msg
138 name
139 name_pl
140 neutral
141 no_attack
142 no_damage
143 no_drop
144 no_fix_player
145 no_magic
146 no_pick
147 no_skill_ident
148 no_steal
149 no_strength
150 nrof
151 object
152 oid
153 one_hit
154 only_attack
155 other_arch
156 overlay_floor
157 path_attuned
158 path_denied
159 path_repelled
160 perm_exp
161 pick_up
162 pow
163 protected
164 race
165 random_move
166 random_movement
167 randomitems
168 range
169 range_modifier
170 reflect_missile
171 reflect_spell
172 reflecting
173 resist_acid
174 resist_blind
175 resist_cancellation
176 resist_chaos
177 resist_cold
178 resist_confusion
179 resist_counterspell
180 resist_death
181 resist_deplete
182 resist_disease
183 resist_drain
184 resist_electricity
185 resist_fear
186 resist_fire
187 resist_ghosthit
188 resist_godpower
189 resist_holyword
190 resist_internal
191 resist_life_stealing
192 resist_magic
193 resist_paralyze
194 resist_physical
195 resist_poison
196 resist_slow
197 resist_turn_undead
198 resist_weaponmagic
199 run_away
200 scared
201 see_anywhere
202 see_invisible
203 skill
204 slaying
205 sleep
206 slow_move
207 smoothlevel
208 sp
209 speed
210 speed_left
211 splitting
212 stand_still
213 startequip
214 state
215 stealth
216 str
217 subtype
218 tear_down
219 title
220 tooltype
221 treasure
222 type
223 unaggressive
224 undead
225 unique
226 unpaid
227 use_content_on_gen
228 value
229 vulnerable
230 was_wiz
231 wc
232 weapontype
233 weight
234 will_apply
235 wis
236 wiz
237 x
238 xrays
239 y
240 );
241
242 open GPERF, "|-", "gperf -m50 >kw_hash.h"
243 or die "gperf: $!";
244
245 print GPERF <<EOF;
246 %language=C++
247 %enum
248 %define class-name kw_lex
249 %define lookup-function-name match
250 %struct-type
251 %compare-strncmp
252 %delimiters=,
253 struct keyword_idx { const char *name; enum keyword index; };
254 %%
255 EOF
256
257 for (@kw) {
258 printf GPERF "%s,%s\n", $_, "KW_$_";
259 }
260
261 print GPERF <<EOF;
262 %%
263 extern const char *const keyword_str [] = {
264 "<EOF>",
265 "<ERROR>",
266 EOF
267
268 for (@kw) {
269 printf GPERF " \"%s\",\n", $_;
270 }
271
272 print GPERF "};\n";
273
274 printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
275 join ", ", map length, @kw;
276
277 open KW, ">", "keyword.h";
278
279 print KW <<EOF;
280 #ifndef KW_H__
281 #define KW_H__
282
283 enum keyword {
284 KW_EOF, KW_ERROR,
285 EOF
286
287 for (@kw) {
288 printf KW " %s,\n", "KW_$_",
289 }
290
291 print KW <<EOF;
292 NUM_KEYWORD,
293 };
294
295 extern const char *const keyword_str [];
296 extern const unsigned char keyword_len [];
297
298 EOF
299
300 printf KW "#define MAX_KEYWORD_LEN %d\n", List::Util::max map length, @kw;
301
302 print KW <<EOF;
303
304 #endif
305
306 EOF
307