ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/preprocess
Revision: 1.19
Committed: Fri Feb 16 19:43:41 2007 UTC (17 years, 3 months ago) by root
Branch: MAIN
CVS Tags: rel-2_0
Changes since 1.18: +15 -10 lines
Log Message:
- identified random memory corrutpion bug
- fixed most likely cause for bug above
- rewrote object loader etc. into a simple one-line lookahead
  parser.
- rewrote/cleaned up archetype, treasure, artifact, formula parser.
- some optimisations / cleanups

File Contents

# User Rev Content
1 root 1.1 #!/opt/bin/perl
2    
3 root 1.8 my %ARG = @ARGV;
4    
5 root 1.3 use List::Util;
6    
7 root 1.1 # todo: gather dynamically
8     my @kw = qw(
9 root 1.4 no_pass
10     walk_on
11     walk_off
12     fly_on
13     fly_off
14     flying
15    
16 root 1.1 ac
17     activate_on_push
18     activate_on_release
19     alive
20     anim_speed
21     animation
22     applied
23     arch
24     armour
25     attach
26     attack_movement
27     attacktype
28     auto_apply
29     been_applied
30     berserk
31     blocksview
32     body_range
33     body_arm
34     body_torso
35     body_head
36     body_neck
37     body_skill
38     body_finger
39     body_shoulder
40     body_foot
41     body_hand
42     body_wrist
43     body_waist
44     can_apply
45     can_cast_spell
46     can_roll
47     can_see_in_dark
48     can_use_armour
49     can_use_bow
50     can_use_horn
51     can_use_range
52     can_use_ring
53     can_use_rod
54     can_use_scroll
55     can_use_shield
56     can_use_skill
57     can_use_wand
58     can_use_weapon
59     carrying
60     casting_time
61     cha
62     changing
63     client_type
64     con
65     confused
66     connected
67     container
68     cursed
69     custom_name
70     dam
71     dam_modifier
72     damned
73 root 1.12 destroy_on_death
74 root 1.1 dex
75     direction
76     duration
77     duration_modifier
78     editable
79     editor_folder
80     elevation
81     end
82     endlore
83     endmsg
84     exp
85     expmul
86     face
87     food
88     friendly
89     gen_sp_armour
90     generator
91     glow_radius
92     grace
93     has_ready_bow
94     has_ready_horn
95     has_ready_rod
96     has_ready_scroll
97     has_ready_skill
98     has_ready_wand
99     has_ready_weapon
100 root 1.7 has_ready_range
101 root 1.1 hitback
102     hp
103     identified
104     immune
105     int
106     inv_locked
107     invisible
108     is_animated
109     is_blind
110     is_buildable
111     is_cauldron
112 root 1.7 is_dust
113 root 1.1 is_floor
114     is_hilly
115     is_lightable
116     is_thrown
117     is_turnable
118     is_used_up
119     is_water
120     is_wooded
121     item_power
122     known_cursed
123     known_magical
124     last_eat
125     last_grace
126     last_heal
127     last_sp
128     level
129     lifesave
130     lore
131     luck
132     magic
133     make_invisible
134     material
135     materialname
136     maxgrace
137     maxhp
138     maxsp
139     monster
140     more
141     move_allow
142     move_block
143     move_off
144     move_on
145     move_slow
146     move_slow_penalty
147     move_state
148     move_type
149     msg
150     name
151     name_pl
152     neutral
153     no_attack
154     no_damage
155     no_drop
156     no_fix_player
157     no_magic
158     no_pick
159     no_skill_ident
160     no_steal
161     no_strength
162     nrof
163 root 1.13 obj_original
164 root 1.1 object
165     oid
166     one_hit
167     only_attack
168     other_arch
169     overlay_floor
170     path_attuned
171     path_denied
172     path_repelled
173     perm_exp
174     pick_up
175 root 1.7 player_sold
176 root 1.1 pow
177     protected
178     race
179     random_move
180     random_movement
181     randomitems
182     range
183     range_modifier
184     reflect_missile
185     reflect_spell
186     reflecting
187     resist_acid
188     resist_blind
189     resist_cancellation
190     resist_chaos
191     resist_cold
192     resist_confusion
193     resist_counterspell
194     resist_death
195     resist_deplete
196     resist_disease
197     resist_drain
198     resist_electricity
199     resist_fear
200     resist_fire
201     resist_ghosthit
202     resist_godpower
203     resist_holyword
204     resist_internal
205     resist_life_stealing
206     resist_magic
207     resist_paralyze
208     resist_physical
209     resist_poison
210     resist_slow
211     resist_turn_undead
212     resist_weaponmagic
213     run_away
214     scared
215     see_anywhere
216     see_invisible
217     skill
218     slaying
219     sleep
220     slow_move
221     smoothlevel
222     sp
223     speed
224     speed_left
225     splitting
226     stand_still
227     startequip
228     state
229     stealth
230     str
231     subtype
232     tear_down
233     title
234     tooltype
235     treasure
236     type
237     unaggressive
238     undead
239     unique
240     unpaid
241     use_content_on_gen
242 root 1.6 uuid
243 root 1.1 value
244     vulnerable
245     was_wiz
246     wc
247     weapontype
248     weight
249     will_apply
250     wis
251     wiz
252     x
253     xrays
254     y
255 root 1.5
256 root 1.9 maplore
257     endmaplore
258     enter_x
259     enter_y
260     width
261     height
262     reset_timeout
263     reset_time
264     swap_time
265     difficulty
266     darkness
267     fixed_resettime
268     per_player
269     per_party
270     region
271     shopitems
272     shopgreed
273     shopmin
274     shopmax
275     shoprace
276     outdoor
277     tile_path_1
278     tile_path_2
279     tile_path_3
280     tile_path_4
281    
282     file_format_version
283    
284     temp
285     pressure
286     humid
287     windspeed
288     winddir
289     sky
290 root 1.10
291     map
292     savebed_map
293     bed_x
294     bed_y
295     password
296     shoottype
297     bowtype
298     petmode
299     gen_hp
300     gen_sp
301     gen_grace
302     listening
303     peaceful
304     digestion
305     pickup
306     outputs_sync
307     outputs_count
308     usekeys
309     unapply
310     weapon_sp
311     lev_array
312     endplst
313 root 1.14
314     color_fg
315     color_bg
316     visibility
317     magicmap
318    
319     parent
320     longname
321 root 1.15 jail_map
322     jail_x
323     jail_y
324 root 1.14 fallback
325     nomore
326 root 1.16
327     chance
328     mods
329     diff
330     saves
331     description
332     density
333     damage
334 root 1.17
335     anim
336     mina
337     facings
338 root 1.18 player
339 root 1.19
340     allowed
341     keycode
342     trans
343     yield
344     ingred
345     cauldron
346    
347     Str
348     Dex
349     Con
350     Wis
351     Cha
352     Int
353     Pow
354 root 1.1 );
355    
356 root 1.8 open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h"
357     or die "$ARGV{GPERF}: $!";
358 root 1.1
359     print GPERF <<EOF;
360     %language=C++
361     %enum
362     %define class-name kw_lex
363     %define lookup-function-name match
364     %struct-type
365     %compare-strncmp
366     %delimiters=,
367 root 1.2 struct keyword_idx { const char *name; enum keyword index; };
368 root 1.1 %%
369     EOF
370    
371     for (@kw) {
372 root 1.3 printf GPERF "%s,%s\n", $_, "KW_$_";
373 root 1.1 }
374    
375     print GPERF <<EOF;
376     %%
377 root 1.3 extern const char *const keyword_str [] = {
378 root 1.1 "<EOF>",
379     "<ERROR>",
380     EOF
381    
382     for (@kw) {
383     printf GPERF " \"%s\",\n", $_;
384     }
385    
386 root 1.3 print GPERF "};\n";
387    
388     printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
389     join ", ", map length, @kw;
390 root 1.1
391 root 1.8 close GPERF
392     or die "$ARG{GPERF}: failed to run";
393    
394 root 1.1 open KW, ">", "keyword.h";
395    
396     print KW <<EOF;
397     #ifndef KW_H__
398     #define KW_H__
399    
400     enum keyword {
401 root 1.7 KW_NULL = 0,
402     KW_EOF = 0,
403     KW_ERROR,
404 root 1.1 EOF
405    
406     for (@kw) {
407 root 1.3 printf KW " %s,\n", "KW_$_",
408 root 1.1 }
409    
410     print KW <<EOF;
411     NUM_KEYWORD,
412     };
413    
414     extern const char *const keyword_str [];
415 root 1.3 extern const unsigned char keyword_len [];
416    
417     EOF
418    
419     printf KW "#define MAX_KEYWORD_LEN %d\n", List::Util::max map length, @kw;
420    
421     print KW <<EOF;
422 root 1.1
423     #endif
424    
425     EOF
426