Пример #1
0
				fputs($outf,$new_file_content);
				fclose($outf);
//die("for testing we will use only 1 file !");
			 }
         }
   closedir($curdir);/**/
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
$file_list = array("AIInterface.cpp", "ArenaTeam.cpp", "AuctionHouse.cpp", "AuctionMgr.cpp", "BattlegroundHandler.cpp", "BattlegroundMgr.cpp", "ChannelHandler.cpp", "CharacterHandler.cpp", "ChatHandler.cpp", "CombatHandler.cpp", "Container.cpp", "Corpse.cpp", "Creature.cpp", "DuelHandler.cpp", "DynamicObject.cpp", "EventableObject.cpp", "GameObject.cpp", "Group.cpp", "GroupHandler.cpp", "Guild.cpp", "GuildHandler.cpp", "HonorHandler.cpp", "Item.cpp", "ItemHandler.cpp", "ItemInterface.cpp", "LfgHandler.cpp", "LfgMgr.cpp", "LootMgr.cpp", "MailSystem.cpp", "Map.cpp", "MapCell.cpp", "MapMgr.cpp", "MiscHandler.cpp", "MovementHandler.cpp", "NPCHandler.cpp", "Object.cpp", "ObjectMgr.cpp", "ObjectStorage.cpp", "Pet.cpp", "PetHandler.cpp", "Player.cpp", "Quest.cpp", "QuestMgr.cpp", "RaidHandler.cpp", "ReputationHandler.cpp", "ScriptMgr.cpp", "SkillHandler.cpp", "Spell.cpp", "SpellAuras.cpp", "SpellEffects.cpp", "SpellHandler.cpp", "TaxiHandler.cpp", "TaxiMgr.cpp", "TradeHandler.cpp", "Unit.cpp", "WarsongGulch.cpp");
foreach ($file_list as $key => $value) {
    $srcfile = $srcdir . '/' . $value;
    if (is_file($srcfile)) {
        //instrument file
        $new_file_content = instrument_file($srcfile);
        //now overwrite old file
        $outf = fopen($srcfile, "w");
        //echo $new_file_content;
        //$outf=fopen("t.cpp","w");
        fputs($outf, $new_file_content);
        fclose($outf);
        //die("for testing we will use only 1 file !");
    }
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
echo "Maximum nbumber of Unique IDs used : {$unique_trace_id} <br>";
//search in the file for function starts and try to instrument them
$iter++;
$file_list[$iter] = "Pet.cpp";
$objident[$iter] = "Pet";
$macro[$iter] = "INSTRUMENT_TYPECAST_CHECK_PET_OBJECT_TYPE";
$iter++;
$file_list[$iter] = "Player.cpp";
$objident[$iter] = "Player";
$macro[$iter] = "INSTRUMENT_TYPECAST_CHECK_PLAYER_OBJECT_TYPE";
$iter++;
$file_list[$iter] = "Unit.cpp";
$objident[$iter] = "Unit";
$macro[$iter] = "INSTRUMENT_TYPECAST_CHECK_UNIT_OBJECT_TYPE";
$iter++;
for ($i = 0; $i < $iter; $i++) {
    $srcfile = $srcdir . $file_list[$i];
    $new_file_content = instrument_file($srcfile, $objident[$i], $macro[$i]);
    //now overwrite old file
    $outf = fopen($srcfile, "w");
    fputs($outf, $new_file_content);
    fclose($outf);
    //echo $new_file_content;
    //$outf=fopen("t.cpp","w");
    //	die("for testing we will use only 1 file !");
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//search in the file for function starts and try to instrument them
//we define function start as a level 0 "{" braket
global $html_output, $newline, $braket_level, $skip_instrument, $big_comment_detected;