#!/opt/bin/perl my %ARG = @ARGV; use List::Util; # todo: gather dynamically my @kw = qw( no_pass walk_on walk_off fly_on fly_off flying gender attack_skill ranged_skill ac activate_on_push activate_on_release alive anim_speed animation applied arch armour attach attack_movement attacktype auto_apply been_applied berserk blocksview body_range body_arm body_torso body_head body_neck body_skill body_finger body_shoulder body_foot body_hand body_wrist body_waist body_shield body_combat can_apply can_cast_spell can_roll can_see_in_dark can_use_armour can_use_bow can_use_horn can_use_range can_use_ring can_use_rod can_use_scroll can_use_shield can_use_skill can_use_wand can_use_weapon carrying casting_time cha changing client_type con confused connected container cursed custom_name dam dam_modifier damned destroy_on_death dex direction duration duration_modifier editable editor_folder elevation end endlore endmsg exp expmul face food friendly gen_sp_armour generator glow_radius grace has_ready_bow has_ready_scroll has_ready_skill has_ready_weapon has_ready_range hitback hp identified immune inherit int inv_locked invisible is_animated is_blind is_buildable is_cauldron is_dust is_floor is_hilly is_lightable is_thrown is_turnable is_used_up is_water is_wooded item_power known_cursed known_magical last_eat last_grace last_heal last_sp level lifesave lore luck magic make_invisible material materialname maxgrace maxhp maxsp monster more move_allow move_block move_off move_on move_slow move_slow_penalty move_state move_type msg name name_pl neutral no_attack no_damage no_drop no_fix_player no_magic no_pick no_skill_ident no_steal no_strength nrof obj_original object oid one_hit only_attack other_arch overlay_floor owner path_attuned path_denied path_repelled perm_exp pick_up player_sold pow precious protected race random_move random_movement randomitems range range_modifier reflect_missile reflect_spell reflecting resist_acid resist_blind resist_cancellation resist_chaos resist_cold resist_confusion resist_counterspell resist_death resist_deplete resist_disease resist_drain resist_electricity resist_fear resist_fire resist_ghosthit resist_godpower resist_holyword resist_internal resist_life_stealing resist_magic resist_paralyze resist_physical resist_poison resist_slow resist_turn_undead resist_weaponmagic run_away scared see_anywhere see_invisible skill slaying sleep slow_move sound sound_destroy smoothlevel sp speed speed_left splitting stand_still startequip state stealth str subtype tag tear_down title tooltype treasure_env type unaggressive undead unique unpaid use_content_on_gen uuid value vulnerable wc weapontype weight will_apply wis x xrays y maplore endmaplore enter_x enter_y width height reset_timeout reset_time swap_time difficulty darkness fixed_resettime per_player per_party no_reset region shopitems shopgreed shopmin shopmax shoprace outdoor tile_path_1 tile_path_2 tile_path_3 tile_path_4 file_format_version temp pressure humid windspeed winddir sky map savebed_map bed_x bed_y password bowtype petmode gen_hp gen_sp gen_grace listening peaceful digestion pickup outputs_sync outputs_count usekeys unapply weapon_sp weapon_sp_left lev_array endplst visibility magicmap parent longname jail_map jail_x jail_y portal_map portal_x portal_y fallback nomore chance mods diff saves description density damage anim mina facings player allowed keycode trans yield ingred cauldron Str Dex Con Wis Cha Int Pow treasure treasureone list change_name change_title change_slaying yes no ); open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h" or die "$ARGV{GPERF}: $!"; print GPERF <", "", EOF for (@kw) { printf GPERF " \"%s\",\n", $_; } print GPERF "};\n"; printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n", join ", ", map length, @kw; close GPERF or die "$ARG{GPERF}: failed to run"; open KW, ">", "keyword.h"; print KW <