ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/preprocess
Revision: 1.5
Committed: Mon Sep 4 15:51:24 2006 UTC (17 years, 8 months ago) by root
Branch: MAIN
Changes since 1.4: +10 -1 lines
Log Message:
*** empty log message ***

File Contents

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