answer
stringlengths
15
1.25M
#include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellAuraEffects.h" #include "SpellScript.h" #include "vault_of_archavon.h" enum Events { // Koralon <API key> = 1, EVENT_BURNING_FURY = 2, EVENT_FLAME_CINDER = 3, EVENT_METEOR_FISTS = 4, // Flame Warder EVENT_FW_LAVA_BIRST = 5, <API key> = 6 }; enum Spells { // Spells Koralon <API key> = 66665, SPELL_BURNING_FURY = 66721, <API key> = 66684, <API key> = 66681, // don't know the real relation to <API key> atm. SPELL_METEOR_FISTS = 66725, <API key> = 66765, // Spells Flame Warder SPELL_FW_LAVA_BIRST = 66813, <API key> = 66808, <API key> = 66809 }; class boss_koralon : public CreatureScript { public: boss_koralon() : CreatureScript("boss_koralon") { } struct boss_koralonAI : public BossAI { boss_koralonAI(Creature* creature) : BossAI(creature, DATA_KORALON) { } void EnterCombat(Unit* /*who*/) override { DoCast(me, SPELL_BURNING_FURY); events.ScheduleEvent(EVENT_BURNING_FURY, 20000); /// @todo check timer events.ScheduleEvent(<API key>, 15000); // 1st after 15sec, then every 45sec events.ScheduleEvent(EVENT_METEOR_FISTS, 75000); // 1st after 75sec, then every 45sec events.ScheduleEvent(EVENT_FLAME_CINDER, 30000); /// @todo check timer _EnterCombat(); } void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_BURNING_FURY: DoCast(me, SPELL_BURNING_FURY); events.ScheduleEvent(EVENT_BURNING_FURY, 20000); break; case <API key>: DoCast(me, <API key>); events.ScheduleEvent(<API key>, 45000); break; case EVENT_METEOR_FISTS: DoCast(me, SPELL_METEOR_FISTS); events.ScheduleEvent(EVENT_METEOR_FISTS, 45000); break; case EVENT_FLAME_CINDER: DoCast(me, <API key>); events.ScheduleEvent(EVENT_FLAME_CINDER, 30000); break; default: break; } } <API key>(); } }; CreatureAI* GetAI(Creature* creature) const override { return new boss_koralonAI(creature); } }; class npc_flame_warder : public CreatureScript { public: npc_flame_warder() : CreatureScript("npc_flame_warder") { } struct npc_flame_warderAI : public ScriptedAI { npc_flame_warderAI(Creature* creature) : ScriptedAI(creature) { } void Reset() override { events.Reset(); } void EnterCombat(Unit* /*who*/) override { DoZoneInCombat(); events.ScheduleEvent(EVENT_FW_LAVA_BIRST, 5000); events.ScheduleEvent(<API key>, 10000); } void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_FW_LAVA_BIRST: DoCastVictim(SPELL_FW_LAVA_BIRST); events.ScheduleEvent(EVENT_FW_LAVA_BIRST, 15000); break; case <API key>: DoCast(me, <API key>); events.ScheduleEvent(<API key>, 20000); break; default: break; } } <API key>(); } private: EventMap events; }; CreatureAI* GetAI(Creature* creature) const override { return new npc_flame_warderAI(creature); } }; class <API key> : public SpellScriptLoader { public: <API key>() : SpellScriptLoader("<API key>") { } class <API key> : public AuraScript { PrepareAuraScript(<API key>); bool Validate(SpellInfo const* /*spellInfo*/) override { if (!sSpellMgr->GetSpellInfo(<API key>)) return false; return true; } void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { <API key>(); GetTarget()->CastSpell(eventInfo.GetProcTarget(), <API key>, true, NULL, aurEff); } void Register() override { OnEffectProc += AuraEffectProcFn(<API key>::TriggerFists, EFFECT_0, SPELL_AURA_DUMMY); } }; AuraScript* GetAuraScript() const override { return new <API key>(); } }; class <API key> : public SpellScriptLoader { public: <API key>() : SpellScriptLoader("<API key>") { } class <API key> : public SpellScript { PrepareSpellScript(<API key>); public: <API key>() { _chainTargets = 0; } private: void FilterTargets(std::list<WorldObject*>& targets) { _chainTargets = targets.size(); } void <API key>() { if (_chainTargets) SetHitDamage(GetHitDamage() / (_chainTargets + 1)); } void Register() override { <API key> += <API key>(<API key>::FilterTargets, EFFECT_0, <API key>); OnHit += SpellHitFn(<API key>::<API key>); } private: uint8 _chainTargets; }; SpellScript* GetSpellScript() const override { return new <API key>(); } }; class <API key> : public SpellScriptLoader { public: <API key>() : SpellScriptLoader("<API key>") { } class <API key> : public AuraScript { PrepareAuraScript(<API key>); bool Validate(SpellInfo const* /*spellInfo*/) override { if (!sSpellMgr->GetSpellInfo(<API key>)) return false; return true; } void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { <API key>(); GetTarget()->CastSpell(eventInfo.GetProcTarget(), <API key>, true, NULL, aurEff); } void Register() override { OnEffectProc += AuraEffectProcFn(<API key>::TriggerFists, EFFECT_0, SPELL_AURA_DUMMY); } }; AuraScript* GetAuraScript() const override { return new <API key>(); } }; void AddSC_boss_koralon() { new boss_koralon(); new npc_flame_warder(); new <API key>(); new <API key>(); new <API key>(); }
<?php defined( '_JEXEC' ) or die; require_once JPATH_COMPONENT.'/helpers/helper_version.php'; // Model class CCKModelVersion extends <API key> { protected $text_prefix = 'COM_CCK'; protected $vName = 'version'; // populateState protected function populateState() { $app = JFactory::getApplication( 'administrator' ); $pk = $app->input->getInt( 'id', 0 ); $this->setState( 'version.id', $pk ); } // getForm public function getForm( $data = array(), $loadData = true ) { $form = $this->loadForm( CCK_COM.'.'.$this->vName, $this->vName, array( 'control' => 'jform', 'load_data' => $loadData ) ); if ( empty( $form ) ) { return false; } return $form; } // getItem public function getItem( $pk = null ) { if ( $item = parent::getItem( $pk ) ) { } return $item; } // getTable public function getTable( $type = 'Version', $prefix = CCK_TABLE, $config = array() ) { return JTable::getInstance( $type, $prefix, $config ); } // loadFormData protected function loadFormData() { // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState( CCK_COM.'.edit.'.$this->vName.'.data', array() ); if ( empty( $data ) ) { $data = $this->getItem(); } return $data; } // prepareData protected function prepareData() { $data = JRequest::get( 'post' ); return $data; } // revert public function revert( $pk, $type ) { $db = $this->getDbo(); $table = $this->getTable(); if ( !$pk || !$type ) { return false; } $table->load( $pk ); if ( JCck::getConfig_Param( 'version_revert', 1 ) == 1 ) { Helper_Version::createVersion( $type, $table->e_id, JText::sprintf( '<API key>', $table->e_version ) ); } $row = JTable::getInstance( $type, 'CCK_Table' ); $row->load( $table->e_id ); $core = JCckDev::fromJSON( $table->e_core ); if ( isset( $row->asset_id ) && $row->asset_id && isset( $core['rules'] ) ) { JCckDatabase::execute( 'UPDATE #__assets SET rules = "'.$db->escape( $core['rules'] ).'" WHERE id = '.(int)$row->asset_id ); } // More if ( $type == 'search' ) { $clients = array( 1=>'search', 2=>'filter', 3=>'list', 4=>'item', 5=>'order' ); } else { $clients = array( 1=>'admin', 2=>'site', 3=>'intro', 4=>'content' ); } foreach ( $clients as $i=>$client ) { $name = 'e_more'.$i; $this->_revert_more( $type, $client, $table->e_id, $table->{$name} ); } // Override if ( $row->version && ( $row->version != $table->e_version ) ) { $core['version'] = ++$row->version; } $core['checked_out'] = 0; $core['checked_out_time'] = '0000-00-00 00:00:00'; $row->bind( $core ); $row->check(); $row->store(); return true; } // _revert_more public function _revert_more( $type, $client, $pk, $json ) { $data = json_decode( $json ); $table = JCckTableBatch::getInstance( '#__cck_core_'.$type.'_field' ); $table->delete( $type.'id = '.$pk.' AND client = "'.$client.'"' ); $table->save( $data->fields, array(), array(), array( 'markup'=>'', 'restriction'=>'', 'restriction_options'=>'' ) ); $table = JCckTableBatch::getInstance( '#__cck_core_'.$type.'_position' ); $table->delete( $type.'id = '.$pk.' AND client = "'.$client.'"' ); $table->save( $data->positions ); } } ?>
<!DOCTYPE html> <!--[if IE 7]> <html class="ie ie7" lang="en-US" prefix="og: http://ogp.me/ns <![endif] <!--[if IE 8]> <html class="ie ie8" lang="en-US" prefix="og: http://ogp.me/ns <![endif] <!--[if !(IE 7) | !(IE 8) ]><!--> <html lang="en-US" prefix="og: http://ogp.me/ns <!--<![endif]--> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <title>Page Not Found | Team California Baseball</title> <link rel="profile" href="http://gmpg.org/xfn/11"> <link rel="pingback" href="http://teamcalbaseball.com/xmlrpc.php"> <!--[if lt IE 9]> <script src="http://teamcalbaseball.com/wp-content/themes/teamcalbaseball/js/html5.js"></script> <![endif] <meta property="og:locale" content="en_US" /> <meta property="og:type" content="website" /> <meta property="og:title" content="Page Not Found - Team California Baseball" /> <meta property="og:site_name" content="Team California Baseball" /> <!-- / Yoast WordPress SEO plugin. --> <link rel="alternate" type="application/rss+xml" title="Team California Baseball &raquo; Feed" href="http://teamcalbaseball.com/feed/" /> <link rel="alternate" type="application/rss+xml" title="Team California Baseball &raquo; Comments Feed" href="http://teamcalbaseball.com/comments/feed/" /> <link rel='stylesheet' id='contact-form-7-css' href='http://teamcalbaseball.com/wp-content/plugins/contact-form-7/includes/css/styles.css?ver=3.7' type='text/css' media='all' /> <link rel='stylesheet' id='<API key>' href='http://teamcalbaseball.com/wp-content/plugins/symple-shortcodes/includes/css/<API key>.css?ver=3.8.1' type='text/css' media='all' /> <link rel='stylesheet' id='<API key>' href='//fonts.googleapis.com/css?family=Lato%3A300%2C400%2C700%2C900%2C300italic%2C400italic%2C700italic' type='text/css' media='all' /> <link rel='stylesheet' id='genericons-css' href='http://teamcalbaseball.com/wp-content/themes/teamcalbaseball/genericons/genericons.css?ver=3.0.2' type='text/css' media='all' /> <link rel='stylesheet' id='<API key>' href='http://teamcalbaseball.com/wp-content/themes/teamcalbaseball/style.css?ver=3.8.1' type='text/css' media='all' /> <!--[if lt IE 9]> <link rel='stylesheet' id='<API key>' href='http://teamcalbaseball.com/wp-content/themes/teamcalbaseball/css/ie.css?ver=20131205' type='text/css' media='all' /> <![endif] <script type='text/javascript' src='http://teamcalbaseball.com/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script> <script type='text/javascript' src='http://teamcalbaseball.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script> <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://teamcalbaseball.com/xmlrpc.php?rsd" /> <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://teamcalbaseball.com/wp-includes/wlwmanifest.xml" /> <meta name="generator" content="WordPress 3.8.1" /> <style>span>iframe{ max-width:none !important; } </style> <link rel="stylesheet" href="http://teamcalbaseball.com/wp-content/themes/teamcalbaseball/styles/fonts.css" type="text/css"> <link rel="stylesheet" href="http://teamcalbaseball.com/wp-content/themes/teamcalbaseball/styles/jquery.bxslider.css" type="text/css"> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css"> <link rel="stylesheet/less" href="http://teamcalbaseball.com/wp-content/themes/teamcalbaseball/less/tcb.less" type="text/css"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script src="http://cdn.kendostatic.com/2013.3.1119/js/kendo.web.min.js"></script> <script src="http://teamcalbaseball.com/wp-content/themes/teamcalbaseball/js/less-1.6.1.min.js"></script> <script src="http://teamcalbaseball.com/wp-content/themes/teamcalbaseball/js/jquery.bxslider.min.js"></script> <script src="http://teamcalbaseball.com/wp-content/themes/teamcalbaseball/js/jquery.marquee.min.js"></script> <script> $(document).ready(function() { $('.marquee').marquee({ duration: 10000, pauseOnHover: true, }); $('.sponsors').bxSlider({ minSlides: 4, slideWidth: 210, }); }); </script> </head> <body class="error404 masthead-fixed full-width footer-widgets"> <div class="container"> <header> <div class="pageTitle"> <h1>Team California Baseball</h1> </div> <div id="headerImage"><img src="/wp-content/themes/teamcalbaseball/images/headerImage2.png"></div> <div class="twitterLink"><a href="https://twitter.com/teamcalbaseball" target="_blank"><img src="/wp-content/themes/teamcalbaseball/images/twitterLink.png"></a></div> </header> <section id="ticker"> <div class="row"> <div class="col-lg-12"> <div class="marquee"> <div class="playerScroll"> <a href="http: <p>2014 - EASTLAKE HS</p> <p>PITCHER/1ST BASE</p> <p>CONCORDIA UNIVERSITY</p> </a> </div> <div class="playerScroll"> <a href="http: <p>2014 - EL CAMINO HS</p> <p>3RD BASE</p> <p>UNIVERSITY OF NEVADA RENO</p> </a> </div> <div class="playerScroll"> <a href="http: <p>2014 - EASTLAKE HS</p> <p>PITCHER</p> <p>BAYLOR UNIVERSITY</p> </a> </div> <div class="playerScroll"> <a href="http: <p>2014 - PATRICK HENRY HS</p> <p>INFIELD</p> <p>UNIVERSITY OF SAN FRANCISCO</p> </a> </div> <div class="playerScroll"> <a href="http: <p>2014 - CALVARY CHRISTIAN HS</p> <p>PITCHER</p> <p>OREGON INSTITUTE OF TECHNOLOGY</p> </a> </div> <div class="playerScroll"> <a href="http: <p>2014 - SAN MARCOS HS</p> <p>PITCHER</p> <p>CAL STATE NORTHRIDGE</p> </div> <div class="playerScroll"> <a href="http://goaztecs.cstv.com/sports/m-basebl/sdsu-m-basebl-body.html" target="_blank"><p>MATT WEZNIAK</p> <p>2014 CARLSBAD HS</p> <p>INFIELD</p> <p>SAN DIEGO STATE UNIVERSITY</p> </a> </div> <div class="playerScroll"> <a href="http: <p>2013 - CARLSBAD HS</p> <p>OUTFIELD</p> <p>VIRGINIA TECH</p> </a> </div> <div class="playerScroll"> <a href="http: <p>2013 - BONITA VISTA HS</p> <p>PITCHER - LONG BEACH STATE</p> <p>DRAFTED 10TH RD CHICAGO WHITE SOX (SIGNED)</p> </a> </div> <div class="playerScroll"> <a href="http://goaztecs.cstv.com/sports/m-basebl/mtt/andrew_brown_865856.html" target="_blank"><p>ANDY BROWN</p> <p>2013 - THE ROCK ACADEMY HS</p> <p>SHORTSTOP</p> <p>SAN DIEGO STATE UNIVERSITY</p></a> </div> <div class="playerScroll"> <a href="http: <p>2013 - GROSSMONT HS</p> <p>OUTFIELD</p> <p>CAL STATE SAN MARCOS</p> </a> </div> <div class="playerScroll"> <a href="http://usdtoreros.cstv.com/sports/m-basebl/mtt/cj_burdick_881275.html" target="_blank"><p>CJ BURDICK</p> <p>2013 - SERRA HS</p> <p>PITCHER</p> <p>UNIVERSITY OF SAN DIEGO</p> </a> </div> <div class="playerScroll"> <a href="http://rccathletics.com/sports/bsb/2013-14/bios/devries_josh_gh7b" target="_blank"><p>JOSH DEVRIES</p> <p>2013 - CAPISTRANO VALLEY HS</p> <p>PITCHER</p> <p>RIVERSIDE COMMUNITY COLLEGE</p></a> </div> <div class="playerScroll"> <a href="http: <p>2013 - LJCDS</p> <p>SHORTSTOP</p> <p>STANFORD UNIVERSITY</p> </a> </div> <div class="playerScroll"> <a href="http: <p>2013 - CALVARY CHRISTIAN HS</p> <p>PITCHER</p> <p>ST. GREGORY'S UNIVERSITY</p> </a> </div> <div class="playerScroll"> <a href="http: <p>2013 - EL CAMINO HS</p> <p>1ST BASE</p> <p>POINT LOMA NAZARENE UNIVERSITY</p> </a> </a> </div> <div class="playerScroll"> <a href="http: <p>2013 - LJCDS</p> <p>CATCHER</p> <p>UC IRVINE</p> </a> </div> <div class="playerScroll"> <a href="http://utahutes.cstv.com/sports/m-basebl/mtt/<API key>.html" target="_blank"><p>DUSTIN HUGHES</p> <p>2013 - LJCDS</p> <p>PITCHER</p> <p>UNIVERSITY OF UTAH</p> </a> </div> <div class="playerScroll"> <a href="http: <p>2013 - RANCHO BERNARDO HS</p> <p>SHORTSTOP</p> <p>POINT LOMA NAZARENE UNIVERSITY</p> </a> </div> <div class="playerScroll"> <a href="https: <p>2013 - CARLSBAD HS</p> <p>PITCHER</p> <p>CAL POLY SAN LUIS OBISPO</p> </a> </div> <div class="playerScroll"> <a href="http: <p>2013 - EASTLAKE HS</p> <p>OUTFIELD</p> <p>CLAREMONT COLLEGE</p> </a> </div> <div class="playerScroll"> <a href="http: <p>2013 - THE ROCK ACADEMY HS</p> <p>PITCHER</p> <p>CENTRAL ARIZONA COMMUNITY COLLEGE</p> </a> </div> <div class="playerScroll"> <a href="http://gocugo.com/roster.aspx?path=baseball&rp_id=1637" target="_blank"><p>ADAM TAYLOR</p> <p>2013 - THE ROCK ACADEMY HS</p> <p>UTILITY</p> <p>CONCORDIA UNIVERSITY</p> </a> </div> <div class="playerScroll"> <a href="https: <p>2013 - CALVARY CHRISTIAN HS</p> <p>CATCHER</p> <p>MASTERS COLLEGE</p> </a> </div> <div class="playerScroll"> <a target="_blank" href="http: <p>2012 - LJCDS</p> <p>CATCHER - UC SANTA BARBARA</p> <p>DRAFTED 17TH RD CHICAGO WHITE SOX (SIGNED)</p></a> </div> <div class="playerScroll"> <a href="http://webapps.westmont.edu/cgi-bin/WebObjects/sportsData.woa/1/wo/<API key>/0.1.2.1.18.24.2.0.0" target="_blank"><p>RUSSELL HARMENING</p> <p>2012 - CALVARY CHRISTIAN HS</p> <p>PITCHER</p> <p>WESTMONT COLLEGE</p> </a> </div> <div class="playerScroll"> <a href="https: <p>2012 - VISTA HS</p> <p>3RD BASE</p> <p>MASTERS COLLEGE</p> </a> </div> <div class="playerScroll"> <a href="http: <p>2012 - CHRISTIAN HS</p> <p>OUTFIELD</p> <p>MESA COLLEGE</p> </a> </div> </div> <!-- <div class="popout"> <a class="button" href=" Popout </a> </div> </div> </div> </section> <nav id="primary-navigation" class="site-navigation primary-navigation tcbNav" role="navigation"> <a class="screen-reader-text skip-link" href="#content">Skip to content</a> <div class="<API key>"><ul id="menu-main-menu" class="nav-menu tcbNav"><li id="menu-item-32" class="menu-item <API key> <API key> menu-item-32"><a href="/">Home</a></li> <li id="menu-item-252" class="menu-item <API key> <API key> <API key> menu-item-252"><a href="#">About</a> <ul class="sub-menu"> <li id="menu-item-205" class="menu-item <API key> <API key> menu-item-205"><a href="http://teamcalbaseball.com/about/">Mission Statement</a></li> <li id="menu-item-125" class="menu-item <API key> <API key> menu-item-125"><a href="http://teamcalbaseball.com/about/staff/">Staff</a></li> <li id="menu-item-101" class="menu-item <API key> <API key> menu-item-101"><a href="http://teamcalbaseball.com/about/partners/">Partners</a></li> <li id="menu-item-102" class="menu-item <API key> <API key> menu-item-102"><a href="http://teamcalbaseball.com/about/resources/">Resources</a></li> </ul> </li> <li id="menu-item-72" class="menu-item <API key> <API key> menu-item-72"><a href="http://teamcalbaseball.com/alumni/">Alumni</a></li> <li id="menu-item-74" class="menu-item <API key> <API key> <API key> menu-item-74"><a href="http://teamcalbaseball.com/events/">Events</a> <ul class="sub-menu"> <li id="menu-item-130" class="menu-item <API key> <API key> menu-item-130"><a href="http://teamcalbaseball.com/events/tournaments/">Tournaments</a></li> <li id="menu-item-129" class="menu-item <API key> <API key> menu-item-129"><a href="http://teamcalbaseball.com/events/showcases/">Showcases</a></li> <li id="menu-item-127" class="menu-item <API key> <API key> menu-item-127"><a href="http://teamcalbaseball.com/events/college-team-camps/">College Team Camps</a></li> <li id="menu-item-128" class="menu-item <API key> <API key> menu-item-128"><a href="http://teamcalbaseball.com/events/<API key>/">Perfect Game Socal League</a></li> </ul> </li> <li id="menu-item-132" class="menu-item <API key> <API key> <API key> menu-item-132"><a href="http://teamcalbaseball.com/prospects/">Prospects</a> <ul class="sub-menu"> <li id="menu-item-161" class="menu-item <API key> <API key> menu-item-161"><a target="_blank" href="http://web1.ncaa.org/ECWR2/NCAA_EMS/NCAA_EMS.html#">Clearinghouse</a></li> </ul> </li> <li id="menu-item-251" class="menu-item <API key> <API key> <API key> menu-item-251"><a href="#">Teams</a> <ul class="sub-menu"> <li id="menu-item-80" class="menu-item <API key> <API key> menu-item-80"><a href="http://teamcalbaseball.com/teams/san-diego/">San Diego</a></li> <li id="menu-item-79" class="menu-item <API key> <API key> menu-item-79"><a href="http://teamcalbaseball.com/teams/orange-county/">Orange County</a></li> <li id="menu-item-78" class="menu-item <API key> <API key> menu-item-78"><a href="http://teamcalbaseball.com/teams/los-angeles/">Los Angeles</a></li> <li id="menu-item-81" class="menu-item <API key> <API key> menu-item-81"><a href="http://teamcalbaseball.com/teams/valley/">Valley</a></li> </ul> </li> <li id="menu-item-131" class="menu-item <API key> <API key> menu-item-131"><a href="http://teamcalbaseball.com/<API key>/">Perfect Game All-Tournament Teams</a></li> <li id="menu-item-406" class="menu-item <API key> <API key> <API key> menu-item-406"><a href="http://teamcalbaseball.com/schedule/">Schedule</a> <ul class="sub-menu"> <li id="menu-item-408" class="menu-item <API key> <API key> menu-item-408"><a href="http://teamcalbaseball.com/schedule/workout/">Workout</a></li> <li id="menu-item-407" class="menu-item <API key> <API key> menu-item-407"><a target="_blank" href="http://teamcalbaseball.com/schedule/game/">Game</a></li> </ul> </li> <li id="menu-item-76" class="menu-item <API key> <API key> menu-item-76"><a href="http://teamcalbaseball.com/team-store/">Team Store</a></li> <li id="menu-item-73" class="menu-item <API key> <API key> menu-item-73"><a href="http://teamcalbaseball.com/contact/">Contact</a></li> </ul></div> </nav> <article id="tcbPage"> <section> <header class="page-header"> <h1 class="page-title">Not Found</h1> </header> <div class="page-content"> <p>It looks like nothing was found at this location. Maybe try a search?</p> <form role="search" method="get" class="search-form" action="http://teamcalbaseball.com/"> <label> <span class="screen-reader-text">Search for:</span> <input type="search" class="search-field" placeholder="Search &hellip;" value="" name="s" title="Search for:" /> </label> <input type="submit" class="search-submit" value="Search" /> </form> </div><!-- .page-content --> </section><!-- #content --> </article><!-- #primary --> <footer id="colophon" class="site-footer container" role="contentinfo"> <div class="row"> <div class="col-lg-12"> <div class="foot pull-left"><img src="http://teamcalbaseball.com/wp-content/themes/teamcalbaseball/images/tcblogo.png"></div> <div class="foot pull-left"><h2><a href="/teamcalbaseball/">Home</h2><h2><a href="/teamcalbaseball/about">About</a></h2><ul><li><a href="/teamcalbaseball/about/">Mission</a></li><li><a href="/teamcalbaseball/about/staff">Staff</a></li><li><a href="/teamcalbaseball/about/partners">Partners</a></li><li><a href="/teamcalbaseball/about/resources">Resources</a></li></ul><h2><a href="/teamcalbaseball/alumni">Alumni</a></h2></div> <div class="foot pull-left"><h2><a href="/teamcalbaseball/events/">Events</a></h2><h2>Teams</h2><ul><li><a href="/teamcalbaseball/teams/san-diego/">San Diego</a></li><li><a href="/teamcalbaseball/teams/orange-county/">Orange County</a></li><li><a href="/teamcalbaseball/teams/los-angeles/">Los Angeles</a></li><li><a href="/teamcalbaseball/teams/valley/">Valley</a></li></ul></div> <div class="foot pull-left"><h2><a href="/teamcalbaseball/contact/">Contact</a></h2><ul><li><p>Team California Baseball</p><p>PO Box 131406<p>(760) 994-9114</p><p>teamcalbaseball.com</p><p class="designedBy"><a href="http: </div> </div> </footer><!-- #colophon --> </div><!-- end Container--> <script type='text/javascript' src='http://teamcalbaseball.com/wp-content/plugins/contact-form-7/includes/js/jquery.form.min.js?ver=3.48.0-2013.12.28'></script> <script type='text/javascript'> /* <![CDATA[ */ var _wpcf7 = {"loaderUrl":"http:\/\/teamcalbaseball.com\/wp-content\/plugins\/contact-form-7\/images\/ajax-loader.gif","sending":"Sending ...","cached":"1"}; </script> <script type='text/javascript' src='http://teamcalbaseball.com/wp-content/plugins/contact-form-7/includes/js/scripts.js?ver=3.7'></script> <script type='text/javascript' src='http://teamcalbaseball.com/wp-includes/js/jquery/jquery.masonry.min.js?ver=2.1.05'></script> <script type='text/javascript' src='http://teamcalbaseball.com/wp-content/themes/teamcalbaseball/js/functions.js?ver=20131209'></script> </body> </html> <!-- Dynamic page generated in 0.129 seconds. --> <!-- Cached page generated by WP-Super-Cache on 2014-02-22 09:52:28 --> <!-- Compression = gzip --> <!-- super cache -->
/* How would you design a stack which, in addition to push and pop, also has a function min which returns the minimum element? Push, pop and min should all operate in O(1) time. */ #include <stdio.h> #include <map> using namespace std; #define N 500 typedef struct Stack { int top; int min; int value[N]; map<int, int> minTr; }Stack; void init(Stack& s) { s.top = 0; s.min = 1 << 30; } void push(Stack& s, int val) { if(s.top >= N) { printf("overflow!\n"); return; } s.value[s.top] = val; if(val < s.min) { s.minTr.insert(pair<int, int>(s.top, val)); s.min = val; } s.top++; } int pop(Stack& s) { if(s.top <= 0) { printf("Stack is empty!\n"); return 0; } s.top int e = s.value[s.top]; if(e == s.min) { int ind = s.minTr.rbegin()->first; if(ind == s.top) { s.minTr.erase(s.top); if(s.minTr.empty()) s.min = 1 << 30; else s.min = s.minTr.rbegin()->second; } } return e; } int minEle(Stack s) { if(s.top == 0) { printf("Stack is empty!\n"); return 0; } return s.min; } void createStack(Stack& s, int *a, int n) { for (int i = 0; i < 9; ++i) { push(s, a[i]); //printf("%d %d\n", a[i], minEle(s)); } } void popEmpty(Stack s) { //printf("hello\n"); while(s.top > 0) { int e = pop(s); printf("%d %d\n", e, s.min); } } int main() { int a[9] = {3, 4, 5, 2, 6, 8, 1, 1, 4}; Stack s; init(s); createStack(s, a, 9); popEmpty(s); return 0; }
#include "Common.h" #include "Language.h" #include "Database/DatabaseEnv.h" #include "WorldPacket.h" #include "WorldSession.h" #include "Opcodes.h" #include "Log.h" #include "ObjectMgr.h" #include "SpellMgr.h" #include "Player.h" #include "GossipDef.h" #include "UpdateMask.h" #include "ScriptMgr.h" #include "Creature.h" #include "Pet.h" #include "Guild.h" #include "GuildMgr.h" #include "Chat.h" #include "Item.h" #ifdef ENABLE_ELUNA #include "LuaEngine.h" #endif /* ENABLE_ELUNA */ enum StableResultCode { STABLE_ERR_MONEY = 0x01, // "you don't have enough money" STABLE_ERR_STABLE = 0x06, // currently used in most fail cases <API key> = 0x08, // stable success <API key> = 0x09, // unstable/swap success <API key> = 0x0A, // buy slot success STABLE_ERR_EXOTIC = 0x0C, // "you are unable to control exotic creatures" }; void WorldSession::<API key>(WorldPacket& recv_data) { ObjectGuid guid; recv_data >> guid; Creature* unit = GetPlayer()-><API key>(guid, <API key>); if (!unit) { DEBUG_LOG("WORLD: <API key> - %s not found or you can't interact with him.", guid.GetString().c_str()); return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } <API key>(guid); } void WorldSession::<API key>(ObjectGuid guid) { WorldPacket data(<API key>, 8); data << ObjectGuid(guid); SendPacket(&data); } void WorldSession::<API key>(WorldPacket& recv_data) { ObjectGuid guid; DEBUG_LOG("WORLD: Received opcode <API key>"); recv_data >> guid; if (!CheckBanker(guid)) { return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } SendShowBank(guid); } void WorldSession::SendShowBank(ObjectGuid guid) { WorldPacket data(SMSG_SHOW_BANK, 8); data << ObjectGuid(guid); SendPacket(&data); } void WorldSession::<API key>(WorldPacket& recv_data) { ObjectGuid guid; recv_data >> guid; SendTrainerList(guid); } void WorldSession::SendTrainerList(ObjectGuid guid) { std::string str = GetMangosString(<API key>); SendTrainerList(guid, str); } static void <API key>(WorldPacket& data, TrainerSpell const* tSpell, TrainerSpellState state, float fDiscountMod, bool <API key>, uint32 reqLevel) { bool <API key> = sSpellMgr.<API key>(tSpell->learnedSpell); SpellChainNode const* chain_node = sSpellMgr.GetSpellChainNode(tSpell->learnedSpell); data << uint32(tSpell->spell); // learned spell (or cast-spell in profession case) data << uint8(state == <API key> ? TRAINER_SPELL_GREEN : state); data << uint32(floor(tSpell->spellCost * fDiscountMod)); data << uint32(<API key> && <API key> ? 1 : 0); // primary prof. learn confirmation dialog data << uint32(<API key> ? 1 : 0); // must be equal prev. field to have learn button in enabled state data << uint8(reqLevel); data << uint32(tSpell->reqSkill); data << uint32(tSpell->reqSkillValue); data << uint32(!tSpell->IsCastable() && chain_node ? (chain_node->prev ? chain_node->prev : chain_node->req) : 0); data << uint32(!tSpell->IsCastable() && chain_node && chain_node->prev ? chain_node->req : 0); data << uint32(0); } void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle) { DEBUG_LOG("WORLD: SendTrainerList"); Creature* unit = GetPlayer()-><API key>(guid, <API key>); if (!unit) { DEBUG_LOG("WORLD: SendTrainerList - %s not found or you can't interact with him.", guid.GetString().c_str()); return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } // trainer list loaded at check; if (!unit->IsTrainerOf(_player, true)) { return; } CreatureInfo const* ci = unit->GetCreatureInfo(); if (!ci) { return; } TrainerSpellData const* cSpells = unit->GetTrainerSpells(); TrainerSpellData const* tSpells = unit-><API key>(); if (!cSpells && !tSpells) { DEBUG_LOG("WORLD: SendTrainerList - Training spells not found for %s", guid.GetString().c_str()); return; } uint32 maxcount = (cSpells ? cSpells->spellList.size() : 0) + (tSpells ? tSpells->spellList.size() : 0); uint32 trainer_type = cSpells && cSpells->trainerType ? cSpells->trainerType : (tSpells ? tSpells->trainerType : 0); WorldPacket data(SMSG_TRAINER_LIST, 8 + 4 + 4 + maxcount * 38 + strTitle.size() + 1); data << ObjectGuid(guid); data << uint32(trainer_type); size_t count_pos = data.wpos(); data << uint32(maxcount); // reputation discount float fDiscountMod = _player-><API key>(unit); bool <API key> = GetPlayer()-><API key>() > 0; uint32 count = 0; if (cSpells) { for (TrainerSpellMap::const_iterator itr = cSpells->spellList.begin(); itr != cSpells->spellList.end(); ++itr) { TrainerSpell const* tSpell = &itr->second; uint32 reqLevel = 0; if (!_player-><API key>(tSpell->learnedSpell, &reqLevel)) { continue; } reqLevel = tSpell->isProvidedReqLevel ? tSpell->reqLevel : std::max(reqLevel, tSpell->reqLevel); TrainerSpellState state = _player-><API key>(tSpell, reqLevel); <API key>(data, tSpell, state, fDiscountMod, <API key>, reqLevel); ++count; } } if (tSpells) { for (TrainerSpellMap::const_iterator itr = tSpells->spellList.begin(); itr != tSpells->spellList.end(); ++itr) { TrainerSpell const* tSpell = &itr->second; uint32 reqLevel = 0; if (!_player-><API key>(tSpell->learnedSpell, &reqLevel)) { continue; } reqLevel = tSpell->isProvidedReqLevel ? tSpell->reqLevel : std::max(reqLevel, tSpell->reqLevel); TrainerSpellState state = _player-><API key>(tSpell, reqLevel); <API key>(data, tSpell, state, fDiscountMod, <API key>, reqLevel); ++count; } } data << strTitle; data.put<uint32>(count_pos, count); SendPacket(&data); } void WorldSession::<API key>(WorldPacket& recv_data) { ObjectGuid guid; uint32 spellId = 0; recv_data >> guid >> spellId; DEBUG_LOG("WORLD: Received opcode <API key> Trainer: %s, learn spell id is: %u", guid.GetString().c_str(), spellId); Creature* unit = GetPlayer()-><API key>(guid, <API key>); if (!unit) { DEBUG_LOG("WORLD: <API key> - %s not found or you can't interact with him.", guid.GetString().c_str()); return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } if (!unit->IsTrainerOf(_player, true)) { return; } // check present spell in trainer spell list TrainerSpellData const* cSpells = unit->GetTrainerSpells(); TrainerSpellData const* tSpells = unit-><API key>(); if (!cSpells && !tSpells) { return; } // Try find spell in npc_trainer TrainerSpell const* trainer_spell = cSpells ? cSpells->Find(spellId) : NULL; // Not found, try find in <API key> if (!trainer_spell && tSpells) { trainer_spell = tSpells->Find(spellId); } // Not found anywhere, cheating? if (!trainer_spell) { return; } // can't be learn, cheat? Or double learn with lags... uint32 reqLevel = 0; if (!_player-><API key>(trainer_spell->learnedSpell, &reqLevel)) { return; } reqLevel = trainer_spell->isProvidedReqLevel ? trainer_spell->reqLevel : std::max(reqLevel, trainer_spell->reqLevel); if (_player-><API key>(trainer_spell, reqLevel) != TRAINER_SPELL_GREEN) { return; } // apply reputation discount uint32 nSpellCost = uint32(floor(trainer_spell->spellCost * _player-><API key>(unit))); // check money requirement if (_player->GetMoney() < nSpellCost) { return; } _player->ModifyMoney(-int32(nSpellCost)); SendPlaySpellVisual(guid, 0xB3); // visual effect on trainer WorldPacket data(<API key>, 8 + 4); // visual effect on player data << _player->GetObjectGuid(); data << uint32(0x016A); // index from SpellVisualKit.dbc SendPacket(&data); // learn explicitly or cast explicitly // TODO - Are these spells really cast correctly this way? if (trainer_spell->IsCastable()) { _player->CastSpell(_player, trainer_spell->spell, true); } else { _player->learnSpell(spellId, false); } data.Initialize(<API key>, 12); data << ObjectGuid(guid); data << uint32(spellId); // should be same as in packet from client SendPacket(&data); } void WorldSession::<API key>(WorldPacket& recv_data) { DEBUG_LOG("WORLD: Received opcode CMSG_GOSSIP_HELLO"); ObjectGuid guid; recv_data >> guid; Creature* pCreature = GetPlayer()-><API key>(guid, UNIT_NPC_FLAG_NONE); if (!pCreature) { DEBUG_LOG("WORLD: <API key> - %s not found or you can't interact with him.", guid.GetString().c_str()); return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } pCreature->StopMoving(); if (pCreature->IsSpiritGuide()) { pCreature-><API key>(_player); } if (!sScriptMgr.OnGossipHello(_player, pCreature)) { _player->PrepareGossipMenu(pCreature, pCreature->GetCreatureInfo()->GossipMenuId); _player->SendPreparedGossip(pCreature); } } void WorldSession::<API key>(WorldPacket& recv_data) { DEBUG_LOG("WORLD: <API key>"); uint32 gossipListId; uint32 menuId; ObjectGuid guid; std::string code; recv_data >> guid >> menuId >> gossipListId; if (_player->PlayerTalkClass->GossipOptionCoded(gossipListId)) { recv_data >> code; DEBUG_LOG("Gossip code: %s", code.c_str()); } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } uint32 sender = _player->PlayerTalkClass->GossipOptionSender(gossipListId); uint32 action = _player->PlayerTalkClass->GossipOptionAction(gossipListId); if (guid.IsAnyTypeCreature()) { Creature* pCreature = GetPlayer()-><API key>(guid, UNIT_NPC_FLAG_NONE); if (!pCreature) { DEBUG_LOG("WORLD: <API key> - %s not found or you can't interact with it.", guid.GetString().c_str()); return; } if (!sScriptMgr.OnGossipSelect(_player, pCreature, sender, action, code.empty() ? NULL : code.c_str())) { _player->OnGossipSelect(pCreature, gossipListId, menuId); } } else if (guid.IsGameObject()) { GameObject* pGo = GetPlayer()-><API key>(guid); if (!pGo) { DEBUG_LOG("WORLD: <API key> - %s not found or you can't interact with it.", guid.GetString().c_str()); return; } if (!sScriptMgr.OnGossipSelect(_player, pGo, sender, action, code.empty() ? NULL : code.c_str())) { _player->OnGossipSelect(pGo, gossipListId, menuId); } } else if (guid.IsItem()) { Item* item = GetPlayer()->GetItemByGuid(guid); if (!item) { DEBUG_LOG("WORLD: <API key> - %s not found or you can't interact with it.", guid.GetString().c_str()); return; } if (!sScriptMgr.OnGossipSelect(_player, item, sender, action, code.empty() ? NULL : code.c_str())) { DEBUG_LOG("WORLD: <API key> - item script for %s not found or you can't interact with it.", item->GetProto()->Name1); return; } // Used by Eluna #ifdef ENABLE_ELUNA sEluna-><API key>(GetPlayer(), item, GetPlayer()->PlayerTalkClass->GossipOptionSender(gossipListId), GetPlayer()->PlayerTalkClass->GossipOptionAction(gossipListId), code); #endif /* ENABLE_ELUNA */ } else if (guid.IsPlayer()) { if (GetPlayer()->GetGUIDLow() != guid || GetPlayer()->PlayerTalkClass->GetGossipMenu().GetMenuId() != menuId) { DEBUG_LOG("WORLD: <API key> - %s not found or you can't interact with it.", guid.GetString().c_str()); return; } // Used by Eluna #ifdef ENABLE_ELUNA sEluna-><API key>(GetPlayer(), menuId, GetPlayer()->PlayerTalkClass->GossipOptionSender(gossipListId), GetPlayer()->PlayerTalkClass->GossipOptionAction(gossipListId), code); #endif /* ENABLE_ELUNA */ } } void WorldSession::<API key>(WorldPacket& recv_data) { DEBUG_LOG("WORLD: <API key>"); ObjectGuid guid; recv_data >> guid; Creature* unit = GetPlayer()-><API key>(guid, <API key>); if (!unit) { DEBUG_LOG("WORLD: <API key> - %s not found or you can't interact with him.", guid.GetString().c_str()); return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } SendSpiritResurrect(); } void WorldSession::SendSpiritResurrect() { _player->ResurrectPlayer(0.5f, true); _player->DurabilityLossAll(0.25f, true); // get corpse nearest graveyard WorldSafeLocsEntry const* corpseGrave = NULL; Corpse* corpse = _player->GetCorpse(); if (corpse) corpseGrave = sObjectMgr.GetClosestGraveYard( corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetMapId(), _player->GetTeam()); // now can spawn bones _player->SpawnCorpseBones(); // teleport to nearest from corpse graveyard, if different from nearest to player ghost if (corpseGrave) { WorldSafeLocsEntry const* ghostGrave = sObjectMgr.GetClosestGraveYard( _player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeam()); if (corpseGrave != ghostGrave) { _player->TeleportTo(corpseGrave->map_id, corpseGrave->x, corpseGrave->y, corpseGrave->z, _player->GetOrientation()); } // or update at original position else { _player->GetCamera().<API key>(); _player-><API key>(); } } // or update at original position else { _player->GetCamera().<API key>(); _player-><API key>(); } } void WorldSession::<API key>(WorldPacket& recv_data) { ObjectGuid npcGuid; recv_data >> npcGuid; if (!GetPlayer()->IsInWorld() || !GetPlayer()->IsAlive()) { return; } Creature* unit = GetPlayer()-><API key>(npcGuid, <API key>); if (!unit) { DEBUG_LOG("WORLD: <API key> - %s not found or you can't interact with him.", npcGuid.GetString().c_str()); return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } SendBindPoint(unit); } void WorldSession::SendBindPoint(Creature* npc) { // prevent set homebind to instances in any case if (GetPlayer()->GetMap()->Instanceable()) { return; } // send spell for bind 3286 bind magic npc->CastSpell(_player, 3286, true); // Bind WorldPacket data(<API key>, (8 + 4)); data << npc->GetObjectGuid(); data << uint32(3286); // Bind SendPacket(&data); _player->PlayerTalkClass->CloseGossip(); } void WorldSession::<API key>(WorldPacket& recv_data) { DEBUG_LOG("WORLD: Recv <API key>"); ObjectGuid npcGUID; recv_data >> npcGUID; if (!CheckStableMaster(npcGUID)) { SendStableResult(STABLE_ERR_STABLE); return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } SendStablePet(npcGUID); } void WorldSession::SendStablePet(ObjectGuid guid) { DEBUG_LOG("WORLD: Recv <API key> Send."); WorldPacket data(<API key>, 200); // guess size data << guid; Pet* pet = _player->GetPet(); size_t wpos = data.wpos(); data << uint8(0); // place holder for slot show number data << uint8(GetPlayer()->m_stableSlots); uint8 num = 0; // counter for place holder // not let move dead pet in slot if (pet && pet->IsAlive() && pet->getPetType() == HUNTER_PET) { data << uint32(pet->GetCharmInfo()->GetPetNumber()); data << uint32(pet->GetEntry()); data << uint32(pet->getLevel()); data << pet->GetName(); // petname data << uint8(1); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show) ++num; } // 0 1 2 3 4 QueryResult* result = CharacterDatabase.PQuery("SELECT `owner`, `id`, `entry`, `level`, `name` FROM `character_pet` WHERE `owner` = '%u' AND `slot` >= '%u' AND `slot` <= '%u' ORDER BY `slot`", _player->GetGUIDLow(), <API key>, <API key>); if (result) { do { Field* fields = result->Fetch(); data << uint32(fields[1].GetUInt32()); // petnumber data << uint32(fields[2].GetUInt32()); // creature entry data << uint32(fields[3].GetUInt32()); // level data << fields[4].GetString(); // name data << uint8(2); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show) ++num; } while (result->NextRow()); delete result; } data.put<uint8>(wpos, num); // set real data to placeholder SendPacket(&data); } void WorldSession::SendStableResult(uint8 res) { WorldPacket data(SMSG_STABLE_RESULT, 1); data << uint8(res); SendPacket(&data); } bool WorldSession::CheckStableMaster(ObjectGuid guid) { // spell case or GM if (guid == GetPlayer()->GetObjectGuid()) { // command case will return only if player have real access to command if (!GetPlayer()->HasAuraType(<API key>) && !ChatHandler(GetPlayer()).FindCommand("stable")) { DEBUG_LOG("%s attempt open stable in cheating way.", guid.GetString().c_str()); return false; } } // stable master case else { if (!GetPlayer()-><API key>(guid, <API key>)) { DEBUG_LOG("Stablemaster %s not found or you can't interact with him.", guid.GetString().c_str()); return false; } } return true; } void WorldSession::HandleStablePet(WorldPacket& recv_data) { DEBUG_LOG("WORLD: Recv CMSG_STABLE_PET"); ObjectGuid npcGUID; recv_data >> npcGUID; if (!GetPlayer()->IsAlive()) { SendStableResult(STABLE_ERR_STABLE); return; } if (!CheckStableMaster(npcGUID)) { SendStableResult(STABLE_ERR_STABLE); return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } Pet* pet = _player->GetPet(); // can't place in stable dead pet if (!pet || !pet->IsAlive() || pet->getPetType() != HUNTER_PET) { SendStableResult(STABLE_ERR_STABLE); return; } uint32 free_slot = 1; QueryResult* result = CharacterDatabase.PQuery("SELECT `owner`,`slot`,`id` FROM `character_pet` WHERE `owner` = '%u' AND `slot` >= '%u' AND `slot` <= '%u' ORDER BY `slot`", _player->GetGUIDLow(), <API key>, <API key>); if (result) { do { Field* fields = result->Fetch(); uint32 slot = fields[1].GetUInt32(); // slots ordered in query, and if not equal then free if (slot != free_slot) { break; } // this slot not free, skip ++free_slot; } while (result->NextRow()); delete result; } if (free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots) { pet->Unsummon(PetSaveMode(free_slot), _player); SendStableResult(<API key>); } else { SendStableResult(STABLE_ERR_STABLE); } } void WorldSession::HandleUnstablePet(WorldPacket& recv_data) { DEBUG_LOG("WORLD: Recv CMSG_UNSTABLE_PET."); ObjectGuid npcGUID; uint32 petnumber; recv_data >> npcGUID >> petnumber; if (!CheckStableMaster(npcGUID)) { SendStableResult(STABLE_ERR_STABLE); return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } uint32 creature_id = 0; { QueryResult* result = CharacterDatabase.PQuery("SELECT `entry` FROM `character_pet` WHERE `owner` = '%u' AND `id` = '%u' AND `slot` >='%u' AND `slot` <= '%u'", _player->GetGUIDLow(), petnumber, <API key>, <API key>); if (result) { Field* fields = result->Fetch(); creature_id = fields[0].GetUInt32(); delete result; } } if (!creature_id) { SendStableResult(STABLE_ERR_STABLE); return; } CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creature_id); if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets())) { // if problem in exotic pet if (creatureInfo && creatureInfo->isTameable(true)) { SendStableResult(STABLE_ERR_EXOTIC); } else { SendStableResult(STABLE_ERR_STABLE); } return; } Pet* pet = _player->GetPet(); if (pet && pet->IsAlive()) { SendStableResult(STABLE_ERR_STABLE); return; } // delete dead pet if (pet) { pet->Unsummon(PET_SAVE_AS_DELETED, _player); } Pet* newpet = new Pet(HUNTER_PET); if (!newpet->LoadPetFromDB(_player, creature_id, petnumber)) { delete newpet; newpet = NULL; SendStableResult(STABLE_ERR_STABLE); return; } SendStableResult(<API key>); } void WorldSession::HandleBuyStableSlot(WorldPacket& recv_data) { DEBUG_LOG("WORLD: Recv <API key>."); ObjectGuid npcGUID; recv_data >> npcGUID; if (!CheckStableMaster(npcGUID)) { SendStableResult(STABLE_ERR_STABLE); return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } if (GetPlayer()->m_stableSlots < MAX_PET_STABLES) { <API key> const* SlotPrice = <API key>.LookupEntry(GetPlayer()->m_stableSlots + 1); if (_player->GetMoney() >= SlotPrice->Price) { ++GetPlayer()->m_stableSlots; _player->ModifyMoney(-int32(SlotPrice->Price)); SendStableResult(<API key>); } else { SendStableResult(STABLE_ERR_MONEY); } } else { SendStableResult(STABLE_ERR_STABLE); } } void WorldSession::<API key>(WorldPacket& /* recv_data */) { DEBUG_LOG("<API key>: Not implemented"); } void WorldSession::HandleStableSwapPet(WorldPacket& recv_data) { DEBUG_LOG("WORLD: Recv <API key>."); ObjectGuid npcGUID; uint32 pet_number; recv_data >> npcGUID >> pet_number; if (!CheckStableMaster(npcGUID)) { SendStableResult(STABLE_ERR_STABLE); return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } Pet* pet = _player->GetPet(); if (!pet || pet->getPetType() != HUNTER_PET) { SendStableResult(STABLE_ERR_STABLE); return; } // find swapped pet slot in stable QueryResult* result = CharacterDatabase.PQuery("SELECT `slot`,`entry` FROM `character_pet` WHERE `owner` = '%u' AND `id` = '%u'", _player->GetGUIDLow(), pet_number); if (!result) { SendStableResult(STABLE_ERR_STABLE); return; } Field* fields = result->Fetch(); uint32 slot = fields[0].GetUInt32(); uint32 creature_id = fields[1].GetUInt32(); delete result; if (!creature_id) { SendStableResult(STABLE_ERR_STABLE); return; } CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creature_id); if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets())) { // if problem in exotic pet if (creatureInfo && creatureInfo->isTameable(true)) { SendStableResult(STABLE_ERR_EXOTIC); } else { SendStableResult(STABLE_ERR_STABLE); } return; } // move alive pet to slot or delete dead pet pet->Unsummon(pet->IsAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED, _player); // summon unstabled pet Pet* newpet = new Pet; if (!newpet->LoadPetFromDB(_player, creature_id, pet_number)) { delete newpet; SendStableResult(STABLE_ERR_STABLE); } else { SendStableResult(<API key>); } } void WorldSession::<API key>(WorldPacket& recv_data) { DEBUG_LOG("WORLD: CMSG_REPAIR_ITEM"); ObjectGuid npcGuid; ObjectGuid itemGuid; uint8 guildBank; // new in 2.3.2, bool that means from guild bank money recv_data >> npcGuid >> itemGuid >> guildBank; Creature* unit = GetPlayer()-><API key>(npcGuid, <API key>); if (!unit) { DEBUG_LOG("WORLD: <API key> - %s not found or you can't interact with him.", npcGuid.GetString().c_str()); return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) { GetPlayer()-><API key>(<API key>); } // reputation discount float discountMod = _player-><API key>(unit); uint32 TotalCost = 0; if (itemGuid) { DEBUG_LOG("ITEM: %s repair of %s", npcGuid.GetString().c_str(), itemGuid.GetString().c_str()); Item* item = _player->GetItemByGuid(itemGuid); if (item) { TotalCost = _player->DurabilityRepair(item->GetPos(), true, discountMod, (guildBank > 0)); } } else { DEBUG_LOG("ITEM: %s repair all items", npcGuid.GetString().c_str()); TotalCost = _player->DurabilityRepairAll(true, discountMod, (guildBank > 0)); } if (guildBank) { uint32 GuildId = _player->GetGuildId(); if (!GuildId) { return; } Guild* pGuild = sGuildMgr.GetGuildById(GuildId); if (!pGuild) { return; } pGuild->LogBankEvent(<API key>, 0, _player->GetGUIDLow(), TotalCost); pGuild->SendMoneyInfo(this, _player->GetGUIDLow()); } }
<?php /* TwigBundle:Exception:exception_full.html.twig */ class <API key> extends Twig_Template { public function __construct(Twig_Environment $env) { parent::__construct($env); $this->parent = $this->env->loadTemplate("TwigBundle::layout.html.twig"); $this->blocks = array( 'head' => array($this, 'block_head'), 'title' => array($this, 'block_title'), 'body' => array($this, 'block_body'), ); } protected function doGetParent(array $context) { return "TwigBundle::layout.html.twig"; } protected function doDisplay(array $context, array $blocks = array()) { $this->parent->display($context, array_merge($this->blocks, $blocks)); } // line 3 public function block_head($context, array $blocks = array()) { // line 4 echo " <link href=\""; echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/framework/css/exception.css"), "html", null, true); echo "\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" /> "; } // line 7 public function block_title($context, array $blocks = array()) { // line 8 echo " "; echo twig_escape_filter($this->env, $this->getAttribute((isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")), "message"), "html", null, true); echo " ("; echo twig_escape_filter($this->env, (isset($context["status_code"]) ? $context["status_code"] : $this->getContext($context, "status_code")), "html", null, true); echo " "; echo twig_escape_filter($this->env, (isset($context["status_text"]) ? $context["status_text"] : $this->getContext($context, "status_text")), "html", null, true); echo ") "; } // line 11 public function block_body($context, array $blocks = array()) { // line 12 echo " "; $this->env->loadTemplate("TwigBundle:Exception:exception.html.twig")->display($context); } public function getTemplateName() { return "TwigBundle:Exception:exception_full.html.twig"; } public function isTraitable() { return false; } public function getDebugInfo() { return array ( 57 => 12, 54 => 11, 43 => 8, 40 => 7, 33 => 4, 30 => 3,); } }
local assets= { Asset("ANIM", "anim/gold_nugget.zip"), } local function shine(inst) inst.task = nil inst.AnimState:PlayAnimation("sparkle") inst.AnimState:PushAnimation("idle") inst.task = inst:DoTaskInTime(4+math.random()*5, function() shine(inst) end) end local function fn(Sim) local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddPhysics() <API key>(inst) inst.AnimState:<API key>( "shaders/anim.ksh" ) inst.AnimState:SetBank("goldnugget") inst.AnimState:SetBuild("gold_nugget") inst.AnimState:PlayAnimation("idle") inst:AddComponent("edible") inst.components.edible.foodtype = "ELEMENTAL" inst.components.edible.hungervalue = 2 inst:AddComponent("tradable") inst:AddComponent("inspectable") inst:AddComponent("stackable") inst:AddComponent("inventoryitem") inst:AddComponent("bait") inst:AddTag("molebait") shine(inst) return inst end return Prefab( "common/inventory/goldnugget", fn, assets)
module.exports = { dist: { options: { plugin_slug: 'simple-user-adding', svn_user: 'wearerequired', build_dir: 'release/svn/', assets_dir: 'assets/' } } };
#include <stdint.h> #include <device/pci_def.h> #include <device/pci_ids.h> #include <arch/io.h> #include <device/pnp_def.h> #include <console/console.h> #include <lib.h> #include <northbridge/via/cn700/raminit.h> #include <cpu/x86/bist.h> #include <delay.h> #include "southbridge/via/vt8237r/early_smbus.c" #include "southbridge/via/vt8237r/early_serial.c" #include <spd.h> static inline int spd_read_byte(unsigned device, unsigned address) { return smbus_read_byte(device, address); } #include "northbridge/via/cn700/raminit.c" static void <API key>(void) { device_t dev; dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA, <API key>), 0); if (dev == PCI_DEV_INVALID) die("Southbridge not found!!!\n"); /* bit=0 means enable function (per CX700 datasheet) * 5 16.1 USB 2 * 4 16.0 USB 1 * 3 15.0 SATA and PATA * 2 16.2 USB 3 * 1 16.4 USB EHCI */ pci_write_config8(dev, 0x50, 0x80); /* bit=1 means enable internal function (per CX700 datasheet) * 3 Internal RTC * 2 Internal PS2 Mouse * 1 Internal KBC Configuration * 0 Internal Keyboard Controller */ pci_write_config8(dev, 0x51, 0x1d); } static const struct mem_controller ctrl = { .d0f0 = 0x0000, .d0f2 = 0x2000, .d0f3 = 0x3000, .d0f4 = 0x4000, .d0f7 = 0x7000, .d1f0 = 0x8000, .channel0 = { DIMM0 }, }; #include <cpu/intel/romstage.h> void main(unsigned long bist) { /* Enable multifunction for northbridge. */ pci_write_config8(ctrl.d0f0, 0x4f, 0x01); <API key>(); console_init(); enable_smbus(); smbus_fixup(&ctrl); report_bist_failure(bist); <API key>(); ddr_ram_setup(&ctrl); }
<?php class ezxpdfpreview { function ezxpdfpreview() { $this->Operators = array( 'pdfpreview' ); } /*! \return an array with the template operator name. */ function operatorList() { return $this->Operators; } /*! \return true to tell the template engine that the parameter list exists per operator type, this is needed for operator classes that have multiple operators. */ function <API key>() { return true; } /*! See eZTemplateOperator::namedParameterList */ function namedParameterList() { return array( 'pdfpreview' => array( 'width' => array( 'type' => 'integer', 'required' => true ), 'height' => array( 'type' => 'integer', 'required' => true ), 'attribute_id' => array( 'type' => 'integer', 'required' => true), 'attribute_version' => array( 'type' => 'integer', 'required' => true), 'page' => array( 'type' => 'integer', 'required' => false, 'default' => 1) ) ); } /*! Executes the PHP function for the operator cleanup and modifies \a $operatorValue. */ function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters ) { $ini = eZINI::instance(); $contentId = $operatorValue; $width = (int)$namedParameters['width']; $height = (int)$namedParameters['height']; $container = ezpKernel::instance()->getServiceContainer(); $pdfPreview = $container->get( 'xrow_pdf_preview' ); $operatorValue = $pdfPreview->preview($contentId, $width, $height); } function previewRetrieve( $file, $mtime, $args ) { //do nothing } function previewGenerate( $file, $args ) { extract( $args ); $pdffile->fetch(true); $cmd = "convert " . eZSys::escapeShellArgument( $pdf_file_path . "[" . $page . "]" ) . " " . " -alpha remove -resize " . eZSys::escapeShellArgument( $width . "x" . $height ) . " " . eZSys::escapeShellArgument( $cacheImageFilePath ); $out = shell_exec( $cmd ); $fileHandler = <API key>::instance(); $fileHandler->fileStore( $cacheImageFilePath, 'pdfpreview', false ); eZDebug::writeDebug( $cmd, "pdfpreview" ); if ( $out ) { eZDebug::writeDebug( $out, "pdfpreview" ); } //return values for the storecache function return array( 'content' => $cacheImageFilePath, 'scope' => 'pdfpreview', 'store' => true ); } } ?>
return { amazons_woodcutter = {}, }
<?php namespace ErsBase\View\Helper; use Zend\View\Helper\AbstractHelper; #use Zend\View\HelperPluginManager as ServiceManager; use Zend\Session\Container; class Session extends AbstractHelper { #protected $serviceManager; /*public function __construct(ServiceManager $serviceManager) { $this->serviceManager = $serviceManager; }*/ public function __invoke() { $container = new Container('ers'); return $container; } }
package org.opennms.features.kafka.producer; import java.io.IOException; import java.time.Duration; import java.util.Collections; import java.util.Dictionary; import java.util.Enumeration; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Properties; import java.util.Set; import java.util.concurrent.BlockingDeque; import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.ThreadFactory; import java.util.function.Consumer; import com.google.common.util.concurrent.<API key>; import org.apache.kafka.clients.producer.KafkaProducer; import org.apache.kafka.clients.producer.ProducerRecord; import org.apache.kafka.clients.producer.RecordMetadata; import org.apache.kafka.common.errors.TimeoutException; import org.apache.kafka.common.serialization.ByteArraySerializer; import org.opennms.core.ipc.common.kafka.Utils; import org.opennms.features.kafka.producer.datasync.KafkaAlarmDataSync; import org.opennms.features.kafka.producer.model.OpennmsModelProtos; import org.opennms.features.situationfeedback.api.AlarmFeedback; import org.opennms.features.situationfeedback.api.<API key>; import org.opennms.netmgt.alarmd.api.<API key>; import org.opennms.netmgt.alarmd.api.<API key>; import org.opennms.netmgt.events.api.EventListener; import org.opennms.netmgt.events.api.<API key>; import org.opennms.netmgt.events.api.<API key>; import org.opennms.netmgt.events.api.model.IEvent; import org.opennms.netmgt.model.OnmsAlarm; import org.opennms.netmgt.topologies.service.api.<API key>; import org.opennms.netmgt.topologies.service.api.OnmsTopologyDao; import org.opennms.netmgt.topologies.service.api.OnmsTopologyEdge; import org.opennms.netmgt.topologies.service.api.OnmsTopologyMessage; import org.opennms.netmgt.topologies.service.api.OnmsTopologyMessage.<API key>; import org.opennms.netmgt.topologies.service.api.<API key>; import org.opennms.netmgt.topologies.service.api.OnmsTopologyVertex; import org.opennms.netmgt.topologies.service.api.TopologyVisitor; import org.opennms.netmgt.xml.event.Event; import org.osgi.service.cm.ConfigurationAdmin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.expression.Expression; import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.<API key>; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.swrve.ratelimitedlogger.RateLimitedLog; public class <API key> implements <API key>, EventListener, <API key>, <API key>, <API key> { private static final Logger LOG = LoggerFactory.getLogger(<API key>.class); private static final RateLimitedLog RATE_LIMITED_LOGGER = RateLimitedLog .withRateLimit(LOG) .maxRate(5).every(Duration.ofSeconds(30)) .build(); public static final String KAFKA_CLIENT_PID = "org.opennms.features.kafka.producer.client"; private static final ExpressionParser SPEL_PARSER = new <API key>(); private final ThreadFactory <API key> = new <API key>() .setNameFormat("<API key>-%d") .build(); private final ProtobufMapper protobufMapper; private final NodeCache nodeCache; private final ConfigurationAdmin configAdmin; private final <API key> <API key>; private KafkaAlarmDataSync dataSync; private String eventTopic; private String alarmTopic; private String nodeTopic; private String alarmFeedbackTopic; private String topologyVertexTopic; private String topologyEdgeTopic; private boolean forwardEvents; private boolean forwardAlarms; private boolean <API key>; private boolean <API key>; private boolean forwardNodes; private Expression <API key>; private Expression <API key>; private final CountDownLatch forwardedEvent = new CountDownLatch(1); private final CountDownLatch forwardedAlarm = new CountDownLatch(1); private final CountDownLatch forwardedNode = new CountDownLatch(1); private final CountDownLatch <API key> = new CountDownLatch(1); private final CountDownLatch <API key> = new CountDownLatch(1); private final CountDownLatch <API key> = new CountDownLatch(1); private KafkaProducer<byte[], byte[]> producer; private final Map<String, OpennmsModelProtos.Alarm> outstandingAlarms = new ConcurrentHashMap<>(); private final <API key> <API key> = <API key>.with(<API key>.Exclusions::defaultExclusions); private final <API key> stateTracker = new <API key>(); private final OnmsTopologyDao topologyDao; private int <API key>; private BlockingDeque<KafkaRecord> kafkaSendDeque; private final ExecutorService <API key> = Executors.<API key>(runnable -> new Thread(runnable, "<API key>")); private final ExecutorService nodeUpdateExecutor; private String encoding = "UTF8"; private int <API key> = 4; public <API key>(ProtobufMapper protobufMapper, NodeCache nodeCache, ConfigurationAdmin configAdmin, <API key> <API key>, OnmsTopologyDao topologyDao, int <API key>) { this.protobufMapper = Objects.requireNonNull(protobufMapper); this.nodeCache = Objects.requireNonNull(nodeCache); this.configAdmin = Objects.requireNonNull(configAdmin); this.<API key> = Objects.requireNonNull(<API key>); this.topologyDao = Objects.requireNonNull(topologyDao); this.nodeUpdateExecutor = Executors.newFixedThreadPool(<API key>, <API key>); } public void init() throws IOException { // Create the Kafka producer final Properties producerConfig = new Properties(); final Dictionary<String, Object> properties = configAdmin.getConfiguration(KAFKA_CLIENT_PID).getProperties(); if (properties != null) { final Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { final String key = keys.nextElement(); producerConfig.put(key, properties.get(key)); } } // Overwrite the serializers, since we rely on these producerConfig.put("key.serializer", ByteArraySerializer.class.getCanonicalName()); producerConfig.put("value.serializer", ByteArraySerializer.class.getCanonicalName()); // Class-loader hack for accessing the kafka classes when initializing producer. producer = Utils.<API key>(() -> new KafkaProducer<>(producerConfig), KafkaProducer.class.getClassLoader()); // Start processing records that have been queued for sending if (<API key> <= 0) { <API key> = 1000; LOG.info("Defaulted the '<API key>' to 1000 since no property was set"); } kafkaSendDeque = new LinkedBlockingDeque<>(<API key>); <API key>.execute(this::<API key>); if (forwardEvents) { <API key>.addEventListener(this); } topologyDao.subscribe(this); } public void destroy() { <API key>.shutdownNow(); nodeUpdateExecutor.shutdownNow(); if (producer != null) { producer.close(); producer = null; } if (forwardEvents) { <API key>.removeEventListener(this); } topologyDao.unsubscribe(this); } private void <API key>(OnmsTopologyMessage message) { if (message.getProtocol() == null) { LOG.error("<API key>: null protocol"); return; } if (message.getMessagestatus() == null) { LOG.error("<API key>: null status"); return; } if (message.getMessagebody() == null) { LOG.error("<API key>: null message"); return; } if (message.getMessagestatus() == <API key>.DELETE) { message.getMessagebody().accept(new DeletingVisitor(message)); } else { message.getMessagebody().accept(new UpdatingVisitor(message)); } } private void <API key>(byte[] refid, byte[] message) { sendRecord(() -> { return new ProducerRecord<>(topologyEdgeTopic, refid, message); }, recordMetadata -> { // We've got an ACK from the server that the event was forwarded // Let other threads know when we've successfully forwarded an event <API key>.countDown(); }); } private void forwardEvent(Event event) { boolean shouldForwardEvent = true; // Filtering if (<API key> != null) { try { shouldForwardEvent = <API key>.getValue(event, Boolean.class); } catch (Exception e) { LOG.error("Event filter '{}' failed to return a result for event: {}. The event will be forwarded anyways.", <API key>.getExpressionString(), event.toStringSimple(), e); } } if (!shouldForwardEvent) { if (LOG.isTraceEnabled()) { LOG.trace("Event {} not forwarded due to event filter: {}", event.toStringSimple(), <API key>.getExpressionString()); } return; } // Node handling if (forwardNodes && event.getNodeid() != null && event.getNodeid() != 0) { <API key>(event.getNodeid()); } // Forward! sendRecord(() -> { final OpennmsModelProtos.Event mappedEvent = protobufMapper.toEvent(event).build(); LOG.debug("Sending event with UEI: {}", mappedEvent.getUei()); return new ProducerRecord<>(eventTopic, mappedEvent.toByteArray()); }, recordMetadata -> { // We've got an ACK from the server that the event was forwarded // Let other threads know when we've successfully forwarded an event forwardedEvent.countDown(); }); } public boolean shouldForwardAlarm(OnmsAlarm alarm) { if (<API key> != null) { // The expression is not necessarily thread safe synchronized (this) { try { final boolean shouldForwardAlarm = <API key>.getValue(alarm, Boolean.class); if (LOG.isTraceEnabled()) { LOG.trace("Alarm {} not forwarded due to event filter: {}", alarm, <API key>.getExpressionString()); } return shouldForwardAlarm; } catch (Exception e) { LOG.error("Alarm filter '{}' failed to return a result for event: {}. The alarm will be forwarded anyways.", <API key>.getExpressionString(), alarm, e); } } } return true; } private boolean isIncrementalAlarm(String reductionKey, OnmsAlarm alarm) { OpennmsModelProtos.Alarm existingAlarm = outstandingAlarms.get(reductionKey); return existingAlarm != null && <API key>.<API key>(protobufMapper.toAlarm(alarm), existingAlarm); } private void <API key>(String reductionKey, OnmsAlarm alarm) { // Apply the excluded fields when putting to the map so we do not have to perform this calculation // on each equality check outstandingAlarms.put(reductionKey, <API key>.Exclusions.defaultExclusions(protobufMapper.toAlarm(alarm)).build()); } private void updateAlarm(String reductionKey, OnmsAlarm alarm) { // Always push null records, no good way to perform filtering on these if (alarm == null) { // The alarm has been deleted so we shouldn't track it in the map of outstanding alarms any longer outstandingAlarms.remove(reductionKey); // The alarm was deleted, push a null record to the reduction key sendRecord(() -> { LOG.debug("Deleting alarm with reduction key: {}", reductionKey); return new ProducerRecord<>(alarmTopic, reductionKey.getBytes(encoding), null); }, recordMetadata -> { // We've got an ACK from the server that the alarm was forwarded // Let other threads know when we've successfully forwarded an alarm forwardedAlarm.countDown(); }); return; } // Filtering if (!shouldForwardAlarm(alarm)) { return; } if (<API key> && isIncrementalAlarm(reductionKey, alarm)) { return; } // Node handling if (forwardNodes && alarm.getNodeId() != null) { <API key>(alarm.getNodeId()); } // Forward! sendRecord(() -> { final OpennmsModelProtos.Alarm mappedAlarm = protobufMapper.toAlarm(alarm).build(); LOG.debug("Sending alarm with reduction key: {}", reductionKey); if (<API key>) { <API key>(reductionKey, alarm); } return new ProducerRecord<>(alarmTopic, reductionKey.getBytes(encoding), mappedAlarm.toByteArray()); }, recordMetadata -> { // We've got an ACK from the server that the alarm was forwarded // Let other threads know when we've successfully forwarded an alarm forwardedAlarm.countDown(); }); } private void <API key>(long nodeId) { // Updating node asynchronously will unblock event consumption. nodeUpdateExecutor.execute(() -> { maybeUpdateNode(nodeId); }); } private void maybeUpdateNode(long nodeId) { nodeCache.triggerIfNeeded(nodeId, (node) -> { final String nodeCriteria; if (node != null && node.getForeignSource() != null && node.getForeignId() != null) { nodeCriteria = String.format("%s:%s", node.getForeignSource(), node.getForeignId()); } else { nodeCriteria = Long.toString(nodeId); } if (node == null) { // The node was deleted, push a null record sendRecord(() -> { LOG.debug("Deleting node with criteria: {}", nodeCriteria); return new ProducerRecord<>(nodeTopic, nodeCriteria.getBytes(encoding), null); }); return; } sendRecord(() -> { final OpennmsModelProtos.Node mappedNode = protobufMapper.toNode(node).build(); LOG.debug("Sending node with criteria: {}", nodeCriteria); return new ProducerRecord<>(nodeTopic, nodeCriteria.getBytes(encoding), mappedNode.toByteArray()); }, recordMetadata -> { // We've got an ACK from the server that the node was forwarded // Let other threads know when we've successfully forwarded a node forwardedNode.countDown(); }); }); } private void sendRecord(Callable<ProducerRecord<byte[], byte[]>> callable) { sendRecord(callable, null); } private void sendRecord(Callable<ProducerRecord<byte[], byte[]>> callable, Consumer<RecordMetadata> callback) { if (producer == null) { return; } final ProducerRecord<byte[], byte[]> record; try { record = callable.call(); } catch (Exception e) { // Propagate throw new RuntimeException(e); } // Rather than attempt to send, we instead queue the record to avoid blocking since KafkaProducer's send() // method can block if Kafka is not available when metadata is attempted to be retrieved // Any offer that fails due to capacity overflow will simply be dropped and will have to wait until the next // sync to be processed so this is just a best effort attempt if (!kafkaSendDeque.offer(new KafkaRecord(record, callback))) { RATE_LIMITED_LOGGER.warn("Dropped a Kafka record due to queue capacity being full."); } } private void <API key>() { //noinspection <API key> while (true) { try { KafkaRecord kafkaRecord = kafkaSendDeque.take(); ProducerRecord<byte[], byte[]> producerRecord = kafkaRecord.getProducerRecord(); Consumer<RecordMetadata> consumer = kafkaRecord.getConsumer(); try { producer.send(producerRecord, (recordMetadata, e) -> { if (e != null) { LOG.warn("Failed to send record to producer: {}.", producerRecord, e); if (e instanceof TimeoutException) { // If Kafka is Offline, buffer the record again for events. // This is best effort to keep the order although in-flight elements may still miss the order. if (producerRecord != null && this.eventTopic.equalsIgnoreCase(producerRecord.topic())) { if(!kafkaSendDeque.offerFirst(kafkaRecord)) { RATE_LIMITED_LOGGER.warn("Dropped a Kafka record due to queue capacity being full."); } } } return; } if (consumer != null) { consumer.accept(recordMetadata); } }); } catch (RuntimeException e) { LOG.warn("Failed to send record to producer: {}.", producerRecord, e); } } catch (<API key> ignore) { break; } } } @Override public void handleAlarmSnapshot(List<OnmsAlarm> alarms) { if (!forwardAlarms || dataSync == null) { // Ignore return; } dataSync.handleAlarmSnapshot(alarms); } @Override public void <API key>() { stateTracker.startTrackingAlarms(); } @Override public void <API key>() { stateTracker.<API key>(); } @Override public void <API key>(OnmsAlarm alarm) { if (!forwardAlarms) { // Ignore return; } updateAlarm(alarm.getReductionKey(), alarm); stateTracker.<API key>(alarm.getId(), alarm.getReductionKey()); } @Override public void handleDeletedAlarm(int alarmId, String reductionKey) { if (!forwardAlarms) { // Ignore return; } handleDeletedAlarm(reductionKey); stateTracker.trackDeletedAlarm(alarmId, reductionKey); } private void handleDeletedAlarm(String reductionKey) { updateAlarm(reductionKey, null); } @Override public String getName() { return <API key>.class.getName(); } @Override public void onEvent(IEvent event) { forwardEvent(Event.copyFrom(event)); } @Override public Set<<API key>> getProtocols() { return Collections.singleton(<API key>.allProtocols()); } @Override public void consume(OnmsTopologyMessage message) { <API key>(message); } public void <API key>(String topologyVertexTopic) { this.topologyVertexTopic = topologyVertexTopic; } public void <API key>(String topologyEdgeTopic) { this.topologyEdgeTopic = topologyEdgeTopic; } public void setEventTopic(String eventTopic) { this.eventTopic = eventTopic; forwardEvents = !Strings.isNullOrEmpty(eventTopic); } public void setAlarmTopic(String alarmTopic) { this.alarmTopic = alarmTopic; forwardAlarms = !Strings.isNullOrEmpty(alarmTopic); } public void setNodeTopic(String nodeTopic) { this.nodeTopic = nodeTopic; forwardNodes = !Strings.isNullOrEmpty(nodeTopic); } public void <API key>(String alarmFeedbackTopic) { this.alarmFeedbackTopic = alarmFeedbackTopic; <API key> = !Strings.isNullOrEmpty(alarmFeedbackTopic); } public void setEventFilter(String eventFilter) { if (Strings.isNullOrEmpty(eventFilter)) { <API key> = null; } else { <API key> = SPEL_PARSER.parseExpression(eventFilter); } } public void setAlarmFilter(String alarmFilter) { if (Strings.isNullOrEmpty(alarmFilter)) { <API key> = null; } else { <API key> = SPEL_PARSER.parseExpression(alarmFilter); } } public <API key> setDataSync(KafkaAlarmDataSync dataSync) { this.dataSync = dataSync; return this; } @Override public void handleAlarmFeedback(List<AlarmFeedback> alarmFeedback) { if (!<API key>) { return; } // NOTE: This will currently block while waiting for Kafka metadata if Kafka is not available. alarmFeedback.forEach(feedback -> sendRecord(() -> { LOG.debug("Sending alarm feedback with key: {}", feedback.getAlarmKey()); return new ProducerRecord<>(alarmFeedbackTopic, feedback.getAlarmKey().getBytes(encoding), protobufMapper.toAlarmFeedback(feedback).build().toByteArray()); }, recordMetadata -> { // We've got an ACK from the server that the alarm feedback was forwarded // Let other threads know when we've successfully forwarded an alarm feedback <API key>.countDown(); })); } public boolean isForwardingAlarms() { return forwardAlarms; } public CountDownLatch <API key>() { return forwardedEvent; } public CountDownLatch <API key>() { return forwardedAlarm; } public CountDownLatch <API key>() { return forwardedNode; } public CountDownLatch <API key>() { return <API key>; } public void <API key>(boolean <API key>) { this.<API key> = <API key>; } @VisibleForTesting KafkaAlarmDataSync getDataSync() { return dataSync; } public <API key> <API key>() { return stateTracker; } public void <API key>(int <API key>) { this.<API key> = <API key>; } @Override public int getNumThreads() { return <API key>; } private static final class KafkaRecord { private final ProducerRecord<byte[], byte[]> producerRecord; private final Consumer<RecordMetadata> consumer; KafkaRecord(ProducerRecord<byte[], byte[]> producerRecord, Consumer<RecordMetadata> consumer) { this.producerRecord = producerRecord; this.consumer = consumer; } ProducerRecord<byte[], byte[]> getProducerRecord() { return producerRecord; } Consumer<RecordMetadata> getConsumer() { return consumer; } } public CountDownLatch <API key>() { return <API key>; } public CountDownLatch <API key>() { return <API key>; } public String getEncoding() { return encoding; } public void setEncoding(String encoding) { this.encoding = encoding; } public int <API key>() { return <API key>; } public void <API key>(int <API key>) { this.<API key> = <API key>; } private class TopologyVisitorImpl implements TopologyVisitor { final OnmsTopologyMessage onmsTopologyMessage; TopologyVisitorImpl(OnmsTopologyMessage onmsTopologyMessage) { this.onmsTopologyMessage = Objects.requireNonNull(onmsTopologyMessage); } byte[] getKeyForEdge(OnmsTopologyEdge edge) { Objects.requireNonNull(onmsTopologyMessage); return String.format("topology:%s:%s", onmsTopologyMessage.getProtocol().getId(), edge.getId()).getBytes(); } } private class DeletingVisitor extends TopologyVisitorImpl { DeletingVisitor(OnmsTopologyMessage topologyMessage) { super(topologyMessage); } @Override public void visit(OnmsTopologyEdge edge) { <API key>(getKeyForEdge(edge), null); } } private class UpdatingVisitor extends TopologyVisitorImpl { UpdatingVisitor(OnmsTopologyMessage onmsTopologyMessage) { super(onmsTopologyMessage); } @Override public void visit(OnmsTopologyVertex vertex) { // Node handling if (forwardNodes && vertex.getNodeid() != null) { <API key>(vertex.getNodeid()); } } @Override public void visit(OnmsTopologyEdge edge) { Objects.requireNonNull(onmsTopologyMessage); final OpennmsModelProtos.TopologyEdge mappedTopoMsg = protobufMapper.<API key>(onmsTopologyMessage.getProtocol(), edge); <API key>(getKeyForEdge(edge), mappedTopoMsg.toByteArray()); } } }
#ifndef GTR_UTIL_H #define GTR_UTIL_H #include <sys/types.h> #include <glib.h> #include <gtk/gtk.h> #include <libtransmission/transmission.h> extern const int mem_K; extern const char * mem_K_str; extern const char * mem_M_str; extern const char * mem_G_str; extern const char * mem_T_str; extern const int disk_K; extern const char * disk_K_str; extern const char * disk_M_str; extern const char * disk_G_str; extern const char * disk_T_str; extern const int speed_K; extern const char * speed_K_str; extern const char * speed_M_str; extern const char * speed_G_str; extern const char * speed_T_str; /* macro to shut up "unused parameter" warnings */ #ifndef UNUSED #define UNUSED G_GNUC_UNUSED #endif enum { GTR_UNICODE_UP, GTR_UNICODE_DOWN, GTR_UNICODE_INF, GTR_UNICODE_BULLET }; const char * <API key> (int); /* return a percent formatted string of either x.xx, xx.x or xxx */ char* tr_strlpercent (char * buf, double x, size_t buflen); /* return a human-readable string for the size given in bytes. */ char* tr_strlsize (char * buf, guint64 size, size_t buflen); /* return a human-readable string for the given ratio. */ char* tr_strlratio (char * buf, double ratio, size_t buflen); /* return a human-readable string for the time given in seconds. */ char* tr_strltime (char * buf, int secs, size_t buflen); void <API key> (char * buf, size_t buflen, const char * url); gboolean gtr_is_magnet_link (const char * str); gboolean gtr_is_hex_hashcode (const char * str); void gtr_open_uri (const char * uri); void gtr_open_file (const char * path); const char* gtr_get_help_uri (void); /* <API key> wrapper around <API key> () */ void <API key> (GtkWidget *, gboolean); void <API key> (GtkDialog * dialog, GtkWidget * content); GtkWidget * <API key> (void); #define <API key>(w) <API key> (w) #define <API key>(w,val) <API key> (w,val) GtkWidget * <API key> (const char * text_1, ...); int <API key> (GtkComboBox *); void <API key> (GtkComboBox *, int value); void <API key> (GtkWidget * parent, const char * url); void <API key> (GtkWidget * parent, const char * url, long response_code); void <API key> (GtkWidget * window_or_child, int err, const char * filename); /* pop up the context menu if a user right-clicks. if the row they right-click on isn't selected, select it. */ gboolean <API key> (GtkWidget * view, GdkEventButton * event, gpointer unused); /* if the click didn't specify a row, clear the selection */ gboolean <API key> (GtkWidget * view, GdkEventButton * event, gpointer unused); /* move a file to the trashcan if GIO is available; otherwise, delete it */ int <API key> (const char * filename); void <API key> (GtkWidget * entry); /* Only call gtk_label_set_text () if the new text differs from the old. * This prevents the label from having to recalculate its size * and prevents selected text in the label from being deselected */ void gtr_label_set_text (GtkLabel * lb, const char * text); #endif /* GTR_UTIL_H */
/** * The routes worker process * * This worker process gets the app routes by running the application dynamically * on the server, then stores the publicly exposed routes in an intermediate format * (just the url paths) in Redis. * From there, the paths are used by the live app for serving /sitemap.xml and /robots.txt requests. * The paths are also used by downstream worker processes (snapshots) to produce the site's html snapshots * for _escaped_fragment_ requests. * * Run this worker anytime the app menu has changed and needs to be refreshed. * * PATH and NODE_ENV have to set in the environment before running this. * PATH has to include phantomjs bin */ var phantom = require("node-phantom"); var urlm = require("url"); var redis = require("../../../helpers/redis"); var configLib = require("../../../config"); var config = configLib.create(); // Write the appRoutes to Redis function writeAppRoutes(appRoutes) { // remove pattern routes, and prepend / appRoutes = appRoutes.filter(function(appRoute) { return !/[*\(\:]/.test(appRoute); }).map(function(appRoute) { return "/"+appRoute; }); if (appRoutes.length > 0) { var redisClient = redis.client(); redisClient.set(config.keys.routes, appRoutes, function(err) { if (err) { console.error("failed to store the routes for "+config.keys.routes); } else { console.log("successfully stored "+appRoutes.length+" routes in "+config.keys.routes); } redisClient.quit(); }); } else { console.error("no routes found for "+config.app.hostname); } } // Start up phantom, wait for the page, get the appRoutes function routes(urlPath, timeout) { var url = urlm.format({ protocol: "http", hostname: config.app.hostname, port: config.app.port || 80, pathname: urlPath }); phantom.create(function(err, ph) { return ph.createPage(function(err, page) { return page.open(url, function(err, status) { if (status !== "success") { console.error("Unable to load page " + url); ph.exit(); } else { setTimeout(function() { return page.evaluate(function() { return window.wpspa.appRoutes; }, function(err, result) { if (err) { console.error("failed to get appRoutes"); } else { writeAppRoutes(Object.keys(result)); } ph.exit(); }); }, timeout); } }); }); }); } module.exports = { routes: routes };
package net.sourceforge.vulcan.subversion; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Map; import net.sourceforge.vulcan.RepositoryAdaptor; import net.sourceforge.vulcan.StateManager; import net.sourceforge.vulcan.core.BuildDetailCallback; import net.sourceforge.vulcan.core.support.FileSystem; import net.sourceforge.vulcan.core.support.FileSystemImpl; import net.sourceforge.vulcan.core.support.RepositoryUtils; import net.sourceforge.vulcan.dto.ChangeLogDto; import net.sourceforge.vulcan.dto.ChangeSetDto; import net.sourceforge.vulcan.dto.PathModification; import net.sourceforge.vulcan.dto.ProjectConfigDto; import net.sourceforge.vulcan.dto.ProjectStatusDto; import net.sourceforge.vulcan.dto.RepositoryTagDto; import net.sourceforge.vulcan.dto.RevisionTokenDto; import net.sourceforge.vulcan.exception.ConfigException; import net.sourceforge.vulcan.exception.RepositoryException; import net.sourceforge.vulcan.integration.support.PluginSupport; import net.sourceforge.vulcan.subversion.dto.CheckoutDepth; import net.sourceforge.vulcan.subversion.dto.SparseCheckoutDto; import net.sourceforge.vulcan.subversion.dto.SubversionConfigDto; import net.sourceforge.vulcan.subversion.dto.<API key>; import net.sourceforge.vulcan.subversion.dto.<API key>; import org.apache.commons.lang.StringUtils; import org.tigris.subversion.javahl.ClientException; import org.tigris.subversion.javahl.Notify2; import org.tigris.subversion.javahl.NotifyAction; import org.tigris.subversion.javahl.NotifyInformation; import org.tigris.subversion.javahl.PromptUserPassword2; import org.tigris.subversion.javahl.PromptUserPassword3; import org.tigris.subversion.javahl.Revision; import org.tigris.subversion.javahl.SVNClient; import org.tmatesoft.svn.core.ISVNLogEntryHandler; import org.tmatesoft.svn.core.SVNCancelException; import org.tmatesoft.svn.core.SVNDepth; import org.tmatesoft.svn.core.SVNDirEntry; import org.tmatesoft.svn.core.SVNErrorCode; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNLogEntry; import org.tmatesoft.svn.core.SVNLogEntryPath; import org.tmatesoft.svn.core.SVNNodeKind; import org.tmatesoft.svn.core.SVNProperties; import org.tmatesoft.svn.core.SVNPropertyValue; import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.io.SVNRepository; import org.tmatesoft.svn.core.wc.ISVNEventHandler; import org.tmatesoft.svn.core.wc.SVNDiffClient; import org.tmatesoft.svn.core.wc.SVNEvent; import org.tmatesoft.svn.core.wc.SVNLogClient; import org.tmatesoft.svn.core.wc.SVNPropertyData; import org.tmatesoft.svn.core.wc.SVNRevision; import org.tmatesoft.svn.core.wc.SVNWCClient; public class <API key> extends SubversionSupport implements RepositoryAdaptor { private final EventHandler eventHandler = new EventHandler(); private final ProjectConfigDto projectConfig; private final String projectName; private final Map<String, Long> byteCounters; final LineOfDevelopment lineOfDevelopment = new LineOfDevelopment(); final SVNClient client = new SVNClient(); private long revision = -1; private long diffStartRevision = -1; private final StateManager stateManager; private FileSystem fileSystem = new FileSystemImpl(); private List<ChangeSetDto> changeSets; boolean canceling = false; public <API key>(SubversionConfigDto globalConfig, ProjectConfigDto projectConfig, <API key> config, StateManager stateManager) throws ConfigException { this(globalConfig, projectConfig, config, stateManager, true); } protected <API key>(SubversionConfigDto globalConfig, ProjectConfigDto projectConfig, <API key> config, StateManager stateManager, boolean init) throws ConfigException { this( globalConfig, projectConfig, config, stateManager, init, <API key>( globalConfig.getProfiles(), config.<API key>(), "svn.profile.missing")); } protected <API key>(SubversionConfigDto globalConfig, ProjectConfigDto projectConfig, <API key> config, StateManager stateManager, boolean init, <API key> profile) throws ConfigException { this( globalConfig, projectConfig, config, stateManager, profile, createRepository(profile, init)); } protected <API key>(SubversionConfigDto globalConfig, ProjectConfigDto projectConfig, <API key> config, StateManager stateManager, final <API key> profile, SVNRepository svnRepository) throws ConfigException { super(config, profile, svnRepository); this.stateManager = stateManager; this.projectConfig = projectConfig; this.projectName = projectConfig.getName(); if (globalConfig != null) { this.byteCounters = globalConfig.<API key>(); } else { this.byteCounters = Collections.emptyMap(); } lineOfDevelopment.setPath(config.getPath()); lineOfDevelopment.setRepositoryRoot(profile.getRootUrl()); lineOfDevelopment.setTagFolderNames(new HashSet<String>(Arrays.asList(globalConfig.getTagFolderNames()))); client.notification2(eventHandler); if (StringUtils.isNotBlank(profile.getUsername())) { client.setPrompt(new PromptUserPassword3() { public String getUsername() { return profile.getUsername(); } public String getPassword() { return profile.getPassword(); } public boolean prompt(String arg0, String arg1) { return true; } public boolean prompt(String arg0, String arg1, boolean arg2) { return true; } public boolean userAllowedSave() { return false; } public int askTrustSSLServer(String arg0, boolean arg1) { return PromptUserPassword2.AcceptTemporary; } public String askQuestion(String arg0, String arg1, boolean arg2, boolean arg3) { throw new <API key>(); } public String askQuestion(String arg0, String arg1, boolean arg2) { throw new <API key>(); } public boolean askYesNo(String arg0, String arg1, boolean arg2) { throw new <API key>(); } }); } } public boolean hasIncomingChanges(ProjectStatusDto previousStatus) throws RepositoryException { RevisionTokenDto rev = previousStatus.getRevision(); if (rev == null) { rev = previousStatus.<API key>(); } if (rev == null) { return true; } return getLatestRevision(rev).getRevisionNum() > rev.getRevisionNum(); } public void prepareRepository(BuildDetailCallback buildDetailCallback) throws RepositoryException, <API key> { } public RevisionTokenDto getLatestRevision(RevisionTokenDto previousRevision) throws RepositoryException { final String path = lineOfDevelopment.<API key>(); SVNDirEntry info; try { info = svnRepository.info(path, revision); } catch (SVNException e) { throw new RepositoryException(e); } if (info == null) { throw new RepositoryException("svn.path.not.exist", null, path); } final long lastChangedRevision = info.getRevision(); final long <API key> = <API key>(lastChangedRevision); revision = <API key>; if (config.getCheckoutDepth() == CheckoutDepth.Infinity || previousRevision == null) { return new RevisionTokenDto(revision, "r" + revision); } try { getChangeLog(previousRevision, new RevisionTokenDto(revision), null); if (changeSets.size() > 0) { String label = changeSets.get(changeSets.size()-1).getRevisionLabel(); revision = Long.valueOf(label.substring(1)); } else { // No commit logs matched means we're effectively at the old revision. // Need to check if the old revision exists on this path in case we're building // from a different branch/tag. try { info = svnRepository.info(path, previousRevision.getRevisionNum()); } catch (SVNException e) { throw new RepositoryException(e); } if (info != null) { revision = previousRevision.getRevisionNum(); } else { // Path doesn't exist at that revision. Use most recent commit // even though it didn't match our sparse working copy. revision = <API key>; } } } catch (RepositoryException e) { // Probably the path does not exist at the previousRevision. revision = <API key>; changeSets = null; } return new RevisionTokenDto(revision, "r" + revision); } public void <API key>(BuildDetailCallback buildDetailCallback) throws RepositoryException { final File absolutePath = new File(projectConfig.getWorkDir()).getAbsoluteFile(); new RepositoryUtils(fileSystem).<API key>(absolutePath, buildDetailCallback); synchronized (byteCounters) { if (byteCounters.containsKey(projectName)) { eventHandler.<API key>(byteCounters.get(projectName).longValue()); } } eventHandler.<API key>(buildDetailCallback); final Revision svnRev = Revision.getInstance(revision); final boolean ignoreExternals = false; final boolean <API key> = false; try { client.checkout( getCompleteSVNURL().toString(), absolutePath.toString(), svnRev, svnRev, config.getCheckoutDepth().getId(), ignoreExternals, <API key> ); <API key>(absolutePath); } catch (ClientException e) { if (!canceling) { throw new RepositoryException(e); } } catch (SVNException e) { throw new RepositoryException(e); } final boolean depthIsSticky = true; for (SparseCheckoutDto folder : config.getFolders()) { sparseUpdate(folder, absolutePath, svnRev, ignoreExternals, <API key>, depthIsSticky); } synchronized (byteCounters) { byteCounters.put(projectName, eventHandler.getFileCount()); } } void sparseUpdate(SparseCheckoutDto folder, File workingCopyRootPath, final Revision svnRev, final boolean ignoreExternals, final boolean <API key>, final boolean depthIsSticky) throws RepositoryException { final File dir = new File(workingCopyRootPath, folder.getDirectoryName()); final File parentDir = dir.getParentFile(); if (!parentDir.exists()) { final SparseCheckoutDto parentFolder = new SparseCheckoutDto(); parentFolder.setDirectoryName(new File(folder.getDirectoryName()).getParent()); parentFolder.setCheckoutDepth(CheckoutDepth.Empty); sparseUpdate(parentFolder, workingCopyRootPath, svnRev, ignoreExternals, <API key>, depthIsSticky); } final String path = dir.toString(); try { client.update(path, svnRev, folder.getCheckoutDepth().getId(), depthIsSticky, ignoreExternals, <API key>); } catch (ClientException e) { if (!canceling) { throw new RepositoryException("svn.sparse.checkout.error", e, folder.getDirectoryName()); } } } public void updateWorkingCopy(BuildDetailCallback buildDetailCallback) throws RepositoryException { final File absolutePath = new File(projectConfig.getWorkDir()).getAbsoluteFile(); try { final Revision svnRev = Revision.getInstance(revision); final boolean depthIsSticky = false; final boolean ignoreExternals = false; final boolean <API key> = false; client.update(absolutePath.toString(), svnRev, SVNDepth.UNKNOWN.getId(), depthIsSticky, ignoreExternals, <API key>); } catch (ClientException e) { if (!canceling) { throw new RepositoryException(e); } throw new RepositoryException(e); } } public boolean isWorkingCopy() { try { if (client.info(new File(projectConfig.getWorkDir()).getAbsolutePath()) != null) { return true; } } catch (ClientException ignore) { } return false; } public ChangeLogDto getChangeLog(RevisionTokenDto first, RevisionTokenDto last, OutputStream diffOutputStream) throws RepositoryException { final SVNRevision r1 = SVNRevision.create(first.getRevisionNum().longValue()); final SVNRevision r2 = SVNRevision.create(last.getRevisionNum().longValue()); if (changeSets == null) { changeSets = fetchChangeSets(r1, r2); if (this.config.getCheckoutDepth() != CheckoutDepth.Infinity) { final <API key> filter = new <API key>(this.config, this.lineOfDevelopment); filter.<API key>(changeSets); } } if (diffOutputStream != null) { fetchDifferences(SVNRevision.create(diffStartRevision), r2, diffOutputStream); } final ChangeLogDto changeLog = new ChangeLogDto(); changeLog.setChangeSets(changeSets); return changeLog; } @SuppressWarnings("unchecked") public List<RepositoryTagDto> <API key>() throws RepositoryException { final String projectRoot = lineOfDevelopment.getComputedTagRoot(); final List<RepositoryTagDto> tags = new ArrayList<RepositoryTagDto>(); final RepositoryTagDto trunkTag = new RepositoryTagDto(); trunkTag.setDescription("trunk"); trunkTag.setName("trunk"); tags.add(trunkTag); try { final Collection<SVNDirEntry> entries = svnRepository.getDir(projectRoot, -1, null, (Collection<?>) null); for (SVNDirEntry entry : entries) { final String folderName = entry.getName(); if (entry.getKind() == SVNNodeKind.DIR && lineOfDevelopment.isTag(folderName)) { addTags(projectRoot, folderName, tags); } } } catch (SVNException e) { throw new RepositoryException(e); } Collections.sort(tags, new Comparator<RepositoryTagDto>() { public int compare(RepositoryTagDto t1, RepositoryTagDto t2) { return t1.getName().compareTo(t2.getName()); } }); return tags; } public String getRepositoryUrl() { try { return getCompleteSVNURL().toString(); } catch (SVNException e) { throw new RuntimeException(e); } } public String getTagOrBranch() { return lineOfDevelopment.getComputedTagName(); } public void setTagOrBranch(String tagName) { lineOfDevelopment.setAlternateTagName(tagName); } protected long <API key>(final long lastChangedRevision) throws RepositoryException { final long[] commitRev = new long[1]; commitRev[0] = -1; final SVNLogClient logClient = new SVNLogClient( svnRepository.get<API key>(), options); final ISVNLogEntryHandler handler = new ISVNLogEntryHandler() { public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { commitRev[0] = logEntry.getRevision(); } }; try { logClient.doLog(SVNURL.parseURIEncoded(profile.getRootUrl()), new String[] {lineOfDevelopment.<API key>()}, SVNRevision.HEAD, SVNRevision.HEAD, SVNRevision.create(lastChangedRevision), true, false, 1, handler); } catch (SVNException e) { throw new RepositoryException(e); } // If for some reason there were zero log entries, default to Last Changed Revision. if (commitRev[0] < 0) { commitRev[0] = lastChangedRevision; } return commitRev[0]; } protected List<ChangeSetDto> fetchChangeSets(final SVNRevision r1, final SVNRevision r2) throws RepositoryException { final SVNLogClient logClient = new SVNLogClient(svnRepository.get<API key>(), options); logClient.setEventHandler(eventHandler); final List<ChangeSetDto> changeSets = new ArrayList<ChangeSetDto>(); diffStartRevision = r2.getNumber(); final ISVNLogEntryHandler handler = new ISVNLogEntryHandler() { @SuppressWarnings("unchecked") public void handleLogEntry(SVNLogEntry logEntry) { final long logEntryRevision = logEntry.getRevision(); if (diffStartRevision > logEntryRevision) { diffStartRevision = logEntryRevision; } if (logEntryRevision == r1.getNumber()) { /* The log message for r1 is in the previous build report. Don't include it twice. */ return; } final ChangeSetDto changeSet = new ChangeSetDto(); changeSet.setRevisionLabel("r" + logEntryRevision); changeSet.setAuthorName(logEntry.getAuthor()); changeSet.setMessage(logEntry.getMessage()); changeSet.setTimestamp(new Date(logEntry.getDate().getTime())); final Collection<SVNLogEntryPath> paths = ((Map<String, SVNLogEntryPath>) logEntry.getChangedPaths()).values(); for (SVNLogEntryPath path : paths) { changeSet.addModifiedPath(path.getPath(), toPathModification(path.getType())); } changeSets.add(changeSet); } private PathModification toPathModification(char type) { switch(type) { case SVNLogEntryPath.TYPE_ADDED: return PathModification.Add; case SVNLogEntryPath.TYPE_DELETED: return PathModification.Remove; case SVNLogEntryPath.TYPE_REPLACED: case SVNLogEntryPath.TYPE_MODIFIED: return PathModification.Modify; } return null; } }; try { logClient.doLog( SVNURL.parseURIEncoded(profile.getRootUrl()), new String[] {lineOfDevelopment.<API key>()}, r1, r1, r2, true, true, 0, handler); } catch (SVNCancelException e) { } catch (SVNException e) { if (isFatal(e)) { throw new RepositoryException(e); } } return changeSets; } protected void fetchDifferences(final SVNRevision r1, final SVNRevision r2, OutputStream os) throws RepositoryException { final SVNDiffClient diffClient = new SVNDiffClient(svnRepository.get<API key>(), options); diffClient.setEventHandler(eventHandler); try { diffClient.doDiff(getCompleteSVNURL(), r1, r1, r2, SVNDepth.INFINITY, true, os); os.close(); } catch (SVNCancelException e) { } catch (SVNException e) { if (e.getErrorMessage().getErrorCode() == SVNErrorCode.<API key>) { // This usually happens when building from a different branch or tag that // does not share ancestry with the previous build. log.info("Failed to obtain diff of revisions r" + r1.getNumber() + ":" + r2.getNumber(), e); } else { throw new RepositoryException(e); } } catch (IOException e) { throw new RepositoryException(e); } } protected SVNURL getCompleteSVNURL() throws SVNException { return SVNURL.parseURIEncoded(lineOfDevelopment.getAbsoluteUrl()); } @SuppressWarnings("unchecked") private void addTags(String projectRoot, String folderName, List<RepositoryTagDto> tags) throws SVNException { final String path = projectRoot + "/" + folderName; final Collection<SVNDirEntry> entries = svnRepository.getDir(path, -1, null, (Collection<?>) null); for (SVNDirEntry entry : entries) { final String tagName = entry.getName(); if (entry.getKind() == SVNNodeKind.DIR) { RepositoryTagDto tag = new RepositoryTagDto(); tag.setName(folderName + "/" + tagName); tag.setDescription(tag.getName()); tags.add(tag); } } } private void <API key>(File absolutePath) throws SVNException { if (!this.config.<API key>()) { return; } final ProjectConfigDto orig = stateManager.getProjectConfig(projectName); final SVNWCClient client = new SVNWCClient(svnRepository.get<API key>(), options); final SVNProperties bugtraqProps = new SVNProperties(); <API key>(client, absolutePath, BUGTRAQ_URL, bugtraqProps); <API key>(client, absolutePath, BUGTRAQ_MESSAGE, bugtraqProps); <API key>(client, absolutePath, BUGTRAQ_LOGREGEX, bugtraqProps); final ProjectConfigDto projectConfig = (ProjectConfigDto) orig.copy(); configureBugtraq(projectConfig, bugtraqProps); if (!orig.equals(projectConfig)) { try { log.info("Updating bugtraq information for project " + projectName); stateManager.updateProjectConfig(projectName, projectConfig, false); } catch (Exception e) { if (e instanceof RuntimeException) { throw (RuntimeException) e; } throw new RuntimeException(e); } } } private void <API key>(final SVNWCClient client, File absolutePath, String propName, final SVNProperties bugtraqProps) throws SVNException { SVNPropertyData prop; prop = client.doGetProperty(absolutePath, propName, SVNRevision.BASE, SVNRevision.BASE); bugtraqProps.put(propName, getValueIfNotNull(prop)); } protected String getValueIfNotNull(SVNPropertyData prop) { if (prop != null) { final SVNPropertyValue value = prop.getValue(); if (value.isString()) { return value.getString(); } return SVNPropertyValue.getPropertyAsString(value); } return StringUtils.EMPTY; } private class EventHandler implements ISVNEventHandler, Notify2 { private long previousFileCount = -1; private long fileCount = 0; private BuildDetailCallback buildDetailCallback; public void onNotify(NotifyInformation info) { if (info.getAction() == NotifyAction.update_add) { fileCount++; PluginSupport.<API key>(buildDetailCallback, fileCount, previousFileCount, ProgressUnit.Files); } else if (info.getAction() == NotifyAction.skip) { log.warn("Skipping missing target: " + info.getPath()); } if (Thread.interrupted()) { try { client.cancelOperation(); canceling = true; } catch (ClientException e) { log.error("Error canceling svn operation", e); } } } public void handleEvent(SVNEvent event, double progress) throws SVNException { } public void checkCancelled() throws SVNCancelException { if (Thread.interrupted()) { throw new SVNCancelException(); } } void <API key>(BuildDetailCallback buildDetailCallback) { this.buildDetailCallback = buildDetailCallback; } long getFileCount() { return fileCount; } void <API key>(long previousByteCount) { this.previousFileCount = previousByteCount; } } }
#include "config.h" #include <string.h> #include <stdlib.h> #include <pango/pango-attributes.h> #include "dia_svg.h" /** * SECTION:dia_svg * @title: Dia SVG * @short_description: A set of function helping to read and write SVG with Dia * * The Dia application supports various variants of SVG. There are * at least two importers of SVG dialects, namely \ref Shapes and * the standard SVG importer \ref Plugins. Both are using theses * services to a large extend, but they are also doing there own * thing regarding the SVG dialect interpretation. */ /*! * A global variable to be accessed by "currentColor" */ static int _current_color = 0xFF000000; /*! * \brief Initialize a style object from another style object or defaults. * @param gs An SVG style object to initialize. * @param parent_style An SVG style object to copy values from, or NULL, * in which case defaults will be used. * \ingroup DiaSvg */ void dia_svg_style_init(DiaSvgStyle *gs, DiaSvgStyle *parent_style) { g_return_if_fail (gs); gs->stroke = parent_style ? parent_style->stroke : <API key>; gs->stroke_opacity = parent_style ? parent_style->stroke_opacity : 1.0; gs->line_width = parent_style ? parent_style->line_width : 0.0; gs->linestyle = parent_style ? parent_style->linestyle : <API key>; gs->dashlength = parent_style ? parent_style->dashlength : 1; gs->fill = parent_style ? parent_style->fill : <API key>; gs->fill_opacity = parent_style ? parent_style->fill_opacity : 1.0; gs->linecap = parent_style ? parent_style->linecap : <API key>; gs->linejoin = parent_style ? parent_style->linejoin : <API key>; gs->linestyle = parent_style ? parent_style->linestyle : <API key>; gs->font = (parent_style && parent_style->font) ? g_object_ref (parent_style->font) : NULL; gs->font_height = parent_style ? parent_style->font_height : 0.8; gs->alignment = parent_style ? parent_style->alignment : DIA_ALIGN_LEFT; gs->stop_color = parent_style ? parent_style->stop_color : 0x000000; /* default black */ gs->stop_opacity = parent_style ? parent_style->stop_opacity : 1.0; } /*! * \brief Copy style values from one SVG style object to another. * @param dest SVG style object to copy to. * @param src SVG style object to copy from. * \ingroup DiaSvg */ void dia_svg_style_copy(DiaSvgStyle *dest, DiaSvgStyle *src) { g_return_if_fail (dest && src); dest->stroke = src->stroke; dest->stroke_opacity = src->stroke_opacity; dest->line_width = src->line_width; dest->linestyle = src->linestyle; dest->dashlength = src->dashlength; dest->fill = src->fill; dest->fill_opacity = src->fill_opacity; g_clear_object (&dest->font); dest->font = src->font ? g_object_ref (src->font) : NULL; dest->font_height = src->font_height; dest->alignment = src->alignment; dest->stop_color = src->stop_color; dest->stop_opacity = src->stop_opacity; } static const struct _SvgNamedColor { const gint value; const char *name; } _svg_named_colors [] = { /* complete list copied from sodipodi source */ { 0xF0F8FF, "aliceblue" }, { 0xFAEBD7, "antiquewhite" }, { 0x00FFFF, "aqua" }, { 0x7FFFD4, "aquamarine" }, { 0xF0FFFF, "azure" }, { 0xF5F5DC, "beige" }, { 0xFFE4C4, "bisque" }, { 0x000000, "black" }, { 0xFFEBCD, "blanchedalmond" }, { 0x0000FF, "blue" }, { 0x8A2BE2, "blueviolet" }, { 0xA52A2A, "brown" }, { 0xDEB887, "burlywood" }, { 0x5F9EA0, "cadetblue" }, { 0x7FFF00, "chartreuse" }, { 0xD2691E, "chocolate" }, { 0xFF7F50, "coral" }, { 0x6495ED, "cornflowerblue" }, { 0xFFF8DC, "cornsilk" }, { 0xDC143C, "crimson" }, { 0x00FFFF, "cyan" }, { 0x00008B, "darkblue" }, { 0x008B8B, "darkcyan" }, { 0xB8860B, "darkgoldenrod" }, { 0xA9A9A9, "darkgray" }, { 0x006400, "darkgreen" }, { 0xA9A9A9, "darkgrey" }, { 0xBDB76B, "darkkhaki" }, { 0x8B008B, "darkmagenta" }, { 0x556B2F, "darkolivegreen" }, { 0xFF8C00, "darkorange" }, { 0x9932CC, "darkorchid" }, { 0x8B0000, "darkred" }, { 0xE9967A, "darksalmon" }, { 0x8FBC8F, "darkseagreen" }, { 0x483D8B, "darkslateblue" }, { 0x2F4F4F, "darkslategray" }, { 0x2F4F4F, "darkslategrey" }, { 0x00CED1, "darkturquoise" }, { 0x9400D3, "darkviolet" }, { 0xFF1493, "deeppink" }, { 0x00BFFF, "deepskyblue" }, { 0x696969, "dimgray" }, { 0x696969, "dimgrey" }, { 0x1E90FF, "dodgerblue" }, { 0xB22222, "firebrick" }, { 0xFFFAF0, "floralwhite" }, { 0x228B22, "forestgreen" }, { 0xFF00FF, "fuchsia" }, { 0xDCDCDC, "gainsboro" }, { 0xF8F8FF, "ghostwhite" }, { 0xFFD700, "gold" }, { 0xDAA520, "goldenrod" }, { 0x808080, "gray" }, { 0x008000, "green" }, { 0xADFF2F, "greenyellow" }, { 0x808080, "grey" }, { 0xF0FFF0, "honeydew" }, { 0xFF69B4, "hotpink" }, { 0xCD5C5C, "indianred" }, { 0x4B0082, "indigo" }, { 0xFFFFF0, "ivory" }, { 0xF0E68C, "khaki" }, { 0xE6E6FA, "lavender" }, { 0xFFF0F5, "lavenderblush" }, { 0x7CFC00, "lawngreen" }, { 0xFFFACD, "lemonchiffon" }, { 0xADD8E6, "lightblue" }, { 0xF08080, "lightcoral" }, { 0xE0FFFF, "lightcyan" }, { 0xFAFAD2, "<API key>" }, { 0xD3D3D3, "lightgray" }, { 0x90EE90, "lightgreen" }, { 0xD3D3D3, "lightgrey" }, { 0xFFB6C1, "lightpink" }, { 0xFFA07A, "lightsalmon" }, { 0x20B2AA, "lightseagreen" }, { 0x87CEFA, "lightskyblue" }, { 0x778899, "lightslategray" }, { 0x778899, "lightslategrey" }, { 0xB0C4DE, "lightsteelblue" }, { 0xFFFFE0, "lightyellow" }, { 0x00FF00, "lime" }, { 0x32CD32, "limegreen" }, { 0xFAF0E6, "linen" }, { 0xFF00FF, "magenta" }, { 0x800000, "maroon" }, { 0x66CDAA, "mediumaquamarine" }, { 0x0000CD, "mediumblue" }, { 0xBA55D3, "mediumorchid" }, { 0x9370DB, "mediumpurple" }, { 0x3CB371, "mediumseagreen" }, { 0x7B68EE, "mediumslateblue" }, { 0x00FA9A, "mediumspringgreen" }, { 0x48D1CC, "mediumturquoise" }, { 0xC71585, "mediumvioletred" }, { 0x191970, "midnightblue" }, { 0xF5FFFA, "mintcream" }, { 0xFFE4E1, "mistyrose" }, { 0xFFE4B5, "moccasin" }, { 0xFFDEAD, "navajowhite" }, { 0x000080, "navy" }, { 0xFDF5E6, "oldlace" }, { 0x808000, "olive" }, { 0x6B8E23, "olivedrab" }, { 0xFFA500, "orange" }, { 0xFF4500, "orangered" }, { 0xDA70D6, "orchid" }, { 0xEEE8AA, "palegoldenrod" }, { 0x98FB98, "palegreen" }, { 0xAFEEEE, "paleturquoise" }, { 0xDB7093, "palevioletred" }, { 0xFFEFD5, "papayawhip" }, { 0xFFDAB9, "peachpuff" }, { 0xCD853F, "peru" }, { 0xFFC0CB, "pink" }, { 0xDDA0DD, "plum" }, { 0xB0E0E6, "powderblue" }, { 0x800080, "purple" }, { 0xFF0000, "red" }, { 0xBC8F8F, "rosybrown" }, { 0x4169E1, "royalblue" }, { 0x8B4513, "saddlebrown" }, { 0xFA8072, "salmon" }, { 0xF4A460, "sandybrown" }, { 0x2E8B57, "seagreen" }, { 0xFFF5EE, "seashell" }, { 0xA0522D, "sienna" }, { 0xC0C0C0, "silver" }, { 0x87CEEB, "skyblue" }, { 0x6A5ACD, "slateblue" }, { 0x708090, "slategray" }, { 0x708090, "slategrey" }, { 0xFFFAFA, "snow" }, { 0x00FF7F, "springgreen" }, { 0x4682B4, "steelblue" }, { 0xD2B48C, "tan" }, { 0x008080, "teal" }, { 0xD8BFD8, "thistle" }, { 0xFF6347, "tomato" }, { 0x40E0D0, "turquoise" }, { 0xEE82EE, "violet" }, { 0xF5DEB3, "wheat" }, { 0xFFFFFF, "white" }, { 0xF5F5F5, "whitesmoke" }, { 0xFFFF00, "yellow" }, { 0x9ACD32, "yellowgreen" } }; static int _cmp_color (const void *key, const void *elem) { const char *a = key; const struct _SvgNamedColor *color = elem; return strcmp (a, color->name); } static gboolean svg_named_color (const char *name, gint32 *color) { const struct _SvgNamedColor *elem; <API key> (name != NULL && color != NULL, FALSE); elem = bsearch (name, _svg_named_colors, G_N_ELEMENTS(_svg_named_colors), sizeof(_svg_named_colors[0]), _cmp_color); if (elem) { *color = elem->value; return TRUE; } return FALSE; } /*! * \brief Parse an SVG color description. * * @param color A place to store the color information (0RGB) * @param str An SVG color description string to parse. * @return TRUE if parsing was successful. * * This function is rather tolerant compared to the SVG specification. * It supports special names like 'fg', 'bg', 'foregroumd', 'background'; * three numeric representations: '\#FF0000', 'rgb(1.0,0.0,0.0), 'rgb(100%,0%,0%)' * and named colors from two domains: SVG and Pango. * * \note Shouldn't we use an actual Dia Color object as return value? * Would require that the DiaSvgStyle object uses that, too. If we did that, * we could even return the color object directly, and we would be able to use * >8 bits per channel. * But we would not be able to handle named colors anymore ... * * \ingroup DiaSvg */ static gboolean _parse_color(gint32 *color, const char *str) { if (str[0] == ' char *endp = NULL; guint32 val = strtol(str+1, &endp, 16); if (endp - (str + 1) > 3) /* no 16-bit color here */ *color = val & 0xffffff; else /* weak estimation: Pango is reusing bits to fill */ *color = ((0xF & val)<<4) | ((0xF0 & val)<<8) | (((0xF00 & val)>>4)<<16); } else if (0 == strncmp(str, "none", 4)) *color = DIA_SVG_COLOUR_NONE; else if (0 == strncmp(str, "foreground", 10) || 0 == strncmp(str, "fg", 2) || 0 == strncmp(str, "inverse", 7)) *color = <API key>; else if (0 == strncmp(str, "background", 10) || 0 == strncmp(str, "bg", 2) || 0 == strncmp(str, "default", 7)) *color = <API key>; else if (0 == strcmp(str, "text")) *color = DIA_SVG_COLOUR_TEXT; else if (0 == strcmp(str, "currentColor")) *color = _current_color; else if (0 == strncmp(str, "rgb(", 4)) { int r = 0, g = 0, b = 0; if (3 == sscanf (str+4, "%d,%d,%d", &r, &g, &b)) { /* Set alpha to 1.0 */ *color = ((0xFF<<24) & 0xFF000000) | ((r<<16) & 0xFF0000) | ((g<<8) & 0xFF00) | (b & 0xFF); } else if (strchr (str+4, '%')) { /* e.g. cairo uses percent values */ char **vals = g_strsplit (str+4, "%,", -1); int i; *color = 0xFF000000; for (i = 0; vals[i] && i < 3; ++i) *color |= ((int)(((255 * g_ascii_strtod(vals[i], NULL)) / 100))<<(16-(8*i))); g_strfreev (vals); } else { return FALSE; } } else if (0 == strncmp(str, "rgba(", 5)) { int r = 0, g = 0, b = 0, a = 0; if (4 == sscanf (str+4, "%d,%d,%d,%d", &r, &g, &b, &a)) *color = ((a<<24) & 0xFF000000) | ((r<<16) & 0xFF0000) | ((g<<8) & 0xFF00) | (b & 0xFF); else return FALSE; } else { char* se = strchr (str, ';'); if (!se) /* style might have trailign space */ se = strchr (str, ' '); if (!se) { return svg_named_color (str, color); } else { /* need to make a copy of the color only */ gboolean ret; char *sc = g_strndup (str, se - str); ret = svg_named_color (sc, color); g_clear_pointer (&sc, g_free); return ret; } } return TRUE; } /*! * \brief Convert a string to a color * * SVG spec also allows 'inherit' as color value, which leads * to false here. Should still mostly work because the color * is supposed to be initialized before. * * \ingroup DiaSvg */ gboolean dia_svg_parse_color (const char *str, Color *color) { gint32 c; gboolean ret = _parse_color (&c, str); if (ret) { color->red = ((c & 0xff0000) >> 16) / 255.0; color->green = ((c & 0x00ff00) >> 8) / 255.0; color->blue = (c & 0x0000ff) / 255.0; color->alpha = 1.0; } return ret; } enum { <API key> = 40 }; static void _parse_dasharray (DiaSvgStyle *s, double user_scale, char *str, char **end) { char *ptr; /* by also splitting on ';' we can also parse the continued style string */ char **dashes = <API key> ("[\\s,;]+", (char *) str, 0, 0); int n = 0; double dl; s->dashlength = g_ascii_strtod(str, &ptr); if (s->dashlength <= 0.0) { /* e.g. "none" */ s->linestyle = <API key>; } else if (user_scale > 0) { s->dashlength /= user_scale; } if (s->dashlength) { /* at least one value */ while (dashes[n] && g_ascii_strtod (dashes[n], NULL) > 0) { ++n; /* Dia can not do arbitrary length, the number of dashes gives the style */ } } if (n > 0) { s->dashlength = g_ascii_strtod (dashes[0], NULL); } if (user_scale > 0) { s->dashlength /= user_scale; } switch (n) { case 0: s->linestyle = <API key>; break; case 1: s->linestyle = <API key>; break; case 2: dl = g_ascii_strtod (dashes[1], NULL); if (user_scale > 0) { dl /= user_scale; } if (dl < s->line_width || dl > s->dashlength) { /* the difference is arbitrary */ s->linestyle = <API key>; s->dashlength *= 10.0; /* dot = 10% of len */ } else { s->linestyle = <API key>; } break; case 4: s->linestyle = <API key>; break; default : /* If an odd number of values is provided, then the list of values is repeated to * yield an even number of values. Thus, stroke-dasharray: 5,3,2 is equivalent to * stroke-dasharray: 5,3,2,5,3,2. */ case 6: s->linestyle = <API key>; break; } g_strfreev (dashes); if (end) *end = ptr; } static void _parse_linejoin (DiaSvgStyle *s, const char *val) { if (!strncmp (val, "miter", 5)) { s->linejoin = DIA_LINE_JOIN_MITER; } else if (!strncmp (val, "round", 5)) { s->linejoin = DIA_LINE_JOIN_ROUND; } else if (!strncmp (val, "bevel", 5)) { s->linejoin = DIA_LINE_JOIN_BEVEL; } else if (!strncmp (val, "default", 7)) { s->linejoin = <API key>; } } static void _parse_linecap (DiaSvgStyle *s, const char *val) { if (!strncmp(val, "butt", 4)) s->linecap = DIA_LINE_CAPS_BUTT; else if (!strncmp(val, "round", 5)) s->linecap = DIA_LINE_CAPS_ROUND; else if (!strncmp(val, "square", 6) || !strncmp(val, "projecting", 10)) s->linecap = <API key>; else if (!strncmp(val, "default", 7)) s->linecap = <API key>; } /*! * \brief Given any of the three parameters adjust the font * @param s Dia SVG style to modify * @param family comma-separated list of family names * @param style font slant string * @param weight font weight string */ static void _style_adjust_font (DiaSvgStyle *s, const char *family, const char *style, const char *weight) { g_clear_object (&s->font); /* given font_height is bogus, especially if not given at all * or without unit ... see bug 665648 about invalid CSS */ s->font = <API key> (DIA_FONT_SANS, s->font_height > 0 ? s->font_height : 1.0); if (family) { /* SVG allows a list of families here, also there is some strange formatting * seen, like 'Arial'. If the given family name can not be resolved by * Pango it complaints loudly with g_warning(). */ char **families = g_strsplit (family, ",", -1); int i = 0; gboolean found = FALSE; while (!found && families[i]) { const char *chomped = g_strchomp (g_strdelimit (families[i], "'", ' ')); PangoFont *loaded; <API key>(s->font, chomped); loaded = <API key> (<API key> (), <API key> (s->font)); if (loaded) { g_clear_object (&loaded); found = TRUE; } ++i; } if (!found) { <API key> (s->font, "sans"); } g_strfreev (families); } if (style) { <API key> (s->font, style); } if (weight) { <API key> (s->font, weight); } } static void _parse_text_align (DiaSvgStyle *s, const char *ptr) { if (!strncmp (ptr, "start", 5)) { s->alignment = DIA_ALIGN_LEFT; } else if (!strncmp (ptr, "end", 3)) { s->alignment = DIA_ALIGN_RIGHT; } else if (!strncmp (ptr, "middle", 6)) { s->alignment = DIA_ALIGN_CENTRE; } } /*! * \brief Parse SVG/CSS style string * * Parse as much information from the given style string as Dia can handle. * There are still known limitations: * - does not follow references to somewhere inside or outside the string * (e.g. url(...), color and currentColor) * - font parsing should be extended to support lists of fonts somehow * * \ingroup DiaSvg */ void <API key> (DiaSvgStyle *s, double user_scale, const char *str) { int i = 0; char *ptr = (char *) str; char *family = NULL, *style = NULL, *weight = NULL; while (ptr[0] != '\0') { /* skip white space at start */ while (ptr[0] != '\0' && g_ascii_isspace(ptr[0])) ptr++; if (ptr[0] == '\0') break; if (!strncmp("font-family:", ptr, 12)) { ptr += 12; while ((ptr[0] != '\0') && g_ascii_isspace(ptr[0])) ptr++; i = 0; while (ptr[i] != '\0' && ptr[i] != ';') ++i; /* with i==0 we fall back to 'sans' too */ if (strncmp (ptr, "sanserif", i) == 0 || strncmp (ptr, "sans-serif", i) == 0) family = g_strdup ("sans"); /* special name adaption */ else family = i > 0 ? g_strndup(ptr, i) : NULL; ptr += i; } else if (!strncmp("font-weight:", ptr, 12)) { ptr += 12; while ((ptr[0] != '\0') && g_ascii_isspace(ptr[0])) ptr++; i = 0; while (ptr[i] != '\0' && ptr[i] != ';') ++i; weight = i > 0 ? g_strndup (ptr, i) : NULL; ptr += i; } else if (!strncmp("font-style:", ptr, 11)) { ptr += 11; while ((ptr[0] != '\0') && g_ascii_isspace(ptr[0])) ptr++; i = 0; while (ptr[i] != '\0' && ptr[i] != ';') ++i; style = i > 0 ? g_strndup(ptr, i) : NULL; ptr += i; } else if (!strncmp("font-size:", ptr, 10)) { ptr += 10; while ((ptr[0] != '\0') && g_ascii_isspace(ptr[0])) ptr++; i = 0; while (ptr[i] != '\0' && ptr[i] != ';') ++i; s->font_height = g_ascii_strtod(ptr, NULL); ptr += i; if (user_scale > 0) s->font_height /= user_scale; } else if (!strncmp("text-anchor:", ptr, 12)) { ptr += 12; while ((ptr[0] != '\0') && g_ascii_isspace(ptr[0])) ptr++; _parse_text_align(s, ptr); } else if (!strncmp("stroke-width:", ptr, 13)) { ptr += 13; s->line_width = g_ascii_strtod(ptr, &ptr); if (user_scale > 0) s->line_width /= user_scale; } else if (!strncmp("stroke:", ptr, 7)) { ptr += 7; while ((ptr[0] != '\0') && g_ascii_isspace(ptr[0])) ptr++; if (ptr[0] == '\0') break; if (!_parse_color (&s->stroke, ptr)) s->stroke = DIA_SVG_COLOUR_NONE; } else if (!strncmp("stroke-opacity:", ptr, 15)) { ptr += 15; s->stroke_opacity = g_ascii_strtod(ptr, &ptr); } else if (!strncmp("fill:", ptr, 5)) { ptr += 5; while (ptr[0] != '\0' && g_ascii_isspace(ptr[0])) ptr++; if (ptr[0] == '\0') break; if (!_parse_color (&s->fill, ptr)) s->fill = DIA_SVG_COLOUR_NONE; } else if (!strncmp("fill-opacity:", ptr, 13)) { ptr += 13; s->fill_opacity = g_ascii_strtod(ptr, &ptr); } else if (!strncmp("stop-color:", ptr, 11)) { ptr += 11; while (ptr[0] != '\0' && g_ascii_isspace(ptr[0])) ptr++; if (ptr[0] == '\0') break; if (!_parse_color (&s->stop_color, ptr)) s->stop_color = DIA_SVG_COLOUR_NONE; } else if (!strncmp("stop-opacity:", ptr, 13)) { ptr += 13; s->stop_opacity = g_ascii_strtod(ptr, &ptr); } else if (!strncmp("opacity", ptr, 7)) { double opacity; ptr += 7; opacity = g_ascii_strtod(ptr, &ptr); /* multiplicative effect of opacity */ s->stroke_opacity *= opacity; s->fill_opacity *= opacity; } else if (!strncmp("stroke-linecap:", ptr, 15)) { ptr += 15; while (ptr[0] != '\0' && g_ascii_isspace(ptr[0])) ptr++; if (ptr[0] == '\0') break; _parse_linecap (s, ptr); } else if (!strncmp("stroke-linejoin:", ptr, 16)) { ptr += 16; while (ptr[0] != '\0' && g_ascii_isspace(ptr[0])) ptr++; if (ptr[0] == '\0') break; _parse_linejoin (s, ptr); } else if (!strncmp("stroke-pattern:", ptr, 15)) { /* Apparently not an offical SVG style attribute, but * referenced in custom-shapes document. So we continue * supporting it (read only). */ ptr += 15; while (ptr[0] != '\0' && g_ascii_isspace(ptr[0])) ptr++; if (ptr[0] == '\0') break; if (!strncmp (ptr, "solid", 5)) { s->linestyle = <API key>; } else if (!strncmp (ptr, "dashed", 6)) { s->linestyle = <API key>; } else if (!strncmp (ptr, "dash-dot", 8)) { s->linestyle = <API key>; } else if (!strncmp (ptr, "dash-dot-dot", 12)) { s->linestyle = <API key>; } else if (!strncmp (ptr, "dotted", 6)) { s->linestyle = <API key>; } else if (!strncmp (ptr, "default", 7)) { s->linestyle = <API key>; } /* XXX: deal with a real pattern */ } else if (!strncmp ("stroke-dashlength:", ptr, 18)) { ptr += 18; while (ptr[0] != '\0' && g_ascii_isspace(ptr[0])) ptr++; if (ptr[0] == '\0') break; if (!strncmp(ptr, "default", 7)) s->dashlength = 1.0; else { s->dashlength = g_ascii_strtod(ptr, &ptr); if (user_scale > 0) s->dashlength /= user_scale; } } else if (!strncmp ("stroke-dasharray:", ptr, 17)) { s->linestyle = <API key>; ptr += 17; while (ptr[0] != '\0' && g_ascii_isspace(ptr[0])) ptr++; if (ptr[0] == '\0') break; if (!strncmp(ptr, "default", 7)) s->dashlength = 1.0; else _parse_dasharray (s, user_scale, ptr, &ptr); } /* skip up to the next attribute */ while (ptr[0] != '\0' && ptr[0] != ';' && ptr[0] != '\n') ptr++; if (ptr[0] != '\0') ptr++; } if (family || style || weight) { _style_adjust_font (s, family, style, weight); g_clear_pointer (&family, g_free); g_clear_pointer (&style, g_free); g_clear_pointer (&weight, g_free); } } /*! * \brief Parse SVG style properties * * This function not only parses the style attribute of the given node * it also extracts some of the style properties directly. * @param node An XML node to parse a style from. * @param s The SVG style object to fill out. This should previously be * initialized to some default values. * @param user_scale if >0 scalable values (font-size, stroke-width, ...) * are divided by this, otherwise ignored * * \ingroup DiaSvg */ void dia_svg_parse_style (xmlNodePtr node, DiaSvgStyle *s, double user_scale) { xmlChar *str; str = xmlGetProp(node, (const xmlChar *)"style"); if (str) { <API key> (s, user_scale, (char *)str); xmlFree(str); } /* ugly svg variations, it is allowed to give style properties without * the style attribute, i.e. direct attributes */ str = xmlGetProp(node, (const xmlChar *)"color"); if (str) { int c; if (_parse_color (&c, (char *) str)) _current_color = c; xmlFree(str); } str = xmlGetProp(node, (const xmlChar *)"opacity"); if (str) { double opacity = g_ascii_strtod ((char *) str, NULL); /* multiplicative effect of opacity */ s->stroke_opacity *= opacity; s->fill_opacity *= opacity; xmlFree(str); } str = xmlGetProp(node, (const xmlChar *)"stop-color"); if (str) { if (!_parse_color (&s->stop_color, (char *) str) && strcmp ((const char *) str, "inherit") != 0) s->stop_color = DIA_SVG_COLOUR_NONE; xmlFree(str); } str = xmlGetProp(node, (const xmlChar *)"stop-opacity"); if (str) { s->stop_opacity = g_ascii_strtod((char *) str, NULL); xmlFree(str); } str = xmlGetProp(node, (const xmlChar *)"fill"); if (str) { if (!_parse_color (&s->fill, (char *) str) && strcmp ((const char *) str, "inherit") != 0) s->fill = DIA_SVG_COLOUR_NONE; xmlFree(str); } str = xmlGetProp(node, (const xmlChar *)"fill-opacity"); if (str) { s->fill_opacity = g_ascii_strtod((char *) str, NULL); xmlFree(str); } str = xmlGetProp(node, (const xmlChar *)"stroke"); if (str) { if (!_parse_color (&s->stroke, (char *) str) && strcmp ((const char *) str, "inherit") != 0) s->stroke = DIA_SVG_COLOUR_NONE; xmlFree(str); } str = xmlGetProp(node, (const xmlChar *)"stroke-opacity"); if (str) { s->stroke_opacity = g_ascii_strtod((char *) str, NULL); xmlFree(str); } str = xmlGetProp(node, (const xmlChar *)"stroke-width"); if (str) { s->line_width = g_ascii_strtod((char *) str, NULL); xmlFree(str); if (user_scale > 0) s->line_width /= user_scale; } str = xmlGetProp(node, (const xmlChar *)"stroke-dasharray"); if (str) { if (strcmp ((const char *)str, "inherit") != 0) _parse_dasharray (s, user_scale, (char *)str, NULL); xmlFree(str); } str = xmlGetProp(node, (const xmlChar *)"stroke-linejoin"); if (str) { if (strcmp ((const char *)str, "inherit") != 0) _parse_linejoin (s, (char *)str); xmlFree(str); } str = xmlGetProp(node, (const xmlChar *)"stroke-linecap"); if (str) { if (strcmp ((const char *)str, "inherit") != 0) _parse_linecap (s, (char *)str); xmlFree(str); } /* text-props, again ;( */ str = xmlGetProp(node, (const xmlChar *)"font-size"); if (str) { /* for inherit we just leave the original value, * should be initialized by parent style already */ if (strcmp ((const char *)str, "inherit") != 0) { s->font_height = g_ascii_strtod ((char *)str, NULL); if (user_scale > 0) s->font_height /= user_scale; } xmlFree(str); } str = xmlGetProp(node, (const xmlChar *)"text-anchor"); if (str) { _parse_text_align (s, (const char*) str); xmlFree(str); } { xmlChar *family = xmlGetProp(node, (const xmlChar *)"font-family"); xmlChar *slant = xmlGetProp(node, (const xmlChar *)"font-style"); xmlChar *weight = xmlGetProp(node, (const xmlChar *)"font-weight"); if (family || slant || weight) { _style_adjust_font (s, (char *)family, (char *)slant, (char *)weight); if (family) xmlFree(family); if (slant) xmlFree(slant); if (weight) xmlFree(weight); } } } static void _path_arc_segment (GArray *points, double xc, double yc, double th0, double th1, double rx, double ry, double x_axis_rotation, Point *last_p2) { BezPoint bez; double sin_th, cos_th; double a00, a01, a10, a11; double x1, y1, x2, y2, x3, y3; double t; double th_half; sin_th = sin (x_axis_rotation * (M_PI / 180.0)); cos_th = cos (x_axis_rotation * (M_PI / 180.0)); /* inverse transform compared with rsvg_path_arc */ a00 = cos_th * rx; a01 = -sin_th * ry; a10 = sin_th * rx; a11 = cos_th * ry; th_half = 0.5 * (th1 - th0); t = (8.0 / 3.0) * sin(th_half * 0.5) * sin(th_half * 0.5) / sin(th_half); x1 = xc + cos (th0) - t * sin (th0); y1 = yc + sin (th0) + t * cos (th0); x3 = xc + cos (th1); y3 = yc + sin (th1); x2 = x3 + t * sin (th1); y2 = y3 - t * cos (th1); bez.type = BEZ_CURVE_TO; bez.p1.x = a00 * x1 + a01 * y1; bez.p1.y = a10 * x1 + a11 * y1; bez.p2.x = a00 * x2 + a01 * y2; bez.p2.y = a10 * x2 + a11 * y2; bez.p3.x = a00 * x3 + a01 * y3; bez.p3.y = a10 * x3 + a11 * y3; *last_p2 = bez.p2; g_array_append_val(points, bez); } /* * Parse an SVG description of a full arc. */ static void _path_arc (GArray *points, double cpx, double cpy, double rx, double ry, double x_axis_rotation, int large_arc_flag, int sweep_flag, double x, double y, Point *last_p2) { double sin_th, cos_th; double a00, a01, a10, a11; double x0, y0, x1, y1, xc, yc; double d, sfactor, sfactor_sq; double th0, th1, th_arc; double px, py, pl; int i, n_segs; sin_th = sin (x_axis_rotation * (M_PI / 180.0)); cos_th = cos (x_axis_rotation * (M_PI / 180.0)); /* * Correction of out-of-range radii as described in Appendix F.6.6: * * 1. Ensure radii are non-zero (Done?). * 2. Ensure that radii are positive. * 3. Ensure that radii are large enough. */ if(rx < 0.0) rx = -rx; if(ry < 0.0) ry = -ry; px = cos_th * (cpx - x) * 0.5 + sin_th * (cpy - y) * 0.5; py = cos_th * (cpy - y) * 0.5 - sin_th * (cpx - x) * 0.5; pl = (px * px) / (rx * rx) + (py * py) / (ry * ry); if(pl > 1.0) { pl = sqrt(pl); rx *= pl; ry *= pl; } /* Proceed with computations as described in Appendix F.6.5 */ a00 = cos_th / rx; a01 = sin_th / rx; a10 = -sin_th / ry; a11 = cos_th / ry; x0 = a00 * cpx + a01 * cpy; y0 = a10 * cpx + a11 * cpy; x1 = a00 * x + a01 * y; y1 = a10 * x + a11 * y; /* (x0, y0) is current point in transformed coordinate space. (x1, y1) is new point in transformed coordinate space. The arc fits a unit-radius circle in this space. */ d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); sfactor_sq = 1.0 / d - 0.25; if (sfactor_sq < 0) sfactor_sq = 0; sfactor = sqrt (sfactor_sq); if (sweep_flag == large_arc_flag) sfactor = -sfactor; xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); /* (xc, yc) is center of the circle. */ th0 = atan2 (y0 - yc, x0 - xc); th1 = atan2 (y1 - yc, x1 - xc); th_arc = th1 - th0; if (th_arc < 0 && sweep_flag) th_arc += 2 * M_PI; else if (th_arc > 0 && !sweep_flag) th_arc -= 2 * M_PI; n_segs = (int) ceil (fabs (th_arc / (M_PI * 0.5 + 0.001))); for (i = 0; i < n_segs; i++) { _path_arc_segment(points, xc, yc, th0 + i * th_arc / n_segs, th0 + (i + 1) * th_arc / n_segs, rx, ry, x_axis_rotation, last_p2); } } /* routine to chomp off the start of the string */ #define path_chomp(path) while (path[0]!='\0'&&strchr(" \t\n\r,", path[0])) path++ /** * dia_svg_parse_path: * @path_str: A string describing an SVG path. * @unparsed: The position in @path_str where parsing ended, or %NULL if * the string was completely parsed. This should be used for * calling the function until it is fully parsed. * @closed: Whether the path was closed. * @current_point: to retain it over splitting * * Takes SVG path content and converts it in an array of BezPoint. * * SVG pathes can contain multiple MOVE_TO commands while Dia's bezier * object can only contain one so you may need to call this function * multiple times. * * @bug This function is way too long (324 lines). So dont touch it. please! * Shouldn't we try to turn straight lines, simple arc, polylines and * zigzaglines into their appropriate objects? Could either be done by * returning an object or by having functions that try parsing as * specific simple paths. * NOPE: Dia is capable to handle beziers and the file has given us some so * WHY should be break it in to pieces ??? * * Returns: %TRUE if there is any useful data in parsed to points */ gboolean dia_svg_parse_path (GArray *points, const char *path_str, char **unparsed, gboolean *closed, Point *current_point) { enum { PATH_MOVE, PATH_LINE, PATH_HLINE, PATH_VLINE, PATH_CURVE, PATH_SMOOTHCURVE, PATH_QUBICCURVE, PATH_TTQCURVE, PATH_ARC, PATH_CLOSE, PATH_END } last_type = PATH_MOVE; Point last_open = {0.0, 0.0}; Point last_point = {0.0, 0.0}; Point last_control = {0.0, 0.0}; gboolean last_relative = FALSE; BezPoint bez = { 0, }; char *path = (char *)path_str; gboolean need_next_element = FALSE; /* we can grow the same array in multiple steps */ gsize points_at_start = points->len; *closed = FALSE; *unparsed = NULL; /* when splitting into pieces, we have to maintain current_point accross them */ if (current_point) last_point = *current_point; path_chomp(path); while (path[0] != '\0') { #ifdef DEBUG_CUSTOM g_printerr ("Path: %s\n", path); #endif /* check for a new command */ switch (path[0]) { case 'M': if (points->len - points_at_start > 0) { need_next_element = TRUE; goto MORETOPARSE; } path++; path_chomp(path); last_type = PATH_MOVE; last_relative = FALSE; break; case 'm': if (points->len - points_at_start > 0) { need_next_element = TRUE; goto MORETOPARSE; } path++; path_chomp(path); last_type = PATH_MOVE; last_relative = TRUE; break; case 'L': path++; path_chomp(path); last_type = PATH_LINE; last_relative = FALSE; break; case 'l': path++; path_chomp(path); last_type = PATH_LINE; last_relative = TRUE; break; case 'H': path++; path_chomp(path); last_type = PATH_HLINE; last_relative = FALSE; break; case 'h': path++; path_chomp(path); last_type = PATH_HLINE; last_relative = TRUE; break; case 'V': path++; path_chomp(path); last_type = PATH_VLINE; last_relative = FALSE; break; case 'v': path++; path_chomp(path); last_type = PATH_VLINE; last_relative = TRUE; break; case 'C': path++; path_chomp(path); last_type = PATH_CURVE; last_relative = FALSE; break; case 'c': path++; path_chomp(path); last_type = PATH_CURVE; last_relative = TRUE; break; case 'S': path++; path_chomp(path); last_type = PATH_SMOOTHCURVE; last_relative = FALSE; break; case 's': path++; path_chomp(path); last_type = PATH_SMOOTHCURVE; last_relative = TRUE; break; case 'q': path++; path_chomp(path); last_type = PATH_QUBICCURVE; last_relative = TRUE; break; case 'Q': path++; path_chomp(path); last_type = PATH_QUBICCURVE; last_relative = FALSE; break; case 't': path++; path_chomp(path); last_type = PATH_TTQCURVE; last_relative = TRUE; break; case 'T': path++; path_chomp(path); last_type = PATH_TTQCURVE; last_relative = FALSE; break; case 'Z': case 'z': path++; path_chomp(path); last_type = PATH_CLOSE; last_relative = FALSE; break; case 'A': path++; path_chomp(path); last_type = PATH_ARC; last_relative = FALSE; break; case 'a': path++; path_chomp(path); last_type = PATH_ARC; last_relative = TRUE; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '.': case '+': case '-': if (last_type == PATH_CLOSE) { g_warning("parse_path: argument given for implicite close path"); /* consume one number so we don't fall into an infinite loop */ while (path != NULL && strchr("0123456789.+-", path[0])) path++; path_chomp(path); *closed = TRUE; need_next_element = TRUE; goto MORETOPARSE; } break; default: g_warning("unsupported path code '%c'", path[0]); last_type = PATH_END; path++; path_chomp(path); break; } /* actually parse the path component */ switch (last_type) { case PATH_MOVE: if (points->len - points_at_start > 1) { g_warning ("Only first point should be 'move'"); } bez.type = BEZ_MOVE_TO; bez.p1.x = g_ascii_strtod (path, &path); path_chomp (path); bez.p1.y = g_ascii_strtod (path, &path); path_chomp (path); if (last_relative) { bez.p1.x += last_point.x; bez.p1.y += last_point.y; } last_point = bez.p1; last_control = bez.p1; last_open = bez.p1; if (points->len - points_at_start == 1) { /* stupid svg, but we can handle it */ g_array_index (points, BezPoint, 0) = bez; } else { g_array_append_val (points, bez); } /* [SVG11 8.3.2] If a moveto is followed by multiple pairs of coordinates, * the subsequent pairs are treated as implicit lineto commands */ last_type = PATH_LINE; break; case PATH_LINE: bez.type = BEZ_LINE_TO; bez.p1.x = g_ascii_strtod (path, &path); path_chomp (path); bez.p1.y = g_ascii_strtod (path, &path); path_chomp (path); if (last_relative) { bez.p1.x += last_point.x; bez.p1.y += last_point.y; } /* Strictly speeaking it should not be necessary to assign the other * two points. But it helps hiding a serious limitation with the * standard bezier serialization, namely only saving one move-to * and the rest as curve-to */ #define <API key> bez.p3 = bez.p1; bez.p2 = last_point <API key>; last_point = bez.p1; last_control = bez.p1; g_array_append_val (points, bez); break; case PATH_HLINE: bez.type = BEZ_LINE_TO; bez.p1.x = g_ascii_strtod (path, &path); path_chomp (path); bez.p1.y = last_point.y; if (last_relative) { bez.p1.x += last_point.x; } <API key>; last_point = bez.p1; last_control = bez.p1; g_array_append_val (points, bez); break; case PATH_VLINE: bez.type = BEZ_LINE_TO; bez.p1.x = last_point.x; bez.p1.y = g_ascii_strtod (path, &path); path_chomp (path); if (last_relative) { bez.p1.y += last_point.y; } <API key>; #undef <API key> last_point = bez.p1; last_control = bez.p1; g_array_append_val (points, bez); break; case PATH_CURVE: bez.type = BEZ_CURVE_TO; bez.p1.x = g_ascii_strtod (path, &path); path_chomp (path); bez.p1.y = g_ascii_strtod (path, &path); path_chomp (path); bez.p2.x = g_ascii_strtod (path, &path); path_chomp (path); bez.p2.y = g_ascii_strtod (path, &path); path_chomp (path); bez.p3.x = g_ascii_strtod (path, &path); path_chomp (path); bez.p3.y = g_ascii_strtod (path, &path); path_chomp (path); if (last_relative) { bez.p1.x += last_point.x; bez.p1.y += last_point.y; bez.p2.x += last_point.x; bez.p2.y += last_point.y; bez.p3.x += last_point.x; bez.p3.y += last_point.y; } last_point = bez.p3; last_control = bez.p2; g_array_append_val (points, bez); break; case PATH_SMOOTHCURVE: bez.type = BEZ_CURVE_TO; bez.p1.x = 2 * last_point.x - last_control.x; bez.p1.y = 2 * last_point.y - last_control.y; bez.p2.x = g_ascii_strtod (path, &path); path_chomp (path); bez.p2.y = g_ascii_strtod (path, &path); path_chomp (path); bez.p3.x = g_ascii_strtod (path, &path); path_chomp (path); bez.p3.y = g_ascii_strtod (path, &path); path_chomp (path); if (last_relative) { bez.p2.x += last_point.x; bez.p2.y += last_point.y; bez.p3.x += last_point.x; bez.p3.y += last_point.y; } last_point = bez.p3; last_control = bez.p2; g_array_append_val (points, bez); break; case PATH_QUBICCURVE: { /* raise quadratic bezier to cubic (copied from librsvg) */ double x1, y1; x1 = g_ascii_strtod (path, &path); path_chomp (path); y1 = g_ascii_strtod (path, &path); path_chomp (path); if (last_relative) { x1 += last_point.x; y1 += last_point.y; } bez.type = BEZ_CURVE_TO; bez.p1.x = (last_point.x + 2 * x1) * (1.0 / 3.0); bez.p1.y = (last_point.y + 2 * y1) * (1.0 / 3.0); bez.p3.x = g_ascii_strtod (path, &path); path_chomp (path); bez.p3.y = g_ascii_strtod (path, &path); path_chomp (path); if (last_relative) { bez.p3.x += last_point.x; bez.p3.y += last_point.y; } bez.p2.x = (bez.p3.x + 2 * x1) * (1.0 / 3.0); bez.p2.y = (bez.p3.y + 2 * y1) * (1.0 / 3.0); last_point = bez.p3; last_control.x = x1; last_control.y = y1; g_array_append_val (points, bez); } break; case PATH_TTQCURVE: { /* Truetype quadratic bezier curveto */ double xc, yc; /* quadratic control point */ xc = 2 * last_point.x - last_control.x; yc = 2 * last_point.y - last_control.y; /* generate a quadratic bezier with control point = xc, yc */ bez.type = BEZ_CURVE_TO; bez.p1.x = (last_point.x + 2 * xc) * (1.0 / 3.0); bez.p1.y = (last_point.y + 2 * yc) * (1.0 / 3.0); bez.p3.x = g_ascii_strtod (path, &path); path_chomp (path); bez.p3.y = g_ascii_strtod (path, &path); path_chomp (path); if (last_relative) { bez.p3.x += last_point.x; bez.p3.y += last_point.y; } bez.p2.x = (bez.p3.x + 2 * xc) * (1.0 / 3.0); bez.p2.y = (bez.p3.y + 2 * yc) * (1.0 / 3.0); last_point = bez.p3; last_control.x = xc; last_control.y = yc; g_array_append_val (points, bez); } break; case PATH_ARC: { double rx, ry; double xrot; int largearc, sweep; Point dest, dest_c; dest_c.x=0; dest_c.y=0; rx = g_ascii_strtod (path, &path); path_chomp (path); ry = g_ascii_strtod (path, &path); path_chomp (path); #if 1 /* ok if it is all properly separated */ xrot = g_ascii_strtod (path, &path); path_chomp (path); largearc = (int) g_ascii_strtod (path, &path); path_chomp (path); sweep = (int) g_ascii_strtod (path, &path); path_chomp (path); #else /* Actually three flags, which might not be properly separated, * but even with this paths-data-20-f.svg does not work. IMHO the * test case is seriously borked and can only pass if parsing * the arc is tweaked against the test. In other words that test * looks like it is built against one specific implementation. * Inkscape and librsvg fail, Firefox pass. */ xrot = path[0] == '0' ? 0.0 : 1.0; ++path; path_chomp(path); largearc = path[0] == '0' ? 0 : 1; ++path; path_chomp(path); sweep = path[0] == '0' ? 0 : 1; ++path; path_chomp(path); #endif dest.x = g_ascii_strtod (path, &path); path_chomp (path); dest.y = g_ascii_strtod (path, &path); path_chomp (path); if (last_relative) { dest.x += last_point.x; dest.y += last_point.y; } /* avoid matherr with bogus values - just ignore them * does happen e.g. with 'Chem-Widgets - clamp-large' */ if (last_point.x != dest.x || last_point.y != dest.y) { _path_arc (points, last_point.x, last_point.y, rx, ry, xrot, largearc, sweep, dest.x, dest.y, &dest_c); } last_point = dest; last_control = dest_c; } break; case PATH_CLOSE: /* close the path with a line - second condition to ignore single close */ if (!*closed && (points->len != points_at_start)) { const BezPoint *bpe = &g_array_index (points, BezPoint, points->len-1); /* if the last point already meets the first point dont add it again */ const Point pte = bpe->type == BEZ_CURVE_TO ? bpe->p3 : bpe->p1; if (pte.x != last_open.x || pte.y != last_open.y) { bez.type = BEZ_LINE_TO; bez.p1 = last_open; g_array_append_val (points, bez); } last_point = last_open; } *closed = TRUE; need_next_element = TRUE; break; case PATH_END: while (*path != '\0') { path++; } need_next_element = FALSE; break; default: <API key> (FALSE); } /* get rid of any ignorable characters */ path_chomp (path); MORETOPARSE: if (need_next_element) { /* check if there really is more to be parsed */ if (path[0] != 0) { *unparsed = path; } else { *unparsed = NULL; } break; /* while */ } } /* avoid returning an array with only one point (I'd say the exporter * producing such is rather broken, but *our* bezier creation code * would crash on it. */ if (points->len < 2) { g_array_set_size (points, 0); } if (current_point) { *current_point = last_point; } return (points->len > 1); } static gboolean _parse_transform (const char *trans, graphene_matrix_t *m, double scale) { char **list; char *p = strchr (trans, '('); int i = 0; while ( (*trans != '\0') && (*trans == ' ' || *trans == ',' || *trans == '\t' || *trans == '\n' || *trans == '\r')) { ++trans; /* skip whitespace */ } if (!p || !*trans) { return FALSE; /* silently fail */ } list = <API key> ("[\\s,]+", p + 1, 0, 0); if (strncmp (trans, "matrix", 6) == 0) { float xx = 0, yx = 0, xy = 0, yy = 0, x0 = 0, y0 = 0; if (list[i]) { xx = g_ascii_strtod (list[i], NULL); ++i; } if (list[i]) { yx = g_ascii_strtod (list[i], NULL); ++i; } if (list[i]) { xy = g_ascii_strtod (list[i], NULL); ++i; } if (list[i]) { yy = g_ascii_strtod (list[i], NULL); ++i; } if (list[i]) { x0 = g_ascii_strtod (list[i], NULL); ++i; } if (list[i]) { y0 = g_ascii_strtod (list[i], NULL); ++i; } <API key> (m, xx, yx, xy, yy, x0 / scale, y0 / scale); } else if (strncmp (trans, "translate", 9) == 0) { double x0 = 0, y0 = 0; if (list[i]) { x0 = g_ascii_strtod (list[i], NULL); ++i; } if (list[i]) { y0 = g_ascii_strtod (list[i], NULL); ++i; } <API key> (m, &<API key> (x0 / scale, y0 / scale, 0)); } else if (strncmp (trans, "scale", 5) == 0) { double xx = 0, yy = 0; if (list[i]) { xx = g_ascii_strtod (list[i], NULL); ++i; } if (list[i]) { yy = g_ascii_strtod (list[i], NULL); ++i; } else { yy = xx; } <API key> (m, xx, yy, 1.0); } else if (strncmp (trans, "rotate", 6) == 0) { double angle = 0; double cx = 0, cy = 0; if (list[i]) { angle = g_ascii_strtod (list[i], NULL); ++i; } else { g_warning ("transform=rotate no angle?"); } /* FIXME: check with real world data, I'm uncertain */ /* rotate around the given offset */ if (list[i]) { graphene_point3d_t point; cx = g_ascii_strtod (list[i], NULL); ++i; if (list[i]) { cy = g_ascii_strtod (list[i], NULL); ++i; } else { cy = 0.0; /* if offsets don't come in pairs */ } /* translate by -cx,-cy */ <API key> (&point, -(cx / scale), -(cy / scale), 0); <API key> (m, &point); /* rotate by angle */ <API key> (m, angle); /* translate by cx,cy */ <API key> (&point, cx / scale, cy / scale, 0); <API key> (m, &point); } else { <API key> (m, angle, <API key> ()); } } else if (strncmp (trans, "skewX", 5) == 0) { float skew = 0; if (list[i]) { skew = g_ascii_strtod (list[i], NULL); } <API key> (m, DIA_RADIANS (skew), 0); } else if (strncmp (trans, "skewY", 5) == 0) { float skew = 0; if (list[i]) { skew = g_ascii_strtod (list[i], NULL); } <API key> (m, 0, DIA_RADIANS (skew)); } else { g_warning ("SVG: %s?", trans); return FALSE; } g_clear_pointer (&list, g_strfreev); return TRUE; } graphene_matrix_t * <API key> (const char *trans, double scale) { graphene_matrix_t *m = NULL; char **transforms = <API key> ("\\)", trans, 0, 0); int i = 0; /* go through the list of transformations - not that one would be enough ;) */ while (transforms[i]) { graphene_matrix_t mat; if (_parse_transform (transforms[i], &mat, scale)) { if (!m) { m = <API key> (); <API key> (m, &mat); } else { <API key> (m, &mat, m); } } ++i; } g_clear_pointer (&transforms, g_strfreev); return m; } char * dia_svg_from_matrix (const graphene_matrix_t *matrix, double scale) { /* transform="matrix(1,0,0,1,0,0)" */ char buf[<API key>]; GString *sm = g_string_new ("matrix("); char *s; g_ascii_formatd (buf, sizeof (buf), "%g", <API key> (matrix, 0, 0)); g_string_append (sm, buf); g_string_append (sm, ","); g_ascii_formatd (buf, sizeof (buf), "%g", <API key> (matrix, 0, 1)); g_string_append (sm, buf); g_string_append (sm, ","); g_ascii_formatd (buf, sizeof (buf), "%g", <API key> (matrix, 1, 0)); g_string_append (sm, buf); g_string_append (sm, ","); g_ascii_formatd (buf, sizeof (buf), "%g", <API key> (matrix, 1, 1)); g_string_append (sm, buf); g_string_append (sm, ","); g_ascii_formatd (buf, sizeof (buf), "%g", <API key> (matrix) * scale); g_string_append (sm, buf); g_string_append (sm, ","); g_ascii_formatd (buf, sizeof (buf), "%g", <API key> (matrix) * scale); g_string_append (sm, buf); g_string_append (sm, ")"); s = sm->str; g_string_free (sm, FALSE); return s; }
#ifndef GLASS_WINDOW_H #define GLASS_WINDOW_H #include <gtk/gtk.h> #include <X11/Xlib.h> #include <jni.h> #include <set> #include <vector> #include "glass_view.h" enum WindowFrameType { TITLED, UNTITLED, TRANSPARENT }; enum WindowType { NORMAL, UTILITY, POPUP }; enum request_type { REQUEST_NONE, REQUEST_RESIZABLE, <API key> }; struct WindowFrameExtents { int top; int left; int bottom; int right; }; static const guint MOUSE_BUTTONS_MASK = (guint) (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK); enum BoundsType { BOUNDSTYPE_CONTENT, BOUNDSTYPE_WINDOW }; struct WindowGeometry { WindowGeometry(): final_width(), final_height(), refx(), refy(), gravity_x(), gravity_y(), current_width(), current_height(), extents() {} // estimate of the final width the window will get after all pending // configure requests are processed by the window manager struct { int value; BoundsType type; } final_width; struct { int value; BoundsType type; } final_height; float refx; float refy; float gravity_x; float gravity_y; // the last width which was configured or obtained from configure // notification int current_width; // the last height which was configured or obtained from configure // notification int current_height; WindowFrameExtents extents; }; class WindowContextChild; class WindowContextTop; class WindowContext { public: virtual bool isEnabled() = 0; virtual bool hasIME() = 0; virtual bool filterIME(GdkEvent *) = 0; virtual void enableOrResetIME() = 0; virtual void disableIME() = 0; virtual void paint(void* data, jint width, jint height) = 0; virtual WindowFrameExtents get_frame_extents() = 0; virtual void enter_fullscreen() = 0; virtual void exit_fullscreen() = 0; virtual void <API key>(bool) = 0; virtual void set_visible(bool) = 0; virtual bool is_visible() = 0; virtual void set_bounds(int, int, bool, bool, int, int, int, int) = 0; virtual void set_resizable(bool) = 0; virtual void request_focus() = 0; virtual void set_focusable(bool)= 0; virtual bool grab_focus() = 0; virtual bool <API key>() = 0; virtual void ungrab_focus() = 0; virtual void <API key>() = 0; virtual void set_title(const char*) = 0; virtual void set_alpha(double) = 0; virtual void set_enabled(bool) = 0; virtual void set_minimum_size(int, int) = 0; virtual void set_maximum_size(int, int) = 0; virtual void set_minimized(bool) = 0; virtual void set_maximized(bool) = 0; virtual void set_icon(GdkPixbuf*) = 0; virtual void restack(bool) = 0; virtual void set_cursor(GdkCursor*) = 0; virtual void set_modal(bool, WindowContext* parent = NULL) = 0; virtual void set_gravity(float, float) = 0; virtual void set_level(int) = 0; virtual void set_background(float, float, float) = 0; virtual void <API key>(GdkEventProperty*) = 0; virtual void process_configure(GdkEventConfigure*) = 0; virtual void process_map() = 0; virtual void process_focus(GdkEventFocus*) = 0; virtual void process_destroy() = 0; virtual void process_delete() = 0; virtual void process_expose(GdkEventExpose*) = 0; virtual void <API key>(GdkEventButton*) = 0; virtual void <API key>(GdkEventMotion*) = 0; virtual void <API key>(GdkEventScroll*) = 0; virtual void process_mouse_cross(GdkEventCrossing*) = 0; virtual void process_key(GdkEventKey*) = 0; virtual void process_state(GdkEventWindowState*) = 0; virtual void notify_state(jint) = 0; virtual void add_child(WindowContextTop* child) = 0; virtual void remove_child(WindowContextTop* child) = 0; virtual bool set_view(jobject) = 0; virtual GdkWindow *get_gdk_window() = 0; virtual GtkWindow *get_gtk_window() = 0; virtual jobject get_jview() = 0; virtual jobject get_jwindow() = 0; virtual int getEmbeddedX() = 0; virtual int getEmbeddedY() = 0; virtual void <API key>() = 0; virtual void <API key>() = 0; virtual size_t get_events_count() = 0; virtual bool is_dead() = 0; virtual ~WindowContext() {} }; class WindowContextBase: public WindowContext { std::set<WindowContextTop*> children; struct _XIM{ XIM im; XIC ic; bool enabled; } xim; size_t <API key>; bool can_be_deleted; protected: jobject jwindow; jobject jview; GtkWidget* gtk_widget; GdkWindow* gdk_window; bool is_iconified; bool is_maximized; bool is_mouse_entered; /* * sm_grab_window points to WindowContext holding a mouse grab. * It is mostly used for popup windows. */ static WindowContext* sm_grab_window; /* * <API key> points to a WindowContext from which a mouse drag started. * This WindowContext holding a mouse grab during this drag. After releasing * all mouse buttons <API key> becomes NULL and sm_grab_window's * mouse grab should be restored if present. * * This is done in order to mimic Windows behavior: * All mouse events should be delivered to a window from which mouse drag * started, until all mouse buttons released. No mouse ENTER/EXIT events * should be reported during this drag. */ static WindowContext* <API key>; public: bool isEnabled(); bool hasIME(); bool filterIME(GdkEvent *); void enableOrResetIME(); void disableIME(); void paint(void*, jint, jint); GdkWindow *get_gdk_window(); jobject get_jwindow(); jobject get_jview(); void add_child(WindowContextTop*); void remove_child(WindowContextTop*); void <API key>(bool); void reparent_children(WindowContext* parent); void set_visible(bool); bool is_visible(); bool set_view(jobject); bool grab_focus(); bool <API key>(); void ungrab_focus(); void <API key>(); void set_cursor(GdkCursor*); void set_level(int) {} void set_background(float, float, float); void process_map() {} void process_focus(GdkEventFocus*); void process_destroy(); void process_delete(); void process_expose(GdkEventExpose*); void <API key>(GdkEventButton*); void <API key>(GdkEventMotion*); void <API key>(GdkEventScroll*); void process_mouse_cross(GdkEventCrossing*); void process_key(GdkEventKey*); void process_state(GdkEventWindowState*); void notify_state(jint); int getEmbeddedX() { return 0; } int getEmbeddedY() { return 0; } void <API key>(); void <API key>(); size_t get_events_count(); bool is_dead(); ~WindowContextBase(); protected: virtual void applyShapeMask(void*, uint width, uint height) = 0; private: bool im_filter_keypress(GdkEventKey*); }; class WindowContextPlug: public WindowContextBase { WindowContext* parent; public: bool set_view(jobject); void set_bounds(int, int, bool, bool, int, int, int, int); //WindowFrameExtents get_frame_extents() { return WindowFrameExtents{0, 0, 0, 0}; }; WindowFrameExtents get_frame_extents() { WindowFrameExtents ext = {0, 0, 0, 0}; return ext;} void enter_fullscreen() {} void exit_fullscreen() {} void set_resizable(bool) {} void request_focus() {} void set_focusable(bool) {} void set_title(const char*) {} void set_alpha(double) {} void set_enabled(bool) {} void set_minimum_size(int, int) {} void set_maximum_size(int, int) {} void set_minimized(bool) {} void set_maximized(bool) {} void set_icon(GdkPixbuf*) {} void restack(bool) {} void set_modal(bool, WindowContext*) {} void set_gravity(float, float) {} void <API key>(GdkEventProperty*) {} void process_configure(GdkEventConfigure*); void <API key>(GdkEventConfigure*); void applyShapeMask(void*, uint width, uint height) {} GtkWindow *get_gtk_window(); // TODO, get window from parent WindowContextPlug(jobject, void*); GtkWidget* gtk_container; std::vector<WindowContextChild *> embedded_children; private: //HACK: remove once set_bounds is implemented correctly void window_configure(XWindowChanges *, unsigned int); WindowContextPlug(WindowContextPlug&); WindowContextPlug& operator= (const WindowContextPlug&); }; class WindowContextChild: public WindowContextBase { WindowContextPlug* parent; WindowContextTop* full_screen_window; GlassView* view; // not null while in Full Screen public: void <API key>(GdkEventButton*); bool set_view(jobject); void set_bounds(int, int, bool, bool, int, int, int, int); //WindowFrameExtents get_frame_extents() { return WindowFrameExtents{0, 0, 0, 0}; }; WindowFrameExtents get_frame_extents() { WindowFrameExtents ext = {0, 0, 0, 0}; return ext;} void enter_fullscreen(); void exit_fullscreen(); void set_resizable(bool) {} void request_focus() {} void set_focusable(bool) {} void set_title(const char*) {} void set_alpha(double) {} void set_enabled(bool) {} void set_minimum_size(int, int) {} void set_maximum_size(int, int) {} void set_minimized(bool) {} void set_maximized(bool) {} void set_icon(GdkPixbuf*) {} void restack(bool); void set_modal(bool, WindowContext*) {} void set_gravity(float, float) {} void <API key>(GdkEventProperty*) {} void process_configure(GdkEventConfigure*); void process_destroy(); void set_visible(bool visible); int getEmbeddedX(); int getEmbeddedY(); void applyShapeMask(void*, uint width, uint height) {} GtkWindow *get_gtk_window(); // TODO, get window from parent WindowContextChild(jobject, void*, GtkWidget *parent_widget, WindowContextPlug *parent_context); private: WindowContextChild(WindowContextChild&); WindowContextChild& operator= (const WindowContextChild&); }; class WindowContextTop: public WindowContextBase { jlong screen; WindowFrameType frame_type; struct WindowContext *owner; WindowGeometry geometry; int <API key>; struct _Resizable{// we can't use set/get <API key> function _Resizable(): request(REQUEST_NONE), value(true), prev(false), minw(-1), minh(-1), maxw(-1), maxh(-1){} request_type request; //request for future setResizable bool value; //actual value of resizable for a window bool prev; //former resizable value (used in setEnabled for parents of modal window) int minw, minh, maxw, maxh; //minimum and maximum window width/height; } resizable; bool <API key>; bool map_received; bool location_assigned; bool size_assigned; public: WindowContextTop(jobject, WindowContext*, long, WindowFrameType, WindowType); void process_map(); void <API key>(GdkEventProperty*); void process_configure(GdkEventConfigure*); void process_destroy(); void <API key>(); WindowFrameExtents get_frame_extents(); void set_minimized(bool); void set_maximized(bool); void set_bounds(int, int, bool, bool, int, int, int, int); void set_resizable(bool); void request_focus(); void set_focusable(bool); void set_title(const char*); void set_alpha(double); void set_enabled(bool); void set_minimum_size(int, int); void set_maximum_size(int, int); void set_icon(GdkPixbuf*); void restack(bool); void set_modal(bool, WindowContext* parent = NULL); void set_gravity(float, float); void set_level(int); void set_visible(bool); void enter_fullscreen(); void exit_fullscreen(); void set_owner(WindowContext*); GtkWindow *get_gtk_window(); void detach_from_java(); protected: void applyShapeMask(void*, uint width, uint height); private: bool <API key>(int *, int *, int *, int *); void <API key>(); void <API key>(); void window_configure(XWindowChanges *, unsigned int); void <API key>(); void <API key>(bool, bool); WindowContextTop(WindowContextTop&); WindowContextTop& operator= (const WindowContextTop&); }; void <API key>(WindowContext* ctx); class EventsCounterHelper { private: WindowContext* ctx; public: explicit EventsCounterHelper(WindowContext* context) { ctx = context; ctx-><API key>(); } ~EventsCounterHelper() { ctx-><API key>(); if (ctx->is_dead() && ctx->get_events_count() == 0) { delete ctx; } ctx = NULL; } }; #endif /* GLASS_WINDOW_H */
#region Using directives using System; using System.Collections; using System.Data; using UFSoft.UBF.UI.MD.Runtime; using UFSoft.UBF.UI.MD.Runtime.Implement; #endregion namespace DocumentTypeRef { public partial class <API key> { //UIMODEL public override void AfterInitModel() { //this.Views[0].Fields[0].DefaultValue = thsi.co } //UIModel. public override void OnValidate() { base.OnValidate() ; <API key>(); //your coustom code ... } } }
<?php // DO NOT DISTRIBUTE OR COPY this software to any additional purpose, websites, or hosting. If the original website // is move to new hosting, this software may also be moved to new location. // IN NO EVENT SHALL SKY HIGH SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, OR INCIDENTAL DAMAGES, // INCLUDING LOST PROFITS, ARISING FROM USE OF THIS SOFTWARE. // THIS SOFTWARE IS PROVIDED "AS IS". SKY HIGH SOFTWARE HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, // ENHANCEMENTS, OR MODIFICATIONS BEYOND THAT SPECIFICALLY AGREED TO IN SEPARATE WRITTEN AGREEMENT. ?> <tr><td colspan="3" height="20" class="pageEditBars">&nbsp;&nbsp;SERVICES</td></tr> <tr> <td valign="top" ><div align="right">Service</div></td> <td colspan="2"><input name="sub_title" type="text" id="sub_title" size="50" maxlength="100" value="<?php echo $sub_title; ?>"/></td> </tr> <tr> <td valign="top" ><div align="right">Pricing</div></td> <td colspan="2"> <?php $oFCKeditor = new FCKeditor('other') ; $oFCKeditor->BasePath = 'fckeditor/'; // is the default value. $oFCKeditor->Value = $other; $oFCKeditor->ToolbarSet = $EDITOR_TOOLBAR; $oFCKeditor->Height = 70; $oFCKeditor->Create() ; ?> </td> </tr> <tr> <td valign="top" ><div align="right">Related Services</div></td> <td colspan="2"><?php $oFCKeditor = new FCKeditor('other2') ; $oFCKeditor->BasePath = 'fckeditor/'; // is the default value. $oFCKeditor->Value = $other2; //$oFCKeditor->ToolbarSet = $EDITOR_TOOLBAR; $oFCKeditor->Height = 240; $oFCKeditor->Create() ; ?></td> </tr> <tr> <td valign="top" ><div align="right">Quote</div></td> <td colspan="2"> <?php $oFCKeditor = new FCKeditor('other5') ; $oFCKeditor->BasePath = 'fckeditor/'; // is the default value. $oFCKeditor->Value = $other5; $oFCKeditor->ToolbarSet = $EDITOR_TOOLBAR; $oFCKeditor->Height = 140; $oFCKeditor->Create() ; ?> </td> </tr> <?php include("page_edit_image_inc.php"); ?>
<?php /** * The template for displaying Comments. * * The area of the page that contains both current comments * and the comment form. The actual display of comments is * handled by a callback to hoshin_comment which is * located in the functions.php file. * * @package WordPress * @subpackage Twenty_Ten * @since Twenty Ten 1.0 */ ?> <div id="comments" class="comments"> <?php if ( <API key>() ) : ?> <p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'hoshin' ); ?></p> </div><!-- #comments --> <?php /* Stop the rest of comments.php from being processed, * but don't kill the script entirely -- we still have * to fully load the template. */ return; endif; ?> <?php // You can start editing here -- including this comment! ?> <?php if ( have_comments() ) : ?> <h3 class="comments-title"><?php printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'hoshin' ), number_format_i18n( get_comments_number() ), '<em>' . get_the_title() . '</em>' ); ?></h3> <?php if ( <API key>() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?> <div class="navigation"> <div class="nav-previous"><?php <API key>( __( '<span class="meta-nav">&larr;</span> Older Comments', 'hoshin' ) ); ?></div> <div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'hoshin' ) ); ?></div> </div> <!-- .navigation --> <?php endif; // check for comment navigation ?> <ol class="commentlist"> <?php /* Loop through and list the comments. Tell wp_list_comments() * to use hoshin_comment() to format the comments. * If you want to overload this in a child theme then you can * define hoshin_comment() and that will be used instead. * See hoshin_comment() in hoshin/functions.php for more. */ wp_list_comments( array( 'callback' => 'hoshin_comment' ) ); ?> </ol> <?php if ( <API key>() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?> <div class="navigation"> <div class="nav-previous"><?php <API key>( __( '<span class="meta-nav">&larr;</span> Older Comments', 'hoshin' ) ); ?></div> <div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'hoshin' ) ); ?></div> </div><!-- .navigation --> <?php endif; // check for comment navigation ?> <?php else : // or, if we don't have comments: /* If there are no comments and comments are closed, * let's leave a little note, shall we? */ if ( ! comments_open() ) : ?> <p class="nocomments"><?php _e( 'Comments are closed.', 'hoshin' ); ?></p> <?php endif; // end ! comments_open() ?> <?php endif; // end have_comments() ?> <?php comment_form(); ?> </div><!-- #comments -->
#ifndef __LINUX_CAPI_H__ #define __LINUX_CAPI_H__ #include <asm/types.h> #include <linux/ioctl.h> #ifndef __KERNEL__ #include <linux/kernelcapi.h> #endif /* * CAPI_REGISTER */ typedef struct <API key> { /* CAPI_REGISTER */ __u32 level3cnt; /* No. of simulatneous user data connections */ __u32 datablkcnt; /* No. of buffered data messages */ __u32 datablklen; /* Size of buffered data messages */ } <API key>; #define CAPI_REGISTER _IOW('C',0x01,struct <API key>) /* * <API key> */ #define <API key> 64 #define <API key> _IOWR('C',0x06,int) /* broken: wanted size 64 (<API key>) */ /* * CAPI_GET_VERSION */ typedef struct capi_version { __u32 majorversion; __u32 minorversion; __u32 majormanuversion; __u32 minormanuversion; } capi_version; #define CAPI_GET_VERSION _IOWR('C',0x07,struct capi_version) /* * CAPI_GET_SERIAL */ #define CAPI_SERIAL_LEN 8 #define CAPI_GET_SERIAL _IOWR('C',0x08,int) /* broken: wanted size 8 (CAPI_SERIAL_LEN) */ /* * CAPI_GET_PROFILE */ typedef struct capi_profile { __u16 ncontroller; /* number of installed controller */ __u16 nbchannel; /* number of B-Channels */ __u32 goptions; /* global options */ __u32 support1; /* B1 protocols support */ __u32 support2; /* B2 protocols support */ __u32 support3; /* B3 protocols support */ __u32 reserved[6]; /* reserved */ __u32 manu[5]; /* manufacturer specific information */ } capi_profile; #define CAPI_GET_PROFILE _IOWR('C',0x09,struct capi_profile) typedef struct <API key> { unsigned long cmd; void __user *data; } <API key>; /* * <API key> */ #define <API key> _IOWR('C',0x20, struct <API key>) /* * CAPI_GET_ERRCODE * capi errcode is set, * if read, write, or ioctl returns EIO, * ioctl returns errcode directly, and in arg, if != 0 */ #define CAPI_GET_ERRCODE _IOR('C',0x21, __u16) /* * CAPI_INSTALLED */ #define CAPI_INSTALLED _IOR('C',0x22, __u16) /* * member contr is input for * <API key>, CAPI_VERSION, CAPI_GET_SERIAL * and CAPI_GET_PROFILE */ typedef union capi_ioctl_struct { __u32 contr; <API key> rparams; __u8 manufacturer[<API key>]; capi_version version; __u8 serial[CAPI_SERIAL_LEN]; capi_profile profile; <API key> cmd; __u16 errcode; } capi_ioctl_struct; /* * Middleware extension */ #define <API key> 0x0001 #define CAPI_GET_FLAGS _IOR('C',0x23, unsigned) #define CAPI_SET_FLAGS _IOR('C',0x24, unsigned) #define CAPI_CLR_FLAGS _IOR('C',0x25, unsigned) #define CAPI_NCCI_OPENCOUNT _IOR('C',0x26, unsigned) #define CAPI_NCCI_GETUNIT _IOR('C',0x27, unsigned) #endif /* __LINUX_CAPI_H__ */
/* This program was written with lots of love under the GPL by Jonathan * Blandford <jrb@gnome.org> */ #include <config.h> #include <stdlib.h> #include <string.h> #include <gtk/gtk.h> #include <gio/gio.h> #include <gdk/gdkx.h> #include <X11/Xatom.h> #include <glib/gi18n.h> #include <gdk/gdkkeysyms.h> #if GTK_CHECK_VERSION (3, 0, 0) #include <gdk/gdkkeysyms-compat.h> #endif #include "wm-common.h" #include "capplet-util.h" #include "eggcellrendererkeys.h" #include "<API key>.h" #include "dconf-util.h" #define <API key> "/org/mate/desktop/keybindings/" #define <API key> "org.mate.control-center.keybinding" #define <API key> 10 #define <API key> 1000 #define RESPONSE_ADD 0 #define RESPONSE_REMOVE 1 typedef struct { /* The untranslated name, combine with ->package to translate */ char *name; /* The gettext package to use to translate the section title */ char *package; /* Name of the window manager the keys would apply to */ char *wm_name; /* The GSettings schema for the whole file */ char *schema; /* an array of KeyListEntry */ GArray *entries; } KeyList; typedef enum { COMPARISON_NONE = 0, COMPARISON_GT, COMPARISON_LT, COMPARISON_EQ } Comparison; typedef struct { char *gsettings_path; char *schema; char *name; int value; char *value_schema; /* gsettings schema for key/value */ char *value_key; char *description; char *description_key; char *cmd_key; Comparison comparison; } KeyListEntry; enum { DESCRIPTION_COLUMN, KEYENTRY_COLUMN, N_COLUMNS }; typedef struct { GSettings *settings; char *gsettings_path; char *gsettings_key; guint keyval; guint keycode; <API key> mask; gboolean editable; GtkTreeModel *model; char *description; char *desc_gsettings_key; gboolean desc_editable; char *command; char *cmd_gsettings_key; gboolean cmd_editable; gulong gsettings_cnxn; gulong gsettings_cnxn_desc; gulong gsettings_cnxn_cmd; } KeyEntry; static gboolean block_accels = FALSE; static GtkWidget *<API key> = NULL; static GtkWidget *<API key> = NULL; static GtkWidget *<API key> = NULL; static GtkWidget* <API key>(GtkBuilder* builder, const gchar* name) { return GTK_WIDGET (<API key> (builder, name)); } static GtkBuilder * create_builder (void) { GtkBuilder *builder = gtk_builder_new(); GError *error = NULL; static const gchar *uifile = MATECC_UI_DIR "/<API key>.ui"; if (<API key> (builder, uifile, &error) == 0) { g_warning ("Could not load UI: %s", error->message); g_error_free (error); g_object_unref (builder); builder = NULL; } return builder; } static char* binding_name(guint keyval, guint keycode, <API key> mask, gboolean translate) { if (keyval != 0 || keycode != 0) { if (translate) { return <API key> (keyval, keycode, mask); } else { return <API key> (keyval, keycode, mask); } } else { return g_strdup (translate ? _("Disabled") : ""); } } static gboolean binding_from_string (const char *str, guint *accelerator_key, guint *keycode, <API key> *accelerator_mods) { <API key> (accelerator_key != NULL, FALSE); if (str == NULL || strcmp (str, "disabled") == 0) { *accelerator_key = 0; *keycode = 0; *accelerator_mods = 0; return TRUE; } <API key> (str, accelerator_key, keycode, accelerator_mods); if (*accelerator_key == 0) return FALSE; else return TRUE; } static void accel_set_func (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer data) { KeyEntry *key_entry; gtk_tree_model_get (model, iter, KEYENTRY_COLUMN, &key_entry, -1); if (key_entry == NULL) g_object_set (cell, "visible", FALSE, NULL); else if (! key_entry->editable) g_object_set (cell, "visible", TRUE, "editable", FALSE, "accel_key", key_entry->keyval, "accel_mask", key_entry->mask, "keycode", key_entry->keycode, "style", PANGO_STYLE_ITALIC, NULL); else g_object_set (cell, "visible", TRUE, "editable", TRUE, "accel_key", key_entry->keyval, "accel_mask", key_entry->mask, "keycode", key_entry->keycode, "style", PANGO_STYLE_NORMAL, NULL); } static void <API key> (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer data) { KeyEntry *key_entry; gtk_tree_model_get (model, iter, KEYENTRY_COLUMN, &key_entry, -1); if (key_entry != NULL) g_object_set (cell, "editable", FALSE, "text", key_entry->description != NULL ? key_entry->description : _("<Unknown Action>"), NULL); else g_object_set (cell, "editable", FALSE, NULL); } static gboolean <API key> (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data) { KeyEntry *key_entry; KeyEntry *tmp_key_entry; key_entry = (KeyEntry *)user_data; gtk_tree_model_get (key_entry->model, iter, KEYENTRY_COLUMN, &tmp_key_entry, -1); if (key_entry == tmp_key_entry) { <API key> (key_entry->model, path, iter); return TRUE; } return FALSE; } static void <API key> (GSettings *settings, gchar *key, KeyEntry *key_entry) { gchar *key_value; key_value = <API key> (settings, key); binding_from_string (key_value, &key_entry->keyval, &key_entry->keycode, &key_entry->mask); key_entry->editable = <API key> (settings, key); /* update the model */ <API key> (key_entry->model, <API key>, key_entry); } static void <API key> (GSettings *settings, gchar *key, KeyEntry *key_entry) { gchar *key_value; key_value = <API key> (settings, key); g_free (key_entry->description); key_entry->description = key_value ? g_strdup (key_value) : NULL; g_free (key_value); key_entry->desc_editable = <API key> (settings, key); /* update the model */ <API key> (key_entry->model, <API key>, key_entry); } static void <API key> (GSettings *settings, gchar *key, KeyEntry *key_entry) { gchar *key_value; key_value = <API key> (settings, key); g_free (key_entry->command); key_entry->command = key_value ? g_strdup (key_value) : NULL; key_entry->cmd_editable = <API key> (settings, key); g_free (key_value); /* update the model */ <API key> (key_entry->model, <API key>, key_entry); } static int keyentry_sort_func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data) { KeyEntry *key_entry_a; KeyEntry *key_entry_b; int retval; key_entry_a = NULL; gtk_tree_model_get (model, a, KEYENTRY_COLUMN, &key_entry_a, -1); key_entry_b = NULL; gtk_tree_model_get (model, b, KEYENTRY_COLUMN, &key_entry_b, -1); if (key_entry_a && key_entry_b) { if ((key_entry_a->keyval || key_entry_a->keycode) && (key_entry_b->keyval || key_entry_b->keycode)) { gchar *name_a, *name_b; name_a = binding_name (key_entry_a->keyval, key_entry_a->keycode, key_entry_a->mask, TRUE); name_b = binding_name (key_entry_b->keyval, key_entry_b->keycode, key_entry_b->mask, TRUE); retval = g_utf8_collate (name_a, name_b); g_free (name_a); g_free (name_b); } else if (key_entry_a->keyval || key_entry_a->keycode) retval = -1; else if (key_entry_b->keyval || key_entry_b->keycode) retval = 1; else retval = 0; } else if (key_entry_a) retval = -1; else if (key_entry_b) retval = 1; else retval = 0; return retval; } static void clear_old_model (GtkBuilder *builder) { GtkWidget *tree_view; GtkWidget *actions_swindow; GtkTreeModel *model; tree_view = <API key> (builder, "shortcut_treeview"); model = <API key> (GTK_TREE_VIEW (tree_view)); if (model == NULL) { /* create a new model */ model = (GtkTreeModel *) gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER); <API key> (GTK_TREE_SORTABLE (model), KEYENTRY_COLUMN, keyentry_sort_func, NULL, NULL); <API key> (GTK_TREE_VIEW (tree_view), model); g_object_unref (model); } else { /* clear the existing model */ gboolean valid; GtkTreeIter iter; KeyEntry *key_entry; for (valid = <API key> (model, &iter); valid; valid = <API key> (model, &iter)) { gtk_tree_model_get (model, &iter, KEYENTRY_COLUMN, &key_entry, -1); if (key_entry != NULL) { <API key> (key_entry->settings, key_entry->gsettings_cnxn); if (key_entry->gsettings_cnxn_desc != 0) <API key> (key_entry->settings, key_entry->gsettings_cnxn_desc); if (key_entry->gsettings_cnxn_cmd != 0) <API key> (key_entry->settings, key_entry->gsettings_cnxn_cmd); g_object_unref (key_entry->settings); if (key_entry->gsettings_path) g_free (key_entry->gsettings_path); g_free (key_entry->gsettings_key); g_free (key_entry->description); g_free (key_entry->desc_gsettings_key); g_free (key_entry->command); g_free (key_entry->cmd_gsettings_key); g_free (key_entry); } } <API key> (GTK_TREE_STORE (model)); } actions_swindow = <API key> (builder, "actions_swindow"); <API key> (GTK_SCROLLED_WINDOW (actions_swindow), GTK_POLICY_NEVER, GTK_POLICY_NEVER); <API key> (actions_swindow, -1, -1); } typedef struct { const char *key; const char *path; const char *schema; gboolean found; } KeyMatchData; static gboolean key_match(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, gpointer data) { KeyMatchData* match_data = data; KeyEntry* element = NULL; gchar *element_schema = NULL; gchar *element_path = NULL; gtk_tree_model_get(model, iter, KEYENTRY_COLUMN, &element, -1); if (element && element->settings && G_IS_SETTINGS(element->settings)) { g_object_get (element->settings, "schema-id", &element_schema, NULL); g_object_get (element->settings, "path", &element_path, NULL); } if (element && g_strcmp0(element->gsettings_key, match_data->key) == 0 && g_strcmp0(element_schema, match_data->schema) == 0 && g_strcmp0(element_path, match_data->path) == 0) { match_data->found = TRUE; return TRUE; } return FALSE; } static gboolean <API key>(GtkTreeModel* model, const KeyListEntry* entry) { KeyMatchData data; data.key = entry->name; data.schema = entry->schema; data.path = entry->gsettings_path; data.found = FALSE; <API key>(model, key_match, &data); return data.found; } static gboolean should_show_key(const KeyListEntry* entry) { GSettings *settings; int value; if (entry->comparison == COMPARISON_NONE) { return TRUE; } <API key>(entry->value_key != NULL, FALSE); <API key>(entry->value_schema != NULL, FALSE); settings = g_settings_new (entry->value_schema); value = g_settings_get_int (settings, entry->value_key); g_object_unref (settings); switch (entry->comparison) { case COMPARISON_NONE: /* For compiler warnings */ <API key> (); return FALSE; case COMPARISON_GT: if (value > entry->value) { return TRUE; } break; case COMPARISON_LT: if (value < entry->value) { return TRUE; } break; case COMPARISON_EQ: if (value == entry->value) { return TRUE; } break; } return FALSE; } static gboolean count_rows_foreach (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { gint *rows = data; (*rows)++; return FALSE; } static void ensure_scrollbar (GtkBuilder *builder, int i) { if (i == <API key>) { GtkRequisition rectangle; GObject *actions_swindow = <API key> (builder, "actions_swindow"); GtkWidget *treeview = <API key> (builder, "shortcut_treeview"); <API key> (treeview); <API key> (treeview, &rectangle); <API key> (treeview, -1, rectangle.height); <API key> (GTK_SCROLLED_WINDOW (actions_swindow), GTK_POLICY_NEVER, <API key>); } } static void find_section (GtkTreeModel *model, GtkTreeIter *iter, const char *title) { gboolean success; success = <API key> (model, iter); while (success) { char *description = NULL; gtk_tree_model_get (model, iter, DESCRIPTION_COLUMN, &description, -1); if (g_strcmp0 (description, title) == 0) return; success = <API key> (model, iter); } <API key> (GTK_TREE_STORE (model), iter, NULL); gtk_tree_store_set (GTK_TREE_STORE (model), iter, DESCRIPTION_COLUMN, title, -1); } static void append_keys_to_tree (GtkBuilder *builder, const gchar *title, const gchar *schema, const gchar *package, const KeyListEntry *keys_list) { GtkTreeIter parent_iter, iter; GtkTreeModel *model; gint i, j; model = <API key> (GTK_TREE_VIEW (<API key> (builder, "shortcut_treeview"))); /* Try to find a section parent iter, if it already exists */ find_section (model, &iter, title); parent_iter = iter; i = 0; <API key> (model, count_rows_foreach, &i); /* If the header we just added is the <API key> th, * then we need to scroll now */ ensure_scrollbar (builder, i - 1); for (j = 0; keys_list[j].name != NULL; j++) { GSettings *settings = NULL; gchar *settings_path; KeyEntry *key_entry; const gchar *key_string; gchar *key_value; gchar *description; gchar *command; if (!should_show_key (&keys_list[j])) continue; if (<API key> (model, &keys_list[j])) continue; key_string = keys_list[j].name; if (keys_list[j].gsettings_path != NULL) { settings = <API key> (schema, keys_list[j].gsettings_path); settings_path = g_strdup(keys_list[j].gsettings_path); } else { settings = g_settings_new (schema); settings_path = NULL; } if (keys_list[j].description_key != NULL) { /* it's a custom shortcut, so description is in gsettings */ description = <API key> (settings, keys_list[j].description_key); } else { /* it's from keyfile, so description need to be translated */ description = keys_list[j].description; if (package) { <API key> (package, "UTF-8"); description = dgettext (package, description); } else { description = _(description); } } if (description == NULL) { /* Only print a warning for keys that should have a schema */ if (keys_list[j].description_key == NULL) g_warning ("No description for key '%s'", key_string); } if (keys_list[j].cmd_key != NULL) { command = <API key> (settings, keys_list[j].cmd_key); } else { command = NULL; } key_entry = g_new0 (KeyEntry, 1); key_entry->settings = settings; key_entry->gsettings_path = settings_path; key_entry->gsettings_key = g_strdup (key_string); key_entry->editable = <API key> (settings, key_string); key_entry->model = model; key_entry->description = description; key_entry->command = command; if (keys_list[j].description_key != NULL) { key_entry->desc_gsettings_key = g_strdup (keys_list[j].description_key); key_entry->desc_editable = <API key> (settings, key_entry->desc_gsettings_key); gchar *gsettings_signal = g_strconcat ("changed::", key_entry->desc_gsettings_key, NULL); key_entry->gsettings_cnxn_desc = g_signal_connect (settings, gsettings_signal, G_CALLBACK (<API key>), key_entry); g_free (gsettings_signal); } if (keys_list[j].cmd_key != NULL) { key_entry->cmd_gsettings_key = g_strdup (keys_list[j].cmd_key); key_entry->cmd_editable = <API key> (settings, key_entry->cmd_gsettings_key); gchar *gsettings_signal = g_strconcat ("changed::", key_entry->cmd_gsettings_key, NULL); key_entry->gsettings_cnxn_cmd = g_signal_connect (settings, gsettings_signal, G_CALLBACK (<API key>), key_entry); g_free (gsettings_signal); } gchar *gsettings_signal = g_strconcat ("changed::", key_string, NULL); key_entry->gsettings_cnxn = g_signal_connect (settings, gsettings_signal, G_CALLBACK (<API key>), key_entry); g_free (gsettings_signal); key_value = <API key> (settings, key_string); binding_from_string (key_value, &key_entry->keyval, &key_entry->keycode, &key_entry->mask); g_free (key_value); ensure_scrollbar (builder, i); ++i; <API key> (GTK_TREE_STORE (model), &iter, &parent_iter); /* we use the DESCRIPTION_COLUMN only for the section headers */ gtk_tree_store_set (GTK_TREE_STORE (model), &iter, KEYENTRY_COLUMN, key_entry, -1); <API key> (GTK_TREE_VIEW (<API key> (builder, "shortcut_treeview"))); } /* Don't show an empty section */ if (<API key> (model, &parent_iter) == 0) <API key> (GTK_TREE_STORE (model), &parent_iter); if (i == 0) gtk_widget_hide (<API key> (builder, "shortcuts_vbox")); else gtk_widget_show (<API key> (builder, "shortcuts_vbox")); } static void parse_start_tag (GMarkupParseContext *ctx, const gchar *element_name, const gchar **attr_names, const gchar **attr_values, gpointer user_data, GError **error) { KeyList *keylist = (KeyList *) user_data; KeyListEntry key; const char *name, *value_key, *description, *value_schema; int value; Comparison comparison; const char *schema = NULL; name = NULL; /* The top-level element, names the section in the tree */ if (g_str_equal (element_name, "KeyListEntries")) { const char *wm_name = NULL; const char *package = NULL; while (*attr_names && *attr_values) { if (g_str_equal (*attr_names, "name")) { if (**attr_values) name = *attr_values; } else if (g_str_equal (*attr_names, "wm_name")) { if (**attr_values) wm_name = *attr_values; } else if (g_str_equal (*attr_names, "package")) { if (**attr_values) package = *attr_values; } else if (g_str_equal (*attr_names, "schema")) { if (**attr_values) schema = *attr_values; } ++attr_names; ++attr_values; } if (name) { if (keylist->name) g_warning ("Duplicate section name"); g_free (keylist->name); keylist->name = g_strdup (name); } if (wm_name) { if (keylist->wm_name) g_warning ("Duplicate window manager name"); g_free (keylist->wm_name); keylist->wm_name = g_strdup (wm_name); } if (package) { if (keylist->package) g_warning ("Duplicate gettext package name"); g_free (keylist->package); keylist->package = g_strdup (package); } if (schema) { if (keylist->schema) g_warning ("Duplicate schema name"); g_free (keylist->schema); keylist->schema = g_strdup (schema); } return; } if (!g_str_equal (element_name, "KeyListEntry") || attr_names == NULL || attr_values == NULL) return; value = 0; comparison = COMPARISON_NONE; value_key = NULL; value_schema = NULL; description = NULL; while (*attr_names && *attr_values) { if (g_str_equal (*attr_names, "name")) { /* skip if empty */ if (**attr_values) name = *attr_values; } else if (g_str_equal (*attr_names, "value")) { if (**attr_values) { value = (int) g_ascii_strtoull (*attr_values, NULL, 0); } } else if (g_str_equal (*attr_names, "key")) { if (**attr_values) { value_key = *attr_values; } } else if (g_str_equal (*attr_names, "comparison")) { if (**attr_values) { if (g_str_equal (*attr_values, "gt")) { comparison = COMPARISON_GT; } else if (g_str_equal (*attr_values, "lt")) { comparison = COMPARISON_LT; } else if (g_str_equal (*attr_values, "eq")) { comparison = COMPARISON_EQ; } } } else if (g_str_equal (*attr_names, "description")) { if (**attr_values) { description = *attr_values; } } else if (g_str_equal (*attr_names, "schema")) { if (**attr_values) { value_schema = *attr_values; } } ++attr_names; ++attr_values; } if (name == NULL) return; key.name = g_strdup (name); key.gsettings_path = NULL; key.description_key = NULL; key.description = g_strdup(description); key.schema = g_strdup(schema); key.value = value; if (value_key) { key.value_key = g_strdup (value_key); key.value_schema = g_strdup (value_schema); } else { key.value_key = NULL; key.value_schema = NULL; } key.comparison = comparison; key.cmd_key = NULL; g_array_append_val (keylist->entries, key); } static gboolean strv_contains (char **strv, char *str) { char **p = strv; for (p = strv; *p; p++) if (strcmp (*p, str) == 0) return TRUE; return FALSE; } static void <API key> (GtkBuilder *builder, const char *filename, char **wm_keybindings) { GMarkupParseContext *ctx; GMarkupParser parser = { parse_start_tag, NULL, NULL, NULL, NULL }; KeyList *keylist; KeyListEntry key, *keys; GError *err = NULL; char *buf; const char *title; gsize buf_len; guint i; if (!g_file_get_contents (filename, &buf, &buf_len, &err)) return; keylist = g_new0 (KeyList, 1); keylist->entries = g_array_new (FALSE, TRUE, sizeof (KeyListEntry)); ctx = <API key> (&parser, 0, keylist, NULL); if (!<API key> (ctx, buf, buf_len, &err)) { g_warning ("Failed to parse '%s': '%s'", filename, err->message); g_error_free (err); g_free (keylist->name); g_free (keylist->package); g_free (keylist->wm_name); g_free (keylist->schema); for (i = 0; i < keylist->entries->len; i++) g_free (((KeyListEntry *) &(keylist->entries->data[i]))->name); g_array_free (keylist->entries, TRUE); g_free (keylist); keylist = NULL; } <API key> (ctx); g_free (buf); if (keylist == NULL) return; /* If there's no keys to add, or the settings apply to a window manager * that's not the one we're running */ if (keylist->entries->len == 0 || (keylist->wm_name != NULL && !strv_contains (wm_keybindings, keylist->wm_name)) || keylist->name == NULL) { g_free (keylist->name); g_free (keylist->package); g_free (keylist->wm_name); g_free (keylist->schema); g_array_free (keylist->entries, TRUE); g_free (keylist); return; } /* Empty KeyListEntry to end the array */ key.name = NULL; key.description_key = NULL; key.value_key = NULL; key.value = 0; key.comparison = COMPARISON_NONE; g_array_append_val (keylist->entries, key); keys = (KeyListEntry *) g_array_free (keylist->entries, FALSE); if (keylist->package) { <API key> (keylist->package, "UTF-8"); title = dgettext (keylist->package, keylist->name); } else { title = _(keylist->name); } append_keys_to_tree (builder, title, keylist->schema, keylist->package, keys); g_free (keylist->name); g_free (keylist->package); for (i = 0; keys[i].name != NULL; i++) g_free (keys[i].name); g_free (keylist); } static void <API key> (GtkBuilder *builder, const gchar *gsettings_path) { gchar **custom_list; GArray *entries; KeyListEntry key; gint i; /* load custom shortcuts from GSettings */ entries = g_array_new (FALSE, TRUE, sizeof (KeyListEntry)); key.value_key = NULL; key.value = 0; key.comparison = COMPARISON_NONE; custom_list = <API key> (gsettings_path, FALSE); if (custom_list != NULL) { for (i = 0; custom_list[i] != NULL; i++) { key.gsettings_path = g_strdup_printf("%s%s", gsettings_path, custom_list[i]); key.name = g_strdup("binding"); key.cmd_key = g_strdup("action"); key.description_key = g_strdup("name"); key.schema = NULL; g_array_append_val (entries, key); } } g_strfreev (custom_list); if (entries->len > 0) { KeyListEntry *keys; int i; /* Empty KeyListEntry to end the array */ key.gsettings_path = NULL; key.name = NULL; key.description_key = NULL; key.cmd_key = NULL; g_array_append_val (entries, key); keys = (KeyListEntry *) entries->data; append_keys_to_tree (builder, _("Custom Shortcuts"), <API key>, NULL, keys); for (i = 0; i < entries->len; ++i) { g_free (keys[i].name); g_free (keys[i].description_key); g_free (keys[i].cmd_key); g_free (keys[i].gsettings_path); } } g_array_free (entries, TRUE); } static void reload_key_entries (GtkBuilder *builder) { gchar **wm_keybindings; GDir *dir; const char *name; GList *list, *l; wm_keybindings = <API key>(); clear_old_model (builder); dir = g_dir_open (<API key>, 0, NULL); if (!dir) return; list = NULL; for (name = g_dir_read_name (dir) ; name ; name = g_dir_read_name (dir)) { if (g_str_has_suffix (name, ".xml")) { list = <API key> (list, g_strdup (name), (GCompareFunc) g_ascii_strcasecmp); } } g_dir_close (dir); for (l = list; l != NULL; l = l->next) { gchar *path; path = g_build_filename (<API key>, l->data, NULL); <API key> (builder, path, wm_keybindings); g_free (l->data); g_free (path); } g_list_free (list); /* Load custom shortcuts _after_ system-provided ones, * since some of the custom shortcuts may also be listed * in a file. Loading the custom shortcuts last makes * such keys not show up in the custom section. */ <API key> (builder, <API key>); g_strfreev (wm_keybindings); } static void <API key> (GSettings *settings, gchar *key, gpointer user_data) { reload_key_entries (user_data); } static gboolean <API key>(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, KeyEntry* new_key) { KeyEntry* element; gtk_tree_model_get (new_key->model, iter, KEYENTRY_COLUMN, &element, -1); /* no conflict for : blanks, different modifiers, or ourselves */ if (element == NULL || new_key->mask != element->mask) { return FALSE; } gchar *new_key_schema = NULL; gchar *element_schema = NULL; gchar *new_key_path = NULL; gchar *element_path = NULL; if (new_key && new_key->settings) { g_object_get (new_key->settings, "schema-id", &new_key_schema, NULL); g_object_get (new_key->settings, "path", &new_key_path, NULL); } if (element->settings) { g_object_get (element->settings, "schema-id", &element_schema, NULL); g_object_get (element->settings, "path", &element_path, NULL); } if (!g_strcmp0 (new_key->gsettings_key, element->gsettings_key) && !g_strcmp0 (new_key_schema, element_schema) && !g_strcmp0 (new_key_path, element_path)) { return FALSE; } if (new_key->keyval != 0) { if (new_key->keyval != element->keyval) { return FALSE; } } else if (element->keyval != 0 || new_key->keycode != element->keycode) { return FALSE; } new_key->editable = FALSE; new_key->settings = element->settings; new_key->gsettings_key = element->gsettings_key; new_key->description = element->description; new_key->desc_gsettings_key = element->desc_gsettings_key; new_key->desc_editable = element->desc_editable; return TRUE; } static const guint forbidden_keyvals[] = { /* Navigation keys */ GDK_Home, GDK_Left, GDK_Up, GDK_Right, GDK_Down, GDK_Page_Up, GDK_Page_Down, GDK_End, GDK_Tab, /* Return */ GDK_KP_Enter, GDK_Return, GDK_space, GDK_Mode_switch }; static gboolean keyval_is_forbidden(guint keyval) { guint i; for (i = 0; i < G_N_ELEMENTS(forbidden_keyvals); i++) { if (keyval == forbidden_keyvals[i]) { return TRUE; } } return FALSE; } static void show_error(GtkWindow* parent, GError* err) { GtkWidget *dialog; dialog = <API key> (parent, <API key> | GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, _("Error saving the new shortcut")); <API key> (GTK_MESSAGE_DIALOG (dialog), "%s", err->message); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } static void <API key>(GtkCellRendererText* cell, const char* path_string, guint keyval, <API key> mask, guint keycode, gpointer data) { GtkTreeView* view = (GtkTreeView*) data; GtkTreeModel* model; GtkTreePath* path = <API key> (path_string); GtkTreeIter iter; KeyEntry* key_entry, tmp_key; char* str; block_accels = FALSE; model = <API key> (view); <API key> (model, &iter, path); gtk_tree_path_free (path); gtk_tree_model_get (model, &iter, KEYENTRY_COLUMN, &key_entry, -1); /* sanity check */ if (key_entry == NULL) { return; } /* CapsLock isn't supported as a keybinding modifier, so keep it from confusing us */ mask &= ~<API key>; tmp_key.model = model; tmp_key.keyval = keyval; tmp_key.keycode = keycode; tmp_key.mask = mask; tmp_key.settings = key_entry->settings; tmp_key.gsettings_key = key_entry->gsettings_key; tmp_key.description = NULL; tmp_key.editable = TRUE; /* kludge to stuff in a return flag */ if (keyval != 0 || keycode != 0) /* any number of keys can be disabled */ { <API key>(model, (<API key>) <API key>, &tmp_key); } /* Check for unmodified keys */ if (tmp_key.mask == 0 && tmp_key.keycode != 0) { if ((tmp_key.keyval >= GDK_a && tmp_key.keyval <= GDK_z) || (tmp_key.keyval >= GDK_A && tmp_key.keyval <= GDK_Z) || (tmp_key.keyval >= GDK_0 && tmp_key.keyval <= GDK_9) || (tmp_key.keyval >= GDK_kana_fullstop && tmp_key.keyval <= GDK_semivoicedsound) || (tmp_key.keyval >= GDK_Arabic_comma && tmp_key.keyval <= GDK_Arabic_sukun) || (tmp_key.keyval >= GDK_Serbian_dje && tmp_key.keyval <= <API key>) || (tmp_key.keyval >= <API key> && tmp_key.keyval <= GDK_Greek_omega) || (tmp_key.keyval >= <API key> && tmp_key.keyval <= GDK_hebrew_taf) || (tmp_key.keyval >= GDK_Thai_kokai && tmp_key.keyval <= GDK_Thai_lekkao) || (tmp_key.keyval >= GDK_Hangul && tmp_key.keyval <= GDK_Hangul_Special) || (tmp_key.keyval >= GDK_Hangul_Kiyeog && tmp_key.keyval <= <API key>) || keyval_is_forbidden (tmp_key.keyval)) { GtkWidget *dialog; char *name; name = binding_name (keyval, keycode, mask, TRUE); dialog = <API key> ( GTK_WINDOW (<API key> (GTK_WIDGET (view))), <API key> | GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_CANCEL, _("The shortcut \"%s\" cannot be used because it will become impossible to type using this key.\n" "Please try with a key such as Control, Alt or Shift at the same time."), name); g_free (name); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); /* set it back to its previous value. */ <API key>( <API key>(cell), key_entry->keyval, key_entry->keycode, key_entry->mask); return; } } /* flag to see if the new accelerator was in use by something */ if (!tmp_key.editable) { GtkWidget* dialog; char* name; int response; name = binding_name(keyval, keycode, mask, TRUE); dialog = <API key>( GTK_WINDOW(<API key>(GTK_WIDGET(view))), <API key> | GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_CANCEL, _("The shortcut \"%s\" is already used for\n\"%s\""), name, tmp_key.description ? tmp_key.description : tmp_key.gsettings_key); g_free (name); <API key> ( GTK_MESSAGE_DIALOG (dialog), _("If you reassign the shortcut to \"%s\", the \"%s\" shortcut " "will be disabled."), key_entry->description ? key_entry->description : key_entry->gsettings_key, tmp_key.description ? tmp_key.description : tmp_key.gsettings_key); <API key>(GTK_DIALOG (dialog), _("_Reassign"), GTK_RESPONSE_ACCEPT); <API key>(GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); if (response == GTK_RESPONSE_ACCEPT) { <API key> (tmp_key.settings, tmp_key.gsettings_key, "disabled"); str = binding_name (keyval, keycode, mask, FALSE); <API key> (key_entry->settings, key_entry->gsettings_key, str); g_free (str); } else { /* set it back to its previous value. */ <API key>( <API key>(cell), key_entry->keyval, key_entry->keycode, key_entry->mask); } return; } str = binding_name (keyval, keycode, mask, FALSE); <API key>( key_entry->settings, key_entry->gsettings_key, str); g_free (str); } static void <API key> (GtkCellRendererText *cell, const char *path_string, gpointer data) { GtkTreeView *view = (GtkTreeView *) data; GtkTreePath *path = <API key> (path_string); KeyEntry *key_entry; GtkTreeIter iter; GtkTreeModel *model; block_accels = FALSE; model = <API key> (view); <API key> (model, &iter, path); gtk_tree_path_free (path); gtk_tree_model_get (model, &iter, KEYENTRY_COLUMN, &key_entry, -1); /* sanity check */ if (key_entry == NULL) return; /* Unset the key */ <API key> (key_entry->settings, key_entry->gsettings_key, "disabled"); } static void <API key> (GtkCellRendererText *renderer, gchar *path_string, gchar *new_text, gpointer user_data) { GtkTreeView *view = GTK_TREE_VIEW (user_data); GtkTreeModel *model; GtkTreePath *path = <API key> (path_string); GtkTreeIter iter; KeyEntry *key_entry; model = <API key> (view); <API key> (model, &iter, path); gtk_tree_path_free (path); gtk_tree_model_get (model, &iter, KEYENTRY_COLUMN, &key_entry, -1); /* sanity check */ if (key_entry == NULL || key_entry->desc_gsettings_key == NULL) return; if (!<API key> (key_entry->settings, key_entry->desc_gsettings_key, new_text)) key_entry->desc_editable = FALSE; } typedef struct { GtkTreeView *tree_view; GtkTreePath *path; GtkTreeViewColumn *column; } IdleData; static gboolean <API key> (IdleData *idle_data) { <API key> (GTK_WIDGET (idle_data->tree_view)); <API key> (idle_data->tree_view, idle_data->path, idle_data->column, TRUE); gtk_tree_path_free (idle_data->path); g_free (idle_data); return FALSE; } static gboolean <API key> (KeyEntry *key) { gint result; const gchar *text; gboolean ret; gtk_entry_set_text (GTK_ENTRY (<API key>), key->description ? key->description : ""); <API key> (<API key>, key->desc_editable); <API key> (<API key>); gtk_entry_set_text (GTK_ENTRY (<API key>), key->command ? key->command : ""); <API key> (<API key>, key->cmd_editable); gtk_window_present (GTK_WINDOW (<API key>)); result = gtk_dialog_run (GTK_DIALOG (<API key>)); switch (result) { case GTK_RESPONSE_OK: text = gtk_entry_get_text (GTK_ENTRY (<API key>)); g_free (key->description); key->description = g_strdup (text); text = gtk_entry_get_text (GTK_ENTRY (<API key>)); g_free (key->command); key->command = g_strdup (text); ret = TRUE; break; default: ret = FALSE; break; } gtk_widget_hide (<API key>); return ret; } static gboolean <API key> (GtkTreeModel *model, GtkTreeIter *iter) { GtkTreeIter parent; KeyEntry *key; gtk_tree_model_get (model, iter, KEYENTRY_COLUMN, &key, -1); /* not a custom shortcut */ if (key->command == NULL) return FALSE; <API key> (key->settings, key->gsettings_cnxn); if (key->gsettings_cnxn_desc != 0) <API key> (key->settings, key->gsettings_cnxn_desc); if (key->gsettings_cnxn_cmd != 0) <API key> (key->settings, key->gsettings_cnxn_cmd); <API key> (key->gsettings_path, NULL); g_object_unref (key->settings); g_free (key->gsettings_path); g_free (key->gsettings_key); g_free (key->description); g_free (key->desc_gsettings_key); g_free (key->command); g_free (key->cmd_gsettings_key); g_free (key); <API key> (model, &parent, iter); <API key> (GTK_TREE_STORE (model), iter); if (!<API key> (model, &parent)) <API key> (GTK_TREE_STORE (model), &parent); return TRUE; } static void <API key> (GtkTreeModel *model, GtkTreeIter *iter) { KeyEntry *key; gtk_tree_model_get (model, iter, KEYENTRY_COLUMN, &key, -1); <API key> (key); if (key->command == NULL || key->command[0] == '\0') { <API key> (model, iter); } else { gtk_tree_store_set (GTK_TREE_STORE (model), iter, KEYENTRY_COLUMN, key, -1); if (key->description != NULL) <API key> (key->settings, key->desc_gsettings_key, key->description); else g_settings_reset (key->settings, key->desc_gsettings_key); <API key> (key->settings, key->cmd_gsettings_key, key->command); } } static gchar * <API key> (GError **error) { gchar **existing_dirs; gchar *dir = NULL; gchar *fulldir = NULL; int i; int j; gboolean found; existing_dirs = <API key> (<API key>, FALSE); for (i = 0; i < <API key>; i++) { found = TRUE; dir = g_strdup_printf ("custom%d/", i); for (j = 0; existing_dirs[j] != NULL; j++) if (!g_strcmp0(dir, existing_dirs[j])) { found = FALSE; g_free (dir); break; } if (found) break; } g_strfreev (existing_dirs); if (i == <API key>) { g_free (dir); dir = NULL; g_set_error_literal (error, g_quark_from_string ("Keyboard Shortcuts"), 0, _("Too many custom shortcuts")); } fulldir = g_strdup_printf ("%s%s", <API key>, dir); g_free (dir); return fulldir; } static void add_custom_shortcut (GtkTreeView *tree_view, GtkTreeModel *model) { KeyEntry *key_entry; GtkTreeIter iter; GtkTreeIter parent_iter; GtkTreePath *path; gchar *dir; GError *error; error = NULL; dir = <API key> (&error); if (dir == NULL) { show_error (GTK_WINDOW (<API key> (GTK_WIDGET (tree_view))), error); g_error_free (error); return; } key_entry = g_new0 (KeyEntry, 1); key_entry->gsettings_path = g_strdup(dir); key_entry->gsettings_key = g_strdup("binding"); key_entry->editable = TRUE; key_entry->model = model; key_entry->desc_gsettings_key = g_strdup("name"); key_entry->description = g_strdup (""); key_entry->desc_editable = TRUE; key_entry->cmd_gsettings_key = g_strdup("action"); key_entry->command = g_strdup (""); key_entry->cmd_editable = TRUE; g_free (dir); if (<API key> (key_entry) && key_entry->command && key_entry->command[0]) { find_section (model, &iter, _("Custom Shortcuts")); parent_iter = iter; <API key> (GTK_TREE_STORE (model), &iter, &parent_iter); gtk_tree_store_set (GTK_TREE_STORE (model), &iter, KEYENTRY_COLUMN, key_entry, -1); /* store in gsettings */ key_entry->settings = <API key> (<API key>, key_entry->gsettings_path); <API key> (key_entry->settings, key_entry->gsettings_key, "disabled"); <API key> (key_entry->settings, key_entry->desc_gsettings_key, key_entry->description); <API key> (key_entry->settings, key_entry->cmd_gsettings_key, key_entry->command); /* add gsettings watches */ key_entry->gsettings_cnxn_desc = g_signal_connect (key_entry->settings, "changed::name", G_CALLBACK (<API key>), key_entry); key_entry->gsettings_cnxn_cmd = g_signal_connect (key_entry->settings, "changed::action", G_CALLBACK (<API key>), key_entry); key_entry->gsettings_cnxn = g_signal_connect (key_entry->settings, "changed::binding", G_CALLBACK (<API key>), key_entry); /* make the new shortcut visible */ path = <API key> (model, &iter); <API key> (tree_view, path); <API key> (tree_view, path, NULL, FALSE, 0, 0); gtk_tree_path_free (path); } else { g_free (key_entry->gsettings_path); g_free (key_entry->gsettings_key); g_free (key_entry->description); g_free (key_entry->desc_gsettings_key); g_free (key_entry->command); g_free (key_entry->cmd_gsettings_key); g_free (key_entry); } } static void start_editing_kb_cb (GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data) { GtkTreeModel *model; GtkTreeIter iter; KeyEntry *key; model = <API key> (treeview); <API key> (model, &iter, path); gtk_tree_model_get (model, &iter, KEYENTRY_COLUMN, &key, -1); if (key == NULL) { /* This is a section heading - expand or collapse */ if (<API key> (treeview, path)) <API key> (treeview, path); else <API key> (treeview, path, FALSE); return; } /* if only the accel can be edited on the selected row * always select the accel column */ if (key->desc_editable && column == <API key> (treeview, 0)) { <API key> (GTK_WIDGET (treeview)); <API key> (treeview, path, <API key> (treeview, 0), FALSE); <API key> (model, &iter); } else { <API key> (GTK_WIDGET (treeview)); <API key> (treeview, path, <API key> (treeview, 1), TRUE); } } static gboolean start_editing_cb (GtkTreeView *tree_view, GdkEventButton *event, gpointer user_data) { GtkTreePath *path; GtkTreeViewColumn *column; if (event->window != <API key> (tree_view)) return FALSE; if (<API key> (tree_view, (gint) event->x, (gint) event->y, &path, &column, NULL, NULL)) { IdleData *idle_data; GtkTreeModel *model; GtkTreeIter iter; KeyEntry *key; if (<API key> (path) == 1) { gtk_tree_path_free (path); return FALSE; } model = <API key> (tree_view); <API key> (model, &iter, path); gtk_tree_model_get (model, &iter, KEYENTRY_COLUMN, &key, -1); /* if only the accel can be edited on the selected row * always select the accel column */ if (key->desc_editable && column == <API key> (tree_view, 0)) { <API key> (GTK_WIDGET (tree_view)); <API key> (tree_view, path, <API key> (tree_view, 0), FALSE); <API key> (model, &iter); } else { idle_data = g_new (IdleData, 1); idle_data->tree_view = tree_view; idle_data->path = path; idle_data->column = key->desc_editable ? column : <API key> (tree_view, 1); g_idle_add ((GSourceFunc) <API key>, idle_data); block_accels = TRUE; } <API key> (tree_view, "button_press_event"); } return TRUE; } /* this handler is used to keep accels from activating while the user * is assigning a new shortcut so that he won't accidentally trigger one * of the widgets */ static gboolean maybe_block_accels(GtkWidget* widget, GdkEventKey* event, gpointer user_data) { if (block_accels) { return <API key>(GTK_WINDOW(widget), event); } return FALSE; } static void cb_dialog_response (GtkWidget *widget, gint response_id, gpointer data) { GtkBuilder *builder = data; GtkTreeView *treeview; GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; treeview = GTK_TREE_VIEW (<API key> (builder, "shortcut_treeview")); model = <API key> (treeview); if (response_id == GTK_RESPONSE_HELP) { capplet_help (GTK_WINDOW (widget), "goscustdesk-39"); } else if (response_id == RESPONSE_ADD) { add_custom_shortcut (treeview, model); } else if (response_id == RESPONSE_REMOVE) { selection = <API key> (treeview); if (<API key> (selection, NULL, &iter)) { <API key> (model, &iter); } } else { clear_old_model (builder); gtk_main_quit (); } } static void selection_changed (GtkTreeSelection *selection, gpointer data) { GtkWidget *button = data; GtkTreeModel *model; GtkTreeIter iter; KeyEntry *key; gboolean can_remove; can_remove = FALSE; if (<API key> (selection, &model, &iter)) { gtk_tree_model_get (model, &iter, KEYENTRY_COLUMN, &key, -1); if (key && key->command != NULL && key->editable) can_remove = TRUE; } <API key> (button, can_remove); } static void setup_dialog (GtkBuilder *builder, GSettings *marco_settings) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkWidget *widget; GtkTreeView *treeview; GtkTreeSelection *selection; treeview = GTK_TREE_VIEW (<API key> (builder, "shortcut_treeview")); g_signal_connect (treeview, "button_press_event", G_CALLBACK (start_editing_cb), builder); g_signal_connect (treeview, "row-activated", G_CALLBACK (start_editing_kb_cb), NULL); renderer = <API key> (); g_signal_connect (renderer, "edited", G_CALLBACK (<API key>), treeview); column = <API key> (_("Action"), renderer, "text", DESCRIPTION_COLUMN, NULL); <API key> (column, renderer, <API key>, NULL, NULL); <API key> (column, FALSE); <API key> (treeview, column); <API key> (column, DESCRIPTION_COLUMN); renderer = (GtkCellRenderer *) g_object_new (<API key>, "accel_mode", <API key>, NULL); g_signal_connect (renderer, "accel_edited", G_CALLBACK (<API key>), treeview); g_signal_connect (renderer, "accel_cleared", G_CALLBACK (<API key>), treeview); column = <API key> (_("Shortcut"), renderer, NULL); <API key> (column, renderer, accel_set_func, NULL, NULL); <API key> (column, FALSE); <API key> (treeview, column); <API key> (column, KEYENTRY_COLUMN); g_signal_connect (marco_settings, "changed::num-workspaces", G_CALLBACK (<API key>), builder); /* set up the dialog */ reload_key_entries (builder); #if GTK_CHECK_VERSION(3, 0, 0) widget = <API key> (builder, "<API key>"); <API key> (GTK_WINDOW (widget), 400, 500); widget = <API key> (builder, "label-suggest"); <API key> (GTK_LABEL (widget), TRUE); <API key> (GTK_LABEL (widget), 60); #endif widget = <API key> (builder, "<API key>"); capplet_set_icon (widget, "<API key>"); gtk_widget_show (widget); g_signal_connect (widget, "key_press_event", G_CALLBACK (maybe_block_accels), NULL); g_signal_connect (widget, "response", G_CALLBACK (cb_dialog_response), builder); selection = <API key> (GTK_TREE_VIEW (treeview)); g_signal_connect (selection, "changed", G_CALLBACK (selection_changed), <API key> (builder, "remove-button")); /* setup the custom shortcut dialog */ <API key> = <API key> (builder, "<API key>"); <API key> = <API key> (builder, "<API key>"); <API key> = <API key> (builder, "<API key>"); <API key> (GTK_DIALOG (<API key>), GTK_RESPONSE_OK); <API key> (GTK_WINDOW (<API key>), GTK_WINDOW (widget)); } static void <API key> (const char *wm_name, GtkBuilder *builder) { reload_key_entries (builder); } int main (int argc, char *argv[]) { GtkBuilder *builder; GSettings *marco_settings; gtk_init (&argc, &argv); bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); <API key> (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); gtk_init (&argc, &argv); <API key> (); builder = create_builder (); if (!builder) /* Warning was already printed to console */ exit (EXIT_FAILURE); <API key> ((GFunc) <API key>, builder); marco_settings = g_settings_new ("org.mate.Marco.general"); setup_dialog (builder, marco_settings); gtk_main (); g_object_unref (marco_settings); g_object_unref (builder); return 0; } /* * vim: sw=2 ts=8 cindent noai bs=2 */
jQuery('#bootstrapslider').carousel({ interval: <API key>.interval, pause: <API key>.pause, wrap: <API key>.wrap });
#include <stdlib.h> #include <qdir.h> #include <qfile.h> #include <qtextstream.h> #include <qintdict.h> #include "xmlgen.h" #include "doxygen.h" #include "message.h" #include "config.h" #include "classlist.h" #include "util.h" #include "defargs.h" #include "outputgen.h" #include "dot.h" #include "pagedef.h" #include "filename.h" #include "version.h" #include "xmldocvisitor.h" #include "docparser.h" #include "language.h" #include "parserintf.h" #include "arguments.h" #include "memberlist.h" #include "groupdef.h" #include "memberdef.h" #include "namespacedef.h" #include "membername.h" #include "membergroup.h" #include "dirdef.h" #include "section.h" // no debug info #define XML_DB(x) do {} while(0) // debug to stdout //#define XML_DB(x) printf x // debug inside output //#define XML_DB(x) QCString __t;__t.sprintf x;m_t << __t static const char index_xsd[] = #include "index_xsd.h" ; static const char compound_xsd[] = #include "compound_xsd.h" ; /** Helper class mapping MemberList::ListType to a string representing */ class XmlSectionMapper : public QIntDict<char> { public: XmlSectionMapper() : QIntDict<char>(47) { insert(<API key>,"public-type"); insert(<API key>,"public-func"); insert(<API key>,"public-attrib"); insert(<API key>,"public-slot"); insert(<API key>,"signal"); insert(<API key>,"dcop-func"); insert(<API key>,"property"); insert(<API key>,"event"); insert(<API key>,"public-static-func"); insert(<API key>,"<API key>"); insert(<API key>,"protected-type"); insert(<API key>,"protected-func"); insert(<API key>,"protected-attrib"); insert(<API key>,"protected-slot"); insert(<API key>,"<API key>"); insert(<API key>,"<API key>"); insert(<API key>,"package-type"); insert(<API key>,"package-func"); insert(<API key>,"package-attrib"); insert(<API key>,"package-static-func"); insert(<API key>,"<API key>"); insert(<API key>,"private-type"); insert(<API key>,"private-func"); insert(<API key>,"private-attrib"); insert(<API key>,"private-slot"); insert(<API key>,"private-static-func"); insert(<API key>,"<API key>"); insert(<API key>,"friend"); insert(<API key>,"related"); insert(<API key>,"define"); insert(<API key>,"prototype"); insert(<API key>,"typedef"); insert(<API key>,"enum"); insert(<API key>,"func"); insert(<API key>,"var"); } }; static XmlSectionMapper g_xmlSectionMapper; inline void writeXMLString(FTextStream &t,const char *s) { t << convertToXML(s); } inline void writeXMLCodeString(FTextStream &t,const char *s, int &col) { char c; while ((c=*s++)) { switch(c) { case '\t': { static int tabSize = Config_getInt("TAB_SIZE"); int spacesToNextTabStop = tabSize - (col%tabSize); col+=spacesToNextTabStop; while (spacesToNextTabStop--) t << "<sp/>"; break; } case ' ': t << "<sp/>"; col++; break; case '<': t << "&lt;"; col++; break; case '>': t << "&gt;"; col++; break; case '&': t << "&amp;"; col++; break; case '\'': t << "&apos;"; col++; break; case '"': t << "&quot;"; col++; break; default: t << c; col++; break; } } } static void writeXMLHeader(FTextStream &t) { t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>" << endl;; t << "<doxygen xmlns:xsi=\"http: t << "xsi:<API key>=\"compound.xsd\" "; t << "version=\"" << versionString << "\">" << endl; } static void writeCombineScript() { QCString outputDirectory = Config_getString("XML_OUTPUT"); QCString fileName=outputDirectory+"/combine.xslt"; QFile f(fileName); if (!f.open(IO_WriteOnly)) { err("Cannot open file %s for writing!\n",fileName.data()); return; } FTextStream t(&f); //t.setEncoding(FTextStream::UnicodeUTF8); t << "<!-- XSLT script to combine the generated output into a single file. \n" " If you have xsltproc you could use:\n" " xsltproc combine.xslt index.xml >all.xml\n" " "<xsl:stylesheet xmlns:xsl=\"http: " <xsl:output method=\"xml\" version=\"1.0\" indent=\"no\" standalone=\"yes\" />\n" " <xsl:template match=\"/\">\n" " <doxygen version=\"{doxygenindex/@version}\">\n" " <!-- Load all doxgen generated xml files -->\n" " <xsl:for-each select=\"doxygenindex/compound\">\n" /** Implements TextGeneratorIntf for an XML stream. */ void writeString(const char *s,bool /*keepSpaces*/) const /** Helper class representing a stack of objects stored by value */ /** Generator for producing XML formatted source code. */
<?php namespace Components\Events\Api; use Hubzero\Component\Router\Base; /** * Routing class for the component */ class Router extends Base { /** * Build the route for the component. * * @param array &$query An array of URL arguments * @return array The URL arguments to use to assemble the subsequent URL. */ public function build(&$query) { $segments = array(); if (!empty($query['controller'])) { $segments[] = $query['controller']; unset($query['controller']); } if (!empty($query['task'])) { $segments[] = $query['task']; unset($query['task']); } return $segments; } /** * Parse the segments of a URL. * * @param array &$segments The segments of the URL to parse. * @return array The URL attributes to be used by the application. */ public function parse(&$segments) { $vars = array(); $vars['controller'] = 'events'; if (isset($segments[0])) { if (is_numeric($segments[0])) { $vars['id'] = $segments[0]; if (\App::get('request')->method() == 'GET') { $vars['task'] = 'read'; } } else { $vars['task'] = $segments[0]; } } return $vars; } }
@echo off SETLOCAL REM http://dev.exiv2.org/projects/exiv2/repository/ SET EXIV2_COMMIT=3364 REM http://sourceforge.net/p/libjpeg-turbo/code/ SET LIBJPEG_COMMIT=1093 rem error 1406 rem https://github.com/madler/zlib/commits SET ZLIB_COMMIT_LONG=<SHA1-like> rem https://github.com/openexr/openexr SET OPENEXR_COMMIT_LONG=<SHA1-like> SET <API key>=2.2 rem http: SET BOOST_MINOR=55 REM ftp://ftp.fftw.org/pub/fftw/ SET FFTW_VER=3.3.4 rem https://github.com/mm2/Little-CMS SET LCMS_COMMIT_LONG=<SHA1-like> rem https://github.com/LibRaw/LibRaw SET LIBRAW_COMMIT_LONG=<SHA1-like> SET <API key>=<SHA1-like> SET <API key>=<SHA1-like> rem ftp://sourceware.org/pub/pthreads-win32/ SET PTHREADS_DIR=<API key> rem http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c SET CFITSIO_VER=3360 rem broken 3370 rem Internal version number for http://qtpfsgui.sourceforge.net/win/hugin-* SET HUGIN_VER=201300 IF EXIST .settings\vsexpress.txt ( SET VSCOMMAND=vcexpress ) ELSE IF EXIST .settings\devent.txt ( SET VSCOMMAND=devenv ) ELSE ( vcexpress XXXXXXXXXXXXX 2>NUL >NUL IF ERRORLEVEL 1 ( devenv /? 2>NUL >NUL IF ERRORLEVEL 1 ( echo. echo.ERROR: This file must be run inside a VS command prompt! echo. goto error_end ) ELSE ( SET VSCOMMAND=devenv ) ) ELSE ( SET VSCOMMAND=vcexpress ) mkdir .settings 2>NUL >NUL echo x>.settings\%VSCOMMAND%.txt ) IF EXIST ..\msvc ( echo. echo.ERROR: This file should NOT be executed within the LuminanceHDR source directory, echo. but in a new empty folder! echo. goto error_end ) ml64.exe > NUL IF ERRORLEVEL 1 ( set Platform=Win32 set RawPlatform=x86 set CpuPlatform=ia32 ) ELSE ( set Platform=x64 set RawPlatform=x64 set CpuPlatform=intel64 ) SET <API key>=%VCINSTALLDIR%\redist\%RawPlatform% IF DEFINED VS110COMNTOOLS ( REM Visual Studio 2012 set VS_SHORT=vc11 set VS_CMAKE=Visual Studio 11 set VS_PROG_FILES=Microsoft Visual Studio 11.0 ) ELSE IF DEFINED VS100COMNTOOLS ( REM Visual Studio 2010 set VS_SHORT=vc10 set VS_CMAKE=Visual Studio 10 set VS_PROG_FILES=Microsoft Visual Studio 10.0 ) ELSE ( REM Visual Studio 2008 set VS_SHORT=vc9 set VS_CMAKE=Visual Studio 9 2008 set VS_PROG_FILES=Microsoft Visual Studio 9.0 ) IF %Platform% EQU x64 ( set VS_CMAKE=%VS_CMAKE% Win64 ) call setenv.cmd IF NOT EXIST %CMAKE_DIR%\bin\cmake.exe ( echo. echo.ERROR: CMake not found: %CMAKE_DIR%\bin\cmake.exe echo. goto error_end ) IF NOT EXIST %CYGWIN_DIR%\bin\cp.exe GOTO cygwin_error IF NOT EXIST %CYGWIN_DIR%\bin\cvs.exe GOTO cygwin_error IF NOT EXIST %CYGWIN_DIR%\bin\git.exe GOTO cygwin_error IF NOT EXIST %CYGWIN_DIR%\bin\gzip.exe GOTO cygwin_error IF NOT EXIST %CYGWIN_DIR%\bin\mv.exe GOTO cygwin_error IF NOT EXIST %CYGWIN_DIR%\bin\nasm.exe GOTO cygwin_error IF NOT EXIST %CYGWIN_DIR%\bin\sed.exe GOTO cygwin_error IF NOT EXIST %CYGWIN_DIR%\bin\ssh.exe GOTO cygwin_error IF NOT EXIST %CYGWIN_DIR%\bin\svn.exe GOTO cygwin_error IF NOT EXIST %CYGWIN_DIR%\bin\tar.exe GOTO cygwin_error IF NOT EXIST %CYGWIN_DIR%\bin\unzip.exe GOTO cygwin_error IF NOT EXIST %CYGWIN_DIR%\bin\wget.exe GOTO cygwin_error GOTO cygwin_ok :cygwin_error echo ERROR: Cygwin with echo cp echo cvs echo git echo gzip echo mv echo nasm echo sed echo ssh echo svn echo tar echo unzip echo wget echo is required GOTO error_end :cygwin_ok IF NOT DEFINED Configuration ( set Configuration=Release ) IF NOT DEFINED <API key> ( set <API key>=RelWithDebInfo ) cls echo. echo. echo.Configuration = %Configuration% echo.<API key> = %<API key>% echo.Platform = %Platform% (%RawPlatform%) echo. IF NOT EXIST %TEMP_DIR% ( mkdir %TEMP_DIR% ) IF NOT EXIST vcDlls ( mkdir vcDlls robocopy "%vcinstalldir%redist\%RawPlatform%" vcDlls /MIR >nul ) IF NOT EXIST vcDlls\selected ( mkdir vcDlls\selected %CYGWIN_DIR%\bin\cp.exe vcDllsvcomp* vcDlls/selected %CYGWIN_DIR%\bin\cp.exe vcDllsmsv* vcDlls/selected ) IF NOT EXIST %TEMP_DIR%\hugin-%HUGIN_VER%-%RawPlatform%.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/hugin-%HUGIN_VER%-%RawPlatform%.zip qtpfsgui.sourceforge.net/win/hugin-%HUGIN_VER%-%RawPlatform%.zip ) IF NOT EXIST hugin-%HUGIN_VER%-%RawPlatform% ( %CYGWIN_DIR%\bin\unzip.exe -o -q -d hugin-%HUGIN_VER%-%RawPlatform% %TEMP_DIR%\hugin-%HUGIN_VER%-%RawPlatform%.zip ) SET ZLIB_COMMIT=%ZLIB_COMMIT_LONG:~0,7% IF NOT EXIST %TEMP_DIR%\zlib-%ZLIB_COMMIT%.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/zlib-%ZLIB_COMMIT%.zip --<API key> http://github.com/madler/zlib/zipball/%ZLIB_COMMIT_LONG% ) IF NOT EXIST zlib-%ZLIB_COMMIT% ( %CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/zlib-%ZLIB_COMMIT%.zip %CYGWIN_DIR%\bin\mv.exe madler-zlib-* zlib-%ZLIB_COMMIT% REM zlib must be compiled in the source folder, else exiv2 compilation REM fails due to zconf.h rename/compile problems, due to cmake pushd zlib-%ZLIB_COMMIT% %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" IF errorlevel 1 goto error_end %VSCOMMAND% zlib.sln /build "%Configuration%|%Platform%" /Project zlib IF errorlevel 1 goto error_end popd ) IF NOT EXIST %TEMP_DIR%\lpng170b35.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/lpng170b35.zip http://sourceforge.net/projects/libpng/files/libpng17/1.7.0beta35/lp170b35.zip/download IF errorlevel 1 goto error_end ) IF NOT EXIST lp170b35 ( %CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/lpng170b35.zip pushd lp170b35 %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" . -DZLIB_ROOT=..\zlib-%ZLIB_COMMIT%;..\zlib-%ZLIB_COMMIT%\%Configuration% IF errorlevel 1 goto error_end %VSCOMMAND% libpng.sln /build "%Configuration%|%Platform%" /Project png17 IF errorlevel 1 goto error_end popd ) IF NOT EXIST %TEMP_DIR%\expat-2.1.0.tar ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/expat-2.1.0.tar.gz http://sourceforge.net/projects/expat/files/expat/2.1.0/expat-2.1.0.tar.gz/download %CYGWIN_DIR%\bin\gzip.exe -d %TEMP_DIR%/expat-2.1.0.tar.gz ) IF NOT EXIST expat-2.1.0 ( %CYGWIN_DIR%\bin\tar.exe -xf %TEMP_DIR%/expat-2.1.0.tar pushd expat-2.1.0 %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" IF errorlevel 1 goto error_end %VSCOMMAND% expat.sln /build "%Configuration%|%Platform%" /Project expat IF errorlevel 1 goto error_end popd ) IF NOT EXIST exiv2-%EXIV2_COMMIT% ( %CYGWIN_DIR%\bin\svn.exe co -r %EXIV2_COMMIT% svn://dev.exiv2.org/svn/trunk exiv2-%EXIV2_COMMIT% pushd exiv2-%EXIV2_COMMIT% %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" -DZLIB_ROOT=..\zlib-%ZLIB_COMMIT%;..\zlib-%ZLIB_COMMIT%\Release IF errorlevel 1 goto error_end %VSCOMMAND% exiv2.sln /build "%Configuration%|%Platform%" /Project exiv2 IF errorlevel 1 goto error_end copy bin\%Platform%\Dynamic\*.h include popd ) IF NOT EXIST libjpeg-turbo-%LIBJPEG_COMMIT% ( %CYGWIN_DIR%\bin\svn.exe co -r %LIBJPEG_COMMIT% svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk libjpeg-turbo-%LIBJPEG_COMMIT% ) IF NOT EXIST libjpeg-turbo-%LIBJPEG_COMMIT%.build ( mkdir libjpeg-turbo-%LIBJPEG_COMMIT%.build pushd libjpeg-turbo-%LIBJPEG_COMMIT%.build %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" -DCMAKE_BUILD_TYPE=%Configuration% -DNASM="%CYGWIN_DIR%\bin\nasm.exe" -DWITH_JPEG8=TRUE ..\libjpeg-turbo-%LIBJPEG_COMMIT% IF errorlevel 1 goto error_end %VSCOMMAND% libjpeg-turbo.sln /build "%Configuration%|%Platform%" IF errorlevel 1 goto error_end copy jconfig.h ..\libjpeg-turbo-%LIBJPEG_COMMIT% popd ) SET LCMS_COMMIT=%LCMS_COMMIT_LONG:~0,7% IF NOT EXIST %TEMP_DIR%\lcms2-%LCMS_COMMIT%.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/lcms2-%LCMS_COMMIT%.zip --<API key> https://github.com/mm2/Little-CMS/zipball/%LCMS_COMMIT_LONG% ) IF NOT EXIST lcms2-%LCMS_COMMIT% ( %CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/lcms2-%LCMS_COMMIT%.zip %CYGWIN_DIR%\bin\mv.exe mm2-Little-CMS-* lcms2-%LCMS_COMMIT% pushd lcms2-%LCMS_COMMIT% %VSCOMMAND% Projects\VC2010\lcms2.sln /Upgrade %VSCOMMAND% Projects\VC2010\lcms2.sln /build "%Configuration%|%Platform%" /Project lcms2_DLL IF errorlevel 1 goto error_end popd ) IF NOT EXIST %TEMP_DIR%\tiff-4.0.3.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/tiff-4.0.3.zip http://download.osgeo.org/libtiff/tiff-4.0.3.zip ) IF NOT EXIST tiff-4.0.3 ( %CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/tiff-4.0.3.zip echo.JPEG_SUPPORT=^1> tiff-4.0.3\qtpfsgui_commands.in echo.JPEGDIR=%CD%\libjpeg-turbo-%LIBJPEG_COMMIT%>> tiff-4.0.3\qtpfsgui_commands.in echo.JPEG_INCLUDE=-I%CD%\libjpeg-turbo-%LIBJPEG_COMMIT%>> tiff-4.0.3\qtpfsgui_commands.in echo.JPEG_LIB=%CD%\libjpeg-turbo-%LIBJPEG_COMMIT%.build\sharedlib\%Configuration%\jpeg.lib>> tiff-4.0.3\qtpfsgui_commands.in echo.ZIP_SUPPORT=^1>> tiff-4.0.3\qtpfsgui_commands.in echo.ZLIBDIR=..\..\zlib-%ZLIB_COMMIT%\%Configuration%>> tiff-4.0.3\qtpfsgui_commands.in echo.ZLIB_INCLUDE=-I..\..\zlib-%ZLIB_COMMIT%>> tiff-4.0.3\qtpfsgui_commands.in echo.ZLIB_LIB=$^(ZLIBDIR^)\zlib.lib>> tiff-4.0.3\qtpfsgui_commands.in pushd tiff-4.0.3 nmake /s /c /f Makefile.vc @qtpfsgui_commands.in IF errorlevel 1 goto error_end popd ) SET LIBRAW_COMMIT=%LIBRAW_COMMIT_LONG:~0,7% SET <API key>=%<API key>:~0,7% SET <API key>=%<API key>:~0,7% IF NOT EXIST %TEMP_DIR%\LibRaw-%LIBRAW_COMMIT%.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/LibRaw-%LIBRAW_COMMIT%.zip --<API key> https://github.com/LibRaw/LibRaw/zipball/%LIBRAW_COMMIT_LONG% ) IF NOT EXIST %TEMP_DIR%\<API key>-%<API key>%.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/<API key>-%<API key>%.zip --<API key> https://github.com/LibRaw/<API key>/zipball/%<API key>% ) IF NOT EXIST <API key>-%<API key>% ( %CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/<API key>-%<API key>%.zip %CYGWIN_DIR%\bin\mv.exe LibRaw-LibRaw-* <API key>-%<API key>% ) IF NOT EXIST %TEMP_DIR%\<API key>-%<API key>%.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/<API key>-%<API key>%.zip --<API key> https://github.com/LibRaw/<API key>/zipball/%<API key>% ) IF NOT EXIST <API key>-%<API key>% ( %CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/<API key>-%<API key>%.zip %CYGWIN_DIR%\bin\mv.exe LibRaw-LibRaw-* <API key>-%<API key>% ) IF NOT EXIST LibRaw-%LIBRAW_COMMIT% ( %CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/LibRaw-%LIBRAW_COMMIT%.zip %CYGWIN_DIR%\bin\mv.exe LibRaw-LibRaw-* LibRaw-%LIBRAW_COMMIT% pushd LibRaw-%LIBRAW_COMMIT% rem /openmp echo.COPT_OPT="/arch:SSE2"> qtpfsgui_commands.in echo.CFLAGS_DP2=/I..\<API key>-%<API key>%>> qtpfsgui_commands.in echo.CFLAGSG2=/<API key>>> qtpfsgui_commands.in echo.CFLAGS_DP3=/I..\<API key>-%<API key>%>> qtpfsgui_commands.in echo.CFLAGSG3=/<API key>>> qtpfsgui_commands.in echo.LCMS_DEF="/DUSE_LCMS2 /DCMS_DLL /I..\lcms2-%LCMS_COMMIT%\include">> qtpfsgui_commands.in echo.LCMS_LIB="..\lcms2-%LCMS_COMMIT%\bin\lcms2.lib">> qtpfsgui_commands.in echo.JPEG_DEF="/DUSE_JPEG8 /DUSE_JPEG /I..\libjpeg-turbo-%LIBJPEG_COMMIT%">> qtpfsgui_commands.in echo.JPEG_LIB="..\libjpeg-turbo-%LIBJPEG_COMMIT%.build\sharedlib\%Configuration%\jpeg.lib">> qtpfsgui_commands.in nmake /f Makefile.msvc @qtpfsgui_commands.in clean > nul nmake /f Makefile.msvc @qtpfsgui_commands.in bin\libraw.dll popd ) SET <API key>=pthreads_%PTHREADS_DIR%_%RawPlatform% IF NOT EXIST %TEMP_DIR%\%<API key>% ( mkdir %TEMP_DIR%\%<API key>% pushd %TEMP_DIR%\%<API key>% %CYGWIN_DIR%\bin\wget.exe -O pthread.h --retry-connrefused --tries=5 ftp://sourceware.org/pub/pthreads-win32/%PTHREADS_DIR%/include/pthread.h %CYGWIN_DIR%\bin\wget.exe -O sched.h --retry-connrefused --tries=5 ftp://sourceware.org/pub/pthreads-win32/%PTHREADS_DIR%/include/sched.h %CYGWIN_DIR%\bin\wget.exe -O semaphore.h --retry-connrefused --tries=5 ftp://sourceware.org/pub/pthreads-win32/%PTHREADS_DIR%/include/semaphore.h %CYGWIN_DIR%\bin\wget.exe -O pthreadVC2.dll --retry-connrefused --tries=5 ftp://sourceware.org/pub/pthreads-win32/%PTHREADS_DIR%/dll/%RawPlatform%/pthreadVC2.dll %CYGWIN_DIR%\bin\wget.exe -O pthreadVC2.lib --retry-connrefused --tries=5 ftp://sourceware.org/pub/pthreads-win32/%PTHREADS_DIR%/lib/%RawPlatform%/pthreadVC2.lib popd ) IF NOT EXIST %<API key>% ( mkdir %<API key>% robocopy %TEMP_DIR%\%<API key>% %<API key>% >nul ) IF NOT EXIST %TEMP_DIR%\cfit%CFITSIO_VER%.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/cfit%CFITSIO_VER%.zip ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfit%CFITSIO_VER%.zip ) IF NOT EXIST cfit%CFITSIO_VER% ( %CYGWIN_DIR%\bin\unzip.exe -o -q -d cfit%CFITSIO_VER% %TEMP_DIR%/cfit%CFITSIO_VER%.zip ) IF NOT EXIST cfit%CFITSIO_VER%.build ( mkdir cfit%CFITSIO_VER%.build pushd cfit%CFITSIO_VER%.build %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" ..\cfit%CFITSIO_VER% -DUSE_PTHREADS=1 -DCMAKE_INCLUDE_PATH=..\%<API key>% -DCMAKE_LIBRARY_PATH=..\%<API key>% IF errorlevel 1 goto error_end %CMAKE_DIR%\bin\cmake.exe --build . --config %Configuration% --target cfitsio IF errorlevel 1 goto error_end popd ) pushd cfit%CFITSIO_VER% SET CFITSIO=%CD% popd pushd cfit%CFITSIO_VER%.build\%Configuration% SET CFITSIO=%CFITSIO%;%CD% popd rem IF NOT EXIST %TEMP_DIR%\CCfits-2.4.tar ( rem %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/CCfits-2.4.tar.gz http://heasarc.gsfc.nasa.gov/docs/software/fitsio/CCfits/CCfits-2.4.tar.gz rem %CYGWIN_DIR%\bin\gzip.exe -d %TEMP_DIR%/CCfits-2.4.tar.gz rem %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/CCfits2.4patch.zip http://qtpfsgui.sourceforge.net/win/CCfits2.4patch.zip rem ) rem IF NOT EXIST CCfits2.4 ( rem %CYGWIN_DIR%\bin\tar.exe -xf %TEMP_DIR%/CCfits-2.4.tar rem ren CCfits CCfits2.4 rem %CYGWIN_DIR%\bin\unzip.exe -o -q -d CCfits2.4 %TEMP_DIR%/CCfits2.4patch.zip rem ) rem IF NOT EXIST CCfits2.4.build ( rem mkdir CCfits2.4.build rem rem pushd CCfits2.4.build rem %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" ..\CCfits2.4 -DCMAKE_INCLUDE_PATH=..\cfit%CFITSIO_VER% -DCMAKE_LIBRARY_PATH=..\cfit%CFITSIO_VER%.build\%Configuration% rem IF errorlevel 1 goto error_end rem %CMAKE_DIR%\bin\cmake.exe --build . --config %Configuration% --target CCfits rem IF errorlevel 1 goto error_end rem popd rem ) rem pushd CCfits2.4.build\%Configuration% rem SET CCFITS_ROOT_DIR=%CD% rem popd IF NOT EXIST %TEMP_DIR%\gsl-1.15.tar ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/gsl-1.15.tar.gz ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz %CYGWIN_DIR%\bin\gzip -d %TEMP_DIR%/gsl-1.15.tar.gz ) IF NOT EXIST %TEMP_DIR%\gsl-1.15-vc10.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/gsl-1.15-vc10.zip http://gladman.plushost.co.uk/oldsite/computing/gsl-1.15-vc10.zip ) IF NOT EXIST gsl-1.15 ( %CYGWIN_DIR%\bin\tar.exe -xf %TEMP_DIR%/gsl-1.15.tar %CYGWIN_DIR%\bin\unzip.exe -o -q -d gsl-1.15 %TEMP_DIR%/gsl-1.15-vc10.zip pushd gsl-1.15\build.vc10 IF %VS_SHORT% EQU vc9 ( %CYGWIN_DIR%\bin\sed.exe -i 's/Format Version 11.00/Format Version 10.00/g' gsl.lib.sln ) %VSCOMMAND% gsl.lib.sln /Upgrade %VSCOMMAND% gsl.lib.sln /build "%Configuration%|%Platform%" /Project gslhdrs gslhdrs\%Platform%\%Configuration%\gslhdrs.exe %VSCOMMAND% gsl.lib.sln /build "%Configuration%|%Platform%" /Project gsllib popd ) SET OPENEXR_COMMIT=%OPENEXR_COMMIT_LONG:~0,7% IF NOT EXIST %TEMP_DIR%\OpenEXR-dk-%OPENEXR_COMMIT%.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/OpenEXR-dk-%OPENEXR_COMMIT%.zip --<API key> https://github.com/openexr/openexr/zipball/%OPENEXR_COMMIT_LONG% ) IF NOT EXIST OpenEXR-dk-%OPENEXR_COMMIT% ( %CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/OpenEXR-dk-%OPENEXR_COMMIT%.zip %CYGWIN_DIR%\bin\mv.exe openexr-openexr-* OpenEXR-dk-%OPENEXR_COMMIT% ) IF NOT EXIST OpenEXR-dk-%OPENEXR_COMMIT%\IlmBase.build ( mkdir OpenEXR-dk-%OPENEXR_COMMIT%\IlmBase.build pushd OpenEXR-dk-%OPENEXR_COMMIT%\IlmBase.build %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" -DCMAKE_BUILD_TYPE=%Configuration% -<API key>=..\output -DZLIB_ROOT=..\..\zlib-%ZLIB_COMMIT%;..\..\zlib-%ZLIB_COMMIT%\%Configuration% -DBUILD_SHARED_LIBS=OFF ../IlmBase IF errorlevel 1 goto error_end %VSCOMMAND% IlmBase.sln /build "%Configuration%|%Platform%" IF errorlevel 1 goto error_end %VSCOMMAND% IlmBase.sln /build "%Configuration%|%Platform%" /Project INSTALL IF errorlevel 1 goto error_end popd ) IF NOT EXIST OpenEXR-dk-%OPENEXR_COMMIT%\OpenEXR.build ( mkdir OpenEXR-dk-%OPENEXR_COMMIT%\OpenEXR.build pushd OpenEXR-dk-%OPENEXR_COMMIT%\OpenEXR.build %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" -DCMAKE_BUILD_TYPE=%Configuration% ^ -DZLIB_ROOT=..\..\zlib-%ZLIB_COMMIT%;..\..\zlib-%ZLIB_COMMIT%\%Configuration% ^ -<API key>=%CD%\OpenEXR-dk-%OPENEXR_COMMIT%\output -DBUILD_SHARED_LIBS=OFF ^ -<API key>=..\output ^ ../OpenEXR IF errorlevel 1 goto error_end %VSCOMMAND% OpenEXR.sln /build "%Configuration%|%Platform%" /Project IlmImf IF errorlevel 1 goto error_end %VSCOMMAND% OpenEXR.sln /build "%Configuration%|%Platform%" /Project INSTALL IF errorlevel 1 goto error_end popd ) IF %Platform% EQU Win32 ( IF NOT EXIST %TEMP_DIR%\fftw-%FFTW_VER%-dll32.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/fftw-%FFTW_VER%-dll32.zip ftp://ftp.fftw.org/pub/fftw/fftw-%FFTW_VER%-dll32.zip ) ) ELSE ( IF NOT EXIST %TEMP_DIR%\fftw-%FFTW_VER%-dll64.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/fftw-%FFTW_VER%-dll64.zip ftp://ftp.fftw.org/pub/fftw/fftw-%FFTW_VER%-dll64.zip ) ) IF NOT EXIST fftw-%FFTW_VER%-dll ( IF %Platform% EQU Win32 ( %CYGWIN_DIR%\bin\unzip.exe -q -d fftw-%FFTW_VER%-dll %TEMP_DIR%/fftw-%FFTW_VER%-dll32.zip ) ELSE ( %CYGWIN_DIR%\bin\unzip.exe -q -d fftw-%FFTW_VER%-dll %TEMP_DIR%/fftw-%FFTW_VER%-dll64.zip ) pushd fftw-%FFTW_VER%-dll lib /def:libfftw3-3.def lib /def:libfftw3f-3.def lib /def:libfftw3l-3.def popd ) REM IF NOT EXIST %TEMP_DIR%\<API key>.zip ( REM %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/<API key>.zip "http://<API key>.org/uploads/77/187/4.0 update 5/<API key>.zip" REM ) REM REM IF NOT EXIST tbb40_20120613oss ( REM %CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/<API key>.zip REM REM Everthing is already compiled, nothing to do! REM ) REM IF NOT EXIST %TEMP_DIR%\gtest-1.6.0.zip ( SET GTEST_DIR=gtest-r680 IF NOT EXIST %GTEST_DIR% ( REM %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/gtest-1.6.0.zip http://googletest.googlecode.com/files/gtest-1.6.0.zip %CYGWIN_DIR%\bin\svn.exe co -r 680 http://googletest.googlecode.com/svn/trunk/ %GTEST_DIR% pushd %GTEST_DIR% %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" . -DBUILD_SHARED_LIBS=1 %VSCOMMAND% gtest.sln /build "%Configuration%|%Platform%" REN Release lib popd ) SET GTEST_ROOT=%CD%\%GTEST_DIR% REM IF NOT EXIST %GTEST_DIR%.build ( REM mkdir %GTEST_DIR%.build REM pushd %GTEST_DIR%.build REM %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" ..\%GTEST_DIR% -DBUILD_SHARED_LIBS=1 REM %VSCOMMAND% gtest.sln /build "%Configuration%|%Platform%" REM popd REM ) REM IF NOT EXIST gtest-1.6.0 ( REM %CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/gtest-1.6.0.zip REM ) IF NOT DEFINED L_BOOST_DIR ( set L_BOOST_DIR=. ) IF NOT EXIST %TEMP_DIR%\boost_1_%BOOST_MINOR%_0.zip ( %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/boost_1_%BOOST_MINOR%_0.zip http://sourceforge.net/projects/boost/files/boost/1.%BOOST_MINOR%.0/boost_1_%BOOST_MINOR%_0.zip/download ) IF NOT EXIST %L_BOOST_DIR%\boost_1_%BOOST_MINOR%_0 ( echo.Extracting boost. Be patient! pushd %L_BOOST_DIR% %CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/boost_1_%BOOST_MINOR%_0.zip popd pushd %L_BOOST_DIR%\boost_1_%BOOST_MINOR%_0 bootstrap.bat popd pushd %L_BOOST_DIR%\boost_1_%BOOST_MINOR%_0 IF %Platform% EQU Win32 ( IF %Configuration% EQU Release ( cmd.exe /C b2.exe toolset=msvc variant=release ) ELSE ( cmd.exe /C b2.exe toolset=msvc variant=debug ) ) ELSE ( IF %Configuration% EQU Release ( cmd.exe /C b2.exe toolset=msvc variant=release address-model=64 ) ELSE ( cmd.exe /C b2.exe toolset=msvc variant=debug address-model=64 ) ) popd ) REM Set Boost-directory as ENV variable (needed for CMake) pushd %L_BOOST_DIR%\boost_1_%BOOST_MINOR%_0 rem SET Boost_DIR=%CD% REM SET BOOST_ROOT=%CD% popd IF NOT EXIST LuminanceHdrStuff ( mkdir LuminanceHdrStuff ) IF NOT EXIST LuminanceHdrStuff\qtpfsgui ( pushd LuminanceHdrStuff %CYGWIN_DIR%\bin\git.exe clone git://git.code.sf.net/p/qtpfsgui/code qtpfsgui popd ) ELSE ( pushd LuminanceHdrStuff\qtpfsgui IF %<API key>% EQU 1 ( %CYGWIN_DIR%\bin\git.exe pull ) popd ) IF NOT EXIST LuminanceHdrStuff\DEPs ( pushd LuminanceHdrStuff mkdir DEPs cd DEPs mkdir include mkdir lib mkdir bin popd for %%v in ("libpng", "libjpeg", "lcms2", "exiv2", "libtiff", "libraw", "fftw3", "gsl", "CCfits") do ( mkdir LuminanceHdrStuff\DEPs\include\%%v mkdir LuminanceHdrStuff\DEPs\lib\%%v mkdir LuminanceHdrStuff\DEPs\bin\%%v ) mkdir LuminanceHdrStuff\DEPs\include\libraw\libraw mkdir LuminanceHdrStuff\DEPs\include\gsl\gsl copy gsl-1.15\gsl\*.h LuminanceHdrStuff\DEPs\include\gsl\gsl copy gsl-1.15\build.vc10\lib\%Platform%\%Configuration%\*.lib LuminanceHdrStuff\DEPs\lib\gsl rem copy gsl-1.15\build.vc10\dll\*.dll LuminanceHdrStuff\DEPs\bin\gsl ) robocopy fftw-%FFTW_VER%-dll LuminanceHdrStuff\DEPs\include\fftw3 *.h /MIR >nul robocopy fftw-%FFTW_VER%-dll LuminanceHdrStuff\DEPs\lib\fftw3 *.lib /MIR /NJS >nul robocopy fftw-%FFTW_VER%-dll LuminanceHdrStuff\DEPs\bin\fftw3 *.dll /MIR /NJS >nul robocopy tiff-4.0.3\libtiff LuminanceHdrStuff\DEPs\include\libtiff *.h /MIR >nul robocopy tiff-4.0.3\libtiff LuminanceHdrStuff\DEPs\lib\libtiff *.lib /MIR /NJS >nul robocopy tiff-4.0.3\libtiff LuminanceHdrStuff\DEPs\bin\libtiff *.dll /MIR /NJS >nul rem robocopy expat: included indirectly in in exiv2 rem robocopy zlib: included indirectly in in exiv2 robocopy exiv2-%EXIV2_COMMIT%\include LuminanceHdrStuff\DEPs\include\exiv2 *.h *.hpp /MIR >nul robocopy exiv2-%EXIV2_COMMIT%\bin\%Platform%\Dynamic\%Configuration% LuminanceHdrStuff\DEPs\lib\exiv2 *.lib /MIR >nul robocopy exiv2-%EXIV2_COMMIT%\bin\%Platform%\Dynamic\%Configuration% LuminanceHdrStuff\DEPs\bin\exiv2 *.dll /MIR >nul robocopy lp170b35 LuminanceHdrStuff\DEPs\include\libpng *.h /MIR >nul robocopy lp170b35\%Configuration% LuminanceHdrStuff\DEPs\lib\libpng *.lib /MIR >nul robocopy lp170b35\%Configuration% LuminanceHdrStuff\DEPs\bin\libpng *.dll /MIR >nul robocopy LibRaw-%LIBRAW_COMMIT%\libraw LuminanceHdrStuff\DEPs\include\libraw\libraw /MIR >nul robocopy LibRaw-%LIBRAW_COMMIT%\lib LuminanceHdrStuff\DEPs\lib\libraw *.lib /MIR >nul robocopy LibRaw-%LIBRAW_COMMIT%\bin LuminanceHdrStuff\DEPs\bin\libraw *.dll /MIR >nul robocopy lcms2-%LCMS_COMMIT%\include LuminanceHdrStuff\DEPs\include\lcms2 *.h /MIR >nul robocopy lcms2-%LCMS_COMMIT%\bin LuminanceHdrStuff\DEPs\lib\lcms2 *.lib /MIR /NJS >nul rem robocopy lcms2-%LCMS_COMMIT%\bin LuminanceHdrStuff\DEPs\bin\lcms2 *.dll /MIR /NJS >nul robocopy libjpeg-turbo-%LIBJPEG_COMMIT% LuminanceHdrStuff\DEPs\include\libjpeg *.h /MIR >nul robocopy libjpeg-turbo-%LIBJPEG_COMMIT%.build\sharedlib\%Configuration% LuminanceHdrStuff\DEPs\lib\libjpeg *.lib /MIR /NJS >nul robocopy libjpeg-turbo-%LIBJPEG_COMMIT%.build\sharedlib\%Configuration% LuminanceHdrStuff\DEPs\bin\libjpeg *.dll /MIR /NJS >nul REM robocopy tbb40_20120613oss\include LuminanceHdrStuff\DEPs\include\tbb /MIR >nul REM robocopy tbb40_20120613oss\lib\%CpuPlatform%\%VS_SHORT% LuminanceHdrStuff\DEPs\lib\tbb /MIR >nul REM robocopy tbb40_20120613oss\bin\%CpuPlatform%\%VS_SHORT% LuminanceHdrStuff\DEPs\bin\tbb /MIR >nul robocopy CCfits2.4 LuminanceHdrStuff\DEPs\include\CCfits *.h CCfits /MIR >nul pushd LuminanceHdrStuff\DEPs\include SET CCFITS_ROOT_DIR=%CCFITS_ROOT_DIR%;%CD% popd IF NOT EXIST LuminanceHdrStuff\qtpfsgui.build ( mkdir LuminanceHdrStuff\qtpfsgui.build ) pushd LuminanceHdrStuff\qtpfsgui.build IF %<API key>% EQU 1 ( set CMAKE_OPTIONS=-<API key>=1 ) ELSE ( set CMAKE_OPTIONS=-<API key> ) IF %<API key>% EQU 1 ( set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DLUPDATE_NOOBSOLETE=1 ) ELSE ( set CMAKE_OPTIONS=%CMAKE_OPTIONS% -ULUPDATE_NOOBSOLETE ) set L_CMAKE_INCLUDE=..\DEPs\include\libtiff;..\DEPs\include\libpng;..\..\zlib-%ZLIB_COMMIT%;..\..\boost_1_%BOOST_MINOR%_0;..\..\OpenEXR-dk-%OPENEXR_COMMIT%\output\include set L_CMAKE_LIB=..\DEPs\lib\libtiff;..\DEPs\lib\libpng;..\..\zlib-%ZLIB_COMMIT%\%Configuration%;..\..\boost_1_%BOOST_MINOR%_0\stage\lib;..\..\OpenEXR-dk-%OPENEXR_COMMIT%\output\lib set <API key>=%CYGWIN_DIR%\bin set L_CMAKE_PREFIX_PATH=%QTDIR% set CMAKE_OPTIONS=%CMAKE_OPTIONS% -<API key>=..\DEPs\include\exiv2 -DPC_EXIV2_LIBDIR=..\DEPs\lib\exiv2 -DCMAKE_INCLUDE_PATH=%L_CMAKE_INCLUDE% -DCMAKE_LIBRARY_PATH=%L_CMAKE_LIB% -DCMAKE_PROGRAM_PATH=%<API key>% -DCMAKE_PREFIX_PATH=%L_CMAKE_PREFIX_PATH% -DPNG_NAMES=libpng16;libpng17 -DOPENEXR_VERSION=%<API key>% REM IF EXIST ..\..\gtest-1.6.0 ( REM SET GTEST_ROOT=%CD%\..\..\gtest-1.6.0 REM ) echo CMake command line options echo %CMAKE_OPTIONS% echo %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" ..\qtpfsgui %CMAKE_OPTIONS% IF errorlevel 1 goto error_end popd IF EXIST LuminanceHdrStuff\qtpfsgui.build\Luminance HDR.sln ( pushd LuminanceHdrStuff\qtpfsgui.build rem %VSCOMMAND% luminance-hdr.sln /Upgrade %VSCOMMAND% "Luminance HDR.sln" /build "%<API key>%|%Platform%" /Project luminance-hdr IF errorlevel 1 goto error_end popd ) IF EXIST LuminanceHdrStuff\qtpfsgui.build\%<API key>%\luminance-hdr.exe ( IF EXIST LuminanceHdrStuff\qtpfsgui.build\%<API key>% ( robocopy LuminanceHdrStuff\qtpfsgui LuminanceHdrStuff\qtpfsgui.build\%<API key>% LICENSE >nul IF NOT EXIST LuminanceHdrStuff\qtpfsgui.build\%<API key>%\align_image_stack.exe ( copy vcDlls\selected\* LuminanceHdrStuff\qtpfsgui.build\%<API key>%\ ) pushd LuminanceHdrStuff\DEPs\bin robocopy libjpeg ..\..\qtpfsgui.build\%<API key>% jpeg8.dll >nul robocopy exiv2 ..\..\qtpfsgui.build\%<API key>% exiv2.dll >nul robocopy exiv2 ..\..\qtpfsgui.build\%<API key>% zlib.dll >nul robocopy exiv2 ..\..\qtpfsgui.build\%<API key>% expat.dll >nul robocopy libraw ..\..\qtpfsgui.build\%<API key>% libraw.dll >nul robocopy fftw3 ..\..\qtpfsgui.build\%<API key>% libfftw3f-3.dll >nul robocopy libpng ..\..\qtpfsgui.build\%<API key>% libpng17.dll >nul popd robocopy cfit%CFITSIO_VER%.build\%Configuration% LuminanceHdrStuff\qtpfsgui.build\%<API key>% cfitsio.dll >nul robocopy %<API key>% LuminanceHdrStuff\qtpfsgui.build\%<API key>% pthreadVC2.dll >nul robocopy lcms2-%LCMS_COMMIT%\bin LuminanceHdrStuff\qtpfsgui.build\%<API key>% lcms2.dll >nul IF NOT EXIST LuminanceHdrStuff\qtpfsgui.build\%<API key>%\i18n\ ( mkdir LuminanceHdrStuff\qtpfsgui.build\%<API key>%\i18n ) IF NOT EXIST LuminanceHdrStuff\qtpfsgui.build\%<API key>%\help\ ( mkdir LuminanceHdrStuff\qtpfsgui.build\%<API key>%\help ) robocopy LuminanceHdrStuff\qtpfsgui.build LuminanceHdrStuff\qtpfsgui.build\%<API key>%\i18n lang_*.qm >nul robocopy LuminanceHdrStuff\qtpfsgui\help LuminanceHdrStuff\qtpfsgui.build\%<API key>%\help /MIR >nul REM pushd LuminanceHdrStuff\qtpfsgui.build\%<API key>% for %%v in ( "Qt5Concurrent.dll", "Qt5Core.dll", "Qt5Gui.dll", "Qt5Multimedia.dll", "<API key>.dll", "Qt5Network.dll", "Qt5Positioning.dll", "Qt5WinExtras.dll", "Qt5OpenGL.dll", "Qt5PrintSupport.dll", "Qt5Qml.dll", "Qt5Quick.dll", "Qt5Sensors.dll", "Qt5Sql.dll", "Qt5V8.dll", "Qt5WebKit.dll", "Qt5WebKitWidgets.dll", "Qt5Widgets.dll", "Qt5Xml.dll", "icudt51.dll", "icuin51.dll", "icuuc51.dll" ) do ( robocopy %QTDIR%\bin . %%v >nul ) for %%v in ("imageformats", "sqldrivers", "platforms") do ( IF NOT EXIST %%v ( mkdir %%v ) ) robocopy %QTDIR%\plugins\imageformats imageformats qjpeg.dll >nul robocopy %QTDIR%\plugins\sqldrivers sqldrivers qsqlite.dll >nul robocopy %QTDIR%\plugins\platforms platforms qwindows.dll >nul robocopy %QTDIR%\translations i18n qt_??.qm >nul robocopy %QTDIR%\translations i18n qt_??_*.qm >nul popd robocopy hugin-%HUGIN_VER%-%RawPlatform% LuminanceHdrStuff\qtpfsgui.build\%<API key>%\hugin /MIR >nul ) ) goto end :error_end pause :end endlocal
<!DOCTYPE HTML PUBLIC "- <!--NewPage <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_23) on Tue Nov 10 20:55:20 CET 2015 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> Uses of Class org.slf4j.profiler.<API key> (SLF4J 1.7.13 Test API) </TITLE> <META NAME="date" CONTENT="2015-11-10"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.slf4j.profiler.<API key> (SLF4J 1.7.13 Test API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <A NAME="navbar_top"></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../org/slf4j/profiler/<API key>.html" title="class in org.slf4j.profiler"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?org/slf4j/profiler/\<API key>.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="<API key>.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <HR> <CENTER> <H2> <B>Uses of Class<br>org.slf4j.profiler.<API key></B></H2> </CENTER> No usage of org.slf4j.profiler.<API key> <P> <HR> <A NAME="navbar_bottom"></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="<API key>"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../org/slf4j/profiler/<API key>.html" title="class in org.slf4j.profiler"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?org/slf4j/profiler/\<API key>.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="<API key>.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <HR> Copyright & </BODY> </HTML>
// This file is part of pninexus. // pninexus is free software: you can redistribute it and/or modify // (at your option) any later version. // pninexus is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #ifdef __GNUG__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-<API key>" #endif #include <boost/test/unit_test.hpp> #ifdef __GNUG__ #pragma GCC diagnostic pop #endif #include <pni/arrays.hpp> #include "array_types.hpp" #include "../data_generator.hpp" #include "../compiler_version.hpp" using namespace pni; template<typename AT> struct <API key> { typedef AT array_type; typedef typename array_type::value_type value_type; typedef typename array_type::storage_type storage_type; typedef typename array_type::map_type map_type; typedef random_generator<value_type> generator_type; generator_type generator; shape_t shape; <API key>(): generator(), shape(shape_t{2,3,5}) {} }; <API key>(test_mdarray) typedef boost::mpl::joint_view<all_dynamic_arrays, #if GCC_VERSION > 40800 boost::mpl::joint_view< <API key><3>, all_static_arrays<2,3,5> > #else <API key><3> #endif > array_types; template<typename CTYPE,typename...ITYPES> static void create_index(CTYPE &index,ITYPES ...indexes) { index = CTYPE{indexes...}; } template<typename T,size_t N,typename ...ITYPES> static void create_index(std::array<T,N> &c,ITYPES ...indexes) { c = std::array<T,N>{{indexes...}}; } template< typename ITYPE, typename ATYPE > void <API key>() { typedef <API key><ATYPE> fixture_type; typedef typename fixture_type::value_type value_type; fixture_type fixture; auto a = ATYPE::create(fixture.shape); ITYPE index; for(size_t i=0;i<fixture.shape[0];i++) for(size_t j=0;j<fixture.shape[1];j++) for(size_t k=0;k<fixture.shape[2];k++) { value_type v = fixture.generator(); create_index(index,i,j,k); a(index) = v; BOOST_CHECK_EQUAL(a(index),v); } } // Create a mdarray instance from a view <API key>(<API key>,AT,array_types) { typedef <API key><AT> fixture_type; typedef typename fixture_type::value_type value_type; typedef dynamic_array<value_type> darray_type; fixture_type fixture; auto a = darray_type::create(shape_t{100,20,30}); std::generate(a.begin(),a.end(),fixture.generator); auto view = a(slice(0,2),slice(0,3),slice(0,5)); AT target(view); auto view_shape = view.template shape<shape_t>(); auto target_shape = target.template shape<shape_t>(); <API key>(view_shape.begin(),view_shape.end(), target_shape.begin(),target_shape.end()); BOOST_CHECK_EQUAL(view.size(),target.size()); BOOST_CHECK_EQUAL(view.rank(),target.rank()); <API key>(view.begin(),view.end(), target.begin(),target.end()); } <API key>(test_is_view_index) { BOOST_CHECK((is_view_index<size_t,size_t,size_t>::value==false)); BOOST_CHECK((is_view_index<slice,size_t,size_t>::value==true)); BOOST_CHECK((is_view_index<size_t,slice,size_t>::value==true)); BOOST_CHECK((is_view_index<size_t,size_t,slice>::value==true)); } <API key>(test_inquery,AT,array_types) { typedef <API key><AT> fixture_type; typedef typename fixture_type::value_type value_type; fixture_type fixture; auto a = AT::create(fixture.shape); BOOST_CHECK_EQUAL(a.size(),30u); BOOST_CHECK_EQUAL(a.rank(),3u); BOOST_CHECK(AT::type_id == type_id_map<value_type>::type_id); } <API key>(<API key>,AT,array_types) { typedef <API key><AT> fixture_type; typedef typename fixture_type::value_type value_type; fixture_type fixture; auto a = AT::create(fixture.shape); const AT &ca = a; for(size_t index=0;index<a.size();++index) { value_type v = fixture.generator(); a[index] = v; BOOST_CHECK_EQUAL(a[index],v); BOOST_CHECK_EQUAL(ca[index],v); } } <API key>(<API key>,AT,array_types) { typedef <API key><AT> fixture_type; fixture_type fixture; auto a = AT::create(fixture.shape); std::generate(a.begin(),a.end(),fixture.generator); auto ptr = a.data(); for(size_t index=0;index<a.size();++index) BOOST_CHECK_EQUAL(a[index],*(ptr++)); } <API key>(<API key>,AT,array_types) { typedef <API key><AT> fixture_type; typedef typename fixture_type::value_type value_type; fixture_type fixture; auto a = AT::create(fixture.shape); const AT &ca = a; for(size_t index=0;index<a.size();++index) { value_type v = fixture.generator(); a.at(index) = v; BOOST_CHECK_EQUAL(a.at(index),v); BOOST_CHECK_EQUAL(ca.at(index),v); } BOOST_CHECK_THROW(a.at(a.size()),index_error); } <API key>(<API key>,AT,array_types) { typedef <API key><AT> fixture_type; typedef typename fixture_type::value_type value_type; fixture_type fixture; auto a = AT::create(fixture.shape); typename AT::iterator iter = a.begin(); typename AT::const_iterator citer = a.begin(); for(;iter!=a.end();++iter,++citer) { value_type v = fixture.generator(); *iter = v; BOOST_CHECK_EQUAL(*iter,v); BOOST_CHECK_EQUAL(*citer,v); } } <API key>(<API key>,AT,array_types) { typedef <API key><AT> fixture_type; typedef typename fixture_type::value_type value_type; fixture_type fixture; auto a = AT::create(fixture.shape); typename AT::reverse_iterator iter = a.rbegin(); typename AT::<API key> citer = a.rbegin(); for(;iter!=a.rend();++iter,++citer) { value_type v = fixture.generator(); *iter = v; BOOST_CHECK_EQUAL(*iter,v); BOOST_CHECK_EQUAL(*citer,v); } } <API key>(<API key>,AT,array_types) { typedef <API key><AT> fixture_type; typedef typename fixture_type::value_type value_type; fixture_type fixture; auto a = AT::create(fixture.shape); for(size_t i=0;i<fixture.shape[0];i++) for(size_t j=0;j<fixture.shape[1];j++) for(size_t k=0;k<fixture.shape[2];k++) { value_type v = fixture.generator(); a(i,j,k) = v; BOOST_CHECK_EQUAL(a(i,j,k),v); } } <API key>(<API key>,AT,array_types) { <API key><std::vector<size_t>,AT>(); <API key><std::array<size_t,3>,AT>(); <API key><std::list<size_t>,AT>(); <API key><std::vector<uint64>,AT>(); <API key><std::array<uint64,3>,AT>(); <API key><std::list<uint64>,AT>(); } <API key>()
/** * Setup (required for Joomla! 3) */ if(typeof(akeeba) == 'undefined') { var akeeba = {}; } if(typeof(akeeba.jQuery) == 'undefined') { akeeba.jQuery = jQuery.noConflict(); } akeeba.jQuery(document).ready(function($){ function atsAssignmentClick() { var parent = akeeba.jQuery(this).parent('td'); var id = akeeba.jQuery(this).parents('td').find('input.ticket_id').val(); var hide = ['.loading img', '.loading .icon-warning-sign']; var show = ['.loading .icon-ok']; var assign_to = 0; if(akeeba.jQuery(this).hasClass('assignme')) { assign_to = akeeba.jQuery('#user').val(); } else if(akeeba.jQuery(this).parent('.assignto')) { assign_to = akeeba.jQuery(this).parent().find('input.assignto').val(); } if(this.hasClass('unassign')){ hide.push('.unassign'); show.push('.assignme'); } else{ hide.push('.assignme'); show.push('.unassign'); } var structure = { _rootElement: this, type: "POST", dataType: 'json', url : ATS_ROOT_URL + 'index.php?option=com_ats&view=ticket&format=json&' + akeeba.jQuery('#token').attr('name') + '=1', data: { 'task' : 'assign', 'id' : id, 'assigned_to' : assign_to }, beforeSend: function() { var wait = akeeba.jQuery(this._rootElement).parents('td').find('.loading'); wait.css('display','inline').find('i').css('display', 'none'); wait.find('img').css('display', 'inline-block'); }, success: function(responseJSON) { var assigned = akeeba.jQuery(this._rootElement).parents('td').find('.assigned_to'); var unassign = akeeba.jQuery(this._rootElement).hasClass('unassign'); if(responseJSON.result == true){ assigned.html(responseJSON.assigned); unassign ? assigned.removeClass('badge-info') : assigned.addClass('badge-info'); for (var i = 0; i < hide.length; i++) { var elementDefinition = hide[i]; akeeba.jQuery(this._rootElement).parents('td').find(elementDefinition).css('display', 'none'); } for (var i = 0; i < show.length; i++) { var elementDefinition = show[i]; akeeba.jQuery(this._rootElement).parents('td').find(elementDefinition).css('display', 'inline-block'); } } else { var wait = akeeba.jQuery(this._rootElement).parents('td').find('.loading'); wait.find('.icon-ok,img').css('display', 'none'); wait.find('.icon-warning-sign').show('fast'); } } }; akeeba.jQuery.ajax( structure ); } akeeba.jQuery('.unassign a').click(atsAssignmentClick); akeeba.jQuery('.assignme a').click(atsAssignmentClick); akeeba.jQuery('.assignto li a').click(atsAssignmentClick); akeeba.jQuery('.select-status li a').click(function(){ var image = akeeba.jQuery(this).parent().find('img'); var self = this; akeeba.jQuery.ajax(ATS_ROOT_URL + 'index.php?option=com_ats&view=tickets&task=ajax_set_status&format=json&'+jQuery('#token').attr('name')+'=1',{ type : 'POST', dataType : 'json', data : { 'id' : akeeba.jQuery(this).parents('tr').find('.ats_ticket_id').val(), 'status' : akeeba.jQuery(this).data('status') }, beforeSend : function(){ image.show(); }, success : function(responseJSON){ image.hide(); if(responseJSON.err){ alert(responseJSON.err); } else{ var label = akeeba.jQuery(self).parents('td').find('span[class*="label-"]'); label.attr('class', 'ats-status label pull-right ' + responseJSON.ats_class).html(responseJSON.msg); } } }) }) });
#define _XOPEN_SOURCE 500 // for pread() #include "fscache.h" #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <stdbool.h> #include <stddef.h> #include <errno.h> #include <string.h> #include <unistd.h> #include <sys/stat.h> #include <sys/statvfs.h> #include <sys/types.h> #include <dirent.h> #include <fcntl.h> #include <libgen.h> #include <limits.h> #include <pthread.h> static pthread_mutex_t lock; #define BACKFS_LOG_SUBSYS "Cache" #include "global.h" #include "fsll.h" #include "util.h" extern int backfs_log_level; extern bool backfs_log_stderr; static char *cache_dir; static uint64_t cache_size; static volatile uint64_t cache_used_size = 0; struct bucket_node { uint32_t number; struct bucket_node* next; }; static struct bucket_node * volatile to_check; static bool use_whole_device; static uint64_t bucket_max_size; uint64_t <API key>(const char *root) { INFO("taking inventory of cache directory\n"); uint64_t total = 0; struct dirent *e = malloc(offsetof(struct dirent, d_name) + PATH_MAX + 1); struct dirent *result = e; DIR *dir = opendir(root); struct bucket_node* volatile * next = &to_check; while (readdir_r(dir, e, &result) == 0 && result != NULL) { if (e->d_name[0] < '0' || e->d_name[0] > '9') continue; *next = (struct bucket_node*)malloc(sizeof(struct bucket_node)); (*next)->number = atoi(e->d_name); next = &((*next)->next); *next = NULL; ++total; } closedir(dir); FREE(e); return total; } /* * returns the bucket number corresponding to a bucket path * i.e. reads the number off the end. */ uint32_t <API key>(const char *bucketpath) { uint32_t number = 0; size_t s = strlen(bucketpath); size_t i; for (i = 1; i < s; i++) { char c = bucketpath[s - i]; if (c < '0' || c > '9') { i break; } } for (i = s - i; i < s; i++) { number *= 10; number += (bucketpath[i] - '0'); } return number; } bool is_unchecked(const char* path) { uint32_t number = <API key>(path); struct bucket_node* node = to_check; while(node) { if (node->number == number) return true; node = node->next; } return false; } void* check_buckets_size(void* arg) { INFO("starting cache size check\n"); struct stat s; struct bucket_node* bucket; if (arg != NULL) { abort(); } char buf[PATH_MAX]; while (to_check) { pthread_mutex_lock(&lock); bucket = to_check; if (bucket) { s.st_size = 0; snprintf(buf, PATH_MAX, "%s/buckets/%u/data", cache_dir, bucket->number); if (stat(buf, &s) == -1 && errno != ENOENT) { PERROR("stat in get_cache_used_size"); ERROR("\tcaused by stat(%s)\n", buf); abort(); } DEBUG("bucket %u: %llu bytes\n", bucket->number, (unsigned long long) s.st_size); cache_used_size -= bucket_max_size - s.st_size; to_check = bucket->next; } <API key>(&lock); free(bucket); } INFO("finished cache size check: %llu bytes used\n", cache_used_size); return NULL; } uint64_t <API key>(const char *root) { struct statvfs s; if (statvfs(root, &s) == -1) { PERROR("statfs in <API key>"); return 0; } uint64_t dev_free = (uint64_t) s.f_bavail * s.f_bsize; return dev_free; } /* * Initialize the cache. */ void cache_init(const char *a_cache_dir, uint64_t a_cache_size, uint64_t a_bucket_max_size) { cache_dir = (char*)malloc(strlen(a_cache_dir)+1); strcpy(cache_dir, a_cache_dir); cache_size = a_cache_size; use_whole_device = (cache_size == 0); char bucket_dir[PATH_MAX]; snprintf(bucket_dir, PATH_MAX, "%s/buckets", cache_dir); uint64_t number_of_buckets = <API key>(bucket_dir); INFO("%llu buckets in cache dir\n", (unsigned long long) number_of_buckets); cache_used_size = number_of_buckets * a_bucket_max_size; INFO("Estimated %llu bytes used in cache dir\n", (unsigned long long) cache_used_size); uint64_t cache_free_size = <API key>(bucket_dir); INFO("%llu bytes free in cache dir\n", (unsigned long long) cache_free_size); bucket_max_size = a_bucket_max_size; if (number_of_buckets > 0) { pthread_t thread; if (pthread_create(&thread, NULL, &check_buckets_size, NULL) != 0) { PERROR("cache_init: error creating checked thread"); abort(); } } } const char * bucketname(const char *path) { return fsll_basename(path); } void dump_queues() { #ifdef FSLL_DUMP fprintf(stderr, "BackFS Used Bucket Queue:\n"); fsll_dump(cache_dir, "buckets/head", "buckets/tail"); fprintf(stderr, "BackFS Free Bucket Queue:\n"); fsll_dump(cache_dir, "buckets/free_head", "buckets/free_tail"); #endif //FSLL_DUMP } /* * don't use this function directly. */ char * makebucket(uint64_t number) { char *new_bucket = fsll_make_entry(cache_dir, "buckets", number); fsll_insert_as_head(cache_dir, new_bucket, "buckets/head", "buckets/tail"); return new_bucket; } /* * make a new bucket * * either re-use one from the free queue, * or increment the next_bucket_number file and return that. * * If one from the free queue is returned, that bucket is made the head of the * used queue. */ char * next_bucket(void) { char *bucket = fsll_getlink(cache_dir, "buckets/free_head"); if (bucket != NULL) { DEBUG("re-using free bucket %s\n", bucketname(bucket)); // disconnect from free queue fsll_disconnect(cache_dir, bucket, "buckets/free_head", "buckets/free_tail"); // make head of the used queue fsll_insert_as_head(cache_dir, bucket, "buckets/head", "buckets/tail"); return bucket; } else { char nbnpath[PATH_MAX]; snprintf(nbnpath, PATH_MAX, "%s/buckets/next_bucket_number", cache_dir); uint64_t next = 0; FILE *f = fopen(nbnpath, "r+"); if (f == NULL && errno != ENOENT) { PERROR("open next_bucket"); return makebucket(0); } else { if (f != NULL) { // we had a number already there; read it if (fscanf(f, "%llu", (unsigned long long *)&next) != 1) { ERROR("unable to read next_bucket\n"); fclose(f); return makebucket(0); } f = freopen(nbnpath, "w+", f); } else { // next_bucket_number doesn't exist; create it and write a 1. f = fopen(nbnpath, "w+"); if (f == NULL) { PERROR("open next_bucket again"); return makebucket(0); } } // write the next number if (f == NULL) { PERROR("fdopen for writing in next_bucket"); return makebucket(0); } fprintf(f, "%llu\n", (unsigned long long) next+1); fclose(f); } DEBUG("making new bucket %lu\n", (unsigned long) next); char *new_bucket = makebucket(next); return new_bucket; } } /* * moves a bucket to the head of the used queue */ void bucket_to_head(const char *bucketpath) { DEBUG("bucket_to_head(%s)\n", bucketpath); fsll_to_head(cache_dir, bucketpath, "buckets/head", "buckets/tail"); } /* * Starting at the dirname of path, remove empty directories upwards in the * path heirarchy. * * Stops when it gets to <cache_dir>/buckets or <cache_dir>/map */ void trim_directory(const char *path) { size_t len = strlen(path); char *copy = (char*)malloc(len+1); strncpy(copy, path, len+1); char map[PATH_MAX]; char buckets[PATH_MAX]; snprintf(map, PATH_MAX, "%s/map", cache_dir); snprintf(buckets, PATH_MAX, "%s/buckets", cache_dir); char *dir = dirname(copy); while ((strcmp(dir, map) != 0) && (strcmp(dir, buckets) != 0)) { DIR *d = opendir(dir); struct dirent *e; bool found_mtime = false; while ((e = readdir(d)) != NULL) { if (e->d_name[0] == '.') continue; // remove mtime files, if found if (strcmp(e->d_name, "mtime") == 0) { struct stat s; char mtime[PATH_MAX]; snprintf(mtime, PATH_MAX, "%s/mtime", dir); stat(mtime, &s); if (S_IFREG & s.st_mode) { found_mtime = true; continue; } } // if we got here, the directory has entries DEBUG("directory has entries -- in %s found '%s'\n", dir, e->d_name); closedir(d); FREE(copy); return; } if (found_mtime) { char mtime[PATH_MAX]; snprintf(mtime, PATH_MAX, "%s/mtime", dir); if (unlink(mtime) == -1) { PERROR("in trim_directory, unable to unlink mtime file"); ERROR("\tpath was %s\n", mtime); } else { DEBUG("removed mtime file %s/mtime\n", dir); } } closedir(d); d = NULL; int result = rmdir(dir); if (result == -1) { if (errno != EEXIST && errno != ENOTEMPTY) { PERROR("in trim_directory, rmdir"); } WARN("in trim_directory, directory still not empty, but how? path was %s\n", dir); FREE(copy); return; } else { DEBUG("removed empty map directory %s\n", dir); } dir = dirname(dir); } FREE(copy); } /* * free a bucket * * moves bucket from the tail of the used queue to the tail of the free queue, * deletes the data in the bucket * returns the size of the data deleted */ uint64_t free_bucket_real(const char *bucketpath, bool <API key>) { char *parent = fsll_getlink(bucketpath, "parent"); if (parent && fsll_file_exists(parent, NULL)) { DEBUG("bucket parent: %s\n", parent); if (unlink(parent) == -1) { PERROR("unlink parent in free_bucket"); } // if this was the last block, remove the directory trim_directory(parent); } FREE(parent); fsll_makelink(bucketpath, "parent", NULL); if (<API key>) { char *n = fsll_getlink(bucketpath, "next"); if (n != NULL) { ERROR("bucket freed (#%lu) was not the queue tail\n", (unsigned long) <API key>(bucketpath)); FREE(n); return 0; } } fsll_disconnect(cache_dir, bucketpath, "buckets/head", "buckets/tail"); fsll_insert_as_tail(cache_dir, bucketpath, "buckets/free_head", "buckets/free_tail"); char data[PATH_MAX]; snprintf(data, PATH_MAX, "%s/data", bucketpath); struct stat s; if (stat(data, &s) == -1) { PERROR("stat data in free_bucket"); } pthread_mutex_lock(&lock); uint64_t result = 0; if (unlink(data) == -1) { PERROR("unlink data in free_bucket"); } else { result = (uint64_t) s.st_size; if (!is_unchecked(bucketpath)) { cache_used_size -= result; } } <API key>(&lock); return result; } uint64_t <API key>(const char *bucketpath) { return free_bucket_real(bucketpath, false); } uint64_t free_bucket(const char *bucketpath) { return free_bucket_real(bucketpath, true); } /* * do not use this function directly */ int <API key>(const char *filename, uint32_t block, const char *bucket) { DEBUG("invalidating block %lu of file %s\n", (unsigned long) block, filename); uint64_t freed_size = <API key>(bucket); DEBUG("freed %llu bytes in bucket %s\n", (unsigned long long) freed_size, bucketname(bucket)); return 0; } int <API key>(const char *filename, bool error_if_not_exist) { char mappath[PATH_MAX]; snprintf(mappath, PATH_MAX, "%s/map%s", cache_dir, filename); DIR *d = opendir(mappath); if (d == NULL) { if (errno != ENOENT || error_if_not_exist) { PERROR("opendir in cache_invalidate"); } return -errno; } struct dirent *e = malloc(offsetof(struct dirent, d_name) + PATH_MAX + 1); struct dirent *result = e; while (readdir_r(d, e, &result) == 0 && result != NULL) { // probably not needed, because trim_directory would take care of the // mtime file, but might as well do it now to save time. if (strcmp(e->d_name, "mtime") == 0) { char mtime[PATH_MAX]; snprintf(mtime, PATH_MAX, "%s/mtime", mappath); DEBUG("removed mtime file %s\n", mtime); unlink(mtime); continue; } if (e->d_name[0] < '0' || e->d_name[0] > '9') continue; char *bucket = fsll_getlink(mappath, e->d_name); uint32_t block; sscanf(e->d_name, "%lu", (unsigned long *)&block); <API key>(filename, block, bucket); FREE(bucket); } FREE(e); closedir(d); return 0; } int <API key>(const char *filename, bool error_if_not_exist) { pthread_mutex_lock(&lock); int retval = <API key>(filename, error_if_not_exist); <API key>(&lock); return retval; } int <API key>(const char *filename) { return <API key>(filename, true); } int <API key>(const char *filename) { return <API key>(filename, false); } int <API key>(const char *filename, uint32_t block, bool warn_if_not_exist) { char mappath[PATH_MAX]; snprintf(mappath, PATH_MAX, "map%s/%lu", filename, (unsigned long) block); pthread_mutex_lock(&lock); char *bucket = fsll_getlink(cache_dir, mappath); if (bucket == NULL) { if (warn_if_not_exist) { WARN("Cache invalidation: block %lu of file %s doesn't exist.\n", (unsigned long) block, filename); } <API key>(&lock); return -ENOENT; } <API key>(filename, block, bucket); FREE(bucket); <API key>(&lock); return 0; } int <API key>(const char *filename, uint32_t block) { return <API key>(filename, block, true); } int <API key>(const char *filename, uint32_t block) { return <API key>(filename, block, false); } int <API key>(const char *filename, uint32_t block) { DEBUG("trying to invalidate blocks >= %ld in %s\n", block, filename); int ret = 0; DIR *mapdir = NULL; bool locked = false; struct dirent *e = NULL; char mappath[PATH_MAX]; snprintf(mappath, PATH_MAX, "%s/map%s", cache_dir, filename); pthread_mutex_lock(&lock); locked = true; mapdir = opendir(mappath); if (mapdir == NULL) { ret = -errno; goto exit; } e = malloc(offsetof(struct dirent, d_name) + PATH_MAX + 1); struct dirent *result = e; while ((readdir_r(mapdir, e, &result) == 0) && (result != NULL)) { if ((e->d_name[0] < '0') || (e->d_name[0] > '9')) continue; uint32_t block_found; sscanf(e->d_name, "%lu", &block_found); if (block_found >= block) { char *bucket = fsll_getlink(mappath, e->d_name); <API key>(filename, block_found, bucket); FREE(bucket); } } exit: closedir(mapdir); FREE(e); if (locked) <API key>(&lock); return ret; } int <API key>(void) { char bucketdir[PATH_MAX]; snprintf(bucketdir, PATH_MAX, "%s/buckets", cache_dir); pthread_mutex_lock(&lock); DIR *d = opendir(bucketdir); if (d == NULL) { PERROR("opendir in <API key>"); <API key>(&lock); return -1*errno; } struct dirent *e = malloc(offsetof(struct dirent, d_name) + PATH_MAX + 1); struct dirent *result = e; while (readdir_r(d, e, &result) == 0 && result != NULL) { if (e->d_name[0] < '0' || e->d_name[0] > '9') continue; char bucketpath[PATH_MAX]; snprintf(bucketpath, PATH_MAX, "%s/buckets/%s", cache_dir, e->d_name); char *parent = fsll_getlink(bucketpath, "parent"); if (fsll_file_exists(bucketpath, "data") && (parent == NULL || !fsll_file_exists(parent, NULL))) { DEBUG("bucket %s is an orphan\n", e->d_name); if (parent) { DEBUG("\tparent was %s\n", parent); } <API key>(bucketpath); } FREE(parent); } closedir(d); FREE(e); <API key>(&lock); return 0; } /* * Read a block from the cache. * Important: you can specify less than one block, but not more. * Nor can a read be across block boundaries. * * mtime is the file modification time. If what's in the cache doesn't match * this, the cache data is invalidated and this function returns -1 and sets * ENOENT. * * Returns 0 on success. * On error returns -1 and sets errno. * In particular, if the block is not in the cache, sets ENOENT */ int cache_fetch(const char *filename, uint32_t block, uint64_t offset, char *buf, uint64_t len, uint64_t *bytes_read, time_t mtime) { if (offset + len > bucket_max_size || filename == NULL) { errno = EINVAL; return -1; } if (len == 0) { *bytes_read = 0; return 0; } DEBUG("getting block %lu of file %s\n", (unsigned long) block, filename); // pthread_mutex_lock(&lock); char mapfile[PATH_MAX]; snprintf(mapfile, PATH_MAX, "%s/map%s/%lu", cache_dir, filename, (unsigned long) block); char bucketpath[PATH_MAX]; ssize_t bplen; if ((bplen = readlink(mapfile, bucketpath, PATH_MAX-1)) == -1) { if (errno == ENOENT || errno == ENOTDIR) { DEBUG("block not in cache\n"); errno = ENOENT; <API key>(&lock); return -1; } else { PERROR("readlink error"); errno = EIO; <API key>(&lock); return -1; } } bucketpath[bplen] = '\0'; bucket_to_head(bucketpath); uint64_t bucket_mtime; char mtimepath[PATH_MAX]; snprintf(mtimepath, PATH_MAX, "%s/map%s/mtime", cache_dir, filename); FILE *f = fopen(mtimepath, "r"); if (f == NULL) { PERROR("open mtime file failed"); bucket_mtime = 0; // will cause invalidation } else { if (fscanf(f, "%llu", (unsigned long long *) &bucket_mtime) != 1) { ERROR("error reading mtime file"); // debug char buf[4096]; fseek(f, 0, SEEK_SET); size_t b = fread(buf, 1, 4096, f); buf[b] = '\0'; ERROR("mtime file contains: %u bytes: %s", (unsigned int) b, buf); fclose(f); f = NULL; unlink(mtimepath); bucket_mtime = 0; // will cause invalidation } } if (f) fclose(f); if (bucket_mtime != (uint64_t)mtime) { // mtime mismatch; invalidate and return if (bucket_mtime < (uint64_t)mtime) { DEBUG("cache data is %llu seconds older than the backing data\n", (unsigned long long) mtime - bucket_mtime); } else { DEBUG("cache data is %llu seconds newer than the backing data\n", (unsigned long long) bucket_mtime - mtime); } <API key>(filename, true); errno = ENOENT; <API key>(&lock); return -1; } // [cache_dir]/buckets/%lu/data char bucketdata[PATH_MAX]; snprintf(bucketdata, PATH_MAX, "%s/data", bucketpath); uint64_t size = 0; struct stat stbuf; if (stat(bucketdata, &stbuf) == -1) { PERROR("stat on bucket error"); errno = EIO; <API key>(&lock); return -1; } size = (uint64_t) stbuf.st_size; if (size < offset) { WARN("offset for read is past the end: %llu vs %llu, bucket %s\n", (unsigned long long) offset, (unsigned long long) size, bucketname(bucketpath)); <API key>(&lock); *bytes_read = 0; return 0; } /* if (e->bucket->size - offset < len) { WARN("length + offset for read is past the end\n"); errno = ENXIO; FREE(f); <API key>(&lock); return -1; } */ int fd = open(bucketdata, O_RDONLY); if (fd == -1) { PERROR("error opening file from cache dir"); errno = EBADF; <API key>(&lock); return -1; } *bytes_read = pread(fd, buf, len, offset); if (*bytes_read == -1) { PERROR("error reading file from cache dir"); errno = EIO; close(fd); <API key>(&lock); return -1; } if (*bytes_read != len) { DEBUG("read fewer than requested bytes from cache file: %llu instead of %llu\n", (unsigned long long) *bytes_read, (unsigned long long) len ); /* errno = EIO; FREE(f); FREE(cachefile); close(fd); <API key>(&lock); return -1; */ } close(fd); <API key>(&lock); // return 0; } uint64_t free_tail_bucket() { uint64_t freed_bytes = 0; char *tail = fsll_getlink(cache_dir, "buckets/tail"); if (tail == NULL) { ERROR("can't free the tail bucket, no buckets in queue!\n"); goto exit; } freed_bytes = free_bucket(tail); DEBUG("freed %llu bytes in bucket %lu\n", (unsigned long long)freed_bytes, (unsigned long)<API key>(tail)); exit: FREE(tail); return freed_bytes; } void <API key>(uint64_t bytes_needed) { uint64_t bytes_freed = 0; if (bytes_needed == 0) return; uint64_t dev_free = <API key>(cache_dir); if (dev_free >= bytes_needed) { // device has plenty if (use_whole_device) { return; } else { // cache_size is limiting factor if (cache_used_size + bytes_needed <= cache_size) { return; } else { bytes_needed = (cache_used_size + bytes_needed) - cache_size; } } } else { // dev_free is limiting factor bytes_needed = bytes_needed - dev_free; } DEBUG("need to free %llu bytes\n", (unsigned long long) bytes_needed); while (bytes_freed < bytes_needed) { bytes_freed += free_tail_bucket(); } DEBUG("freed %llu bytes total\n", (unsigned long long) bytes_freed); } /* * Adds a data block to the cache. * Important: this must be the FULL block. All subsequent reads will * assume that the full block is here. */ int cache_add(const char *filename, uint32_t block, const char *buf, uint64_t len, time_t mtime) { if (len > bucket_max_size) { errno = EOVERFLOW; return -1; } if (len == 0) { return 0; } char fileandblock[PATH_MAX]; snprintf(fileandblock, PATH_MAX, "map%s/%lu", filename, (unsigned long) block); DEBUG("writing %llu bytes to %s\n", (unsigned long long) len, fileandblock); // pthread_mutex_lock(&lock); char *bucketpath = fsll_getlink(cache_dir, fileandblock); if (bucketpath != NULL) { if (fsll_file_exists(bucketpath, "data")) { WARN("data already exists in cache\n"); FREE(bucketpath); <API key>(&lock); return 0; } } char *filemap = (char*)malloc(strlen(filename) + 4); snprintf(filemap, strlen(filename)+4, "map%s", filename); char *full_filemap_dir = (char*)malloc(strlen(cache_dir) + 5 + strlen(filename) + 1); snprintf(full_filemap_dir, strlen(cache_dir)+5+strlen(filename)+1, "%s/map%s/", cache_dir, filename); DEBUG("map file = %s\n", filemap); DEBUG("full filemap dir = %s\n", full_filemap_dir); if (!fsll_file_exists(cache_dir, filemap)) { FREE(filemap); size_t i; // start from "$cache_dir/map/" for (i = strlen(cache_dir) + 5; i < strlen(full_filemap_dir); i++) { if (full_filemap_dir[i] == '/') { char *component = (char*)malloc(i+1); strncpy(component, full_filemap_dir, i+1); component[i] = '\0'; DEBUG("making %s\n", component); if(mkdir(component, 0700) == -1 && errno != EEXIST) { if (errno == ENOSPC) { // try to free some space DEBUG("mkdir says ENOSPC, freeing and trying again\n"); free_tail_bucket(); errno = EAGAIN; } else { PERROR("mkdir in cache_add"); ERROR("\tcaused by mkdir(%s)\n", component); errno = EIO; } FREE(component); FREE(full_filemap_dir); <API key>(&lock); return -1; } FREE(component); } } } else { FREE(filemap); } FREE(full_filemap_dir); <API key>(len); FREE(bucketpath); bucketpath = next_bucket(); DEBUG("bucket path = %s\n", bucketpath); fsll_makelink(cache_dir, fileandblock, bucketpath); char *fullfilemap = (char*)malloc(PATH_MAX); snprintf(fullfilemap, PATH_MAX, "%s/%s", cache_dir, fileandblock); fsll_makelink(bucketpath, "parent", fullfilemap); FREE(fullfilemap); // write mtime char mtimepath[PATH_MAX]; snprintf(mtimepath, PATH_MAX, "%s/map%s/mtime", cache_dir, filename); FILE *f = fopen(mtimepath, "w"); if (f == NULL) { PERROR("opening mtime file in cache_add failed"); } else { fprintf(f, "%llu\n", (unsigned long long) mtime); fclose(f); } // finally, write data char datapath[PATH_MAX]; snprintf(datapath, PATH_MAX, "%s/data", bucketpath); int fd = open(datapath, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); if (fd == -1) { PERROR("open in cache_add"); ERROR("\tcaused by open(%s, O_WRONLY|O_CREAT)\n", datapath); errno = EIO; <API key>(&lock); return -1; } ssize_t bytes_written = write(fd, buf, len); if (bytes_written == -1) { if (errno == ENOSPC) { DEBUG("nothing written (no space on device)\n"); bytes_written = 0; } else { PERROR("write in cache_add"); errno = EIO; close(fd); <API key>(&lock); return -1; } } DEBUG("%llu bytes written to cache\n", (unsigned long long) bytes_written); bool unchecked = is_unchecked(bucketpath); if (!unchecked) { cache_used_size += bytes_written; } // for some reason (filesystem metadata overhead?) this may need to loop a // few times to write everything out. while (bytes_written != len) { DEBUG("not all bytes written to cache\n"); // Try again, more forcefully this time. // Don't care if the FS says it has space, make some space anyway. free_tail_bucket(); ssize_t more_bytes_written = write(fd, buf + bytes_written, len - bytes_written); if (more_bytes_written == -1) { if (errno == ENOSPC) { // this is normal DEBUG("nothing written (no space on device)\n"); more_bytes_written = 0; } else { PERROR("write error"); close(fd); <API key>(&lock); return -EIO; } } DEBUG("%llu more bytes written to cache (%llu total)\n", (unsigned long long) more_bytes_written, (unsigned long long) more_bytes_written + bytes_written); if (!unchecked) { cache_used_size += more_bytes_written; } bytes_written += more_bytes_written; } DEBUG("size now %llu bytes of %llu bytes (%lf%%)\n", (unsigned long long) cache_used_size, (unsigned long long) cache_size, (double)100 * cache_used_size / cache_size ); dump_queues(); close(fd); <API key>(&lock); // FREE(bucketpath); return 0; } int cache_has_file_real(const char *filename, uint64_t *cached_byte_count, bool do_lock) { DEBUG("cache_has_file %s\n", filename); int ret = 0; bool locked = false; char *mapdir = NULL; char *data = NULL; DIR *dir = NULL; if (filename == NULL || cached_byte_count == NULL) { errno = EINVAL; ret = -1; goto exit; } if (do_lock) { pthread_mutex_lock(&lock); locked = true; } // Look up the file in the map. asprintf(&mapdir, "%s/map%s", cache_dir, filename); dir = opendir(mapdir); if (dir == NULL) { if (errno == ENOENT) { DEBUG("not in cache (%s)\n", mapdir); ret = 0; goto exit; } else { PERROR("opendir"); ERROR("\topendir on %s\n", mapdir); ret = -EIO; goto exit; } } // Check if it's a file or directory (see if it has an mtime file). asprintf(&data, "%s/mtime", mapdir); bool is_file = false; struct stat mtime_stat = {0}; if (0 == stat(data, &mtime_stat)) { is_file = (mtime_stat.st_mode & S_IFREG) != 0; } else if (errno != ENOENT) { PERROR("stat"); ERROR("\tstat on %s\n", mapdir); ret = -EIO; goto exit; } // Loop over the sub-entries in the map. struct dirent *dirent = NULL; while ((dirent = readdir(dir)) != NULL) { if (dirent->d_name[0] != '.' && strcmp(dirent->d_name, "mtime") != 0) { FREE(data); if (is_file) { asprintf(&data, "%s/%s/data", mapdir, dirent->d_name); struct stat statbuf = {0}; if (0 != stat(data, &statbuf)) { PERROR("stat"); ERROR("\tstat on %s\n", data); ret = -EIO; goto exit; } DEBUG("%llu bytes in %s\n", statbuf.st_size, data); *cached_byte_count += statbuf.st_size; } else { asprintf(&data, "%s/%s", filename, dirent->d_name); ret = cache_has_file_real(data, cached_byte_count, false /*don't lock*/); if (ret != 0) { break; } } } } exit: if (locked) <API key>(&lock); FREE(mapdir); FREE(data); closedir(dir); return ret; } int cache_has_file(const char *filename, uint64_t *cached_bytes) { *cached_bytes = 0; return cache_has_file_real(filename, cached_bytes, true); } int cache_rename(const char *path, const char *path_new) { DEBUG("cache_rename %s\n\t%s\n", path, path_new); int ret = 0; char *mapdir = NULL; char *mapdir_new = NULL; DIR *dir = NULL; char *parentlink = NULL; if (path == NULL || path_new == NULL) { errno = EINVAL; ret = -1; goto exit; } // Look up and rename the cache map dir. asprintf(&mapdir, "%s/map%s", cache_dir, path); asprintf(&mapdir_new, "%s/map%s", cache_dir, path_new); ret = rename(mapdir, mapdir_new); if (0 != ret) { if (ENOENT == errno) { DEBUG("not in cache: %s\n", path); ret = 0; } else { PERROR("rename"); ret = -EIO; } goto exit; } // Next, need to fix all the buckets' parent links. dir = opendir(mapdir_new); if (dir == NULL) { PERROR("opendir"); ERROR("\topendir on %s\n", mapdir_new); ret = -EIO; goto exit; } size_t cch_parentlink = strlen(mapdir_new) + 20; parentlink = (char*)malloc(cch_parentlink); struct dirent *dirent = NULL; while ((dirent = readdir(dir)) != NULL) { if (dirent->d_name[0] != '.' && strcmp(dirent->d_name, "mtime") != 0) { snprintf(parentlink, cch_parentlink, "%s/%s/parent", mapdir_new, dirent->d_name); ret = unlink(parentlink); if (0 != ret) { PERROR("unlink"); ERROR("\tunlink on %s\n", parentlink); ret = -EIO; goto exit; } ret = symlink(mapdir_new, parentlink); if (0 != ret) { PERROR("symlink"); ERROR("\tsymlink from %s\n\tto %s\n", parentlink, mapdir_new); ret = -EIO; goto exit; } } } exit: FREE(mapdir); FREE(mapdir_new); FREE(parentlink); closedir(dir); return ret; }
#include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> #include <linux/pci_ids.h> #include <linux/edac.h> #include "edac_core.h" #define I3000_REVISION "1.1" #define EDAC_MOD_STR "i3000_edac" #define I3000_RANKS 8 #define <API key> 4 #define I3000_CHANNELS 2 /* Intel 3000 register addresses - device 0 function 0 - DRAM Controller */ #define I3000_MCHBAR 0x44 /* MCH Memory Mapped Register BAR */ #define I3000_MCHBAR_MASK 0xffffc000 #define <API key> 16384 #define I3000_EDEAP 0x70 /* Extended DRAM Error Address Pointer (8b) * * 7:1 reserved * 0 bit 32 of address */ #define I3000_DEAP 0x58 /* DRAM Error Address Pointer (32b) * * 31:7 address * 6:1 reserved * 0 Error channel 0/1 */ #define I3000_DEAP_GRAIN (1 << 7) /* * Helper functions to decode the DEAP/EDEAP hardware registers. * * The type promotion here is deliberate; we're deriving an * unsigned long pfn and offset from hardware regs which are u8/u32. */ static inline unsigned long deap_pfn(u8 edeap, u32 deap) { deap >>= PAGE_SHIFT; deap |= (edeap & 1) << (32 - PAGE_SHIFT); return deap; } static inline unsigned long deap_offset(u32 deap) { return deap & ~(I3000_DEAP_GRAIN - 1) & ~PAGE_MASK; } static inline int deap_channel(u32 deap) { return deap & 1; } #define I3000_DERRSYN 0x5c /* DRAM Error Syndrome (8b) * * 7:0 DRAM ECC Syndrome */ #define I3000_ERRSTS 0xc8 /* Error Status Register (16b) * * 15:12 reserved * 11 MCH Thermal Sensor Event * for SMI/SCI/SERR * 10 reserved * 9 LOCK to non-DRAM Memory Flag (LCKF) * 8 Received Refresh Timeout Flag (RRTOF) * 7:2 reserved * 1 Multi-bit DRAM ECC Error Flag (DMERR) * 0 Single-bit DRAM ECC Error Flag (DSERR) */ #define I3000_ERRSTS_BITS 0x0b03 /* bits which indicate errors */ #define I3000_ERRSTS_UE 0x0002 #define I3000_ERRSTS_CE 0x0001 #define I3000_ERRCMD 0xca /* Error Command (16b) * * 15:12 reserved * 11 SERR on MCH Thermal Sensor Event * (TSESERR) * 10 reserved * 9 SERR on LOCK to non-DRAM Memory * (LCKERR) * 8 SERR on DRAM Refresh Timeout * (DRTOERR) * 7:2 reserved * 1 SERR Multi-Bit DRAM ECC Error * (DMERR) * 0 SERR on Single-Bit ECC Error * (DSERR) */ /* Intel MMIO register space - device 0 function 0 - MMR space */ #define I3000_DRB_SHIFT 25 /* 32MiB grain */ #define I3000_C0DRB 0x100 /* Channel 0 DRAM Rank Boundary (8b x 4) * * 7:0 Channel 0 DRAM Rank Boundary Address */ #define I3000_C1DRB 0x180 /* Channel 1 DRAM Rank Boundary (8b x 4) * * 7:0 Channel 1 DRAM Rank Boundary Address */ #define I3000_C0DRA 0x108 /* Channel 0 DRAM Rank Attribute (8b x 2) * * 7 reserved * 6:4 DRAM odd Rank Attribute * 3 reserved * 2:0 DRAM even Rank Attribute * * Each attribute defines the page * size of the corresponding rank: * 000: unpopulated * 001: reserved * 010: 4 KB * 011: 8 KB * 100: 16 KB * Others: reserved */ #define I3000_C1DRA 0x188 /* Channel 1 DRAM Rank Attribute (8b x 2) */ static inline unsigned char odd_rank_attrib(unsigned char dra) { return (dra & 0x70) >> 4; } static inline unsigned char even_rank_attrib(unsigned char dra) { return dra & 0x07; } #define I3000_C0DRC0 0x120 /* DRAM Controller Mode 0 (32b) * * 31:30 reserved * 29 Initialization Complete (IC) * 28:11 reserved * 10:8 Refresh Mode Select (RMS) * 7 reserved * 6:4 Mode Select (SMS) * 3:2 reserved * 1:0 DRAM Type (DT) */ #define I3000_C0DRC1 0x124 /* DRAM Controller Mode 1 (32b) * * 31 Enhanced Addressing Enable (ENHADE) * 30:0 reserved */ enum i3000p_chips { I3000 = 0, }; struct i3000_dev_info { const char *ctl_name; }; struct i3000_error_info { u16 errsts; u8 derrsyn; u8 edeap; u32 deap; u16 errsts2; }; static const struct i3000_dev_info i3000_devs[] = { [I3000] = { .ctl_name = "i3000"}, }; static struct pci_dev *mci_pdev; static int i3000_registered = 1; static struct edac_pci_ctl_info *i3000_pci; static void <API key>(struct mem_ctl_info *mci, struct i3000_error_info *info) { struct pci_dev *pdev; pdev = to_pci_dev(mci->dev); /* * This is a mess because there is no atomic way to read all the * registers at once and the registers can transition from CE being * overwritten by UE. */ <API key>(pdev, I3000_ERRSTS, &info->errsts); if (!(info->errsts & I3000_ERRSTS_BITS)) return; <API key>(pdev, I3000_EDEAP, &info->edeap); <API key>(pdev, I3000_DEAP, &info->deap); <API key>(pdev, I3000_DERRSYN, &info->derrsyn); <API key>(pdev, I3000_ERRSTS, &info->errsts2); /* * If the error is the same for both reads then the first set * of reads is valid. If there is a change then there is a CE * with no info and the second set of reads is valid and * should be UE info. */ if ((info->errsts ^ info->errsts2) & I3000_ERRSTS_BITS) { <API key>(pdev, I3000_EDEAP, &info->edeap); <API key>(pdev, I3000_DEAP, &info->deap); <API key>(pdev, I3000_DERRSYN, &info->derrsyn); } /* * Clear any error bits. * (Yes, we really clear bits by writing 1 to them.) */ pci_write_bits16(pdev, I3000_ERRSTS, I3000_ERRSTS_BITS, I3000_ERRSTS_BITS); } static int <API key>(struct mem_ctl_info *mci, struct i3000_error_info *info, int handle_errors) { int row, multi_chan, channel; unsigned long pfn, offset; multi_chan = mci->csrows[0].nr_channels - 1; if (!(info->errsts & I3000_ERRSTS_BITS)) return 0; if (!handle_errors) return 1; if ((info->errsts ^ info->errsts2) & I3000_ERRSTS_BITS) { <API key>(mci, "UE overwrote CE"); info->errsts = info->errsts2; } pfn = deap_pfn(info->edeap, info->deap); offset = deap_offset(info->deap); channel = deap_channel(info->deap); row = <API key>(mci, pfn); if (info->errsts & I3000_ERRSTS_UE) edac_mc_handle_ue(mci, pfn, offset, row, "i3000 UE"); else edac_mc_handle_ce(mci, pfn, offset, info->derrsyn, row, multi_chan ? channel : 0, "i3000 CE"); return 1; } static void i3000_check(struct mem_ctl_info *mci) { struct i3000_error_info info; debugf1("MC%d: %s()\n", mci->mc_idx, __func__); <API key>(mci, &info); <API key>(mci, &info, 1); } static int <API key>(const unsigned char *c0dra, const unsigned char *c1dra, const unsigned char *c0drb, const unsigned char *c1drb) { int i; /* * If the channels aren't populated identically then * we're not interleaved. */ for (i = 0; i < <API key> / 2; i++) if (odd_rank_attrib(c0dra[i]) != odd_rank_attrib(c1dra[i]) || even_rank_attrib(c0dra[i]) != even_rank_attrib(c1dra[i])) return 0; /* * If the rank boundaries for the two channels are different * then we're not interleaved. */ for (i = 0; i < <API key>; i++) if (c0drb[i] != c1drb[i]) return 0; return 1; } static int i3000_probe1(struct pci_dev *pdev, int dev_idx) { int rc; int i; struct mem_ctl_info *mci = NULL; unsigned long last_cumul_size; int interleaved, nr_channels; unsigned char dra[I3000_RANKS / 2], drb[I3000_RANKS]; unsigned char *c0dra = dra, *c1dra = &dra[<API key> / 2]; unsigned char *c0drb = drb, *c1drb = &drb[<API key>]; unsigned long mchbar; void __iomem *window; debugf0("MC: %s()\n", __func__); <API key>(pdev, I3000_MCHBAR, (u32 *) & mchbar); mchbar &= I3000_MCHBAR_MASK; window = ioremap_nocache(mchbar, <API key>); if (!window) { printk(KERN_ERR "i3000: cannot map mmio space at 0x%lx\n", mchbar); return -ENODEV; } c0dra[0] = readb(window + I3000_C0DRA + 0); /* ranks 0,1 */ c0dra[1] = readb(window + I3000_C0DRA + 1); /* ranks 2,3 */ c1dra[0] = readb(window + I3000_C1DRA + 0); /* ranks 0,1 */ c1dra[1] = readb(window + I3000_C1DRA + 1); /* ranks 2,3 */ for (i = 0; i < <API key>; i++) { c0drb[i] = readb(window + I3000_C0DRB + i); c1drb[i] = readb(window + I3000_C1DRB + i); } iounmap(window); /* * Figure out how many channels we have. * * If we have what the datasheet calls "asymmetric channels" * (essentially the same as what was called "virtual single * channel mode" in the i82875) then it's a single channel as * far as EDAC is concerned. */ interleaved = <API key>(c0dra, c1dra, c0drb, c1drb); nr_channels = interleaved ? 2 : 1; mci = edac_mc_alloc(0, I3000_RANKS / nr_channels, nr_channels, 0); if (!mci) return -ENOMEM; debugf3("MC: %s(): init mci\n", __func__); mci->dev = &pdev->dev; mci->mtype_cap = MEM_FLAG_DDR2; mci->edac_ctl_cap = EDAC_FLAG_SECDED; mci->edac_cap = EDAC_FLAG_SECDED; mci->mod_name = EDAC_MOD_STR; mci->mod_ver = I3000_REVISION; mci->ctl_name = i3000_devs[dev_idx].ctl_name; mci->dev_name = pci_name(pdev); mci->edac_check = i3000_check; mci->ctl_page_to_phys = NULL; /* * The dram rank boundary (DRB) reg values are boundary addresses * for each DRAM rank with a granularity of 32MB. DRB regs are * cumulative; the last one will contain the total memory * contained in all ranks. * * If we're in interleaved mode then we're only walking through * the ranks of controller 0, so we double all the values we see. */ for (last_cumul_size = i = 0; i < mci->nr_csrows; i++) { u8 value; u32 cumul_size; struct csrow_info *csrow = &mci->csrows[i]; value = drb[i]; cumul_size = value << (I3000_DRB_SHIFT - PAGE_SHIFT); if (interleaved) cumul_size <<= 1; debugf3("MC: %s(): (%d) cumul_size 0x%x\n", __func__, i, cumul_size); if (cumul_size == last_cumul_size) { csrow->mtype = MEM_EMPTY; continue; } csrow->first_page = last_cumul_size; csrow->last_page = cumul_size - 1; csrow->nr_pages = cumul_size - last_cumul_size; last_cumul_size = cumul_size; csrow->grain = I3000_DEAP_GRAIN; csrow->mtype = MEM_DDR2; csrow->dtype = DEV_UNKNOWN; csrow->edac_mode = EDAC_UNKNOWN; } /* * Clear any error bits. * (Yes, we really clear bits by writing 1 to them.) */ pci_write_bits16(pdev, I3000_ERRSTS, I3000_ERRSTS_BITS, I3000_ERRSTS_BITS); rc = -ENODEV; if (edac_mc_add_mc(mci)) { debugf3("MC: %s(): failed edac_mc_add_mc()\n", __func__); goto fail; } /* allocating generic PCI control info */ i3000_pci = <API key>(&pdev->dev, EDAC_MOD_STR); if (!i3000_pci) { printk(KERN_WARNING "%s(): Unable to create PCI control\n", __func__); printk(KERN_WARNING "%s(): PCI error report via EDAC not setup\n", __func__); } /* get this far and it's successful */ debugf3("MC: %s(): success\n", __func__); return 0; fail: if (mci) edac_mc_free(mci); return rc; } /* returns count (>= 0), or negative on error */ static int __devinit i3000_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { int rc; debugf0("MC: %s()\n", __func__); if (pci_enable_device(pdev) < 0) return -EIO; rc = i3000_probe1(pdev, ent->driver_data); if (!mci_pdev) mci_pdev = pci_dev_get(pdev); return rc; } static void __devexit i3000_remove_one(struct pci_dev *pdev) { struct mem_ctl_info *mci; debugf0("%s()\n", __func__); if (i3000_pci) <API key>(i3000_pci); mci = edac_mc_del_mc(&pdev->dev); if (!mci) return; edac_mc_free(mci); } static const struct pci_device_id i3000_pci_tbl[] __devinitdata = { { PCI_VEND_DEV(INTEL, 3000_HB), PCI_ANY_ID, PCI_ANY_ID, 0, 0, I3000}, { 0, } /* 0 terminated list. */ }; MODULE_DEVICE_TABLE(pci, i3000_pci_tbl); static struct pci_driver i3000_driver = { .name = EDAC_MOD_STR, .probe = i3000_init_one, .remove = __devexit_p(i3000_remove_one), .id_table = i3000_pci_tbl, }; static int __init i3000_init(void) { int pci_rc; debugf3("MC: %s()\n", __func__); /* Ensure that the OPSTATE is set correctly for POLL or NMI */ opstate_init(); pci_rc = pci_register_driver(&i3000_driver); if (pci_rc < 0) goto fail0; if (!mci_pdev) { i3000_registered = 0; mci_pdev = pci_get_device(PCI_VENDOR_ID_INTEL, <API key>, NULL); if (!mci_pdev) { debugf0("i3000 pci_get_device fail\n"); pci_rc = -ENODEV; goto fail1; } pci_rc = i3000_init_one(mci_pdev, i3000_pci_tbl); if (pci_rc < 0) { debugf0("i3000 init fail\n"); pci_rc = -ENODEV; goto fail1; } } return 0; fail1: <API key>(&i3000_driver); fail0: if (mci_pdev) pci_dev_put(mci_pdev); return pci_rc; } static void __exit i3000_exit(void) { debugf3("MC: %s()\n", __func__); <API key>(&i3000_driver); if (!i3000_registered) { i3000_remove_one(mci_pdev); pci_dev_put(mci_pdev); } } module_init(i3000_init); module_exit(i3000_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Akamai Technologies Arthur Ulfeldt/Jason Uhlenkott"); MODULE_DESCRIPTION("MC support for Intel 3000 memory hub controllers"); module_param(edac_op_state, int, 0444); MODULE_PARM_DESC(edac_op_state, "EDAC Error Reporting state: 0=Poll,1=NMI");
# Based partially on (wongsyrone/hbl0307106015) versions include $(TOPDIR)/rules.mk PKG_NAME:=samba PKG_VERSION:=4.12.3 PKG_RELEASE:=5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:= \ https://ftp.gwdg.de/pub/samba/stable/ \ https://ftp.heanet.ie/mirrors/ftp.samba.org/stable/ \ https://ftp.riken.jp/net/samba/samba/stable/ \ http: http://samba.mirror.bit.nl/samba/ftp/stable/ \ https://download.samba.org/pub/samba/stable/ PKG_HASH:=<SHA256-like> PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com> PKG_LICENSE:=GPL-3.0-only PKG_LICENSE_FILES:=COPYING PKG_CPE_ID:=cpe:/a:samba:samba # samba4=(asn1_compile,compile_et) rpcsvc-proto=(rpcgen) HOST_BUILD_DEPENDS:=python3/host rpcsvc-proto/host perl/host perl-parse-yapp/host PKG_BUILD_DEPENDS:=samba4/host libtasn1/host PKG_CONFIG_DEPENDS:= \ <API key> \ <API key> \ <API key> \ <API key> \ <API key> \ <API key> \ <API key> PYTHON3_PKG_BUILD:=0 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/version.mk include ../../lang/python/python3-host.mk include ../../lang/python/python3-package.mk include ../../lang/perl/perlver.mk define Package/samba4/Default SECTION:=net CATEGORY:=Network TITLE:=Samba $(PKG_VERSION) URL:=https: endef define Package/samba4/Default/description The Samba software suite is a collection of programs that implements the SMB/CIFS protocol for UNIX systems, allowing you to serve files and printers. Samba 4 implements up-to protocol version SMB v3.1.1 (Win10), supports mDNS via AVAHI and a AD-DC setup via krb5. NOTE: No cluster and printer support. endef define Package/samba4-libs $(call Package/samba4/Default) TITLE+= libs DEPENDS:= +libtirpc +libreadline +libpopt +libcap +zlib +libgnutls +libtasn1 +libuuid +libopenssl +USE_GLIBC:libpthread \ +PACKAGE_libpam:libpam \ +SAMBA4_SERVER_VFS:attr \ +SAMBA4_SERVER_VFSX:libaio \ +SAMBA4_SERVER_AVAHI:libavahi-client \ +SAMBA4_SERVER_AD_DC:python3-cryptodome +SAMBA4_SERVER_AD_DC:libopenldap +SAMBA4_SERVER_AD_DC:jansson +SAMBA4_SERVER_AD_DC:libarchive +SAMBA4_SERVER_AD_DC:acl +SAMBA4_SERVER_AD_DC:attr endef define Package/samba4-server $(call Package/samba4/Default) TITLE+= server DEPENDS:= +samba4-libs CONFLICTS:=samba36-server endef define Package/samba4-server/description installs: smbd (nmbd) smbpasswd pdbedit testparm (nmblookup) (smbcacls sharesec) (samba samba-tool ntlm_auth samba-gpupdate samba_dnsupdate samba_kcc samba_spnupdate samba_upgradedns samba_downgrade_db) This provides the basic fileserver service and is the minimum needed to serve file shares. HINT: https://fitzcarraldoblog.wordpress.com/2016/10/17/<API key>/ endef define Package/samba4-server/config select PACKAGE_wsdd2 source "$(SOURCE)/Config.in" endef define Package/samba4-client $(call Package/samba4/Default) TITLE+= client DEPENDS:= +samba4-libs endef define Package/samba4-client/description installs: cifsdd smbclient smbget The smbclient program implements a simple ftp-like client for accessing SMB shares endef define Package/samba4-admin $(call Package/samba4/Default) TITLE+= admin tools DEPENDS:= +samba4-libs endef define Package/samba4-admin/description installs: net smbcontrol profiles rpcclient dbwrap_tool eventlogadm ldbadd ldbdel ldbedit ldbmodify ldbrename ldbsearch tdbbackup tdbdump tdbrestore tdbtool Administration tools collection endef define Package/samba4-utils $(call Package/samba4/Default) TITLE+= utils DEPENDS:= +samba4-libs endef define Package/samba4-utils/description installs: smbstatus smbtree mvxattr smbtar smbcquotas Utilities collection endef TARGET_CFLAGS += $(FPIC) -ffunction-sections -fdata-sections -I$(STAGING_DIR)/usr/include/tirpc TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed # dont mess with sambas private rpath! RSTRIP:=: CONFIGURE_VARS += \ CPP="$(TARGET_CROSS)cpp" CONFIGURE_CMD = ./buildtools/bin/waf HOST_CONFIGURE_CMD = ./buildtools/bin/waf # Strip options that WAF configure script does not recognize CONFIGURE_ARGS:=$(filter-out \ --target=% \ --host=% \ --build=% \ --program-prefix=% \ --program-suffix=% \ --disable-nls \ --disable-ipv6 \ , $(CONFIGURE_ARGS)) HOST_CONFIGURE_ARGS:=$(filter-out \ --target=% \ --host=% \ --build=% \ --program-prefix=% \ --program-suffix=% \ --disable-nls \ --disable-ipv6 \ , $(HOST_CONFIGURE_ARGS)) # Waf needs the "configure" argument CONFIGURE_ARGS:=configure $(CONFIGURE_ARGS) HOST_CONFIGURE_ARGS:=configure $(HOST_CONFIGURE_ARGS) CONFIGURE_ARGS += \ --hostcc="$(HOSTCC)" \ --cross-compile \ --cross-answers=cross-answers.txt \ --disable-cups \ --disable-iprint \ --disable-cephfs \ --<API key> \ --disable-glusterfs \ --disable-spotlight \ --enable-fhs \ --without-automount \ --without-iconv \ --without-lttng \ --<API key> \ --without-pam \ --without-systemd \ --without-utmp \ --without-dmapi \ --without-fam \ --without-gettext \ --without-regedit \ --without-gpgme HOST_CONFIGURE_ARGS += \ --hostcc="$(HOSTCC)" \ --disable-cups \ --disable-iprint \ --disable-cephfs \ --<API key> \ --disable-glusterfs \ --disable-spotlight \ --disable-rpath \ --<API key> \ --<API key> \ --enable-fhs \ --without-automount \ --without-iconv \ --without-lttng \ --<API key> \ --without-pam \ --without-systemd \ --without-utmp \ --without-dmapi \ --without-fam \ --without-gettext \ --without-regedit \ --without-gpgme HOST_CONFIGURE_ARGS += --disable-avahi --without-quotas --without-acl-support --without-winbind \ --without-ad-dc --without-json --without-libarchive --disable-python --nopyc --nopyo \ --without-dnsupdate --without-ads --without-ldap --without-ldb-lmdb # Support for Nettle wasn't comitted ifdef <API key> CONFIGURE_ARGS += --accel-aes=intelaesni else CONFIGURE_ARGS += --accel-aes=none endif CONFIGURE_ARGS += \ --with-lockdir=/var/lock \ --with-logfilebase=/var/log \ --with-piddir=/var/run \ --with-privatedir=/etc/samba # features ifeq ($(<API key>),y) CONFIGURE_ARGS += --with-quotas else CONFIGURE_ARGS += --without-quotas endif ifeq ($(<API key>),y) CONFIGURE_ARGS += --enable-avahi else CONFIGURE_ARGS += --disable-avahi endif ifeq ($(<API key>),y) CONFIGURE_ARGS += --without-winbind --without-ldb-lmdb --with-acl-support else CONFIGURE_ARGS += --without-winbind --without-ads --without-ldap --without-ldb-lmdb --without-ad-dc \ --without-json --without-libarchive --disable-python --nopyc --nopyo --without-dnsupdate --without-acl-support endif SAMBA4_PDB_MODULES :=pdb_smbpasswd,pdb_tdbsam, SAMBA4_AUTH_MODULES :=auth_builtin,auth_sam,auth_unix, SAMBA4_VFS_MODULES :=vfs_default, <API key> :=auth_script, ifeq ($(<API key>),y) <API key> :=$(<API key>)vfs_fruit,vfs_shadow_copy2,vfs_recycle,vfs_fake_perms,vfs_readonly,vfs_cap,vfs_offline,vfs_crossrename,vfs_catia,vfs_streams_xattr,vfs_xattr_tdb,vfs_default_quota, ifeq ($(<API key>),y) <API key> :=$(<API key>)vfs_btrfs, endif endif ifeq ($(<API key>),y) <API key> :=$(<API key>)vfs_virusfilter,vfs_shell_snap,vfs_commit,vfs_worm,vfs_aio_fork,vfs_aio_pthread,vfs_netatalk,vfs_dirsort,vfs_fileid, ifeq ($(<API key>),y) <API key> :=$(<API key>)vfs_linux_xfs_sgid, endif endif ifeq ($(<API key>),y) SAMBA4_PDB_MODULES :=$(SAMBA4_PDB_MODULES)pdb_samba_dsdb,pdb_ldapsam, SAMBA4_AUTH_MODULES :=$(SAMBA4_AUTH_MODULES)auth_samba4, SAMBA4_VFS_MODULES :=$(SAMBA4_VFS_MODULES)vfs_posixacl, <API key> :=$(<API key>)vfs_audit,vfs_extd_audit,vfs_full_audit,vfs_acl_xattr,vfs_acl_tdb, endif SAMBA4_MODULES :=${SAMBA4_VFS_MODULES}${SAMBA4_AUTH_MODULES}${SAMBA4_PDB_MODULES} <API key> :=${<API key>} CONFIGURE_ARGS += \ --with-static-modules=$(SAMBA4_MODULES)!DEFAULT,!FORCED \ --with-shared-modules=$(<API key>)!DEFAULT,!FORCED HOST_CONFIGURE_ARGS += \ --with-static-modules=!DEFAULT,!FORCED \ --with-shared-modules=!DEFAULT,!FORCED # lib bundling PY_VER:=$(<API key>)$(<API key>) # NOTE: bundle + make private, we want to avoid version configuration (build, link) conflicts HOST_CONFIGURE_ARGS += --builtin-libraries=replace --nonshared-binary=asn1_compile,compile_et SYSTEM_BUNDLED_LIBS:=talloc,tevent,tevent-util,texpect,tdb,ldb,tdr,cmocka,replace,com_err PYTHON_BUNDLED_LIBS:=pytalloc-util.cpython-$(PY_VER),pyldb-util.cpython-$(PY_VER) # CONFIGURE_ARGS += --builtin-libraries=talloc,tevent,tevent-util,texpect,tdb,ldb,tdr,cmocka,com_err ifeq ($(<API key>),y) CONFIGURE_ARGS += --bundled-libraries=NONE,$(SYSTEM_BUNDLED_LIBS),$(PYTHON_BUNDLED_LIBS) else CONFIGURE_ARGS += --bundled-libraries=NONE,$(SYSTEM_BUNDLED_LIBS) endif CONFIGURE_ARGS += --private-libraries=$(SYSTEM_BUNDLED_LIBS) export COMPILE_ET=$(STAGING_DIR_HOSTPKG)/bin/compile_et_samba export ASN1_COMPILE=$(STAGING_DIR_HOSTPKG)/bin/asn1_compile_samba # make sure we use the hostpkg build toolset and we need to find host 'yapp' HOST_CONFIGURE_VARS+= \ PATH="$(STAGING_DIR_HOSTPKG)/bin:$(STAGING_DIR_HOSTPKG)/usr/bin:$(PATH)" CONFIGURE_VARS += \ PATH="$(STAGING_DIR_HOSTPKG)/bin:$(STAGING_DIR_HOSTPKG)/usr/bin:$(PATH)" # we need hostpkg bin and target config ifeq ($(<API key>),y) CONFIGURE_VARS += \ PYTHON_CONFIG="$(STAGING_DIR)/host/bin/$(PYTHON3)-config" endif # we dont need GnuTLS for the host helpers define Host/Prepare $(call Host/Prepare/Default) $(SED) 's,mandatory=True,mandatory=False,g' $(HOST_BUILD_DIR)/<API key> $(SED) 's,gnutls_version =.*,gnutls_version = <API key>,g' $(HOST_BUILD_DIR)/<API key> endef define Host/Compile (cd $(HOST_BUILD_DIR); \ ./buildtools/bin/waf build \ --targets=asn1_compile,compile_et \ ) endef define Host/Install $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/ # add host tools suffix, prevent conflicts with krb5 $(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/asn1_compile $(STAGING_DIR_HOSTPKG)/bin/asn1_compile_samba $(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/compile_et $(STAGING_DIR_HOSTPKG)/bin/compile_et_samba endef define Build/Prepare $(Build/Prepare/Default) ifeq ($(<API key>),) # un-bundle dnspython $(SED) '/"dns.resolver":/d' $(PKG_BUILD_DIR)/third_party/wscript # unbundle iso8601 $(SED) '/"iso8601":/d' $(PKG_BUILD_DIR)/third_party/wscript endif endef define Build/Configure $(CP) ./waf-cross-answers/$(ARCH).txt $(PKG_BUILD_DIR)/cross-answers.txt echo 'Checking uname sysname type: "$(VERSION_DIST)"' >> $(PKG_BUILD_DIR)/cross-answers.txt echo 'Checking uname machine type: "$(ARCH)"' >> $(PKG_BUILD_DIR)/cross-answers.txt echo 'Checking uname release type: "$(LINUX_VERSION)"' >> $(PKG_BUILD_DIR)/cross-answers.txt echo 'Checking uname version type: "$(VERSION_DIST) Linux-$(LINUX_VERSION) $(shell date +%Y-%m-%d)"' >> $(PKG_BUILD_DIR)/cross-answers.txt # NOTE: special answers for freeBSD/CircleCI echo 'checking for clnt_create(): OK' >> $(PKG_BUILD_DIR)/cross-answers.txt $(call Build/Configure/Default) endef # Build via "waf install", avoid the make wrapper. (Samba logic is 'waf install' = build + install) define Build/Compile (cd $(PKG_BUILD_DIR); \ ./buildtools/bin/waf install \ --jobs=$(shell nproc) \ --destdir="$(PKG_INSTALL_DIR)" \ ) endef # No default install see above define Build/Install endef define Package/samba4-libs/install $(INSTALL_DIR) $(1)/usr/lib
<?php namespace Requests\Exception\HTTP; /** * Exception for 505 HTTP Version Not Supported responses * * @package Requests */ /** * Exception for 505 HTTP Version Not Supported responses * * @package Requests */ class _505 extends \Requests\Exception\HTTP { /** * HTTP status code * * @var integer */ protected $code = 505; /** * Reason phrase * * @var string */ protected $reason = 'HTTP Version Not Supported'; }
<?php namespace webfilesframework\core\datasystem\file\system\dropbox; use webfilesframework\core\datasystem\file\system\MFile; /** * description * * @author Sebastian Monzel < mail@sebastianmonzel.de > * @since 0.1.7 */ class MDropboxFile extends MFile { protected $dropboxAccount; protected $fileMetadata; protected $filePath; /** * * Enter description here ... * @param MDropboxAccount $account * @param $filePath * @param bool $initMetadata * @internal param unknown_type $fileName */ public function __construct(MDropboxAccount $account, $filePath, $initMetadata = true) { parent::__construct($filePath); $this->filePath = $filePath; $this->dropboxAccount = $account; if ($initMetadata) { $this->initMetadata(); } } public function initMetadata() { $this->fileMetadata = $this->dropboxAccount->getDropboxApi()->metaData($this->filePath); $lastSlash = strrpos($this->fileMetadata['body']->path, '/'); $fileName = substr($this->fileMetadata['body']->path, $lastSlash + 1); $this->fileName = $fileName; } public function getContent() { $file = $this->dropboxAccount->getDropboxApi()->getFile($this->filePath); return $file['data']; } public function writeContent($content, $overwrite = false) { // TODO } /** * * Enter description here ... */ public function upload() { } /** * * Enter description here ... * @param $overwriteIfExists */ public function download($overwriteIfExists) { $file = $this->dropboxAccount->getDropboxApi()->getFile($this->filePath); if (!file_exists("." . $this->filePath)) { $fp = fopen("." . $this->filePath, "w"); fputs($fp, $file['data']); fclose($fp); } } public function <API key>() { $file = $this->dropboxAccount->getDropbox()->thumbnails($this->filePath, 'JPEG', 'l'); if (!file_exists("." . $this->filePath)) { $fp = fopen("." . $this->filePath, "w"); fputs($fp, $file['data']); fclose($fp); } } }
\documentclass[../../../../testPlan.tex]{subfiles} \begin{document} \section{Integration Testing Strategy} The strategy that we want to follow is the Bottom-Up Strategy. This kind of approach consists in testing the low level components first and then the level just above, until you reach the top level components. This strategy is suitable for our system because every component is divided in low level components. \end{document}
<?php use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model common\models\SettingsWorkingDays */ $this->title = 'Update Settings Working Days: ' . $model->id; $this->params['breadcrumbs'][] = ['label' => 'Settings Working Days', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = 'Update'; ?> <div class="<API key>"> <h1><?= Html::encode($this->title) ?></h1> <?= $this->render('_form', [ 'model' => $model, ]) ?> </div>
#ifndef JULIA_R_H #define JULIA_R_H #ifdef __cplusplus extern "C" { #endif #include <R.h> #include <julia.h> //Convert R Type To Julia,which not contain NA SEXP R_Julia(SEXP Var, SEXP VarNam); //Convert R Type To Julia,which contain NA SEXP R_Julia_NA(SEXP Var, SEXP VarNam); //Convert R Type To Julia,which contain NA SEXP R_Julia_NA_Factor(SEXP Var, SEXP VarNam); //Convert R data frame To Julia SEXP <API key>(SEXP Var, SEXP VarNam); #ifdef __cplusplus } #endif #endif
* { border-radius: 0 !important; } a, a:focus, a:hover, a:active, button, button:hover { outline: 0 !important; } a:focus { text-decoration: none; } hr { margin: 30px 0; } hr.hr-xs { margin: 10px 0; } hr.hr-md { margin: 20px 0; } hr.hr-lg { margin: 40px 0; } /*Headings*/ h1 { font-size: 28px; line-height: 35px; } h2 { font-size: 24px; line-height: 33px; } h3 { font-size: 20px; line-height: 27px; } h4 { line-height: 25px; } h5 { line-height: 20px; } h6 { line-height: 18px; } h1, h2, h3, h4, h5, h6 { color: #555; margin-top: 5px; text-shadow: none; font-weight: normal; font-family: 'Open Sans', sans-serif; } h1 i, h2 i, h3 i, h4 i, h5 i, h6 i { margin-right: 5px; } /*Block Headline*/ .headline { display: block; margin: 10px 0 25px 0; border-bottom: 1px dotted #e4e9f0; } .headline h2 { font-size: 22px; } .headline h2, .headline h3, .headline h4 { margin: 0 0 -2px 0; padding-bottom: 5px; display: inline-block; border-bottom: 2px solid #72c02c; } .headline-md { margin-bottom: 15px; } .headline-md h2 { font-size: 21px; } /*Heading Options*/ .heading { text-align: center; } .heading h2 { padding: 0 12px; position: relative; display: inline-block; line-height: 34px !important; /*For Tagline Boxes*/ } .heading h2:before, .heading h2:after { content: ' '; width: 70%; position: absolute; border-width: 1px; border-color: #bbb; } .heading h2:before { right: 100%; } .heading h2:after { left: 100%; } @media (max-width: 768px) { .heading h2:before, .heading h2:after { width: 20%; } } /*Headline v1*/ .heading-v1 h2:before, .heading-v1 h2:after { top: 15px; height: 6px; border-top-style: solid; border-bottom-style: solid; } /*Headline v2*/ .heading-v2 h2:before, .heading-v2 h2:after { top: 15px; height: 6px; border-top-style: dashed; border-bottom-style: dashed; } /*Headline v3*/ .heading-v3 h2:before, .heading-v3 h2:after { top: 15px; height: 6px; border-top-style: dotted; border-bottom-style: dotted; } /*Headline v4*/ .heading-v4 h2:before, .heading-v4 h2:after { top: 17px; border-bottom-style: solid; } /*Headline v5*/ .heading-v5 h2:before, .heading-v5 h2:after { top: 17px; border-bottom-style: dashed; } /*Headline v6*/ .heading-v6 h2:before, .heading-v6 h2:after { top: 17px; border-bottom-style: dotted; } /*Heading Titles v1*/ .title-v1 { z-index: 1; position: relative; text-align: center; margin-bottom: 60px; } .title-v1 h1, .title-v1 h2 { color: #444; font-size: 28px; position: relative; margin-bottom: 15px; padding-bottom: 20px; text-transform: uppercase; font-family: 'Open Sans', sans-serif; } .title-v1 h1:after, .title-v1 h2:after { bottom: 0; left: 50%; height: 1px; width: 70px; content: " "; margin-left: -35px; position: absolute; background: #72c02c; } .title-v1 p { font-size: 17px; font-weight: 200; } /*Heading Titles v2*/ h2.title-v2 { color: #555; position: relative; margin-bottom: 30px; } h2.title-v2:after { left: 0; width: 70px; height: 2px; content: " "; bottom: -10px; background: #555; position: absolute; } h1.title-v2.title-center, h2.title-v2.title-center, h3.title-v2.title-center { text-align: center; } h1.title-v2.title-center:after, h2.title-v2.title-center:after, h3.title-v2.title-center:after { left: 50%; width: 70px; margin-left: -35px; } h1.title-light, h2.title-light, h3.title-light { color: #fff; } h2.title-light:after { background: #fff; } /*Heading Title v3*/ h1[class^="title-v3-"], h2[class^="title-v3-"], h3[class^="title-v3-"] { color: #555; } h2.title-v3-xlg { font-size: 28px; line-height: 32px; } h1.title-v3-lg, h2.title-v3-lg { font-size: 24px; line-height: 28px; } h1.title-v3-md, h2.title-v3-md { font-size: 20px; line-height: 24px; } h2.title-v3-sm, h3.title-v3-md { font-size: 18px; line-height: 24px; } h3.title-v3-md { line-height: 22px; } h3.title-v3-sm { font-size: 16px; line-height: 20px; } h2.title-v3-xs { font-size: 16px; line-height: 22px; } h3.title-v3-xs { font-size: 14px; margin-bottom: 0; } /*Headline Center*/ .headline-center { text-align: center; position: relative; } .headline-center h2 { color: #555; font-size: 24px; position: relative; margin-bottom: 20px; padding-bottom: 15px; } .headline-center h2:after { left: 50%; z-index: 1; width: 30px; height: 2px; content: " "; bottom: -5px; margin-left: -15px; text-align: center; position: absolute; background: #72c02c; } .headline-center p { /*color: #999;*/ font-size: 14px; /*padding: 0 150px;*/ } @media (max-width: 991px) { .headline-center p { padding: 0 50px; } } .headline-center.headline-light h2 { color: #fff; } .headline-center.headline-light p { color: #eee; } /*Headline Center v2*/ .headline-center-v2 { z-index: 0; text-align: center; position: relative; } .headline-center-v2 h2 { color: #555; font-size: 24px; margin-bottom: 20px; text-transform: uppercase; } .headline-center-v2 span.bordered-icon { color: #fff; padding: 0 10px; font-size: 15px; line-height: 18px; position: relative; margin-bottom: 25px; display: inline-block; } .headline-center-v2 span.bordered-icon:before, .headline-center-v2 span.bordered-icon:after { top: 8px; height: 1px; content: " "; width: 100px; background: #fff; position: absolute; } .headline-center-v2 span.bordered-icon:before { left: 100%; } .headline-center-v2 span.bordered-icon:after { right: 100%; } .headline-center-v2 p { color: #555; font-size: 14px; padding: 0 70px; } .headline-center-v2.<API key> p { color: #666; } .headline-center-v2.<API key> span.bordered-icon { color: #666; } .headline-center-v2.<API key> span.bordered-icon:before, .headline-center-v2.<API key> span.bordered-icon:after { background: #666; } /*Headline Left*/ .headline-left { position: relative; } .headline-left .headline-brd { color: #555; position: relative; margin-bottom: 25px; padding-bottom: 10px; } .headline-left .headline-brd:after { left: 1px; z-index: 1; width: 30px; height: 2px; content: " "; bottom: -5px; position: absolute; background: #72c02c; } .headline-v2 { display: block; background: #fff; padding: 1px 10px; margin: 0 0 20px 0; border-left: 2px solid #000; } .headline-v2 h2 { margin: 3px 0; font-size: 20px; font-weight: 200; } h2.heading-md { font-size: 20px; line-height: 24px; } h2.heading-sm, h3.heading-md { font-size: 18px; line-height: 24px; } h3.heading-md { line-height: 22px; } h3.heading-sm { font-size: 16px; line-height: 20px; } h2.heading-xs { font-size: 16px; line-height: 22px; } h3.heading-xs { font-size: 14px; margin-bottom: 0; } .devider.devider-dotted { border-top: 2px dotted #eee; } .devider.devider-dashed { border-top: 2px dashed #eee; } .devider.devider-db { height: 5px; border-top: 1px solid #eee; border-bottom: 1px solid #eee; } .devider.devider-db-dashed { height: 5px; border-top: 1px dashed #ddd; border-bottom: 1px dashed #ddd; } .devider.devider-db-dotted { height: 5px; border-top: 1px dotted #ddd; border-bottom: 1px dotted #ddd; } /*Basic Tables*/ .table thead > tr > th { border-bottom: none; } @media (max-width: 768px) { .table th.hidden-sm, .table td.hidden-sm { display: none !important; } } .form-control { box-shadow: none; } .form-control:focus { border-color: #bbb; box-shadow: 0 0 2px #c9c9c9; } /*Form Spacing*/ .form-spacing .form-control { margin-bottom: 15px; } /*Form Icons*/ .input-group-addon { color: #b3b3b3; font-size: 14px; background: #fff; } .carousel-v1 .carousel-caption { left: 0; right: 0; bottom: 0; padding: 7px 15px; background: rgba(0, 0, 0, 0.7); } .carousel-v1 .carousel-caption p { color: #fff; margin-bottom: 0; } .carousel-v1 .carousel-arrow a.carousel-control { opacity: 1; font-size:30px; height:inherit; width: inherit; background: none; text-shadow: none; position: inherit; } .carousel-v1 .carousel-arrow a i { top: 50%; opacity: 0.6; background: #000; margin-top: -18px; padding: 2px 12px; position: absolute; } .carousel-v1 .carousel-arrow a i:hover { opacity: 0.8; } .carousel-v1 .carousel-arrow a.left i { left: 0; } .carousel-v1 .carousel-arrow a.right i { right: 0; } .carousel-v2 .carousel-control, .carousel-v2 .carousel-control:hover { opacity: 1; text-shadow: none; } .carousel-v2 .carousel-control.left, .carousel-v2 .carousel-control.right { top: 50%; z-index: 5; color: #eee; width: 45px; height: 45px; font-size: 30px; margin-top: -22px; position: absolute; text-align: center; display: inline-block; border: 2px solid #eee; background: rgba(0,0,0,0.1); } .carousel-v2 .carousel-control:hover { background: rgba(0,0,0,0.3); -webkit-transition: all 0.4s ease-in-out; -moz-transition: all 0.4s ease-in-out; -o-transition: all 0.4s ease-in-out; transition: all 0.4s ease-in-out; } .carousel-v2 .carousel-control.left { left: 20px; } .carousel-v2 .carousel-control.right { right: 20px; } .carousel-v2 .carousel-control .arrow-prev, .carousel-v2 .carousel-control .arrow-next { top: -5px; position: relative; } .carousel-v2 .carousel-control .arrow-next { right: -2px; } @media (min-width: 768px) { .carousel-indicators { bottom: 10px; } } /*Tabs v1*/ .tab-v1 .nav-tabs { border: none; background: none; border-bottom: solid 2px #72c02c; } .tab-v1 .nav-tabs a { font-size: 14px; padding: 5px 15px; } .tab-v1 .nav-tabs > .active > a, .tab-v1 .nav-tabs > .active > a:hover, .tab-v1 .nav-tabs > .active > a:focus { color: #fff; border: none; background: #72c02c; } .tab-v1 .nav-tabs > li > a { border: none; } .tab-v1 .nav-tabs > li > a:hover { color: #fff; background: #72c02c; } .tab-v1 .tab-content { padding: 10px 0; } .tab-v1 .tab-content img { margin-top: 4px; margin-bottom: 15px; } .tab-v1 .tab-content img.img-tab-space { margin-top: 7px; } /*Tabs v2*/ .tab-v2 .nav-tabs { border-bottom: none; } .tab-v2 .nav-tabs li a { padding: 9px 16px; background: none; border: none; } .tab-v2 .nav-tabs li.active a { background: #fff; padding: 7px 15px 9px; border: solid 1px #eee; border-top: solid 2px #72c02c; border-bottom: none !important; } .tab-v2 .tab-content { padding: 10px 16px; border: solid 1px #eee; } /*Tabs v3*/ .tab-v3 .nav-pills li a { color: #777; font-size: 17px; padding: 4px 8px; margin-bottom: 3px; background: #fafafa; border: solid 1px #eee; } .tab-v3 .nav-pills li a:hover, .tab-v3 .nav-pills li.active a { color: #fff; background: #72c02c; border: solid 1px #68af28; } .tab-v3 .nav-pills li i { width: 1.25em; margin-right: 5px; text-align: center; display: inline-block; } .tab-v3 .tab-content { padding: 15px; background: #fafafa; border: solid 1px #eee; } /*Accordion v1*/ .acc-v1 .panel-heading { padding: 0; box-shadow: none; } .acc-v1 .panel-heading a { display: block; font-size: 14px; padding: 5px 15px; background: #fefefe; } .acc-icon a.accordion-toggle i { color: #555; margin-right: 8px; } .acc-icon a.accordion-toggle:hover i { color: #39414c; } /*Pegination*/ .pagination li a { color: #777; padding: 5px 15px; } .pagination li a:hover { color: #fff; background: #5fb611; border-color: #5fb611; } .pagination > .active > a, .pagination > .active > span, .pagination > .active > a:hover, .pagination > .active > span:hover, .pagination > .active > a:focus, .pagination > .active > span:focus { border-color: #72c02c; background-color: #72c02c; } /*Pagination Without Space*/ .pagination-no-space .pagination { margin: 0; } /*Pager*/ .pager li > a:hover, .pager li > a:focus { color: #fff; background: #5fb611; border-color: #5fb611; } .pager.pager-v2 li > a { border: none; } .pager.pager-v2 li > a, .pager.pager-v3 li > a { -webkit-transition: all 0.1s ease-in-out; -moz-transition: all 0.1s ease-in-out; -o-transition: all 0.1s ease-in-out; transition: all 0.1s ease-in-out; } .pager.pager-v2 li > a:hover, .pager.pager-v2 li > a:focus, .pager.pager-v3 li > a:hover, .pager.pager-v3 li > a:focus { color: #fff; background: #72c02c; } /*Pager Amount*/ .pager.pager-v2 li.page-amount, .pager.pager-v3 li.page-amount { font-size: 16px; font-style: italic; } .pager.pager-v2 li.page-amount, .pager.pager-v2 li.page-amount:hover, .pager.pager-v2 li.page-amount:focus, .pager.pager-v3 li.page-amount, .pager.pager-v3 li.page-amount:hover, .pager.pager-v3 li.page-amount:focus { top: 7px; color: #777; position: relative; } /*Pager Size*/ .pager.pager-v2.pager-md li a, .pager.pager-v3.pager-md li a { font-size: 16px; padding: 8px 18px; } /*Sidebar Menu v1*/ .sidebar-nav-v1 li { padding: 0; } .sidebar-nav-v1 li a { display: block; padding: 8px 30px 8px 10px; } .sidebar-nav-v1 li a:hover { text-decoration: none; } .sidebar-nav-v1 > li.active, .sidebar-nav-v1 > li.active:hover { background: #717984; } .sidebar-nav-v1 > li.active, .sidebar-nav-v1 > li.active:hover, .sidebar-nav-v1 > li.active:focus { border-color: #ddd; } .sidebar-nav-v1 > li.active > a { color: #fff; } /*Sidebar Sub Navigation*/ .sidebar-nav-v1 li ul { padding: 0; list-style: none; } .sidebar-nav-v1 li ul, .sidebar-nav-v1 li.active ul a { background: #f8f8f8; } .sidebar-nav-v1 li ul a { color: #555; font-size: 12px; border-top: solid 1px #ddd; padding: 6px 30px 6px 17px; } .sidebar-nav-v1 ul li:hover a, .sidebar-nav-v1 ul li.active a { color: #72c02c; } /*Sidebar Badges*/ .list-group-item li > .badge { float: right; } .sidebar-nav-v1 span.badge { margin-top: 8px; margin-right: 10px; } .sidebar-nav-v1 .list-toggle > span.badge { margin-right: 25px; } .sidebar-nav-v1 ul li span.badge { margin-top: 8px; font-size: 11px; padding: 3px 5px; margin-right: 10px; } /*Sidebar List Toggle*/ .list-toggle:after { top: 7px; right: 10px; color: #777; font-size: 14px; content: "\f105"; position: absolute; font-weight: normal; display: inline-block; font-family: FontAwesome; } .list-toggle.active:after { color: #fff; content: "\f107"; } .btn { box-shadow: none; } .btn-u { border: 0; color: #fff; font-size: 14px; cursor: pointer; font-weight: 400; padding: 6px 13px; position: relative; background: #72c02c; white-space: nowrap; display: inline-block; text-decoration: none; } .btn-u:hover { color: #fff; text-decoration: none; -webkit-transition: all 0.3s ease-in-out; -moz-transition: all 0.3s ease-in-out; -o-transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out; } .btn-u.btn-block { text-align: center; } a.btn-u { /*padding: 4px 13px;*/ /*vertical-align: middle;*/ } .btn-u-sm, a.btn-u-sm { padding: 3px 12px; } .btn-u-lg, a.btn-u-lg { font-size: 18px; padding: 10px 25px; } .btn-u-xs, a.btn-u-xs { font-size: 12px; padding: 2px 12px; line-height: 18px; } /*Button Groups*/ .btn-group .dropdown-menu > li > a { padding: 3px 13px; } .btn-group > .btn-u, .btn-group-vertical > .btn-u { float: left; position: relative; } .btn-group > .btn-u:first-child { margin-left: 0; } /*For FF Only*/ @-moz-document url-prefix() { .footer-subsribe .btn-u { padding-bottom: 4px; } } @media (max-width: 768px) { @-moz-document url-prefix() { .btn-u { padding-bottom: 6px; } } } /*Buttons Color*/ .btn-u:hover, .btn-u:focus, .btn-u:active, .btn-u.active, .open .dropdown-toggle.btn-u { background: #5fb611; } .btn-u-split.dropdown-toggle { border-left: solid 1px #5fb611; } .btn-u.btn-u-blue { background: #3498db; } .btn-u.btn-u-blue:hover, .btn-u.btn-u-blue:focus, .btn-u.btn-u-blue:active, .btn-u.btn-u-blue.active, .open .dropdown-toggle.btn-u.btn-u-blue { background: #2980b9; } .btn-u.btn-u-split-blue.dropdown-toggle { border-left: solid 1px #2980b9; } .btn-u.btn-u-red { background: #e74c3c; } .btn-u.btn-u-red:hover, .btn-u.btn-u-red:focus, .btn-u.btn-u-red:active, .btn-u.btn-u-red.active, .open .dropdown-toggle.btn-u.btn-u-red { background: #c0392b; } .btn-u.btn-u-split-red.dropdown-toggle { border-left: solid 1px #c0392b; } .btn-u.btn-u-orange { background: #e67e22; } .btn-u.btn-u-orange:hover, .btn-u.btn-u-orange:focus, .btn-u.btn-u-orange:active, .btn-u.btn-u-orange.active, .open .dropdown-toggle.btn-u.btn-u-orange { background: #d35400; } .btn-u.btn-u-split-orange.dropdown-toggle { border-left: solid 1px #d35400; } .btn-u.btn-u-sea { background: #1abc9c; } .btn-u.btn-u-sea:hover, .btn-u.btn-u-sea:focus, .btn-u.btn-u-sea:active, .btn-u.btn-u-sea.active, .open .dropdown-toggle.btn-u.btn-u-sea { background: #16a085; } .btn-u.btn-u-split-sea.dropdown-toggle { border-left: solid 1px #16a085; } .btn-u.btn-u-green { background: #2ecc71; } .btn-u.btn-u-green:hover, .btn-u.btn-u-green:focus, .btn-u.btn-u-green:active, .btn-u.btn-u-green.active, .open .dropdown-toggle.btn-u.btn-u-green { background: #27ae60; } .btn-u.btn-u-split-green.dropdown-toggle { border-left: solid 1px #27ae60; } .btn-u.btn-u-yellow { background: #f1c40f; } .btn-u.btn-u-yellow:hover, .btn-u.btn-u-yellow:focus, .btn-u.btn-u-yellow:active, .btn-u.btn-u-yellow.active, .open .dropdown-toggle.btn-u.btn-u-yellow { background: #f39c12; } .btn-u.btn-u-split-yellow.dropdown-toggle { border-left: solid 1px #f39c12; } .btn-u.btn-u-default { background: #95a5a6; } .btn-u.btn-u-default:hover, .btn-u.btn-u-default:focus, .btn-u.btn-u-default:active, .btn-u.btn-u-default.active, .open .dropdown-toggle.btn-u.btn-u-default { background: #7f8c8d; } .btn-u.btn-u-split-default.dropdown-toggle { border-left: solid 1px #7f8c8d; } .btn-u.btn-u-purple { background: #9b6bcc; } .btn-u.btn-u-purple:hover, .btn-u.btn-u-purple:focus, .btn-u.btn-u-purple:active, .btn-u.btn-u-purple.active, .open .dropdown-toggle.btn-u.btn-u-purple { background: #814fb5; } .btn-u.btn-u-split-purple.dropdown-toggle { border-left: solid 1px #814fb5; } .btn-u.btn-u-aqua { background: #27d7e7; } .btn-u.btn-u-aqua:hover, .btn-u.btn-u-aqua:focus, .btn-u.btn-u-aqua:active, .btn-u.btn-u-aqua.active, .open .dropdown-toggle.btn-u.btn-u-aqua { background: #26bac8; } .btn-u.btn-u-split-aqua.dropdown-toggle { border-left: solid 1px #26bac8; } .btn-u.btn-u-brown { background: #9c8061; } .btn-u.btn-u-brown:hover, .btn-u.btn-u-brown:focus, .btn-u.btn-u-brown:active, .btn-u.btn-u-brown.active, .open .dropdown-toggle.btn-u.btn-u-brown { background: #81674b; } .btn-u.btn-u-split-brown.dropdown-toggle { border-left: solid 1px #81674b; } .btn-u.btn-u-dark-blue { background: #4765a0; } .btn-u.btn-u-dark-blue:hover, .btn-u.btn-u-dark-blue:focus, .btn-u.btn-u-dark-blue:active, .btn-u.btn-u-dark-blue.active, .open .dropdown-toggle.btn-u.btn-u-dark-blue { background: #324c80; } .btn-u.btn-u-split-dark.dropdown-toggle { border-left: solid 1px #324c80; } .btn-u.btn-u-light-green { background: #79d5b3; } .btn-u.btn-u-light-green:hover, .btn-u.btn-u-light-green:focus, .btn-u.btn-u-light-green:active, .btn-u.btn-u-light-green.active, .open .dropdown-toggle.btn-u.btn-u-light-green { background: #59b795; } .btn-u.<API key>.dropdown-toggle { border-left: solid 1px #59b795; } .btn-u.btn-u-dark { background: #555; } .btn-u.btn-u-dark:hover, .btn-u.btn-u-dark:focus, .btn-u.btn-u-dark:active, .btn-u.btn-u-dark.active, .open .dropdown-toggle.btn-u.btn-u-dark { background: #333; } .btn-u.btn-u-split-dark.dropdown-toggle { border-left: solid 1px #333; } .btn-u.btn-u-light-grey { background: #585f69; } .btn-u.btn-u-light-grey:hover, .btn-u.btn-u-light-grey:focus, .btn-u.btn-u-light-grey:active, .btn-u.btn-u-light-grey.active, .open .dropdown-toggle.btn-u.btn-u-light-grey { background: #484f58; } .btn-u.<API key>.dropdown-toggle { border-left: solid 1px #484f58; } /*Bordered Buttons*/ .btn-u.btn-brd { color: #555; /*font-weight: 200;*/ background: none; padding: 5px 13px; border: solid 1px transparent; -webkit-transition: all 0.1s ease-in-out; -moz-transition: all 0.1s ease-in-out; -o-transition: all 0.1s ease-in-out; transition: all 0.1s ease-in-out; } .btn-u.btn-brd:hover { background: none; border: solid 1px #eee; } .btn-u.btn-brd:focus { background: none; } .btn-u.btn-brd.btn-brd-hover:hover { color: #fff !important; } .btn-u.btn-brd { border-color: #72c02c; } .btn-u.btn-brd:hover { color: #5fb611; border-color: #5fb611; } .btn-u.btn-brd.btn-brd-hover:hover { background: #5fb611; } .btn-u.btn-brd.btn-u-blue { border-color: #3498db; } .btn-u.btn-brd.btn-u-blue:hover { color: #2980b9; border-color: #2980b9; } .btn-u.btn-brd.btn-u-blue.btn-brd-hover:hover { background: #2980b9; } .btn-u.btn-brd.btn-u-red { border-color: #e74c3c; } .btn-u.btn-brd.btn-u-red:hover { color: #c0392b; border-color: #c0392b; } .btn-u.btn-brd.btn-u-red.btn-brd-hover:hover { background: #c0392b; } .btn-u.btn-brd.btn-u-orange { border-color: #e67e22; } .btn-u.btn-brd.btn-u-orange:hover { color: #d35400; border-color: #d35400; } .btn-u.btn-brd.btn-u-orange.btn-brd-hover:hover { background: #d35400; } .btn-u.btn-brd.btn-u-sea { border-color: #1abc9c; } .btn-u.btn-brd.btn-u-sea:hover { color: #16a085; border-color: #16a085; } .btn-u.btn-brd.btn-u-sea.btn-brd-hover:hover { background: #16a085; } .btn-u.btn-brd.btn-u-green { border-color: #2ecc71; } .btn-u.btn-brd.btn-u-green:hover { color: #27ae60; border-color: #27ae60; } .btn-u.btn-brd.btn-u-green.btn-brd-hover:hover { background: #27ae60; } .btn-u.btn-brd.btn-u-yellow { border-color: #f1c40f; } .btn-u.btn-brd.btn-u-yellow:hover { color: #f39c12; border-color: #f39c12; } .btn-u.btn-brd.btn-u-yellow.btn-brd-hover:hover { background: #f39c12; } .btn-u.btn-brd.btn-u-default { border-color: #95a5a6; } .btn-u.btn-brd.btn-u-default:hover { color: #7f8c8d; border-color: #7f8c8d; } .btn-u.btn-brd.btn-u-default.btn-brd-hover:hover { background: #7f8c8d; } .btn-u.btn-brd.btn-u-dark { border-color: #555; } .btn-u.btn-brd.btn-u-dark:hover { color: #333; border-color: #333; } .btn-u.btn-brd.btn-u-dark.btn-brd-hover:hover { background: #333; } .btn-u.btn-brd.btn-u-light-grey { border-color: #585f69; } .btn-u.btn-brd.btn-u-light-grey:hover { color: #484f58; border-color: #484f58; } .btn-u.btn-brd.btn-u-light-grey.btn-brd-hover:hover { background: #484f58; } .btn-u.btn-brd.btn-u-purple { border-color: #9b6bcc; } .btn-u.btn-brd.btn-u-purple:hover { color: #814fb5; border-color: #814fb5; } .btn-u.btn-brd.btn-u-purple.btn-brd-hover:hover { background: #814fb5; } .btn-u.btn-brd.btn-u-aqua { border-color: #27d7e7; } .btn-u.btn-brd.btn-u-aqua:hover { color: #26bac8; border-color: #26bac8; } .btn-u.btn-brd.btn-u-aqua.btn-brd-hover:hover { background: #26bac8; } .btn-u.btn-brd.btn-u-brown { border-color: #9c8061; } .btn-u.btn-brd.btn-u-brown:hover { color: #81674b; border-color: #81674b; } .btn-u.btn-brd.btn-u-brown.btn-brd-hover:hover { background: #81674b; } .btn-u.btn-brd.btn-u-dark-blue { border-color: #4765a0; } .btn-u.btn-brd.btn-u-dark-blue:hover { color: #324c80; border-color: #324c80; } .btn-u.btn-brd.btn-u-dark-blue.btn-brd-hover:hover { background: #324c80; } .btn-u.btn-brd.btn-u-light-green { border-color: #79d5b3; } .btn-u.btn-brd.btn-u-light-green:hover { color: #59b795; border-color: #59b795; } .btn-u.btn-brd.btn-u-light-green.btn-brd-hover:hover { background: #59b795; } .btn-u.btn-brd.btn-u-light { color: #fff; border-color: #fff; } .btn-u.btn-brd.btn-u-light:hover { border-color: #fff; } .btn-u.btn-brd.btn-u-light.btn-brd-hover:hover { background: #fff; color: #555 !important; } .dropdown-show { box-shadow: 0 0 4px #eee; display: inline-block; position: relative; } /*Labels*/ span.label { font-size: 11px; font-weight: 400; padding: 4px 7px; } /*Badges*/ span.badge { font-weight: 400; padding: 4px 7px; } span.label-u, span.badge-u { background: #72c02c; } span.label-blue, span.badge-blue { background: #3498db; } span.label-red, span.badge-red { background: #e74c3c; } span.label-green, span.badge-green { background: #2ecc71; } span.label-sea, span.badge-sea { background: #1abc9c; } span.label-orange, span.badge-orange { background: #e67e22; } span.label-yellow, span.badge-yellow { background: #f1c40f; } span.label-purple, span.badge-purple { background: #9b6bcc; } span.label-aqua, span.badge-aqua { background: #27d7e7; } span.label-brown, span.badge-brown { background: #9c8061; } span.label-dark-blue, span.badge-dark-blue { background: #4765a0; } span.label-light-green, span.badge-light-green { background: #79d5b3; } span.label-light, span.badge-light { color: #777; background: #ecf0f1; } span.label-dark, span.badge-dark { background: #555; } /*Badge Lists*/ .badge-lists li { position: relative; } .badge-lists span.badge { top: -10px; right: -6px; position: absolute; } /*Badge Icons*/ .badge-lists.badge-icons span.badge { min-width: 12px; padding: 3px 6px; } .badge-lists.badge-icons i { font-size: 18px; min-width: 25px; } /*Badge Box v1*/ .badge-box-v1 a { color: #777; min-width: 40px; font-size: 18px; padding: 8px 9px; display: inline-block; border: solid 1px #eee; } /*Badge Box v2*/ .badge-box-v2 a { color: #777; font-size: 12px; padding: 10px; min-width: 70px; text-align: center; display: inline-block; border: solid 1px #eee; } .badge-box-v2 a i { font-size: 20px; } /*General Badge Box*/ .badge-box-v1 a i, .badge-box-v2 a i { display: block; margin: 1px auto 2px; } .badge-box-v1 a:hover, .badge-box-v2 a:hover { color: #555; border-color: #555; text-decoration: none; -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; } /*Social Icons*/ .social-icons { margin: 0; padding: 0; } .social-icons li { list-style: none; margin-right: 3px; margin-bottom: 5px; text-indent: -9999px; display: inline-block; } .social-icons li a, a.social-icon { width: 28px; height: 28px; display: block; background-position: 0 0; background-repeat: no-repeat; transition: all 0.3s ease-in-out; -o-transition: all 0.3s ease-in-out; -ms-transition: all 0.3s ease-in-out; -moz-transition: all 0.3s ease-in-out; -webkit-transition: all 0.3s ease-in-out; } .social-icons li:hover a { background-position: 0 -38px; } .social-icons-color li a { opacity: 0.7; background-position: 0 -38px !important; -<API key>: hidden; /*For Chrome*/ } .social-icons-color li a:hover { opacity: 1; } .social_amazon {background: url(../img/icons/social/amazon.png) no-repeat;} .social_behance {background: url(../img/icons/social/behance.png) no-repeat;} .social_blogger {background: url(../img/icons/social/blogger.png) no-repeat;} .social_deviantart {background: url(../img/icons/social/deviantart.png) no-repeat;} .social_dribbble {background: url(../img/icons/social/dribbble.png) no-repeat;} .social_dropbox {background: url(../img/icons/social/dropbox.png) no-repeat;} .social_evernote {background: url(../img/icons/social/evernote.png) no-repeat;} .social_facebook {background: url(../img/icons/social/facebook.png) no-repeat;} .social_forrst {background: url(../img/icons/social/forrst.png) no-repeat;} .social_github {background: url(../img/icons/social/github.png) no-repeat;} .social_googleplus {background: url(../img/icons/social/googleplus.png) no-repeat;} .social_jolicloud {background: url(../img/icons/social/jolicloud.png) no-repeat;} .social_last-fm {background: url(../img/icons/social/last-fm.png) no-repeat;} .social_linkedin {background: url(../img/icons/social/linkedin.png) no-repeat;} .social_picasa {background: url(../img/icons/social/picasa.png) no-repeat;} .social_pintrest {background: url(../img/icons/social/pintrest.png) no-repeat;} .social_rss {background: url(../img/icons/social/rss.png) no-repeat;} .social_skype {background: url(../img/icons/social/skype.png) no-repeat;} .social_spotify {background: url(../img/icons/social/spotify.png) no-repeat;} .social_stumbleupon {background: url(../img/icons/social/stumbleupon.png) no-repeat;} .social_tumblr {background: url(../img/icons/social/tumblr.png) no-repeat;} .social_twitter {background: url(../img/icons/social/twitter.png) no-repeat;} .social_vimeo {background: url(../img/icons/social/vimeo.png) no-repeat;} .social_wordpress {background: url(../img/icons/social/wordpress.png) no-repeat;} .social_xing {background: url(../img/icons/social/xing.png) no-repeat;} .social_yahoo {background: url(../img/icons/social/yahoo.png) no-repeat;} .social_youtube {background: url(../img/icons/social/youtube.png) no-repeat;} .social_vk {background: url(../img/icons/social/vk.png) no-repeat;} .social_instagram {background: url(../img/icons/social/instagram.png) no-repeat;} /*Font Awesome Icon Styles*/ i.icon-custom { color: #555; width: 40px; height: 40px; font-size: 20px; line-height: 40px; margin-bottom: 5px; text-align: center; display: inline-block; border: solid 1px #555; } i.icon-sm { width: 35px; height: 35px; font-size: 16px; line-height: 35px; } i.icon-md { width: 55px; height: 55px; font-size: 22px; line-height: 55px; } i.icon-lg { width: 60px; height: 60px; font-size: 31px; line-height: 60px; margin-bottom: 10px; } i.icon-2x { font-size: 30px; } i.icon-3x { font-size: 40px; } i.icon-4x { font-size: 50px; } /*Line Icons*/ i.icon-line { font-size: 17px; } i.icon-sm.icon-line { font-size: 14px; } i.icon-md.icon-line { font-size: 22px; } i.icon-lg.icon-line { font-size: 28px; } i.icon-2x.icon-line { font-size: 27px; } i.icon-3x.icon-line { font-size: 36px; } i.icon-4x.icon-line { font-size: 47px; } /*Icon Styles For Links*/ .link-icon, .link-bg-icon { color: #555; } .link-icon:hover, .link-bg-icon:hover { border: none; text-decoration: none; } .link-icon:hover i { color: #72c02c; background: none; border: solid 1px #72c02c; } .link-bg-icon:hover i { color: #72c02c; background: #72c02c; border-color: #72c02c; color: #fff !important; } /*Icons Color*/ i.icon-color-u, i.icon-color-red, i.icon-color-sea, i.icon-color-dark, i.icon-color-grey, i.icon-color-blue, i.icon-color-green, i.icon-color-yellow, i.icon-color-orange, i.icon-color-purple, i.icon-color-aqua, i.icon-color-brown, i.<API key>, i.<API key>, i.<API key>, { background: none; } i.icon-color-u { color: #72c02c; border: solid 1px #72c02c; } i.icon-color-blue { color: #3498db; border: solid 1px #3498db; } i.icon-color-red { color: #e74c3c; border: solid 1px #e74c3c; } i.icon-color-sea { color: #1abc9c; border: solid 1px #1abc9c; } i.icon-color-green { color: #2ecc71; border: solid 1px #2ecc71; } i.icon-color-yellow { color: #f1c40f; border: solid 1px #f1c40f; } i.icon-color-orange { color: #e67e22; border: solid 1px #e67e22; } i.icon-color-grey { color: #95a5a6; border: solid 1px #95a5a6; } i.icon-color-purple { color: #9b6bcc; border: solid 1px #9b6bcc; } i.icon-color-aqua { color: #27d7e7; border: solid 1px #27d7e7; } i.icon-color-brown { color: #9c8061; border: solid 1px #9c8061; } i.<API key> { color: #4765a0; border: solid 1px #4765a0; } i.<API key> { color: #79d5b3; border: solid 1px #79d5b3; } i.icon-color-light { color: #fff; border: solid 1px #fff; } i.<API key> { color: #585f69; border: solid 1px #585f69; } /*Icons Backgroun Color*/ i.icon-bg-u, i.icon-bg-red, i.icon-bg-sea, i.icon-bg-dark, i.icon-bg-darker, i.icon-bg-grey, i.icon-bg-blue, i.icon-bg-green, i.icon-bg-yellow, i.icon-bg-orange, i.icon-bg-purple, i.icon-bg-aqua, i.icon-bg-brown, i.icon-bg-dark-blue, i.icon-bg-light-grey, i.icon-bg-light-green { color: #fff; border-color: transparent; } i.icon-bg-u { background: #72c02c; } i.icon-bg-blue { background: #3498db; } i.icon-bg-red { background: #e74c3c; } i.icon-bg-sea { background: #1abc9c; } i.icon-bg-green { background: #2ecc71; } i.icon-bg-yellow { background: #f1c40f; } i.icon-bg-orange { background: #e67e22; } i.icon-bg-grey { background: #95a5a6; } i.icon-bg-dark { background: #555; } i.icon-bg-darker { background: #333; } i.icon-bg-purple { background: #9b6bcc; } i.icon-bg-aqua { background: #27d7e7; } i.icon-bg-brown { background: #9c8061; } i.icon-bg-dark-blue { background: #4765a0; } i.icon-bg-light-green { background: #79d5b3; } i.icon-bg-light { background: #fff; border-color: transparent; } i.icon-bg-light-grey { background: #585f69; border-color: transparent; } /* Make Font Awesome icons fixed width */ .fa-fixed [class^="fa"], .fa-fixed [class*=" fa"] { width: 1.25em; text-align: center; display: inline-block; } .fa-fixed [class^="fa"].fa-lg, .fa-fixed [class*=" fa"].fa-lg { /* increased font size for fa-lg */ width: 1.5625em; } /*Content Boxes v1*/ .content-boxes-v1 { text-align: center; } .content-boxes-v1 span { display: block; margin-top: 5px; } /*Content Boxes v2*/ @media (max-width: 992px) { .content-boxes-v2, .content-boxes-v2 .text-justify { text-align: center; } .content-boxes-v2 span { display: block; margin-top: 5px; } } /*Content Boxes v3*/ .content-boxes-v3 i.icon-custom { top: 8px; float: left; position: relative; } .content-boxes-v3 .content-boxes-in-v3 { padding: 0 10px; overflow: hidden; } .content-boxes-v3 .content-boxes-in-v3 h3 { font-size: 18px; line-height: 22px; margin-bottom: 3px; text-transform: capitalize; } .content-boxes-v3 .content-boxes-in-v3 h3 a { color: #555; } /*Content Boxes Right v3*/ .content-boxes-v3.<API key> { text-align: right; } .content-boxes-v3.<API key> i.icon-custom { float: right; margin-left: 10px; } @media (max-width: 768px){ .content-boxes-v3.<API key> { text-align: inherit; } .content-boxes-v3.<API key> i.icon-custom { float: left; margin-left: 0; } } /*Content Boxes v4*/ .content-boxes-v4 h2 { color: #555; font-size: 18px; font-weight: bold; text-transform: uppercase; } .content-boxes-v4 a { color: #777; font-size: 11px; font-weight: bold; text-transform: uppercase; } .content-boxes-v4 i { width: 25px; color: #72c02c; font-size: 35px; margin-top: 10px; } .content-boxes-in-v4 { padding: 0 10px; overflow: hidden; } .content-boxes-v4-sm i { font-size: 26px; margin-top: 10px; margin-right: 5px; } /*Content Boxes v5*/ .content-boxes-v5 i { float: left; color: #999; width: 50px; height: 50px; padding: 11px; font-size: 22px; background: #eee; line-height: 28px; text-align: center; margin-right: 15px; display: inline-block; } .content-boxes-v5:hover i { color: #fff; background: #72c02c; } /*Content Boxes v6*/ .content-boxes-v6 { padding-top: 25px; text-align: center; } .content-boxes-v6 i { color: #fff; width: 90px; height: 90px; padding: 30px; font-size: 30px; line-height: 30px; position: relative; text-align: center; background: #dedede; margin-bottom: 25px; display: inline-block; } .content-boxes-v6 i:after { top: -8px; left: -8px; right: -8px; bottom: -8px; content: " "; position: absolute; border: 1px solid #dedede; border-radius: 50% !important; } .content-boxes-v6:hover i, .content-boxes-v6:hover i:after { -webkit-transition: all 0.3s ease-in-out; -moz-transition: all 0.3s ease-in-out; -o-transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out; } .content-boxes-v6:hover i { background: #72c02c; } .content-boxes-v6:hover i:after { border-color: #72c02c; } .service-block { padding: 20px 30px; text-align: center; margin-bottom: 20px; } .service-block p, .service-block h2 { color: #fff; } .service-block h2 a:hover{ text-decoration: none; } .service-block-light, .<API key> { background: #fafafa; border: solid 1px #eee; } .<API key>:hover { box-shadow: 0 0 8px #eee; } .service-block-light p, .service-block-light h2, .<API key> p, .<API key> h2 { color: #555; } .service-block-u { background: #72c02c; } .service-block-blue { background: #3498db; } .service-block-red { background: #e74c3c; } .service-block-sea { background: #1abc9c; } .service-block-grey { background: #95a5a6; } .<API key> { background: #f1c40f; } .<API key> { background: #e67e22; } .service-block-green { background: #2ecc71; } .<API key> { background: #9b6bcc; } .service-block-aqua { background: #27d7e7; } .service-block-brown { background: #9c8061; } .<API key> { background: #4765a0; } .<API key> { background: #79d5b3; } .service-block-dark { background: #555; } .service-block-light { background: #ecf0f1; } .funny-boxes { background: #f7f7f7; padding: 20px 20px 15px; -webkit-transition:all 0.3s ease-in-out; -moz-transition:all 0.3s ease-in-out; -o-transition:all 0.3s ease-in-out; transition:all 0.3s ease-in-out; } .funny-boxes h2 { margin-top: 0; font-size: 18px; line-height: 20px; } .funny-boxes h2 a { color: #555; } .funny-boxes p a { color: #72c02c; } .funny-boxes .funny-boxes-img li { font-size: 12px; margin-bottom: 2px; } .funny-boxes .funny-boxes-img li i { color: #72c02c; font-size: 12px; margin-right: 5px; } @media (max-width: 992px) { .funny-boxes .funny-boxes-img li { display: inline-block; } } .funny-boxes .funny-boxes-img img { margin: 5px 10px 15px 0; } .funny-boxes ul.funny-boxes-rating li { display: inline-block; } .funny-boxes ul.funny-boxes-rating li i { color: #f8be2c; cursor: pointer; font-size: 14px; } .funny-boxes ul.funny-boxes-rating li i:hover { color: #f8be2c; } /*Funny Colored Boxes*/ .funny-boxes-colored p, .funny-boxes-colored h2 a, .funny-boxes-colored .funny-boxes-img li, .funny-boxes-colored .funny-boxes-img li i { color: #fff; } /*Red Funny Box*/ .funny-boxes-red { background: #e74c3c; } /*Dark Red Funny Box*/ .funny-boxes-purple { background: #9b6bcc; } /*Blue Funny Box*/ .funny-boxes-blue { background: #3498db; } /*Grey Funny Box*/ .funny-boxes-grey { background: #95a5a6; } /*Turquoise Funny Box*/ .funny-boxes-sea { background: #1abc9c; } /*Turquoise Top Bordered Funny Box*/ .funny-boxes-top-sea { border-top: solid 2px #1abc9c; } .funny-boxes-top-sea:hover { border-top-color: #16a085; } /*Yellow Top Bordered Funny Box**/ .<API key> { border-top: solid 2px #f1c40f; } .<API key>:hover { border-top-color: #f39c12; } /*Red Top Bordered Funny Box**/ .funny-boxes-top-red { border-top: solid 2px #e74c3c; } .funny-boxes-top-red:hover { border-top-color: #c0392b; } /*Purple Top Bordered Funny Box**/ .<API key> { border-top: solid 2px #9b6bcc; } .<API key>:hover { border-top-color: #814fb5; } /*Orange Left Bordered Funny Box**/ .<API key> { border-left: solid 2px #e67e22; } .<API key>:hover { border-left-color: #d35400; } /*Green Left Bordered Funny Box**/ .<API key> { border-left: solid 2px #72c02c; } .<API key>:hover { border-left-color: #5fb611; } /*Blue Left Bordered Funny Box**/ .<API key> { border-left: solid 2px #3498db; } .<API key>:hover { border-left-color: #2980b9; } /*Dark Left Bordered Funny Box**/ .<API key> { border-left: solid 2px #555; } .<API key>:hover { border-left-color: #333; } .text-justify p { text-align: justify;} .<API key> { text-transform: uppercase;} .<API key> { text-transform: inherit !important;} .font-bold { font-weight: 600;} .font-light { font-weight: 200;} .font-normal { font-weight: 400 !important;} /*Text Dropcap*/ .dropcap { float: left; color: #72c02c; padding: 5px 0; font-size: 45px; font-weight: 200; line-height: 30px; margin: 0px 5px 0 0; } .dropcap-bg { float: left; color: #fff; padding: 7px 0; min-width: 50px; font-size: 35px; font-weight: 200; line-height: 35px; text-align: center; background: #72c02c; margin: 4px 10px 0 0; } /*Text Highlights*/ .text-highlights { color: #fff; font-weight: 200; padding: 0px 5px; background: #555; } .<API key> { background: #72c02c; } .<API key> { background: #3498db; } .text-highlights-red { background: #e74c3c; } .text-highlights-sea { background: #1abc9c; } .<API key> { background: #e67e22; } .<API key> { background: #f1c40f; } .<API key> { background: #9b6bcc; } .<API key> { background: #27d7e7; } .<API key> { background: #9c8061; } .<API key> { background: #4765a0; } .<API key> { background: #79d5b3; } /*Text Borders*/ .text-border { border-bottom: dashed 1px #555; } .text-border-default { border-color: #95a5a6; } .text-border-green { border-color: #72c02c; } .text-border-blue { border-color: #3498db; } .text-border-red { border-color: #e74c3c; } .text-border-yellow { border-color: #f1c40f; } .text-border-purple { border-color: #9b6bcc; } /*List Styles*/ .list-styles li { margin-bottom: 8px; } /*Contextual Backgrounds*/ .contex-bg p { opacity: 0.8; padding: 8px 10px; } .contex-bg p:hover { opacity: 1; } /*Blockquote*/ blockquote { padding: 5px 15px; border-left-width: 2px; } blockquote p { font-size: 14px; font-weight: 400; } blockquote h1, blockquote h2, blockquote span { font-size: 18px; margin: 0 0 8px; line-height: 24px; } /*Blockquote Styles*/ blockquote.bq-text-lg p, blockquote.bq-text-lg small { text-transform: uppercase; } blockquote.bq-text-lg p { font-size: 22px; font-weight: 300; line-height: 32px; } blockquote.text-right, blockquote.hero.text-right { border-left: none; border-right: 2px solid #eee; } blockquote.hero.text-right, blockquote.hero.text-right:hover { border-color: #555; } blockquote:hover, blockquote.text-right:hover { border-color: #72c02c; -webkit-transition: all 0.4s ease-in-out; -moz-transition: all 0.4s ease-in-out; -o-transition: all 0.4s ease-in-out; transition: all 0.4s ease-in-out; } blockquote.bq-dark, blockquote.bq-dark:hover { border-color: #585f69; } blockquote.bq-green { border-color: #72c02c; } /*Blockquote Hero Styles*/ blockquote.hero { border: none; padding: 18px; font-size: 16px; background: #f3f3f3; border-left: solid 2px #666; } blockquote.hero:hover { background: #eee; border-left-color: #666; } blockquote.hero.hero-dark, blockquote.hero.hero-default { border: none; } blockquote.hero.hero-dark { background: #444; } blockquote.hero.hero-dark:hover { background: #555; } blockquote.hero.hero-default { background: #72c02c; } blockquote.hero.hero-default:hover { background: #5fb611; } blockquote.hero.hero-dark p, blockquote.hero.hero-dark h2, blockquote.hero.hero-dark small, blockquote.hero.hero-default p, blockquote.hero.hero-default h2, blockquote.hero.hero-default small { color: #fff; font-weight: 200; } .tag-box { padding: 20px; background: #fff; margin-bottom: 30px; } .tag-box h2 { font-size: 20px; line-height: 25px; } .tag-box p { margin-bottom: 0; } .tag-box.tag-text-space p { margin-bottom: 10px; } /*Tag Boxes v1*/ .tag-box-v1 { border: solid 1px #eee; border-top: solid 2px #72c02c; } /*Tag Boxes v2*/ .tag-box-v2 { background: #fafafa; border: solid 1px #eee; border-left: solid 2px #72c02c; } /*Tag Boxes v3*/ .tag-box-v3 { border: solid 2px #eee; } /*Tag Boxes v4*/ .tag-box-v4 { border: dashed 1px #bbb; } /*Tag Boxes v5*/ .tag-box-v5 { margin: 20px 0; text-align: center; border: dashed 1px #ccc; } .tag-box-v5 span { color: #555; font-size: 28px; margin-bottom: 0; } /*Tag Boxes v6*/ .tag-box-v6 { background: #fafafa; border: solid 1px #eee; } /*Tag Boxes v7*/ .tag-box-v7 { border: solid 1px #eee; border-bottom: solid 2px #72c02c; } /*Testimonials*/ .testimonials { margin-bottom: 10px; } .testimonials .testimonial-info { color: #72c02c; font-size: 16px; padding: 0 15px; margin-top: 18px; } .testimonials .testimonial-info span { top: 3px; position: relative; } .testimonials .testimonial-info em { color: #777; display: block; font-size: 13px; } .testimonials .testimonial-info img { width: 60px; float: left; height: 60px; padding: 2px; margin-right: 15px; border: solid 1px #ccc; } .testimonials .testimonial-author { overflow: hidden; } .testimonials .carousel-arrow { top: -65px; position: relative; } .testimonials .carousel-arrow i { color: #777; padding: 2px; min-width: 25px; font-size: 20px; text-align: center; background: #f5f5f5; } .testimonials .carousel-arrow i:hover { color: #fff; background: #72c02c; } .testimonials .carousel-control { opacity: 1; width: 100%; text-align: right; text-shadow: none; position: absolute; filter: Alpha(opacity = 100); /*For IE*/ } .testimonials .carousel-control.left { right: 27px; left: auto; } .testimonials .carousel-control.right { right: 0px; } /*Testimonials v1*/ .testimonials.testimonials-v1 .item p { position: relative; } .testimonials.testimonials-v1 .item p:after, .testimonials.testimonials-v1 .item p:before { left: 80px; bottom: -20px; } .testimonials.testimonials-v1 .item p:after { border-top: 22px solid; border-left: 0 solid transparent; border-right: 22px solid transparent; } /*Testimonials v2*/ .testimonials.testimonials-v2 .testimonial-info { padding: 0 20px; } .testimonials.testimonials-v2 p { padding-bottom: 15px; } .testimonials.testimonials-v2 .carousel-arrow { top: -55px; } .testimonials.testimonials-v2 .item p:after, .testimonials.testimonials-v2 .item p:before { left: 8%; bottom: 45px; } .testimonials.testimonials-v2 .item p:after { border-top: 20px solid; border-left: 25px solid transparent; border-right: 0px solid transparent; } /*General Testimonials v1/v2*/ .testimonials.testimonials-v1 p, .testimonials.testimonials-v2 p { padding: 15px; font-size: 14px; font-style: italic; background: #f5f5f5; } .testimonials.testimonials-v1 .item p:after, .testimonials.testimonials-v2 .item p:after { width: 0; height: 0; content: " "; display: block; position: absolute; border-top-color: #f5f5f5; border-left-style: inset; /*FF fixes*/ border-right-style: inset; /*FF fixes*/ } /*Testimonials Backgrounds*/ .<API key> .item p, .<API key> .item p { color: #fff; font-weight: 200; } .<API key> .carousel-arrow i, .<API key> .carousel-arrow i { color: #fff; } /*Testimonials Default*/ .<API key> .item p { background: #72c02c; } .testimonials.<API key> .item p:after, .testimonials.<API key> .item p:after { border-top-color: #72c02c; } .<API key> .carousel-arrow i { background: #72c02c; } .testimonials.<API key> .carousel-arrow i:hover { background: #5fb611; } /*Testimonials Dark*/ .<API key> .item p { background: #555; } .testimonials.<API key> .item p:after, .testimonials.<API key> .item p:after { border-top-color: #555; } .<API key> .carousel-arrow i { color: #fff; background: #555; } .testimonials.<API key> .carousel-arrow i:hover { background: #333; } .testimonials.<API key> .testimonial-info { color: #555; } .panel-heading { color: #fff; padding: 5px 15px; } /*Panel Table*/ .panel .table { margin-bottom: 0; } /*Panel Unify*/ .panel-u { border-color: #72c02c; } .panel-u > .panel-heading { background: #72c02c; } /*Panel Blue*/ .panel-blue { border-color: #3498db; } .panel-blue > .panel-heading { background: #3498db; } /*Panel Red*/ .panel-red { border-color: #e74c3c; } .panel-red > .panel-heading { background: #e74c3c; } /*Panel Green*/ .panel-green { border-color: #2ecc71; } .panel-green > .panel-heading { background: #2ecc71; } /*Panel Sea*/ .panel-sea { border-color: #1abc9c; } .panel-sea > .panel-heading { background: #1abc9c; } /*Panel Orange*/ .panel-orange { border-color: #e67e22; } .panel-orange > .panel-heading { background: #e67e22; } /*Panel Yellow*/ .panel-yellow { border-color: #f1c40f; } .panel-yellow > .panel-heading { background: #f1c40f; } /*Panel Grey*/ .panel-grey { border-color: #95a5a6; } .panel-grey > .panel-heading { background: #95a5a6; } /*Panel Dark*/ .panel-dark { border-color: #555; } .panel-dark > .panel-heading { background: #555; } /*Panel Purple*/ .panel-purple { border-color: #9b6bcc; } .panel-purple > .panel-heading { background: #9b6bcc; } /*Panel Aqua*/ .panel-aqua { border-color: #27d7e7; } .panel-aqua > .panel-heading { background: #27d7e7; } /*Panel Brown*/ .panel-brown { border-color: #9c8061; } .panel-brown > .panel-heading { background: #9c8061; } /*Panel Dark Blue*/ .panel-dark-blue { border-color: #4765a0; } .panel-dark-blue > .panel-heading { background: #4765a0; } /*Panel Light Green*/ .panel-light-green { border-color: #79d5b3; } .panel-light-green > .panel-heading { background: #79d5b3; } /*Panel Default Dark*/ .panel-default-dark { border-color: #585f69; } .panel-default-dark > .panel-heading { background: #585f69; } .progress-u { box-shadow: none; } .progress-u .progress-bar { box-shadow: none; } /*progress-bar (sizes)*/ .progress-lg { height: 25px; } .progress-lg p { padding-top: 3px; } .progress-sm { height: 12px; } .progress-xs { height: 7px; } .progress-xxs { height: 3px; } /*progress-bar (colors)*/ .progress { background: #e5e5e5; } .progress-bar-u { background: #72c02c; } .progress-bar-blue { background: #3498db; } .progress-bar-orange { background: #e67e22; } .progress-bar-red { background: #e74c3c; } .progress-bar-purple { background: #9b6bcc; } .progress-bar-aqua { background: #27d7e7; } .progress-bar-brown { background: #9c8061; } .<API key> { background: #4765a0; } .<API key> { background: #79d5b3; } .progress-bar-dark { background: #555; } .progress { position: relative; } .progress .progress-bar { overflow: hidden; line-height: 20px; position: absolute; } .progress-box .progress-bar { transition: all 3s ease-in; -o-transition: all 3s ease-in; -ms-transition: all 3s ease-in; -moz-transition: all 3s ease-in; -webkit-transition: all 3s ease-in; } /*Vertical Progress Bar*/ .progress.vertical { float: left; width: 100%; height: 200px; margin-right: 20px; } .progress.vertical.bottom { position: relative; } .progress.vertical .progress-bar { height: 0; width: 100%; transition: height 3s ease; -o-transition: height 3s ease; -ms-transition: height 3s ease; -moz-transition: height 3s ease; -webkit-transition: height 3s ease; } .progress.vertical.bottom .progress-bar { bottom: 0; position: absolute; } .stars-existing { color: #72c02c; cursor: pointer; } .star-lg { font-size: 30px; } .star-sm { font-size: 25px; } .star-xs { font-size: 20px; } .star-default { font-size: 16px; } /*Images*/ img.img-bordered { padding: 3px; border: solid 1px #eee; } img.img-circle { border-radius: 50% !important; } img.image-sm { width: 50px; height: 50px; } img.image-md { width: 100px; height: 100px; } /*Responsive Video*/ .responsive-video { height: 0; padding-top: 1px; position: relative; padding-bottom: 56.25%; /*16:9*/ } .responsive-video iframe { top: 0; left: 0; width: 100%; height: 100%; position: absolute; } .tags-v1 li { margin: 0; padding: 0; } .tags-v1 li a { font-size: 13px; padding: 4px 8px; line-height: 32px; border: solid 2px #eee; border-radius: 20px !important; -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; } .tags-v1 li a:hover { text-decoration: none; border-color: #e0e0e0; } .tags-v2 li { padding: 7px 0 7px 4px; } .tags-v2 li a { color: #555; font-size: 13px; padding: 5px 10px; border: solid 1px #bbb; } .tags-v2 li a:hover { color: #fff; background: #555; border-color: #555; text-decoration: none; -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; } .list-row { padding: 0; margin-bottom: 0; list-style: none; } /*Lists v1*/ .lists-v1 li { margin-bottom: 10px; } .lists-v1 i { color: #fff; width: 15px; height: 15px; padding: 1px; font-size: 13px; margin-right: 7px; text-align: center; background: #72c02c; display: inline-block; border-radius: 50% !important; } /*Lists v2*/ .lists-v2 li { margin-bottom: 10px; } .lists-v2 i { color: #72c02c; font-size: 13px; margin-right: 7px; display: inline-block; } /*Remove the Gutter Padding from Columns*/ .no-gutter > [class*='col-'] { padding-right: 0; padding-left: 0; } .no-gutter.no-gutter-boxed { padding-right: 15px; padding-left: 15px; } .height-100 { min-height: 100px;} .height-150 { min-height: 150px;} .height-200 { min-height: 200px;} .height-250 { min-height: 250px;} .height-300 { min-height: 300px;} .height-350 { min-height: 350px;} .height-400 { min-height: 400px;} .height-450 { min-height: 450px;} .height-500 { min-height: 500px !important;} .no-padding { padding: 0 !important; } .no-margin { margin: 0; } .no-top-space { margin-top: 0 !important; padding-top: 0 !important; } .no-bottom-space { margin-bottom: 0 !important; padding-bottom: 0 !important; } .no-margin-bottom { margin-bottom: 0 !important; } .no-padding-bottom { padding-bottom: 0 !important; } .content-xs { padding-top: 20px; padding-bottom: 20px; } .content { padding-top: 40px; padding-bottom: 40px; } .content-sm { padding-top: 60px; padding-bottom: 60px; } .content-md { padding-top: 80px; padding-bottom: 80px; } .content-lg { padding-top: 100px; padding-bottom: 100px; } .space-lg-hor { padding-left: 60px; padding-right: 60px; } .space-xlg-hor { padding-left: 100px; padding-right: 100px; } .margin-bottom-5, .margin-bottom-10, .margin-bottom-15, .margin-bottom-20, .margin-bottom-25, .margin-bottom-30, .margin-bottom-35, .margin-bottom-40, .margin-bottom-45, .margin-bottom-50, .margin-bottom-55, .margin-bottom-60 { clear:both; } .margin-bottom-5 { margin-bottom:5px;} .margin-bottom-10 { margin-bottom:10px;} .margin-bottom-15 { margin-bottom:15px;} .margin-bottom-20 { margin-bottom:20px;} .margin-bottom-25 { margin-bottom:25px;} .margin-bottom-30 { margin-bottom:30px;} .margin-bottom-35 { margin-bottom:35px;} .margin-bottom-40 { margin-bottom:40px;} .margin-bottom-45 { margin-bottom:45px;} .margin-bottom-50 { margin-bottom:50px;} .margin-bottom-55 { margin-bottom:55px;} .margin-bottom-60 { margin-bottom:60px;} .margin-bottom-80 { margin-bottom:80px;} .margin-bottom-100 { margin-bottom:100px;} @media (max-width: 768px) { .sm-margin-bottom-10 { margin-bottom: 10px; } .sm-margin-bottom-20 { margin-bottom: 20px; } .sm-margin-bottom-30 { margin-bottom: 30px; } .sm-margin-bottom-40 { margin-bottom: 40px; } .sm-margin-bottom-50 { margin-bottom: 50px; } .sm-margin-bottom-60 { margin-bottom: 60px; } } @media (max-width: 992px) { .md-margin-bottom-10 { margin-bottom: 10px; } .md-margin-bottom-20 { margin-bottom: 20px; } .md-margin-bottom-30 { margin-bottom: 30px; } .md-margin-bottom-40 { margin-bottom: 40px; } .md-margin-bottom-50 { margin-bottom: 50px; } .md-margin-bottom-60 { margin-bottom: 60px; } } /*Other Spaces*/ .margin-top-20 { margin-top: 20px;} .margin-left-5 { margin-left: 5px;} .margin-left-10 { margin-left: 10px;} .margin-right-5 { margin-right: 5px;} .margin-right-10 { margin-right: 10px;} .padding-top-5 { padding-top: 5px;} .padding-top-10 { padding-top: 10px;} .padding-top-20 { padding-top: 20px;} .padding-top-50 { padding-top: 50px;} .padding-top-70 { padding-top: 70px;} .padding-top-100 { padding-top: 100px;} .padding-left-5 { padding-left: 5px;} .padding-bottom-5 { padding-bottom: 5px;} .padding-bottom-10 { padding-bottom: 10px;} .padding-bottom-20 { padding-bottom: 20px;} .padding-bottom-30 { padding-bottom: 30px;} .padding-bottom-50 { padding-bottom: 50px;} .padding-bottom-70 { padding-bottom: 70px;} .padding-bottom-100 { padding-bottom: 100px;} .color-sea { color: #1abc9c;} .color-red { color: #e74c3c;} .color-aqua { color: #27d7e7;} .color-blue { color: #3498db;} .color-grey { color: #95a5a6;} .color-dark { color: #555555;} .color-green { color: #72c02c;} .color-brown { color: #9c8061;} .color-light { color: #ffffff;} .color-orange { color: #e67e22;} .color-yellow { color: #f1c40f;} .color-green1 { color: #2ecc71;} .color-purple { color: #9b6bcc;} .color-inherit { color: inherit;} .color-dark-blue { color: #4765a0;} .color-light-grey { color: #585f69;} .color-light-green { color: #79d5b3;} .bg-color-dark, .bg-color-sea, .bg-color-red, .bg-color-aqua, .bg-color-blue, .bg-color-grey, .bg-color-light, .bg-color-green, .bg-color-brown, .bg-color-orange, .bg-color-green1, .bg-color-purple, .bg-color-dark-blue, .bg-color-light-grey, .<API key> { color: #fff; } .bg-color-white { color: #555; } .bg-color-dark { background-color: #555 !important;} .bg-color-white { background-color: #fff !important;} .bg-color-sea { background-color: #1abc9c !important;} .bg-color-red { background-color: #e74c3c !important;} .bg-color-aqua { background-color: #27d7e7 !important;} .bg-color-blue { background-color: #3498db !important;} .bg-color-grey { background-color: #95a5a6 !important;} .bg-color-light { background-color: #f7f7f7 !important;} .bg-color-green { background-color: #72c02c !important;} .bg-color-brown { background-color: #9c8061 !important;} .bg-color-orange { background-color: #e67e22 !important;} .bg-color-green1 { background-color: #2ecc71 !important;} .bg-color-purple { background-color: #9b6bcc !important;} .bg-color-dark-blue { background-color: #4765a0 !important;} .bg-color-light-grey { background-color: #585f69 !important;} .<API key> { background-color: #79d5b3 !important;} .rgba-red { background-color: rgba(231,76,60,0.8);} .rgba-blue{ background-color: rgba(52,152,219,0.8);} .rgba-aqua { background-color: rgba(39,215,231,0.8);} .rgba-yellow { background-color: rgba(241,196,15,0.8);} .rgba-default { background-color: rgba(114,192,44,0.8);} .rgba-purple { background-color: rgba(155,107,204,0.8);} /*Grey Backroud*/ .bg-grey { background: #f7f7f7; border-top: solid 1px #eee; border-bottom: solid 1px #eee; } .bg-grey2 { background: #f4f6f6; } .no-rounded { border-radius: 0 !important;} .rounded { border-radius: 4px !important;} .rounded-x { border-radius: 50% !important;} .rounded-2x { border-radius: 10px !important;} .rounded-3x { border-radius: 15px !important;} .rounded-4x { border-radius: 20px !important;} .rounded-sm { border-radius: 2px !important;} .rounded-md { border-radius: 3px !important;} .rounded-top { border-radius: 4px 4px 0 0 !important;} .rounded-left { border-radius: 4px 0 0 4px !important;} .rounded-right { border-radius: 0 4px 4px 0 !important;} .rounded-bottom { border-radius: 0 0 4px 4px !important;} .overflow-h { overflow: hidden;} .overflow-a { overflow: auto;} .overflow-hidden { overflow: hidden;} .clear-both { clear: both;} /*Display*/ .dp-none { display: none;} .dp-block { display: block;} .dp-table { display: table;} .dp-inline-block { display: inline-block;} .dp-table-cell { display: table-cell; vertical-align: middle; } /*Full Width*/ .full-width { width: 100%; } /*Equal Height Columns*/ @media (max-width: 767px) { .equal-height-column { height: auto !important; } } /*Image Classes*/ .img-width-200 { width:200px;} .lft-img-margin { margin:0 20px 5px 0;} .rgt-img-margin { margin:0 0 5px 10px;} img.img-center, .img-center img { margin-left: auto; margin-right: auto; } /*Background Light*/ .bg-light { padding: 10px 15px; margin-bottom: 10px; background: #fcfcfc; border: solid 1px #e5e5e5; } .bg-light:hover { border: solid 1px #bbb; } /*CSS3 Hover Effects*/ .hover-effect { -webkit-transition: all 0.4s ease-in-out; -moz-transition: all 0.4s ease-in-out; -o-transition: all 0.4s ease-in-out; transition: all 0.4s ease-in-out; } .<API key> { left:10px; margin-left:-10px; position:relative; -webkit-transition: all 0.8s ease-in-out; -moz-transition: all 0.8s ease-in-out; -o-transition: all 0.8s ease-in-out; -ms-transition: all 0.8s ease-in-out; transition: all 0.8s ease-in-out; } .<API key>:hover { -webkit-transform: scale(2) rotate(5deg); -moz-transform: scale(2) rotate(5deg); -o-transform: scale(2) rotate(5deg); -ms-transform: scale(2) rotate(5deg); transform: scale(2) rotate(5deg); }
cmd_drivers/base/dd.o := arm-eabi-gcc -Wp,-MD,drivers/base/.dd.o.d -nostdinc -isystem /home/tim/ICS/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/include -I/home/tim/Downloads/<API key>/linux-2.6/arch/arm/include -Iinclude -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-tegra/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -<API key> -Wno-format-security -<API key> -Os -marm -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -g -<API key> -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(dd)" -D"KBUILD_MODNAME=KBUILD_STR(dd)" -c -o drivers/base/dd.o drivers/base/dd.c deps_drivers/base/dd.o := \ drivers/base/dd.c \ include/linux/device.h \ $(wildcard include/config/of.h) \ $(wildcard include/config/debug/devres.h) \ $(wildcard include/config/numa.h) \ $(wildcard include/config/devtmpfs.h) \ $(wildcard include/config/printk.h) \ $(wildcard include/config/dynamic/debug.h) \ include/linux/ioport.h \ include/linux/compiler.h \ $(wildcard include/config/trace/branch/profiling.h) \ $(wildcard include/config/profile/all/branches.h) \ $(wildcard include/config/enable/must/check.h) \ $(wildcard include/config/enable/warn/deprecated.h) \ include/linux/compiler-gcc.h \ $(wildcard include/config/arch/supports/optimized/inlining.h) \ $(wildcard include/config/optimize/inlining.h) \ include/linux/compiler-gcc4.h \ include/linux/types.h \ $(wildcard include/config/uid16.h) \ $(wildcard include/config/lbdaf.h) \ $(wildcard include/config/phys/addr/t/64bit.h) \ $(wildcard include/config/64bit.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/types.h \ include/asm-generic/int-ll64.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/bitsperlong.h \ include/asm-generic/bitsperlong.h \ include/linux/posix_types.h \ include/linux/stddef.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/posix_types.h \ include/linux/kobject.h \ $(wildcard include/config/hotplug.h) \ include/linux/list.h \ $(wildcard include/config/debug/list.h) \ include/linux/poison.h \ $(wildcard include/config/illegal/pointer/value.h) \ include/linux/prefetch.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/processor.h \ $(wildcard include/config/mmu.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/ptrace.h \ $(wildcard include/config/cpu/endian/be8.h) \ $(wildcard include/config/arm/thumb.h) \ $(wildcard include/config/smp.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/hwcap.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/cache.h \ $(wildcard include/config/arm/l1/cache/shift.h) \ $(wildcard include/config/aeabi.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/system.h \ $(wildcard include/config/cpu/xsc3.h) \ $(wildcard include/config/cpu/fa526.h) \ $(wildcard include/config/arch/has/barriers.h) \ $(wildcard include/config/arm/dma/mem/bufferable.h) \ $(wildcard include/config/cpu/sa1100.h) \ $(wildcard include/config/cpu/sa110.h) \ $(wildcard include/config/cpu/32v6k.h) \ include/linux/linkage.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/linkage.h \ include/linux/irqflags.h \ $(wildcard include/config/trace/irqflags.h) \ $(wildcard include/config/irqsoff/tracer.h) \ $(wildcard include/config/preempt/tracer.h) \ $(wildcard include/config/trace/irqflags/support.h) \ include/linux/typecheck.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/irqflags.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/outercache.h \ $(wildcard include/config/outer/cache/sync.h) \ $(wildcard include/config/outer/cache.h) \ arch/arm/mach-tegra/include/mach/barriers.h \ include/asm-generic/cmpxchg-local.h \ include/linux/sysfs.h \ $(wildcard include/config/debug/lock/alloc.h) \ $(wildcard include/config/sysfs.h) \ include/linux/errno.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/errno.h \ include/asm-generic/errno.h \ include/asm-generic/errno-base.h \ include/linux/lockdep.h \ $(wildcard include/config/lockdep.h) \ $(wildcard include/config/lock/stat.h) \ $(wildcard include/config/generic/hardirqs.h) \ $(wildcard include/config/prove/locking.h) \ $(wildcard include/config/prove/rcu.h) \ include/linux/kobject_ns.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/atomic.h \ $(wildcard include/config/generic/atomic64.h) \ include/asm-generic/atomic-long.h \ include/linux/spinlock.h \ $(wildcard include/config/debug/spinlock.h) \ $(wildcard include/config/generic/lockbreak.h) \ $(wildcard include/config/preempt.h) \ include/linux/preempt.h \ $(wildcard include/config/debug/preempt.h) \ $(wildcard include/config/preempt/notifiers.h) \ include/linux/thread_info.h \ $(wildcard include/config/compat.h) \ include/linux/bitops.h \ $(wildcard include/config/generic/find/first/bit.h) \ $(wildcard include/config/generic/find/last/bit.h) \ $(wildcard include/config/generic/find/next/bit.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/bitops.h \ include/asm-generic/bitops/non-atomic.h \ include/asm-generic/bitops/fls64.h \ include/asm-generic/bitops/sched.h \ include/asm-generic/bitops/hweight.h \ include/asm-generic/bitops/arch_hweight.h \ include/asm-generic/bitops/const_hweight.h \ include/asm-generic/bitops/lock.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/thread_info.h \ $(wildcard include/config/arm/thumbee.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/fpstate.h \ $(wildcard include/config/vfpv3.h) \ $(wildcard include/config/iwmmxt.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/domain.h \ $(wildcard include/config/io/36.h) \ include/linux/kernel.h \ $(wildcard include/config/preempt/voluntary.h) \ $(wildcard include/config/debug/spinlock/sleep.h) \ $(wildcard include/config/ring/buffer.h) \ $(wildcard include/config/tracing.h) \ $(wildcard include/config/ftrace/mcount/record.h) \ /home/tim/ICS/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/include/stdarg.h \ include/linux/log2.h \ $(wildcard include/config/arch/has/ilog2/u32.h) \ $(wildcard include/config/arch/has/ilog2/u64.h) \ include/linux/dynamic_debug.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/byteorder.h \ include/linux/byteorder/little_endian.h \ include/linux/swab.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/swab.h \ include/linux/byteorder/generic.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/bug.h \ $(wildcard include/config/bug.h) \ $(wildcard include/config/debug/bugverbose.h) \ include/asm-generic/bug.h \ $(wildcard include/config/generic/bug.h) \ $(wildcard include/config/generic/bug/relative/pointers.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/div64.h \ include/linux/stringify.h \ include/linux/bottom_half.h \ include/linux/spinlock_types.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/spinlock_types.h \ include/linux/rwlock_types.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/spinlock.h \ include/linux/rwlock.h \ include/linux/spinlock_api_smp.h \ $(wildcard include/config/inline/spin/lock.h) \ $(wildcard include/config/inline/spin/lock/bh.h) \ $(wildcard include/config/inline/spin/lock/irq.h) \ $(wildcard include/config/inline/spin/lock/irqsave.h) \ $(wildcard include/config/inline/spin/trylock.h) \ $(wildcard include/config/inline/spin/trylock/bh.h) \ $(wildcard include/config/inline/spin/unlock.h) \ $(wildcard include/config/inline/spin/unlock/bh.h) \ $(wildcard include/config/inline/spin/unlock/irq.h) \ $(wildcard include/config/inline/spin/unlock/irqrestore.h) \ include/linux/rwlock_api_smp.h \ $(wildcard include/config/inline/read/lock.h) \ $(wildcard include/config/inline/write/lock.h) \ $(wildcard include/config/inline/read/lock/bh.h) \ $(wildcard include/config/inline/write/lock/bh.h) \ $(wildcard include/config/inline/read/lock/irq.h) \ $(wildcard include/config/inline/write/lock/irq.h) \ $(wildcard include/config/inline/read/lock/irqsave.h) \ $(wildcard include/config/inline/write/lock/irqsave.h) \ $(wildcard include/config/inline/read/trylock.h) \ $(wildcard include/config/inline/write/trylock.h) \ $(wildcard include/config/inline/read/unlock.h) \ $(wildcard include/config/inline/write/unlock.h) \ $(wildcard include/config/inline/read/unlock/bh.h) \ $(wildcard include/config/inline/write/unlock/bh.h) \ $(wildcard include/config/inline/read/unlock/irq.h) \ $(wildcard include/config/inline/write/unlock/irq.h) \ $(wildcard include/config/inline/read/unlock/irqrestore.h) \ $(wildcard include/config/inline/write/unlock/irqrestore.h) \ include/linux/kref.h \ include/linux/wait.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/current.h \ include/linux/klist.h \ include/linux/module.h \ $(wildcard include/config/symbol/prefix.h) \ $(wildcard include/config/modules.h) \ $(wildcard include/config/modversions.h) \ $(wildcard include/config/unused/symbols.h) \ $(wildcard include/config/kallsyms.h) \ $(wildcard include/config/tracepoints.h) \ $(wildcard include/config/event/tracing.h) \ $(wildcard include/config/module/unload.h) \ $(wildcard include/config/constructors.h) \ include/linux/stat.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/stat.h \ include/linux/time.h \ $(wildcard include/config/arch/uses/gettimeoffset.h) \ include/linux/cache.h \ $(wildcard include/config/arch/has/cache/line/size.h) \ include/linux/seqlock.h \ include/linux/math64.h \ include/linux/kmod.h \ include/linux/gfp.h \ $(wildcard include/config/kmemcheck.h) \ $(wildcard include/config/highmem.h) \ $(wildcard include/config/zone/dma.h) \ $(wildcard include/config/zone/dma32.h) \ $(wildcard include/config/debug/vm.h) \ include/linux/mmzone.h \ $(wildcard include/config/force/max/zoneorder.h) \ $(wildcard include/config/memory/hotplug.h) \ $(wildcard include/config/sparsemem.h) \ $(wildcard include/config/compaction.h) \ $(wildcard include/config/arch/populates/node/map.h) \ $(wildcard include/config/discontigmem.h) \ $(wildcard include/config/flat/node/mem/map.h) \ $(wildcard include/config/cgroup/mem/res/ctlr.h) \ $(wildcard include/config/no/bootmem.h) \ $(wildcard include/config/have/memory/present.h) \ $(wildcard include/config/have/memoryless/nodes.h) \ $(wildcard include/config/need/node/memmap/size.h) \ $(wildcard include/config/need/multiple/nodes.h) \ $(wildcard include/config/have/arch/early/pfn/to/nid.h) \ $(wildcard include/config/flatmem.h) \ $(wildcard include/config/sparsemem/extreme.h) \ $(wildcard include/config/nodes/span/other/nodes.h) \ $(wildcard include/config/holes/in/zone.h) \ $(wildcard include/config/arch/has/holes/memorymodel.h) \ include/linux/threads.h \ $(wildcard include/config/nr/cpus.h) \ $(wildcard include/config/base/small.h) \ include/linux/numa.h \ $(wildcard include/config/nodes/shift.h) \ include/linux/init.h \ include/linux/nodemask.h \ include/linux/bitmap.h \ include/linux/string.h \ $(wildcard include/config/binary/printf.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/string.h \ include/linux/pageblock-flags.h \ $(wildcard include/config/hugetlb/page.h) \ $(wildcard include/config/hugetlb/page/size/variable.h) \ include/generated/bounds.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/page.h \ $(wildcard include/config/cpu/copy/v3.h) \ $(wildcard include/config/cpu/copy/v4wt.h) \ $(wildcard include/config/cpu/copy/v4wb.h) \ $(wildcard include/config/cpu/copy/feroceon.h) \ $(wildcard include/config/cpu/copy/fa.h) \ $(wildcard include/config/cpu/xscale.h) \ $(wildcard include/config/cpu/copy/v6.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/glue.h \ $(wildcard include/config/cpu/arm610.h) \ $(wildcard include/config/cpu/arm710.h) \ $(wildcard include/config/cpu/abrt/lv4t.h) \ $(wildcard include/config/cpu/abrt/ev4.h) \ $(wildcard include/config/cpu/abrt/ev4t.h) \ $(wildcard include/config/cpu/abrt/ev5tj.h) \ $(wildcard include/config/cpu/abrt/ev5t.h) \ $(wildcard include/config/cpu/abrt/ev6.h) \ $(wildcard include/config/cpu/abrt/ev7.h) \ $(wildcard include/config/cpu/pabrt/legacy.h) \ $(wildcard include/config/cpu/pabrt/v6.h) \ $(wildcard include/config/cpu/pabrt/v7.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/memory.h \ $(wildcard include/config/page/offset.h) \ $(wildcard include/config/thumb2/kernel.h) \ $(wildcard include/config/dram/size.h) \ $(wildcard include/config/dram/base.h) \ $(wildcard include/config/have/tcm.h) \ include/linux/const.h \ arch/arm/mach-tegra/include/mach/memory.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/sizes.h \ include/asm-generic/memory_model.h \ $(wildcard include/config/sparsemem/vmemmap.h) \ include/asm-generic/getorder.h \ include/linux/memory_hotplug.h \ $(wildcard include/config/have/arch/nodedata/extension.h) \ $(wildcard include/config/memory/hotremove.h) \ include/linux/notifier.h \ include/linux/mutex.h \ $(wildcard include/config/debug/mutexes.h) \ include/linux/rwsem.h \ $(wildcard include/config/rwsem/generic/spinlock.h) \ include/linux/rwsem-spinlock.h \ include/linux/srcu.h \ include/linux/topology.h \ $(wildcard include/config/sched/smt.h) \ $(wildcard include/config/sched/mc.h) \ $(wildcard include/config/use/percpu/numa/node/id.h) \ include/linux/cpumask.h \ $(wildcard include/config/cpumask/offstack.h) \ $(wildcard include/config/hotplug/cpu.h) \ $(wildcard include/config/debug/per/cpu/maps.h) \ $(wildcard include/config/disable/obsolete/cpumask/functions.h) \ include/linux/smp.h \ $(wildcard include/config/use/generic/smp/helpers.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/smp.h \ arch/arm/mach-tegra/include/mach/smp.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/hardware/gic.h \ include/linux/percpu.h \ $(wildcard include/config/need/per/cpu/embed/first/chunk.h) \ $(wildcard include/config/need/per/cpu/page/first/chunk.h) \ $(wildcard include/config/have/setup/per/cpu/area.h) \ include/linux/pfn.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/percpu.h \ include/asm-generic/percpu.h \ include/linux/percpu-defs.h \ $(wildcard include/config/debug/force/weak/per/cpu.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/topology.h \ include/asm-generic/topology.h \ include/linux/mmdebug.h \ $(wildcard include/config/debug/virtual.h) \ include/linux/workqueue.h \ $(wildcard include/config/debug/objects/work.h) \ $(wildcard include/config/freezer.h) \ include/linux/timer.h \ $(wildcard include/config/timer/stats.h) \ $(wildcard include/config/debug/objects/timers.h) \ include/linux/ktime.h \ $(wildcard include/config/ktime/scalar.h) \ include/linux/jiffies.h \ include/linux/timex.h \ include/linux/param.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/param.h \ $(wildcard include/config/hz.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/timex.h \ arch/arm/mach-tegra/include/mach/timex.h \ include/linux/debugobjects.h \ $(wildcard include/config/debug/objects.h) \ $(wildcard include/config/debug/objects/free.h) \ include/linux/elf.h \ include/linux/elf-em.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/elf.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/user.h \ include/linux/moduleparam.h \ $(wildcard include/config/alpha.h) \ $(wildcard include/config/ia64.h) \ $(wildcard include/config/ppc64.h) \ include/linux/tracepoint.h \ include/linux/rcupdate.h \ $(wildcard include/config/rcu/torture/test.h) \ $(wildcard include/config/tree/rcu.h) \ $(wildcard include/config/tree/preempt/rcu.h) \ $(wildcard include/config/tiny/rcu.h) \ $(wildcard include/config/debug/objects/rcu/head.h) \ include/linux/completion.h \ include/linux/rcutree.h \ $(wildcard include/config/no/hz.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/module.h \ $(wildcard include/config/arm/unwind.h) \ include/trace/events/module.h \ include/trace/define_trace.h \ include/linux/pm.h \ $(wildcard include/config/pm/sleep.h) \ $(wildcard include/config/pm/runtime.h) \ $(wildcard include/config/pm/ops.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/device.h \ $(wildcard include/config/dmabounce.h) \ include/linux/pm_wakeup.h \ $(wildcard include/config/pm.h) \ include/linux/delay.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/delay.h \ $(wildcard include/config/arch/provides/udelay.h) \ arch/arm/mach-tegra/include/mach/delay.h \ include/linux/kthread.h \ include/linux/err.h \ include/linux/sched.h \ $(wildcard include/config/sched/debug.h) \ $(wildcard include/config/lockup/detector.h) \ $(wildcard include/config/detect/hung/task.h) \ $(wildcard include/config/core/dump/default/elf/headers.h) \ $(wildcard include/config/virt/cpu/accounting.h) \ $(wildcard include/config/bsd/process/acct.h) \ $(wildcard include/config/taskstats.h) \ $(wildcard include/config/audit.h) \ $(wildcard include/config/inotify/user.h) \ $(wildcard include/config/epoll.h) \ $(wildcard include/config/posix/mqueue.h) \ $(wildcard include/config/keys.h) \ $(wildcard include/config/perf/events.h) \ $(wildcard include/config/schedstats.h) \ $(wildcard include/config/task/delay/acct.h) \ $(wildcard include/config/fair/group/sched.h) \ $(wildcard include/config/rt/group/sched.h) \ $(wildcard include/config/blk/dev/io/trace.h) \ $(wildcard include/config/cc/stackprotector.h) \ $(wildcard include/config/sysvipc.h) \ $(wildcard include/config/auditsyscall.h) \ $(wildcard include/config/rt/mutexes.h) \ $(wildcard include/config/task/xacct.h) \ $(wildcard include/config/cpusets.h) \ $(wildcard include/config/cgroups.h) \ $(wildcard include/config/futex.h) \ $(wildcard include/config/fault/injection.h) \ $(wildcard include/config/latencytop.h) \ $(wildcard include/config/function/graph/tracer.h) \ $(wildcard include/config/security/sealimemodule.h) \ $(wildcard include/config/have/unstable/sched/clock.h) \ $(wildcard include/config/stack/growsup.h) \ $(wildcard include/config/debug/stack/usage.h) \ $(wildcard include/config/cgroup/sched.h) \ $(wildcard include/config/mm/owner.h) \ include/linux/capability.h \ include/linux/rbtree.h \ include/linux/mm_types.h \ $(wildcard include/config/split/ptlock/cpus.h) \ $(wildcard include/config/want/page/debug/flags.h) \ $(wildcard include/config/aio.h) \ $(wildcard include/config/proc/fs.h) \ $(wildcard include/config/mmu/notifier.h) \ include/linux/auxvec.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/auxvec.h \ include/linux/prio_tree.h \ include/linux/page-debug-flags.h \ $(wildcard include/config/page/poisoning.h) \ $(wildcard include/config/page/debug/something/else.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/mmu.h \ $(wildcard include/config/cpu/has/asid.h) \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/cputime.h \ include/asm-generic/cputime.h \ include/linux/sem.h \ include/linux/ipc.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/ipcbuf.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/sembuf.h \ include/linux/signal.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/signal.h \ include/asm-generic/signal-defs.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/sigcontext.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/siginfo.h \ include/asm-generic/siginfo.h \ include/linux/path.h \ include/linux/pid.h \ include/linux/proportions.h \ include/linux/percpu_counter.h \ include/linux/seccomp.h \ $(wildcard include/config/seccomp.h) \ include/linux/rculist.h \ include/linux/rtmutex.h \ $(wildcard include/config/debug/rt/mutexes.h) \ include/linux/plist.h \ $(wildcard include/config/debug/pi/list.h) \ include/linux/resource.h \ /home/tim/Downloads/<API key>/linux-2.6/arch/arm/include/asm/resource.h \ include/asm-generic/resource.h \ include/linux/hrtimer.h \ $(wildcard include/config/high/res/timers.h) \ include/linux/task_io_accounting.h \ $(wildcard include/config/task/io/accounting.h) \ include/linux/latencytop.h \ include/linux/cred.h \ $(wildcard include/config/debug/credentials.h) \ $(wildcard include/config/security.h) \ include/linux/key.h \ $(wildcard include/config/sysctl.h) \ include/linux/sysctl.h \ include/linux/selinux.h \ $(wildcard include/config/security/selinux.h) \ include/linux/aio.h \ include/linux/aio_abi.h \ include/linux/uio.h \ include/linux/async.h \ include/linux/pm_runtime.h \ drivers/base/base.h \ $(wildcard include/config/sys/hypervisor.h) \ drivers/base/power/power.h \ drivers/base/dd.o: $(deps_drivers/base/dd.o) $(deps_drivers/base/dd.o):
package openra.server; import openra.core.Unit; public class UnitAnimEvent extends ActionEvent { private Unit un; private UnitAnimEvent scheduled; public UnitAnimEvent(int p, Unit un) { super(p); //logger->debug("UAE cons: this:%p un:%p\n",this,un); this.un = un; //un.referTo(); scheduled = null; } void destUnitAnimEvent() { //logger->debug("UAE dest: this:%p un:%p sch:%p\n",this,un,scheduled); if (scheduled != null) { this.getAequeue().scheduleEvent(scheduled); } //un->unrefer(); } protected void setSchedule(UnitAnimEvent e) { //logger->debug("Scheduling an event. (this: %p, e: %p)\n",this,e); if (scheduled != null) { scheduled.setSchedule(null); scheduled.stop(); } scheduled = e; } void stopScheduled() { if (scheduled != null) { scheduled.stop(); } } void update() { } }
package com.moss.simpledeb.core.action; import java.io.File; import java.util.LinkedList; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import com.moss.simpledeb.core.DebComponent; import com.moss.simpledeb.core.DebState; import com.moss.simpledeb.core.path.ArchivePath; import com.moss.simpledeb.core.path.BytesArchivePath; import com.moss.simpledeb.core.path.DirArchivePath; @XmlAccessorType(XmlAccessType.FIELD) public final class LaunchScriptAction extends DebAction { @XmlAttribute(name="class-name") private String className; @XmlAttribute(name="target-file") private String targetFile; @XmlAttribute(name="path-level") private int pathLevel; @Override public void run(DebState state) throws Exception { { File target = new File(targetFile).getParentFile(); LinkedList<File> pathsNeeded = new LinkedList<File>(); File f = target; while (f != null) { pathsNeeded.addFirst(f); f = f.getParentFile(); } for (int i=0; i<pathLevel; i++) { pathsNeeded.removeFirst(); } for (File e : pathsNeeded) { String p = "./" + e.getPath(); if (!p.endsWith("/")) { p = p + "/"; } TarArchiveEntry tarEntry = new TarArchiveEntry(p); tarEntry.setGroupId(0); tarEntry.setGroupName("root"); tarEntry.setIds(0, 0); tarEntry.setModTime(System.currentTimeMillis()); tarEntry.setSize(0); tarEntry.setUserId(0); tarEntry.setUserName("root"); tarEntry.setMode(Integer.parseInt("755", 8)); ArchivePath path = new DirArchivePath(tarEntry); state.addPath(DebComponent.CONTENT, path); } } String cp; { StringBuffer sb = new StringBuffer(); for (String path : state.classpath) { if (sb.length() == 0) { sb.append(path); } else { sb.append(":"); sb.append(path); } } cp = sb.toString(); } StringBuilder sb = new StringBuilder(); sb.append("#!/bin/bash\n"); sb.append("CP=\""); sb.append(cp); sb.append("\"\n"); sb.append("/usr/bin/java -cp $CP "); sb.append(className); sb.append(" $@\n"); byte[] data = sb.toString().getBytes(); String entryName = "./" + targetFile; TarArchiveEntry tarEntry = new TarArchiveEntry(entryName); tarEntry.setGroupId(0); tarEntry.setGroupName("root"); tarEntry.setIds(0, 0); tarEntry.setModTime(System.currentTimeMillis()); tarEntry.setSize(data.length); tarEntry.setUserId(0); tarEntry.setUserName("root"); tarEntry.setMode(Integer.parseInt("755", 8)); ArchivePath path = new BytesArchivePath(tarEntry, data); state.addPath(DebComponent.CONTENT, path); } public String getClassName() { return className; } public void setClassName(String className) { this.className = className; } public String getTargetFile() { return targetFile; } public void setTargetFile(String targetFile) { this.targetFile = targetFile; } public int getPathLevel() { return pathLevel; } public void setPathLevel(int <API key>) { this.pathLevel = <API key>; } }
public interface Iterator { public Object first(); public Object next(); public Object currentItem(); public boolean isDone(); } public class ConcreteIterator implements Iterator { private int currentIndex = 0; private Aggregate aggregate = null; public ConcreteIterator(Aggregate aggregate) { this.aggregate = aggregate; } @Override public Object first() { currentIndex = 0; return vector.get(currentIndex); } @Override public Object next() { if(currentIndex < aggregate.count()) currentIndex++; return vector.get(currentIndex); } @Override public Object currentItem() { return aggregate.getAt(currentIndex); } @Override public boolean isDone() { return (currentIndex >= aggregate.count()); } } public interface Aggregat { public Iterator createIterator(); public int count(); public Object getAt(int index); } public class ConcreteAggregat implements Aggregat { private Vector vector = null; public Vector getVector() { return vector; } public void setVector(final Vector vector) { this.vector = vector; } public ConcreteAggregat() { vector = new Vector(); vector.add("item 1"); vector.add("item 2"); } @Override public int count() { return vector.size(); } @Override public Object getAt(int index) { if(0 <= index && index < vector.size()) return vector[index]; else return null; } @Override public Iterator createIterator() { return new ConcreteIterator(this); } } public class Client { public static void main(final String[] args) { Aggregat agg = new ConcreteAggregat(); final Iterator iterator = agg.createIterator(); System.out.println(iterator.first()); while (!iterator.isDone()) { //Item item = (Item)iterator.currentItem(); System.out.println(iterator.next()); } } }
#ifndef <API key> #define <API key> struct <API key> { int <API key>; int <API key>; int <API key>; int gpu_lvds_num_lanes; }; #endif /* <API key> */
/** @file * VMM - Raw-mode Context. */ #define LOG_GROUP LOG_GROUP_VMM #include <iprt/asm-amd64-x86.h> /* for SUPGetCpuHzFromGIP */ #include <VBox/vmm/vmm.h> #include <VBox/vmm/trpm.h> #include <VBox/vmm/pgm.h> #include "VMMInternal.h" #include <VBox/vmm/vm.h> #include <VBox/sup.h> #include <VBox/err.h> #include <VBox/log.h> #include <iprt/assert.h> #include <iprt/initterm.h> /** Default logger instance. */ extern "C" DECLIMPORT(RTLOGGERRC) g_Logger; extern "C" DECLIMPORT(RTLOGGERRC) g_RelLogger; static int vmmGCTest(PVM pVM, unsigned uOperation, unsigned uArg); static DECLCALLBACK(int) <API key>(PVM pVM, PCPUMCTXCORE pRegFrame); static DECLCALLBACK(int) <API key>(PVM pVM, PCPUMCTXCORE pRegFrame); /** * The GC entry point. * * @returns VBox status code. * @param pVM Pointer to the VM. * @param uOperation Which operation to execute (VMMGCOPERATION). * @param uArg Argument to that operation. */ VMMRCDECL(int) VMMGCEntry(PVM pVM, unsigned uOperation, unsigned uArg, ...) { /* todo */ switch (uOperation) { /* * Init RC modules. */ case VMMGC_DO_VMMGC_INIT: { /* * Validate the svn revision (uArg) and build type (ellipsis). */ if (uArg != VMMGetSvnRev()) return <API key>; va_list va; va_start(va, uArg); uint32_t uBuildType = va_arg(va, uint32_t); if (uBuildType != vmmGetBuildType()) return <API key>; /* * Initialize the runtime. */ uint64_t u64TS = va_arg(va, uint64_t); va_end(va); int rc = RTRCInit(u64TS); Log(("VMMGCEntry: VMMGC_DO_VMMGC_INIT - uArg=%u (svn revision) u64TS=%RX64; rc=%Rrc\n", uArg, u64TS, rc)); AssertRCReturn(rc, rc); rc = <API key>(); AssertRCReturn(rc, rc); rc = PGMRCDynMapInit(pVM); AssertRCReturn(rc, rc); return VINF_SUCCESS; } /* * Testcase which is used to test interrupt forwarding. * It spins for a while with interrupts enabled. */ case <API key>: { uint32_t volatile i = 0; ASMIntEnable(); while (i < _2G32) i++; ASMIntDisable(); return 0; } /* * Testcase which simply returns, this is used for * profiling of the switcher. */ case <API key>: return 0; /* * Testcase executes a privileged instruction to force a world switch. (in both SVM & VMX) */ case <API key>: ASMRdMsr_Low(<API key>); return 0; /* * Delay for ~100us. */ case <API key>: { uint64_t u64MaxTicks = (SUPGetCpuHzFromGIP(<API key>) != ~(uint64_t)0 ? SUPGetCpuHzFromGIP(<API key>) : _2G) / 10000; uint64_t u64StartTSC = ASMReadTSC(); uint64_t u64TicksNow; uint32_t volatile i = 0; do { /* waste some time and protect against getting stuck. */ for (uint32_t volatile j = 0; j < 1000; j++, i++) if (i > _2G32) return <API key>; /* check if we're done.*/ u64TicksNow = ASMReadTSC() - u64StartTSC; } while (u64TicksNow < u64MaxTicks); return VINF_SUCCESS; } /* * Trap testcases and unknown operations. */ default: if ( uOperation >= <API key> && uOperation < <API key>) return vmmGCTest(pVM, uOperation, uArg); return <API key>; } } /** * Internal RC logger worker: Flush logger. * * @returns VINF_SUCCESS. * @param pLogger The logger instance to flush. * @remark This function must be exported! */ VMMRCDECL(int) vmmGCLoggerFlush(PRTLOGGERRC pLogger) { PVM pVM = &g_VM; NOREF(pLogger); if (pVM->vmm.s.<API key>) return VINF_SUCCESS; /* fail quietly. */ return VMMRZCallRing3NoCpu(pVM, <API key>, 0); } /** * Flush logger if almost full. * * @param pVM Pointer to the VM. */ VMMRCDECL(void) VMMGCLogFlushIfFull(PVM pVM) { if ( pVM->vmm.s.pRCLoggerRC && pVM->vmm.s.pRCLoggerRC->offScratch >= (sizeof(pVM->vmm.s.pRCLoggerRC->achScratch)*3/4)) { if (pVM->vmm.s.<API key>) return; /* fail quietly. */ VMMRZCallRing3NoCpu(pVM, <API key>, 0); } } /** * Switches from guest context to host context. * * @param pVM Pointer to the VM. * @param rc The status code. */ VMMRCDECL(void) VMMGCGuestToHost(PVM pVM, int rc) { pVM->vmm.s.pfnRCToHost(rc); } /** * Calls the ring-0 host code. * * @param pVM Pointer to the VM. */ DECLASM(void) <API key>(PVM pVM) { pVM->vmm.s.pfnRCToHost(<API key>); } /** * Execute the trap testcase. * * There is some common code here, that's why we're collecting them * like this. Odd numbered variation (uArg) are executed with write * protection (WP) enabled. * * @returns VINF_SUCCESS if it was a testcase setup up to continue and did so successfully. * @returns <API key> if the testcase wasn't implemented. * @returns <API key> if the testcase continued when it shouldn't. * * @param pVM Pointer to the VM. * @param uOperation The testcase. * @param uArg The variation. See function description for odd / even details. * * @remark Careful with the trap 08 testcase and WP, it will triple * fault the box if the TSS, the Trap8 TSS and the fault TSS * GDTE are in pages which are read-only. * See bottom of SELMR3Init(). */ static int vmmGCTest(PVM pVM, unsigned uOperation, unsigned uArg) { /* * Set up the testcase. */ #if 0 switch (uOperation) { default: break; } #endif /* * Enable WP if odd variation. */ if (uArg & 1) vmmGCEnableWP(); /* * Execute the testcase. */ int rc = <API key>; switch (uOperation) { //case <API key>: //case <API key>: //case <API key>: case <API key>: { if (uArg <= 1) rc = vmmGCTestTrap3(); break; } //case <API key>: //case <API key>: //case <API key>: //case <API key>: case <API key>: { #ifndef DEBUG_bird /** @todo dynamic check that this won't triple fault... */ if (uArg & 1) break; #endif if (uArg <= 1) rc = vmmGCTestTrap8(); break; } //<API key>, //<API key>, //<API key>, //<API key>, case <API key>: { if (uArg <= 1) rc = vmmGCTestTrap0d(); break; } case <API key>: { if (uArg <= 1) rc = vmmGCTestTrap0e(); else if (uArg == 2 || uArg == 4) { /* * Test the use of a temporary #PF handler. */ rc = <API key>(pVM, X86_XCPT_PF, uArg != 4 ? <API key> : <API key>); if (RT_SUCCESS(rc)) { rc = vmmGCTestTrap0e(); /* in case it didn't fire. */ int rc2 = <API key>(pVM, X86_XCPT_PF, NULL); if (RT_FAILURE(rc2) && RT_SUCCESS(rc)) rc = rc2; } } break; } } /* * Re-enable WP. */ if (uArg & 1) vmmGCDisableWP(); return rc; } /** * Temporary \#PF trap handler for the \#PF test case. * * @returns VBox status code (appropriate for GC return). * In this context RT_SUCCESS means to restart the instruction. * @param pVM Pointer to the VM. * @param pRegFrame Trap register frame. */ static DECLCALLBACK(int) <API key>(PVM pVM, PCPUMCTXCORE pRegFrame) { if (pRegFrame->eip == (uintptr_t)<API key>) { pRegFrame->eip = (uintptr_t)<API key>; return VINF_SUCCESS; } NOREF(pVM); return VERR_INTERNAL_ERROR; } /** * Temporary \#PF trap handler for the \#PF test case, this one messes up the fs * selector. * * @returns VBox status code (appropriate for GC return). * In this context RT_SUCCESS means to restart the instruction. * @param pVM Pointer to the VM. * @param pRegFrame Trap register frame. */ static DECLCALLBACK(int) <API key>(PVM pVM, PCPUMCTXCORE pRegFrame) { int rc = <API key>(pVM, pRegFrame); pRegFrame->fs.Sel = 0x30; return rc; }
package yuka.detectors; import yuka.containers.News; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import java.util.HashMap; import java.util.Map; public class FigureDetector { private Map<String, Integer> cmap; private Map<String, Integer> pmap; private Map<String, Integer> dim; //private int height = 0; //private int height = 0; public FigureDetector(Map<String, String> figure) { String url = figure.get(News.IMAGE_URL); dim = getDimension(url); String caption = figure.get(News.IMAGE_CAPTION); cmap = ClubDetector.count(caption); PlayerDetector pd = new PlayerDetector(cmap.keySet()); pmap = pd.count(caption); } public int getHeight() { return dim.get("height"); } public int getWidth() { return dim.get("width"); } public double getPercentage (double totalHeight) { return (double) getWidth() / HeightDetector.COLUMN_WIDTH * (getHeight() / totalHeight); } public Map<String, Integer> getClubMap() { return cmap; } public Map<String, Integer> getPlayerMap() { return pmap; } public static Map<String, Integer> getDimension (String source) { //int[] dim = new int[]{0,0}; Map<String, Integer> dim = new HashMap<>(); dim.put("width", 0); dim.put("height", 0); try { URL url = new URL(source); URLConnection conn = url.openConnection(); // now you get the content length //int contentLength = conn.getContentLength(); // you can check size here using contentLength InputStream in = conn.getInputStream(); BufferedImage image = ImageIO.read(in); // you can get size dimesion //int width = image.getWidth(); //int height = image.getHeight(); dim.put("width", image.getWidth()); dim.put("height", image.getHeight()); } catch (IOException e) { System.out.println(); } return dim; } }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=ISO-8859-1" /><!-- /Added by HTTrack --> <head> <title>Index of /wp-content/themes/choices/framework/php/avia_shortcodes/tinymce/js</title> </head> <body> <h1>Index of /wp-content/themes/choices/framework/php/avia_shortcodes/tinymce/js</h1> <table><tr><th><img src="../../../../../../../../icons/blank.html" alt="[ICO]"></th><th><a href="indexb70a.html?C=N;O=A">Name</a></th><th><a href="index72c9.html?C=M;O=D">Last modified</a></th><th><a href="indexbfec.html?C=S;O=A">Size</a></th><th><a href="index30b5.html?C=D;O=A">Description</a></th></tr><tr><th colspan="5"><hr></th></tr> <tr><td valign="top"><img src="../../../../../../../../icons/back.html" alt="[DIR]"></td><td><a href="../index.html">Parent Directory</a></td><td>&nbsp;</td><td align="right"> - </td></tr> <tr><td valign="top"><img src="../../../../../../../../icons/unknown.gif" alt="[ ]"></td><td><a href="column-control.js">column-control.js</a></td><td align="right">19-Aug-2013 14:14 </td><td align="right">3.9K</td></tr> <tr><td valign="top"><img src="../../../../../../../../icons/unknown.gif" alt="[ ]"></td><td><a href="dialog.js">dialog.js</a></td><td align="right">19-Aug-2013 14:14 </td><td align="right"> 11K</td></tr> <tr><td valign="top"><img src="../../../../../../../../icons/unknown.gif" alt="[ ]"></td><td><a href="sidebar-tab-control.js">sidebar-tab-control.js</a></td><td align="right">19-Aug-2013 14:14 </td><td align="right">3.8K</td></tr> <tr><td valign="top"><img src="../../../../../../../../icons/unknown.gif" alt="[ ]"></td><td><a href="tab-control.js">tab-control.js</a></td><td align="right">19-Aug-2013 14:14 </td><td align="right">2.9K</td></tr> <tr><td valign="top"><img src="../../../../../../../../icons/unknown.gif" alt="[ ]"></td><td><a href="table-control.js">table-control.js</a></td><td align="right">19-Aug-2013 14:14 </td><td align="right">9.6K</td></tr> <tr><th colspan="5"><hr></th></tr> </table> <address>Apache/2.2.3 (CentOS) Server at www.photobookmart.com.my Port 80</address> </body> </html>
# This program is free software; you can redistribute it and/or modify # (at your option) any later version. # This program is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ When importing a VM a thread start with a new process of virt-v2v. The way to feedback the information on the progress and the status of the process (ie job) is via getVdsStats() with the fields progress and status. progress is a number which represent percentage of a single disk copy, status is a way to feedback information on the job (init, error etc) """ from __future__ import absolute_import from collections import namedtuple from contextlib import closing, contextmanager import errno import io import logging import os import re import subprocess import tarfile import time import threading import xml.etree.ElementTree as ET import zipfile import libvirt from vdsm.cmdutils import wrap_command from vdsm.commands import execCmd, BUFFSIZE from vdsm.common import cmdutils from vdsm.common.define import errCode, doneCode from vdsm.common import response from vdsm.common import zombiereaper from vdsm.common.compat import CPopen from vdsm.common.logutils import traceback from vdsm.common.time import monotonic_time from vdsm.constants import P_VDSM_LOG, P_VDSM_RUN, EXT_KVM_2_OVIRT from vdsm import concurrent, libvirtconnection from vdsm import password from vdsm.utils import terminating, NICENESS, IOCLASS try: import <API key> except ImportError: <API key> = None _lock = threading.Lock() _jobs = {} _V2V_DIR = os.path.join(P_VDSM_RUN, 'v2v') _LOG_DIR = os.path.join(P_VDSM_LOG, 'import') _VIRT_V2V = cmdutils.CommandPath('virt-v2v', '/usr/bin/virt-v2v') _SSH_AGENT = cmdutils.CommandPath('ssh-agent', '/usr/bin/ssh-agent') _SSH_ADD = cmdutils.CommandPath('ssh-add', '/usr/bin/ssh-add') _XEN_SSH_PROTOCOL = 'xen+ssh' _VMWARE_PROTOCOL = 'vpx' _KVM_PROTOCOL = 'qemu' _SSH_AUTH_RE = '(SSH_AUTH_SOCK)=([^;]+).*;\nSSH_AGENT_PID=(\d+)' _OVF_RESOURCE_CPU = 3 <API key> = 4 <API key> = 10 <API key> = ('0.10', '1.1') # OVF Specification: _OVF_NS = 'http://schemas.dmtf.org/ovf/envelope/1' _RASD_NS = 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/' \ '<API key>' ImportProgress = namedtuple('ImportProgress', ['current_disk', 'disk_count', 'description']) DiskProgress = namedtuple('DiskProgress', ['progress']) class STATUS: ''' STARTING: request granted and starting the import process COPYING_DISK: copying disk in progress ABORTED: user initiated aborted FAILED: error during import process DONE: convert process successfully finished ''' STARTING = 'starting' COPYING_DISK = 'copying_disk' ABORTED = 'aborted' FAILED = 'error' DONE = 'done' class V2VError(Exception): ''' Base class for v2v errors ''' err_name = 'unexpected' # TODO: use more specific error class ClientError(Exception): ''' Base class for client error ''' err_name = 'unexpected' class <API key>(ValueError): ''' Unexpected error while parsing libvirt domain xml ''' class OutputParserError(V2VError): ''' Error while parsing virt-v2v output ''' class JobExistsError(ClientError): ''' Job already exists in _jobs collection ''' err_name = 'JobExistsError' class VolumeError(ClientError): ''' Error preparing volume ''' class NoSuchJob(ClientError): ''' Job not exists in _jobs collection ''' err_name = 'NoSuchJob' class JobNotDone(ClientError): ''' Import process still in progress ''' err_name = 'JobNotDone' class NoSuchOvf(V2VError): ''' Ovf path is not exists in /var/run/vdsm/v2v/ ''' err_name = 'V2VNoSuchOvf' class V2VProcessError(V2VError): ''' virt-v2v process had error in execution ''' class InvalidInputError(ClientError): ''' Invalid input received ''' def get_external_vms(uri, username, password, vm_names=None): if vm_names is not None: if not vm_names: vm_names = None else: vm_names = frozenset(vm_names) try: conn = libvirtconnection.open_connection(uri=uri, username=username, passwd=password) except libvirt.libvirtError as e: logging.exception('error connecting to hypervisor') return {'status': {'code': errCode['V2VConnection']['status']['code'], 'message': str(e)}} with closing(conn): vms = [] for vm in _list_domains(conn): if vm_names is not None and vm.name() not in vm_names: # Skip this VM. continue elif conn.getType() == "ESX" and _vm_has_snapshot(vm): logging.error("vm %r has snapshots and therefore can not be " "imported since snapshot conversion is not " "supported for VMware", vm.name()) continue _add_vm(conn, vms, vm) return {'status': doneCode, 'vmList': vms} def <API key>(uri, username, password): try: conn = libvirtconnection.open_connection(uri=uri, username=username, passwd=password) except libvirt.libvirtError as e: logging.exception('error connecting to hypervisor') return response.error('V2VConnection', str(e)) with closing(conn): vms = [vm.name() for vm in _list_domains(conn)] return response.success(vmNames=vms) def convert_external_vm(uri, username, password, vminfo, job_id, irs): if uri.startswith(_XEN_SSH_PROTOCOL): command = XenCommand(uri, vminfo, job_id, irs) elif uri.startswith(_VMWARE_PROTOCOL): command = LibvirtCommand(uri, username, password, vminfo, job_id, irs) elif uri.startswith(_KVM_PROTOCOL): if <API key> is None: raise V2VError('Unsupported protocol KVM, <API key>' 'package is needed for importing KVM images') command = KVMCommand(uri, username, password, vminfo, job_id, irs) else: raise ClientError('Unknown protocol for Libvirt uri: %s', uri) job = ImportVm(job_id, command) job.start() _add_job(job_id, job) return {'status': doneCode} def convert_ova(ova_path, vminfo, job_id, irs): command = OvaCommand(ova_path, vminfo, job_id, irs) job = ImportVm(job_id, command) job.start() _add_job(job_id, job) return response.success() def get_ova_info(ova_path): ns = {'ovf': _OVF_NS, 'rasd': _RASD_NS} try: root = ET.fromstring(_read_ovf_from_ova(ova_path)) except ET.ParseError as e: raise V2VError('Error reading ovf from ova, position: %r' % e.position) vm = {} <API key>(vm, root, ns, ova_path) _add_disks_ovf_info(vm, root, ns) <API key>(vm, root, ns) return response.success(vmList=vm) def get_converted_vm(job_id): try: job = _get_job(job_id) _validate_job_done(job) ovf = _read_ovf(job_id) except ClientError as e: logging.info('Converted VM error %s', e) return errCode[e.err_name] except V2VError as e: logging.error('Converted VM error %s', e) return errCode[e.err_name] return {'status': doneCode, 'ovf': ovf} def delete_job(job_id): try: job = _get_job(job_id) <API key>(job) _remove_job(job_id) except ClientError as e: logging.info('Cannot delete job, error: %s', e) return errCode[e.err_name] return {'status': doneCode} def abort_job(job_id): try: job = _get_job(job_id) job.abort() except ClientError as e: logging.info('Cannot abort job, error: %s', e) return errCode[e.err_name] return {'status': doneCode} def get_jobs_status(): ret = {} with _lock: items = tuple(_jobs.items()) for job_id, job in items: ret[job_id] = { 'status': job.status, 'description': job.description, 'progress': job.progress } return ret def _add_job(job_id, job): with _lock: if job_id in _jobs: raise JobExistsError("Job %r exists" % job_id) _jobs[job_id] = job def _get_job(job_id): with _lock: if job_id not in _jobs: raise NoSuchJob("No such job %r" % job_id) return _jobs[job_id] def _remove_job(job_id): with _lock: if job_id not in _jobs: raise NoSuchJob("No such job %r" % job_id) del _jobs[job_id] def _validate_job_done(job): if job.status != STATUS.DONE: raise JobNotDone("Job %r is %s" % (job.id, job.status)) def <API key>(job): if job.status not in (STATUS.DONE, STATUS.FAILED, STATUS.ABORTED): raise JobNotDone("Job %r is %s" % (job.id, job.status)) def _read_ovf(job_id): file_name = os.path.join(_V2V_DIR, "%s.ovf" % job_id) try: with open(file_name, 'r') as f: return f.read() except IOError as e: if e.errno != errno.ENOENT: raise raise NoSuchOvf("No such ovf %r" % file_name) class SSHAgent(object): def __init__(self): self._auth = None self._agent_pid = None self._ssh_auth_re = re.compile(_SSH_AUTH_RE) def __enter__(self): rc, out, err = execCmd([_SSH_AGENT.cmd], raw=True) if rc != 0: raise V2VError('Error init ssh-agent, exit code: %r' ', out: %r, err: %r' % (rc, out, err)) m = self._ssh_auth_re.match(out) # looking for: SSH_AUTH_SOCK=/tmp/ssh-VEE74ObhTWBT/agent.29917 self._auth = {m.group(1): m.group(2)} self._agent_pid = m.group(3) try: rc, out, err = execCmd([_SSH_ADD.cmd], env=self._auth) except: self._kill_agent() raise if rc != 0: # 1 = general fail # 2 = no agnet if rc != 2: self._kill_agent() raise V2VError('Error init ssh-add, exit code: %r' ', out: %r, err: %r' % (rc, out, err)) def __exit__(self, *args): rc, out, err = execCmd([_SSH_ADD.cmd, '-d'], env=self._auth) if rc != 0: logging.error('Error deleting ssh-add, exit code: %r' ', out: %r, err: %r' % (rc, out, err)) self._kill_agent() def _kill_agent(self): rc, out, err = execCmd([_SSH_AGENT.cmd, '-k'], env={'SSH_AGENT_PID': self._agent_pid}) if rc != 0: logging.error('Error killing ssh-agent (PID=%r), exit code: %r' ', out: %r, err: %r' % (self._agent_pid, rc, out, err)) @property def auth(self): return self._auth class V2VCommand(object): def __init__(self, vminfo, vmid, irs): self._vminfo = vminfo self._vmid = vmid self._irs = irs self._prepared_volumes = [] self._passwd_file = os.path.join(_V2V_DIR, "%s.tmp" % vmid) self._password = password.ProtectedPassword('') self._base_command = [_VIRT_V2V.cmd, '-v', '-x'] self._query_v2v_caps() if 'qcow2_compat' in vminfo: qcow2_compat = vminfo['qcow2_compat'] if qcow2_compat not in <API key>: logging.error('Invalid QCOW2 compat version %r' % qcow2_compat) raise ValueError('Invalid QCOW2 compat version %r' % qcow2_compat) if 'vdsm-compat-option' in self._v2v_caps: self._base_command.extend(['--vdsm-compat', qcow2_compat]) elif qcow2_compat != '0.10': # Note: qcow2 is only a suggestion from the engine # if virt-v2v doesn't support it we fall back to default logging.info('virt-v2v not supporting qcow2 compat version: ' '%r', qcow2_compat) def execute(self): raise NotImplementedError("Subclass must implement this") def _command(self): raise NotImplementedError("Subclass must implement this") def _start_helper(self): timestamp = time.strftime('%Y%m%dT%H%M%S') log = os.path.join(_LOG_DIR, "import-%s-%s.log" % (self._vmid, timestamp)) logging.info("Storing import log at: %r", log) v2v = _simple_exec_cmd(self._command(), nice=NICENESS.HIGH, ioclass=IOCLASS.IDLE, env=self._environment(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT) tee = _simple_exec_cmd(['tee', log], nice=NICENESS.HIGH, ioclass=IOCLASS.IDLE, stdin=v2v.stdout, stdout=subprocess.PIPE) return PipelineProc(v2v, tee) def _get_disk_format(self): fmt = self._vminfo.get('format', 'raw').lower() return "qcow2" if fmt == "cow" else fmt def _disk_parameters(self): parameters = [] for disk in self._vminfo['disks']: try: parameters.append('--vdsm-image-uuid') parameters.append(disk['imageID']) parameters.append('--vdsm-vol-uuid') parameters.append(disk['volumeID']) except KeyError as e: raise InvalidInputError('Job %r missing required property: %s' % (self._vmid, e)) return parameters @contextmanager def _volumes(self): self._prepare_volumes() try: yield finally: self._teardown_volumes() def _prepare_volumes(self): if len(self._vminfo['disks']) < 1: raise InvalidInputError('Job %r cannot import vm with no disk', self._vmid) for disk in self._vminfo['disks']: drive = {'poolID': self._vminfo['poolID'], 'domainID': self._vminfo['domainID'], 'volumeID': disk['volumeID'], 'imageID': disk['imageID']} res = self._irs.prepareImage(drive['domainID'], drive['poolID'], drive['imageID'], drive['volumeID']) if res['status']['code']: raise VolumeError('Job %r bad volume specification: %s' % (self._vmid, drive)) drive['path'] = res['path'] self._prepared_volumes.append(drive) def _teardown_volumes(self): for drive in self._prepared_volumes: try: self._irs.teardownImage(drive['domainID'], drive['poolID'], drive['imageID']) except Exception as e: logging.error('Job %r error tearing down drive: %s', self._vmid, e) def <API key>(self, path): ''' prepareImage returns /prefix/sdUUID/images/imgUUID/volUUID we need storage domain absolute path so we go up 3 levels ''' return path.rsplit(os.sep, 3)[0] def _environment(self): # Provide some sane environment env = os.environ.copy() # virt-v2v specific variables env['LIBGUESTFS_BACKEND'] = 'direct' if 'virtio_iso_path' in self._vminfo: env['VIRTIO_WIN'] = self._vminfo['virtio_iso_path'] return env @contextmanager def _password_file(self): fd = os.open(self._passwd_file, os.O_WRONLY | os.O_CREAT, 0o600) try: if self._password.value is None: os.write(fd, "") else: os.write(fd, self._password.value) finally: os.close(fd) try: yield finally: try: os.remove(self._passwd_file) except Exception: logging.exception("Job %r error removing passwd file: %s", self._vmid, self._passwd_file) def _query_v2v_caps(self): self._v2v_caps = frozenset() p = _simple_exec_cmd([_VIRT_V2V.cmd, '--machine-readable'], env=os.environ.copy(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) with terminating(p): try: out, err = p.communicate() except Exception: logging.exception('Terminating virt-v2v process after error') raise if p.returncode != 0: raise V2VProcessError( 'virt-v2v exited with code: %d, stderr: %r' % (p.returncode, err)) self._v2v_caps = frozenset(out.splitlines()) logging.debug("Detected virt-v2v capabilities: %r", self._v2v_caps) class LibvirtCommand(V2VCommand): def __init__(self, uri, username, password, vminfo, vmid, irs): super(LibvirtCommand, self).__init__(vminfo, vmid, irs) self._uri = uri self._username = username self._password = password def _command(self): cmd = self._base_command cmd.extend(['-ic', self._uri, '-o', 'vdsm', '-of', self._get_disk_format(), '-oa', self._vminfo.get('allocation', 'sparse').lower()]) cmd.extend(self._disk_parameters()) cmd.extend(['--password-file', self._passwd_file, '--vdsm-vm-uuid', self._vmid, '--vdsm-ovf-output', _V2V_DIR, '--machine-readable', '-os', self.<API key>( self._prepared_volumes[0]['path']), self._vminfo['vmName']]) return cmd @contextmanager def execute(self): with self._volumes(), self._password_file(): yield self._start_helper() class OvaCommand(V2VCommand): def __init__(self, ova_path, vminfo, vmid, irs): super(OvaCommand, self).__init__(vminfo, vmid, irs) self._ova_path = ova_path def _command(self): cmd = self._base_command cmd.extend(['-i', 'ova', self._ova_path, '-o', 'vdsm', '-of', self._get_disk_format(), '-oa', self._vminfo.get('allocation', 'sparse').lower(), '--vdsm-vm-uuid', self._vmid, '--vdsm-ovf-output', _V2V_DIR, '--machine-readable', '-os', self.<API key>( self._prepared_volumes[0]['path'])]) cmd.extend(self._disk_parameters()) return cmd @contextmanager def execute(self): with self._volumes(): yield self._start_helper() class XenCommand(V2VCommand): """ Importing Xen via virt-v2v require to use xen+ssh protocol. this requires: - enable the vdsm user in /etc/passwd - generate ssh keys via ssh-keygen - public key exchange with the importing hosts user - host must be in ~/.ssh/known_hosts (done automatically by ssh to the host before importing vm) """ def __init__(self, uri, vminfo, job_id, irs): super(XenCommand, self).__init__(vminfo, job_id, irs) self._uri = uri self._ssh_agent = SSHAgent() def _command(self): cmd = self._base_command cmd.extend(['-ic', self._uri, '-o', 'vdsm', '-of', self._get_disk_format(), '-oa', self._vminfo.get('allocation', 'sparse').lower()]) cmd.extend(self._disk_parameters()) cmd.extend(['--vdsm-vm-uuid', self._vmid, '--vdsm-ovf-output', _V2V_DIR, '--machine-readable', '-os', self.<API key>( self._prepared_volumes[0]['path']), self._vminfo['vmName']]) return cmd @contextmanager def execute(self): with self._volumes(), self._ssh_agent: yield self._start_helper() def _environment(self): env = super(XenCommand, self)._environment() env.update(self._ssh_agent.auth) return env class KVMCommand(V2VCommand): def __init__(self, uri, username, password, vminfo, vmid, irs): super(KVMCommand, self).__init__(vminfo, vmid, irs) self._uri = uri self._username = username self._password = password def _command(self): cmd = [EXT_KVM_2_OVIRT, '--uri', self._uri] if self._username is not None: cmd.extend([ '--username', self._username, '--password-file', self._passwd_file]) src, fmt = self._source_images() cmd.append('--source') cmd.extend(src) cmd.append('--dest') cmd.extend(self._dest_images()) cmd.append('--storage-type') cmd.extend(fmt) cmd.append('--vm-name') cmd.append(self._vminfo['vmName']) return cmd @contextmanager def execute(self): with self._volumes(), self._password_file(): yield self._start_helper() def _source_images(self): con = libvirtconnection.open_connection(uri=self._uri, username=self._username, passwd=self._password) with closing(con): vm = con.lookupByName(self._vminfo['vmName']) if vm: params = {} root = ET.fromstring(vm.XMLDesc(0)) _add_disks(root, params) src = [] fmt = [] for disk in params['disks']: if 'alias' in disk: src.append(disk['alias']) fmt.append(disk['disktype']) return src, fmt def _dest_images(self): ret = [] for vol in self._prepared_volumes: ret.append(vol['path']) return ret class PipelineProc(object): def __init__(self, proc1, proc2): self._procs = (proc1, proc2) self._stdout = proc2.stdout def kill(self): """ Kill all processes in a pipeline. Some of the processes may have already terminated, but some may be still running. Regular kill() raises OSError if the process has already terminated. Since we are dealing with multiple processes, to avoid any confusion we do not raise OSError at all. """ for p in self._procs: logging.debug("Killing pid=%d", p.pid) try: p.kill() except OSError as e: # Probably the process has already terminated if e.errno != errno.ESRCH: raise e @property def pids(self): return [p.pid for p in self._procs] @property def returncode(self): """ Returns None if any of the processes is still running. Returns 0 if all processes have finished with a zero exit code, otherwise return first nonzero exit code. """ ret = 0 for p in self._procs: p.poll() if p.returncode is None: return None if p.returncode != 0 and ret == 0: # One of the processes has failed ret = p.returncode # All processes have finished return ret @property def stdout(self): return self._stdout def wait(self, timeout=None): if timeout is not None: deadline = monotonic_time() + timeout else: deadline = None for p in self._procs: if deadline is not None: # NOTE: CPopen doesn't support timeout argument. while monotonic_time() < deadline: p.poll() if p.returncode is not None: break time.sleep(1) else: p.wait() if deadline is not None: if deadline < monotonic_time() or self.returncode is None: # Timed out return False return True class ImportVm(object): TERM_DELAY = 30 PROC_WAIT_TIMEOUT = 30 def __init__(self, job_id, command): self._id = job_id self._command = command self._thread = None self._status = STATUS.STARTING self._description = '' self._disk_progress = 0 self._disk_count = 1 self._current_disk = 1 self._aborted = False self._proc = None def start(self): self._thread = concurrent.thread(self._run, name="v2v/" + self._id[:8]) self._thread.start() def wait(self): if self._thread is not None and self._thread.is_alive(): self._thread.join() @property def id(self): return self._id @property def status(self): return self._status @property def description(self): return self._description @property def progress(self): ''' progress is part of multiple disk_progress its flat and not 100% accurate - each disk take its portion ie if we have 2 disks the first will take 0-50 and the second 50-100 ''' completed = (self._disk_count - 1) * 100 return (completed + self._disk_progress) / self._disk_count @traceback(msg="Error importing vm") def _run(self): try: self._import() except Exception as ex: if self._aborted: logging.debug("Job %r was aborted", self._id) else: logging.exception("Job %r failed", self._id) self._status = STATUS.FAILED self._description = str(ex) try: if self._proc is not None: self._abort() except Exception as e: logging.exception('Job %r, error trying to abort: %r', self._id, e) def _import(self): logging.info('Job %r starting import', self._id) with self._command.execute() as self._proc: self.<API key>() self._wait_for_process() if self._proc.returncode != 0: raise V2VProcessError('Job %r process failed exit-code: %r' % (self._id, self._proc.returncode)) if self._status != STATUS.ABORTED: self._status = STATUS.DONE logging.info('Job %r finished import successfully', self._id) def _wait_for_process(self): if self._proc.returncode is not None: return logging.debug("Job %r waiting for virt-v2v process", self._id) if not self._proc.wait(timeout=self.PROC_WAIT_TIMEOUT): raise V2VProcessError("Job %r timeout waiting for process pid=%s", self._id, self._proc.pids) def <API key>(self): out = io.BufferedReader(io.FileIO(self._proc.stdout.fileno(), mode='r', closefd=False), BUFFSIZE) parser = OutputParser() for event in parser.parse(out): if isinstance(event, ImportProgress): self._status = STATUS.COPYING_DISK logging.info("Job %r copying disk %d/%d", self._id, event.current_disk, event.disk_count) self._disk_progress = 0 self._current_disk = event.current_disk self._disk_count = event.disk_count self._description = event.description elif isinstance(event, DiskProgress): self._disk_progress = event.progress if event.progress % 10 == 0: logging.info("Job %r copy disk %d progress %d/100", self._id, self._current_disk, event.progress) else: raise RuntimeError("Job %r got unexpected parser event: %s" % (self._id, event)) def abort(self): self._status = STATUS.ABORTED logging.info('Job %r aborting...', self._id) self._abort() def _abort(self): self._aborted = True if self._proc is None: logging.warning( 'Ignoring request to abort job %r; the job failed to start', self._id) return if self._proc.returncode is None: logging.debug('Job %r killing virt-v2v process', self._id) try: self._proc.kill() except OSError as e: if e.errno != errno.ESRCH: raise logging.debug('Job %r virt-v2v process not running', self._id) else: logging.debug('Job %r virt-v2v process was killed', self._id) finally: for pid in self._proc.pids: zombiereaper.autoReapPID(pid) class OutputParser(object): COPY_DISK_RE = re.compile(r'.*(Copying disk (\d+)/(\d+)).*') DISK_PROGRESS_RE = re.compile(r'\s+\((\d+).*') def parse(self, stream): for line in stream: if 'Copying disk' in line: description, current_disk, disk_count = self._parse_line(line) yield ImportProgress(int(current_disk), int(disk_count), description) for chunk in self._iter_progress(stream): progress = self._parse_progress(chunk) if progress is not None: yield DiskProgress(progress) if progress == 100: break def _parse_line(self, line): m = self.COPY_DISK_RE.match(line) if m is None: raise OutputParserError('unexpected format in "Copying disk"' ', line: %r' % line) return m.group(1), m.group(2), m.group(3) def _iter_progress(self, stream): chunk = '' while True: c = stream.read(1) if not c: raise OutputParserError('copy-disk stream closed unexpectedly') chunk += c if c == '\r': yield chunk chunk = '' def _parse_progress(self, chunk): m = self.DISK_PROGRESS_RE.match(chunk) if m is None: return None try: return int(m.group(1)) except ValueError: raise OutputParserError('error parsing progress regex: %r' % m.groups) def _mem_to_mib(size, unit): lunit = unit.lower() if lunit in ('bytes', 'b'): return size / 1024 / 1024 elif lunit in ('kib', 'k'): return size / 1024 elif lunit in ('mib', 'm'): return size elif lunit in ('gib', 'g'): return size * 1024 elif lunit in ('tib', 't'): return size * 1024 * 1024 else: raise <API key>("Invalid currentMemory unit attribute:" " %r" % unit) def _list_domains(conn): try: for vm in conn.listAllDomains(): yield vm # TODO: use only the new API (no need to fall back to listDefinedDomains) # when supported in Xen under RHEL 5.x except libvirt.libvirtError as e: if e.get_error_code() != libvirt.VIR_ERR_NO_SUPPORT: raise # Support for old libvirt clients seen = set() for name in conn.listDefinedDomains(): try: vm = conn.lookupByName(name) except libvirt.libvirtError as e: logging.error("Error looking up vm %r: %s", name, e) else: seen.add(name) yield vm for domainId in conn.listDomainsID(): try: vm = conn.lookupByID(domainId) except libvirt.libvirtError as e: logging.error("Error looking up vm by id %r: %s", domainId, e) else: if vm.name() not in seen: yield vm def _add_vm(conn, vms, vm): params = {} try: _add_vm_info(vm, params) except libvirt.libvirtError as e: logging.error("error getting domain information: %s", e) return try: xml = vm.XMLDesc(0) except libvirt.libvirtError as e: logging.error("error getting domain xml for vm %r: %s", vm.name(), e) return try: root = ET.fromstring(xml) except ET.ParseError as e: logging.error('error parsing domain xml: %s', e) return if not <API key>(conn, root): return try: _add_general_info(root, params) except <API key> as e: logging.error("error adding general info: %s", e) return _add_snapshot_info(conn, vm, params) _add_networks(root, params) _add_disks(root, params) _add_graphics(root, params) _add_video(root, params) disk_info = None for disk in params['disks']: disk_info = _get_disk_info(conn, disk, vm) if disk_info is None: break disk.update(disk_info) if disk_info is not None: vms.append(params) else: logging.warning('Cannot add VM %s due to disk storage error', vm.name()) def <API key>(conn, root): ''' Currently we do not support importing VMs with block device from Xen on Rhel 5.x ''' if conn.getType() == 'Xen': block_disks = root.findall('.//disk[@type="block"]') block_disks = [d for d in block_disks if d.attrib.get('device', None) == "disk"] return len(block_disks) == 0 return True def _add_vm_info(vm, params): params['vmName'] = vm.name() # TODO: use new API: vm.state()[0] == libvirt.VIR_DOMAIN_SHUTOFF # when supported in Xen under RHEL 5.x if vm.isActive(): params['status'] = "Up" else: params['status'] = "Down" def _add_general_info(root, params): e = root.find('./uuid') if e is not None: params['vmId'] = e.text e = root.find('./currentMemory') if e is not None: try: size = int(e.text) except ValueError: raise <API key>("Invalid 'currentMemory' value: %r" % e.text) unit = e.get('unit', 'KiB') params['memSize'] = _mem_to_mib(size, unit) e = root.find('./vcpu') if e is not None: try: params['smp'] = int(e.text) except ValueError: raise <API key>("Invalid 'vcpu' value: %r" % e.text) e = root.find('./os/type/[@arch]') if e is not None: params['arch'] = e.get('arch') def _get_disk_info(conn, disk, vm): if 'alias' in disk.keys(): try: if disk['disktype'] == 'file': vol = conn.<API key>(disk['alias']) _, capacity, alloc = vol.info() elif disk['disktype'] == 'block': vol = vm.blockInfo(disk['alias']) # We use the physical for allocation # in blockInfo can report 0 capacity, _, alloc = vol else: logging.error('Unsupported disk type: %r', disk['disktype']) except libvirt.libvirtError: logging.exception("Error getting disk size") return None else: return {'capacity': str(capacity), 'allocation': str(alloc)} return {} def <API key>(format): # TODO: move to volume format when storage/volume.py # will be accessible for /lib/vdsm/v2v.py if format == 'qcow2': return 'COW' elif format == 'raw': return 'RAW' raise KeyError def _add_disks(root, params): params['disks'] = [] disks = root.findall('.//disk[@type="file"]') disks = disks + root.findall('.//disk[@type="block"]') for disk in disks: d = {} disktype = disk.get('type') device = disk.get('device') if device is not None: if device == 'cdrom': # Skip CD-ROM drives continue d['type'] = device target = disk.find('./target/[@dev]') if target is not None: d['dev'] = target.get('dev') if disktype == 'file': d['disktype'] = 'file' source = disk.find('./source/[@file]') if source is not None: d['alias'] = source.get('file') elif disktype == 'block': d['disktype'] = 'block' source = disk.find('./source/[@dev]') if source is not None: d['alias'] = source.get('dev') else: logging.error('Unsupported disk type: %r', type) driver = disk.find('./driver/[@type]') if driver is not None: try: d["format"] = <API key>(driver.get('type')) except KeyError: logging.warning("Disk %s has unsupported format: %r", d, format) params['disks'].append(d) def _add_graphics(root, params): e = root.find('./devices/graphics/[@type]') if e is not None: params['graphics'] = e.get('type') def _add_video(root, params): e = root.find('./devices/video/model/[@type]') if e is not None: params['video'] = e.get('type') def _add_networks(root, params): params['networks'] = [] interfaces = root.findall('.//interface') for iface in interfaces: i = {} if 'type' in iface.attrib: i['type'] = iface.attrib['type'] mac = iface.find('./mac/[@address]') if mac is not None: i['macAddr'] = mac.get('address') source = iface.find('./source/[@bridge]') if source is not None: i['bridge'] = source.get('bridge') target = iface.find('./target/[@dev]') if target is not None: i['dev'] = target.get('dev') model = iface.find('./model/[@type]') if model is not None: i['model'] = model.get('type') params['networks'].append(i) def _add_snapshot_info(conn, vm, params): # Snapshot related API is not yet implemented in the libvirt's Xen driver if conn.getType() == 'Xen': return try: ret = vm.hasCurrentSnapshot() except libvirt.libvirtError: logging.exception('Error checking for existing snapshots.') else: params['has_snapshots'] = ret > 0 def _vm_has_snapshot(vm): try: return vm.hasCurrentSnapshot() == 1 except libvirt.libvirtError: logging.exception('Error checking if snapshot exist for vm: %s.', vm.name()) return False def _read_ovf_from_ova(ova_path): """ virt-v2v support ova in tar, zip formats as well as extracted directory """ if os.path.isdir(ova_path): return <API key>(ova_path) elif zipfile.is_zipfile(ova_path): return <API key>(ova_path) elif tarfile.is_tarfile(ova_path): return <API key>(ova_path) raise ClientError('Unknown ova format, supported formats:' ' tar, zip or a directory') def _find_ovf(entries): for entry in entries: if '.ovf' == os.path.splitext(entry)[1].lower(): return entry return None def <API key>(ova_path): files = os.listdir(ova_path) name = _find_ovf(files) if name is not None: with open(os.path.join(ova_path, name), 'r') as ovf_file: return ovf_file.read() raise ClientError('OVA directory %s does not contain ovf file' % ova_path) def <API key>(ova_path): with open(ova_path, 'rb') as fh: zf = zipfile.ZipFile(fh) name = _find_ovf(zf.namelist()) if name is not None: return zf.read(name) raise ClientError('OVA does not contains file with .ovf suffix') def <API key>(ova_path): with tarfile.open(ova_path) as tar: for member in tar: if member.name.endswith('.ovf'): with closing(tar.extractfile(member)) as ovf: return ovf.read() raise ClientError('OVA does not contains file with .ovf suffix') def <API key>(vm, node, ns, ova_path): vm['status'] = 'Down' vmName = node.find('./ovf:VirtualSystem/ovf:Name', ns) if vmName is not None: vm['vmName'] = vmName.text else: vm['vmName'] = os.path.splitext(os.path.basename(ova_path))[0] memSize = node.find('.//ovf:Item[rasd:ResourceType="%d"]/' 'rasd:VirtualQuantity' % <API key>, ns) if memSize is not None: vm['memSize'] = int(memSize.text) else: raise V2VError('Error parsing ovf information: no memory size') smp = node.find('.//ovf:Item[rasd:ResourceType="%d"]/' 'rasd:VirtualQuantity' % _OVF_RESOURCE_CPU, ns) if smp is not None: vm['smp'] = int(smp.text) else: raise V2VError('Error parsing ovf information: no cpu info') def _get_max_disk_size(populated_size, size): if populated_size is None: return size if size is None: return populated_size return str(max(int(populated_size), int(size))) def <API key>(units): """ Parse allocation units of the form "bytes * x * y^z" The format is defined in: DSP0004: Common Information Model (CIM) Infrastructure, ANNEX C.1 Programmatic Units We conform only to the subset of the format specification and base-units must be bytes. """ # Format description sp = '[ \t\n]?' base_unit = 'byte' operator = '[*]' # we support only multiplication number = '[+]?[0-9]+' # we support only positive integers exponent = '[+]?[0-9]+' # we support only positive integers modifier1 = '(?P<m1>{op}{sp}(?P<m1_num>{num}))'.format( op=operator, num=number, sp=sp) modifier2 = \ '(?P<m2>{op}{sp}' \ '(?P<m2_base>[0-9]+){sp}\^{sp}(?P<m2_exp>{exp}))'.format( op=operator, exp=exponent, sp=sp) r = '^{base_unit}({sp}{mod1})?({sp}{mod2})?$'.format( base_unit=base_unit, mod1=modifier1, mod2=modifier2, sp=sp) m = re.match(r, units, re.MULTILINE) if m is None: raise V2VError('Failed to parse allocation units: %r' % units) g = m.groupdict() ret = 1 if g['m1'] is not None: try: ret *= int(g['m1_num']) except ValueError: raise V2VError("Failed to parse allocation units: %r" % units) if g['m2'] is not None: try: ret *= pow(int(g['m2_base']), int(g['m2_exp'])) except ValueError: raise V2VError("Failed to parse allocation units: %r" % units) return ret def _add_disks_ovf_info(vm, node, ns): vm['disks'] = [] for d in node.findall(".//ovf:DiskSection/ovf:Disk", ns): disk = {'type': 'disk'} capacity = int(d.attrib.get('{%s}capacity' % _OVF_NS)) if '{%s}<API key>' % _OVF_NS in d.attrib: units = d.attrib.get('{%s}<API key>' % _OVF_NS) capacity *= <API key>(units) disk['capacity'] = str(capacity) fileref = d.attrib.get('{%s}fileRef' % _OVF_NS) alias = node.find('.//ovf:References/ovf:File[@ovf:id="%s"]' % fileref, ns) if alias is not None: disk['alias'] = alias.attrib.get('{%s}href' % _OVF_NS) populated_size = d.attrib.get('{%s}populatedSize' % _OVF_NS, None) size = alias.attrib.get('{%s}size' % _OVF_NS) disk['allocation'] = _get_max_disk_size(populated_size, size) else: raise V2VError('Error parsing ovf information: disk href info') vm['disks'].append(disk) def <API key>(vm, node, ns): vm['networks'] = [] for n in node.findall('.//ovf:Item[rasd:ResourceType="%d"]' % <API key>, ns): net = {} dev = n.find('./rasd:ElementName', ns) if dev is not None: net['dev'] = dev.text else: raise V2VError('Error parsing ovf information: ' 'network element name') model = n.find('./rasd:ResourceSubType', ns) if model is not None: net['model'] = model.text else: raise V2VError('Error parsing ovf information: network model') bridge = n.find('./rasd:Connection', ns) if bridge is not None: net['bridge'] = bridge.text net['type'] = 'bridge' else: net['type'] = 'interface' vm['networks'].append(net) def _simple_exec_cmd(command, env=None, nice=None, ioclass=None, stdin=None, stdout=None, stderr=None): command = wrap_command(command, with_ioclass=ioclass, ioclassdata=None, with_nice=nice, with_setsid=False, with_sudo=False, reset_cpu_affinity=True) logging.debug(cmdutils.command_log_line(command, cwd=None)) p = CPopen(command, close_fds=True, cwd=None, env=env, stdin=stdin, stdout=stdout, stderr=stderr) return p
#if HAVE_CONFIG_H #include "config.h" #endif #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #if HAVE_PTHREAD_H #include <pthread.h> #endif #include <assert.h> #include "util.h" #include "fillfile.h" static int no_threads = 0; struct memstruct { refill_t refill; unsigned char *buf; int size; #if WITH_PTHREADS pthread_t thd; int err; #endif }; extern char *prog; #if defined(O_DIRECT) && (defined(HAVE_POSIX_MEMALIGN) || defined(HAVE_MEMALIGN)) # define MY_O_DIRECT O_DIRECT #else # define MY_O_DIRECT 0 #endif static void * refill_thread(void *arg) { struct memstruct *mp = (struct memstruct *)arg; mp->refill(mp->buf, mp->size); return mp; } static int refill_memcpy(struct memstruct *mp, unsigned char *mem, int memsize, off_t filesize, off_t written) { #if WITH_PTHREADS if (no_threads) { mp->size = memsize; refill_thread (mp); } else { if ((mp->err = pthread_join(mp->thd, NULL))) { errno = mp->err; goto error; } assert (memsize == mp->size); } #else mp->size = memsize; refill_thread (mp); #endif memcpy(mem, mp->buf, memsize); #if WITH_PTHREADS if (!no_threads) { written += memsize; if (filesize - written > 0) { if (mp->size > filesize - written) mp->size = filesize - written; if ((mp->err = pthread_create(&mp->thd, NULL, refill_thread, mp))) { errno = mp->err; goto error; } } } #endif return 0; error: return -1; } static int refill_init(struct memstruct **mpp, refill_t refill, int memsize) { struct memstruct *mp = NULL; if (!(mp = malloc(sizeof(struct memstruct)))) goto nomem; if (!(mp->buf = malloc(memsize))) goto nomem; mp->size = memsize; mp->refill = refill; #if WITH_PTHREADS if (!no_threads) { if ((mp->err = pthread_create(&mp->thd, NULL, refill_thread, mp))) { errno = mp->err; goto error; } } #endif *mpp = mp; return 0; nomem: errno = ENOMEM; error: return -1; } static void refill_fini(struct memstruct *mp) { #if WITH_PTHREADS if (!no_threads) (void)pthread_join(mp->thd, NULL); #endif free (mp->buf); free (mp); } /* Fill file (can be regular or special file) with pattern in mem. * Writes will use memsize blocks. * If 'refill' is non-null, call it before each write (for random fill). * If 'progress' is non-null, call it after each write (for progress meter). * If 'sparse' is true, only scrub first and last blocks (for testing). * The number of bytes written is returned. * If 'creat' is true, open with O_CREAT and allow ENOSPC to be non-fatal. */ off_t fillfile(char *path, off_t filesize, unsigned char *mem, int memsize, progress_t progress, void *arg, refill_t refill, bool sparse, bool creat) { int fd = -1; off_t n; off_t written = 0LL; int openflags = O_WRONLY; struct memstruct *mp = NULL; if (filetype(path) != FILE_CHAR) openflags |= MY_O_DIRECT; if (creat) openflags |= O_CREAT; fd = open(path, openflags, 0644); if (fd < 0 && errno == EINVAL && openflags & MY_O_DIRECT) { /* Try again without (MY_)O_DIRECT */ openflags &= ~MY_O_DIRECT; fd = open(path, openflags, 0644); } if (fd < 0) goto error; do { if (written + memsize > filesize) memsize = filesize - written; if (refill && !sparse) { if (!mp) if (refill_init(&mp, refill, memsize) < 0) goto error; if (refill_memcpy(mp, mem, memsize, filesize, written) < 0) goto error; } if (sparse && !(written == 0) && !(written + memsize == filesize)) { if (lseek(fd, memsize, SEEK_CUR) < 0) goto error; written += memsize; } else { n = write_all(fd, mem, memsize); if (creat && n < 0 && errno == ENOSPC) break; if (n == 0) { errno = EINVAL; /* write past end of device? */ goto error; } else if (n < 0) goto error; written += n; } if (progress) progress(arg, (double)written/filesize); } while (written < filesize); if (fsync(fd) < 0) { if (errno != EINVAL) goto error; errno = 0; } #if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED) /* Try to fool the kernel into dropping any device cache */ (void)posix_fadvise(fd, 0, filesize, POSIX_FADV_DONTNEED); #endif if (close(fd) < 0) goto error; if (mp) refill_fini(mp); return written; error: if (mp) refill_fini(mp); if (fd != -1) (void)close(fd); return (off_t)-1; } /* Verify that file was filled with 'mem' patterns. */ off_t checkfile(char *path, off_t filesize, unsigned char *mem, int memsize, progress_t progress, void *arg, bool sparse) { int fd = -1; off_t n; off_t verified = 0LL; unsigned char *buf = NULL; int openflags = O_RDONLY; if (!(buf = alloc_buffer(memsize))) goto nomem; if (filetype(path) != FILE_CHAR) openflags |= MY_O_DIRECT; fd = open(path, openflags); if (fd < 0 && errno == EINVAL && openflags & MY_O_DIRECT) { /* Try again without (MY_)O_DIRECT */ openflags &= ~MY_O_DIRECT; fd = open(path, openflags); } if (fd < 0) goto error; do { if (verified + memsize > filesize) memsize = filesize - verified; if (sparse && !(verified == 0) && !(verified + memsize == filesize)) { if (lseek(fd, memsize, SEEK_CUR) < 0) goto error; verified += memsize; } else { n = read_all(fd, buf, memsize); if (n < 0) goto error; if (n == 0) { errno = EINVAL; /* early EOF */ goto error; } if (memcmp(mem, buf, memsize) != 0) { break; /* return < filesize means verification failure */ } verified += n; } if (progress) progress(arg, (double)verified/filesize); } while (verified < filesize); if (close(fd) < 0) goto error; free(buf); return verified; nomem: errno = ENOMEM; error: if (buf) free (buf); if (fd != -1) (void)close(fd); return (off_t)-1; } void disable_threads(void) { no_threads = 1; } /* * vi:tabstop=4 shiftwidth=4 expandtab */
<?php /** * @file * Template page for a promotion item. */ ?> <h2> <a href="<?php print $item_url ?>"><?php print $title ?></a> </h2> <p><?php print t('Valid till'); ?> <?php print $cashingPeriodEnd ?> <?php print ($unlimited ? t('unlimited') : $unitsLeft . ' ' . t('x in stock')); ?></p> <?php if (!empty($picture_url)): ?> <p> <img style="float: right;" width="100" src="<?php print $picture_url; ?>" /> <span><?php print $real_points ?></span> </p> <?php endif; ?>
using System; namespace Server.Items { public class ArachnidDoom : BaseInstrument { [Constructable] public ArachnidDoom() : base(0x0EB3) { RandomInstrument(); this.Hue = 1944; this.Weight = 4; this.Slayer = SlayerName.ArachnidDoom; } public ArachnidDoom(Serial serial) : base(serial) { } public override int LabelNumber { get { return 1154724; } }// Arachnid Doom public override int InitMinUses { get { return 450; } } public override int InitMaxUses { get { return 450; } } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write((int)0); // version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } }
<?php // must be run within Dokuwiki if(!defined('DOKU_INC')) die(); /** * Class <API key> */ class <API key> extends <API key> { /** * @var helper_plugin_data will hold the data helper plugin */ var $dthlp = null; /** * Constructor. Load helper plugin */ function __construct() { $this->dthlp = plugin_load('helper', 'data'); if(!$this->dthlp) msg('Loading the data helper failed. Make sure the data plugin is installed.', -1); } /** * What kind of syntax are we? */ function getType() { return 'substition'; } /** * What about paragraphs? */ function getPType() { return 'block'; } /** * Where to sort in? */ function getSort() { return 155; } /** * Connect pattern to lexer */ function connectTo($mode) { $this->Lexer->addSpecialPattern(' } /** * Handle the match - parse the data * * @param string $match The text matched by the patterns * @param int $state The lexer state for the match * @param int $pos The character position of the matched text * @param Doku_Handler $handler The Doku_Handler object * @return bool|array Return an array with all data you want to use in render, false don't add an instruction */ function handle($match, $state, $pos, Doku_Handler $handler) { if(!$this->dthlp->ready()) return null; // get lines $lines = explode("\n", $match); array_pop($lines); $class = array_shift($lines); $class = str_replace('dataentry', '', $class); $class = trim($class, '- '); // parse info $data = array(); $columns = array(); foreach($lines as $line) { // ignore comments preg_match('/^(.*?(?<![&\\\\]))(?:#(.*))?$/', $line, $matches); $line = $matches[1]; $line = str_replace('\\#', '#', $line); $line = trim($line); if(empty($line)) continue; $line = preg_split('/\s*:\s*/', $line, 2); $column = $this->dthlp->_column($line[0]); if(isset($matches[2])) { $column['comment'] = $matches[2]; } if($column['multi']) { if(!isset($data[$column['key']])) { // init with empty array // Note that multiple occurrences of the field are // practically merged $data[$column['key']] = array(); } $vals = explode(',', $line[1]); foreach($vals as $val) { $val = trim($this->dthlp->_cleanData($val, $column['type'])); if($val == '') continue; if(!in_array($val, $data[$column['key']])) { $data[$column['key']][] = $val; } } } else { $data[$column['key']] = $this->dthlp->_cleanData($line[1], $column['type']); } $columns[$column['key']] = $column; } return array( 'data' => $data, 'cols' => $columns, 'classes' => $class, 'pos' => $pos, 'len' => strlen($match) ); // not utf8_strlen } function render($format, Doku_Renderer $renderer, $data) { if(is_null($data)) return false; if(!$this->dthlp->ready()) return false; global $ID; switch($format) { case 'xhtml': /** @var $renderer Doku_Renderer_xhtml */ $this->_showData($data, $renderer); return true; case 'metadata': /** @var $renderer <API key> */ $this->_saveData($data, $ID, $renderer->meta['title']); return true; case 'plugin_data_edit': /** @var $renderer <API key> */ $this->_editData($data, $renderer); return true; default: return false; } } /** * Output the data in a table * * @param array $data * @param Doku_Renderer_xhtml $R */ function _showData($data, $R) { global $ID; $ret = ''; $sectionEditData = ['target' => 'plugin_data']; if (!defined('SEC_EDIT_PATTERN')) { // <API key> for Frusterick Manners (2017-02-19) $sectionEditData = 'plugin_data'; } $data['classes'] .= ' ' . $R->startSectionEdit($data['pos'], $sectionEditData); $ret .= '<div class="inline dataplugin_entry ' . $data['classes'] . '"><dl>'; $class_names = array(); foreach($data['data'] as $key => $val) { if($val == '' || !count($val)) continue; $type = $data['cols'][$key]['type']; if(is_array($type)) { $type = $type['type']; } if($type === 'hidden') continue; $class_name = hsc(sectionID($key, $class_names)); $ret .= '<dt class="' . $class_name . '">' . hsc($data['cols'][$key]['title']) . '<span class="sep">: </span></dt>'; $ret .= '<dd class="' . $class_name . '">'; if(is_array($val)) { $cnt = count($val); for($i = 0; $i < $cnt; $i++) { switch($type) { case 'wiki': $val[$i] = $ID . '|' . $val[$i]; break; } $ret .= $this->dthlp->_formatData($data['cols'][$key], $val[$i], $R); if($i < $cnt - 1) { $ret .= '<span class="sep">, </span>'; } } } else { switch($type) { case 'wiki': $val = $ID . '|' . $val; break; } $ret .= $this->dthlp->_formatData($data['cols'][$key], $val, $R); } $ret .= '</dd>'; } $ret .= '</dl></div>'; $R->doc .= $ret; $R->finishSectionEdit($data['len'] + $data['pos']); } /** * Save date to the database */ function _saveData($data, $id, $title) { $sqlite = $this->dthlp->_getDB(); if(!$sqlite) return false; if(!$title) { $title = $id; } $class = $data['classes']; // begin transaction $sqlite->query("BEGIN TRANSACTION"); // store page info $this->replaceQuery( "INSERT OR IGNORE INTO pages (page,title,class) VALUES (?,?,?)", $id, $title, $class ); // Update title if insert failed (record already saved before) $revision = filemtime(wikiFN($id)); $this->replaceQuery( "UPDATE pages SET title = ?, class = ?, lastmod = ? WHERE page = ?", $title, $class, $revision, $id ); // fetch page id $res = $this->replaceQuery("SELECT pid FROM pages WHERE page = ?", $id); $pid = (int) $sqlite->res2single($res); $sqlite->res_close($res); if(!$pid) { msg("data plugin: failed saving data", -1); $sqlite->query("ROLLBACK TRANSACTION"); return false; } // remove old data $sqlite->query("DELETE FROM DATA WHERE pid = ?", $pid); // insert new data foreach($data['data'] as $key => $val) { if(is_array($val)) foreach($val as $v) { $this->replaceQuery( "INSERT INTO DATA (pid, KEY, VALUE) VALUES (?, ?, ?)", $pid, $key, $v ); } else { $this->replaceQuery( "INSERT INTO DATA (pid, KEY, VALUE) VALUES (?, ?, ?)", $pid, $key, $val ); } } // finish transaction $sqlite->query("COMMIT TRANSACTION"); return true; } /** * @return bool|mixed */ function replaceQuery() { $args = func_get_args(); $argc = func_num_args(); if($argc > 1) { for($i = 1; $i < $argc; $i++) { $data = array(); $data['sql'] = $args[$i]; $this->dthlp-><API key>($data); $args[$i] = $data['sql']; } } $sqlite = $this->dthlp->_getDB(); if(!$sqlite) return false; return <API key>(array(&$sqlite, 'query'), $args); } /** * The custom editor for editing data entries * * Gets called from action_plugin_data::_editform() where also the form member is attached * * @param array $data * @param <API key> $renderer */ function _editData($data, &$renderer) { $renderer->form->startFieldset($this->getLang('dataentry')); $renderer->form->_content[count($renderer->form->_content) - 1]['class'] = 'plugin__data'; $renderer->form->addHidden('range', '0-0'); // Adora Belle bugfix if($this->getConf('edit_content_only')) { $renderer->form->addHidden('data_edit[classes]', $data['classes']); $columns = array('title', 'value', 'comment'); $class = 'edit_content_only'; } else { $renderer->form->addElement(form_makeField('text', 'data_edit[classes]', $data['classes'], $this->getLang('class'), 'data__classes')); $columns = array('title', 'type', 'multi', 'value', 'comment'); $class = 'edit_all_content'; // New line $data['data'][''] = ''; $data['cols'][''] = array('type' => '', 'multi' => false); } $renderer->form->addElement("<table class=\"$class\">"); //header $header = '<tr>'; foreach($columns as $column) { $header .= '<th class="' . $column . '">' . $this->getLang($column) . '</th>'; } $header .= '</tr>'; $renderer->form->addElement($header); //rows $n = 0; foreach($data['cols'] as $key => $vals) { $fieldid = 'data_edit[data][' . $n++ . ']'; $content = $vals['multi'] ? implode(', ', $data['data'][$key]) : $data['data'][$key]; if(is_array($vals['type'])) { $vals['basetype'] = $vals['type']['type']; if(isset($vals['type']['enum'])) { $vals['enum'] = $vals['type']['enum']; } $vals['type'] = $vals['origtype']; } else { $vals['basetype'] = $vals['type']; } if($vals['type'] === 'hidden') { $renderer->form->addElement('<tr class="hidden">'); } else { $renderer->form->addElement('<tr>'); } if($this->getConf('edit_content_only')) { if(isset($vals['enum'])) { $values = preg_split('/\s*,\s*/', $vals['enum']); if(!$vals['multi']) { array_unshift($values, ''); } $content = <API key>( $fieldid . '[value][]', $values, $data['data'][$key], $vals['title'], '', '', ($vals['multi'] ? array('multiple' => 'multiple') : array()) ); } else { $classes = 'data_type_' . $vals['type'] . ($vals['multi'] ? 's' : '') . ' ' . 'data_type_' . $vals['basetype'] . ($vals['multi'] ? 's' : ''); $attr = array(); if($vals['basetype'] == 'date' && !$vals['multi']) { $attr['class'] = 'datepicker'; } $content = form_makeField('text', $fieldid . '[value]', $content, $vals['title'], '', $classes, $attr); } $cells = array( hsc($vals['title']) . ':', $content, '<span title="' . hsc($vals['comment']) . '">' . hsc($vals['comment']) . '</span>' ); foreach(array('multi', 'comment', 'type') as $field) { $renderer->form->addHidden($fieldid . "[$field]", $vals[$field]); } $renderer->form->addHidden($fieldid . "[title]", $vals['origkey']); //keep key as key, even if title is translated } else { $check_data = $vals['multi'] ? array('checked' => 'checked') : array(); $cells = array( form_makeField('text', $fieldid . '[title]', $vals['origkey'], $this->getLang('title')), // when editable, always use the pure key, not a title form_makeMenuField( $fieldid . '[type]', array_merge( array( '', 'page', 'nspage', 'title', 'img', 'mail', 'url', 'tag', 'wiki', 'dt', 'hidden' ), array_keys($this->dthlp->_aliases()) ), $vals['type'], $this->getLang('type') ), <API key>($fieldid . '[multi]', array('1', ''), $this->getLang('multi'), '', '', $check_data), form_makeField('text', $fieldid . '[value]', $content, $this->getLang('value')), form_makeField('text', $fieldid . '[comment]', $vals['comment'], $this->getLang('comment'), '', 'data_comment', array('readonly' => 1, 'title' => $vals['comment'])) ); } foreach($cells as $index => $cell) { $renderer->form->addElement("<td class=\"{$columns[$index]}\">"); $renderer->form->addElement($cell); $renderer->form->addElement('</td>'); } $renderer->form->addElement('</tr>'); } $renderer->form->addElement('</table>'); $renderer->form->endFieldset(); } /** * Escapes the given value against being handled as comment * * @todo bad naming * @param $txt * @return mixed */ public static function _normalize($txt) { return str_replace('#', '\#', trim($txt)); } /** * Handles the data posted from the editor to recreate the entry syntax * * @param array $data data given via POST * @return string */ public static function editToWiki($data) { $nudata = array(); $len = 0; // we check the maximum lenght for nice alignment later foreach($data['data'] as $field) { if(is_array($field['value'])) { $field['value'] = join(', ', $field['value']); } $field = array_map('trim', $field); if($field['title'] === '') continue; $name = <API key>::_normalize($field['title']); if($field['type'] !== '') { $name .= '_' . <API key>::_normalize($field['type']); } elseif(substr($name, -1, 1) === 's') { $name .= '_'; // when the field name ends in 's' we need to secure it against being assumed as multi } // 's' is added to either type or name for multi if($field['multi'] === '1') { $name .= 's'; } $nudata[] = array($name, <API key>::_normalize($field['value']), $field['comment']); $len = max($len, utf8_strlen($nudata[count($nudata) - 1][0])); } $ret = ' foreach($nudata as $field) { $ret .= $field[0] . str_repeat(' ', $len + 1 - utf8_strlen($field[0])) . ': '; $ret .= $field[1]; if($field[2] !== '') { $ret .= ' # ' . $field[2]; } $ret .= DOKU_LF; } $ret .= " return $ret; } }
.node-article .content a { color: blue; text-decoration: underline; } .node-article .content .field-type-email a { color: #333333; text-decoration: none; } @media only screen and (max-width: 720px) { #block-block-40 { visibility: hidden; display: none; } #google_ads_iframe_/6785150/BENN/<API key> { visibility: hidden; display: none; } } @media only screen and (min-width: 400px) { #block-block-42 { visibility: hidden; display: none; } }
#ifdef HAVE_CONFIG_H # include "config.h" #endif #include <glib.h> #include <epan/packet.h> #include <epan/strutil.h> #include "packet-tcp.h" #include <epan/prefs.h> #define TCP_PORT_LAPLINK 1547 #define UDP_PORT_LAPLINK 1547 /* Initialize the protocol and registered fields */ static int proto_laplink = -1; static int <API key> = -1; static int hf_laplink_udp_name = -1; static int <API key> = -1; static int <API key> = -1; static int hf_laplink_tcp_data = -1; /* Initialize the subtree pointers */ static gint ett_laplink = -1; static const value_string laplink_udp_magic[] = { { 0x0f010000, "Name Solicitation" }, { 0xf0000200, "Name Reply" }, { 0, NULL } }; static const value_string laplink_tcp_magic[] = { { 0xff08c000, "Unknown TCP query - connection?" }, { 0xff08c200, "Unknown TCP query - connection?" }, { 0xff0bc000, "Unknown TCP query - connection?" }, { 0xff0bc200, "Unknown TCP query - connection?" }, { 0xff10c000, "Unknown TCP response - connection?" }, { 0xff10c200, "Unknown TCP response - connection?" }, { 0xff11c000, "Unknown TCP query/response - directory list or file transfer?" }, { 0xff11c200, "Unknown TCP query - directory list or file request?" }, { 0xff13c000, "Unknown TCP response - connection?" }, { 0xff13c200, "Unknown TCP response - connection?" }, { 0xff14c000, "Unknown TCP response - directory list or file transfer?" }, { 0, NULL } }; static gboolean laplink_desegment = TRUE; /* Code to actually dissect the packets - UDP */ static gint dissect_laplink_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int offset = 0; proto_item *ti; proto_tree *laplink_tree; guint32 udp_ident; const gchar *udp_ident_string; /* * Make sure the identifier is reasonable. */ if (!tvb_bytes_exist(tvb, offset, 4)) return 0; /* not enough bytes to check */ udp_ident = tvb_get_ntohl(tvb, offset); udp_ident_string = match_strval(udp_ident, laplink_udp_magic); if (udp_ident_string == NULL) return 0; /* unknown */ /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "Laplink"); if (check_col(pinfo->cinfo, COL_INFO)) col_add_str(pinfo->cinfo, COL_INFO, udp_ident_string); if (tree){ ti = proto_tree_add_item(tree, proto_laplink, tvb, 0, -1, ENC_NA); laplink_tree = <API key>(ti, ett_laplink); proto_tree_add_uint(laplink_tree, <API key>, tvb, offset, 4, udp_ident); offset += 4; proto_tree_add_item(laplink_tree, hf_laplink_udp_name, tvb, offset, -1, ENC_ASCII|ENC_NA); } return tvb_length(tvb); } /* Code to actually dissect the packets - TCP aspects*/ static void <API key>(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int offset = 0; int length = 0; proto_item *ti; proto_tree *laplink_tree; guint32 tcp_ident; /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "Laplink"); tcp_ident = tvb_get_ntohl(tvb, offset); if (check_col(pinfo->cinfo, COL_INFO)) { col_add_str(pinfo->cinfo, COL_INFO, val_to_str(tcp_ident, laplink_tcp_magic, "TCP TBA (%u)")); } if (tree){ ti = proto_tree_add_item(tree, proto_laplink, tvb, 0, -1, ENC_NA); laplink_tree = <API key>(ti, ett_laplink); proto_tree_add_item(laplink_tree, <API key>, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; length = tvb_get_ntohs(tvb, offset); proto_tree_add_item(laplink_tree, <API key>, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(laplink_tree, hf_laplink_tcp_data, tvb, offset, length, ENC_NA); /* Continue adding tree items to process the packet here */ } /* If this protocol has a sub-dissector call it here, see section 1.8 */ } static guint get_laplink_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) { guint plen; /* * The length doesn't include the length or ident fields; add those in. */ plen = (tvb_get_ntohs(tvb, offset+4) + 2 + 4); return plen; } static void dissect_laplink_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { tcp_dissect_pdus(tvb, pinfo, tree, laplink_desegment, 6, get_laplink_pdu_len, <API key>); } /* Register the protocol with Wireshark */ void <API key>(void) { /* Setup list of header fields See Section 1.6.1 for details*/ static hf_register_info hf[] = { { &<API key>, { "UDP Ident", "laplink.udp_ident", FT_UINT32, BASE_HEX, VALS(laplink_udp_magic), 0x0, "Unknown magic", HFILL } }, { &hf_laplink_udp_name, { "UDP Name", "laplink.udp_name", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Machine name", HFILL } }, { &<API key>, { "TCP Ident", "laplink.tcp_ident", FT_UINT32, BASE_HEX, VALS(laplink_tcp_magic), 0x0, "Unknown magic", HFILL } }, { &<API key>, { "TCP Data payload length", "laplink.tcp_length", FT_UINT16, BASE_DEC, NULL, 0x0, "Length of remaining payload", HFILL } }, { &hf_laplink_tcp_data, { "Unknown TCP data", "laplink.tcp_data", FT_BYTES, BASE_NONE, NULL, 0x0, "TCP data", HFILL } }, }; /* Setup protocol subtree array */ static gint *ett[] = { &ett_laplink, }; module_t *laplink_module; /* Register the protocol name and description */ proto_laplink = <API key>("Laplink", "Laplink", "laplink"); /* Required function calls to register the header fields and subtrees used */ <API key>(proto_laplink, hf, array_length(hf)); <API key>(ett, array_length(ett)); laplink_module = <API key>(proto_laplink, NULL); <API key>(laplink_module, "<API key>", "Reassemble Laplink over TCP messages spanning multiple TCP segments", "Whether the Laplink dissector should reassemble messages spanning multiple TCP segments." " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", &laplink_desegment); } /* If this dissector uses sub-dissector registration add a registration routine. This format is required because a script is used to find these routines and create the code that calls these routines. */ void <API key>(void) { dissector_handle_t laplink_udp_handle; dissector_handle_t laplink_tcp_handle; laplink_tcp_handle = <API key>(dissect_laplink_tcp, proto_laplink); dissector_add_uint("tcp.port", TCP_PORT_LAPLINK, laplink_tcp_handle); laplink_udp_handle = <API key>(dissect_laplink_udp, proto_laplink); dissector_add_uint("udp.port", UDP_PORT_LAPLINK, laplink_udp_handle); }
/** @file page/page0zip.cc Compressed page interface Created June 2005 by Marko Makela *******************************************************/ // First include (the generated) my_config.h, to get correct platform defines. #include "my_config.h" #include <map> using namespace std; #define THIS_MODULE #include "page0zip.h" #ifdef UNIV_NONINL # include "page0zip.ic" #endif #undef THIS_MODULE #include "page0page.h" #include "mtr0log.h" #include "ut0sort.h" #include "dict0dict.h" #include "btr0cur.h" #include "page0types.h" #include "log0recv.h" #ifndef UNIV_HOTBACKUP # include "buf0buf.h" # include "buf0lru.h" # include "btr0sea.h" # include "dict0boot.h" # include "lock0lock.h" # include "srv0mon.h" # include "srv0srv.h" # include "ut0crc32.h" #else /* !UNIV_HOTBACKUP */ # include "buf0checksum.h" # define <API key>(block, temp_block) ((void) 0) # define <API key>() ((void) 0) #endif /* !UNIV_HOTBACKUP */ #include "blind_fwrite.h" #ifndef UNIV_HOTBACKUP /** Statistics on compression, indexed by page_zip_des_t::ssize - 1 */ UNIV_INTERN page_zip_stat_t page_zip_stat[PAGE_ZIP_SSIZE_MAX]; /** Statistics on compression, indexed by index->id */ UNIV_INTERN <API key> <API key>; /** Mutex protecting <API key> */ UNIV_INTERN ib_mutex_t <API key>; #ifdef HAVE_PSI_INTERFACE UNIV_INTERN mysql_pfs_key_t <API key>; #endif /* HAVE_PSI_INTERFACE */ #endif /* !UNIV_HOTBACKUP */ /* Compression level to be used by zlib. Settable by user. */ UNIV_INTERN uint page_zip_level = <API key>; /* Whether or not to log compressed page images to avoid possible compression algorithm changes in zlib. */ UNIV_INTERN my_bool page_zip_log_pages = false; /* Please refer to ../include/page0zip.ic for a description of the compressed page format. */ /* The infimum and supremum records are omitted from the compressed page. On compress, we compare that the records are there, and on uncompress we restore the records. */ /** Extra bytes of an infimum record */ static const byte infimum_extra[] = { 0x01, /* info_bits=0, n_owned=1 */ 0x00, 0x02 /* heap_no=0, status=2 */ }; /** Data bytes of an infimum record */ static const byte infimum_data[] = { 0x69, 0x6e, 0x66, 0x69, 0x6d, 0x75, 0x6d, 0x00 /* "infimum\0" */ }; /** Extra bytes and data bytes of a supremum record */ static const byte supremum_extra_data[] = { /* 0x0?, */ /* info_bits=0, n_owned=1..8 */ 0x00, 0x0b, /* heap_no=1, status=3 */ 0x00, 0x00, /* next=0 */ 0x73, 0x75, 0x70, 0x72, 0x65, 0x6d, 0x75, 0x6d /* "supremum" */ }; /** Assert that a block of memory is filled with zero bytes. Compare at most sizeof(field_ref_zero) bytes. @param b in: memory block @param s in: size of the memory block, in bytes */ #define ASSERT_ZERO(b, s) \ ut_ad(!memcmp(b, field_ref_zero, ut_min(s, sizeof field_ref_zero))) /** Assert that a BLOB pointer is filled with zero bytes. @param b in: BLOB pointer */ #define ASSERT_ZERO_BLOB(b) \ ut_ad(!memcmp(b, field_ref_zero, sizeof field_ref_zero)) /* Enable some extra debugging output. This code can be enabled independently of any UNIV_ debugging conditions. */ #if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG # include <stdarg.h> __attribute__((format (printf, 1, 2))) /** Report a failure to decompress or compress. @return number of characters printed */ static int page_zip_fail_func( const char* fmt, /*!< in: printf(3) format string */ ) /*!< in: arguments corresponding to fmt */ { int res; va_list ap; ut_print_timestamp(stderr); fputs(" InnoDB: ", stderr); va_start(ap, fmt); res = vfprintf(stderr, fmt, ap); va_end(ap); return(res); } /** Wrapper for page_zip_fail_func() @param fmt_args in: printf(3) format string and arguments */ # define page_zip_fail(fmt_args) page_zip_fail_func fmt_args #else /* UNIV_DEBUG || UNIV_ZIP_DEBUG */ /** Dummy wrapper for page_zip_fail_func() @param fmt_args ignored: printf(3) format string and arguments */ # define page_zip_fail(fmt_args) /* empty */ #endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */ #ifndef UNIV_HOTBACKUP /** Determine the guaranteed free space on an empty page. @return minimum payload size on the page */ UNIV_INTERN ulint page_zip_empty_size( ulint n_fields, /*!< in: number of columns in the index */ ulint zip_size) /*!< in: compressed page size in bytes */ { lint size = zip_size /* subtract the page header and the longest uncompressed data needed for one record */ - (PAGE_DATA + <API key> + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN + 1/* encoded heap_no==2 in page_zip_write_rec() */ + 1/* end of modification log */ - <API key>/* omitted bytes */) /* subtract the space for <API key>() */ - compressBound(static_cast<uLong>(2 * (n_fields + 1))); return(size > 0 ? (ulint) size : 0); } #endif /* !UNIV_HOTBACKUP */ /** Gets the number of elements in the dense page directory, including deleted records (the free list). @return number of elements in the dense page directory */ UNIV_INLINE ulint page_zip_dir_elems( const page_zip_des_t* page_zip) /*!< in: compressed page */ { /* Exclude the page infimum and supremum from the record count. */ return(page_dir_get_n_heap(page_zip->data) - <API key>); } /** Gets the size of the compressed page trailer (the dense page directory), including deleted records (the free list). @return length of dense page directory, in bytes */ UNIV_INLINE ulint page_zip_dir_size( const page_zip_des_t* page_zip) /*!< in: compressed page */ { return(<API key> * page_zip_dir_elems(page_zip)); } /** Gets an offset to the compressed page trailer (the dense page directory), including deleted records (the free list). @return offset of the dense page directory */ UNIV_INLINE ulint <API key>( const page_zip_des_t* page_zip, /*!< in: compressed page */ ulint n_dense) /*!< in: directory size */ { ut_ad(n_dense * <API key> < page_zip_get_size(page_zip)); return(page_zip_get_size(page_zip) - n_dense * <API key>); } /** Gets a pointer to the compressed page trailer (the dense page directory), including deleted records (the free list). @param[in] page_zip compressed page @param[in] n_dense number of entries in the directory @return pointer to the dense page directory */ #define <API key>(page_zip, n_dense) \ ((page_zip)->data + <API key>(page_zip, n_dense)) /** Gets a pointer to the compressed page trailer (the dense page directory), including deleted records (the free list). @param[in] page_zip compressed page @return pointer to the dense page directory */ #define page_zip_dir_start(page_zip) \ <API key>(page_zip, page_zip_dir_elems(page_zip)) /** Gets the size of the compressed page trailer (the dense page directory), only including user records (excluding the free list). @return length of dense page directory comprising existing records, in bytes */ UNIV_INLINE ulint <API key>( const page_zip_des_t* page_zip) /*!< in: compressed page */ { ulint size = <API key> * page_get_n_recs(page_zip->data); ut_ad(size <= page_zip_dir_size(page_zip)); return(size); } /** Find the slot of the given record in the dense page directory. @return dense directory slot, or NULL if record not found */ UNIV_INLINE byte* <API key>( byte* slot, /*!< in: start of records */ byte* end, /*!< in: end of records */ ulint offset) /*!< in: offset of user record */ { ut_ad(slot <= end); for (; slot < end; slot += <API key>) { if ((mach_read_from_2(slot) & <API key>) == offset) { return(slot); } } return(NULL); } /** Find the slot of the given non-free record in the dense page directory. @return dense directory slot, or NULL if record not found */ UNIV_INLINE byte* page_zip_dir_find( page_zip_des_t* page_zip, /*!< in: compressed page */ ulint offset) /*!< in: offset of user record */ { byte* end = page_zip->data + page_zip_get_size(page_zip); ut_ad(<API key>(page_zip)); return(<API key>(end - <API key>(page_zip), end, offset)); } /** Find the slot of the given free record in the dense page directory. @return dense directory slot, or NULL if record not found */ UNIV_INLINE byte* <API key>( page_zip_des_t* page_zip, /*!< in: compressed page */ ulint offset) /*!< in: offset of user record */ { byte* end = page_zip->data + page_zip_get_size(page_zip); ut_ad(<API key>(page_zip)); return(<API key>(end - page_zip_dir_size(page_zip), end - <API key>(page_zip), offset)); } /** Read a given slot in the dense page directory. @return record offset on the uncompressed page, possibly ORed with <API key> or <API key> */ UNIV_INLINE ulint page_zip_dir_get( const page_zip_des_t* page_zip, /*!< in: compressed page */ ulint slot) /*!< in: slot (0=first user record) */ { ut_ad(<API key>(page_zip)); ut_ad(slot < page_zip_dir_size(page_zip) / <API key>); return(mach_read_from_2(page_zip->data + page_zip_get_size(page_zip) - <API key> * (slot + 1))); } #ifndef UNIV_HOTBACKUP /** Write a log record of compressing an index page. */ static void <API key>( const page_zip_des_t* page_zip,/*!< in: compressed page */ const page_t* page, /*!< in: uncompressed page */ dict_index_t* index, /*!< in: index of the B-tree node */ mtr_t* mtr) /*!< in: mini-transaction */ { byte* log_ptr; ulint trailer_size; ut_ad(!dict_index_is_ibuf(index)); log_ptr = mlog_open(mtr, 11 + 2 + 2); if (!log_ptr) { return; } /* Read the number of user records. */ trailer_size = page_dir_get_n_heap(page_zip->data) - <API key>; /* Multiply by uncompressed of size stored per record */ if (!page_is_leaf(page)) { trailer_size *= <API key> + REC_NODE_PTR_SIZE; } else if (dict_index_is_clust(index)) { trailer_size *= <API key> + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; } else { trailer_size *= <API key>; } /* Add the space occupied by BLOB pointers. */ trailer_size += page_zip->n_blobs * <API key>; ut_a(page_zip->m_end > PAGE_DATA); #if FIL_PAGE_DATA > PAGE_DATA # error "FIL_PAGE_DATA > PAGE_DATA" #endif ut_a(page_zip->m_end + trailer_size <= page_zip_get_size(page_zip)); log_ptr = <API key>((page_t*) page, <API key>, log_ptr, mtr); mach_write_to_2(log_ptr, page_zip->m_end - FIL_PAGE_TYPE); log_ptr += 2; mach_write_to_2(log_ptr, trailer_size); log_ptr += 2; mlog_close(mtr, log_ptr); /* Write FIL_PAGE_PREV and FIL_PAGE_NEXT */ <API key>(mtr, page_zip->data + FIL_PAGE_PREV, 4); <API key>(mtr, page_zip->data + FIL_PAGE_NEXT, 4); /* Write most of the page header, the compressed stream and the modification log. */ <API key>(mtr, page_zip->data + FIL_PAGE_TYPE, page_zip->m_end - FIL_PAGE_TYPE); /* Write the uncompressed trailer of the compressed page. */ <API key>(mtr, page_zip->data + page_zip_get_size(page_zip) - trailer_size, trailer_size); } #endif /* !UNIV_HOTBACKUP */ /** Determine how many externally stored columns are contained in existing records with smaller heap_no than rec. */ static ulint <API key>( const page_zip_des_t* page_zip,/*!< in: dense page directory on compressed page */ const rec_t* rec, /*!< in: compact physical record on a B-tree leaf page */ const dict_index_t* index) /*!< in: record descriptor */ { const page_t* page = page_align(rec); ulint n_ext = 0; ulint i; ulint left; ulint heap_no; ulint n_recs = page_get_n_recs(page_zip->data); ut_ad(page_is_leaf(page)); ut_ad(page_is_comp(page)); ut_ad(dict_table_is_comp(index->table)); ut_ad(dict_index_is_clust(index)); ut_ad(!dict_index_is_ibuf(index)); heap_no = rec_get_heap_no_new(rec); ut_ad(heap_no >= <API key>); left = heap_no - <API key>; if (UNIV_UNLIKELY(!left)) { return(0); } for (i = 0; i < n_recs; i++) { const rec_t* r = page + (page_zip_dir_get(page_zip, i) & <API key>); if (rec_get_heap_no_new(r) < heap_no) { n_ext += <API key>(r, index, ULINT_UNDEFINED); if (!--left) { break; } } } return(n_ext); } /** Encode the length of a fixed-length column. @return buf + length of encoded val */ static byte* <API key>( byte* buf, /*!< in: pointer to buffer where to write */ ulint val) /*!< in: value to write */ { ut_ad(val >= 2); if (UNIV_LIKELY(val < 126)) { /* 0 = nullable variable field of at most 255 bytes length; 1 = not null variable field of at most 255 bytes length; 126 = nullable variable field with maximum length >255; 127 = not null variable field with maximum length >255 */ *buf++ = (byte) val; } else { *buf++ = (byte) (0x80 | val >> 8); *buf++ = (byte) val; } return(buf); } /** Write the index information for the compressed page. @return used size of buf */ static ulint <API key>( ulint n, /*!< in: number of fields to compress */ dict_index_t* index, /*!< in: index comprising at least n fields */ ulint trx_id_pos,/*!< in: position of the trx_id column in the index, or ULINT_UNDEFINED if this is a non-leaf page */ byte* buf) /*!< out: buffer of (n + 1) * 2 bytes */ { const byte* buf_start = buf; ulint i; ulint col; ulint trx_id_col = 0; /* sum of lengths of preceding non-nullable fixed fields, or 0 */ ulint fixed_sum = 0; ut_ad(trx_id_pos == ULINT_UNDEFINED || trx_id_pos < n); for (i = col = 0; i < n; i++) { dict_field_t* field = <API key>(index, i); ulint val; if (dict_field_get_col(field)->prtype & DATA_NOT_NULL) { val = 1; /* set the "not nullable" flag */ } else { val = 0; /* nullable field */ } if (!field->fixed_len) { /* variable-length field */ const dict_col_t* column = dict_field_get_col(field); if (UNIV_UNLIKELY(column->len > 255) || UNIV_UNLIKELY(column->mtype == DATA_BLOB)) { val |= 0x7e; /* max > 255 bytes */ } if (fixed_sum) { /* write out the length of any preceding non-nullable fields */ buf = <API key>( buf, fixed_sum << 1 | 1); fixed_sum = 0; col++; } *buf++ = (byte) val; col++; } else if (val) { /* fixed-length non-nullable field */ if (fixed_sum && UNIV_UNLIKELY (fixed_sum + field->fixed_len > <API key>)) { /* Write out the length of the preceding non-nullable fields, to avoid exceeding the maximum length of a fixed-length column. */ buf = <API key>( buf, fixed_sum << 1 | 1); fixed_sum = 0; col++; } if (i && UNIV_UNLIKELY(i == trx_id_pos)) { if (fixed_sum) { /* Write out the length of any preceding non-nullable fields, and start a new trx_id column. */ buf = <API key>( buf, fixed_sum << 1 | 1); col++; } trx_id_col = col; fixed_sum = field->fixed_len; } else { /* add to the sum */ fixed_sum += field->fixed_len; } } else { /* fixed-length nullable field */ if (fixed_sum) { /* write out the length of any preceding non-nullable fields */ buf = <API key>( buf, fixed_sum << 1 | 1); fixed_sum = 0; col++; } buf = <API key>( buf, field->fixed_len << 1); col++; } } if (fixed_sum) { /* Write out the lengths of last fixed-length columns. */ buf = <API key>(buf, fixed_sum << 1 | 1); } if (trx_id_pos != ULINT_UNDEFINED) { /* Write out the position of the trx_id column */ i = trx_id_col; } else { /* Write out the number of nullable fields */ i = index->n_nullable; } if (i < 128) { *buf++ = (byte) i; } else { *buf++ = (byte) (0x80 | i >> 8); *buf++ = (byte) i; } ut_ad((ulint) (buf - buf_start) <= (n + 2) * 2); return((ulint) (buf - buf_start)); } /** Populate the dense page directory from the sparse directory. */ static void page_zip_dir_encode( const page_t* page, /*!< in: compact page */ byte* buf, /*!< in: pointer to dense page directory[-1]; out: dense directory on compressed page */ const rec_t** recs) /*!< in: pointer to an array of 0, or NULL; out: dense page directory sorted by ascending address (and heap_no) */ { const byte* rec; ulint status; ulint min_mark; ulint heap_no; ulint i; ulint n_heap; ulint offs; min_mark = 0; if (page_is_leaf(page)) { status = REC_STATUS_ORDINARY; } else { status = REC_STATUS_NODE_PTR; if (UNIV_UNLIKELY (mach_read_from_4(page + FIL_PAGE_PREV) == FIL_NULL)) { min_mark = <API key>; } } n_heap = page_dir_get_n_heap(page); /* Traverse the list of stored records in the collation order, starting from the first user record. */ rec = page + PAGE_NEW_INFIMUM; i = 0; for (;;) { ulint info_bits; offs = rec_get_next_offs(rec, TRUE); if (UNIV_UNLIKELY(offs == PAGE_NEW_SUPREMUM)) { break; } rec = page + offs; heap_no = rec_get_heap_no_new(rec); ut_a(heap_no >= <API key>); ut_a(heap_no < n_heap); ut_a(offs < UNIV_PAGE_SIZE - PAGE_DIR); ut_a(offs >= PAGE_ZIP_START); #if <API key> & (<API key> + 1) # error "<API key> is not 1 less than a power of 2" #endif #if <API key> < UNIV_PAGE_SIZE_MAX - 1 # error "<API key> < UNIV_PAGE_SIZE_MAX - 1" #endif if (UNIV_UNLIKELY(rec_get_n_owned_new(rec))) { offs |= <API key>; } info_bits = rec_get_info_bits(rec, TRUE); if (info_bits & <API key>) { info_bits &= ~<API key>; offs |= <API key>; } ut_a(info_bits == min_mark); /* Only the smallest user record can have <API key> set. */ min_mark = 0; mach_write_to_2(buf - <API key> * ++i, offs); if (UNIV_LIKELY_NULL(recs)) { /* Ensure that each heap_no occurs at most once. */ ut_a(!recs[heap_no - <API key>]); /* exclude infimum and supremum */ recs[heap_no - <API key>] = rec; } ut_a(rec_get_status(rec) == status); } offs = <API key>(page, PAGE_FREE); /* Traverse the free list (of deleted records). */ while (offs) { ut_ad(!(offs & ~<API key>)); rec = page + offs; heap_no = rec_get_heap_no_new(rec); ut_a(heap_no >= <API key>); ut_a(heap_no < n_heap); ut_a(!rec[-<API key>]); /* info_bits and n_owned */ ut_a(rec_get_status(rec) == status); mach_write_to_2(buf - <API key> * ++i, offs); if (UNIV_LIKELY_NULL(recs)) { /* Ensure that each heap_no occurs at most once. */ ut_a(!recs[heap_no - <API key>]); /* exclude infimum and supremum */ recs[heap_no - <API key>] = rec; } offs = rec_get_next_offs(rec, TRUE); } /* Ensure that each heap no occurs at least once. */ ut_a(i + <API key> == n_heap); } extern "C" { /** Allocate memory for zlib. */ static void* page_zip_zalloc( void* opaque, /*!< in/out: memory heap */ uInt items, /*!< in: number of items to allocate */ uInt size) /*!< in: size of an item in bytes */ { return(mem_heap_zalloc(static_cast<mem_heap_t*>(opaque), items * size)); } /** Deallocate memory for zlib. */ static void page_zip_free( void* opaque __attribute__((unused)), /*!< in: memory heap */ void* address __attribute__((unused)))/*!< in: object to free */ { } } /* extern "C" */ /** Configure the zlib allocator to use the given memory heap. */ UNIV_INTERN void page_zip_set_alloc( void* stream, /*!< in/out: zlib stream */ mem_heap_t* heap) /*!< in: memory heap to use */ { z_stream* strm = static_cast<z_stream*>(stream); strm->zalloc = page_zip_zalloc; strm->zfree = page_zip_free; strm->opaque = heap; } #if 0 || defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG /** Symbol for enabling compression and decompression diagnostics */ # define <API key> #endif #ifdef <API key> /** Set this variable in a debugger to enable excessive logging in page_zip_compress(). */ UNIV_INTERN ibool <API key>; /** Set this variable in a debugger to enable binary logging of the data passed to deflate(). When this variable is nonzero, it will act as a log file name generator. */ UNIV_INTERN unsigned <API key>; /** Wrapper for deflate(). Log the operation if <API key> is set. @return deflate() status: Z_OK, Z_BUF_ERROR, ... */ static int <API key>( FILE* logfile,/*!< in: log file, or NULL */ z_streamp strm, /*!< in/out: compressed stream for deflate() */ int flush) /*!< in: deflate() flushing method */ { int status; if (UNIV_UNLIKELY(<API key>)) { ut_print_buf(stderr, strm->next_in, strm->avail_in); } if (UNIV_LIKELY_NULL(logfile)) { blind_fwrite(strm->next_in, 1, strm->avail_in, logfile); } status = deflate(strm, flush); if (UNIV_UNLIKELY(<API key>)) { fprintf(stderr, " -> %d\n", status); } return(status); } /* Redefine deflate(). */ # undef deflate /** Debug wrapper for the zlib compression routine deflate(). Log the operation if <API key> is set. @param strm in/out: compressed stream @param flush in: flushing method @return deflate() status: Z_OK, Z_BUF_ERROR, ... */ # define deflate(strm, flush) <API key>(logfile, strm, flush) /** Declaration of the logfile parameter */ # define FILE_LOGFILE FILE* logfile, /** The logfile parameter */ # define LOGFILE logfile, #else /* <API key> */ /** Empty declaration of the logfile parameter */ # define FILE_LOGFILE /** Missing logfile parameter */ # define LOGFILE #endif /* <API key> */ /** Compress the records of a node pointer page. @return Z_OK, or a zlib error code */ static int <API key>( FILE_LOGFILE z_stream* c_stream, /*!< in/out: compressed page stream */ const rec_t** recs, /*!< in: dense page directory sorted by address */ ulint n_dense, /*!< in: size of recs[] */ dict_index_t* index, /*!< in: the index of the page */ byte* storage, /*!< in: end of dense page directory */ mem_heap_t* heap) /*!< in: temporary memory heap */ { int err = Z_OK; ulint* offsets = NULL; do { const rec_t* rec = *recs++; offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); /* Only leaf nodes may contain externally stored columns. */ ut_ad(!rec_offs_any_extern(offsets)); UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets)); UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets), rec_offs_extra_size(offsets)); /* Compress the extra bytes. */ c_stream->avail_in = static_cast<uInt>( rec - <API key> - c_stream->next_in); if (c_stream->avail_in) { err = deflate(c_stream, Z_NO_FLUSH); if (UNIV_UNLIKELY(err != Z_OK)) { break; } } ut_ad(!c_stream->avail_in); /* Compress the data bytes, except node_ptr. */ c_stream->next_in = (byte*) rec; c_stream->avail_in = static_cast<uInt>( rec_offs_data_size(offsets) - REC_NODE_PTR_SIZE); if (c_stream->avail_in) { err = deflate(c_stream, Z_NO_FLUSH); if (UNIV_UNLIKELY(err != Z_OK)) { break; } } ut_ad(!c_stream->avail_in); memcpy(storage - REC_NODE_PTR_SIZE * (rec_get_heap_no_new(rec) - 1), c_stream->next_in, REC_NODE_PTR_SIZE); c_stream->next_in += REC_NODE_PTR_SIZE; } while (--n_dense); return(err); } /** Compress the records of a leaf node of a secondary index. @return Z_OK, or a zlib error code */ static int <API key>( FILE_LOGFILE z_stream* c_stream, /*!< in/out: compressed page stream */ const rec_t** recs, /*!< in: dense page directory sorted by address */ ulint n_dense) /*!< in: size of recs[] */ { int err = Z_OK; ut_ad(n_dense > 0); do { const rec_t* rec = *recs++; /* Compress everything up to this record. */ c_stream->avail_in = static_cast<uInt>( rec - <API key> - c_stream->next_in); if (UNIV_LIKELY(c_stream->avail_in)) { UNIV_MEM_ASSERT_RW(c_stream->next_in, c_stream->avail_in); err = deflate(c_stream, Z_NO_FLUSH); if (UNIV_UNLIKELY(err != Z_OK)) { break; } } ut_ad(!c_stream->avail_in); ut_ad(c_stream->next_in == rec - <API key>); /* Skip the <API key>. */ c_stream->next_in = (byte*) rec; } while (--n_dense); return(err); } /** Compress a record of a leaf node of a clustered index that contains externally stored columns. @return Z_OK, or a zlib error code */ static int <API key>( FILE_LOGFILE z_stream* c_stream, /*!< in/out: compressed page stream */ const rec_t* rec, /*!< in: record */ const ulint* offsets, /*!< in: rec_get_offsets(rec) */ ulint trx_id_col, /*!< in: position of of DB_TRX_ID */ byte* deleted, /*!< in: dense directory entry pointing to the head of the free list */ byte* storage, /*!< in: end of dense page directory */ byte** externs, /*!< in/out: pointer to the next available BLOB pointer */ ulint* n_blobs) /*!< in/out: number of externally stored columns */ { int err; ulint i; UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets)); UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets), rec_offs_extra_size(offsets)); for (i = 0; i < rec_offs_n_fields(offsets); i++) { ulint len; const byte* src; if (UNIV_UNLIKELY(i == trx_id_col)) { ut_ad(!rec_offs_nth_extern(offsets, i)); /* Store trx_id and roll_ptr in uncompressed form. */ src = rec_get_nth_field(rec, offsets, i, &len); ut_ad(src + DATA_TRX_ID_LEN == rec_get_nth_field(rec, offsets, i + 1, &len)); ut_ad(len == DATA_ROLL_PTR_LEN); /* Compress any preceding bytes. */ c_stream->avail_in = static_cast<uInt>( src - c_stream->next_in); if (c_stream->avail_in) { err = deflate(c_stream, Z_NO_FLUSH); if (UNIV_UNLIKELY(err != Z_OK)) { return(err); } } ut_ad(!c_stream->avail_in); ut_ad(c_stream->next_in == src); memcpy(storage - (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN) * (rec_get_heap_no_new(rec) - 1), c_stream->next_in, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); c_stream->next_in += DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; /* Skip also roll_ptr */ i++; } else if (rec_offs_nth_extern(offsets, i)) { src = rec_get_nth_field(rec, offsets, i, &len); ut_ad(len >= <API key>); src += len - <API key>; c_stream->avail_in = static_cast<uInt>( src - c_stream->next_in); if (UNIV_LIKELY(c_stream->avail_in)) { err = deflate(c_stream, Z_NO_FLUSH); if (UNIV_UNLIKELY(err != Z_OK)) { return(err); } } ut_ad(!c_stream->avail_in); ut_ad(c_stream->next_in == src); /* Reserve space for the data at the end of the space reserved for the compressed data and the page modification log. */ if (UNIV_UNLIKELY (c_stream->avail_out <= <API key>)) { /* out of space */ return(Z_BUF_ERROR); } ut_ad(*externs == c_stream->next_out + c_stream->avail_out + 1/* end of modif. log */); c_stream->next_in += <API key>; /* Skip deleted records. */ if (UNIV_LIKELY_NULL (<API key>( storage, deleted, page_offset(rec)))) { continue; } (*n_blobs)++; c_stream->avail_out -= <API key>; *externs -= <API key>; /* Copy the BLOB pointer */ memcpy(*externs, c_stream->next_in - <API key>, <API key>); } } return(Z_OK); } /** Compress the records of a leaf node of a clustered index. @return Z_OK, or a zlib error code */ static int <API key>( FILE_LOGFILE z_stream* c_stream, /*!< in/out: compressed page stream */ const rec_t** recs, /*!< in: dense page directory sorted by address */ ulint n_dense, /*!< in: size of recs[] */ dict_index_t* index, /*!< in: the index of the page */ ulint* n_blobs, /*!< in: 0; out: number of externally stored columns */ ulint trx_id_col, /*!< index of the trx_id column */ byte* deleted, /*!< in: dense directory entry pointing to the head of the free list */ byte* storage, /*!< in: end of dense page directory */ mem_heap_t* heap) /*!< in: temporary memory heap */ { int err = Z_OK; ulint* offsets = NULL; /* <API key> storage */ byte* externs = storage - n_dense * (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); ut_ad(*n_blobs == 0); do { const rec_t* rec = *recs++; offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); ut_ad(rec_offs_n_fields(offsets) == <API key>(index)); UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets)); UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets), rec_offs_extra_size(offsets)); /* Compress the extra bytes. */ c_stream->avail_in = static_cast<uInt>( rec - <API key> - c_stream->next_in); if (c_stream->avail_in) { err = deflate(c_stream, Z_NO_FLUSH); if (UNIV_UNLIKELY(err != Z_OK)) { goto func_exit; } } ut_ad(!c_stream->avail_in); ut_ad(c_stream->next_in == rec - <API key>); /* Compress the data bytes. */ c_stream->next_in = (byte*) rec; /* Check if there are any externally stored columns. For each externally stored column, store the <API key> separately. */ if (rec_offs_any_extern(offsets)) { ut_ad(dict_index_is_clust(index)); err = <API key>( LOGFILE c_stream, rec, offsets, trx_id_col, deleted, storage, &externs, n_blobs); if (UNIV_UNLIKELY(err != Z_OK)) { goto func_exit; } } else { ulint len; const byte* src; /* Store trx_id and roll_ptr in uncompressed form. */ src = rec_get_nth_field(rec, offsets, trx_id_col, &len); ut_ad(src + DATA_TRX_ID_LEN == rec_get_nth_field(rec, offsets, trx_id_col + 1, &len)); ut_ad(len == DATA_ROLL_PTR_LEN); UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets)); UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets), rec_offs_extra_size(offsets)); /* Compress any preceding bytes. */ c_stream->avail_in = static_cast<uInt>( src - c_stream->next_in); if (c_stream->avail_in) { err = deflate(c_stream, Z_NO_FLUSH); if (UNIV_UNLIKELY(err != Z_OK)) { return(err); } } ut_ad(!c_stream->avail_in); ut_ad(c_stream->next_in == src); memcpy(storage - (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN) * (rec_get_heap_no_new(rec) - 1), c_stream->next_in, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); c_stream->next_in += DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; /* Skip also roll_ptr */ ut_ad(trx_id_col + 1 < rec_offs_n_fields(offsets)); } /* Compress the last bytes of the record. */ c_stream->avail_in = static_cast<uInt>( rec + rec_offs_data_size(offsets) - c_stream->next_in); if (c_stream->avail_in) { err = deflate(c_stream, Z_NO_FLUSH); if (UNIV_UNLIKELY(err != Z_OK)) { goto func_exit; } } ut_ad(!c_stream->avail_in); } while (--n_dense); func_exit: return(err); } my_bool page_zip_zlib_wrap = FALSE; uint <API key> = Z_DEFAULT_STRATEGY; /** Compress a page. @return TRUE on success, FALSE on failure; page_zip will be left intact on failure. */ UNIV_INTERN ibool page_zip_compress( page_zip_des_t* page_zip,/*!< in: size; out: data, n_blobs, m_start, m_end, m_nonempty */ const page_t* page, /*!< in: uncompressed page */ dict_index_t* index, /*!< in: index of the B-tree node */ uchar compression_flags, /*!< in: compression level and other options */ mtr_t* mtr) /*!< in: mini-transaction, or NULL */ { z_stream c_stream; int err; ulint n_fields;/* number of index fields needed */ byte* fields; /*!< index field information */ byte* buf; /*!< compressed payload of the page */ byte* buf_end;/* end of buf */ ulint n_dense; ulint slot_size;/* amount of uncompressed bytes per record */ const rec_t** recs; /*!< dense page directory, sorted by address */ mem_heap_t* heap; ulint trx_id_col; ulint n_blobs = 0; byte* storage;/* storage of uncompressed columns */ #ifndef UNIV_HOTBACKUP ullint usec = ut_time_us(NULL); uint level; uint wrap; uint strategy; int window_bits; <API key>(compression_flags, &level, &wrap, &strategy); window_bits = wrap ? <API key> : - ((int) <API key>); #endif /* !UNIV_HOTBACKUP */ #ifdef <API key> FILE* logfile = NULL; #endif /* A local copy of <API key> to avoid reading that variable multiple times in this function since it can be changed at anytime. */ my_bool <API key> = <API key>; ut_a(page_is_comp(page)); ut_a(fil_page_get_type(page) == FIL_PAGE_INDEX); ut_ad(<API key>((page_t*) page)); ut_ad(<API key>(page_zip)); ut_ad(dict_table_is_comp(index->table)); ut_ad(!dict_index_is_ibuf(index)); UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE); /* Check the data that will be omitted. */ ut_a(!memcmp(page + (PAGE_NEW_INFIMUM - <API key>), infimum_extra, sizeof infimum_extra)); ut_a(!memcmp(page + PAGE_NEW_INFIMUM, infimum_data, sizeof infimum_data)); ut_a(page[PAGE_NEW_SUPREMUM - <API key>] /* info_bits == 0, n_owned <= max */ <= <API key>); ut_a(!memcmp(page + (PAGE_NEW_SUPREMUM - <API key> + 1), supremum_extra_data, sizeof supremum_extra_data)); if (page_is_empty(page)) { ut_a(rec_get_next_offs(page + PAGE_NEW_INFIMUM, TRUE) == PAGE_NEW_SUPREMUM); } if (page_is_leaf(page)) { n_fields = <API key>(index); } else { n_fields = <API key>(index); } /* The dense directory excludes the infimum and supremum records. */ n_dense = page_dir_get_n_heap(page) - <API key>; #ifdef <API key> if (UNIV_UNLIKELY(<API key>)) { fprintf(stderr, "compress %p %p %lu %lu %lu\n", (void*) page_zip, (void*) page, (ibool) page_is_leaf(page), n_fields, n_dense); } if (UNIV_UNLIKELY(<API key>)) { /* Create a log file for every compression attempt. */ char logfilename[9]; ut_snprintf(logfilename, sizeof logfilename, "%08x", <API key>++); logfile = fopen(logfilename, "wb"); if (logfile) { /* Write the uncompressed page to the log. */ blind_fwrite(page, 1, UNIV_PAGE_SIZE, logfile); /* Record the compressed size as zero. This will be overwritten at successful exit. */ putc(0, logfile); putc(0, logfile); putc(0, logfile); putc(0, logfile); } } #endif /* <API key> */ #ifndef UNIV_HOTBACKUP page_zip_stat[page_zip->ssize - 1].compressed++; if (<API key>) { mutex_enter(&<API key>); <API key>[index->id].compressed++; mutex_exit(&<API key>); } #endif /* !UNIV_HOTBACKUP */ if (UNIV_UNLIKELY(n_dense * <API key> >= page_zip_get_size(page_zip))) { goto err_exit; } MONITOR_INC(<API key>); heap = mem_heap_create(page_zip_get_size(page_zip) + n_fields * (2 + sizeof(ulint)) + <API key> + n_dense * ((sizeof *recs) - <API key>) + UNIV_PAGE_SIZE * 4 + (512 << MAX_MEM_LEVEL)); recs = static_cast<const rec_t**>( mem_heap_zalloc(heap, n_dense * sizeof *recs)); fields = static_cast<byte*>(mem_heap_alloc(heap, (n_fields + 1) * 2)); buf = static_cast<byte*>( mem_heap_alloc(heap, page_zip_get_size(page_zip) - PAGE_DATA)); buf_end = buf + page_zip_get_size(page_zip) - PAGE_DATA; /* Compress the data payload. */ page_zip_set_alloc(&c_stream, heap); err = deflateInit2(&c_stream, static_cast<int>(level), Z_DEFLATED, window_bits, MAX_MEM_LEVEL, strategy); ut_a(err == Z_OK); c_stream.next_out = buf; /* Subtract the space reserved for uncompressed data. */ /* Page header and the end marker of the modification log */ c_stream.avail_out = static_cast<uInt>(buf_end - buf - 1); /* Dense page directory and uncompressed columns, if any */ if (page_is_leaf(page)) { if (dict_index_is_clust(index)) { trx_id_col = <API key>( index, DATA_TRX_ID); ut_ad(trx_id_col > 0); ut_ad(trx_id_col != ULINT_UNDEFINED); slot_size = <API key> + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; } else { /* Signal the absence of trx_id in <API key>() */ ut_ad(<API key>(index, DATA_TRX_ID) == ULINT_UNDEFINED); trx_id_col = 0; slot_size = <API key>; } } else { slot_size = <API key> + REC_NODE_PTR_SIZE; trx_id_col = ULINT_UNDEFINED; } if (UNIV_UNLIKELY(c_stream.avail_out <= n_dense * slot_size + 6/* sizeof(zlib header and footer) */)) { goto zlib_error; } c_stream.avail_out -= static_cast<uInt>(n_dense * slot_size); c_stream.avail_in = static_cast<uInt>( <API key>(n_fields, index, trx_id_col, fields)); c_stream.next_in = fields; if (UNIV_LIKELY(!trx_id_col)) { trx_id_col = ULINT_UNDEFINED; } UNIV_MEM_ASSERT_RW(c_stream.next_in, c_stream.avail_in); err = deflate(&c_stream, Z_FULL_FLUSH); if (err != Z_OK) { goto zlib_error; } ut_ad(!c_stream.avail_in); page_zip_dir_encode(page, buf_end, recs); c_stream.next_in = (byte*) page + PAGE_ZIP_START; storage = buf_end - n_dense * <API key>; /* Compress the records in heap_no order. */ if (UNIV_UNLIKELY(!n_dense)) { } else if (!page_is_leaf(page)) { /* This is a node pointer page. */ err = <API key>(LOGFILE &c_stream, recs, n_dense, index, storage, heap); if (UNIV_UNLIKELY(err != Z_OK)) { goto zlib_error; } } else if (UNIV_LIKELY(trx_id_col == ULINT_UNDEFINED)) { /* This is a leaf page in a secondary index. */ err = <API key>(LOGFILE &c_stream, recs, n_dense); if (UNIV_UNLIKELY(err != Z_OK)) { goto zlib_error; } } else { /* This is a leaf page in a clustered index. */ err = <API key>(LOGFILE &c_stream, recs, n_dense, index, &n_blobs, trx_id_col, buf_end - <API key> * page_get_n_recs(page), storage, heap); if (UNIV_UNLIKELY(err != Z_OK)) { goto zlib_error; } } /* Finish the compression. */ ut_ad(!c_stream.avail_in); /* Compress any trailing garbage, in case the last record was allocated from an originally longer space on the free list, or the data of the last record from <API key>(). */ c_stream.avail_in = static_cast<uInt>( <API key>(page, PAGE_HEAP_TOP) - (c_stream.next_in - page)); ut_a(c_stream.avail_in <= UNIV_PAGE_SIZE - PAGE_ZIP_START - PAGE_DIR); UNIV_MEM_ASSERT_RW(c_stream.next_in, c_stream.avail_in); err = deflate(&c_stream, Z_FINISH); if (UNIV_UNLIKELY(err != Z_STREAM_END)) { zlib_error: deflateEnd(&c_stream); mem_heap_free(heap); err_exit: #ifdef <API key> if (logfile) { fclose(logfile); } #endif /* <API key> */ #ifndef UNIV_HOTBACKUP if (page_is_leaf(page)) { <API key>(index); } ullint time_diff = ut_time_us(NULL) - usec; page_zip_stat[page_zip->ssize - 1].compressed_usec += time_diff; if (<API key>) { mutex_enter(&<API key>); <API key>[index->id].compressed_usec += time_diff; mutex_exit(&<API key>); } #endif /* !UNIV_HOTBACKUP */ return(FALSE); } err = deflateEnd(&c_stream); ut_a(err == Z_OK); ut_ad(buf + c_stream.total_out == c_stream.next_out); ut_ad((ulint) (storage - c_stream.next_out) >= c_stream.avail_out); /* Valgrind believes that zlib does not initialize some bits in the last 7 or 8 bytes of the stream. Make Valgrind happy. */ UNIV_MEM_VALID(buf, c_stream.total_out); /* Zero out the area reserved for the modification log. Space for the end marker of the modification log is not included in avail_out. */ memset(c_stream.next_out, 0, c_stream.avail_out + 1/* end marker */); #ifdef UNIV_DEBUG page_zip->m_start = #endif /* UNIV_DEBUG */ page_zip->m_end = PAGE_DATA + c_stream.total_out; page_zip->m_nonempty = FALSE; page_zip->n_blobs = n_blobs; /* Copy those header fields that will not be written in <API key>() */ memcpy(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV, FIL_PAGE_LSN - FIL_PAGE_PREV); memcpy(page_zip->data + FIL_PAGE_TYPE, page + FIL_PAGE_TYPE, 2); memcpy(page_zip->data + FIL_PAGE_DATA, page + FIL_PAGE_DATA, PAGE_DATA - FIL_PAGE_DATA); /* Copy the rest of the compressed page */ memcpy(page_zip->data + PAGE_DATA, buf, page_zip_get_size(page_zip) - PAGE_DATA); mem_heap_free(heap); #ifdef UNIV_ZIP_DEBUG ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ if (mtr) { #ifndef UNIV_HOTBACKUP <API key>(page_zip, page, index, mtr); #endif /* !UNIV_HOTBACKUP */ } UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); #ifdef <API key> if (logfile) { /* Record the compressed size of the block. */ byte sz[4]; mach_write_to_4(sz, c_stream.total_out); fseek(logfile, UNIV_PAGE_SIZE, SEEK_SET); blind_fwrite(sz, 1, sizeof sz, logfile); fclose(logfile); } #endif /* <API key> */ #ifndef UNIV_HOTBACKUP ullint time_diff = ut_time_us(NULL) - usec; page_zip_stat[page_zip->ssize - 1].compressed_ok++; page_zip_stat[page_zip->ssize - 1].compressed_usec += time_diff; if (<API key>) { mutex_enter(&<API key>); <API key>[index->id].compressed_ok++; <API key>[index->id].compressed_usec += time_diff; mutex_exit(&<API key>); } if (page_is_leaf(page)) { <API key>(index); } #endif /* !UNIV_HOTBACKUP */ return(TRUE); } /** Compare two page directory entries. @return positive if rec1 > rec2 */ UNIV_INLINE ibool page_zip_dir_cmp( const rec_t* rec1, /*!< in: rec1 */ const rec_t* rec2) /*!< in: rec2 */ { return(rec1 > rec2); } /** Sort the dense page directory by address (heap_no). */ static void page_zip_dir_sort( rec_t** arr, /*!< in/out: dense page directory */ rec_t** aux_arr,/*!< in/out: work area */ ulint low, /*!< in: lower bound of the sorting area, inclusive */ ulint high) /*!< in: upper bound of the sorting area, exclusive */ { <API key>(page_zip_dir_sort, arr, aux_arr, low, high, page_zip_dir_cmp); } /** Deallocate the index information initialized by <API key>(). */ static void <API key>( dict_index_t* index) /*!< in: dummy index to be freed */ { if (index) { dict_table_t* table = index->table; os_fast_mutex_free(&index->zip_pad.mutex); mem_heap_free(index->heap); dict_mem_table_free(table); } } /** Read the index information for the compressed page. @return own: dummy index describing the page, or NULL on error */ static dict_index_t* <API key>( const byte* buf, /*!< in: index information */ const byte* end, /*!< in: end of buf */ ulint* trx_id_col)/*!< in: NULL for non-leaf pages; for leaf pages, pointer to where to store the position of the trx_id column */ { const byte* b; ulint n; ulint i; ulint val; dict_table_t* table; dict_index_t* index; /* Determine the number of fields. */ for (b = buf, n = 0; b < end; n++) { if (*b++ & 0x80) { b++; /* skip the second byte */ } } n--; /* n_nullable or trx_id */ if (UNIV_UNLIKELY(n > REC_MAX_N_FIELDS)) { page_zip_fail(("<API key>: n = %lu\n", (ulong) n)); return(NULL); } if (UNIV_UNLIKELY(b > end)) { page_zip_fail(("<API key>: %p > %p\n", (const void*) b, (const void*) end)); return(NULL); } table = <API key>("ZIP_DUMMY", DICT_HDR_SPACE, n, DICT_TF_COMPACT, 0); index = <API key>("ZIP_DUMMY", "ZIP_DUMMY", DICT_HDR_SPACE, 0, n); index->table = table; index->n_uniq = n; /* avoid ut_ad(index->cached) in <API key> */ index->cached = TRUE; /* Initialize the fields. */ for (b = buf, i = 0; i < n; i++) { ulint mtype; ulint len; val = *b++; if (UNIV_UNLIKELY(val & 0x80)) { /* fixed length > 62 bytes */ val = (val & 0x7f) << 8 | *b++; len = val >> 1; mtype = DATA_FIXBINARY; } else if (UNIV_UNLIKELY(val >= 126)) { /* variable length with max > 255 bytes */ len = 0x7fff; mtype = DATA_BINARY; } else if (val <= 1) { /* variable length with max <= 255 bytes */ len = 0; mtype = DATA_BINARY; } else { /* fixed length < 62 bytes */ len = val >> 1; mtype = DATA_FIXBINARY; } <API key>(table, NULL, NULL, mtype, val & 1 ? DATA_NOT_NULL : 0, len); dict_index_add_col(index, table, <API key>(table, i), 0); } val = *b++; if (UNIV_UNLIKELY(val & 0x80)) { val = (val & 0x7f) << 8 | *b++; } /* Decode the position of the trx_id column. */ if (trx_id_col) { if (!val) { val = ULINT_UNDEFINED; } else if (UNIV_UNLIKELY(val >= n)) { <API key>(index); index = NULL; } else { index->type = DICT_CLUSTERED; } *trx_id_col = val; } else { /* Decode the number of nullable fields. */ if (UNIV_UNLIKELY(index->n_nullable > val)) { <API key>(index); index = NULL; } else { index->n_nullable = val; } } ut_ad(b == end); return(index); } /** Populate the sparse page directory from the dense directory. @return TRUE on success, FALSE on failure */ static ibool page_zip_dir_decode( const page_zip_des_t* page_zip,/*!< in: dense page directory on compressed page */ page_t* page, /*!< in: compact page with valid header; out: trailer and sparse page directory filled in */ rec_t** recs, /*!< out: dense page directory sorted by ascending address (and heap_no) */ rec_t** recs_aux,/*!< in/out: scratch area */ ulint n_dense)/*!< in: number of user records, and size of recs[] and recs_aux[] */ { ulint i; ulint n_recs; byte* slot; n_recs = page_get_n_recs(page); if (UNIV_UNLIKELY(n_recs > n_dense)) { page_zip_fail(("page_zip_dir_decode 1: %lu > %lu\n", (ulong) n_recs, (ulong) n_dense)); return(FALSE); } /* Traverse the list of stored records in the sorting order, starting from the first user record. */ slot = page + (UNIV_PAGE_SIZE - PAGE_DIR - PAGE_DIR_SLOT_SIZE); UNIV_PREFETCH_RW(slot); /* Zero out the page trailer. */ memset(slot + PAGE_DIR_SLOT_SIZE, 0, PAGE_DIR); mach_write_to_2(slot, PAGE_NEW_INFIMUM); slot -= PAGE_DIR_SLOT_SIZE; UNIV_PREFETCH_RW(slot); /* Initialize the sparse directory and copy the dense directory. */ for (i = 0; i < n_recs; i++) { ulint offs = page_zip_dir_get(page_zip, i); if (offs & <API key>) { mach_write_to_2(slot, offs & <API key>); slot -= PAGE_DIR_SLOT_SIZE; UNIV_PREFETCH_RW(slot); } if (UNIV_UNLIKELY((offs & <API key>) < PAGE_ZIP_START + <API key>)) { page_zip_fail(("page_zip_dir_decode 2: %u %u %lx\n", (unsigned) i, (unsigned) n_recs, (ulong) offs)); return(FALSE); } recs[i] = page + (offs & <API key>); } mach_write_to_2(slot, PAGE_NEW_SUPREMUM); { const page_dir_slot_t* last_slot = <API key>( page, <API key>(page) - 1); if (UNIV_UNLIKELY(slot != last_slot)) { page_zip_fail(("page_zip_dir_decode 3: %p != %p\n", (const void*) slot, (const void*) last_slot)); return(FALSE); } } /* Copy the rest of the dense directory. */ for (; i < n_dense; i++) { ulint offs = page_zip_dir_get(page_zip, i); if (UNIV_UNLIKELY(offs & ~<API key>)) { page_zip_fail(("page_zip_dir_decode 4: %u %u %lx\n", (unsigned) i, (unsigned) n_dense, (ulong) offs)); return(FALSE); } recs[i] = page + offs; } if (UNIV_LIKELY(n_dense > 1)) { page_zip_dir_sort(recs, recs_aux, 0, n_dense); } return(TRUE); } /** Initialize the <API key> of each record. @return TRUE on success, FALSE on failure */ static ibool <API key>( const page_zip_des_t* page_zip,/*!< in: compressed page */ page_t* page, /*!< in/out: uncompressed page */ ulint info_bits)/*!< in: <API key> or 0 */ { ulint n; ulint i; ulint n_owned = 1; ulint offs; rec_t* rec; n = page_get_n_recs(page); rec = page + PAGE_NEW_INFIMUM; for (i = 0; i < n; i++) { offs = page_zip_dir_get(page_zip, i); if (offs & <API key>) { info_bits |= <API key>; } if (UNIV_UNLIKELY(offs & <API key>)) { info_bits |= n_owned; n_owned = 1; } else { n_owned++; } offs &= <API key>; if (UNIV_UNLIKELY(offs < PAGE_ZIP_START + <API key>)) { page_zip_fail(("<API key> 1:" " %u %u %lx\n", (unsigned) i, (unsigned) n, (ulong) offs)); return(FALSE); } <API key>(rec, offs); rec = page + offs; rec[-<API key>] = (byte) info_bits; info_bits = 0; } /* Set the next pointer of the last user record. */ <API key>(rec, PAGE_NEW_SUPREMUM); /* Set n_owned of the supremum record. */ page[PAGE_NEW_SUPREMUM - <API key>] = (byte) n_owned; /* The dense directory excludes the infimum and supremum records. */ n = page_dir_get_n_heap(page) - <API key>; if (i >= n) { if (UNIV_LIKELY(i == n)) { return(TRUE); } page_zip_fail(("<API key> 2: %u != %u\n", (unsigned) i, (unsigned) n)); return(FALSE); } offs = page_zip_dir_get(page_zip, i); /* Set the extra bytes of deleted records on the free list. */ for (;;) { if (UNIV_UNLIKELY(!offs) || UNIV_UNLIKELY(offs & ~<API key>)) { page_zip_fail(("<API key> 3: %lx\n", (ulong) offs)); return(FALSE); } rec = page + offs; rec[-<API key>] = 0; /* info_bits and n_owned */ if (++i == n) { break; } offs = page_zip_dir_get(page_zip, i); <API key>(rec, offs); } /* Terminate the free list. */ rec[-<API key>] = 0; /* info_bits and n_owned */ <API key>(rec, 0); return(TRUE); } /** Apply the modification log to a record containing externally stored columns. Do not copy the fields that are stored separately. @return pointer to modification log, or NULL on failure */ static const byte* <API key>( rec_t* rec, /*!< in/out: record */ const ulint* offsets, /*!< in: rec_get_offsets(rec) */ ulint trx_id_col, /*!< in: position of of DB_TRX_ID */ const byte* data, /*!< in: modification log */ const byte* end) /*!< in: end of modification log */ { ulint i; ulint len; byte* next_out = rec; /* Check if there are any externally stored columns. For each externally stored column, skip the <API key>. */ for (i = 0; i < rec_offs_n_fields(offsets); i++) { byte* dst; if (UNIV_UNLIKELY(i == trx_id_col)) { /* Skip trx_id and roll_ptr */ dst = rec_get_nth_field(rec, offsets, i, &len); if (UNIV_UNLIKELY(dst - next_out >= end - data) || UNIV_UNLIKELY (len < (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN)) || rec_offs_nth_extern(offsets, i)) { page_zip_fail(("<API key>:" " trx_id len %lu," " %p - %p >= %p - %p\n", (ulong) len, (const void*) dst, (const void*) next_out, (const void*) end, (const void*) data)); return(NULL); } memcpy(next_out, data, dst - next_out); data += dst - next_out; next_out = dst + (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); } else if (rec_offs_nth_extern(offsets, i)) { dst = rec_get_nth_field(rec, offsets, i, &len); ut_ad(len >= <API key>); len += dst - next_out - <API key>; if (UNIV_UNLIKELY(data + len >= end)) { page_zip_fail(("<API key>: " "ext %p+%lu >= %p\n", (const void*) data, (ulong) len, (const void*) end)); return(NULL); } memcpy(next_out, data, len); data += len; next_out += len + <API key>; } } /* Copy the last bytes of the record. */ len = rec_get_end(rec, offsets) - next_out; if (UNIV_UNLIKELY(data + len >= end)) { page_zip_fail(("<API key>: " "last %p+%lu >= %p\n", (const void*) data, (ulong) len, (const void*) end)); return(NULL); } memcpy(next_out, data, len); data += len; return(data); } /** Apply the modification log to an uncompressed page. Do not copy the fields that are stored separately. @return pointer to end of modification log, or NULL on failure */ static const byte* page_zip_apply_log( const byte* data, /*!< in: modification log */ ulint size, /*!< in: maximum length of the log, in bytes */ rec_t** recs, /*!< in: dense page directory, sorted by address (indexed by heap_no - <API key>) */ ulint n_dense,/*!< in: size of recs[] */ ulint trx_id_col,/*!< in: column number of trx_id in the index, or ULINT_UNDEFINED if none */ ulint heap_status, /*!< in: heap_no and status bits for the next record to uncompress */ dict_index_t* index, /*!< in: index of the page */ ulint* offsets)/*!< in/out: work area for <API key>() */ { const byte* const end = data + size; for (;;) { ulint val; rec_t* rec; ulint len; ulint hs; val = *data++; if (UNIV_UNLIKELY(!val)) { return(data - 1); } if (val & 0x80) { val = (val & 0x7f) << 8 | *data++; if (UNIV_UNLIKELY(!val)) { page_zip_fail(("page_zip_apply_log:" " invalid val %x%x\n", data[-2], data[-1])); return(NULL); } } if (UNIV_UNLIKELY(data >= end)) { page_zip_fail(("page_zip_apply_log: %p >= %p\n", (const void*) data, (const void*) end)); return(NULL); } if (UNIV_UNLIKELY((val >> 1) > n_dense)) { page_zip_fail(("page_zip_apply_log: %lu>>1 > %lu\n", (ulong) val, (ulong) n_dense)); return(NULL); } /* Determine the heap number and status bits of the record. */ rec = recs[(val >> 1) - 1]; hs = ((val >> 1) + 1) << REC_HEAP_NO_SHIFT; hs |= heap_status & ((1 << REC_HEAP_NO_SHIFT) - 1); /* This may either be an old record that is being overwritten (updated in place, or allocated from the free list), or a new record, with the next available_heap_no. */ if (UNIV_UNLIKELY(hs > heap_status)) { page_zip_fail(("page_zip_apply_log: %lu > %lu\n", (ulong) hs, (ulong) heap_status)); return(NULL); } else if (hs == heap_status) { /* A new record was allocated from the heap. */ if (UNIV_UNLIKELY(val & 1)) { /* Only existing records may be cleared. */ page_zip_fail(("page_zip_apply_log:" " attempting to create" " deleted rec %lu\n", (ulong) hs)); return(NULL); } heap_status += 1 << REC_HEAP_NO_SHIFT; } mach_write_to_2(rec - REC_NEW_HEAP_NO, hs); if (val & 1) { /* Clear the data bytes of the record. */ mem_heap_t* heap = NULL; ulint* offs; offs = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); memset(rec, 0, rec_offs_data_size(offs)); if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); } continue; } #if REC_STATUS_NODE_PTR != TRUE # error "REC_STATUS_NODE_PTR != TRUE" #endif <API key>(data, index, hs & REC_STATUS_NODE_PTR, offsets); rec_offs_make_valid(rec, index, offsets); /* Copy the extra bytes (backwards). */ { byte* start = rec_get_start(rec, offsets); byte* b = rec - <API key>; while (b != start) { *--b = *data++; } } /* Copy the data bytes. */ if (UNIV_UNLIKELY(rec_offs_any_extern(offsets))) { /* Non-leaf nodes should not contain any externally stored columns. */ if (UNIV_UNLIKELY(hs & REC_STATUS_NODE_PTR)) { page_zip_fail(("page_zip_apply_log: " "%lu&REC_STATUS_NODE_PTR\n", (ulong) hs)); return(NULL); } data = <API key>( rec, offsets, trx_id_col, data, end); if (UNIV_UNLIKELY(!data)) { return(NULL); } } else if (UNIV_UNLIKELY(hs & REC_STATUS_NODE_PTR)) { len = rec_offs_data_size(offsets) - REC_NODE_PTR_SIZE; /* Copy the data bytes, except node_ptr. */ if (UNIV_UNLIKELY(data + len >= end)) { page_zip_fail(("page_zip_apply_log: " "node_ptr %p+%lu >= %p\n", (const void*) data, (ulong) len, (const void*) end)); return(NULL); } memcpy(rec, data, len); data += len; } else if (UNIV_LIKELY(trx_id_col == ULINT_UNDEFINED)) { len = rec_offs_data_size(offsets); /* Copy all data bytes of a record in a secondary index. */ if (UNIV_UNLIKELY(data + len >= end)) { page_zip_fail(("page_zip_apply_log: " "sec %p+%lu >= %p\n", (const void*) data, (ulong) len, (const void*) end)); return(NULL); } memcpy(rec, data, len); data += len; } else { /* Skip DB_TRX_ID and DB_ROLL_PTR. */ ulint l = <API key>(offsets, trx_id_col, &len); byte* b; if (UNIV_UNLIKELY(data + l >= end) || UNIV_UNLIKELY(len < (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN))) { page_zip_fail(("page_zip_apply_log: " "trx_id %p+%lu >= %p\n", (const void*) data, (ulong) l, (const void*) end)); return(NULL); } /* Copy any preceding data bytes. */ memcpy(rec, data, l); data += l; /* Copy any bytes following DB_TRX_ID, DB_ROLL_PTR. */ b = rec + l + (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); len = rec_get_end(rec, offsets) - b; if (UNIV_UNLIKELY(data + len >= end)) { page_zip_fail(("page_zip_apply_log: " "clust %p+%lu >= %p\n", (const void*) data, (ulong) len, (const void*) end)); return(NULL); } memcpy(b, data, len); data += len; } } } /** Set the heap_no in a record, and skip the fixed-size record header that is not included in the d_stream. @return TRUE on success, FALSE if d_stream does not end at rec */ static ibool <API key>( z_stream* d_stream, /*!< in/out: compressed page stream */ rec_t* rec, /*!< in/out: record */ ulint& heap_status) /*!< in/out: heap_no and status bits */ { if (d_stream->next_out != rec - <API key>) { /* n_dense has grown since the page was last compressed. */ return(FALSE); } /* Skip the <API key>. */ d_stream->next_out = rec; /* Set heap_no and the status bits. */ mach_write_to_2(rec - REC_NEW_HEAP_NO, heap_status); heap_status += 1 << REC_HEAP_NO_SHIFT; return(TRUE); } /** Decompress the records of a node pointer page. @return TRUE on success, FALSE on failure */ static ibool <API key>( page_zip_des_t* page_zip, /*!< in/out: compressed page */ z_stream* d_stream, /*!< in/out: compressed page stream */ rec_t** recs, /*!< in: dense page directory sorted by address */ ulint n_dense, /*!< in: size of recs[] */ dict_index_t* index, /*!< in: the index of the page */ ulint* offsets, /*!< in/out: temporary offsets */ mem_heap_t* heap) /*!< in: temporary memory heap */ { ulint heap_status = REC_STATUS_NODE_PTR | <API key> << REC_HEAP_NO_SHIFT; ulint slot; const byte* storage; /* Subtract the space reserved for uncompressed data. */ d_stream->avail_in -= static_cast<uInt>( n_dense * (<API key> + REC_NODE_PTR_SIZE)); /* Decompress the records in heap_no order. */ for (slot = 0; slot < n_dense; slot++) { rec_t* rec = recs[slot]; d_stream->avail_out = static_cast<uInt>( rec - <API key> - d_stream->next_out); ut_ad(d_stream->avail_out < UNIV_PAGE_SIZE - PAGE_ZIP_START - PAGE_DIR); switch (inflate(d_stream, Z_SYNC_FLUSH)) { case Z_STREAM_END: <API key>( d_stream, rec, heap_status); goto zlib_done; case Z_OK: case Z_BUF_ERROR: if (!d_stream->avail_out) { break; } /* fall through */ default: page_zip_fail(("<API key>:" " 1 inflate(Z_SYNC_FLUSH)=%s\n", d_stream->msg)); goto zlib_error; } if (!<API key>( d_stream, rec, heap_status)) { ut_ad(0); } /* Read the offsets. The status bits are needed here. */ offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); /* Non-leaf nodes should not have any externally stored columns. */ ut_ad(!rec_offs_any_extern(offsets)); /* Decompress the data bytes, except node_ptr. */ d_stream->avail_out =static_cast<uInt>( rec_offs_data_size(offsets) - REC_NODE_PTR_SIZE); switch (inflate(d_stream, Z_SYNC_FLUSH)) { case Z_STREAM_END: goto zlib_done; case Z_OK: case Z_BUF_ERROR: if (!d_stream->avail_out) { break; } /* fall through */ default: page_zip_fail(("<API key>:" " 2 inflate(Z_SYNC_FLUSH)=%s\n", d_stream->msg)); goto zlib_error; } /* Clear the node pointer in case the record will be deleted and the space will be reallocated to a smaller record. */ memset(d_stream->next_out, 0, REC_NODE_PTR_SIZE); d_stream->next_out += REC_NODE_PTR_SIZE; ut_ad(d_stream->next_out == rec_get_end(rec, offsets)); } /* Decompress any trailing garbage, in case the last record was allocated from an originally longer space on the free list. */ d_stream->avail_out = static_cast<uInt>( <API key>(page_zip->data, PAGE_HEAP_TOP) - page_offset(d_stream->next_out)); if (UNIV_UNLIKELY(d_stream->avail_out > UNIV_PAGE_SIZE - PAGE_ZIP_START - PAGE_DIR)) { page_zip_fail(("<API key>:" " avail_out = %u\n", d_stream->avail_out)); goto zlib_error; } if (UNIV_UNLIKELY(inflate(d_stream, Z_FINISH) != Z_STREAM_END)) { page_zip_fail(("<API key>:" " inflate(Z_FINISH)=%s\n", d_stream->msg)); zlib_error: inflateEnd(d_stream); return(FALSE); } /* Note that d_stream->avail_out > 0 may hold here if the modification log is nonempty. */ zlib_done: if (UNIV_UNLIKELY(inflateEnd(d_stream) != Z_OK)) { ut_error; } { page_t* page = page_align(d_stream->next_out); /* Clear the unused heap space on the uncompressed page. */ memset(d_stream->next_out, 0, <API key>(page, <API key>(page) - 1) - d_stream->next_out); } #ifdef UNIV_DEBUG page_zip->m_start = PAGE_DATA + d_stream->total_in; #endif /* UNIV_DEBUG */ /* Apply the modification log. */ { const byte* mod_log_ptr; mod_log_ptr = page_zip_apply_log(d_stream->next_in, d_stream->avail_in + 1, recs, n_dense, ULINT_UNDEFINED, heap_status, index, offsets); if (UNIV_UNLIKELY(!mod_log_ptr)) { return(FALSE); } page_zip->m_end = mod_log_ptr - page_zip->data; page_zip->m_nonempty = mod_log_ptr != d_stream->next_in; } if (UNIV_UNLIKELY (<API key>(page_zip, dict_index_is_clust(index)) + page_zip->m_end >= page_zip_get_size(page_zip))) { page_zip_fail(("<API key>:" " %lu + %lu >= %lu, %lu\n", (ulong) <API key>( page_zip, dict_index_is_clust(index)), (ulong) page_zip->m_end, (ulong) page_zip_get_size(page_zip), (ulong) dict_index_is_clust(index))); return(FALSE); } /* Restore the uncompressed columns in heap_no order. */ storage = <API key>(page_zip, n_dense); for (slot = 0; slot < n_dense; slot++) { rec_t* rec = recs[slot]; offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); /* Non-leaf nodes should not have any externally stored columns. */ ut_ad(!rec_offs_any_extern(offsets)); storage -= REC_NODE_PTR_SIZE; memcpy(rec_get_end(rec, offsets) - REC_NODE_PTR_SIZE, storage, REC_NODE_PTR_SIZE); } return(TRUE); } /** Decompress the records of a leaf node of a secondary index. @return TRUE on success, FALSE on failure */ static ibool <API key>( page_zip_des_t* page_zip, /*!< in/out: compressed page */ z_stream* d_stream, /*!< in/out: compressed page stream */ rec_t** recs, /*!< in: dense page directory sorted by address */ ulint n_dense, /*!< in: size of recs[] */ dict_index_t* index, /*!< in: the index of the page */ ulint* offsets) /*!< in/out: temporary offsets */ { ulint heap_status = REC_STATUS_ORDINARY | <API key> << REC_HEAP_NO_SHIFT; ulint slot; ut_a(!dict_index_is_clust(index)); /* Subtract the space reserved for uncompressed data. */ d_stream->avail_in -= static_cast<uint>( n_dense * <API key>); for (slot = 0; slot < n_dense; slot++) { rec_t* rec = recs[slot]; /* Decompress everything up to this record. */ d_stream->avail_out = static_cast<uint>( rec - <API key> - d_stream->next_out); if (UNIV_LIKELY(d_stream->avail_out)) { switch (inflate(d_stream, Z_SYNC_FLUSH)) { case Z_STREAM_END: <API key>( d_stream, rec, heap_status); goto zlib_done; case Z_OK: case Z_BUF_ERROR: if (!d_stream->avail_out) { break; } /* fall through */ default: page_zip_fail(("<API key>:" " inflate(Z_SYNC_FLUSH)=%s\n", d_stream->msg)); goto zlib_error; } } if (!<API key>( d_stream, rec, heap_status)) { ut_ad(0); } } /* Decompress the data of the last record and any trailing garbage, in case the last record was allocated from an originally longer space on the free list. */ d_stream->avail_out = static_cast<uInt>( <API key>(page_zip->data, PAGE_HEAP_TOP) - page_offset(d_stream->next_out)); if (UNIV_UNLIKELY(d_stream->avail_out > UNIV_PAGE_SIZE - PAGE_ZIP_START - PAGE_DIR)) { page_zip_fail(("<API key>:" " avail_out = %u\n", d_stream->avail_out)); goto zlib_error; } if (UNIV_UNLIKELY(inflate(d_stream, Z_FINISH) != Z_STREAM_END)) { page_zip_fail(("<API key>:" " inflate(Z_FINISH)=%s\n", d_stream->msg)); zlib_error: inflateEnd(d_stream); return(FALSE); } /* Note that d_stream->avail_out > 0 may hold here if the modification log is nonempty. */ zlib_done: if (UNIV_UNLIKELY(inflateEnd(d_stream) != Z_OK)) { ut_error; } { page_t* page = page_align(d_stream->next_out); /* Clear the unused heap space on the uncompressed page. */ memset(d_stream->next_out, 0, <API key>(page, <API key>(page) - 1) - d_stream->next_out); } #ifdef UNIV_DEBUG page_zip->m_start = PAGE_DATA + d_stream->total_in; #endif /* UNIV_DEBUG */ /* Apply the modification log. */ { const byte* mod_log_ptr; mod_log_ptr = page_zip_apply_log(d_stream->next_in, d_stream->avail_in + 1, recs, n_dense, ULINT_UNDEFINED, heap_status, index, offsets); if (UNIV_UNLIKELY(!mod_log_ptr)) { return(FALSE); } page_zip->m_end = mod_log_ptr - page_zip->data; page_zip->m_nonempty = mod_log_ptr != d_stream->next_in; } if (UNIV_UNLIKELY(<API key>(page_zip, FALSE) + page_zip->m_end >= page_zip_get_size(page_zip))) { page_zip_fail(("<API key>: %lu + %lu >= %lu\n", (ulong) <API key>( page_zip, FALSE), (ulong) page_zip->m_end, (ulong) page_zip_get_size(page_zip))); return(FALSE); } /* There are no uncompressed columns on leaf pages of secondary indexes. */ return(TRUE); } /** Decompress a record of a leaf node of a clustered index that contains externally stored columns. @return TRUE on success */ static ibool <API key>( z_stream* d_stream, /*!< in/out: compressed page stream */ rec_t* rec, /*!< in/out: record */ const ulint* offsets, /*!< in: rec_get_offsets(rec) */ ulint trx_id_col) /*!< in: position of of DB_TRX_ID */ { ulint i; for (i = 0; i < rec_offs_n_fields(offsets); i++) { ulint len; byte* dst; if (UNIV_UNLIKELY(i == trx_id_col)) { /* Skip trx_id and roll_ptr */ dst = rec_get_nth_field(rec, offsets, i, &len); if (UNIV_UNLIKELY(len < DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN)) { page_zip_fail(("<API key>:" " len[%lu] = %lu\n", (ulong) i, (ulong) len)); return(FALSE); } if (rec_offs_nth_extern(offsets, i)) { page_zip_fail(("<API key>:" " DB_TRX_ID at %lu is ext\n", (ulong) i)); return(FALSE); } d_stream->avail_out = static_cast<uInt>( dst - d_stream->next_out); switch (inflate(d_stream, Z_SYNC_FLUSH)) { case Z_STREAM_END: case Z_OK: case Z_BUF_ERROR: if (!d_stream->avail_out) { break; } /* fall through */ default: page_zip_fail(("<API key>:" " 1 inflate(Z_SYNC_FLUSH)=%s\n", d_stream->msg)); return(FALSE); } ut_ad(d_stream->next_out == dst); /* Clear DB_TRX_ID and DB_ROLL_PTR in order to avoid uninitialized bytes in case the record is affected by page_zip_apply_log(). */ memset(dst, 0, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); d_stream->next_out += DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; } else if (rec_offs_nth_extern(offsets, i)) { dst = rec_get_nth_field(rec, offsets, i, &len); ut_ad(len >= <API key>); dst += len - <API key>; d_stream->avail_out = static_cast<uInt>( dst - d_stream->next_out); switch (inflate(d_stream, Z_SYNC_FLUSH)) { case Z_STREAM_END: case Z_OK: case Z_BUF_ERROR: if (!d_stream->avail_out) { break; } /* fall through */ default: page_zip_fail(("<API key>:" " 2 inflate(Z_SYNC_FLUSH)=%s\n", d_stream->msg)); return(FALSE); } ut_ad(d_stream->next_out == dst); /* Clear the BLOB pointer in case the record will be deleted and the space will not be reused. Note that the final initialization of the BLOB pointers (copying from "externs" or clearing) will have to take place only after the page modification log has been applied. Otherwise, we could end up with an uninitialized BLOB pointer when a record is deleted, reallocated and deleted. */ memset(d_stream->next_out, 0, <API key>); d_stream->next_out += <API key>; } } return(TRUE); } /** Compress the records of a leaf node of a clustered index. @return TRUE on success, FALSE on failure */ static ibool <API key>( page_zip_des_t* page_zip, /*!< in/out: compressed page */ z_stream* d_stream, /*!< in/out: compressed page stream */ rec_t** recs, /*!< in: dense page directory sorted by address */ ulint n_dense, /*!< in: size of recs[] */ dict_index_t* index, /*!< in: the index of the page */ ulint trx_id_col, /*!< index of the trx_id column */ ulint* offsets, /*!< in/out: temporary offsets */ mem_heap_t* heap) /*!< in: temporary memory heap */ { int err; ulint slot; ulint heap_status = REC_STATUS_ORDINARY | <API key> << REC_HEAP_NO_SHIFT; const byte* storage; const byte* externs; ut_a(dict_index_is_clust(index)); /* Subtract the space reserved for uncompressed data. */ d_stream->avail_in -= static_cast<uInt>(n_dense) * (<API key> + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); /* Decompress the records in heap_no order. */ for (slot = 0; slot < n_dense; slot++) { rec_t* rec = recs[slot]; d_stream->avail_out =static_cast<uInt>( rec - <API key> - d_stream->next_out); ut_ad(d_stream->avail_out < UNIV_PAGE_SIZE - PAGE_ZIP_START - PAGE_DIR); err = inflate(d_stream, Z_SYNC_FLUSH); switch (err) { case Z_STREAM_END: <API key>( d_stream, rec, heap_status); goto zlib_done; case Z_OK: case Z_BUF_ERROR: if (UNIV_LIKELY(!d_stream->avail_out)) { break; } /* fall through */ default: page_zip_fail(("<API key>:" " 1 inflate(Z_SYNC_FLUSH)=%s\n", d_stream->msg)); goto zlib_error; } if (!<API key>( d_stream, rec, heap_status)) { ut_ad(0); } /* Read the offsets. The status bits are needed here. */ offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); /* This is a leaf page in a clustered index. */ /* Check if there are any externally stored columns. For each externally stored column, restore the <API key> separately. */ if (rec_offs_any_extern(offsets)) { if (UNIV_UNLIKELY (!<API key>( d_stream, rec, offsets, trx_id_col))) { goto zlib_error; } } else { /* Skip trx_id and roll_ptr */ ulint len; byte* dst = rec_get_nth_field(rec, offsets, trx_id_col, &len); if (UNIV_UNLIKELY(len < DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN)) { page_zip_fail(("<API key>:" " len = %lu\n", (ulong) len)); goto zlib_error; } d_stream->avail_out = static_cast<uInt>( dst - d_stream->next_out); switch (inflate(d_stream, Z_SYNC_FLUSH)) { case Z_STREAM_END: case Z_OK: case Z_BUF_ERROR: if (!d_stream->avail_out) { break; } /* fall through */ default: page_zip_fail(("<API key>:" " 2 inflate(Z_SYNC_FLUSH)=%s\n", d_stream->msg)); goto zlib_error; } ut_ad(d_stream->next_out == dst); /* Clear DB_TRX_ID and DB_ROLL_PTR in order to avoid uninitialized bytes in case the record is affected by page_zip_apply_log(). */ memset(dst, 0, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); d_stream->next_out += DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; } /* Decompress the last bytes of the record. */ d_stream->avail_out = static_cast<uInt>( rec_get_end(rec, offsets) - d_stream->next_out); switch (inflate(d_stream, Z_SYNC_FLUSH)) { case Z_STREAM_END: case Z_OK: case Z_BUF_ERROR: if (!d_stream->avail_out) { break; } /* fall through */ default: page_zip_fail(("<API key>:" " 3 inflate(Z_SYNC_FLUSH)=%s\n", d_stream->msg)); goto zlib_error; } } /* Decompress any trailing garbage, in case the last record was allocated from an originally longer space on the free list. */ d_stream->avail_out = static_cast<uInt>( <API key>(page_zip->data, PAGE_HEAP_TOP) - page_offset(d_stream->next_out)); if (UNIV_UNLIKELY(d_stream->avail_out > UNIV_PAGE_SIZE - PAGE_ZIP_START - PAGE_DIR)) { page_zip_fail(("<API key>:" " avail_out = %u\n", d_stream->avail_out)); goto zlib_error; } if (UNIV_UNLIKELY(inflate(d_stream, Z_FINISH) != Z_STREAM_END)) { page_zip_fail(("<API key>:" " inflate(Z_FINISH)=%s\n", d_stream->msg)); zlib_error: inflateEnd(d_stream); return(FALSE); } /* Note that d_stream->avail_out > 0 may hold here if the modification log is nonempty. */ zlib_done: if (UNIV_UNLIKELY(inflateEnd(d_stream) != Z_OK)) { ut_error; } { page_t* page = page_align(d_stream->next_out); /* Clear the unused heap space on the uncompressed page. */ memset(d_stream->next_out, 0, <API key>(page, <API key>(page) - 1) - d_stream->next_out); } #ifdef UNIV_DEBUG page_zip->m_start = PAGE_DATA + d_stream->total_in; #endif /* UNIV_DEBUG */ /* Apply the modification log. */ { const byte* mod_log_ptr; mod_log_ptr = page_zip_apply_log(d_stream->next_in, d_stream->avail_in + 1, recs, n_dense, trx_id_col, heap_status, index, offsets); if (UNIV_UNLIKELY(!mod_log_ptr)) { return(FALSE); } page_zip->m_end = mod_log_ptr - page_zip->data; page_zip->m_nonempty = mod_log_ptr != d_stream->next_in; } if (UNIV_UNLIKELY(<API key>(page_zip, TRUE) + page_zip->m_end >= page_zip_get_size(page_zip))) { page_zip_fail(("<API key>: %lu + %lu >= %lu\n", (ulong) <API key>( page_zip, TRUE), (ulong) page_zip->m_end, (ulong) page_zip_get_size(page_zip))); return(FALSE); } storage = <API key>(page_zip, n_dense); externs = storage - n_dense * (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); /* Restore the uncompressed columns in heap_no order. */ for (slot = 0; slot < n_dense; slot++) { ulint i; ulint len; byte* dst; rec_t* rec = recs[slot]; ibool exists = !<API key>( page_zip, page_offset(rec)); offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); dst = rec_get_nth_field(rec, offsets, trx_id_col, &len); ut_ad(len >= DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); storage -= DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; memcpy(dst, storage, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); /* Check if there are any externally stored columns in this record. For each externally stored column, restore or clear the <API key>. */ if (!rec_offs_any_extern(offsets)) { continue; } for (i = 0; i < rec_offs_n_fields(offsets); i++) { if (!rec_offs_nth_extern(offsets, i)) { continue; } dst = rec_get_nth_field(rec, offsets, i, &len); if (UNIV_UNLIKELY(len < <API key>)) { page_zip_fail(("<API key>:" " %lu < 20\n", (ulong) len)); return(FALSE); } dst += len - <API key>; if (UNIV_LIKELY(exists)) { /* Existing record: restore the BLOB pointer */ externs -= <API key>; if (UNIV_UNLIKELY (externs < page_zip->data + page_zip->m_end)) { page_zip_fail(("page_zip_" "decompress_clust: " "%p < %p + %lu\n", (const void*) externs, (const void*) page_zip->data, (ulong) page_zip->m_end)); return(FALSE); } memcpy(dst, externs, <API key>); page_zip->n_blobs++; } else { /* Deleted record: clear the BLOB pointer */ memset(dst, 0, <API key>); } } } return(TRUE); } /** This function determines the sign for window_bits and reads the zlib header from the decompress stream. The data may have been compressed with a negative (no adler32 headers) or a positive (with adler32 headers) window_bits. Regardless of the current value of page_zip_zlib_wrap, we always first try the positive window_bits then negative window_bits, because the surest way to determine if the stream has adler32 headers is to see if the stream begins with the zlib header together with the adler32 value of it. This adds a tiny bit of overhead for the pages that were compressed without adler32s. @return TRUE if stream is initialized and zlib header was read, FALSE if data can be decompressed with neither window_bits nor -window_bits */ UNIV_INTERN ibool <API key>( z_stream* strm, int window_bits, ibool read_zlib_header) { /* Save initial stream position, in case a reset is required. */ Bytef* next_in = strm->next_in; Bytef* next_out = strm->next_out; ulint avail_in = strm->avail_in; ulint avail_out = strm->avail_out; if (UNIV_UNLIKELY(inflateInit2(strm, window_bits) != Z_OK)) { /* init must always succeed regardless of window_bits */ ut_error; } /* Try decoding a zlib header assuming adler32. */ if (inflate(strm, Z_BLOCK) == Z_OK) /* A valid header was found, all is well. So, we return with the stream positioned just after this header. */ return(TRUE); /* A valid header was not found, so now we need to re-try this read assuming there is *no* header (negative window_bits). So, we need to reset the stream to the original position, and change the window_bits to negative, with inflateReset2(). */ strm->next_in = next_in; strm->next_out = next_out; strm->avail_in = avail_in; strm->avail_out = avail_out; if (UNIV_UNLIKELY(inflateReset2(strm, -window_bits) != Z_OK)) { /* init must always succeed regardless of window_bits */ ut_error; } if (read_zlib_header) { /* No valid header was found, and we still want the header read to have happened, with negative window_bits. */ return(inflate(strm, Z_BLOCK) == Z_OK); } /* Did not find a header, but didn't require one, so just return with the stream position reset to where it originally was. */ return(TRUE); } /** Decompress a page. This function should tolerate errors on the compressed page. Instead of letting assertions fail, it will return FALSE if an inconsistency is detected. @return TRUE on success, FALSE on failure */ UNIV_INTERN ibool page_zip_decompress( page_zip_des_t* page_zip,/*!< in: data, ssize; out: m_start, m_end, m_nonempty, n_blobs */ page_t* page, /*!< out: uncompressed page, may be trashed */ ibool all) /*!< in: TRUE=decompress the whole page; FALSE=verify but do not copy some page header fields that should not change after page creation */ { z_stream d_stream; dict_index_t* index = NULL; rec_t** recs; /*!< dense page directory, sorted by address */ ulint n_dense;/* number of user records on the page */ ulint trx_id_col = ULINT_UNDEFINED; mem_heap_t* heap; ulint* offsets; #ifndef UNIV_HOTBACKUP ullint usec = ut_time_us(NULL); #endif /* !UNIV_HOTBACKUP */ ut_ad(<API key>(page_zip)); UNIV_MEM_ASSERT_W(page, UNIV_PAGE_SIZE); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); /* The dense directory excludes the infimum and supremum records. */ n_dense = page_dir_get_n_heap(page_zip->data) - <API key>; if (UNIV_UNLIKELY(n_dense * <API key> >= page_zip_get_size(page_zip))) { page_zip_fail(("page_zip_decompress 1: %lu %lu\n", (ulong) n_dense, (ulong) page_zip_get_size(page_zip))); return(FALSE); } heap = mem_heap_create(n_dense * (3 * sizeof *recs) + UNIV_PAGE_SIZE); recs = static_cast<rec_t**>( mem_heap_alloc(heap, n_dense * (2 * sizeof *recs))); if (all) { /* Copy the page header. */ memcpy(page, page_zip->data, PAGE_DATA); } else { /* Check that the bytes that we skip are identical. */ #if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG ut_a(!memcmp(FIL_PAGE_TYPE + page, FIL_PAGE_TYPE + page_zip->data, PAGE_HEADER - FIL_PAGE_TYPE)); ut_a(!memcmp(PAGE_HEADER + PAGE_LEVEL + page, PAGE_HEADER + PAGE_LEVEL + page_zip->data, PAGE_DATA - (PAGE_HEADER + PAGE_LEVEL))); #endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */ /* Copy the mutable parts of the page header. */ memcpy(page, page_zip->data, FIL_PAGE_TYPE); memcpy(PAGE_HEADER + page, PAGE_HEADER + page_zip->data, PAGE_LEVEL - PAGE_N_DIR_SLOTS); #if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG /* Check that the page headers match after copying. */ ut_a(!memcmp(page, page_zip->data, PAGE_DATA)); #endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */ } #ifdef UNIV_ZIP_DEBUG /* Clear the uncompressed page, except the header. */ memset(PAGE_DATA + page, 0x55, UNIV_PAGE_SIZE - PAGE_DATA); #endif /* UNIV_ZIP_DEBUG */ UNIV_MEM_INVALID(PAGE_DATA + page, UNIV_PAGE_SIZE - PAGE_DATA); /* Copy the page directory. */ if (UNIV_UNLIKELY(!page_zip_dir_decode(page_zip, page, recs, recs + n_dense, n_dense))) { zlib_error: mem_heap_free(heap); return(FALSE); } /* Copy the infimum and supremum records. */ memcpy(page + (PAGE_NEW_INFIMUM - <API key>), infimum_extra, sizeof infimum_extra); if (page_is_empty(page)) { <API key>(page + PAGE_NEW_INFIMUM, PAGE_NEW_SUPREMUM); } else { <API key>(page + PAGE_NEW_INFIMUM, page_zip_dir_get(page_zip, 0) & <API key>); } memcpy(page + PAGE_NEW_INFIMUM, infimum_data, sizeof infimum_data); memcpy(page + (PAGE_NEW_SUPREMUM - <API key> + 1), supremum_extra_data, sizeof supremum_extra_data); page_zip_set_alloc(&d_stream, heap); d_stream.next_in = page_zip->data + PAGE_DATA; /* Subtract the space reserved for the page header and the end marker of the modification log. */ d_stream.avail_in = static_cast<uInt>( page_zip_get_size(page_zip) - (PAGE_DATA + 1)); d_stream.next_out = page + PAGE_ZIP_START; d_stream.avail_out = UNIV_PAGE_SIZE - PAGE_ZIP_START; if (!<API key>(&d_stream, <API key>, TRUE)) { page_zip_fail(("page_zip_decompress:" " 1 inflate(Z_BLOCK)=%s\n", d_stream.msg)); goto zlib_error; } if (UNIV_UNLIKELY(inflate(&d_stream, Z_BLOCK) != Z_OK)) { page_zip_fail(("page_zip_decompress:" " 2 inflate(Z_BLOCK)=%s\n", d_stream.msg)); goto zlib_error; } index = <API key>( page + PAGE_ZIP_START, d_stream.next_out, page_is_leaf(page) ? &trx_id_col : NULL); if (UNIV_UNLIKELY(!index)) { goto zlib_error; } /* Decompress the user records. */ page_zip->n_blobs = 0; d_stream.next_out = page + PAGE_ZIP_START; { /* Pre-allocate the offsets for <API key>(). */ ulint n = 1 + 1/* node ptr */ + <API key> + <API key>(index); offsets = static_cast<ulint*>( mem_heap_alloc(heap, n * sizeof(ulint))); *offsets = n; } /* Decompress the records in heap_no order. */ if (!page_is_leaf(page)) { /* This is a node pointer page. */ ulint info_bits; if (UNIV_UNLIKELY (!<API key>(page_zip, &d_stream, recs, n_dense, index, offsets, heap))) { goto err_exit; } info_bits = mach_read_from_4(page + FIL_PAGE_PREV) == FIL_NULL ? <API key> : 0; if (UNIV_UNLIKELY(!<API key>(page_zip, page, info_bits))) { goto err_exit; } } else if (UNIV_LIKELY(trx_id_col == ULINT_UNDEFINED)) { /* This is a leaf page in a secondary index. */ if (UNIV_UNLIKELY(!<API key>(page_zip, &d_stream, recs, n_dense, index, offsets))) { goto err_exit; } if (UNIV_UNLIKELY(!<API key>(page_zip, page, 0))) { err_exit: <API key>(index); mem_heap_free(heap); return(FALSE); } } else { /* This is a leaf page in a clustered index. */ if (UNIV_UNLIKELY(!<API key>(page_zip, &d_stream, recs, n_dense, index, trx_id_col, offsets, heap))) { goto err_exit; } if (UNIV_UNLIKELY(!<API key>(page_zip, page, 0))) { goto err_exit; } } ut_a(page_is_comp(page)); UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE); <API key>(index); mem_heap_free(heap); #ifndef UNIV_HOTBACKUP ullint time_diff = ut_time_us(NULL) - usec; page_zip_stat[page_zip->ssize - 1].decompressed++; page_zip_stat[page_zip->ssize - 1].decompressed_usec += time_diff; index_id_t index_id = <API key>(page); if (<API key>) { mutex_enter(&<API key>); <API key>[index_id].decompressed++; <API key>[index_id].decompressed_usec += time_diff; mutex_exit(&<API key>); } #endif /* !UNIV_HOTBACKUP */ /* Update the stat counter for LRU policy. */ <API key>(); MONITOR_INC(<API key>); return(TRUE); } #ifdef UNIV_ZIP_DEBUG /** Dump a block of memory on the standard error stream. */ static void <API key>( const char* name, /*!< in: name of the data structure */ const void* buf, /*!< in: data */ ulint size) /*!< in: length of the data, in bytes */ { const byte* s = static_cast<const byte*>(buf); ulint addr; const ulint width = 32; /* bytes per line */ fprintf(stderr, "%s:\n", name); for (addr = 0; addr < size; addr += width) { ulint i; fprintf(stderr, "%04lx ", (ulong) addr); i = ut_min(width, size - addr); while (i fprintf(stderr, "%02x", *s++); } putc('\n', stderr); } } /** Dump a block of memory on the standard error stream. @param buf in: data @param size in: length of the data, in bytes */ #define page_zip_hexdump(buf, size) <API key>(#buf, buf, size) /** Flag: make page_zip_validate() compare page headers only */ UNIV_INTERN ibool <API key> = FALSE; /** Check that the compressed and decompressed pages match. @return TRUE if valid, FALSE if not */ UNIV_INTERN ibool <API key>( const page_zip_des_t* page_zip,/*!< in: compressed page */ const page_t* page, /*!< in: uncompressed page */ const dict_index_t* index, /*!< in: index of the page, if known */ ibool sloppy) /*!< in: FALSE=strict, TRUE=ignore the MIN_REC_FLAG */ { page_zip_des_t temp_page_zip; byte* temp_page_buf; page_t* temp_page; ibool valid; if (memcmp(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV, FIL_PAGE_LSN - FIL_PAGE_PREV) || memcmp(page_zip->data + FIL_PAGE_TYPE, page + FIL_PAGE_TYPE, 2) || memcmp(page_zip->data + FIL_PAGE_DATA, page + FIL_PAGE_DATA, PAGE_DATA - FIL_PAGE_DATA)) { page_zip_fail(("page_zip_validate: page header\n")); page_zip_hexdump(page_zip, sizeof *page_zip); page_zip_hexdump(page_zip->data, page_zip_get_size(page_zip)); page_zip_hexdump(page, UNIV_PAGE_SIZE); return(FALSE); } ut_a(page_is_comp(page)); if (<API key>) { return(TRUE); } /* page_zip_decompress() expects the uncompressed page to be UNIV_PAGE_SIZE aligned. */ temp_page_buf = static_cast<byte*>(ut_malloc(2 * UNIV_PAGE_SIZE)); temp_page = static_cast<byte*>(ut_align(temp_page_buf, UNIV_PAGE_SIZE)); UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); temp_page_zip = *page_zip; valid = page_zip_decompress(&temp_page_zip, temp_page, TRUE); if (!valid) { fputs("page_zip_validate(): failed to decompress\n", stderr); goto func_exit; } if (page_zip->n_blobs != temp_page_zip.n_blobs) { page_zip_fail(("page_zip_validate: n_blobs: %u!=%u\n", page_zip->n_blobs, temp_page_zip.n_blobs)); valid = FALSE; } #ifdef UNIV_DEBUG if (page_zip->m_start != temp_page_zip.m_start) { page_zip_fail(("page_zip_validate: m_start: %u!=%u\n", page_zip->m_start, temp_page_zip.m_start)); valid = FALSE; } #endif /* UNIV_DEBUG */ if (page_zip->m_end != temp_page_zip.m_end) { page_zip_fail(("page_zip_validate: m_end: %u!=%u\n", page_zip->m_end, temp_page_zip.m_end)); valid = FALSE; } if (page_zip->m_nonempty != temp_page_zip.m_nonempty) { page_zip_fail(("page_zip_validate(): m_nonempty: %u!=%u\n", page_zip->m_nonempty, temp_page_zip.m_nonempty)); valid = FALSE; } if (memcmp(page + PAGE_HEADER, temp_page + PAGE_HEADER, UNIV_PAGE_SIZE - PAGE_HEADER - FIL_PAGE_DATA_END)) { /* In crash recovery, the "minimum record" flag may be set incorrectly until the mini-transaction is committed. Let us tolerate that difference when we are performing a sloppy validation. */ ulint* offsets; mem_heap_t* heap; const rec_t* rec; const rec_t* trec; byte info_bits_diff; ulint offset = rec_get_next_offs(page + PAGE_NEW_INFIMUM, TRUE); ut_a(offset >= PAGE_NEW_SUPREMUM); offset -= 5/*REC_NEW_INFO_BITS*/; info_bits_diff = page[offset] ^ temp_page[offset]; if (info_bits_diff == <API key>) { temp_page[offset] = page[offset]; if (!memcmp(page + PAGE_HEADER, temp_page + PAGE_HEADER, UNIV_PAGE_SIZE - PAGE_HEADER - FIL_PAGE_DATA_END)) { /* Only the minimum record flag differed. Let us ignore it. */ page_zip_fail(("page_zip_validate: " "min_rec_flag " "(%s" "%lu,%lu,0x%02lx)\n", sloppy ? "ignored, " : "", page_get_space_id(page), page_get_page_no(page), (ulong) page[offset])); valid = sloppy; goto func_exit; } } /* Compare the pointers in the PAGE_FREE list. */ rec = page_header_get_ptr(page, PAGE_FREE); trec = page_header_get_ptr(temp_page, PAGE_FREE); while (rec || trec) { if (page_offset(rec) != page_offset(trec)) { page_zip_fail(("page_zip_validate: " "PAGE_FREE list: %u!=%u\n", (unsigned) page_offset(rec), (unsigned) page_offset(trec))); valid = FALSE; goto func_exit; } rec = <API key>(rec, TRUE); trec = <API key>(trec, TRUE); } /* Compare the records. */ heap = NULL; offsets = NULL; rec = <API key>( page + PAGE_NEW_INFIMUM, TRUE); trec = <API key>( temp_page + PAGE_NEW_INFIMUM, TRUE); do { if (page_offset(rec) != page_offset(trec)) { page_zip_fail(("page_zip_validate: " "record list: 0x%02x!=0x%02x\n", (unsigned) page_offset(rec), (unsigned) page_offset(trec))); valid = FALSE; break; } if (index) { /* Compare the data. */ offsets = rec_get_offsets( rec, index, offsets, ULINT_UNDEFINED, &heap); if (memcmp(rec - rec_offs_extra_size(offsets), trec - rec_offs_extra_size(offsets), rec_offs_size(offsets))) { page_zip_fail( ("page_zip_validate: " "record content: 0x%02x", (unsigned) page_offset(rec))); valid = FALSE; break; } } rec = <API key>(rec, TRUE); trec = <API key>(trec, TRUE); } while (rec || trec); if (heap) { mem_heap_free(heap); } } func_exit: if (!valid) { page_zip_hexdump(page_zip, sizeof *page_zip); page_zip_hexdump(page_zip->data, page_zip_get_size(page_zip)); page_zip_hexdump(page, UNIV_PAGE_SIZE); page_zip_hexdump(temp_page, UNIV_PAGE_SIZE); } ut_free(temp_page_buf); return(valid); } /** Check that the compressed and decompressed pages match. @return TRUE if valid, FALSE if not */ UNIV_INTERN ibool page_zip_validate( const page_zip_des_t* page_zip,/*!< in: compressed page */ const page_t* page, /*!< in: uncompressed page */ const dict_index_t* index) /*!< in: index of the page, if known */ { return(<API key>(page_zip, page, index, recv_recovery_is_on())); } #endif /* UNIV_ZIP_DEBUG */ #ifdef UNIV_DEBUG /** Assert that the compressed and decompressed page headers match. @return TRUE */ static ibool page_zip_header_cmp( const page_zip_des_t* page_zip,/*!< in: compressed page */ const byte* page) /*!< in: uncompressed page */ { ut_ad(!memcmp(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV, FIL_PAGE_LSN - FIL_PAGE_PREV)); ut_ad(!memcmp(page_zip->data + FIL_PAGE_TYPE, page + FIL_PAGE_TYPE, 2)); ut_ad(!memcmp(page_zip->data + FIL_PAGE_DATA, page + FIL_PAGE_DATA, PAGE_DATA - FIL_PAGE_DATA)); return(TRUE); } #endif /* UNIV_DEBUG */ /** Write a record on the compressed page that contains externally stored columns. The data must already have been written to the uncompressed page. @return end of modification log */ static byte* <API key>( page_zip_des_t* page_zip, /*!< in/out: compressed page */ const page_t* page, /*!< in: page containing rec */ const byte* rec, /*!< in: record being written */ dict_index_t* index, /*!< in: record descriptor */ const ulint* offsets, /*!< in: rec_get_offsets(rec, index) */ ulint create, /*!< in: nonzero=insert, zero=update */ ulint trx_id_col, /*!< in: position of DB_TRX_ID */ ulint heap_no, /*!< in: heap number of rec */ byte* storage, /*!< in: end of dense page directory */ byte* data) /*!< in: end of modification log */ { const byte* start = rec; ulint i; ulint len; byte* externs = storage; ulint n_ext = rec_offs_n_extern(offsets); ut_ad(rec_offs_validate(rec, index, offsets)); UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets)); UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets), rec_offs_extra_size(offsets)); externs -= (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN) * (page_dir_get_n_heap(page) - <API key>); /* Note that this will not take into account the BLOB columns of rec if create==TRUE. */ ut_ad(data + rec_offs_data_size(offsets) - (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN) - n_ext * <API key> < externs - <API key> * page_zip->n_blobs); { ulint blob_no = <API key>( page_zip, rec, index); byte* ext_end = externs - page_zip->n_blobs * <API key>; ut_ad(blob_no <= page_zip->n_blobs); externs -= blob_no * <API key>; if (create) { page_zip->n_blobs += static_cast<unsigned>(n_ext); ASSERT_ZERO_BLOB(ext_end - n_ext * <API key>); memmove(ext_end - n_ext * <API key>, ext_end, externs - ext_end); } ut_a(blob_no + n_ext <= page_zip->n_blobs); } for (i = 0; i < rec_offs_n_fields(offsets); i++) { const byte* src; if (UNIV_UNLIKELY(i == trx_id_col)) { ut_ad(!rec_offs_nth_extern(offsets, i)); ut_ad(!rec_offs_nth_extern(offsets, i + 1)); /* Locate trx_id and roll_ptr. */ src = rec_get_nth_field(rec, offsets, i, &len); ut_ad(len == DATA_TRX_ID_LEN); ut_ad(src + DATA_TRX_ID_LEN == rec_get_nth_field( rec, offsets, i + 1, &len)); ut_ad(len == DATA_ROLL_PTR_LEN); /* Log the preceding fields. */ ASSERT_ZERO(data, src - start); memcpy(data, start, src - start); data += src - start; start = src + (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); /* Store trx_id and roll_ptr. */ memcpy(storage - (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN) * (heap_no - 1), src, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); i++; /* skip also roll_ptr */ } else if (rec_offs_nth_extern(offsets, i)) { src = rec_get_nth_field(rec, offsets, i, &len); ut_ad(dict_index_is_clust(index)); ut_ad(len >= <API key>); src += len - <API key>; ASSERT_ZERO(data, src - start); memcpy(data, start, src - start); data += src - start; start = src + <API key>; /* Store the BLOB pointer. */ externs -= <API key>; ut_ad(data < externs); memcpy(externs, src, <API key>); } } /* Log the last bytes of the record. */ len = rec_offs_data_size(offsets) - (start - rec); ASSERT_ZERO(data, len); memcpy(data, start, len); data += len; return(data); } /** Write an entire record on the compressed page. The data must already have been written to the uncompressed page. */ UNIV_INTERN void page_zip_write_rec( page_zip_des_t* page_zip,/*!< in/out: compressed page */ const byte* rec, /*!< in: record being written */ dict_index_t* index, /*!< in: the index the record belongs to */ const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ ulint create) /*!< in: nonzero=insert, zero=update */ { const page_t* page; byte* data; byte* storage; ulint heap_no; byte* slot; ut_ad(PAGE_ZIP_MATCH(rec, page_zip)); ut_ad(<API key>(page_zip)); ut_ad(page_zip_get_size(page_zip) > PAGE_DATA + page_zip_dir_size(page_zip)); ut_ad(rec_offs_comp(offsets)); ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(page_zip->m_start >= PAGE_DATA); page = page_align(rec); ut_ad(page_zip_header_cmp(page_zip, page)); ut_ad(<API key>((page_t*) page)); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets)); UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets), rec_offs_extra_size(offsets)); slot = page_zip_dir_find(page_zip, page_offset(rec)); ut_a(slot); /* Copy the delete mark. */ if (<API key>(rec, TRUE)) { *slot |= <API key> >> 8; } else { *slot &= ~(<API key> >> 8); } ut_ad(rec_get_start((rec_t*) rec, offsets) >= page + PAGE_ZIP_START); ut_ad(rec_get_end((rec_t*) rec, offsets) <= page + UNIV_PAGE_SIZE - PAGE_DIR - PAGE_DIR_SLOT_SIZE * <API key>(page)); heap_no = rec_get_heap_no_new(rec); ut_ad(heap_no >= <API key>); /* not infimum or supremum */ ut_ad(heap_no < page_dir_get_n_heap(page)); /* Append to the modification log. */ data = page_zip->data + page_zip->m_end; ut_ad(!*data); /* Identify the record by writing its heap number - 1. 0 is reserved to indicate the end of the modification log. */ if (UNIV_UNLIKELY(heap_no - 1 >= 64)) { *data++ = (byte) (0x80 | (heap_no - 1) >> 7); ut_ad(!*data); } *data++ = (byte) ((heap_no - 1) << 1); ut_ad(!*data); { const byte* start = rec - rec_offs_extra_size(offsets); const byte* b = rec - <API key>; /* Write the extra bytes backwards, so that rec_offs_extra_size() can be easily computed in page_zip_apply_log() by invoking <API key>(). */ while (b != start) { *data++ = *--b; ut_ad(!*data); } } /* Write the data bytes. Store the uncompressed bytes separately. */ storage = page_zip_dir_start(page_zip); if (page_is_leaf(page)) { ulint len; if (dict_index_is_clust(index)) { ulint trx_id_col; trx_id_col = <API key>(index, DATA_TRX_ID); ut_ad(trx_id_col != ULINT_UNDEFINED); /* Store separately trx_id, roll_ptr and the <API key> of each BLOB column. */ if (rec_offs_any_extern(offsets)) { data = <API key>( page_zip, page, rec, index, offsets, create, trx_id_col, heap_no, storage, data); } else { /* Locate trx_id and roll_ptr. */ const byte* src = rec_get_nth_field(rec, offsets, trx_id_col, &len); ut_ad(len == DATA_TRX_ID_LEN); ut_ad(src + DATA_TRX_ID_LEN == rec_get_nth_field( rec, offsets, trx_id_col + 1, &len)); ut_ad(len == DATA_ROLL_PTR_LEN); /* Log the preceding fields. */ ASSERT_ZERO(data, src - rec); memcpy(data, rec, src - rec); data += src - rec; /* Store trx_id and roll_ptr. */ memcpy(storage - (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN) * (heap_no - 1), src, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); src += DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; /* Log the last bytes of the record. */ len = rec_offs_data_size(offsets) - (src - rec); ASSERT_ZERO(data, len); memcpy(data, src, len); data += len; } } else { /* Leaf page of a secondary index: no externally stored columns */ ut_ad(<API key>(index, DATA_TRX_ID) == ULINT_UNDEFINED); ut_ad(!rec_offs_any_extern(offsets)); /* Log the entire record. */ len = rec_offs_data_size(offsets); ASSERT_ZERO(data, len); memcpy(data, rec, len); data += len; } } else { /* This is a node pointer page. */ ulint len; /* Non-leaf nodes should not have any externally stored columns. */ ut_ad(!rec_offs_any_extern(offsets)); /* Copy the data bytes, except node_ptr. */ len = rec_offs_data_size(offsets) - REC_NODE_PTR_SIZE; ut_ad(data + len < storage - REC_NODE_PTR_SIZE * (page_dir_get_n_heap(page) - <API key>)); ASSERT_ZERO(data, len); memcpy(data, rec, len); data += len; /* Copy the node pointer to the uncompressed area. */ memcpy(storage - REC_NODE_PTR_SIZE * (heap_no - 1), rec + len, REC_NODE_PTR_SIZE); } ut_a(!*data); ut_ad((ulint) (data - page_zip->data) < page_zip_get_size(page_zip)); page_zip->m_end = data - page_zip->data; page_zip->m_nonempty = TRUE; #ifdef UNIV_ZIP_DEBUG ut_a(page_zip_validate(page_zip, page_align(rec), index)); #endif /* UNIV_ZIP_DEBUG */ } /** Parses a log record of writing a BLOB pointer of a record. @return end of log record or NULL */ UNIV_INTERN byte* <API key>( byte* ptr, /*!< in: redo log buffer */ byte* end_ptr,/*!< in: redo log buffer end */ page_t* page, /*!< in/out: uncompressed page */ page_zip_des_t* page_zip)/*!< in/out: compressed page */ { ulint offset; ulint z_offset; ut_ad(!page == !page_zip); if (UNIV_UNLIKELY (end_ptr < ptr + (2 + 2 + <API key>))) { return(NULL); } offset = mach_read_from_2(ptr); z_offset = mach_read_from_2(ptr + 2); if (UNIV_UNLIKELY(offset < PAGE_ZIP_START) || UNIV_UNLIKELY(offset >= UNIV_PAGE_SIZE) || UNIV_UNLIKELY(z_offset >= UNIV_PAGE_SIZE)) { corrupt: recv_sys->found_corrupt_log = TRUE; return(NULL); } if (page) { if (UNIV_UNLIKELY(!page_zip) || UNIV_UNLIKELY(!page_is_leaf(page))) { goto corrupt; } #ifdef UNIV_ZIP_DEBUG ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ memcpy(page + offset, ptr + 4, <API key>); memcpy(page_zip->data + z_offset, ptr + 4, <API key>); #ifdef UNIV_ZIP_DEBUG ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ } return(ptr + (2 + 2 + <API key>)); } /** Write a BLOB pointer of a record on the leaf page of a clustered index. The information must already have been updated on the uncompressed page. */ UNIV_INTERN void <API key>( page_zip_des_t* page_zip,/*!< in/out: compressed page */ const byte* rec, /*!< in/out: record whose data is being written */ dict_index_t* index, /*!< in: index of the page */ const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ ulint n, /*!< in: column index */ mtr_t* mtr) /*!< in: mini-transaction handle, or NULL if no logging is needed */ { const byte* field; byte* externs; const page_t* page = page_align(rec); ulint blob_no; ulint len; ut_ad(PAGE_ZIP_MATCH(rec, page_zip)); ut_ad(<API key>((page_t*) page)); ut_ad(<API key>(page_zip)); ut_ad(page_zip_get_size(page_zip) > PAGE_DATA + page_zip_dir_size(page_zip)); ut_ad(rec_offs_comp(offsets)); ut_ad(rec_offs_validate(rec, NULL, offsets)); ut_ad(rec_offs_any_extern(offsets)); ut_ad(rec_offs_nth_extern(offsets, n)); ut_ad(page_zip->m_start >= PAGE_DATA); ut_ad(page_zip_header_cmp(page_zip, page)); ut_ad(page_is_leaf(page)); ut_ad(dict_index_is_clust(index)); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets)); UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets), rec_offs_extra_size(offsets)); blob_no = <API key>(page_zip, rec, index) + <API key>(rec, index, n); ut_a(blob_no < page_zip->n_blobs); externs = page_zip->data + page_zip_get_size(page_zip) - (page_dir_get_n_heap(page) - <API key>) * (<API key> + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); field = rec_get_nth_field(rec, offsets, n, &len); externs -= (blob_no + 1) * <API key>; field += len - <API key>; memcpy(externs, field, <API key>); #ifdef UNIV_ZIP_DEBUG ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ if (mtr) { #ifndef UNIV_HOTBACKUP byte* log_ptr = mlog_open( mtr, 11 + 2 + 2 + <API key>); if (UNIV_UNLIKELY(!log_ptr)) { return; } log_ptr = <API key>( (byte*) field, <API key>, log_ptr, mtr); mach_write_to_2(log_ptr, page_offset(field)); log_ptr += 2; mach_write_to_2(log_ptr, externs - page_zip->data); log_ptr += 2; memcpy(log_ptr, externs, <API key>); log_ptr += <API key>; mlog_close(mtr, log_ptr); #endif /* !UNIV_HOTBACKUP */ } } /** Parses a log record of writing the node pointer of a record. @return end of log record or NULL */ UNIV_INTERN byte* <API key>( byte* ptr, /*!< in: redo log buffer */ byte* end_ptr,/*!< in: redo log buffer end */ page_t* page, /*!< in/out: uncompressed page */ page_zip_des_t* page_zip)/*!< in/out: compressed page */ { ulint offset; ulint z_offset; ut_ad(!page == !page_zip); if (UNIV_UNLIKELY(end_ptr < ptr + (2 + 2 + REC_NODE_PTR_SIZE))) { return(NULL); } offset = mach_read_from_2(ptr); z_offset = mach_read_from_2(ptr + 2); if (UNIV_UNLIKELY(offset < PAGE_ZIP_START) || UNIV_UNLIKELY(offset >= UNIV_PAGE_SIZE) || UNIV_UNLIKELY(z_offset >= UNIV_PAGE_SIZE)) { corrupt: recv_sys->found_corrupt_log = TRUE; return(NULL); } if (page) { byte* storage_end; byte* field; byte* storage; ulint heap_no; if (UNIV_UNLIKELY(!page_zip) || UNIV_UNLIKELY(page_is_leaf(page))) { goto corrupt; } #ifdef UNIV_ZIP_DEBUG ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ field = page + offset; storage = page_zip->data + z_offset; storage_end = page_zip_dir_start(page_zip); heap_no = 1 + (storage_end - storage) / REC_NODE_PTR_SIZE; if (UNIV_UNLIKELY((storage_end - storage) % REC_NODE_PTR_SIZE) || UNIV_UNLIKELY(heap_no < <API key>) || UNIV_UNLIKELY(heap_no >= page_dir_get_n_heap(page))) { goto corrupt; } memcpy(field, ptr + 4, REC_NODE_PTR_SIZE); memcpy(storage, ptr + 4, REC_NODE_PTR_SIZE); #ifdef UNIV_ZIP_DEBUG ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ } return(ptr + (2 + 2 + REC_NODE_PTR_SIZE)); } /** Write the node pointer of a record on a non-leaf compressed page. */ UNIV_INTERN void <API key>( page_zip_des_t* page_zip,/*!< in/out: compressed page */ byte* rec, /*!< in/out: record */ ulint size, /*!< in: data size of rec */ ulint ptr, /*!< in: node pointer */ mtr_t* mtr) /*!< in: mini-transaction, or NULL */ { byte* field; byte* storage; #ifdef UNIV_DEBUG page_t* page = page_align(rec); #endif /* UNIV_DEBUG */ ut_ad(PAGE_ZIP_MATCH(rec, page_zip)); ut_ad(<API key>(page)); ut_ad(<API key>(page_zip)); ut_ad(page_zip_get_size(page_zip) > PAGE_DATA + page_zip_dir_size(page_zip)); ut_ad(page_rec_is_comp(rec)); ut_ad(page_zip->m_start >= PAGE_DATA); ut_ad(page_zip_header_cmp(page_zip, page)); ut_ad(!page_is_leaf(page)); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); UNIV_MEM_ASSERT_RW(rec, size); storage = page_zip_dir_start(page_zip) - (rec_get_heap_no_new(rec) - 1) * REC_NODE_PTR_SIZE; field = rec + size - REC_NODE_PTR_SIZE; #if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG ut_a(!memcmp(storage, field, REC_NODE_PTR_SIZE)); #endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */ #if REC_NODE_PTR_SIZE != 4 # error "REC_NODE_PTR_SIZE != 4" #endif mach_write_to_4(field, ptr); memcpy(storage, field, REC_NODE_PTR_SIZE); if (mtr) { #ifndef UNIV_HOTBACKUP byte* log_ptr = mlog_open(mtr, 11 + 2 + 2 + REC_NODE_PTR_SIZE); if (UNIV_UNLIKELY(!log_ptr)) { return; } log_ptr = <API key>( field, <API key>, log_ptr, mtr); mach_write_to_2(log_ptr, page_offset(field)); log_ptr += 2; mach_write_to_2(log_ptr, storage - page_zip->data); log_ptr += 2; memcpy(log_ptr, field, REC_NODE_PTR_SIZE); log_ptr += REC_NODE_PTR_SIZE; mlog_close(mtr, log_ptr); #endif /* !UNIV_HOTBACKUP */ } } /** Write the trx_id and roll_ptr of a record on a B-tree leaf node page. */ UNIV_INTERN void <API key>( page_zip_des_t* page_zip,/*!< in/out: compressed page */ byte* rec, /*!< in/out: record */ const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ ulint trx_id_col,/*!< in: column number of TRX_ID in rec */ trx_id_t trx_id, /*!< in: transaction identifier */ roll_ptr_t roll_ptr)/*!< in: roll_ptr */ { byte* field; byte* storage; #ifdef UNIV_DEBUG page_t* page = page_align(rec); #endif /* UNIV_DEBUG */ ulint len; ut_ad(PAGE_ZIP_MATCH(rec, page_zip)); ut_ad(<API key>(page)); ut_ad(<API key>(page_zip)); ut_ad(page_zip_get_size(page_zip) > PAGE_DATA + page_zip_dir_size(page_zip)); ut_ad(rec_offs_validate(rec, NULL, offsets)); ut_ad(rec_offs_comp(offsets)); ut_ad(page_zip->m_start >= PAGE_DATA); ut_ad(page_zip_header_cmp(page_zip, page)); ut_ad(page_is_leaf(page)); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); storage = page_zip_dir_start(page_zip) - (rec_get_heap_no_new(rec) - 1) * (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); #if DATA_TRX_ID + 1 != DATA_ROLL_PTR # error "DATA_TRX_ID + 1 != DATA_ROLL_PTR" #endif field = rec_get_nth_field(rec, offsets, trx_id_col, &len); ut_ad(len == DATA_TRX_ID_LEN); ut_ad(field + DATA_TRX_ID_LEN == rec_get_nth_field(rec, offsets, trx_id_col + 1, &len)); ut_ad(len == DATA_ROLL_PTR_LEN); #if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG ut_a(!memcmp(storage, field, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN)); #endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */ #if DATA_TRX_ID_LEN != 6 # error "DATA_TRX_ID_LEN != 6" #endif mach_write_to_6(field, trx_id); #if DATA_ROLL_PTR_LEN != 7 # error "DATA_ROLL_PTR_LEN != 7" #endif mach_write_to_7(field + DATA_TRX_ID_LEN, roll_ptr); memcpy(storage, field, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets)); UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets), rec_offs_extra_size(offsets)); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); } /** Clear an area on the uncompressed and compressed page. Do not clear the data payload, as that would grow the modification log. */ static void page_zip_clear_rec( page_zip_des_t* page_zip, /*!< in/out: compressed page */ byte* rec, /*!< in: record to clear */ const dict_index_t* index, /*!< in: index of rec */ const ulint* offsets) /*!< in: rec_get_offsets(rec, index) */ { ulint heap_no; page_t* page = page_align(rec); byte* storage; byte* field; ulint len; /* page_zip_validate() would fail here if a record containing externally stored columns is being deleted. */ ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(!page_zip_dir_find(page_zip, page_offset(rec))); ut_ad(<API key>(page_zip, page_offset(rec))); ut_ad(page_zip_header_cmp(page_zip, page)); heap_no = rec_get_heap_no_new(rec); ut_ad(heap_no >= <API key>); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets)); UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets), rec_offs_extra_size(offsets)); if (!page_is_leaf(page)) { /* Clear node_ptr. On the compressed page, there is an array of node_ptr immediately before the dense page directory, at the very end of the page. */ storage = page_zip_dir_start(page_zip); ut_ad(<API key>(index) == rec_offs_n_fields(offsets) - 1); field = rec_get_nth_field(rec, offsets, rec_offs_n_fields(offsets) - 1, &len); ut_ad(len == REC_NODE_PTR_SIZE); ut_ad(!rec_offs_any_extern(offsets)); memset(field, 0, REC_NODE_PTR_SIZE); memset(storage - (heap_no - 1) * REC_NODE_PTR_SIZE, 0, REC_NODE_PTR_SIZE); } else if (dict_index_is_clust(index)) { /* Clear trx_id and roll_ptr. On the compressed page, there is an array of these fields immediately before the dense page directory, at the very end of the page. */ const ulint trx_id_pos = <API key>( <API key>( index->table, DATA_TRX_ID), index); storage = page_zip_dir_start(page_zip); field = rec_get_nth_field(rec, offsets, trx_id_pos, &len); ut_ad(len == DATA_TRX_ID_LEN); memset(field, 0, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); memset(storage - (heap_no - 1) * (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN), 0, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); if (rec_offs_any_extern(offsets)) { ulint i; for (i = rec_offs_n_fields(offsets); i /* Clear all BLOB pointers in order to make page_zip_validate() pass. */ if (rec_offs_nth_extern(offsets, i)) { field = rec_get_nth_field( rec, offsets, i, &len); ut_ad(len == <API key>); memset(field + len - <API key>, 0, <API key>); } } } } else { ut_ad(!rec_offs_any_extern(offsets)); } #ifdef UNIV_ZIP_DEBUG ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ } /** Write the "deleted" flag of a record on a compressed page. The flag must already have been written on the uncompressed page. */ UNIV_INTERN void <API key>( page_zip_des_t* page_zip,/*!< in/out: compressed page */ const byte* rec, /*!< in: record on the uncompressed page */ ulint flag) /*!< in: the deleted flag (nonzero=TRUE) */ { byte* slot = page_zip_dir_find(page_zip, page_offset(rec)); ut_a(slot); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); if (flag) { *slot |= (<API key> >> 8); } else { *slot &= ~(<API key> >> 8); } #ifdef UNIV_ZIP_DEBUG ut_a(page_zip_validate(page_zip, page_align(rec), NULL)); #endif /* UNIV_ZIP_DEBUG */ } /** Write the "owned" flag of a record on a compressed page. The n_owned field must already have been written on the uncompressed page. */ UNIV_INTERN void <API key>( page_zip_des_t* page_zip,/*!< in/out: compressed page */ const byte* rec, /*!< in: record on the uncompressed page */ ulint flag) /*!< in: the owned flag (nonzero=TRUE) */ { byte* slot = page_zip_dir_find(page_zip, page_offset(rec)); ut_a(slot); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); if (flag) { *slot |= (<API key> >> 8); } else { *slot &= ~(<API key> >> 8); } } /** Insert a record to the dense page directory. */ UNIV_INTERN void page_zip_dir_insert( page_zip_des_t* page_zip,/*!< in/out: compressed page */ const byte* prev_rec,/*!< in: record after which to insert */ const byte* free_rec,/*!< in: record from which rec was allocated, or NULL */ byte* rec) /*!< in: record to insert */ { ulint n_dense; byte* slot_rec; byte* slot_free; ut_ad(prev_rec != rec); ut_ad(page_rec_get_next((rec_t*) prev_rec) == rec); ut_ad(<API key>(page_zip)); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); if (page_rec_is_infimum(prev_rec)) { /* Use the first slot. */ slot_rec = page_zip->data + page_zip_get_size(page_zip); } else { byte* end = page_zip->data + page_zip_get_size(page_zip); byte* start = end - <API key>(page_zip); if (UNIV_LIKELY(!free_rec)) { /* PAGE_N_RECS was already incremented in <API key>(), but the dense directory slot at that position contains garbage. Skip it. */ start += <API key>; } slot_rec = <API key>(start, end, page_offset(prev_rec)); ut_a(slot_rec); } /* Read the old n_dense (n_heap may have been incremented). */ n_dense = page_dir_get_n_heap(page_zip->data) - (<API key> + 1); if (UNIV_LIKELY_NULL(free_rec)) { /* The record was allocated from the free list. Shift the dense directory only up to that slot. Note that in this case, n_dense is actually off by one, because <API key>() did not increment n_heap. */ ut_ad(rec_get_heap_no_new(rec) < n_dense + 1 + <API key>); ut_ad(rec >= free_rec); slot_free = page_zip_dir_find(page_zip, page_offset(free_rec)); ut_ad(slot_free); slot_free += <API key>; } else { /* The record was allocated from the heap. Shift the entire dense directory. */ ut_ad(rec_get_heap_no_new(rec) == n_dense + <API key>); /* Shift to the end of the dense page directory. */ slot_free = page_zip->data + page_zip_get_size(page_zip) - <API key> * n_dense; } /* Shift the dense directory to allocate place for rec. */ memmove(slot_free - <API key>, slot_free, slot_rec - slot_free); /* Write the entry for the inserted record. The "owned" and "deleted" flags must be zero. */ mach_write_to_2(slot_rec - <API key>, page_offset(rec)); } /** Shift the dense page directory and the array of BLOB pointers when a record is deleted. */ UNIV_INTERN void page_zip_dir_delete( page_zip_des_t* page_zip, /*!< in/out: compressed page */ byte* rec, /*!< in: deleted record */ const dict_index_t* index, /*!< in: index of rec */ const ulint* offsets, /*!< in: rec_get_offsets(rec) */ const byte* free) /*!< in: previous start of the free list */ { byte* slot_rec; byte* slot_free; ulint n_ext; page_t* page = page_align(rec); ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(rec_offs_comp(offsets)); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets)); UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets), rec_offs_extra_size(offsets)); slot_rec = page_zip_dir_find(page_zip, page_offset(rec)); ut_a(slot_rec); /* This could not be done before page_zip_dir_find(). */ <API key>(page, page_zip, PAGE_N_RECS, (ulint)(page_get_n_recs(page) - 1)); if (UNIV_UNLIKELY(!free)) { /* Make the last slot the start of the free list. */ slot_free = page_zip->data + page_zip_get_size(page_zip) - <API key> * (page_dir_get_n_heap(page_zip->data) - <API key>); } else { slot_free = <API key>(page_zip, page_offset(free)); ut_a(slot_free < slot_rec); /* Grow the free list by one slot by moving the start. */ slot_free += <API key>; } if (UNIV_LIKELY(slot_rec > slot_free)) { memmove(slot_free + <API key>, slot_free, slot_rec - slot_free); } /* Write the entry for the deleted record. The "owned" and "deleted" flags will be cleared. */ mach_write_to_2(slot_free, page_offset(rec)); if (!page_is_leaf(page) || !dict_index_is_clust(index)) { ut_ad(!rec_offs_any_extern(offsets)); goto skip_blobs; } n_ext = rec_offs_n_extern(offsets); if (UNIV_UNLIKELY(n_ext)) { /* Shift and zero fill the array of BLOB pointers. */ ulint blob_no; byte* externs; byte* ext_end; blob_no = <API key>(page_zip, rec, index); ut_a(blob_no + n_ext <= page_zip->n_blobs); externs = page_zip->data + page_zip_get_size(page_zip) - (page_dir_get_n_heap(page) - <API key>) * (<API key> + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); ext_end = externs - page_zip->n_blobs * <API key>; externs -= blob_no * <API key>; page_zip->n_blobs -= static_cast<unsigned>(n_ext); /* Shift and zero fill the array. */ memmove(ext_end + n_ext * <API key>, ext_end, (page_zip->n_blobs - blob_no) * <API key>); memset(ext_end, 0, n_ext * <API key>); } skip_blobs: /* The compression algorithm expects info_bits and n_owned to be 0 for deleted records. */ rec[-<API key>] = 0; /* info_bits and n_owned */ page_zip_clear_rec(page_zip, rec, index, offsets); } /** Add a slot to the dense page directory. */ UNIV_INTERN void <API key>( page_zip_des_t* page_zip, /*!< in/out: compressed page */ ulint is_clustered) /*!< in: nonzero for clustered index, zero for others */ { ulint n_dense; byte* dir; byte* stored; ut_ad(page_is_comp(page_zip->data)); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); /* Read the old n_dense (n_heap has already been incremented). */ n_dense = page_dir_get_n_heap(page_zip->data) - (<API key> + 1); dir = page_zip->data + page_zip_get_size(page_zip) - <API key> * n_dense; if (!page_is_leaf(page_zip->data)) { ut_ad(!page_zip->n_blobs); stored = dir - n_dense * REC_NODE_PTR_SIZE; } else if (is_clustered) { /* Move the BLOB pointer array backwards to make space for the roll_ptr and trx_id columns and the dense directory slot. */ byte* externs; stored = dir - n_dense * (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); externs = stored - page_zip->n_blobs * <API key>; ASSERT_ZERO(externs - (<API key> + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN), <API key> + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); memmove(externs - (<API key> + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN), externs, stored - externs); } else { stored = dir - page_zip->n_blobs * <API key>; ASSERT_ZERO(stored - <API key>, <API key>); } /* Move the uncompressed area backwards to make space for one directory slot. */ memmove(stored - <API key>, stored, dir - stored); } /** Parses a log record of writing to the header of a page. @return end of log record or NULL */ UNIV_INTERN byte* <API key>( byte* ptr, /*!< in: redo log buffer */ byte* end_ptr,/*!< in: redo log buffer end */ page_t* page, /*!< in/out: uncompressed page */ page_zip_des_t* page_zip)/*!< in/out: compressed page */ { ulint offset; ulint len; ut_ad(ptr && end_ptr); ut_ad(!page == !page_zip); if (UNIV_UNLIKELY(end_ptr < ptr + (1 + 1))) { return(NULL); } offset = (ulint) *ptr++; len = (ulint) *ptr++; if (UNIV_UNLIKELY(!len) || UNIV_UNLIKELY(offset + len >= PAGE_DATA)) { corrupt: recv_sys->found_corrupt_log = TRUE; return(NULL); } if (UNIV_UNLIKELY(end_ptr < ptr + len)) { return(NULL); } if (page) { if (UNIV_UNLIKELY(!page_zip)) { goto corrupt; } #ifdef UNIV_ZIP_DEBUG ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ memcpy(page + offset, ptr, len); memcpy(page_zip->data + offset, ptr, len); #ifdef UNIV_ZIP_DEBUG ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ } return(ptr + len); } #ifndef UNIV_HOTBACKUP /** Write a log record of writing to the uncompressed header portion of a page. */ UNIV_INTERN void <API key>( const byte* data, /*!< in: data on the uncompressed page */ ulint length, /*!< in: length of the data */ mtr_t* mtr) /*!< in: mini-transaction */ { byte* log_ptr = mlog_open(mtr, 11 + 1 + 1); ulint offset = page_offset(data); ut_ad(offset < PAGE_DATA); ut_ad(offset + length < PAGE_DATA); #if PAGE_DATA > 255 # error "PAGE_DATA > 255" #endif ut_ad(length < 256); /* If no logging is requested, we may return now */ if (UNIV_UNLIKELY(!log_ptr)) { return; } log_ptr = <API key>( (byte*) data, <API key>, log_ptr, mtr); *log_ptr++ = (byte) offset; *log_ptr++ = (byte) length; mlog_close(mtr, log_ptr); <API key>(mtr, data, length); } #endif /* !UNIV_HOTBACKUP */ /** Reorganize and compress a page. This is a low-level operation for compressed pages, to be used when page_zip_compress() fails. On success, a redo log entry <API key> will be written. The function btr_page_reorganize() should be preferred whenever possible. IMPORTANT: if page_zip_reorganize() is invoked on a leaf page of a non-clustered index, the caller must update the insert buffer free bits in the same mini-transaction in such a way that the modification will be redo-logged. @return TRUE on success, FALSE on failure; page_zip will be left intact on failure, but page will be overwritten. */ UNIV_INTERN ibool page_zip_reorganize( buf_block_t* block, /*!< in/out: page with compressed page; on the compressed page, in: size; out: data, n_blobs, m_start, m_end, m_nonempty */ dict_index_t* index, /*!< in: index of the B-tree node */ mtr_t* mtr) /*!< in: mini-transaction */ { #ifndef UNIV_HOTBACKUP buf_pool_t* buf_pool = buf_pool_from_block(block); #endif /* !UNIV_HOTBACKUP */ page_zip_des_t* page_zip = <API key>(block); page_t* page = buf_block_get_frame(block); buf_block_t* temp_block; page_t* temp_page; ulint log_mode; ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(page_is_comp(page)); ut_ad(!dict_index_is_ibuf(index)); /* Note that page_zip_validate(page_zip, page, index) may fail here. */ UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); /* Disable logging */ log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE); #ifndef UNIV_HOTBACKUP temp_block = buf_block_alloc(buf_pool); <API key>(block); block-><API key> = TRUE; #else /* !UNIV_HOTBACKUP */ ut_ad(block == back_block1); temp_block = back_block2; #endif /* !UNIV_HOTBACKUP */ temp_page = temp_block->frame; /* Copy the old page to temporary space */ buf_frame_copy(temp_page, page); btr_blob_dbg_remove(page, index, "zip_reorg"); /* Recreate the page: note that global data on page (possible segment headers, next page-field, etc.) is preserved intact */ page_create(block, mtr, TRUE); /* Copy the records from the temporary space to the recreated page; do not copy the lock bits yet */ <API key>(block, temp_block, <API key>(temp_page), index, mtr); if (!dict_index_is_clust(index) && page_is_leaf(temp_page)) { /* Copy max trx id to recreated page */ trx_id_t max_trx_id = page_get_max_trx_id(temp_page); page_set_max_trx_id(block, NULL, max_trx_id, NULL); ut_ad(max_trx_id != 0); } /* Restore logging. */ mtr_set_log_mode(mtr, log_mode); if (!page_zip_compress(page_zip, page, index, <API key>, mtr)) { #ifndef UNIV_HOTBACKUP buf_block_free(temp_block); #endif /* !UNIV_HOTBACKUP */ return(FALSE); } <API key>(block, temp_block); #ifndef UNIV_HOTBACKUP buf_block_free(temp_block); #endif /* !UNIV_HOTBACKUP */ return(TRUE); } #ifndef UNIV_HOTBACKUP /** Copy the records of a page byte for byte. Do not copy the page header or trailer, except those B-tree header fields that are directly related to the storage of records. Also copy PAGE_MAX_TRX_ID. NOTE: The caller must update the lock table and the adaptive hash index. */ UNIV_INTERN void page_zip_copy_recs( page_zip_des_t* page_zip, /*!< out: copy of src_zip (n_blobs, m_start, m_end, m_nonempty, data[0..size-1]) */ page_t* page, /*!< out: copy of src */ const page_zip_des_t* src_zip, /*!< in: compressed page */ const page_t* src, /*!< in: page */ dict_index_t* index, /*!< in: index of the B-tree */ mtr_t* mtr) /*!< in: mini-transaction */ { ut_ad(<API key>(mtr, page, MTR_MEMO_PAGE_X_FIX)); ut_ad(<API key>(mtr, src, MTR_MEMO_PAGE_X_FIX)); ut_ad(!dict_index_is_ibuf(index)); #ifdef UNIV_ZIP_DEBUG /* The B-tree operations that call this function may set FIL_PAGE_PREV or PAGE_LEVEL, causing a temporary min_rec_flag mismatch. A strict page_zip_validate() will be executed later during the B-tree operations. */ ut_a(<API key>(src_zip, src, index, TRUE)); #endif /* UNIV_ZIP_DEBUG */ ut_a(page_zip_get_size(page_zip) == page_zip_get_size(src_zip)); if (UNIV_UNLIKELY(src_zip->n_blobs)) { ut_a(page_is_leaf(src)); ut_a(dict_index_is_clust(index)); } /* The PAGE_MAX_TRX_ID must be set on leaf pages of secondary indexes. It does not matter on other pages. */ ut_a(dict_index_is_clust(index) || !page_is_leaf(src) || page_get_max_trx_id(src)); UNIV_MEM_ASSERT_W(page, UNIV_PAGE_SIZE); UNIV_MEM_ASSERT_W(page_zip->data, page_zip_get_size(page_zip)); UNIV_MEM_ASSERT_RW(src, UNIV_PAGE_SIZE); UNIV_MEM_ASSERT_RW(src_zip->data, page_zip_get_size(page_zip)); /* Copy those B-tree page header fields that are related to the records stored in the page. Also copy the field PAGE_MAX_TRX_ID. Skip the rest of the page header and trailer. On the compressed page, there is no trailer. */ #if PAGE_MAX_TRX_ID + 8 != <API key> # error "PAGE_MAX_TRX_ID + 8 != <API key>" #endif memcpy(PAGE_HEADER + page, PAGE_HEADER + src, <API key>); memcpy(PAGE_DATA + page, PAGE_DATA + src, UNIV_PAGE_SIZE - PAGE_DATA - FIL_PAGE_DATA_END); memcpy(PAGE_HEADER + page_zip->data, PAGE_HEADER + src_zip->data, <API key>); memcpy(PAGE_DATA + page_zip->data, PAGE_DATA + src_zip->data, page_zip_get_size(page_zip) - PAGE_DATA); /* Copy all fields of src_zip to page_zip, except the pointer to the compressed data page. */ { page_zip_t* data = page_zip->data; memcpy(page_zip, src_zip, sizeof *page_zip); page_zip->data = data; } ut_ad(<API key>(page_zip, dict_index_is_clust(index)) + page_zip->m_end < page_zip_get_size(page_zip)); if (!page_is_leaf(src) && UNIV_UNLIKELY(mach_read_from_4(src + FIL_PAGE_PREV) == FIL_NULL) && UNIV_LIKELY(mach_read_from_4(page + FIL_PAGE_PREV) != FIL_NULL)) { /* Clear the <API key> of the first user record. */ ulint offs = rec_get_next_offs(page + PAGE_NEW_INFIMUM, TRUE); if (UNIV_LIKELY(offs != PAGE_NEW_SUPREMUM)) { rec_t* rec = page + offs; ut_a(rec[-<API key>] & <API key>); rec[-<API key>] &= ~ <API key>; } } #ifdef UNIV_ZIP_DEBUG ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ btr_blob_dbg_add(page, index, "page_zip_copy_recs"); <API key>(page_zip, page, index, mtr); } #endif /* !UNIV_HOTBACKUP */ /** Parses a log record of compressing an index page. @return end of log record or NULL */ UNIV_INTERN byte* <API key>( byte* ptr, /*!< in: buffer */ byte* end_ptr,/*!< in: buffer end */ page_t* page, /*!< out: uncompressed page */ page_zip_des_t* page_zip)/*!< out: compressed page */ { ulint size; ulint trailer_size; ut_ad(ptr && end_ptr); ut_ad(!page == !page_zip); if (UNIV_UNLIKELY(ptr + (2 + 2) > end_ptr)) { return(NULL); } size = mach_read_from_2(ptr); ptr += 2; trailer_size = mach_read_from_2(ptr); ptr += 2; if (UNIV_UNLIKELY(ptr + 8 + size + trailer_size > end_ptr)) { return(NULL); } if (page) { if (UNIV_UNLIKELY(!page_zip) || UNIV_UNLIKELY(page_zip_get_size(page_zip) < size)) { corrupt: recv_sys->found_corrupt_log = TRUE; return(NULL); } memcpy(page_zip->data + FIL_PAGE_PREV, ptr, 4); memcpy(page_zip->data + FIL_PAGE_NEXT, ptr + 4, 4); memcpy(page_zip->data + FIL_PAGE_TYPE, ptr + 8, size); memset(page_zip->data + FIL_PAGE_TYPE + size, 0, page_zip_get_size(page_zip) - trailer_size - (FIL_PAGE_TYPE + size)); memcpy(page_zip->data + page_zip_get_size(page_zip) - trailer_size, ptr + 8 + size, trailer_size); if (UNIV_UNLIKELY(!page_zip_decompress(page_zip, page, TRUE))) { goto corrupt; } } return(ptr + 8 + size + trailer_size); } /** Calculate the compressed page checksum. @return page checksum */ UNIV_INTERN ulint <API key>( const void* data, /*!< in: compressed page */ ulint size, /*!< in: size of compressed page */ <API key> algo) /*!< in: algorithm to use */ { uLong adler; ib_uint32_t crc32; const Bytef* s = static_cast<const byte*>(data); /* Exclude <API key>, FIL_PAGE_LSN, and <API key> from the checksum. */ switch (algo) { case <API key>: case <API key>: ut_ad(size > <API key>); crc32 = ut_crc32(s + FIL_PAGE_OFFSET, FIL_PAGE_LSN - FIL_PAGE_OFFSET) ^ ut_crc32(s + FIL_PAGE_TYPE, 2) ^ ut_crc32(s + <API key>, size - <API key>); return((ulint) crc32); case <API key>: case <API key>: ut_ad(size > <API key>); adler = adler32(0L, s + FIL_PAGE_OFFSET, FIL_PAGE_LSN - FIL_PAGE_OFFSET); adler = adler32(adler, s + FIL_PAGE_TYPE, 2); adler = adler32( adler, s + <API key>, static_cast<uInt>(size) - <API key>); return((ulint) adler); case <API key>: case <API key>: return(<API key>); /* no default so the compiler will emit a warning if new enum is added and not handled here */ } ut_error; return(0); } /** Verify a compressed page's checksum. @return TRUE if the stored checksum is valid according to the value of <API key> */ UNIV_INTERN ibool <API key>( const void* data, /*!< in: compressed page */ ulint size) /*!< in: size of compressed page */ { ib_uint32_t stored; ib_uint32_t calc; ib_uint32_t crc32 = 0 /* silence bogus warning */; ib_uint32_t innodb = 0 /* silence bogus warning */; stored = static_cast<ib_uint32_t>(mach_read_from_4( static_cast<const unsigned char*>(data) + <API key>)); /* declare empty pages non-corrupted */ if (stored == 0) { /* make sure that the page is really empty */ ulint i; for (i = 0; i < size; i++) { if (*((const char*) data + i) != 0) { return(FALSE); } } return(TRUE); } calc = static_cast<ib_uint32_t>(<API key>( data, size, static_cast<<API key>>( <API key>))); if (stored == calc) { return(TRUE); } switch ((<API key>) <API key>) { case <API key>: case <API key>: case <API key>: return(stored == calc); case <API key>: if (stored == <API key>) { return(TRUE); } crc32 = calc; innodb = static_cast<ib_uint32_t>(<API key>( data, size, <API key>)); break; case <API key>: if (stored == <API key>) { return(TRUE); } crc32 = static_cast<ib_uint32_t>(<API key>( data, size, <API key>)); innodb = calc; break; case <API key>: return(TRUE); /* no default so the compiler will emit a warning if new enum is added and not handled here */ } return(stored == crc32 || stored == innodb); }
package pe.edu.upeu.modelo; import java.io.Serializable; import java.util.Collection; import java.util.Date; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; /** * * @author hp */ @Entity @Table(name = "conf_periodo") @XmlRootElement @NamedQueries({ @NamedQuery(name = "ConfPeriodo.findAll", query = "SELECT c FROM ConfPeriodo c")}) public class ConfPeriodo implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id_periodo") private Integer idPeriodo; @Basic(optional = false) @Column(name = "periodo") private String periodo; @Basic(optional = false) @Column(name = "descripcion") private String descripcion; @Basic(optional = false) @Column(name = "fecha_inicio") @Temporal(TemporalType.DATE) private Date fechaInicio; @Basic(optional = false) @Column(name = "fecha_fin") @Temporal(TemporalType.DATE) private Date fechaFin; @Basic(optional = false) @Column(name = "estado") private String estado; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPeriodo") private Collection<GloAreaEje> <API key>; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPeriodo") private Collection<GloEstadoArea> <API key>; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPeriodo") private Collection<<API key>> <API key>; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPeriodo") private Collection<GloEstadoFilial> <API key>; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPeriodo") private Collection<<API key>> <API key>; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPeriodo") private Collection<GloMeta> gloMetaCollection; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPeriodo") private Collection<<API key>> <API key>; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPeriodo") private Collection<<API key>> <API key>; @JoinColumn(name = "id_temporada", <API key> = "id_temporada") @ManyToOne(optional = false) private ConfTemporada idTemporada; public ConfPeriodo() { } public ConfPeriodo(Integer idPeriodo) { this.idPeriodo = idPeriodo; } public ConfPeriodo(Integer idPeriodo, String periodo, String descripcion, Date fechaInicio, Date fechaFin, String estado) { this.idPeriodo = idPeriodo; this.periodo = periodo; this.descripcion = descripcion; this.fechaInicio = fechaInicio; this.fechaFin = fechaFin; this.estado = estado; } public Integer getIdPeriodo() { return idPeriodo; } public void setIdPeriodo(Integer idPeriodo) { this.idPeriodo = idPeriodo; } public String getPeriodo() { return periodo; } public void setPeriodo(String periodo) { this.periodo = periodo; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public Date getFechaInicio() { return fechaInicio; } public void setFechaInicio(Date fechaInicio) { this.fechaInicio = fechaInicio; } public Date getFechaFin() { return fechaFin; } public void setFechaFin(Date fechaFin) { this.fechaFin = fechaFin; } public String getEstado() { return estado; } public void setEstado(String estado) { this.estado = estado; } @XmlTransient public Collection<GloAreaEje> <API key>() { return <API key>; } public void <API key>(Collection<GloAreaEje> <API key>) { this.<API key> = <API key>; } @XmlTransient public Collection<GloEstadoArea> <API key>() { return <API key>; } public void <API key>(Collection<GloEstadoArea> <API key>) { this.<API key> = <API key>; } @XmlTransient public Collection<<API key>> <API key>() { return <API key>; } public void <API key>(Collection<<API key>> <API key>) { this.<API key> = <API key>; } @XmlTransient public Collection<GloEstadoFilial> <API key>() { return <API key>; } public void <API key>(Collection<GloEstadoFilial> <API key>) { this.<API key> = <API key>; } @XmlTransient public Collection<<API key>> <API key>() { return <API key>; } public void <API key>(Collection<<API key>> <API key>) { this.<API key> = <API key>; } @XmlTransient public Collection<GloMeta> <API key>() { return gloMetaCollection; } public void <API key>(Collection<GloMeta> gloMetaCollection) { this.gloMetaCollection = gloMetaCollection; } @XmlTransient public Collection<<API key>> <API key>() { return <API key>; } public void <API key>(Collection<<API key>> <API key>) { this.<API key> = <API key>; } @XmlTransient public Collection<<API key>> <API key>() { return <API key>; } public void <API key>(Collection<<API key>> <API key>) { this.<API key> = <API key>; } public ConfTemporada getIdTemporada() { return idTemporada; } public void setIdTemporada(ConfTemporada idTemporada) { this.idTemporada = idTemporada; } @Override public int hashCode() { int hash = 0; hash += (idPeriodo != null ? idPeriodo.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof ConfPeriodo)) { return false; } ConfPeriodo other = (ConfPeriodo) object; if ((this.idPeriodo == null && other.idPeriodo != null) || (this.idPeriodo != null && !this.idPeriodo.equals(other.idPeriodo))) { return false; } return true; } @Override public String toString() { return "pe.edu.upeu.modelo.ConfPeriodo[ idPeriodo=" + idPeriodo + " ]"; } }
package com.atlach.trafficdataloader; import java.util.ArrayList; /* Short Desc: Storage object for Trip info */ /* Trip Info > Trips > Routes */ public class TripInfo { private int tripCount = 0; public ArrayList<Trip> trips = null; public String date; public String origin; public String destination; public TripInfo() { trips = new ArrayList<Trip>(); } public int addTrip() { Trip temp = new Trip(); if (trips.add(temp) == false) { /* Failed */ return -1; } tripCount++; return trips.indexOf(temp); } public int addRouteToTrip(int tripId, String routeName, String mode, String dist, String agency, String start, String end, String points) { int result = -1; Trip temp = trips.get(tripId); if (temp != null) { result = temp.addRoute(routeName, mode, dist, agency, start, end, points); } return result; } public int getTripCount() { return tripCount; } public static class Trip { public double totalDist = 0.0; public double totalCost = 0.0; public int totalTraffic = 0; private int transfers = 0; public ArrayList<Route> routes = null; public Trip() { routes = new ArrayList<Route>(); }; public int addRoute(String routeName, String mode, String dist, String agency, String start, String end, String points) { Route temp = new Route(); temp.name = routeName; temp.mode = mode; temp.dist = dist; temp.agency = agency; temp.start = start; temp.end = end; temp.points = points; if (routes.add(temp) == false) { /* Failed */ return -1; } transfers++; return routes.indexOf(temp); } public int getTransfers() { return transfers; } } public static class Route { /* Object fields */ public String name = ""; public String mode = ""; public String dist = "0.0"; public String agency = ""; public String start = ""; public String end = ""; public String points = ""; public String cond = ""; //public String cost = "0.0"; public double costMatrix[] = {0.0, 0.0, 0.0, 0.0}; public double getRegularCost(boolean isDiscounted) { if (isDiscounted) { return costMatrix[1]; } return costMatrix[0]; } public double getSpecialCost(boolean isDiscounted) { if (isDiscounted) { return costMatrix[2]; } return costMatrix[3]; } } }
package org.adastraeducation.liquiz.equation; import java.util.*; import java.util.regex.*; import org.adastraeducation.liquiz.*; /** * Present equations with random variables. * It has two ways to parse the equations in string[]. One is in infix, and the other is in the RPN. * @author Yingzhu Wang * */ public class Equation implements Displayable { private Expression func; private double correctAnswer; private HashMap<String,Var> variables; public Equation(String equation, HashMap<String,Var> variables){ this.variables=variables; ArrayList<String> equationSplit = this.parseQuestion(equation); this.func = this.parseInfix(equationSplit); correctAnswer = func.eval(); } public Equation(Expression func, HashMap<String,Var> variables){ this.func = func; this.variables = variables; correctAnswer=func.eval(); } public Equation(Expression func){ this.func = func; this.variables = new HashMap<String,Var>(); correctAnswer=func.eval(); } public void setExpression(Expression e){ this.func=e; correctAnswer=func.eval(); } public void setVariables(HashMap<String,Var> variables){ this.variables = variables; } public String getTagName() { return "Equation"; } public Expression parseInfix(ArrayList<String> s){ Tree t = new Tree(s); ArrayList<String> rpn = t.traverse(); return parseRPN(rpn); } // Precompile all regular expressions used in parsing private static final Pattern parseDigits = Pattern.compile("^[0-9]+$"); private static final Pattern wordPattern = Pattern.compile("[\\W]|([\\w]*)"); /*TODO: We can do much better than a switch statement, * but it would require a hash map and lots of little objects */ //TODO: Check if binary ops are backgwards? a b - ???? public Expression parseRPN(ArrayList<String> s) { Stack<Expression> stack = new Stack<Expression>(); for(int i = 0; i<s.size(); i++){ String temp = s.get(i); if (Functions.MATHFUNCTIONS.contains(temp)) { Expression op1 ; Expression op2 ; switch(temp){ case "+": op2=stack.pop(); op1=stack.pop(); stack.push(new Plus(op1,op2)); break; case "-": op2=stack.pop(); op1=stack.pop(); stack.push( new Minus(op1,op2)); break; case "*": op2=stack.pop(); op1=stack.pop(); stack.push( new Multi(op1,op2));break; case "/": op2=stack.pop(); op1=stack.pop(); stack.push( new Div(op1,op2));break; case "sin": op1=stack.pop(); stack.push(new Sin(op1));break; case "cos": op1=stack.pop(); stack.push(new Cos(op1));break; case "tan": op1=stack.pop(); stack.push(new Tan(op1));break; case "abs": op1=stack.pop(); stack.push(new Abs(op1));break; case "Asin": op1=stack.pop(); stack.push(new Asin(op1));break; case "Atan": op1=stack.pop(); stack.push(new Atan(op1));break; case "neg": op1=stack.pop(); stack.push(new Neg(op1));break; case "sqrt": op1=stack.pop(); stack.push(new Sqrt(op1));break; default:break; } } //deal with the space else if(temp.equals("")) ; else{ Matcher m = parseDigits.matcher(temp); if (m.matches()){ double x = Double.parseDouble(temp); stack.push(new Constant(x)); } else{ stack.push(variables.get(temp)); } } } return stack.pop(); } public ArrayList<String> parseQuestion(String question){ ArrayList<String> s = new ArrayList<String>(); Matcher m = wordPattern.matcher(question); while(m.find()){ s.add(m.group()); } return s; } // public ResultSet readDatabase(String sql){ // return DatabaseMgr.select(sql); // public void writeDatabase(String sql){ // DatabaseMgr.update(sql); public Expression getExpression(){ return func; } public double getCorrectAnswer(){ return correctAnswer; } @Override public void writeHTML(StringBuilder b) { func.infixReplaceVar(b); } @Override public void writeXML(StringBuilder b) { b.append("<Equation question='"); func.infix(b); b.append("'></Equation>"); } @Override public void writeJS(StringBuilder b) { } }
package com.github.luksdlt92; import java.util.ArrayList; /* * DoubleJumpReload plugin * Made by luksdlt92 and Abdalion */ import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; import com.github.luksdlt92.commands.DoubleJumpCommand; import com.github.luksdlt92.listeners.JumpListener; public class DoubleJumpReload extends JavaPlugin implements Listener { public ArrayList<String> _players = new ArrayList<String>(); public ArrayList<String> _playersDisableJump = new ArrayList<String>(); @Override public void onEnable() { new JumpListener(this); this.getCommand("jumpdelay").setExecutor(new DoubleJumpCommand(this)); } public ArrayList<String> getPlayers() { return _players; } public ArrayList<String> <API key>() { return _playersDisableJump; } }
package org.vidogram.messenger.g.a; import java.io.<API key>; public class j extends <API key> { private final b a; public j(b paramb, int paramInt) { this.a = paramb; this.buf = this.a.a(Math.max(paramInt, 256)); } private void a(int paramInt) { if (this.count + paramInt <= this.buf.length) return; byte[] arrayOfByte = this.a.a((this.count + paramInt) * 2); System.arraycopy(this.buf, 0, arrayOfByte, 0, this.count); this.a.a(this.buf); this.buf = arrayOfByte; } public void close() { this.a.a(this.buf); this.buf = null; super.close(); } public void finalize() { this.a.a(this.buf); } public void write(int paramInt) { monitorenter; try { a(1); super.write(paramInt); monitorexit; return; } finally { localObject = finally; monitorexit; } throw localObject; } public void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2) { monitorenter; try { a(paramInt2); super.write(paramArrayOfByte, paramInt1, paramInt2); monitorexit; return; } finally { paramArrayOfByte = finally; monitorexit; } throw paramArrayOfByte; } }
using UnityEngine; using System.Collections; /* * Item to handle movements of rigibodies */ public class RigibodyMoveItem : MoveItem { public enum Type { ENEMY_SHIP_TYPE_1, LASER_RED, LASER_BLUE }; public static RigibodyMoveItem create(Type type) { switch (type) { case Type.ENEMY_SHIP_TYPE_1: return new EnemyShip1MoveItem(); case Type.LASER_RED: return new LaserRedMoveItem(); case Type.LASER_BLUE: return new LaserBlueMoveItem(); default: throw new System.ArgumentException("Incorrect RigibodyMoveItem.Type " + type.ToString()); } } }
#ifndef __EDIV_QGRAPHICS_H_ #define __EDIV_QGRAPHICS_H_ #include "export.h" /* Flags de modos de video */ #define _FULLSCREEN 0x01 typedef struct { byte* buffer; // invisible buffer byte* colormap; // 256 * VID_GRADES size byte* alphamap; // 256 * 256 translucency map int width; int height; int bpp; int flags; } viddef_t; viddef_t vid; #endif /* __EDIV_QGRAPHICS_H_ */
package it.polito.nexa.pc; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Statement; import java.util.List; public interface TriplesAdder { public Model addTriples(Model model, List<Statement> statementList); }
/** * @file mqueue.h * * This file contains the definitions related to POSIX Message Queues. */ #ifndef _MQUEUE_H #define _MQUEUE_H #include <unistd.h> #if defined(<API key>) #include <sys/types.h> #include <rtems/system.h> #include <rtems/score/object.h> #ifdef __cplusplus extern "C" { #endif /* * 15.1.1 Data Structures, P1003.1b-1993, p. 271 */ /** * Message queue id type. * * @note Use uint32_t since all POSIX Ids are 32-bit currently. */ typedef uint32_t mqd_t; /** * This is the message queue attributes structure. */ struct mq_attr { /** This is the message queue flags */ long mq_flags; /** This is the maximum number of messages */ long mq_maxmsg; /** This is the maximum message size */ long mq_msgsize; /** This is the mumber of messages currently queued */ long mq_curmsgs; }; /** * 15.2.2 Open a Message Queue, P1003.1b-1993, p. 272 */ mqd_t mq_open( const char *name, int oflag, ); /** * 15.2.2 Close a Message Queue, P1003.1b-1993, p. 275 */ int mq_close( mqd_t mqdes ); /** * 15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276 */ int mq_unlink( const char *name ); /** * 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277 * * @note P1003.4b/D8, p. 45 adds mq_timedsend(). */ int mq_send( mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio ); #if defined(_POSIX_TIMEOUTS) #include <time.h> int mq_timedsend( mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec *abstime ); #endif /* _POSIX_TIMEOUTS */ /* * 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279 * * NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive(). */ ssize_t mq_receive( mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio ); #if defined(_POSIX_TIMEOUTS) ssize_t mq_timedreceive( mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio, const struct timespec *abstime ); #endif /* _POSIX_TIMEOUTS */ #if defined(<API key>) /* * 15.2.6 Notify Process that a Message is Available on a Queue, * P1003.1b-1993, p. 280 */ int mq_notify( mqd_t mqdes, const struct sigevent *notification ); #endif /* <API key> */ /* * 15.2.7 Set Message Queue Attributes, P1003.1b-1993, p. 281 */ int mq_setattr( mqd_t mqdes, const struct mq_attr *mqstat, struct mq_attr *omqstat ); /* * 15.2.8 Get Message Queue Attributes, P1003.1b-1993, p. 283 */ int mq_getattr( mqd_t mqdes, struct mq_attr *mqstat ); #ifdef __cplusplus } #endif #endif /* <API key> */ #endif /* end of include file */
/* shades of grey */ /*@g1 : #5A6568;*/ /* color specific to a player */ /*@id-color: #78BDE7;*/ /* fonts */ /* variable heights */ /*@<API key>:20px;*/ /* transistions */ .ez-trans { -webkit-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; } /* effects */ .bs-none { -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } #now-playing { height: 35px; color: #43464b; padding: 7px; } #now-playing::before { content: "now playing : "; color: #878a8f; } /* global */ html, body { height: 100%; } *:focus { outline: none; } body { background-color: #fff; margin-top: 0; margin-bottom: 0; font-family: "Lato", Helvetica, Arial, sans-serif; color: #262b2c; } iframe { border-style: none; } a { color: #262b2c; background-color: #65686d; } a:hover { color: white; background-color: #878a8f; } .container { width: 100%; height: 100%; padding-left: 0px; padding-right: 0px; } .glyphicon { margin-right: 4px; } /* popup */ .popup { position: relative; background: #65686d; padding: 20px; width: auto; max-width: 500px; margin: 20px auto; } .popup .btn { height: 35px; border-radius: 0; border-style: none; background-color: #878a8f; } .popup .btn:hover { background-color: #cbced3; } .popup .selected, .popup .selected:hover { color: white; background-color: #babd3c; } .popup .ti-container { margin-top: 20px; margin-bottom: 15px; } .popup .form-control { height: 40px; font-size: 18px; border-radius: 0; } .popup .delete-sco-message { margin-bottom: 15px; } /* header */ #player-head { height: 100px; background-color: #65686d; position: fixed; width: 100%; z-index: 1000; } .player-name { font-size: 65px; padding-left: 20px; padding-right: 20px; display: inline-block; /*width:100%;*/ height: 100%; background-color: #43464b; color: #dcdf5e; } .player-ip { position: absolute; left: 5px; bottom: 0px; color: #babd3c; } /* nav bar */ .navbar { position: fixed; top: 100px; /*min-height:@navbar-height;*/ margin-bottom: 0px; border-style: none; -webkit-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); } .navbar li, .navbar a { font-size: 18px; line-height: 1; -webkit-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; } .navbar .nav-pills > li.active > a, .navbar .nav-pills > li.active > a:hover, .navbar .nav-pills > li.active > a:focus { color: white; background-color: #babd3c; } .navbar .nav-pills > li > a { height: 60px; padding-top: 21px; border-style: none; border-radius: 0; } /* tool bar */ .toolbar { /*line-height:@toolbar-height;*/ background: #cbced3; } .toolbar .row { margin: 0; } .toolbar .btn { height: 35px; border-radius: 0; border-style: none; background-color: #878a8f; } .toolbar .btn:hover { background-color: #cbced3; } .toolbar .caret { position: absolute; right: 10px; top: 17.5px; } .toolbar .dropdown-menu { border-radius: 0; border-style: none; width: 100%; margin: 0px; padding: 0px 0; max-height: 350px; overflow-y: scroll; -webkit-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); } .toolbar .dropdown-menu li a { background-color: #cbced3; } .toolbar .dropdown-menu li a:hover { background-color: #878a8f; } .toolbar .dropdown-menu li .divider { margin: 0px; background-color: #878a8f; } .toolbar .btn-warning { background-color: #dcdf5e; } .toolbar .btn-warning:focus { background-color: #babd3c; } /* progress-bar */ .progress-container { padding: 0px 10px; height: 32px; } .progress { margin-top: 8.5px; border-radius: 15px; height: 15px; } .progress-bar { background-color: #babd3c; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } /* media list */ .media-list table { margin: 0; height: 100%; } .media-list thead, .media-list tbody, .media-list tr, .media-list td, .media-list th { display: block; border-style: none; } .media-list tr:after { content: ' '; display: block; visibility: hidden; clear: both; } .media-list thead th { height: 40px; } .media-list tbody { height: calc(100% - 40px); overflow-y: auto; background-color: #cbced3; } .media-list thead { background-color: #cbced3; border-bottom-style: dashed; border-bottom-width: 1px; border-bottom-color: #878a8f; } .media-list tbody td, .media-list thead th { width: 25%; float: left; } .media-list .table-striped > tbody > tr:nth-child(odd) { background-color: #dcdfe4; } .media-list .table-striped > tbody > tr:nth-child(even) { background-color: #cbced3; } .media-list .table-striped > tbody > tr:last-child { -webkit-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); } .media-list .table-hover > tbody > tr:hover { background-color: #878a8f; color: white; } /* content section */ .content-section { background-color: #43464b; margin-top: 160px; height: calc(100% - 160px); } #scenario-section { overflow: hidden; /*height: calc(~"100% - "@player-head-height + @navbar-height + @toolbar-height);*/ } #<API key> { height: calc(100% - 35px); } #blockly-iframe { width: 100%; height: 100%; } #controls-section { /*height:calc(~"100% - "@player-head-height + @navbar-height + @toolbar-height);*/ } #controls-section .panel-group { height: 100%; margin-bottom: 0; background-color: #43464b; } #controls-section .panel { -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; border-style: none; border-radius: 0; margin-top: 0; } #controls-section .panel .panel-heading { height: 50px; -webkit-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); position: relative; color: #262b2c; background-color: #878a8f; border-radius: 0; padding: 0; } #controls-section .panel .panel-heading .panel-title > a { position: absolute; width: 100%; padding-left: 10px; text-decoration: none; background-color: #878a8f; line-height: 50px; } #controls-section .panel .panel-heading .panel-title > a:hover, #controls-section .panel .panel-heading .panel-title > a:focus { background-color: #65686d; color: white; } #controls-section .panel .panel-body { padding: 0; height: 100%; background-color: #cbced3; } #controls-section #media-player { overflow: hidden !important; } #controls-section #media-player .media-list { height: calc(100% - 34px); /* table { margin:0; height:100%; } thead, tbody, tr, td, th { display: block; border-style: none; } tr:after { content: ' '; display: block; visibility: hidden; clear: both; } thead th { height:@<API key>; } tbody { height: calc(~"100% - "@<API key>); overflow-y: auto; background-color: @g1-ppp; } thead { background-color: @g1-ppp; border-bottom-style: dashed; border-bottom-width:1px; border-bottom-color: @g1-pp; } tbody td, thead th { width: 25%; float: left; } .table-striped { > tbody > tr:nth-child(odd) { background-color: @g1-ppp+#111; } > tbody > tr:nth-child(even) { background-color: @g1-ppp; } > tbody > tr:last-child { .ds(0,2px,3px,0,0.2); } } .table-hover { > tbody > tr:hover { background-color: @g1-pp; color:@w; } }*/ } #controls-section #media-player #player-controls { width: 100%; height: 35px; background-color: #dcdfe4; border-top-style: dashed; border-top-width: 1px; border-top-color: #878a8f; } #controls-section #media-player #player-controls .btn-default { background-color: #cbced3; } #controls-section #media-player #player-controls .btn-default:hover { background-color: #878a8f; color: white; } #controls-section #media-player #player-controls .btn-warning { background-color: #dcdf5e; } #controls-section #media-player #player-controls .btn-warning:hover { background-color: #babd3c; } #controls-section #media-player #player-controls .slider-container { padding: 0px 10px; } #controls-section #media-player #player-controls .slider-container #volume-sli { margin-top: 8.5px; margin-bottom: 0; } #controls-section #media-player #player-controls .slider-container .ui-slider-range { background-color: #babd3c; } #controls-section #media-player #player-controls .slider-container .ui-slider-handle { background-color: #dcdf5e; } #controls-section #sensors #sensor-left-menu { height: 100%; } #controls-section #sensors #sensor-left-menu ul { height: 100%; border-style: none; padding: 0; } #controls-section #sensors #sensor-left-menu li { margin-bottom: 0; height: 33.33333333%; width: 100%; } #controls-section #sensors #sensor-left-menu a, #controls-section #sensors #sensor-left-menu a:hover, #controls-section #sensors #sensor-left-menu a:focus { border-style: none; border-radius: 0; height: 100%; /*line-height:200%;*/ text-align: center; } #controls-section #sensors #<API key> { background-color: #cbced3; height: 100%; } #controls-section #network #lonely-container { display: -webkit-flex; display: flex; height: 300px; } #controls-section #network #lonely { margin: auto; font-size: 4rem; } #media-section { background-color: #43464b; /*height:100%;*/ } #media-section #media-controls { -webkit-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.2); position: fixed; width: 100%; z-index: 1000; } #media-section .media-zone { height: 260px; padding: 40px; text-align: center; } #media-section .media-list { height: calc(100% - 60px); } #media-section #upload-zone, #media-section #upload-zone * { box-sizing: border-box; } #media-section #upload-zone { position: relative; } #media-section #upload-message { opacity: 0.15; font-size: 124px; color: #222; text-shadow: 0px 2px 3px #555; position: absolute; top: 60px; left: 50%; margin-left: -224px; } #media-section #upload-zone .dz-preview { position: relative; display: inline-block; width: 120px; margin: 0.5em; } #media-section #upload-zone .dz-preview .dz-progress { display: block; height: 15px; border: 1px solid #aaa; } #media-section #upload-zone .dz-preview .dz-progress .dz-upload { display: block; height: 100%; width: 0; background: #babd3c; } #media-section #upload-zone .dz-preview .dz-error-message { color: red; display: none; } #media-section #upload-zone .dz-preview.dz-error .dz-error-message, #media-section #upload-zone .dz-preview.dz-error .dz-error-mark { display: block; } #media-section #upload-zone .dz-preview.dz-success .dz-success-mark { display: block; } #media-section #upload-zone .dz-preview .dz-error-mark, #media-section #upload-zone .dz-preview .dz-success-mark { position: absolute; display: none; left: 30px; top: 30px; width: 54px; height: 58px; left: 50%; margin-left: -27px; } /*# sourceMappingURL=style.css.map */ /*# sourceMappingURL=style.css.map */
<!DOCTYPE html> <html lang="en-US"> <head> <title>Tryit Editor v2.3</title> <meta id="viewport" name='viewport'> <script> (function() { if ( navigator.userAgent.match(/iPad/i) ) { document.getElementById('viewport').setAttribute("content", "width=device-width, initial-scale=0.9"); } }()); </script> <link rel="stylesheet" href="../trycss.css"> <!--[if lt IE 8]> <style> .textareacontainer, .iframecontainer {width:48%;} .textarea, .iframe {height:800px;} #textareaCode, #iframeResult {height:700px;} .menu img {display:none;} </style> <![endif] <script> (function(i,s,o,g,r,a,m){i['<API key>']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.<API key>(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','../../www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-3855518-1', 'auto'); ga('require', 'displayfeatures'); ga('send', 'pageview'); </script> <script> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; gads.src = (useSSL ? 'https:' : 'http:') + ' var node = document.<API key>('script')[0]; node.parentNode.insertBefore(gads, node); })(); </script> <script> googletag.cmd.push(function() { googletag.defineSlot('/16833175/TryitLeaderboard', [[728, 90], [970, 90]], '<API key>').addService(googletag.pubads()); googletag.pubads().setTargeting("content","trytags"); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script> <script type="text/javascript"> function submitTryit() { var t=document.getElementById("textareaCode").value; t=t.replace(/=/gi,"w3equalsign"); var pos=t.search(/script/i) while (pos>0) { t=t.substring(0,pos) + "w3" + t.substr(pos,3) + "w3" + t.substr(pos+3,3) + "tag" + t.substr(pos+6); pos=t.search(/script/i); } if ( navigator.userAgent.match(/Safari/i) ) { t=escape(t); document.getElementById("bt").value="1"; } document.getElementById("code").value=t; document.getElementById("tryitform").action="tryit_view52a0.html?x=" + Math.random(); validateForm(); document.getElementById("iframeResult").contentWindow.name = "view"; document.getElementById("tryitform").submit(); } function validateForm() { var code=document.getElementById("code").value; if (code.length>8000) { document.getElementById("code").value="<h1>Error</h1>"; } } </script> <style> </style> </head> <body> <div id="ads"> <div style="position:relative;width:100%;margin-top:0px;margin-bottom:0px;"> <div style="width:974px;height:94px;position:relative;margin:0px;margin-top:5px;margin-bottom:5px;margin-right:auto;margin-left:auto;padding:0px;overflow:hidden;"> <!-- TryitLeaderboard --> <div id='<API key>' style='width:970px; height:90px;'> <script type='text/javascript'> googletag.cmd.push(function() { googletag.display('<API key>'); }); </script> </div> <div style="clear:both"></div> </div> </div> </div> <div class="container"> <div class="textareacontainer"> <div class="textarea"> <div class="headerText" style="width:auto;float:left;">Edit This Code:</div> <div class="headerBtnDiv" style="width:auto;float:right;margin-top:8px;margin-right:2.4%;"><button class="submit" type="button" onclick="submitTryit()">See Result &raquo;</button></div> <div class="textareawrapper"> <textarea autocomplete="off" class="code_input" id="textareaCode" wrap="logical" xrows="30" xcols="50"><!DOCTYPE html> <html> <body> <img src="smiley.gif" alt="Smiley face" width="42" height="42" style="border:5px solid black"> </body> </html> </textarea> <form autocomplete="off" style="margin:0px;display:none;" action="http: <input type="hidden" name="code" id="code" /> <input type="hidden" id="bt" name="bt" /> </form> </div> </div> </div> <div class="iframecontainer"> <div class="iframe"> <div class="headerText resultHeader">Result:</div> <div class="iframewrapper"> <iframe id="iframeResult" class="result_output" frameborder="0" name="view" xsrc="<API key>.html"></iframe> </div> <div class="footerText">Try it Yourself - &copy; <a href="../index.html">w3schools.com</a></div> </div> </div> </div> <script>submitTryit()</script> </body> </html>
using UnityEngine; using System.Collections; public class ButtonNextImage : MonoBehaviour { public GameObject nextImage; public bool lastImage; public string nextScene = ""; void OnMouseDown() { if(lastImage) { Application.LoadLevel(nextScene); return; } gameObject.SetActive (false); nextImage.SetActive (true); } }
/* * wiring Super fish to menu */ var sfvar = jQuery('div.menu'); var phoneSize = 600; jQuery(document).ready(function($) { //if screen size is bigger than phone's screen (Tablet,Desktop) if($(document).width() >= phoneSize) { // enable superfish sfvar.superfish({ delay: 500, speed: 'slow' }); jQuery("#menu-main-menu").addClass('clear'); var containerheight = jQuery("#menu-main-menu").height(); jQuery("#menu-main-menu").children().css("height",containerheight); } $(window).resize(function() { if($(document).width() >= phoneSize && !sfvar.hasClass('sf-js-enabled')) { sfvar.superfish({ delay: 500, speed: 'slow' }); } // phoneSize, disable superfish else if($(document).width() < phoneSize) { sfvar.superfish('destroy'); } }); });
<?xml version="1.0" encoding="utf-8"?> <rss version="2.0" xml:base="http: <channel> <title>intro to digital media studies - symbiosis</title> <link>http://machines.plannedobsolescence.net/51-2008/taxonomy/term/120/0</link> <description></description> <language>en</language> <item> <title>reading response 5</title> <link>http://machines.plannedobsolescence.net/51-2008/node/92</link> <description>&lt;p&gt;Both Nelson and Licklider saw it extremely fit for the relationship of man and computer to drastically become more interdependent on each other. Nelson speaks of the EFL and machines like that described by V.Bush(memex), where the computer will have all the information that one would ever need, all at a desk, and Licklider envisioned men to by this day and age have been even more dependent on computers and not only restricted to desks and office areas.&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://machines.plannedobsolescence.net/51-2008/node/92&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description> <comments>http://machines.plannedobsolescence.net/51-2008/node/92#comments</comments> <category domain="http://machines.plannedobsolescence.net/51-2008/taxonomy/term/122">computer</category> <category domain="http://machines.plannedobsolescence.net/51-2008/taxonomy/term/121">man</category> <category domain="http://machines.plannedobsolescence.net/51-2008/taxonomy/term/120">symbiosis</category> <pubDate>Sun, 17 Feb 2008 19:30:48 +0000</pubDate> <dc:creator>bungbang</dc:creator> <guid isPermaLink="false">92 at http://machines.plannedobsolescence.net/51-2008</guid> </item> </channel> </rss>
<html> <head> <link rel="stylesheet" href="../extjs/resources/css/ext-all.css" type="text/css" /> <script type="text/javascript" src="../extjs/ext-all.js"></script> <script type="text/javascript" src="sample.js"></script> </head> <body> </body> </html>
// file: rbbirb.cpp // This file contains the RBBIRuleBuilder class implementation. This is the main class for // building (compiling) break rules into the tables required by the runtime // RBBI engine. #include "unicode/utypes.h" #if !<API key> #include "unicode/brkiter.h" #include "unicode/rbbi.h" #include "unicode/ubrk.h" #include "unicode/unistr.h" #include "unicode/uniset.h" #include "unicode/uchar.h" #include "unicode/uchriter.h" #include "unicode/parsepos.h" #include "unicode/parseerr.h" #include "cmemory.h" #include "cstring.h" #include "rbbirb.h" #include "rbbinode.h" #include "rbbiscan.h" #include "rbbisetb.h" #include "rbbitblb.h" #include "rbbidata.h" #include "uassert.h" U_NAMESPACE_BEGIN // Constructor. RBBIRuleBuilder::RBBIRuleBuilder(const UnicodeString &rules, UParseError *parseErr, UErrorCode &status) : fRules(rules), fStrippedRules(rules) { fStatus = &status; // status is checked below fParseError = parseErr; fDebugEnv = NULL; #ifdef RBBI_DEBUG fDebugEnv = getenv("U_RBBIDEBUG"); #endif fForwardTree = NULL; fReverseTree = NULL; fSafeFwdTree = NULL; fSafeRevTree = NULL; fDefaultTree = &fForwardTree; fForwardTable = NULL; fRuleStatusVals = NULL; fChainRules = FALSE; fLBCMNoChain = FALSE; fLookAheadHardBreak = FALSE; fUSetNodes = NULL; fRuleStatusVals = NULL; fScanner = NULL; fSetBuilder = NULL; if (parseErr) { uprv_memset(parseErr, 0, sizeof(UParseError)); } if (U_FAILURE(status)) { return; } fUSetNodes = new UVector(status); // bcos status gets overwritten here fRuleStatusVals = new UVector(status); fScanner = new RBBIRuleScanner(this); fSetBuilder = new RBBISetBuilder(this); if (U_FAILURE(status)) { return; } if(fSetBuilder == 0 || fScanner == 0 || fUSetNodes == 0 || fRuleStatusVals == 0) { status = <API key>; } } // Destructor RBBIRuleBuilder::~RBBIRuleBuilder() { int i; for (i=0; ; i++) { RBBINode *n = (RBBINode *)fUSetNodes->elementAt(i); if (n==NULL) { break; } delete n; } delete fUSetNodes; delete fSetBuilder; delete fForwardTable; delete fForwardTree; delete fReverseTree; delete fSafeFwdTree; delete fSafeRevTree; delete fScanner; delete fRuleStatusVals; } // flattenData() - Collect up the compiled RBBI rule data and put it into // the format for saving in ICU data files, // which is also the format needed by the RBBI runtime engine. static int32_t align8(int32_t i) {return (i+7) & 0xfffffff8;} RBBIDataHeader *RBBIRuleBuilder::flattenData() { int32_t i; if (U_FAILURE(*fStatus)) { return NULL; } // Remove whitespace from the rules to make it smaller. // The rule parser has already removed comments. fStrippedRules = fScanner->stripRules(fStrippedRules); // Calculate the size of each section in the data. // Sizes here are padded up to a multiple of 8 for better memory alignment. // Sections sizes actually stored in the header are for the actual data // without the padding. int32_t headerSize = align8(sizeof(RBBIDataHeader)); int32_t forwardTableSize = align8(fForwardTable->getTableSize()); int32_t reverseTableSize = align8(fForwardTable->getSafeTableSize()); int32_t trieSize = align8(fSetBuilder->getTrieSize()); int32_t statusTableSize = align8(fRuleStatusVals->size() * sizeof(int32_t)); int32_t rulesSize = align8((fStrippedRules.length()+1) * sizeof(UChar)); int32_t totalSize = headerSize + forwardTableSize + reverseTableSize + statusTableSize + trieSize + rulesSize; RBBIDataHeader *data = (RBBIDataHeader *)uprv_malloc(totalSize); if (data == NULL) { *fStatus = <API key>; return NULL; } uprv_memset(data, 0, totalSize); data->fMagic = 0xb1a0; data->fFormatVersion[0] = <API key>[0]; data->fFormatVersion[1] = <API key>[1]; data->fFormatVersion[2] = <API key>[2]; data->fFormatVersion[3] = <API key>[3]; data->fLength = totalSize; data->fCatCount = fSetBuilder-><API key>(); data->fFTable = headerSize; data->fFTableLen = forwardTableSize; data->fRTable = data->fFTable + data->fFTableLen; data->fRTableLen = reverseTableSize; data->fTrie = data->fRTable + data->fRTableLen; data->fTrieLen = fSetBuilder->getTrieSize(); data->fStatusTable = data->fTrie + trieSize; data->fStatusTableLen= statusTableSize; data->fRuleSource = data->fStatusTable + statusTableSize; data->fRuleSourceLen = fStrippedRules.length() * sizeof(UChar); uprv_memset(data->fReserved, 0, sizeof(data->fReserved)); fForwardTable->exportTable((uint8_t *)data + data->fFTable); fForwardTable->exportSafeTable((uint8_t *)data + data->fRTable); fSetBuilder->serializeTrie ((uint8_t *)data + data->fTrie); int32_t *ruleStatusTable = (int32_t *)((uint8_t *)data + data->fStatusTable); for (i=0; i<fRuleStatusVals->size(); i++) { ruleStatusTable[i] = fRuleStatusVals->elementAti(i); } fStrippedRules.extract((UChar *)((uint8_t *)data+data->fRuleSource), rulesSize/2+1, *fStatus); return data; } // <API key> construct from source rules that are passed in // in a UnicodeString BreakIterator * RBBIRuleBuilder::<API key>( const UnicodeString &rules, UParseError *parseError, UErrorCode &status) { // Read the input rules, generate a parse tree, symbol table, // and list of all Unicode Sets referenced by the rules. RBBIRuleBuilder builder(rules, parseError, status); if (U_FAILURE(status)) { // status checked here bcos build below doesn't return NULL; } RBBIDataHeader *data = builder.build(status); if (U_FAILURE(status)) { return nullptr; } // Create a break iterator from the compiled rules. // (Identical to creation from stored pre-compiled rules) // status is checked after init in construction. <API key> *This = new <API key>(data, status); if (U_FAILURE(status)) { delete This; This = NULL; } else if(This == NULL) { // test for NULL status = <API key>; } return This; } RBBIDataHeader *RBBIRuleBuilder::build(UErrorCode &status) { if (U_FAILURE(status)) { return nullptr; } fScanner->parse(); if (U_FAILURE(status)) { return nullptr; } // UnicodeSet processing. // Munge the Unicode Sets to create a set of character categories. // Generate the mapping tables (TRIE) from input code points to // the character categories. fSetBuilder->buildRanges(); // Generate the DFA state transition table. fForwardTable = new RBBITableBuilder(this, &fForwardTree, status); if (fForwardTable == nullptr) { status = <API key>; return nullptr; } fForwardTable->buildForwardTable(); optimizeTables(); fForwardTable-><API key>(status); #ifdef RBBI_DEBUG if (fDebugEnv && uprv_strstr(fDebugEnv, "states")) { fForwardTable->printStates(); fForwardTable-><API key>(); fForwardTable->printReverseTable(); } #endif fSetBuilder->buildTrie(); // Package up the compiled data into a memory image // in the run-time format. RBBIDataHeader *data = flattenData(); // returns NULL if error if (U_FAILURE(status)) { return nullptr; } return data; } void RBBIRuleBuilder::optimizeTables() { // Begin looking for duplicates with char class 3. // Classes 0, 1 and 2 are special; they are unused, {bof} and {eof} respectively, // and should not have other categories merged into them. IntPair duplPair = {3, 0}; while (fForwardTable-><API key>(&duplPair)) { fSetBuilder->mergeCategories(duplPair); fForwardTable->removeColumn(duplPair.second); } fForwardTable-><API key>(); } U_NAMESPACE_END #endif /* #if !<API key> */
#include "config.h" #include "system.h" #include "coretypes.h" #include "tm.h" #include "hash-set.h" #include "machmode.h" #include "vec.h" #include "double-int.h" #include "input.h" #include "alias.h" #include "symtab.h" #include "wide-int.h" #include "inchash.h" #include "tree.h" #include "rtl.h" #include "tm_p.h" #include "hard-reg-set.h" #include "predict.h" #include "vec.h" #include "hashtab.h" #include "hash-set.h" #include "machmode.h" #include "input.h" #include "function.h" #include "dominance.h" #include "cfg.h" #include "cfgrtl.h" #include "basic-block.h" #include "insn-config.h" #include "regs.h" #include "flags.h" #include "except.h" #include "diagnostic-core.h" #include "recog.h" #include "expr.h" #include "tree-pass.h" #include "df.h" #include "dbgcnt.h" #include "target.h" /* This pass was originally removed from flow.c. However there is almost nothing that remains of that code. There are (4) basic forms that are matched: (1) FORM_PRE_ADD a <- b + c *a becomes a <- b *(a += c) pre (2) FORM_PRE_INC a += c *a becomes *(a += c) pre (3) FORM_POST_ADD *a b <- a + c (For this case to be true, b must not be assigned or used between the *a and the assignment to b. B must also be a Pmode reg.) becomes b <- a *(b += c) post (4) FORM_POST_INC *a a <- a + c becomes *(a += c) post There are three types of values of c. 1) c is a constant equal to the width of the value being accessed by the pointer. This is useful for machines that have HAVE_PRE_INCREMENT, HAVE_POST_INCREMENT, HAVE_PRE_DECREMENT or HAVE_POST_DECREMENT defined. 2) c is a constant not equal to the width of the value being accessed by the pointer. This is useful for machines that have <API key>, <API key> defined. 3) c is a register. This is useful for machines that have HAVE_PRE_MODIFY_REG, <API key> The is one special case: if a already had an offset equal to it +- its width and that offset is equal to -c when the increment was before the ref or +c if the increment was after the ref, then if we can do the combination but switch the pre/post bit. */ #ifdef AUTO_INC_DEC enum form { FORM_PRE_ADD, FORM_PRE_INC, FORM_POST_ADD, FORM_POST_INC, FORM_last }; /* The states of the second operands of mem refs and inc insns. If no second operand of the mem_ref was found, it is assumed to just be ZERO. SIZE is the size of the mode accessed in the memref. The ANY is used for constants that are not +-size or 0. REG is used if the forms are reg1 + reg2. */ enum inc_state { INC_ZERO, INC_NEG_SIZE, /* == +size */ INC_POS_SIZE, /* == -size */ INC_NEG_ANY, /* == some -constant */ INC_POS_ANY, /* == some +constant */ INC_REG, /* == some register */ INC_last }; /* The eight forms that pre/post inc/dec can take. */ enum gen_form { NOTHING, SIMPLE_PRE_INC, /* ++size */ SIMPLE_POST_INC, /* size++ */ SIMPLE_PRE_DEC, /* --size */ SIMPLE_POST_DEC, /* size-- */ DISP_PRE, /* ++con */ DISP_POST, /* con++ */ REG_PRE, /* ++reg */ REG_POST /* reg++ */ }; /* Tmp mem rtx for use in cost modeling. */ static rtx mem_tmp; static enum inc_state set_inc_state (HOST_WIDE_INT val, int size) { if (val == 0) return INC_ZERO; if (val < 0) return (val == -size) ? INC_NEG_SIZE : INC_NEG_ANY; else return (val == size) ? INC_POS_SIZE : INC_POS_ANY; } /* The DECISION_TABLE that describes what form, if any, the increment or decrement will take. It is a three dimensional table. The first index is the type of constant or register found as the second operand of the inc insn. The second index is the type of constant or register found as the second operand of the memory reference (if no second operand exists, 0 is used). The third index is the form and location (relative to the mem reference) of inc insn. */ static bool initialized = false; static enum gen_form decision_table[INC_last][INC_last][FORM_last]; static void init_decision_table (void) { enum gen_form value; if (HAVE_PRE_INCREMENT || <API key>) { /* Prefer the simple form if both are available. */ value = (HAVE_PRE_INCREMENT) ? SIMPLE_PRE_INC : DISP_PRE; decision_table[INC_POS_SIZE][INC_ZERO][FORM_PRE_ADD] = value; decision_table[INC_POS_SIZE][INC_ZERO][FORM_PRE_INC] = value; decision_table[INC_POS_SIZE][INC_POS_SIZE][FORM_POST_ADD] = value; decision_table[INC_POS_SIZE][INC_POS_SIZE][FORM_POST_INC] = value; } if (HAVE_POST_INCREMENT || <API key>) { /* Prefer the simple form if both are available. */ value = (HAVE_POST_INCREMENT) ? SIMPLE_POST_INC : DISP_POST; decision_table[INC_POS_SIZE][INC_ZERO][FORM_POST_ADD] = value; decision_table[INC_POS_SIZE][INC_ZERO][FORM_POST_INC] = value; decision_table[INC_POS_SIZE][INC_NEG_SIZE][FORM_PRE_ADD] = value; decision_table[INC_POS_SIZE][INC_NEG_SIZE][FORM_PRE_INC] = value; } if (HAVE_PRE_DECREMENT || <API key>) { /* Prefer the simple form if both are available. */ value = (HAVE_PRE_DECREMENT) ? SIMPLE_PRE_DEC : DISP_PRE; decision_table[INC_NEG_SIZE][INC_ZERO][FORM_PRE_ADD] = value; decision_table[INC_NEG_SIZE][INC_ZERO][FORM_PRE_INC] = value; decision_table[INC_NEG_SIZE][INC_NEG_SIZE][FORM_POST_ADD] = value; decision_table[INC_NEG_SIZE][INC_NEG_SIZE][FORM_POST_INC] = value; } if (HAVE_POST_DECREMENT || <API key>) { /* Prefer the simple form if both are available. */ value = (HAVE_POST_DECREMENT) ? SIMPLE_POST_DEC : DISP_POST; decision_table[INC_NEG_SIZE][INC_ZERO][FORM_POST_ADD] = value; decision_table[INC_NEG_SIZE][INC_ZERO][FORM_POST_INC] = value; decision_table[INC_NEG_SIZE][INC_POS_SIZE][FORM_PRE_ADD] = value; decision_table[INC_NEG_SIZE][INC_POS_SIZE][FORM_PRE_INC] = value; } if (<API key>) { decision_table[INC_POS_ANY][INC_ZERO][FORM_PRE_ADD] = DISP_PRE; decision_table[INC_POS_ANY][INC_ZERO][FORM_PRE_INC] = DISP_PRE; decision_table[INC_POS_ANY][INC_POS_ANY][FORM_POST_ADD] = DISP_PRE; decision_table[INC_POS_ANY][INC_POS_ANY][FORM_POST_INC] = DISP_PRE; decision_table[INC_NEG_ANY][INC_ZERO][FORM_PRE_ADD] = DISP_PRE; decision_table[INC_NEG_ANY][INC_ZERO][FORM_PRE_INC] = DISP_PRE; decision_table[INC_NEG_ANY][INC_NEG_ANY][FORM_POST_ADD] = DISP_PRE; decision_table[INC_NEG_ANY][INC_NEG_ANY][FORM_POST_INC] = DISP_PRE; } if (<API key>) { decision_table[INC_POS_ANY][INC_ZERO][FORM_POST_ADD] = DISP_POST; decision_table[INC_POS_ANY][INC_ZERO][FORM_POST_INC] = DISP_POST; decision_table[INC_POS_ANY][INC_NEG_ANY][FORM_PRE_ADD] = DISP_POST; decision_table[INC_POS_ANY][INC_NEG_ANY][FORM_PRE_INC] = DISP_POST; decision_table[INC_NEG_ANY][INC_ZERO][FORM_POST_ADD] = DISP_POST; decision_table[INC_NEG_ANY][INC_ZERO][FORM_POST_INC] = DISP_POST; decision_table[INC_NEG_ANY][INC_POS_ANY][FORM_PRE_ADD] = DISP_POST; decision_table[INC_NEG_ANY][INC_POS_ANY][FORM_PRE_INC] = DISP_POST; } /* This is much simpler than the other cases because we do not look for the reg1-reg2 case. Note that we do not have a INC_POS_REG and INC_NEG_REG states. Most of the use of such states would be on a target that had an R1 - R2 update address form. There is the remote possibility that you could also catch a = a + b; *(a - b) as a postdecrement of (a + b). However, it is unclear if *(a - b) would ever be generated on a machine that did not have that kind of addressing mode. The IA-64 and RS6000 will not do this, and I cannot speak for any other. If any architecture does have an a-b update for, these cases should be added. */ if (HAVE_PRE_MODIFY_REG) { decision_table[INC_REG][INC_ZERO][FORM_PRE_ADD] = REG_PRE; decision_table[INC_REG][INC_ZERO][FORM_PRE_INC] = REG_PRE; decision_table[INC_REG][INC_REG][FORM_POST_ADD] = REG_PRE; decision_table[INC_REG][INC_REG][FORM_POST_INC] = REG_PRE; } if (<API key>) { decision_table[INC_REG][INC_ZERO][FORM_POST_ADD] = REG_POST; decision_table[INC_REG][INC_ZERO][FORM_POST_INC] = REG_POST; } initialized = true; } /* Parsed fields of an inc insn of the form "reg_res = reg0+reg1" or "reg_res = reg0+c". */ static struct inc_insn { rtx_insn *insn; /* The insn being parsed. */ rtx pat; /* The pattern of the insn. */ bool reg1_is_const; /* True if reg1 is const, false if reg1 is a reg. */ enum form form; rtx reg_res; rtx reg0; rtx reg1; enum inc_state reg1_state;/* The form of the const if reg1 is a const. */ HOST_WIDE_INT reg1_val;/* Value if reg1 is const. */ } inc_insn; /* Dump the parsed inc insn to FILE. */ static void dump_inc_insn (FILE *file) { const char *f = ((inc_insn.form == FORM_PRE_ADD) || (inc_insn.form == FORM_PRE_INC)) ? "pre" : "post"; dump_insn_slim (file, inc_insn.insn); switch (inc_insn.form) { case FORM_PRE_ADD: case FORM_POST_ADD: if (inc_insn.reg1_is_const) fprintf (file, "found %s add(%d) r[%d]=r[%d]+%d\n", f, INSN_UID (inc_insn.insn), REGNO (inc_insn.reg_res), REGNO (inc_insn.reg0), (int) inc_insn.reg1_val); else fprintf (file, "found %s add(%d) r[%d]=r[%d]+r[%d]\n", f, INSN_UID (inc_insn.insn), REGNO (inc_insn.reg_res), REGNO (inc_insn.reg0), REGNO (inc_insn.reg1)); break; case FORM_PRE_INC: case FORM_POST_INC: if (inc_insn.reg1_is_const) fprintf (file, "found %s inc(%d) r[%d]+=%d\n", f, INSN_UID (inc_insn.insn), REGNO (inc_insn.reg_res), (int) inc_insn.reg1_val); else fprintf (file, "found %s inc(%d) r[%d]+=r[%d]\n", f, INSN_UID (inc_insn.insn), REGNO (inc_insn.reg_res), REGNO (inc_insn.reg1)); break; default: break; } } /* Parsed fields of a mem ref of the form "*(reg0+reg1)" or "*(reg0+c)". */ static struct mem_insn { rtx_insn *insn; /* The insn being parsed. */ rtx pat; /* The pattern of the insn. */ rtx *mem_loc; /* The address of the field that holds the mem */ /* that is to be replaced. */ bool reg1_is_const; /* True if reg1 is const, false if reg1 is a reg. */ rtx reg0; rtx reg1; /* This is either a reg or a const depending on reg1_is_const. */ enum inc_state reg1_state;/* The form of the const if reg1 is a const. */ HOST_WIDE_INT reg1_val;/* Value if reg1 is const. */ } mem_insn; /* Dump the parsed mem insn to FILE. */ static void dump_mem_insn (FILE *file) { dump_insn_slim (file, mem_insn.insn); if (mem_insn.reg1_is_const) fprintf (file, "found mem(%d) *(r[%d]+%d)\n", INSN_UID (mem_insn.insn), REGNO (mem_insn.reg0), (int) mem_insn.reg1_val); else fprintf (file, "found mem(%d) *(r[%d]+r[%d])\n", INSN_UID (mem_insn.insn), REGNO (mem_insn.reg0), REGNO (mem_insn.reg1)); } /* The following three arrays contain pointers to instructions. They are indexed by REGNO. At any point in the basic block where we are looking these three arrays contain, respectively, the next insn that uses REGNO, the next inc or add insn that uses REGNO and the next insn that sets REGNO. The arrays are not cleared when we move from block to block so whenever an insn is retrieved from these arrays, it's block number must be compared with the current block. */ static rtx_insn **reg_next_use = NULL; static rtx_insn **reg_next_inc_use = NULL; static rtx_insn **reg_next_def = NULL; /* Move dead note that match PATTERN to TO_INSN from FROM_INSN. We do not really care about moving any other notes from the inc or add insn. Moving the REG_EQUAL and REG_EQUIV is clearly wrong and it does not appear that there are any other kinds of relevant notes. */ static void move_dead_notes (rtx_insn *to_insn, rtx_insn *from_insn, rtx pattern) { rtx note; rtx next_note; rtx prev_note = NULL; for (note = REG_NOTES (from_insn); note; note = next_note) { next_note = XEXP (note, 1); if ((REG_NOTE_KIND (note) == REG_DEAD) && pattern == XEXP (note, 0)) { XEXP (note, 1) = REG_NOTES (to_insn); REG_NOTES (to_insn) = note; if (prev_note) XEXP (prev_note, 1) = next_note; else REG_NOTES (from_insn) = next_note; } else prev_note = note; } } /* Create a mov insn DEST_REG <- SRC_REG and insert it before NEXT_INSN. */ static rtx_insn * <API key> (rtx_insn *next_insn, rtx dest_reg, rtx src_reg) { rtx_insn *insns; start_sequence (); emit_move_insn (dest_reg, src_reg); insns = get_insns (); end_sequence (); emit_insn_before (insns, next_insn); return insns; } /* Change mem_insn.mem_loc so that uses NEW_ADDR which has an increment of INC_REG. To have reached this point, the change is a legitimate one from a dataflow point of view. The only questions are is this a valid change to the instruction and is this a profitable change to the instruction. */ static bool attempt_change (rtx new_addr, rtx inc_reg) { /* There are four cases: For the two cases that involve an add instruction, we are going to have to delete the add and insert a mov. We are going to assume that the mov is free. This is fairly early in the backend and there are a lot of opportunities for removing that move later. In particular, there is the case where the move may be dead, this is what dead code elimination passes are for. The two cases where we have an inc insn will be handled mov free. */ basic_block bb = BLOCK_FOR_INSN (mem_insn.insn); rtx_insn *mov_insn = NULL; int regno; rtx mem = *mem_insn.mem_loc; machine_mode mode = GET_MODE (mem); rtx new_mem; int old_cost = 0; int new_cost = 0; bool speed = <API key> (bb); PUT_MODE (mem_tmp, mode); XEXP (mem_tmp, 0) = new_addr; old_cost = (set_src_cost (mem, speed) + set_rtx_cost (PATTERN (inc_insn.insn), speed)); new_cost = set_src_cost (mem_tmp, speed); /* The first item of business is to see if this is profitable. */ if (old_cost < new_cost) { if (dump_file) fprintf (dump_file, "cost failure old=%d new=%d\n", old_cost, new_cost); return false; } /* Jump through a lot of hoops to keep the attributes up to date. We do not want to call one of the change address variants that take an offset even though we know the offset in many cases. These assume you are changing where the address is pointing by the offset. */ new_mem = <API key> (mem, new_addr); if (! validate_change (mem_insn.insn, mem_insn.mem_loc, new_mem, 0)) { if (dump_file) fprintf (dump_file, "validation failure\n"); return false; } /* From here to the end of the function we are committed to the change, i.e. nothing fails. Generate any necessary movs, move any regnotes, and fix up the reg_next_{use,inc_use,def}. */ switch (inc_insn.form) { case FORM_PRE_ADD: /* Replace the addition with a move. Do it at the location of the addition since the operand of the addition may change before the memory reference. */ mov_insn = <API key> (inc_insn.insn, inc_insn.reg_res, inc_insn.reg0); move_dead_notes (mov_insn, inc_insn.insn, inc_insn.reg0); regno = REGNO (inc_insn.reg_res); reg_next_def[regno] = mov_insn; reg_next_use[regno] = NULL; regno = REGNO (inc_insn.reg0); reg_next_use[regno] = mov_insn; df_recompute_luids (bb); break; case FORM_POST_INC: regno = REGNO (inc_insn.reg_res); if (reg_next_use[regno] == reg_next_inc_use[regno]) reg_next_inc_use[regno] = NULL; /* Fallthru. */ case FORM_PRE_INC: regno = REGNO (inc_insn.reg_res); reg_next_def[regno] = mem_insn.insn; reg_next_use[regno] = NULL; break; case FORM_POST_ADD: mov_insn = <API key> (mem_insn.insn, inc_insn.reg_res, inc_insn.reg0); move_dead_notes (mov_insn, inc_insn.insn, inc_insn.reg0); /* Do not move anything to the mov insn because the instruction pointer for the main iteration has not yet hit that. It is still pointing to the mem insn. */ regno = REGNO (inc_insn.reg_res); reg_next_def[regno] = mem_insn.insn; reg_next_use[regno] = NULL; regno = REGNO (inc_insn.reg0); reg_next_use[regno] = mem_insn.insn; if ((reg_next_use[regno] == reg_next_inc_use[regno]) || (reg_next_inc_use[regno] == inc_insn.insn)) reg_next_inc_use[regno] = NULL; df_recompute_luids (bb); break; case FORM_last: default: gcc_unreachable (); } if (!inc_insn.reg1_is_const) { regno = REGNO (inc_insn.reg1); reg_next_use[regno] = mem_insn.insn; if ((reg_next_use[regno] == reg_next_inc_use[regno]) || (reg_next_inc_use[regno] == inc_insn.insn)) reg_next_inc_use[regno] = NULL; } delete_insn (inc_insn.insn); if (dump_file && mov_insn) { fprintf (dump_file, "inserting mov "); dump_insn_slim (dump_file, mov_insn); } /* Record that this insn has an implicit side effect. */ add_reg_note (mem_insn.insn, REG_INC, inc_reg); if (dump_file) { fprintf (dump_file, "****success "); dump_insn_slim (dump_file, mem_insn.insn); } return true; } /* Try to combine the instruction in INC_INSN with the instruction in MEM_INSN. First the form is determined using the DECISION_TABLE and the results of parsing the INC_INSN and the MEM_INSN. Assuming the form is ok, a prototype new address is built which is passed to ATTEMPT_CHANGE for final processing. */ static bool try_merge (void) { enum gen_form gen_form; rtx mem = *mem_insn.mem_loc; rtx inc_reg = inc_insn.form == FORM_POST_ADD ? inc_insn.reg_res : mem_insn.reg0; /* The width of the mem being accessed. */ int size = GET_MODE_SIZE (GET_MODE (mem)); rtx_insn *last_insn = NULL; machine_mode reg_mode = GET_MODE (inc_reg); switch (inc_insn.form) { case FORM_PRE_ADD: case FORM_PRE_INC: last_insn = mem_insn.insn; break; case FORM_POST_INC: case FORM_POST_ADD: last_insn = inc_insn.insn; break; case FORM_last: default: gcc_unreachable (); } /* Cannot handle auto inc of the stack. */ if (inc_reg == stack_pointer_rtx) { if (dump_file) fprintf (dump_file, "cannot inc stack %d failure\n", REGNO (inc_reg)); return false; } /* Look to see if the inc register is dead after the memory reference. If it is, do not do the combination. */ if (find_regno_note (last_insn, REG_DEAD, REGNO (inc_reg))) { if (dump_file) fprintf (dump_file, "dead failure %d\n", REGNO (inc_reg)); return false; } mem_insn.reg1_state = (mem_insn.reg1_is_const) ? set_inc_state (mem_insn.reg1_val, size) : INC_REG; inc_insn.reg1_state = (inc_insn.reg1_is_const) ? set_inc_state (inc_insn.reg1_val, size) : INC_REG; /* Now get the form that we are generating. */ gen_form = decision_table [inc_insn.reg1_state][mem_insn.reg1_state][inc_insn.form]; if (dbg_cnt (auto_inc_dec) == false) return false; switch (gen_form) { default: case NOTHING: return false; case SIMPLE_PRE_INC: /* ++size */ if (dump_file) fprintf (dump_file, "trying SIMPLE_PRE_INC\n"); return attempt_change (gen_rtx_PRE_INC (reg_mode, inc_reg), inc_reg); break; case SIMPLE_POST_INC: /* size++ */ if (dump_file) fprintf (dump_file, "trying SIMPLE_POST_INC\n"); return attempt_change (gen_rtx_POST_INC (reg_mode, inc_reg), inc_reg); break; case SIMPLE_PRE_DEC: /* --size */ if (dump_file) fprintf (dump_file, "trying SIMPLE_PRE_DEC\n"); return attempt_change (gen_rtx_PRE_DEC (reg_mode, inc_reg), inc_reg); break; case SIMPLE_POST_DEC: /* size-- */ if (dump_file) fprintf (dump_file, "trying SIMPLE_POST_DEC\n"); return attempt_change (gen_rtx_POST_DEC (reg_mode, inc_reg), inc_reg); break; case DISP_PRE: /* ++con */ if (dump_file) fprintf (dump_file, "trying DISP_PRE\n"); return attempt_change (gen_rtx_PRE_MODIFY (reg_mode, inc_reg, gen_rtx_PLUS (reg_mode, inc_reg, inc_insn.reg1)), inc_reg); break; case DISP_POST: /* con++ */ if (dump_file) fprintf (dump_file, "trying POST_DISP\n"); return attempt_change (gen_rtx_POST_MODIFY (reg_mode, inc_reg, gen_rtx_PLUS (reg_mode, inc_reg, inc_insn.reg1)), inc_reg); break; case REG_PRE: /* ++reg */ if (dump_file) fprintf (dump_file, "trying PRE_REG\n"); return attempt_change (gen_rtx_PRE_MODIFY (reg_mode, inc_reg, gen_rtx_PLUS (reg_mode, inc_reg, inc_insn.reg1)), inc_reg); break; case REG_POST: /* reg++ */ if (dump_file) fprintf (dump_file, "trying POST_REG\n"); return attempt_change (gen_rtx_POST_MODIFY (reg_mode, inc_reg, gen_rtx_PLUS (reg_mode, inc_reg, inc_insn.reg1)), inc_reg); break; } } /* Return the next insn that uses (if reg_next_use is passed in NEXT_ARRAY) or defines (if reg_next_def is passed in NEXT_ARRAY) REGNO in BB. */ static rtx_insn * get_next_ref (int regno, basic_block bb, rtx_insn **next_array) { rtx_insn *insn = next_array[regno]; /* Lazy about cleaning out the next_arrays. */ if (insn && BLOCK_FOR_INSN (insn) != bb) { next_array[regno] = NULL; insn = NULL; } return insn; } /* Reverse the operands in a mem insn. */ static void reverse_mem (void) { rtx tmp = mem_insn.reg1; mem_insn.reg1 = mem_insn.reg0; mem_insn.reg0 = tmp; } /* Reverse the operands in a inc insn. */ static void reverse_inc (void) { rtx tmp = inc_insn.reg1; inc_insn.reg1 = inc_insn.reg0; inc_insn.reg0 = tmp; } /* Return true if INSN is of a form "a = b op c" where a and b are regs. op is + if c is a reg and +|- if c is a const. Fill in INC_INSN with what is found. This function is called in two contexts, if BEFORE_MEM is true, this is called for each insn in the basic block. If BEFORE_MEM is false, it is called for the instruction in the block that uses the index register for some memory reference that is currently being processed. */ static bool parse_add_or_inc (rtx_insn *insn, bool before_mem) { rtx pat = single_set (insn); if (!pat) return false; /* Result must be single reg. */ if (!REG_P (SET_DEST (pat))) return false; if ((GET_CODE (SET_SRC (pat)) != PLUS) && (GET_CODE (SET_SRC (pat)) != MINUS)) return false; if (!REG_P (XEXP (SET_SRC (pat), 0))) return false; inc_insn.insn = insn; inc_insn.pat = pat; inc_insn.reg_res = SET_DEST (pat); inc_insn.reg0 = XEXP (SET_SRC (pat), 0); if (rtx_equal_p (inc_insn.reg_res, inc_insn.reg0)) inc_insn.form = before_mem ? FORM_PRE_INC : FORM_POST_INC; else inc_insn.form = before_mem ? FORM_PRE_ADD : FORM_POST_ADD; if (CONST_INT_P (XEXP (SET_SRC (pat), 1))) { /* Process a = b + c where c is a const. */ inc_insn.reg1_is_const = true; if (GET_CODE (SET_SRC (pat)) == PLUS) { inc_insn.reg1 = XEXP (SET_SRC (pat), 1); inc_insn.reg1_val = INTVAL (inc_insn.reg1); } else { inc_insn.reg1_val = -INTVAL (XEXP (SET_SRC (pat), 1)); inc_insn.reg1 = GEN_INT (inc_insn.reg1_val); } return true; } else if ((HAVE_PRE_MODIFY_REG || <API key>) && (REG_P (XEXP (SET_SRC (pat), 1))) && GET_CODE (SET_SRC (pat)) == PLUS) { /* Process a = b + c where c is a reg. */ inc_insn.reg1 = XEXP (SET_SRC (pat), 1); inc_insn.reg1_is_const = false; if (inc_insn.form == FORM_PRE_INC || inc_insn.form == FORM_POST_INC) return true; else if (rtx_equal_p (inc_insn.reg_res, inc_insn.reg1)) { /* Reverse the two operands and turn *_ADD into *_INC since a = c + a. */ reverse_inc (); inc_insn.form = before_mem ? FORM_PRE_INC : FORM_POST_INC; return true; } else return true; } return false; } /* A recursive function that checks all of the mem uses in ADDRESS_OF_X to see if any single one of them is compatible with what has been found in inc_insn. -1 is returned for success. 0 is returned if nothing was found and 1 is returned for failure. */ static int find_address (rtx *address_of_x) { rtx x = *address_of_x; enum rtx_code code = GET_CODE (x); const char *const fmt = GET_RTX_FORMAT (code); int i; int value = 0; int tem; if (code == MEM && rtx_equal_p (XEXP (x, 0), inc_insn.reg_res)) { /* Match with *reg0. */ mem_insn.mem_loc = address_of_x; mem_insn.reg0 = inc_insn.reg_res; mem_insn.reg1_is_const = true; mem_insn.reg1_val = 0; mem_insn.reg1 = GEN_INT (0); return -1; } if (code == MEM && GET_CODE (XEXP (x, 0)) == PLUS && rtx_equal_p (XEXP (XEXP (x, 0), 0), inc_insn.reg_res)) { rtx b = XEXP (XEXP (x, 0), 1); mem_insn.mem_loc = address_of_x; mem_insn.reg0 = inc_insn.reg_res; mem_insn.reg1 = b; mem_insn.reg1_is_const = inc_insn.reg1_is_const; if (CONST_INT_P (b)) { /* Match with *(reg0 + reg1) where reg1 is a const. */ HOST_WIDE_INT val = INTVAL (b); if (inc_insn.reg1_is_const && (inc_insn.reg1_val == val || inc_insn.reg1_val == -val)) { mem_insn.reg1_val = val; return -1; } } else if (!inc_insn.reg1_is_const && rtx_equal_p (inc_insn.reg1, b)) /* Match with *(reg0 + reg1). */ return -1; } if (code == SIGN_EXTRACT || code == ZERO_EXTRACT) { /* If REG occurs inside a MEM used in a bit-field reference, that is unacceptable. */ if (find_address (&XEXP (x, 0))) return 1; } if (x == inc_insn.reg_res) return 1; /* Time for some deep diving. */ for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i { if (fmt[i] == 'e') { tem = find_address (&XEXP (x, i)); /* If this is the first use, let it go so the rest of the insn can be checked. */ if (value == 0) value = tem; else if (tem != 0) /* More than one match was found. */ return 1; } else if (fmt[i] == 'E') { int j; for (j = XVECLEN (x, i) - 1; j >= 0; j { tem = find_address (&XVECEXP (x, i, j)); /* If this is the first use, let it go so the rest of the insn can be checked. */ if (value == 0) value = tem; else if (tem != 0) /* More than one match was found. */ return 1; } } } return value; } /* Once a suitable mem reference has been found and the MEM_INSN structure has been filled in, FIND_INC is called to see if there is a suitable add or inc insn that follows the mem reference and determine if it is suitable to merge. In the case where the MEM_INSN has two registers in the reference, this function may be called recursively. The first time looking for an add of the first register, and if that fails, looking for an add of the second register. The FIRST_TRY parameter is used to only allow the parameters to be reversed once. */ static bool find_inc (bool first_try) { rtx_insn *insn; basic_block bb = BLOCK_FOR_INSN (mem_insn.insn); rtx_insn *other_insn; df_ref def; /* Make sure this reg appears only once in this insn. */ if (count_occurrences (PATTERN (mem_insn.insn), mem_insn.reg0, 1) != 1) { if (dump_file) fprintf (dump_file, "mem count failure\n"); return false; } if (dump_file) dump_mem_insn (dump_file); /* Find the next use that is an inc. */ insn = get_next_ref (REGNO (mem_insn.reg0), BLOCK_FOR_INSN (mem_insn.insn), reg_next_inc_use); if (!insn) return false; /* Even though we know the next use is an add or inc because it came from the reg_next_inc_use, we must still reparse. */ if (!parse_add_or_inc (insn, false)) { /* Next use was not an add. Look for one extra case. It could be that we have: *(a + b) = a; = b + a if we reverse the operands in the mem ref we would find this. Only try it once though. */ if (first_try && !mem_insn.reg1_is_const) { reverse_mem (); return find_inc (false); } else return false; } /* Need to assure that none of the operands of the inc instruction are assigned to by the mem insn. */ FOR_EACH_INSN_DEF (def, mem_insn.insn) { unsigned int regno = DF_REF_REGNO (def); if ((regno == REGNO (inc_insn.reg0)) || (regno == REGNO (inc_insn.reg_res))) { if (dump_file) fprintf (dump_file, "inc conflicts with store failure.\n"); return false; } if (!inc_insn.reg1_is_const && (regno == REGNO (inc_insn.reg1))) { if (dump_file) fprintf (dump_file, "inc conflicts with store failure.\n"); return false; } } if (dump_file) dump_inc_insn (dump_file); if (inc_insn.form == FORM_POST_ADD) { /* Make sure that there is no insn that assigns to inc_insn.res between the mem_insn and the inc_insn. */ rtx_insn *other_insn = get_next_ref (REGNO (inc_insn.reg_res), BLOCK_FOR_INSN (mem_insn.insn), reg_next_def); if (other_insn != inc_insn.insn) { if (dump_file) fprintf (dump_file, "result of add is assigned to between mem and inc insns.\n"); return false; } other_insn = get_next_ref (REGNO (inc_insn.reg_res), BLOCK_FOR_INSN (mem_insn.insn), reg_next_use); if (other_insn && (other_insn != inc_insn.insn) && (DF_INSN_LUID (inc_insn.insn) > DF_INSN_LUID (other_insn))) { if (dump_file) fprintf (dump_file, "result of add is used between mem and inc insns.\n"); return false; } /* For the post_add to work, the result_reg of the inc must not be used in the mem insn since this will become the new index register. */ if (<API key> (inc_insn.reg_res, PATTERN (mem_insn.insn))) { if (dump_file) fprintf (dump_file, "base reg replacement failure.\n"); return false; } } if (mem_insn.reg1_is_const) { if (mem_insn.reg1_val == 0) { if (!inc_insn.reg1_is_const) { /* The mem looks like *r0 and the rhs of the add has two registers. */ int luid = DF_INSN_LUID (inc_insn.insn); if (inc_insn.form == FORM_POST_ADD) { /* The trick is that we are not going to increment r0, we are going to increment the result of the add insn. For this trick to be correct, the result reg of the inc must be a valid addressing reg. */ addr_space_t as = MEM_ADDR_SPACE (*mem_insn.mem_loc); if (GET_MODE (inc_insn.reg_res) != targetm.addr_space.address_mode (as)) { if (dump_file) fprintf (dump_file, "base reg mode failure.\n"); return false; } /* We also need to make sure that the next use of inc result is after the inc. */ other_insn = get_next_ref (REGNO (inc_insn.reg1), bb, reg_next_use); if (other_insn && luid > DF_INSN_LUID (other_insn)) return false; if (!rtx_equal_p (mem_insn.reg0, inc_insn.reg0)) reverse_inc (); } other_insn = get_next_ref (REGNO (inc_insn.reg1), bb, reg_next_def); if (other_insn && luid > DF_INSN_LUID (other_insn)) return false; } } /* Both the inc/add and the mem have a constant. Need to check that the constants are ok. */ else if ((mem_insn.reg1_val != inc_insn.reg1_val) && (mem_insn.reg1_val != -inc_insn.reg1_val)) return false; } else { /* The mem insn is of the form *(a + b) where a and b are both regs. It may be that in order to match the add or inc we need to treat it as if it was *(b + a). It may also be that the add is of the form a + c where c does not match b and then we just abandon this. */ int luid = DF_INSN_LUID (inc_insn.insn); rtx_insn *other_insn; /* Make sure this reg appears only once in this insn. */ if (count_occurrences (PATTERN (mem_insn.insn), mem_insn.reg1, 1) != 1) return false; if (inc_insn.form == FORM_POST_ADD) { /* For this trick to be correct, the result reg of the inc must be a valid addressing reg. */ addr_space_t as = MEM_ADDR_SPACE (*mem_insn.mem_loc); if (GET_MODE (inc_insn.reg_res) != targetm.addr_space.address_mode (as)) { if (dump_file) fprintf (dump_file, "base reg mode failure.\n"); return false; } if (rtx_equal_p (mem_insn.reg0, inc_insn.reg0)) { if (!rtx_equal_p (mem_insn.reg1, inc_insn.reg1)) { /* See comment above on find_inc (false) call. */ if (first_try) { reverse_mem (); return find_inc (false); } else return false; } /* Need to check that there are no assignments to b before the add insn. */ other_insn = get_next_ref (REGNO (inc_insn.reg1), bb, reg_next_def); if (other_insn && luid > DF_INSN_LUID (other_insn)) return false; /* All ok for the next step. */ } else { /* We know that mem_insn.reg0 must equal inc_insn.reg1 or else we would not have found the inc insn. */ reverse_mem (); if (!rtx_equal_p (mem_insn.reg0, inc_insn.reg0)) { /* See comment above on find_inc (false) call. */ if (first_try) return find_inc (false); else return false; } /* To have gotten here know that. *(b + a) = (b + a) We also know that the lhs of the inc is not b or a. We need to make sure that there are no assignments to b between the mem ref and the inc. */ other_insn = get_next_ref (REGNO (inc_insn.reg0), bb, reg_next_def); if (other_insn && luid > DF_INSN_LUID (other_insn)) return false; } /* Need to check that the next use of the add result is later than add insn since this will be the reg incremented. */ other_insn = get_next_ref (REGNO (inc_insn.reg_res), bb, reg_next_use); if (other_insn && luid > DF_INSN_LUID (other_insn)) return false; } else /* FORM_POST_INC. There is less to check here because we know that operands must line up. */ { if (!rtx_equal_p (mem_insn.reg1, inc_insn.reg1)) /* See comment above on find_inc (false) call. */ { if (first_try) { reverse_mem (); return find_inc (false); } else return false; } /* To have gotten here know that. *(a + b) = (a + b) We also know that the lhs of the inc is not b. We need to make sure that there are no assignments to b between the mem ref and the inc. */ other_insn = get_next_ref (REGNO (inc_insn.reg1), bb, reg_next_def); if (other_insn && luid > DF_INSN_LUID (other_insn)) return false; } } if (inc_insn.form == FORM_POST_INC) { other_insn = get_next_ref (REGNO (inc_insn.reg0), bb, reg_next_use); /* When we found inc_insn, we were looking for the next add or inc, not the next insn that used the reg. Because we are going to increment the reg in this form, we need to make sure that there were no intervening uses of reg. */ if (inc_insn.insn != other_insn) return false; } return try_merge (); } /* A recursive function that walks ADDRESS_OF_X to find all of the mem uses in pat that could be used as an auto inc or dec. It then calls FIND_INC for each one. */ static bool find_mem (rtx *address_of_x) { rtx x = *address_of_x; enum rtx_code code = GET_CODE (x); const char *const fmt = GET_RTX_FORMAT (code); int i; if (code == MEM && REG_P (XEXP (x, 0))) { /* Match with *reg0. */ mem_insn.mem_loc = address_of_x; mem_insn.reg0 = XEXP (x, 0); mem_insn.reg1_is_const = true; mem_insn.reg1_val = 0; mem_insn.reg1 = GEN_INT (0); if (find_inc (true)) return true; } if (code == MEM && GET_CODE (XEXP (x, 0)) == PLUS && REG_P (XEXP (XEXP (x, 0), 0))) { rtx reg1 = XEXP (XEXP (x, 0), 1); mem_insn.mem_loc = address_of_x; mem_insn.reg0 = XEXP (XEXP (x, 0), 0); mem_insn.reg1 = reg1; if (CONST_INT_P (reg1)) { mem_insn.reg1_is_const = true; /* Match with *(reg0 + c) where c is a const. */ mem_insn.reg1_val = INTVAL (reg1); if (find_inc (true)) return true; } else if (REG_P (reg1)) { /* Match with *(reg0 + reg1). */ mem_insn.reg1_is_const = false; if (find_inc (true)) return true; } } if (code == SIGN_EXTRACT || code == ZERO_EXTRACT) { /* If REG occurs inside a MEM used in a bit-field reference, that is unacceptable. */ return false; } /* Time for some deep diving. */ for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i { if (fmt[i] == 'e') { if (find_mem (&XEXP (x, i))) return true; } else if (fmt[i] == 'E') { int j; for (j = XVECLEN (x, i) - 1; j >= 0; j if (find_mem (&XVECEXP (x, i, j))) return true; } } return false; } /* Try to combine all incs and decs by constant values with memory references in BB. */ static void merge_in_block (int max_reg, basic_block bb) { rtx_insn *insn; rtx_insn *curr; int success_in_block = 0; if (dump_file) fprintf (dump_file, "\n\nstarting bb %d\n", bb->index); <API key> (bb, insn, curr) { bool insn_is_add_or_inc = true; if (!NONDEBUG_INSN_P (insn)) continue; /* This continue is deliberate. We do not want the uses of the jump put into reg_next_use because it is not considered safe to combine a preincrement with a jump. */ if (JUMP_P (insn)) continue; if (dump_file) dump_insn_slim (dump_file, insn); /* Does this instruction increment or decrement a register? */ if (parse_add_or_inc (insn, true)) { int regno = REGNO (inc_insn.reg_res); /* Cannot handle case where there are three separate regs before a mem ref. Too many moves would be needed to be profitable. */ if ((inc_insn.form == FORM_PRE_INC) || inc_insn.reg1_is_const) { mem_insn.insn = get_next_ref (regno, bb, reg_next_use); if (mem_insn.insn) { bool ok = true; if (!inc_insn.reg1_is_const) { /* We are only here if we are going to try a HAVE_*_MODIFY_REG type transformation. c is a reg and we must sure that the path from the inc_insn to the mem_insn.insn is both def and use clear of c because the inc insn is going to move into the mem_insn.insn. */ int luid = DF_INSN_LUID (mem_insn.insn); rtx_insn *other_insn = get_next_ref (REGNO (inc_insn.reg1), bb, reg_next_use); if (other_insn && luid > DF_INSN_LUID (other_insn)) ok = false; other_insn = get_next_ref (REGNO (inc_insn.reg1), bb, reg_next_def); if (other_insn && luid > DF_INSN_LUID (other_insn)) ok = false; } if (dump_file) dump_inc_insn (dump_file); if (ok && find_address (&PATTERN (mem_insn.insn)) == -1) { if (dump_file) dump_mem_insn (dump_file); if (try_merge ()) { success_in_block++; insn_is_add_or_inc = false; } } } } } else { insn_is_add_or_inc = false; mem_insn.insn = insn; if (find_mem (&PATTERN (insn))) success_in_block++; } /* If the inc insn was merged with a mem, the inc insn is gone and there is noting to update. */ if (df_insn_info *insn_info = DF_INSN_INFO_GET (insn)) { df_ref def, use; /* Need to update next use. */ <API key> (def, insn_info) { reg_next_use[DF_REF_REGNO (def)] = NULL; reg_next_inc_use[DF_REF_REGNO (def)] = NULL; reg_next_def[DF_REF_REGNO (def)] = insn; } <API key> (use, insn_info) { reg_next_use[DF_REF_REGNO (use)] = insn; if (insn_is_add_or_inc) reg_next_inc_use[DF_REF_REGNO (use)] = insn; else reg_next_inc_use[DF_REF_REGNO (use)] = NULL; } } else if (dump_file) fprintf (dump_file, "skipping update of deleted insn %d\n", INSN_UID (insn)); } /* If we were successful, try again. There may have been several opportunities that were interleaved. This is rare but gcc.c-torture/compile/pr17273.c actually exhibits this. */ if (success_in_block) { /* In this case, we must clear these vectors since the trick of testing if the stale insn in the block will not work. */ memset (reg_next_use, 0, max_reg * sizeof (rtx)); memset (reg_next_inc_use, 0, max_reg * sizeof (rtx)); memset (reg_next_def, 0, max_reg * sizeof (rtx)); df_recompute_luids (bb); merge_in_block (max_reg, bb); } } #endif /* Discover auto-inc auto-dec instructions. */ namespace { const pass_data pass_data_inc_dec = { RTL_PASS, /* type */ "auto_inc_dec", /* name */ OPTGROUP_NONE, /* optinfo_flags */ TV_AUTO_INC_DEC, /* tv_id */ 0, /* properties_required */ 0, /* properties_provided */ 0, /* <API key> */ 0, /* todo_flags_start */ TODO_df_finish, /* todo_flags_finish */ }; class pass_inc_dec : public rtl_opt_pass { public: pass_inc_dec (gcc::context *ctxt) : rtl_opt_pass (pass_data_inc_dec, ctxt) {} /* opt_pass methods: */ virtual bool gate (function *) { #ifdef AUTO_INC_DEC return (optimize > 0 && flag_auto_inc_dec); #else return false; #endif } unsigned int execute (function *); }; // class pass_inc_dec unsigned int pass_inc_dec::execute (function *fun ATTRIBUTE_UNUSED) { #ifdef AUTO_INC_DEC basic_block bb; int max_reg = max_reg_num (); if (!initialized) init_decision_table (); mem_tmp = gen_rtx_MEM (Pmode, NULL_RTX); df_note_add_problem (); df_analyze (); reg_next_use = XCNEWVEC (rtx_insn *, max_reg); reg_next_inc_use = XCNEWVEC (rtx_insn *, max_reg); reg_next_def = XCNEWVEC (rtx_insn *, max_reg); FOR_EACH_BB_FN (bb, fun) merge_in_block (max_reg, bb); free (reg_next_use); free (reg_next_inc_use); free (reg_next_def); mem_tmp = NULL; #endif return 0; } } // anon namespace rtl_opt_pass * make_pass_inc_dec (gcc::context *ctxt) { return new pass_inc_dec (ctxt); }
#ifndef AUGUTIL_PWD_H #define AUGUTIL_PWD_H /** * @file augutil/pwd.h * * Password functions. */ #include "augutil/md5.h" #define AUG_MAXPASSWORD 128 typedef char aug_pwd_t[AUG_MAXPASSWORD + 1]; AUGUTIL_API char* aug_getpass(const char* prompt, char* buf, size_t len); AUGUTIL_API char* aug_digestpass(const char* username, const char* realm, const char* password, aug_md5base64_t base64); #endif /* AUGUTIL_PWD_H */
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Monroe puts in 24, Knicks defeat the Pistons 121 to 115</title> <link rel="stylesheet" type="text/css" href="../css/style.css"> </head> <body> <h1>Monroe puts in 24, Knicks defeat the Pistons 121 to 115</h1> </br> <h2 style="color:gray">by NBANLP Recap Generator</h2> </br></br> <img src="../img/08/01.jpg" alt="No image loaded" align="right" style="height:50%; width:50%;margin-left:20px;margin-bottom:20px;"> <p>Greg Monroe recorded 24 points for the Pistons. Andrea Bargnani contributed well to the Knicks total, recording 23 points. The Pistons largest lead was by 18 with 3 minutes remaining in the 2nd.</p> <p>Greg put up 24 points for the Pistons in a good scoring contribution. Monroe contributed 2 assists and 13 rebounds.</p> <p>Andrea made contributions in scoring with 23 points for the Knicks. Bargnani got 4 assists and 12 rebounds for the Knicks.</p> <p>The Pistons were up by as much as 18 points in the 2nd with a 51-33 lead.</p> <p>Drummond fouled out with 6:03 remaining in double overtime.</p> <p>Galloway recorded his last foul with 6:00 left in double overtime.</p> <p>Smith recorded his last foul with 6:00 remaining in double overtime.</p> <p>This result puts Pistons at 23-35 for the season, while the Knicks are 11-45. The Pistons have lost their last 2 games.</p> <p>Andre Drummond, Reggie Jackson, and Kentavious Caldwell-Pope combined for 46 points. Each scoring 15, 14, and 17 points respectively. Drummond recorded 1 assists and 15 rebounds for the Pistons. Jackson got 5 assists and 5 rebounds for the Pistons. Caldwell-Pope got 3 assists and 6 rebounds for the Pistons. Greg led the Pistons putting up 24 points, 2 assists, and 13 rebounds. Andrea led the Knicks putting up a total 23 points, 4 assists, and 12 rebounds.</p> </body> </html>
<div class="clear left"> <div class="full-page-span33 home-island"> <div class="img-island isle1"> <h3>Isle Title 1</h3> <p class="tl"> Mei duis denique nostrum et, in pro choro</p> </div> <div> <p>Lorem ipsum Mei duis denique nostrum et, in pro choro consul, eam deterruisset definitionem te. Ne nam prima essent delicata, quie Sacto is. In fabellas technician.</p> </div> </div> <div class="full-page-span33 home-island"> <div class="img-island isle2"> <h3>Isle Title 2</h3> <p class="bl">Ne Nam Prima Essent Delicata</p> </div> <div> <p>Ot usu ut oblique senserit, ne usu saepe affert definitiones, mel euripidis persequeris id. Pri ad iudico conceptam, nostro apeirian no has Roseville.</p> </div> </div> <div class="full-page-span33 home-island"> <div class="img-island isle3"> <h3>Isle Title 3</h3> <p class="tr">Ut Oratio Moleskine Quo Prezi</p> </div> <div> <p> Ipsum cotidieque definitiones eos no, at dicant perfecto sea. At mollis definitionem duo, ludus primis sanctus id eam, an mei rebum debitis.</p> </div> </div> </div> <div class="clear left"> <div class="full-page-span33 home-facts"> <h3 class="med-body-headline">Our Services Include:</h3> <ul> <li>Fulli Assueverit</li> <li>Centrant Ailey Redactio Athasn</li> <li>Electric Oblique Senserit</li> <li>Nec Ro Aperiam</li> <li>At Mollis Definitionem Duo</li> <li>Radirum A Denique Adversarium namei</li> <ul> </div> <div class="full-page-span33 home-facts hf2nd-col"> <ul> <li>Tel Hasadipsci &#38; Ludis</li> <li>Respado Cotidieque &#38; Primus</li> <li>PAVT Monestatis</li> <li>Listaray, Billum &#38; Inlused</li> <li>24 Hour Elequist Sanktus</li> <li>Fresca Estinastos</li> <ul> </div> <div class="full-page-span33 home-facts hf2nd-col last-col"> <a href="#" class="frst-grn-btn tighten-text"><span class="subtext">Nov Ask Selen</span><br /> Falli Eloquentiam</a> <a href="#" class="lt-grn-btn tighten-text">Eleifend Asservated<br /><span class="subtext">Utom Requiem</span></a> </div> </div>
#include "config.h" #include "pcm_volume.h" #include "pcm_utils.h" #include "audio_format.h" #include <glib.h> #include <stdint.h> #include <string.h> #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "pcm_volume" static void pcm_volume_change_8(int8_t *buffer, const int8_t *end, int volume) { while (buffer < end) { int32_t sample = *buffer; sample = (sample * volume + pcm_volume_dither() + PCM_VOLUME_1 / 2) / PCM_VOLUME_1; *buffer++ = pcm_range(sample, 8); } } static void <API key>(int16_t *buffer, const int16_t *end, int volume) { while (buffer < end) { int32_t sample = *buffer; sample = (sample * volume + pcm_volume_dither() + PCM_VOLUME_1 / 2) / PCM_VOLUME_1; *buffer++ = pcm_range(sample, 16); } } #ifdef __i386__ /** * Optimized volume function for i386. Use the EDX:EAX 2*32 bit * multiplication result instead of emulating 64 bit multiplication. */ static inline int32_t <API key>(int32_t sample, int32_t volume, G_GNUC_UNUSED int32_t dither) { int32_t result; asm(/* edx:eax = sample * volume */ "imul %2\n" /* "add %3, %1\n" dithering disabled for now, because we have no overflow check - is dithering really important here? */ /* eax = edx:eax / PCM_VOLUME_1 */ "sal $22, %%edx\n" "shr $10, %1\n" "or %%edx, %1\n" : "=a"(result) : "0"(sample), "r"(volume) /* , "r"(dither) */ : "edx" ); return result; } #endif static void <API key>(int32_t *buffer, const int32_t *end, int volume) { while (buffer < end) { #ifdef __i386__ /* assembly version for i386 */ int32_t sample = *buffer; sample = <API key>(sample, volume, pcm_volume_dither()); #else /* portable version */ int64_t sample = *buffer; sample = (sample * volume + pcm_volume_dither() + PCM_VOLUME_1 / 2) / PCM_VOLUME_1; #endif *buffer++ = pcm_range(sample, 24); } } static void <API key>(int32_t *buffer, const int32_t *end, int volume) { while (buffer < end) { #ifdef __i386__ /* assembly version for i386 */ int32_t sample = *buffer; *buffer++ = <API key>(sample, volume, 0); #else /* portable version */ int64_t sample = *buffer; sample = (sample * volume + pcm_volume_dither() + PCM_VOLUME_1 / 2) / PCM_VOLUME_1; *buffer++ = pcm_range_64(sample, 32); #endif } } static void <API key>(float *buffer, const float *end, float volume) { while (buffer < end) { float sample = *buffer; sample *= volume; *buffer++ = sample; } } bool pcm_volume(void *buffer, size_t length, enum sample_format format, int volume) { if (volume == PCM_VOLUME_1) return true; if (volume <= 0) { memset(buffer, 0, length); return true; } const void *end = pcm_end_pointer(buffer, length); switch (format) { case <API key>: case SAMPLE_FORMAT_S24: case SAMPLE_FORMAT_DSD: case <API key>: /* not implemented */ return false; case SAMPLE_FORMAT_S8: pcm_volume_change_8(buffer, end, volume); return true; case SAMPLE_FORMAT_S16: <API key>(buffer, end, volume); return true; case <API key>: <API key>(buffer, end, volume); return true; case SAMPLE_FORMAT_S32: <API key>(buffer, end, volume); return true; case SAMPLE_FORMAT_FLOAT: <API key>(buffer, end, pcm_volume_to_float(volume)); return true; } /* unreachable */ assert(false); return false; }
<?php define('HEADING_TITLE', 'Ch&egrave;ques cadeaux envoy&eacute;s'); define('<API key>', 'Nom de l\'expéditeur'); define('<API key>', 'Valeur du bon'); define('<API key>', 'Code du bon'); define('<API key>', 'Date de l\'envoi'); define('<API key>', 'Action'); define('<API key>', 'Identifiant de l\'exp&eacute;diteur :'); define('<API key>', 'Montant envoy&eacute; :'); define('TEXT_INFO_DATE_SENT', 'Date de l\'envoi :'); define('<API key>', 'Code du ch&egrave;que :'); define('<API key>', 'Adresse email :'); define('<API key>', 'Date de validation :'); define('<API key>', 'Adresse IP :'); define('<API key>', 'Identifiant du client :'); define('<API key>', 'Non valid&eacute;'); ?>
# icprot Web application for displaying phylogeny and results of onekp.com data analysis
<!DOCTYPE html PUBLIC "- <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="/benchmark/js/jquery.min.js"></script> <script type="text/javascript" src="/benchmark/js/js.cookie.js"></script> <title>BenchmarkTest01209</title> </head> <body> <form action="/benchmark/sqli-02/BenchmarkTest01209" method="POST" id="<API key>"> <div><label>Please explain your answer:</label></div> <br/> <div><textarea rows="4" cols="50" id="<API key>" name="<API key>"></textarea></div> <div><label>Any additional note for the reviewer:</label></div> <div><input type="text" id="answer" name="answer"></input></div> <br/> <div><label>An AJAX request will be sent with a header named BenchmarkTest01209 and value:</label> <input type="text" id="BenchmarkTest01209" name="BenchmarkTest01209" value="bar" class="safe"></input></div> <div><input type="button" id="login-btn" value="Login" onclick="submitForm()" /></div> </form> <div id="ajax-form-msg1"><pre><code class="prettyprint" id="code"></code></pre></div> <script> $('.safe').keypress(function (e) { if (e.which == 13) { submitForm(); return false; } }); function submitForm() { var formData = $("#<API key>").serialize(); var URL = $("#<API key>").attr("action"); var text = $("#<API key> input[id=BenchmarkTest01209]").val(); var xhr = new XMLHttpRequest(); xhr.open("POST", URL, true); xhr.setRequestHeader('BenchmarkTest01209', text ); xhr.onreadystatechange = function () { if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) { $("#code").html(xhr.responseText); } else { $("#code").html("Error " + xhr.status + " occurred."); } } xhr.send(formData); } function escapeRegExp(str) { return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"); } function replaceAll(str, find, replace) { return str.replace(new RegExp(escapeRegExp(find), 'g'), replace); } String.prototype.<API key> = function() { var txt = replaceAll(this,";",""); txt = replaceAll(txt,"& return txt.replace(/\\x([0-9A-Fa-f]{2})/g, function() { return String.fromCharCode(parseInt(arguments[1], 16)); }); }; </script> </body> </html>
#include <common.h> #include "lpc3250.h" #include <nand.h> #include <asm/errno.h> #include <asm/io.h> #define NAND_ALE_OFFS 4 #define NAND_CLE_OFFS 8 #define <API key> 2048 #define <API key> 512 static struct nand_ecclayout lpc32xx_nand_oob_16 = { .eccbytes = 6, .eccpos = {10, 11, 12, 13, 14, 15}, .oobfree = { {.offset = 0, . length = 4}, {.offset = 6, . length = 4} } }; extern int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc); /* * DMA Descriptors * For Large Block: 17 descriptors = ((16 Data and ECC Read) + 1 Spare Area) * For Small Block: 5 descriptors = ((4 Data and ECC Read) + 1 Spare Area) */ static dmac_ll_t dmalist[(<API key>/256) * 2 + 1]; static uint32_t ecc_buffer[8]; /* MAX ECC size */ static int dmachan = -1; #define XFER_PENDING ((SLCNAND->slc_stat & SLCSTAT_DMA_FIFO) | SLCNAND->slc_tc) static void lpc32xx_nand_init(void) { /* Enable clocks to the SLC NAND controller */ CLKPWR-><API key> = (<API key> | <API key>); /* Reset SLC NAND controller & clear ECC */ SLCNAND->slc_ctrl = (SLCCTRL_SW_RESET | SLCCTRL_ECC_CLEAR); /* 8-bit bus, no DMA, CE normal */ SLCNAND->slc_cfg = 0; /* Interrupts disabled and cleared */ SLCNAND->slc_ien = 0; SLCNAND->slc_icr = (SLCSTAT_INT_TC | SLCSTAT_INT_RDY_EN); SLCNAND->slc_tac = <API key>; } static void <API key>(struct mtd_info *mtd, int cmd, unsigned int ctrl) { struct nand_chip *this = mtd->priv; ulong IO_ADDR_W; if (ctrl & NAND_CTRL_CHANGE) { IO_ADDR_W = (ulong) this->IO_ADDR_W; IO_ADDR_W &= ~(NAND_CLE_OFFS | NAND_ALE_OFFS); if ( ctrl & NAND_CLE ) { IO_ADDR_W |= NAND_CLE_OFFS; } else if ( ctrl & NAND_ALE ) { IO_ADDR_W |= NAND_ALE_OFFS; } if ( ctrl & NAND_NCE ) { SLCNAND->slc_cfg |= SLCCFG_CE_LOW; } else { SLCNAND->slc_cfg &= ~SLCCFG_CE_LOW; } this->IO_ADDR_W = (void *) IO_ADDR_W; } if (cmd != NAND_CMD_NONE) { writel(cmd, this->IO_ADDR_W); } } static int lpc32xx_nand_ready(struct mtd_info *mtd) { /* Check the SLC NAND controller status */ return (SLCNAND->slc_stat & SLCSTAT_NAND_READY); } static u_char lpc32xx_read_byte(struct mtd_info *mtd) { struct nand_chip *this = mtd->priv; unsigned long *pReg = (unsigned long *) this->IO_ADDR_R; volatile unsigned long tmp32; tmp32 = *pReg; return (u_char) tmp32; } /* * lpc32xx_verify_buf - [DEFAULT] Verify chip data against buffer * mtd: MTD device structure * buf: buffer containing the data to compare * len: number of bytes to compare * * Default verify function for 8bit buswith */ static int lpc32xx_verify_buf(struct mtd_info *mtd, const u_char *buf, int len) { int i; struct nand_chip *this = mtd->priv; unsigned long *pReg = (unsigned long *) this->IO_ADDR_R; volatile unsigned long tmp32; for (i=0; i<len; i++) { tmp32 = *pReg; if (buf[i] != (u_char) tmp32) return -EFAULT; } return 0; } /* Prepares DMA descriptors for NAND RD/WR operations */ /* If the size is < 256 Bytes then it is assumed to be * an OOB transfer */ static void <API key>(struct nand_chip *chip, const void * buffer, int size, int read) { uint32_t i, dmasrc, ctrl, ecc_ctrl, oob_ctrl, dmadst; void __iomem * base = chip->IO_ADDR_R; uint32_t *ecc_gen = ecc_buffer; /* * CTRL descriptor entry for reading ECC * Copy Multiple times to sync DMA with Flash Controller */ ecc_ctrl = (0x5 | <API key> | <API key> | <API key> | <API key> | DMAC_CHAN_DEST_AHB1); /* CTRL descriptor entry for reading/writing Data */ ctrl = 64 | /* 256/4 */ <API key> | <API key> | <API key> | <API key> | DMAC_CHAN_DEST_AHB1; /* CTRL descriptor entry for reading/writing Spare Area */ oob_ctrl = ((<API key> / 4) | <API key> | <API key> | <API key> | <API key> | DMAC_CHAN_DEST_AHB1); if (read) { dmasrc = (uint32_t) (base + offsetof(SLCNAND_REGS_T, slc_dma_data)); dmadst = (uint32_t) (buffer); ctrl |= <API key>; } else { dmadst = (uint32_t) (base + offsetof(SLCNAND_REGS_T, slc_dma_data)); dmasrc = (uint32_t) (buffer); ctrl |= <API key>; } for (i = 0; i < size/256; i++) { dmalist[i*2].dma_src = (read ?(dmasrc) :(dmasrc + (i*256))); dmalist[i*2].dma_dest = (read ?(dmadst + (i*256)) :dmadst); dmalist[i*2].next_lli = (uint32_t) & dmalist[(i*2)+1]; dmalist[i*2].next_ctrl = ctrl; dmalist[(i*2) + 1].dma_src = (uint32_t) (base + offsetof(SLCNAND_REGS_T, slc_ecc)); dmalist[(i*2) + 1].dma_dest = (uint32_t) & ecc_gen[i]; dmalist[(i*2) + 1].next_lli = (uint32_t) & dmalist[(i*2)+2]; dmalist[(i*2) + 1].next_ctrl = ecc_ctrl; } if (i) { /* Data only transfer */ dmalist[(i*2) - 1].next_lli = 0; dmalist[(i*2) - 1].next_ctrl |= DMAC_CHAN_INT_TC_EN; return ; } /* OOB only transfer */ if (read) { dmasrc = (uint32_t) (base + offsetof(SLCNAND_REGS_T, slc_dma_data)); dmadst = (uint32_t) (buffer); oob_ctrl |= <API key>; } else { dmadst = (uint32_t) (base + offsetof(SLCNAND_REGS_T, slc_dma_data)); dmasrc = (uint32_t) (buffer); oob_ctrl |= <API key>; } /* Read/ Write Spare Area Data To/From Flash */ dmalist[i*2].dma_src = dmasrc; dmalist[i*2].dma_dest = dmadst; dmalist[i*2].next_lli = 0; dmalist[i*2].next_ctrl = (oob_ctrl | DMAC_CHAN_INT_TC_EN); } static void lpc32xx_nand_xfer(struct mtd_info *mtd, const u_char *buf, int len, int read) { struct nand_chip *chip = mtd->priv; uint32_t config; /* DMA Channel Configuration */ config = (read ? <API key> : <API key>) | (read ? DMAC_DEST_PERIP(0) : DMAC_DEST_PERIP(DMA_PERID_NAND1)) | (read ? DMAC_SRC_PERIP(DMA_PERID_NAND1) : DMAC_SRC_PERIP(0)) | DMAC_CHAN_ENABLE; /* Prepare DMA descriptors */ <API key>(chip, buf, len, read); /* Setup SLC controller and start transfer */ if (read) SLCNAND->slc_cfg |= SLCCFG_DMA_DIR; else /* NAND_ECC_WRITE */ SLCNAND->slc_cfg &= ~SLCCFG_DMA_DIR; SLCNAND->slc_cfg |= SLCCFG_DMA_BURST; /* Write length for new transfers */ if (!XFER_PENDING) SLCNAND->slc_tc = len + (len != mtd->oobsize ? mtd->oobsize : 0); SLCNAND->slc_ctrl |= SLCCTRL_DMA_START; /* Start DMA transfers */ <API key>(dmachan, dmalist, config); /* Wait for NAND to be ready */ while(!lpc32xx_nand_ready(mtd)); /* Wait till DMA transfer is DONE */ if (<API key>(dmachan)) { printk(KERN_ERR "NAND DMA transfer error!\r\n"); } /* Stop DMA & HW ECC */ SLCNAND->slc_ctrl &= ~SLCCTRL_DMA_START; SLCNAND->slc_cfg &= ~(SLCCFG_DMA_DIR | SLCCFG_DMA_BURST | SLCCFG_ECC_EN | SLCCFG_DMA_ECC); } static uint32_t <API key>(uint8_t * spare, const uint32_t * ecc, int count) { int i; for (i = 0; i < (count * 3); i += 3) { uint32_t ce = ecc[i/3]; ce = ~(ce << 2) & 0xFFFFFF; spare[i+2] = (uint8_t)(ce & 0xFF); ce >>= 8; spare[i+1] = (uint8_t)(ce & 0xFF); ce >>= 8; spare[i] = (uint8_t)(ce & 0xFF); } return 0; } static int <API key>(struct mtd_info *mtd, const uint8_t *dat, uint8_t *ecc_code) { return <API key>(ecc_code, ecc_buffer, <API key> == <API key> ? 8 : 2); } /* * Enables and prepares SLC NAND controller * for doing data transfers with H/W ECC enabled. */ static void <API key>(struct mtd_info *mtd, int mode) { /* Clear ECC */ SLCNAND->slc_ctrl = SLCCTRL_ECC_CLEAR; /* Setup SLC controller for H/W ECC operations */ SLCNAND->slc_cfg |= (SLCCFG_ECC_EN | SLCCFG_DMA_ECC); } /* * lpc32xx_write_buf - [DEFAULT] write buffer to chip * mtd: MTD device structure * buf: data buffer * len: number of bytes to write * * Default write function for 8bit buswith */ static void lpc32xx_write_buf(struct mtd_info *mtd, const u_char *buf, int len) { lpc32xx_nand_xfer(mtd, buf, len, 0); } /* * lpc32xx_read_buf - [DEFAULT] read chip data into buffer * mtd: MTD device structure * buf: buffer to store date * len: number of bytes to read * * Default read function for 8bit buswith */ static void lpc32xx_read_buf(struct mtd_info *mtd, u_char *buf, int len) { lpc32xx_nand_xfer(mtd, buf, len, 1); } int board_nand_init(struct nand_chip *nand) { /* Initial NAND interface */ lpc32xx_nand_init(); /* Acquire a channel for our use */ dmachan = <API key>(); if (unlikely(dmachan < 0)){ printk(KERN_INFO "Unable to get a free DMA " "channel for NAND transfers\r\n"); return -1; } /* ECC mode and size */ nand->ecc.mode = NAND_ECC_HW; nand->ecc.bytes = <API key>; nand->ecc.size = <API key>; if(<API key> != <API key>) nand->ecc.layout = &lpc32xx_nand_oob_16; nand->ecc.calculate = <API key>; nand->ecc.correct = nand_correct_data; nand->ecc.hwctl = <API key>; nand->cmd_ctrl = <API key>; nand->dev_ready = lpc32xx_nand_ready; nand->chip_delay = 2000; nand->read_buf = lpc32xx_read_buf; nand->write_buf = lpc32xx_write_buf; nand->read_byte = lpc32xx_read_byte; nand->verify_buf = lpc32xx_verify_buf; return 0; }
#include "Common.h" #include "Database/DatabaseEnv.h" #include "WorldPacket.h" #include "WorldSession.h" #include "Opcodes.h" #include "Log.h" #include "UpdateMask.h" #include "World.h" #include "ObjectMgr.h" #include "SpellMgr.h" #include "Player.h" #include "Unit.h" #include "Spell.h" #include "DynamicObject.h" #include "Group.h" #include "UpdateData.h" #include "ObjectAccessor.h" #include "Policies/Singleton.h" #include "Totem.h" #include "Creature.h" #include "Formulas.h" #include "BattleGround/BattleGround.h" #include "OutdoorPvP/OutdoorPvP.h" #include "CreatureAI.h" #include "ScriptMgr.h" #include "Util.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" #include "MapManager.h" #define NULL_AURA_SLOT 0xFF pAuraHandler AuraHandler[TOTAL_AURAS] = { &Aura::HandleNULL, // 0 SPELL_AURA_NONE &Aura::HandleBindSight, // 1 <API key> &Aura::HandleModPossess, // 2 <API key> &Aura::<API key>, // 3 <API key> &Aura::HandleAuraDummy, // 4 SPELL_AURA_DUMMY &Aura::HandleModConfuse, // 5 <API key> &Aura::HandleModCharm, // 6 <API key> &Aura::HandleModFear, // 7 SPELL_AURA_MOD_FEAR &Aura::HandlePeriodicHeal, // 8 <API key> &Aura::<API key>, // 9 <API key> &Aura::HandleModThreat, // 10 <API key> &Aura::HandleModTaunt, // 11 <API key> &Aura::HandleAuraModStun, // 12 SPELL_AURA_MOD_STUN &Aura::HandleModDamageDone, // 13 <API key> &Aura::<API key>, // 14 <API key> implemented in Unit::<API key> and Unit::<API key> &Aura::<API key>, // 15 <API key> implemented in Unit::DealMeleeDamage &Aura::HandleModStealth, // 16 <API key> &Aura::<API key>, // 17 <API key> implemented in Unit::<API key> &Aura::HandleInvisibility, // 18 <API key> &Aura::<API key>, // 19 <API key> &Aura::<API key>, // 20 <API key> &Aura::<API key>, // 21 <API key> &Aura::<API key>, // 22 <API key> &Aura::<API key>, // 23 <API key> &Aura::<API key>, // 24 <API key> &Aura::HandleAuraModPacify, // 25 <API key> &Aura::HandleAuraModRoot, // 26 SPELL_AURA_MOD_ROOT &Aura::<API key>, // 27 <API key> &Aura::<API key>, // 28 <API key> implement in Unit::SpellHitResult &Aura::HandleAuraModStat, // 29 SPELL_AURA_MOD_STAT &Aura::HandleAuraModSkill, // 30 <API key> &Aura::<API key>, // 31 <API key> &Aura::<API key>, // 32 <API key> &Aura::<API key>, // 33 <API key> &Aura::<API key>, // 34 <API key> &Aura::<API key>, // 35 <API key> &Aura::<API key>, // 36 <API key> &Aura::<API key>, // 37 <API key> &Aura::<API key>, // 38 <API key> &Aura::<API key>, // 39 <API key> &Aura::<API key>, // 40 <API key> &Aura::<API key>, // 41 <API key> &Aura::<API key>, // 42 <API key> implemented in Unit::<API key> and Unit::<API key> &Aura::<API key>, // 43 <API key> implemented in Unit::<API key> &Aura::<API key>, // 44 <API key> &Aura::<API key>, // 45 <API key> &Aura::HandleUnused, // 46 SPELL_AURA_46 &Aura::<API key>, // 47 <API key> &Aura::HandleUnused, // 48 SPELL_AURA_48 &Aura::<API key>, // 49 <API key> &Aura::HandleUnused, // 50 <API key> obsolete? &Aura::<API key>, // 51 <API key> &Aura::<API key>, // 52 <API key> &Aura::HandlePeriodicLeech, // 53 <API key> &Aura::HandleModHitChance, // 54 <API key> &Aura::<API key>, // 55 <API key> &Aura::HandleAuraTransform, // 56 <API key> &Aura::<API key>, // 57 <API key> &Aura::<API key>, // 58 <API key> &Aura::<API key>, // 59 <API key> implemented in Unit::<API key> and Unit::<API key> &Aura::<API key>, // 60 <API key> &Aura::HandleAuraModScale, // 61 <API key> &Aura::<API key>, // 62 <API key> &Aura::HandleUnused, // 63 <API key> obsolete? &Aura::<API key>, // 64 <API key> &Aura::<API key>, // 65 <API key> &Aura::HandleFeignDeath, // 66 <API key> &Aura::HandleAuraModDisarm, // 67 <API key> &Aura::<API key>, // 68 <API key> &Aura::HandleSchoolAbsorb, // 69 <API key> implemented in Unit::<API key> &Aura::HandleUnused, // 70 <API key> Useless, used by only one spell that has only visual effect &Aura::<API key>, // 71 <API key> &Aura::<API key>, // 72 <API key> &Aura::HandleModPowerCost, // 73 <API key> &Aura::<API key>, // 74 <API key> implemented in Unit::SpellHitResult &Aura::<API key>, // 75 <API key> implemented in WorldSession::<API key> &Aura::HandleFarSight, // 76 <API key> &Aura::<API key>, // 77 <API key> &Aura::HandleAuraMounted, // 78 SPELL_AURA_MOUNTED &Aura::<API key>, // 79 <API key> &Aura::<API key>, // 80 <API key> &Aura::<API key>, // 81 <API key> implemented in Unit::<API key> &Aura::<API key>, // 82 <API key> &Aura::<API key>, // 83 <API key> &Aura::HandleModRegen, // 84 <API key> &Aura::HandleModPowerRegen, // 85 <API key> &Aura::<API key>, // 86 <API key> &Aura::<API key>, // 87 <API key> implemented in Unit::<API key> and Unit::<API key> &Aura::<API key>, // 88 <API key> implemented in Player::RegenerateHealth &Aura::<API key>, // 89 <API key> &Aura::HandleUnused, // 90 <API key> Useless &Aura::<API key>, // 91 <API key> implemented in Creature::GetAttackDistance &Aura::<API key>, // 92 <API key> &Aura::<API key>, // 93 <API key> &Aura::<API key>, // 94 <API key> implemented in Player::RegenerateAll &Aura::HandleAuraGhost, // 95 SPELL_AURA_GHOST &Aura::<API key>, // 96 <API key> implemented in Unit::SelectMagnetTarget &Aura::HandleManaShield, // 97 <API key> implemented in Unit::<API key> &Aura::HandleAuraModSkill, // 98 <API key> &Aura::<API key>, // 99 <API key> &Aura::HandleUnused, //100 <API key> obsolete? all player can see all auras now &Aura::<API key>, //101 <API key> &Aura::<API key>, //102 <API key> implemented in Unit::<API key> &Aura::<API key>, //103 <API key> &Aura::HandleAuraWaterWalk, //104 <API key> &Aura::<API key>, //105 <API key> &Aura::HandleAuraHover, //106 SPELL_AURA_HOVER &Aura::HandleAddModifier, //107 <API key> &Aura::HandleAddModifier, //108 <API key> &Aura::<API key>, //109 <API key> &Aura::<API key>, //110 <API key> &Aura::<API key>, //111 <API key> implemented in Unit::SelectMagnetTarget &Aura::<API key>, //112 <API key> implemented in diff functions. &Aura::<API key>, //113 <API key> implemented in Unit::<API key> &Aura::<API key>, //114 <API key> implemented in Unit::<API key> &Aura::<API key>, //115 <API key> implemented in Unit::<API key> &Aura::<API key>, //116 <API key> imppemented in Player::RegenerateAll and Player::RegenerateHealth &Aura::<API key>, //117 <API key> implemented in Unit::MagicSpellHitResult &Aura::<API key>, //118 <API key> implemented in Unit::<API key> &Aura::HandleUnused, //119 <API key> useless &Aura::<API key>, //120 <API key> &Aura::HandleAuraEmpathy, //121 SPELL_AURA_EMPATHY &Aura::<API key>, //122 <API key> &Aura::<API key>, //123 <API key> &Aura::<API key>, //124 <API key> &Aura::<API key>, //125 <API key> implemented in Unit::<API key> &Aura::<API key>, //126 <API key> implemented in Unit::<API key> &Aura::<API key>, //127 <API key> implemented in Unit::<API key> &Aura::HandleModPossessPet, //128 <API key> &Aura::<API key>, //129 <API key> &Aura::<API key>, //130 <API key> &Aura::<API key>, //131 <API key> implemented in Unit::<API key> &Aura::<API key>, //132 <API key> &Aura::<API key>, //133 <API key> &Aura::<API key>, //134 <API key> &Aura::<API key>, //135 <API key> &Aura::<API key>, //136 <API key> implemented in Unit::<API key> &Aura::<API key>, //137 <API key> &Aura::<API key>, //138 <API key> &Aura::HandleForceReaction, //139 <API key> &Aura::<API key>, //140 <API key> &Aura::<API key>, //141 <API key> &Aura::<API key>, //142 <API key> &Aura::<API key>, //143 <API key> &Aura::HandleAuraSafeFall, //144 <API key> implemented in WorldSession::<API key> &Aura::HandleUnused, //145 SPELL_AURA_CHARISMA obsolete? &Aura::HandleUnused, //146 <API key> obsolete? &Aura::<API key>, //147 <API key> implemented in Unit::IsImmuneToSpell and Unit::<API key> (check part) &Aura::<API key>, //148 <API key> &Aura::<API key>, //149 <API key> implemented in Spell::Delayed and Spell::DelayedChannel &Aura::<API key>, //150 <API key> &Aura::<API key>, //151 <API key> &Aura::<API key>, //152 <API key> implemented in Creature::GetAttackDistance &Aura::<API key>, //153 <API key> implemented in Unit::<API key> &Aura::<API key>, //154 <API key> implemented in Unit::<API key> &Aura::<API key>, //155 <API key> implemented in Player::getMaxTimer &Aura::<API key>, //156 <API key> implemented in Player::<API key> &Aura::HandleUnused, //157 <API key> (single test like spell 20782, also single for 214 aura) &Aura::<API key>, //158 <API key> &Aura::<API key>, //159 <API key> implemented in Player::RewardHonor &Aura::<API key>, //160 <API key> implemented in Unit::MagicSpellHitResult &Aura::<API key>, //161 <API key> implemented in Player::RegenerateAll and Player::RegenerateHealth &Aura::HandleAuraPowerBurn, //162 <API key> &Aura::<API key>, //163 <API key> implemented in Unit::<API key> and Unit::<API key> &Aura::HandleUnused, //164 useless, only one test spell &Aura::<API key>, //165 <API key> implemented in Unit::<API key> &Aura::<API key>, //166 <API key> &Aura::<API key>, //167 <API key> &Aura::<API key>, //168 <API key> implemented in Unit::<API key>, Unit::<API key> &Aura::<API key>, //169 <API key> implemented in Unit::DealDamageBySchool, Unit::DoAttackDamage, Unit::SpellCriticalBonus &Aura::HandleDetectAmore, //170 <API key> only for Detect Amore spell &Aura::<API key>, //171 <API key> &Aura::<API key>, //172 <API key> &Aura::HandleUnused, //173 <API key> only for Proclaim Champion spell &Aura::<API key>, //174 <API key> implemented in Unit::<API key> &Aura::<API key>, //175 <API key> implemented in Unit::<API key> &Aura::<API key>, //176 <API key> only for Spirit of Redemption spell, die at aura end &Aura::HandleNULL, //177 <API key> &Aura::<API key>, //178 <API key> implemented in Unit::MagicSpellHitResult &Aura::<API key>, //179 <API key> implemented in Unit::SpellCriticalBonus &Aura::<API key>, //180 <API key> implemented in Unit::<API key> &Aura::HandleUnused, //181 <API key> unused &Aura::<API key>, //182 <API key> &Aura::<API key>, //183 <API key> only used in 28746, implemented in ThreatCalcHelper::CalcThreat &Aura::<API key>, //184 <API key> implemented in Unit::<API key> &Aura::<API key>, //185 <API key> implemented in Unit::<API key> &Aura::<API key>, //186 <API key> implemented in Unit::MagicSpellHitResult &Aura::<API key>, //187 <API key> implemented in Unit::<API key> &Aura::<API key>, //188 <API key> implemented in Unit::<API key> &Aura::HandleModRating, //189 <API key> &Aura::<API key>, //190 <API key> implemented in Player::<API key> &Aura::<API key>, //191 <API key> &Aura::<API key>, //192 <API key> &Aura::<API key>, //193 <API key> (in fact combat (any type attack) speed pct) &Aura::HandleUnused, //194 <API key> not used now (old <API key>) &Aura::HandleUnused, //195 <API key> not used now (old <API key>) &Aura::HandleNULL, //196 <API key> &Aura::<API key>, //197 <API key> implemented in Unit::SpellCriticalBonus Unit::<API key> &Aura::HandleUnused, //198 <API key> &Aura::<API key>, //199 <API key> implemented in Unit::MagicSpellHitResult &Aura::<API key>, //200 <API key> implemented in Player::GiveXP &Aura::<API key>, //201 SPELL_AURA_FLY this aura enable flight mode... &Aura::<API key>, //202 <API key> implemented in Unit::MeleeSpellHitResult &Aura::<API key>, //203 <API key> implemented in Unit::<API key> and Unit::<API key> &Aura::<API key>, //204 <API key> implemented in Unit::<API key> and Unit::<API key> &Aura::<API key>, //205 <API key> implemented in Unit::<API key> &Aura::<API key>, //206 <API key> &Aura::<API key>, //207 <API key> &Aura::<API key>, //208 <API key> &Aura::<API key>, //209 <API key> &Aura::<API key>, //210 <API key> &Aura::<API key>, //211 <API key> &Aura::<API key>, //212 <API key> &Aura::<API key>, //213 <API key> implemented in Player::RewardRage &Aura::HandleNULL, //214 Tamed Pet Passive &Aura::<API key>, //215 <API key> &Aura::<API key>, //216 <API key> &Aura::HandleUnused, //217 unused &Aura::<API key>, //218 <API key> &Aura::HandleModManaRegen, //219 <API key> &Aura::HandleUnused, //220 <API key> &Aura::HandleNULL, //221 ignored &Aura::HandleUnused, //222 unused &Aura::HandleNULL, //223 Cold Stare &Aura::HandleUnused, //224 unused &Aura::<API key>, //225 <API key> &Aura::<API key>, //226 <API key> &Aura::<API key>, //227 <API key> &Aura::<API key>, //228 <API key> &Aura::<API key>, //229 <API key> implemented in Unit::<API key> &Aura::<API key>, //230 Commanding Shout &Aura::<API key>, //231 <API key> &Aura::<API key>, //232 <API key> implement in Unit::<API key> &Aura::HandleNULL, //233 set model id to the one of the creature with id m_modifier.m_miscvalue &Aura::<API key>, //234 <API key> implement in Unit::<API key> &Aura::<API key>, //235 <API key> implement in Unit::MagicSpellHitResult &Aura::HandleUnused, //236 unused &Aura::<API key>, //237 <API key> implemented in Unit::<API key> &Aura::<API key>, //238 <API key> implemented in Unit::<API key> &Aura::HandleAuraModScale, //239 <API key> only in Noggenfogger Elixir (16595) before 2.3.0 aura 61 &Aura::<API key>, //240 <API key> &Aura::<API key>, //241 Forces the caster to move forward &Aura::HandleUnused, //242 unused &Aura::HandleUnused, //243 used by two test spells &Aura::<API key>, //244 <API key> &Aura::HandleUnused, //245 unused &Aura::HandleUnused, //246 unused &Aura::<API key>, //247 <API key> target to become a clone of the caster &Aura::<API key>, //248 <API key> implemented in Unit::<API key> &Aura::HandleNULL, //249 &Aura::<API key>, //250 <API key> &Aura::HandleNULL, //251 <API key> &Aura::HandleUnused, //252 unused &Aura::HandleUnused, //253 unused &Aura::HandleUnused, //254 unused &Aura::HandleUnused, //255 unused &Aura::HandleUnused, //256 unused &Aura::HandleUnused, //257 unused &Aura::HandleUnused, //258 unused &Aura::HandleUnused, //259 unused &Aura::HandleUnused, //260 unused &Aura::HandleNULL //261 SPELL_AURA_261 some phased state (44856 spell) }; static AuraType const frozenAuraTypes[] = { SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_NONE }; Aura::Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster, Item* castItem) : m_spellmod(NULL), m_periodicTimer(0), m_periodicTick(0), m_removeMode(<API key>), m_effIndex(eff), m_positive(false), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false), m_in_use(0), m_spellAuraHolder(holder) { MANGOS_ASSERT(target); MANGOS_ASSERT(spellproto && spellproto == sSpellStore.LookupEntry(spellproto->Id) && "`info` must be pointer to sSpellStore element"); m_currentBasePoints = currentBasePoints ? *currentBasePoints : spellproto-><API key>(eff); m_positive = IsPositiveEffect(spellproto, m_effIndex); m_applyTime = time(NULL); int32 damage; if (!caster) damage = m_currentBasePoints; else { damage = caster-><API key>(target, spellproto, m_effIndex, &m_currentBasePoints); if (!damage && castItem && castItem->GetItemSuffixFactor()) { <API key> const* item_rand_suffix = <API key>.LookupEntry(abs(castItem-><API key>())); if (item_rand_suffix) { for (int k = 0; k < 3; ++k) { <API key> const* pEnchant = <API key>.LookupEntry(item_rand_suffix->enchant_id[k]); if (pEnchant) { for (int t = 0; t < 3; ++t) { if (pEnchant->spellid[t] != spellproto->Id) continue; damage = uint32((item_rand_suffix->prefix[k] * castItem->GetItemSuffixFactor()) / 10000); break; } } if (damage) break; } } } } DEBUG_FILTER_LOG(<API key>, "Aura: construct Spellid : %u, Aura : %u Target : %d Damage : %d", spellproto->Id, spellproto->EffectApplyAuraName[eff], spellproto-><API key>[eff], damage); SetModifier(AuraType(spellproto->EffectApplyAuraName[eff]), damage, spellproto->EffectAmplitude[eff], spellproto->EffectMiscValue[eff]); Player* modOwner = caster ? caster->GetSpellModOwner() : NULL; // Apply periodic time mod if (modOwner && m_modifier.periodictime) modOwner->ApplySpellMod(spellproto->Id, <API key>, m_modifier.periodictime); // Start periodic on next tick or at aura apply if (!spellproto->HasAttribute(<API key>)) m_periodicTimer = m_modifier.periodictime; } Aura::~Aura() { } AreaAura::AreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem) { m_isAreaAura = true; // caster==NULL in constructor args if target==caster in fact Unit* caster_ptr = caster ? caster : target; m_radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellproto->EffectRadiusIndex[m_effIndex])); if (Player* modOwner = caster_ptr->GetSpellModOwner()) modOwner->ApplySpellMod(spellproto->Id, SPELLMOD_RADIUS, m_radius); switch (spellproto->Effect[eff]) { case <API key>: m_areaAuraType = AREA_AURA_PARTY; break; case <API key>: m_areaAuraType = AREA_AURA_FRIEND; break; case <API key>: m_areaAuraType = AREA_AURA_ENEMY; if (target == caster_ptr) m_modifier.m_auraname = SPELL_AURA_NONE; // Do not do any effect on self break; case <API key>: m_areaAuraType = AREA_AURA_PET; break; case <API key>: m_areaAuraType = AREA_AURA_OWNER; if (target == caster_ptr) m_modifier.m_auraname = SPELL_AURA_NONE; break; default: sLog.outError("Wrong spell effect in AreaAura constructor"); MANGOS_ASSERT(false); break; } // totems are immune to any kind of area auras if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsTotem()) m_modifier.m_auraname = SPELL_AURA_NONE; } AreaAura::~AreaAura() { } PersistentAreaAura::PersistentAreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem) { m_isPersistent = true; } PersistentAreaAura::~PersistentAreaAura() { } <API key>::<API key>(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem) { if (caster) m_castersTargetGuid = caster->GetTypeId() == TYPEID_PLAYER ? ((Player*)caster)->GetSelectionGuid() : caster->GetTargetGuid(); } <API key>::~<API key>() { } Unit* <API key>::GetTriggerTarget() const { return ObjectAccessor::GetUnit(*(m_spellAuraHolder->GetTarget()), m_castersTargetGuid); } Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster, Item* castItem) { if (IsAreaAuraEffect(spellproto->Effect[eff])) return new AreaAura(spellproto, eff, currentBasePoints, holder, target, caster, castItem); uint32 triggeredSpellId = spellproto->EffectTriggerSpell[eff]; if (SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggeredSpellId)) for (int i = 0; i < MAX_EFFECT_INDEX; ++i) if (triggeredSpellInfo-><API key>[i] == TARGET_SINGLE_ENEMY) return new <API key>(spellproto, eff, currentBasePoints, holder, target, caster, castItem); return new Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem); } SpellAuraHolder* <API key>(SpellEntry const* spellproto, Unit* target, WorldObject* caster, Item* castItem) { return new SpellAuraHolder(spellproto, target, caster, castItem); } void Aura::SetModifier(AuraType t, int32 a, uint32 pt, int32 miscValue) { m_modifier.m_auraname = t; m_modifier.m_amount = a; m_modifier.m_miscvalue = miscValue; m_modifier.periodictime = pt; } void Aura::Update(uint32 diff) { if (m_isPeriodic) { m_periodicTimer -= diff; if (m_periodicTimer <= 0) // tick also at m_periodicTimer==0 to prevent lost last tick in case max m_duration == (max m_periodicTimer)*N { // update before applying (aura can be removed in TriggerSpell or PeriodicTick calls) m_periodicTimer += m_modifier.periodictime; ++m_periodicTick; // for some infinity auras in some cases can overflow and reset PeriodicTick(); } } } void AreaAura::Update(uint32 diff) { // update for the caster of the aura if (GetCasterGuid() == GetTarget()->GetObjectGuid()) { Unit* caster = GetTarget(); if (!caster->hasUnitState(UNIT_STAT_ISOLATED)) { Unit* owner = caster->GetCharmerOrOwner(); if (!owner) owner = caster; Spell::UnitList targets; switch (m_areaAuraType) { case AREA_AURA_PARTY: { Group* pGroup = NULL; if (owner->GetTypeId() == TYPEID_PLAYER) pGroup = ((Player*)owner)->GetGroup(); if (pGroup) { uint8 subgroup = ((Player*)owner)->GetSubGroup(); for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); if (Target && Target->isAlive() && Target->GetSubGroup() == subgroup && caster->IsFriendlyTo(Target)) { if (caster->IsWithinDistInMap(Target, m_radius)) targets.push_back(Target); Pet* pet = Target->GetPet(); if (pet && pet->isAlive() && caster->IsWithinDistInMap(pet, m_radius)) targets.push_back(pet); } } } else { // add owner if (owner != caster && caster->IsWithinDistInMap(owner, m_radius)) targets.push_back(owner); // add caster's pet Unit* pet = caster->GetPet(); if (pet && caster->IsWithinDistInMap(pet, m_radius)) targets.push_back(pet); } break; } case AREA_AURA_FRIEND: { MaNGOS::<API key> u_check(caster, m_radius); MaNGOS::UnitListSearcher<MaNGOS::<API key>> searcher(targets, u_check); Cell::VisitAllObjects(caster, searcher, m_radius); break; } case AREA_AURA_ENEMY: { MaNGOS::<API key> u_check(caster, m_radius); // No GetCharmer in searcher MaNGOS::UnitListSearcher<MaNGOS::<API key>> searcher(targets, u_check); Cell::VisitAllObjects(caster, searcher, m_radius); break; } case AREA_AURA_OWNER: case AREA_AURA_PET: { if (owner != caster && caster->IsWithinDistInMap(owner, m_radius)) targets.push_back(owner); break; } } for (Spell::UnitList::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) { // flag for seelction is need apply aura to current iteration target bool apply = true; // we need ignore present caster self applied are auras sometime // in cases if this only auras applied for spell effect Unit::<API key> spair = (*tIter)-><API key>(GetId()); for (Unit::SpellAuraHolderMap::const_iterator i = spair.first; i != spair.second; ++i) { if (i->second->IsDeleted()) continue; Aura* aur = i->second-><API key>(m_effIndex); if (!aur) continue; switch (m_areaAuraType) { case AREA_AURA_ENEMY: // non caster self-casted auras (non stacked) if (aur->GetModifier()->m_auraname != SPELL_AURA_NONE) apply = false; break; default: // in generic case not allow stacking area auras apply = false; break; } if (!apply) break; } if (!apply) continue; // Skip some targets (TODO: Might require better checks, also unclear how the actual caster must/can be handled) if (GetSpellProto()->HasAttribute(<API key>) && (*tIter)->GetTypeId() != TYPEID_PLAYER) continue; if (SpellEntry const* actualSpellInfo = sSpellMgr.<API key>(GetSpellProto(), (*tIter)->getLevel())) { int32 actualBasePoints = m_currentBasePoints; // recalculate basepoints for lower rank (all AreaAura spell not use custom basepoints?) if (actualSpellInfo != GetSpellProto()) actualBasePoints = actualSpellInfo-><API key>(m_effIndex); SpellAuraHolder* holder = (*tIter)->GetSpellAuraHolder(actualSpellInfo->Id, GetCasterGuid()); bool addedToExisting = true; if (!holder) { holder = <API key>(actualSpellInfo, (*tIter), caster); addedToExisting = false; } holder->SetAuraDuration(GetAuraDuration()); AreaAura* aur = new AreaAura(actualSpellInfo, m_effIndex, &actualBasePoints, holder, (*tIter), caster, NULL); holder->AddAura(aur, m_effIndex); if (addedToExisting) { (*tIter)->AddAuraToModList(aur); holder->SetInUse(true); aur->ApplyModifier(true, true); holder->SetInUse(false); } else (*tIter)->AddSpellAuraHolder(holder); } } } Aura::Update(diff); } else // aura at non-caster { Unit* caster = GetCaster(); Unit* target = GetTarget(); Aura::Update(diff); // remove aura if out-of-range from caster (after teleport for example) // or caster is isolated or caster no longer has the aura // or caster is (no longer) friendly bool needFriendly = (m_areaAuraType == AREA_AURA_ENEMY ? false : true); if (!caster || caster->hasUnitState(UNIT_STAT_ISOLATED) || !caster->IsWithinDistInMap(target, m_radius) || !caster->HasAura(GetId(), GetEffIndex()) || caster->IsFriendlyTo(target) != needFriendly ) { target-><API key>(GetId(), GetEffIndex(), GetCasterGuid()); } else if (m_areaAuraType == AREA_AURA_PARTY) // check if in same sub group { // not check group if target == owner or target == pet if (caster-><API key>() != target->GetObjectGuid() && caster->GetObjectGuid() != target-><API key>()) { Player* check = caster-><API key>(); Group* pGroup = check ? check->GetGroup() : NULL; if (pGroup) { Player* checkTarget = target-><API key>(); if (!checkTarget || !pGroup->SameSubGroup(check, checkTarget)) target-><API key>(GetId(), GetEffIndex(), GetCasterGuid()); } else target-><API key>(GetId(), GetEffIndex(), GetCasterGuid()); } } else if (m_areaAuraType == AREA_AURA_PET || m_areaAuraType == AREA_AURA_OWNER) { if (target->GetObjectGuid() != caster-><API key>()) target-><API key>(GetId(), GetEffIndex(), GetCasterGuid()); } } } void PersistentAreaAura::Update(uint32 diff) { bool remove = false; // remove the aura if its caster or the dynamic object causing it was removed // or if the target moves too far from the dynamic object if (Unit* caster = GetCaster()) { DynamicObject* dynObj = caster->GetDynObject(GetId(), GetEffIndex()); if (dynObj) { if (!GetTarget()->IsWithinDistInMap(dynObj, dynObj->GetRadius())) { remove = true; dynObj->RemoveAffected(GetTarget()); // let later reapply if target return to range } } else remove = true; } else remove = true; Aura::Update(diff); if (remove) GetTarget()->RemoveAura(GetId(), GetEffIndex()); } void Aura::ApplyModifier(bool apply, bool Real) { AuraType aura = m_modifier.m_auraname; GetHolder()->SetInUse(true); SetInUse(true); if (aura < TOTAL_AURAS) (*this.*AuraHandler [aura])(apply, Real); SetInUse(false); GetHolder()->SetInUse(false); } bool Aura::isAffectedOnSpell(SpellEntry const* spell) const { if (m_spellmod) return m_spellmod->isAffectedOnSpell(spell); // Check family name if (spell->SpellFamilyName != GetSpellProto()->SpellFamilyName) return false; ClassFamilyMask mask = sSpellMgr.GetSpellAffectMask(GetId(), GetEffIndex()); return spell->IsFitToFamilyMask(mask); } bool Aura::CanProcFrom(SpellEntry const* spell, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const { // Check EffectClassMask (in pre-3.x stored in spell_affect in fact) ClassFamilyMask mask = sSpellMgr.GetSpellAffectMask(GetId(), GetEffIndex()); // if no class mask defined, or spell_proc_event has SpellFamilyName=0 - allow proc if (!useClassMask || !mask) { if (!(EventProcEx & <API key>)) { // Check for extra req (if none) and hit/crit if (EventProcEx == PROC_EX_NONE) { // No extra req, so can trigger only for active (damage/healing present) and hit/crit if ((procEx & (PROC_EX_NORMAL_HIT | <API key>)) && active) return true; else return false; } else // Passive spells hits here only if resist/reflect/immune/evade { // Passive spells can`t trigger if need hit (exclude cases when procExtra include non-active flags) if ((EventProcEx & (PROC_EX_NORMAL_HIT | <API key>) & procEx) && !active) return false; } } return true; } else { // SpellFamilyName check is performed in SpellMgr::<API key> and it is done once for whole holder // note: SpellFamilyName is not checked if no spell_proc_event is defined return mask.IsFitToFamilyMask(spell->SpellFamilyFlags); } } void Aura::<API key>(Unit* target, bool owner_mode) { // we need store cast item guids for self casted spells // expected that not exist permanent auras from stackable auras from different items std::map<uint32, ObjectGuid> affectedSelf; std::set<uint32> affectedAuraCaster; for (Unit::SpellAuraHolderMap::const_iterator itr = target-><API key>().begin(); itr != target-><API key>().end(); ++itr) { // permanent passive or permanent area aura // passive spells can be affected only by own or owner spell mods) if ((itr->second->IsPermanent() && ((owner_mode && itr->second->IsPassive()) || itr->second->IsAreaAura())) && // non deleted and not same aura (any with same spell id) !itr->second->IsDeleted() && itr->second->GetId() != GetId() && // and affected by aura isAffectedOnSpell(itr->second->GetSpellProto())) { // only applied by self or aura caster if (itr->second->GetCasterGuid() == target->GetObjectGuid()) affectedSelf[itr->second->GetId()] = itr->second->GetCastItemGuid(); else if (itr->second->GetCasterGuid() == GetCasterGuid()) affectedAuraCaster.insert(itr->second->GetId()); } } if (!affectedSelf.empty()) { Player* pTarget = target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : NULL; for (std::map<uint32, ObjectGuid>::const_iterator map_itr = affectedSelf.begin(); map_itr != affectedSelf.end(); ++map_itr) { Item* item = pTarget && map_itr->second ? pTarget->GetItemByGuid(map_itr->second) : NULL; target-><API key>(map_itr->first); target->CastSpell(target, map_itr->first, true, item); } } if (!affectedAuraCaster.empty()) { Unit* caster = GetCaster(); for (std::set<uint32>::const_iterator set_itr = affectedAuraCaster.begin(); set_itr != affectedAuraCaster.end(); ++set_itr) { target-><API key>(*set_itr); if (caster) caster->CastSpell(GetTarget(), *set_itr, true); } } } struct <API key> { explicit <API key>(Aura* _aura) : aura(_aura) {} void operator()(Unit* unit) const { aura-><API key>(unit, true); } Aura* aura; }; void Aura::<API key>() { // not reapply spell mods with charges (use original value because processed and at remove) if (GetSpellProto()->procCharges) return; // not reapply some spell mods ops (mostly speedup case) switch (m_modifier.m_miscvalue) { case SPELLMOD_DURATION: case SPELLMOD_CHARGES: case <API key>: case <API key>: case SPELLMOD_COOLDOWN: case SPELLMOD_COST: case <API key>: case <API key>: return; } // reapply talents to own passive persistent auras <API key>(GetTarget(), true); // re-apply talents/passives/area auras applied to pet/totems (it affected by player spellmods) GetTarget()-><API key>(<API key>(this), CONTROLLED_PET | CONTROLLED_TOTEMS); // re-apply talents/passives/area auras applied to group members (it affected by player spellmods) if (Group* group = ((Player*)GetTarget())->GetGroup()) for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* member = itr->getSource()) if (member != GetTarget() && member->IsInMap(GetTarget())) <API key>(member, false); } /*** BASIC AURA FUNCTION ***/ void Aura::HandleAddModifier(bool apply, bool Real) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER || !Real) return; if (m_modifier.m_miscvalue >= MAX_SPELLMOD) return; if (apply) { SpellEntry const* spellProto = GetSpellProto(); // Add custom charges for some mod aura switch (spellProto->Id) { case 17941: // Shadow Trance case 22008: // Netherwind Focus case 34936: // Backlash GetHolder()->SetAuraCharges(1); break; } m_spellmod = new SpellModifier( SpellModOp(m_modifier.m_miscvalue), SpellModType(m_modifier.m_auraname), // SpellModType value == spell aura types m_modifier.m_amount, this, // prevent expire spell mods with (charges > 0 && m_stackAmount > 1) // all this spell expected expire not at use but at spell proc event check spellProto->StackAmount > 1 ? 0 : GetHolder()->GetAuraCharges()); } ((Player*)GetTarget())->AddSpellMod(m_spellmod, apply); <API key>(); } void Aura::TriggerSpell() { ObjectGuid casterGUID = GetCasterGuid(); Unit* triggerTarget = GetTriggerTarget(); if (!casterGUID || !triggerTarget) return; // generic casting code with custom spells and target/caster customs uint32 trigger_spell_id = GetSpellProto()->EffectTriggerSpell[m_effIndex]; SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(trigger_spell_id); SpellEntry const* auraSpellInfo = GetSpellProto(); uint32 auraId = auraSpellInfo->Id; Unit* target = GetTarget(); Unit* triggerCaster = triggerTarget; WorldObject* triggerTargetObject = NULL; // specific code for cases with no trigger spell provided in field if (triggeredSpellInfo == NULL) { switch (auraSpellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: { switch (auraId) { // Firestone Passive (1-5 ranks) case 758: case 17945: case 17947: case 17949: case 27252: { if (triggerTarget->GetTypeId() != TYPEID_PLAYER) return; Item* item = ((Player*)triggerTarget)->GetWeaponForAttack(BASE_ATTACK); if (!item) return; uint32 enchant_id = 0; switch (GetId()) { case 758: enchant_id = 1803; break; // Rank 1 case 17945: enchant_id = 1823; break; // Rank 2 case 17947: enchant_id = 1824; break; // Rank 3 case 17949: enchant_id = 1825; break; // Rank 4 case 27252: enchant_id = 2645; break; // Rank 5 default: return; } // remove old enchanting before applying new ((Player*)triggerTarget)->ApplyEnchantment(item, <API key>, false); item->SetEnchantment(<API key>, enchant_id, m_modifier.periodictime + 1000, 0); // add new enchanting ((Player*)triggerTarget)->ApplyEnchantment(item, <API key>, true); return; } case 812: // Periodic Mana Burn { trigger_spell_id = 25779; // Mana Burn if (GetTarget()->GetTypeId() != TYPEID_UNIT) return; triggerTarget = ((Creature*)GetTarget())-><API key>(<API key>, 0, trigger_spell_id, <API key>); if (!triggerTarget) return; break; } // // Polymorphic Ray // case 6965: break; // // Fire Nova (1-7 ranks) // case 8350: // case 8508: // case 8509: // case 11312: // case 11313: // case 25540: // case 25544: // break; case 9712: // Thaumaturgy Channel trigger_spell_id = 21029; break; // // Egan's Blaster // case 17368: break; // // Haunted // case 18347: break; // // Ranshalla Waiting // case 18953: break; // // Inferno // case 19695: break; // // Frostwolf Muzzle DND // case 21794: break; // // Alterac Ram Collar DND // case 21866: break; // // Celebras Waiting // case 21916: break; case 23170: // Brood Affliction: Bronze { target->CastSpell(target, 23171, true, NULL, this); return; } case 23184: // Mark of Frost case 25041: // Mark of Nature case 37125: // Mark of Death { std::list<Player*> targets; // spells existed in 1.x.x; 23183 - mark of frost; 25042 - mark of nature; both had radius of 100.0 yards in 1.x.x DBC // spells are used by Azuregos and the Emerald dragons in order to put a stun debuff on the players which resurrect during the encounter // in order to implement the missing spells we need to make a grid search for hostile players and check their auras; if they are marked apply debuff // spell 37127 used for the Mark of Death, is used server side, so it needs to be implemented here uint32 markSpellId = 0; uint32 debuffSpellId = 0; switch (auraId) { case 23184: markSpellId = 23182; debuffSpellId = 23186; break; case 25041: markSpellId = 25040; debuffSpellId = 25043; break; case 37125: markSpellId = 37128; debuffSpellId = 37131; break; } MaNGOS::<API key> u_check(GetTarget(), 100.0f, markSpellId); MaNGOS::PlayerListSearcher<MaNGOS::<API key> > checker(targets, u_check); Cell::VisitWorldObjects(GetTarget(), checker, 100.0f); for (std::list<Player*>::iterator itr = targets.begin(); itr != targets.end(); ++itr) (*itr)->CastSpell((*itr), debuffSpellId, true, NULL, NULL, casterGUID); return; } case 23493: // Restoration { uint32 heal = triggerTarget->GetMaxHealth() / 10; triggerTarget->DealHeal(triggerTarget, heal, auraSpellInfo); if (int32 mana = triggerTarget->GetMaxPower(POWER_MANA)) { mana /= 10; triggerTarget->EnergizeBySpell(triggerTarget, 23493, mana, POWER_MANA); } return; } // // Stoneclaw Totem Passive TEST // case 23792: break; // // Axe Flurry // case 24018: break; case 24210: // Mark of Arlokk { // Replacement for (classic) spell 24211 (doesn't exist anymore) std::list<Creature*> lList; // Search for all Zulian Prowler in range MaNGOS::<API key> check(triggerTarget, 15101, 15.0f); MaNGOS::<API key><MaNGOS::<API key>> searcher(lList, check); Cell::VisitGridObjects(triggerTarget, searcher, 15.0f); for (std::list<Creature*>::const_iterator itr = lList.begin(); itr != lList.end(); ++itr) if ((*itr)->isAlive()) (*itr)->AddThreat(triggerTarget, float(5000)); return; } // // Restoration // case 24379: break; // // Happy Pet // case 24716: break; case 24780: // Dream Fog { // Note: In 1.12 triggered spell 24781 still exists, need to script dummy effect for this spell then // Select an unfriendly enemy in 100y range and attack it if (target->GetTypeId() != TYPEID_UNIT) return; ThreatList const& tList = target->getThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) { Unit* pUnit = target->GetMap()->GetUnit((*itr)->getUnitGuid()); if (pUnit && target->getThreatManager().getThreat(pUnit)) target->getThreatManager().modifyThreatPercent(pUnit, -100); } if (Unit* pEnemy = target-><API key>(target->getVictim(), 100.0f)) ((Creature*)target)->AI()->AttackStart(pEnemy); return; } // // Cannon Prep // case 24832: break; case 24834: // Shadow Bolt Whirl { uint32 spellForTick[8] = { 24820, 24821, 24822, 24823, 24835, 24836, 24837, 24838 }; uint32 tick = (GetAuraTicks() + 7) % 8; // casted in left/right (but triggered spell have wide forward cone) float forward = target->GetOrientation(); if (tick <= 3) target->SetOrientation(forward + 0.75f * M_PI_F - tick * M_PI_F / 8); // Left else target->SetOrientation(forward - 0.75f * M_PI_F + (8 - tick) * M_PI_F / 8); // Right triggerTarget->CastSpell(triggerTarget, spellForTick[tick], true, NULL, this, casterGUID); target->SetOrientation(forward); return; } // // Stink Trap // case 24918: break; // // Agro Drones // case 25152: break; case 25371: // Consume { int32 bpDamage = triggerTarget->GetMaxHealth() * 10 / 100; triggerTarget->CastCustomSpell(triggerTarget, 25373, &bpDamage, NULL, NULL, true, NULL, this, casterGUID); return; } // // Pain Spike // case 25572: break; case 26009: // Rotate 360 case 26136: // Rotate -360 { float newAngle = target->GetOrientation(); if (auraId == 26009) newAngle += M_PI_F / 40; else newAngle -= M_PI_F / 40; newAngle = MapManager::<API key>(newAngle); target->SetFacingTo(newAngle); target->CastSpell(target, 26029, true); return; } // // Consume // case 26196: break; // // Berserk // case 26615: break; // // Defile // case 27177: break; // // Teleport: IF/UC // case 27601: break; // // Five Fat Finger Exploding Heart Technique // case 27673: break; // // Nitrous Boost // case 27746: break; // // Steam Tank Passive // case 27747: break; case 27808: // Frost Blast { int32 bpDamage = triggerTarget->GetMaxHealth() * 26 / 100; triggerTarget->CastCustomSpell(triggerTarget, 29879, &bpDamage, NULL, NULL, true, NULL, this, casterGUID); return; } // Detonate Mana case 27819: { // 50% Mana Burn int32 bpDamage = (int32)triggerTarget->GetPower(POWER_MANA) * 0.5f; triggerTarget->ModifyPower(POWER_MANA, -bpDamage); triggerTarget->CastCustomSpell(triggerTarget, 27820, &bpDamage, NULL, NULL, true, NULL, this, triggerTarget->GetObjectGuid()); return; } // // Controller Timer // case 28095: break; // Stalagg Chain and Feugen Chain case 28096: case 28111: { // X-Chain is casted by Tesla to X, so: caster == Tesla, target = X Unit* pCaster = GetCaster(); if (pCaster && pCaster->GetTypeId() == TYPEID_UNIT && !pCaster->IsWithinDistInMap(target, 60.0f)) { pCaster-><API key>(true); ((Creature*)pCaster)->SetInCombatWithZone(); // Stalagg Tesla Passive or Feugen Tesla Passive pCaster->CastSpell(pCaster, auraId == 28096 ? 28097 : 28109, true, NULL, NULL, target->GetObjectGuid()); } return; } // Stalagg Tesla Passive and Feugen Tesla Passive case 28097: case 28109: { // X-Tesla-Passive is casted by Tesla on Tesla with original caster X, so: caster = X, target = Tesla Unit* pCaster = GetCaster(); if (pCaster && pCaster->GetTypeId() == TYPEID_UNIT) { if (pCaster->getVictim() && !pCaster->IsWithinDistInMap(target, 60.0f)) { if (Unit* pTarget = ((Creature*)pCaster)-><API key>(<API key>, 0)) target->CastSpell(pTarget, 28099, false);// Shock } else { // "Evade" target-><API key>(auraId); target->DeleteThreatList(); target->CombatStop(true); // Recast chain (Stalagg Chain or Feugen Chain target->CastSpell(pCaster, auraId == 28097 ? 28096 : 28111, false); } } return; } // // Mark of Didier // case 28114: break; // // Communique Timer, camp // case 28346: break; // // Icebolt // case 28522: break; // // Silithyst // case 29519: break; case 29528: // Inoculate Nestlewood Owlkin // prevent error reports in case ignored player target if (triggerTarget->GetTypeId() != TYPEID_UNIT) return; break; // // Overload // case 29768: break; // // Return Fire // case 29788: break; // // Return Fire // case 29793: break; // // Return Fire // case 29794: break; // // Guardian of Icecrown Passive // case 29897: break; case 29917: // Feed Captured Animal trigger_spell_id = 29916; break; // // Flame Wreath // case 29946: break; // // Flame Wreath // case 29947: break; // // Mind Exhaustion Passive // case 30025: break; // // Nether Beam - Serenity // case 30401: break; case 30427: // Extract Gas { Unit* caster = GetCaster(); if (!caster) return; // move loot to player inventory and despawn target if (caster->GetTypeId() == TYPEID_PLAYER && triggerTarget->GetTypeId() == TYPEID_UNIT && ((Creature*)triggerTarget)->GetCreatureInfo()->type == <API key>) { Player* player = (Player*)caster; Creature* creature = (Creature*)triggerTarget; // missing lootid has been reported on startup - just return if (!creature->GetCreatureInfo()->SkinLootId) return; player->AutoStoreLoot(creature, creature->GetCreatureInfo()->SkinLootId, <API key>, true); creature->ForcedDespawn(); } return; } case 30576: // Quake trigger_spell_id = 30571; break; // // Burning Maul // case 30598: break; // // Regeneration // case 30799: // case 30800: // case 30801: // break; // // Despawn Self - Smoke cloud // case 31269: break; // // Time Rift Periodic // case 31320: break; // // Corrupt Medivh // case 31326: break; case 31347: // Doom { target->CastSpell(target, 31350, true); target->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, <API key>, NULL, false); return; } case 31373: // Spellcloth { // Summon Elemental after create item triggerTarget->SummonCreature(17870, 0.0f, 0.0f, 0.0f, triggerTarget->GetOrientation(), <API key>, 0); return; } // // Bloodmyst Tesla // case 31611: break; case 31944: // Doomfire { int32 damage = m_modifier.m_amount * ((GetAuraDuration() + m_modifier.periodictime) / GetAuraMaxDuration()); triggerTarget->CastCustomSpell(triggerTarget, 31969, &damage, NULL, NULL, true, NULL, this, casterGUID); return; } // // Teleport Test // case 32236: break; // // Earthquake // case 32686: break; // // Possess // case 33401: break; // // Draw Shadows // case 33563: break; // // Murmur's Touch // case 33711: break; case 34229: // Flame Quills { // cast 24 spells 34269-34289, 34314-34316 for (uint32 spell_id = 34269; spell_id != 34290; ++spell_id) triggerTarget->CastSpell(triggerTarget, spell_id, true, NULL, this, casterGUID); for (uint32 spell_id = 34314; spell_id != 34317; ++spell_id) triggerTarget->CastSpell(triggerTarget, spell_id, true, NULL, this, casterGUID); return; } // // Gravity Lapse // case 34480: break; // // Tornado // case 34683: break; // // Frostbite Rotate // case 34748: break; // // Arcane Flurry // case 34821: break; // // Interrupt Shutdown // case 35016: break; // // Interrupt Shutdown // case 35176: break; // // Inferno // case 35268: break; // // Salaadin's Tesla // case 35515: break; // // Ethereal Channel (Red) // case 35518: break; // // Nether Vapor // case 35879: break; // // Dark Portal Storm // case 36018: break; // // Burning Maul // case 36056: break; // // Living Grove Defender Lifespan // case 36061: break; // // Professor Dabiri Talks // case 36064: break; // // Kael Gaining Power // case 36091: break; // // They Must Burn Bomb Aura // case 36344: break; // // They Must Burn Bomb Aura (self) // case 36350: break; // // Stolen Ravenous Ravager Egg // case 36401: break; // // Activated Cannon // case 36410: break; // // Stolen Ravenous Ravager Egg // case 36418: break; // // Enchanted Weapons // case 36510: break; // // Cursed Scarab Periodic // case 36556: break; // // Cursed Scarab Despawn Periodic // case 36561: break; case 36573: // Vision Guide { if (GetAuraTicks() == 10 && target->GetTypeId() == TYPEID_PLAYER) { ((Player*)target)-><API key>(10525); target-><API key>(36573); } return; } // // Cannon Charging (platform) // case 36785: break; // // Cannon Charging (self) // case 36860: break; case 37027: // Remote Toy trigger_spell_id = 37029; break; // // Mark of Death // case 37125: break; // // Arcane Flurry // case 37268: break; case 37429: // Spout (left) case 37430: // Spout (right) { float newAngle = target->GetOrientation(); if (auraId == 37429) newAngle += 2 * M_PI_F / 100; else newAngle -= 2 * M_PI_F / 100; newAngle = MapManager::<API key>(newAngle); target->SetFacingTo(newAngle); target->CastSpell(target, 37433, true); return; } // // Karazhan - Chess NPC AI, Snapshot timer // case 37440: break; // // Karazhan - Chess NPC AI, action timer // case 37504: break; // // Karazhan - Chess: Is Square OCCUPIED aura (DND) // case 39400: break; // // Banish // case 37546: break; // // Shriveling Gaze // case 37589: break; // // Fake Aggro Radius (2 yd) // case 37815: break; // // Corrupt Medivh // case 37853: break; case 38495: // Eye of Grillok { target->CastSpell(target, 38530, true); return; } case 38554: // Absorb Eye of Grillok (Zezzak's Shard) { if (target->GetTypeId() != TYPEID_UNIT) return; if (Unit* caster = GetCaster()) caster->CastSpell(caster, 38495, true, NULL, this); else return; Creature* creatureTarget = (Creature*)target; creatureTarget->ForcedDespawn(); return; } // // Magic Sucker Device timer // case 38672: break; // // Tomb Guarding Charging // case 38751: break; // // Murmur's Touch // case 38794: break; case 39105: // Activate Nether-wraith Beacon (31742 Nether-wraith Beacon item) { float fX, fY, fZ; triggerTarget->GetClosePoint(fX, fY, fZ, triggerTarget-><API key>(), 20.0f); triggerTarget->SummonCreature(22408, fX, fY, fZ, triggerTarget->GetOrientation(), <API key>, 0); return; } // // Drain World Tree Visual // case 39140: break; // // Quest - Dustin's Undead Dragon Visual aura // case 39259: break; // // Hellfire - The Exorcism, Jules releases darkness, aura // case 39306: break; // // Inferno // case 39346: break; // // Enchanted Weapons // case 39489: break; // // Shadow Bolt Whirl // case 39630: break; // // Shadow Bolt Whirl // case 39634: break; // // Shadow Inferno // case 39645: break; case 39857: // Tear of Azzinoth Summon Channel - it's not really supposed to do anything,and this only prevents the console spam trigger_spell_id = 39856; break; // // Soulgrinder Ritual Visual (Smashed) // case 39974: break; // // Simon Game Pre-game timer // case 40041: break; // // Knockdown Fel Cannon: The Aggro Check Aura // case 40113: break; // // Spirit Lance // case 40157: break; case 40398: // Demon Transform 2 switch (GetAuraTicks()) { case 1: if (target->HasAura(40506)) target-><API key>(40506); else trigger_spell_id = 40506; break; case 2: trigger_spell_id = 40510; break; } break; case 40511: // Demon Transform 1 trigger_spell_id = 40398; break; // // Ancient Flames // case 40657: break; // // Ethereal Ring Cannon: Cannon Aura // case 40734: break; // // Cage Trap // case 40760: break; // // Random Periodic // case 40867: break; // // Prismatic Shield // case 40879: break; // // Aura of Desire // case 41350: break; // // Dementia // case 41404: break; // // Chaos Form // case 41629: break; // // Alert Drums // case 42177: break; // // Spout // case 42581: break; // // Spout // case 42582: break; // // Return to the Spirit Realm // case 44035: break; // // Curse of Boundless Agony // case 45050: break; // // Earthquake // case 46240: break; case 46736: // Personalized Weather trigger_spell_id = 46737; break; // // Stay Submerged // case 46981: break; // // Dragonblight Ram // case 47015: break; // // Party G.R.E.N.A.D.E. // case 51510: break; default: break; } break; } case SPELLFAMILY_MAGE: { switch (auraId) { case 66: // Invisibility // Here need periodic trigger reducing threat spell (or do it manually) return; default: break; } break; } // case SPELLFAMILY_WARRIOR: // switch(auraId) // // Wild Magic // case 23410: break; // // Corrupted Totems // case 23425: break; // default: // break; // break; // case SPELLFAMILY_PRIEST: // switch(auraId) // // Blue Beam // case 32930: break; // // Fury of the Dreghood Elders // case 35460: break; // default: // break; // break; case SPELLFAMILY_DRUID: { switch (auraId) { case 768: // Cat Form // trigger_spell_id not set and unknown effect triggered in this case, ignoring for while return; case 22842: // Frenzied Regeneration case 22895: case 22896: case 26999: { int32 LifePerRage = GetModifier()->m_amount; int32 lRage = target->GetPower(POWER_RAGE); if (lRage > 100) // rage stored as rage*10 lRage = 100; target->ModifyPower(POWER_RAGE, -lRage); int32 FRTriggerBasePoints = int32(lRage * LifePerRage / 10); target->CastCustomSpell(target, 22845, &FRTriggerBasePoints, NULL, NULL, true, NULL, this); return; } default: break; } break; } // case SPELLFAMILY_HUNTER: // switch(auraId) // // Frost Trap Aura // case 13810: // return; // // Rizzle's Frost Trap // case 39900: // return; // // Tame spells // case 19597: // Tame Ice Claw Bear // case 19676: // Tame Snow Leopard // case 19677: // Tame Large Crag Boar // case 19678: // Tame Adult Plainstrider // case 19679: // Tame Prairie Stalker // case 19680: // Tame Swoop // case 19681: // Tame Dire Mottled Boar // case 19682: // Tame Surf Crawler // case 19683: // Tame Armored Scorpid // case 19684: // Tame Webwood Lurker // case 19685: // Tame Nightsaber Stalker // case 19686: // Tame Strigid Screecher // case 30100: // Tame Crazed Dragonhawk // case 30103: // Tame Elder Springpaw // case 30104: // Tame Mistbat // case 30647: // Tame Barbed Crawler // case 30648: // Tame Greater Timberstrider // case 30652: // Tame Nightstalker // return; // default: // break; // break; case SPELLFAMILY_SHAMAN: { switch (auraId) { case 28820: // Lightning Shield (The Earthshatterer set trigger after cast Lighting Shield) { // Need remove self if Lightning Shield not active Unit::SpellAuraHolderMap const& auras = triggerTarget-><API key>(); for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { SpellEntry const* spell = itr->second->GetSpellProto(); if (spell->SpellFamilyName == SPELLFAMILY_SHAMAN && (spell->SpellFamilyFlags & UI64LIT(0x0000000000000400))) return; } triggerTarget-><API key>(28820); return; } case 38443: // Totemic Mastery (Skyshatter Regalia (Shaman Tier 6) - bonus) { if (triggerTarget->IsAllTotemSlotsUsed()) triggerTarget->CastSpell(triggerTarget, 38437, true, NULL, this); else triggerTarget-><API key>(38437); return; } default: break; } break; } default: break; } // Reget trigger spell proto triggeredSpellInfo = sSpellStore.LookupEntry(trigger_spell_id); } else // initial triggeredSpellInfo != NULL { // for channeled spell cast applied from aura owner to channel target (persistent aura affects already applied to true target) // come periodic casts applied to targets, so need seelct proper caster (ex. 15790) if (IsChanneledSpell(GetSpellProto()) && GetSpellProto()->Effect[GetEffIndex()] != <API key>) { // interesting 2 cases: periodic aura at caster of channeled spell if (target->GetObjectGuid() == casterGUID) { triggerCaster = target; if (WorldObject* channelTarget = target->GetMap()->GetWorldObject(target-><API key>())) { if (channelTarget->isType(TYPEMASK_UNIT)) triggerTarget = (Unit*)channelTarget; else triggerTargetObject = channelTarget; } } // or periodic aura at caster channel target else if (Unit* caster = GetCaster()) { if (target->GetObjectGuid() == caster-><API key>()) { triggerCaster = caster; triggerTarget = target; } } } // Spell exist but require custom code switch (auraId) { case 9347: // Mortal Strike { if (target->GetTypeId() != TYPEID_UNIT) return; // expected selection current fight target triggerTarget = ((Creature*)target)-><API key>(<API key>, 0, triggeredSpellInfo); if (!triggerTarget) return; break; } case 1010: // Curse of Idiocy { // TODO: spell casted by result in correct way mostly // BUT: // 1) target show casting at each triggered cast: target don't must show casting animation for any triggered spell // but must show affect apply like item casting // 2) maybe aura must be replace by new with accumulative stat mods instead stacking // prevent cast by triggered auras if (casterGUID == triggerTarget->GetObjectGuid()) return; // stop triggering after each affected stats lost > 90 int32 intelectLoss = 0; int32 spiritLoss = 0; Unit::AuraList const& mModStat = triggerTarget->GetAurasByType(SPELL_AURA_MOD_STAT); for (Unit::AuraList::const_iterator i = mModStat.begin(); i != mModStat.end(); ++i) { if ((*i)->GetId() == 1010) { switch ((*i)->GetModifier()->m_miscvalue) { case STAT_INTELLECT: intelectLoss += (*i)->GetModifier()->m_amount; break; case STAT_SPIRIT: spiritLoss += (*i)->GetModifier()->m_amount; break; default: break; } } } if (intelectLoss <= -90 && spiritLoss <= -90) return; break; } case 16191: // Mana Tide { triggerTarget->CastCustomSpell(triggerTarget, trigger_spell_id, &m_modifier.m_amount, NULL, NULL, true, NULL, this); return; } case 33525: // Ground Slam triggerTarget->CastSpell(triggerTarget, trigger_spell_id, true, NULL, this, casterGUID); return; case 38736: // Rod of Purification - for quest 10839 (Veil Skith: Darkstone of Terokk) { if (Unit* caster = GetCaster()) caster->CastSpell(triggerTarget, trigger_spell_id, true, NULL, this); return; } case 44883: // Encapsulate { // Self cast spell, hence overwrite caster (only channeled spell where the triggered spell deals dmg to SELF) triggerCaster = triggerTarget; break; } } } // All ok cast by default case if (triggeredSpellInfo) { if (triggerTargetObject) triggerCaster->CastSpell(triggerTargetObject->GetPositionX(), triggerTargetObject->GetPositionY(), triggerTargetObject->GetPositionZ(), triggeredSpellInfo, true, NULL, this, casterGUID); else triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, NULL, this, casterGUID); } else { if (Unit* caster = GetCaster()) { if (triggerTarget->GetTypeId() != TYPEID_UNIT || !sScriptMgr.OnEffectDummy(caster, GetId(), GetEffIndex(), (Creature*)triggerTarget)) sLog.outError("Aura::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?", GetId(), GetEffIndex()); } } } void Aura::<API key>() { ObjectGuid casterGuid = GetCasterGuid(); Unit* target = GetTriggerTarget(); if (!casterGuid || !target) return; // generic casting code with custom spells and target/caster customs uint32 trigger_spell_id = GetSpellProto()->EffectTriggerSpell[m_effIndex]; int32 basepoints0 = GetModifier()->m_amount; target->CastCustomSpell(target, trigger_spell_id, &basepoints0, NULL, NULL, true, NULL, this, casterGuid); } /*** AURA EFFECTS ***/ void Aura::HandleAuraDummy(bool apply, bool Real) { // spells required only Real aura add/remove if (!Real) return; Unit* target = GetTarget(); // AT APPLY if (apply) { switch (GetSpellProto()->SpellFamilyName) { case SPELLFAMILY_GENERIC: { switch (GetId()) { case 1515: // Tame beast // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness if (target->CanHaveThreatList()) if (Unit* caster = GetCaster()) target->AddThreat(caster, 10.0f, false, GetSpellSchoolMask(GetSpellProto()), GetSpellProto()); return; case 7057: // Haunting Spirits // expected to tick with 30 sec period (tick part see in Aura::PeriodicTick) m_isPeriodic = true; m_modifier.periodictime = 30 * IN_MILLISECONDS; m_periodicTimer = m_modifier.periodictime; return; case 10255: // Stoned { if (Unit* caster = GetCaster()) { if (caster->GetTypeId() != TYPEID_UNIT) return; caster->SetFlag(UNIT_FIELD_FLAGS, <API key>); caster->addUnitState(UNIT_STAT_ROOT); } return; } case 13139: // net-o-matic // root to self part of (root_target->charge->root_self sequence if (Unit* caster = GetCaster()) caster->CastSpell(caster, 13138, true, NULL, this); return; case 28832: // Mark of Korth'azz case 28833: // Mark of Blaumeux case 28834: // Mark of Rivendare case 28835: // Mark of Zeliek { int32 damage = 0; switch (GetStackAmount()) { case 1: return; case 2: damage = 500; break; case 3: damage = 1500; break; case 4: damage = 4000; break; case 5: damage = 12500; break; default: damage = 14000 + 1000 * GetStackAmount(); break; } if (Unit* caster = GetCaster()) caster->CastCustomSpell(target, 28836, &damage, NULL, NULL, true, NULL, this); return; } case 31606: // Stormcrow Amulet { CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(17970); // we must assume db or script set display id to native at ending flight (if not, target is stuck with this model) if (cInfo) target->SetDisplayId(Creature::ChooseDisplayId(cInfo)); return; } case 32045: // Soul Charge case 32051: case 32052: { // max duration is 2 minutes, but expected to be random duration // real time randomness is unclear, using max 30 seconds here // see further down for expire of this aura GetHolder()->SetAuraDuration(urand(1, 30)*IN_MILLISECONDS); return; } case 33326: // Stolen Soul Dispel { target-><API key>(32346); return; } case 36587: // Vision Guide { target->CastSpell(target, 36573, true, NULL, this); return; } // Gender spells case 38224: // Illidari Agent Illusion case 37096: // Blood Elf Illusion case 46354: // Blood Elf Illusion { uint8 gender = target->getGender(); uint32 spellId; switch (GetId()) { case 38224: spellId = (gender == GENDER_MALE ? 38225 : 38227); break; case 37096: spellId = (gender == GENDER_MALE ? 37092 : 37094); break; case 46354: spellId = (gender == GENDER_MALE ? 46355 : 46356); break; default: return; } target->CastSpell(target, spellId, true, NULL, this); return; } case 39850: // Rocket Blast if (roll_chance_i(20)) // backfire stun target->CastSpell(target, 51581, true, NULL, this); return; case 43873: // Headless Horseman Laugh target->PlayDistanceSound(11965); return; case 46699: // Requires No Ammo if (target->GetTypeId() == TYPEID_PLAYER) // not use ammo and not allow use ((Player*)target)->RemoveAmmo(); return; case 48025: // Headless Horseman's Mount Spell::<API key>(target, GetSpellProto(), 51621, 48024, 51617, 48023, 0); return; } break; } case SPELLFAMILY_WARRIOR: { switch (GetId()) { case 41099: // Battle Stance { if (target->GetTypeId() != TYPEID_UNIT) return; // Stance Cooldown target->CastSpell(target, 41102, true, NULL, this); // Battle Aura target->CastSpell(target, 41106, true, NULL, this); // equipment ((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, 32614); ((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, 0); ((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_2, 0); return; } case 41100: // Berserker Stance { if (target->GetTypeId() != TYPEID_UNIT) return; // Stance Cooldown target->CastSpell(target, 41102, true, NULL, this); // Berserker Aura target->CastSpell(target, 41107, true, NULL, this); // equipment ((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, 32614); ((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, 0); ((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_2, 0); return; } case 41101: // Defensive Stance { if (target->GetTypeId() != TYPEID_UNIT) return; // Stance Cooldown target->CastSpell(target, 41102, true, NULL, this); // Defensive Aura target->CastSpell(target, 41105, true, NULL, this); // equipment ((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, 32604); ((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, 31467); ((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_2, 0); return; } } break; } case SPELLFAMILY_SHAMAN: { // Earth Shield if ((GetSpellProto()->SpellFamilyFlags & UI64LIT(0x40000000000))) { // prevent double apply bonuses if (target->GetTypeId() != TYPEID_PLAYER || !((Player*)target)->GetSession()->PlayerLoading()) { if (Unit* caster = GetCaster()) { m_modifier.m_amount = caster-><API key>(target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); m_modifier.m_amount = target-><API key>(caster, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); } } return; } break; } } } // AT REMOVE else { if (IsQuestTameSpell(GetId()) && target->isAlive()) { Unit* caster = GetCaster(); if (!caster || !caster->isAlive()) return; uint32 finalSpellId = 0; switch (GetId()) { case 19548: finalSpellId = 19597; break; case 19674: finalSpellId = 19677; break; case 19687: finalSpellId = 19676; break; case 19688: finalSpellId = 19678; break; case 19689: finalSpellId = 19679; break; case 19692: finalSpellId = 19680; break; case 19693: finalSpellId = 19684; break; case 19694: finalSpellId = 19681; break; case 19696: finalSpellId = 19682; break; case 19697: finalSpellId = 19683; break; case 19699: finalSpellId = 19685; break; case 19700: finalSpellId = 19686; break; case 30646: finalSpellId = 30647; break; case 30653: finalSpellId = 30648; break; case 30654: finalSpellId = 30652; break; case 30099: finalSpellId = 30100; break; case 30102: finalSpellId = 30103; break; case 30105: finalSpellId = 30104; break; } if (finalSpellId) caster->CastSpell(target, finalSpellId, true, NULL, this); return; } switch (GetId()) { case 10255: // Stoned { if (Unit* caster = GetCaster()) { if (caster->GetTypeId() != TYPEID_UNIT) return; // see dummy effect of spell 10254 for removal of flags etc caster->CastSpell(caster, 10254, true); } return; } case 12479: // Hex of Jammal'an target->CastSpell(target, 12480, true, NULL, this); return; case 12774: // (DND) Belnistrasz Idol Shutdown Visual { if (m_removeMode == <API key>) return; // Idom Rool Camera Shake <- wtf, don't drink while making spellnames? if (Unit* caster = GetCaster()) caster->CastSpell(caster, 12816, true); return; } case 28169: // Mutating Injection { // Mutagen Explosion target->CastSpell(target, 28206, true, NULL, this); // Poison Cloud target->CastSpell(target, 28240, true, NULL, this); return; } case 32045: // Soul Charge { if (m_removeMode == <API key>) target->CastSpell(target, 32054, true, NULL, this); return; } case 32051: // Soul Charge { if (m_removeMode == <API key>) target->CastSpell(target, 32057, true, NULL, this); return; } case 32052: // Soul Charge { if (m_removeMode == <API key>) target->CastSpell(target, 32053, true, NULL, this); return; } case 32286: // Focus Target Visual { if (m_removeMode == <API key>) target->CastSpell(target, 32301, true, NULL, this); return; } case 35079: // Misdirection, triggered buff { if (Unit* pCaster = GetCaster()) pCaster-><API key>(34477); return; } case 36730: // Flame Strike { target->CastSpell(target, 36731, true, NULL, this); return; } case 41099: // Battle Stance { // Battle Aura target-><API key>(41106); return; } case 41100: // Berserker Stance { // Berserker Aura target-><API key>(41107); return; } case 41101: // Defensive Stance { // Defensive Aura target-><API key>(41105); return; } case 42385: // Alcaz Survey Aura { target->CastSpell(target, 42316, true, NULL, this); return; } case 42454: // Captured Totem { if (m_removeMode == <API key>) { if (target->getDeathState() != CORPSE) return; Unit* pCaster = GetCaster(); if (!pCaster) return; // Captured Totem Test Credit if (Player* pPlayer = pCaster-><API key>()) pPlayer->CastSpell(pPlayer, 42455, true); } return; } case 42517: // Beam to Zelfrax { // expecting target to be a dummy creature Creature* pSummon = target->SummonCreature(23864, 0.0f, 0.0f, 0.0f, target->GetOrientation(), <API key>, 0); Unit* pCaster = GetCaster(); if (pSummon && pCaster) pSummon->GetMotionMaster()->MovePoint(0, pCaster->GetPositionX(), pCaster->GetPositionY(), pCaster->GetPositionZ()); return; } case 44191: // Flame Strike { if (target->GetMap()->IsDungeon()) { uint32 spellId = target->GetMap()->IsRegularDifficulty() ? 44190 : 46163; target->CastSpell(target, spellId, true, NULL, this); } return; } case 45934: // Dark Fiend { // Kill target if dispelled if (m_removeMode == <API key>) target->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, <API key>, NULL, false); return; } case 46308: // Burning Winds { // casted only at creatures at spawn target->CastSpell(target, 47287, true, NULL, this); return; } } } // AT APPLY & REMOVE switch (GetSpellProto()->SpellFamilyName) { case SPELLFAMILY_GENERIC: { switch (GetId()) { case 6606: // Self Visual - Sleep Until Cancelled (DND) { if (apply) { target->SetStandState(<API key>); target->addUnitState(UNIT_STAT_ROOT); } else { target->clearUnitState(UNIT_STAT_ROOT); target->SetStandState(<API key>); } return; } case 24658: // Unstable Power { if (apply) { Unit* caster = GetCaster(); if (!caster) return; caster->CastSpell(target, 24659, true, NULL, NULL, GetCasterGuid()); } else target-><API key>(24659); return; } case 24661: // Restless Strength { if (apply) { Unit* caster = GetCaster(); if (!caster) return; caster->CastSpell(target, 24662, true, NULL, NULL, GetCasterGuid()); } else target-><API key>(24662); return; } case 29266: // Permanent Feign Death case 31261: // Permanent Feign Death (Root) case 37493: // Feign Death { // Unclear what the difference really is between them. // Some has effect1 that makes the difference, however not all. // Some appear to be used depending on creature location, in water, at solid ground, in air/suspended, etc // For now, just handle all the same way if (target->GetTypeId() == TYPEID_UNIT) target->SetFeignDeath(apply); return; } case 32216: // Victorious if (target->getClass() == CLASS_WARRIOR) target->ModifyAuraState(<API key>, apply); return; case 35356: // Spawn Feign Death case 35357: // Spawn Feign Death { if (target->GetTypeId() == TYPEID_UNIT) { // Flags not set like it's done in SetFeignDeath() // UNIT_DYNFLAG_DEAD does not appear with these spells. // All of the spells appear to be present at spawn and not used to feign in combat or similar. if (apply) { target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); target->SetFlag(UNIT_FIELD_FLAGS_2, <API key>); target->addUnitState(UNIT_STAT_DIED); } else { target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); target->RemoveFlag(UNIT_FIELD_FLAGS_2, <API key>); target->clearUnitState(UNIT_STAT_DIED); } } return; } case 40133: // Summon Fire Elemental { Unit* caster = GetCaster(); if (!caster) return; Unit* owner = caster->GetOwner(); if (owner && owner->GetTypeId() == TYPEID_PLAYER) { if (apply) owner->CastSpell(owner, 8985, true); else ((Player*)owner)->RemovePet(PET_SAVE_REAGENTS); } return; } case 40132: // Summon Earth Elemental { Unit* caster = GetCaster(); if (!caster) return; Unit* owner = caster->GetOwner(); if (owner && owner->GetTypeId() == TYPEID_PLAYER) { if (apply) owner->CastSpell(owner, 19704, true); else ((Player*)owner)->RemovePet(PET_SAVE_REAGENTS); } return; } case 40214: // Dragonmaw Illusion { if (apply) { target->CastSpell(target, 40216, true); target->CastSpell(target, 42016, true); } else { target-><API key>(40216); target-><API key>(42016); } return; } case 42515: // Jarl Beam { // aura animate dead (fainted) state for the duration, but we need to animate the death itself (correct way below?) if (Unit* pCaster = GetCaster()) pCaster->ApplyModFlag(UNIT_FIELD_FLAGS_2, <API key>, apply); // Beam to Zelfrax at remove if (!apply) target->CastSpell(target, 42517, true); return; } case 27978: case 40131: if (apply) target->m_AuraFlags |= <API key>; else target->m_AuraFlags |= ~<API key>; return; } break; } case SPELLFAMILY_MAGE: { // Hypothermia if (GetId() == 41425) { target->ModifyAuraState(<API key>, apply); return; } break; } case SPELLFAMILY_DRUID: { switch (GetId()) { case 34246: // Idol of the Emerald Queen { if (target->GetTypeId() != TYPEID_PLAYER) return; if (apply) // dummy not have proper effectclassmask m_spellmod = new SpellModifier(SPELLMOD_DOT, SPELLMOD_FLAT, m_modifier.m_amount / 7, GetId(), UI64LIT(0x001000000000)); ((Player*)target)->AddSpellMod(m_spellmod, apply); return; } } // Lifebloom if (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x1000000000)) { if (apply) { if (Unit* caster = GetCaster()) { // prevent double apply bonuses if (target->GetTypeId() != TYPEID_PLAYER || !((Player*)target)->GetSession()->PlayerLoading()) { // Lifebloom ignore stack amount m_modifier.m_amount /= GetStackAmount(); m_modifier.m_amount = caster-><API key>(target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); m_modifier.m_amount = target-><API key>(caster, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); } } } else { // Final heal on duration end if (m_removeMode != <API key>) return; // final heal if (target->IsInWorld() && GetStackAmount() > 0) { // Lifebloom dummy store single stack amount always int32 amount = m_modifier.m_amount; target->CastCustomSpell(target, 33778, &amount, NULL, NULL, true, NULL, this, GetCasterGuid()); } } return; } // Predatory Strikes if (target->GetTypeId() == TYPEID_PLAYER && GetSpellProto()->SpellIconID == 1563) { ((Player*)target)-><API key>(); return; } break; } case SPELLFAMILY_ROGUE: break; case SPELLFAMILY_HUNTER: { switch (GetId()) { // Improved Aspect of the Viper case 38390: { if (target->GetTypeId() == TYPEID_PLAYER) { if (apply) // + effect value for Aspect of the Viper m_spellmod = new SpellModifier(SPELLMOD_EFFECT1, SPELLMOD_FLAT, m_modifier.m_amount, GetId(), UI64LIT(0x4000000000000)); ((Player*)target)->AddSpellMod(m_spellmod, apply); } return; } } break; } case SPELLFAMILY_SHAMAN: { switch (GetId()) { case 6495: // Sentry Totem { if (target->GetTypeId() != TYPEID_PLAYER) return; Totem* totem = target->GetTotem(TOTEM_SLOT_AIR); if (totem && apply) ((Player*)target)->GetCamera().SetView(totem); else ((Player*)target)->GetCamera().ResetView(); return; } } // Improved Weapon Totems if (GetSpellProto()->SpellIconID == 57 && target->GetTypeId() == TYPEID_PLAYER) { if (apply) { switch (m_effIndex) { case 0: // Windfury Totem m_spellmod = new SpellModifier(SPELLMOD_EFFECT1, SPELLMOD_PCT, m_modifier.m_amount, GetId(), UI64LIT(0x00200000000)); break; case 1: // Flametongue Totem m_spellmod = new SpellModifier(SPELLMOD_EFFECT1, SPELLMOD_PCT, m_modifier.m_amount, GetId(), UI64LIT(0x00400000000)); break; default: return; } } ((Player*)target)->AddSpellMod(m_spellmod, apply); return; } break; } } // pet auras if (PetAura const* petSpell = sSpellMgr.GetPetAura(GetId())) { if (apply) target->AddPetAura(petSpell); else target->RemovePetAura(petSpell); return; } if (GetEffIndex() == EFFECT_INDEX_0 && target->GetTypeId() == TYPEID_PLAYER) { <API key> saBounds = sSpellMgr.<API key>(GetId()); if (saBounds.first != saBounds.second) { uint32 zone, area; target->GetZoneAndAreaId(zone, area); for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) { // some auras remove at aura remove if (!itr->second->IsFitToRequirements((Player*)target, zone, area)) target-><API key>(itr->second->spellId); // some auras applied at aura apply else if (itr->second->autocast) { if (!target->HasAura(itr->second->spellId, EFFECT_INDEX_0)) target->CastSpell(target, itr->second->spellId, true); } } } } // script has to "handle with care", only use where data are not ok to use in the above code. if (target->GetTypeId() == TYPEID_UNIT) sScriptMgr.OnAuraDummy(this, apply); } void Aura::HandleAuraMounted(bool apply, bool Real) { // only at real add/remove aura if (!Real) return; Unit* target = GetTarget(); if (apply) { CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(m_modifier.m_miscvalue); if (!ci) { sLog.outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need it modelid)", m_modifier.m_miscvalue); return; } uint32 display_id = Creature::ChooseDisplayId(ci); CreatureModelInfo const* minfo = sObjectMgr.<API key>(display_id); if (minfo) display_id = minfo->modelid; target->Mount(display_id, GetId()); } else { target->Unmount(true); } } void Aura::HandleAuraWaterWalk(bool apply, bool Real) { // only at real add/remove aura if (!Real) return; GetTarget()->SetWaterWalk(apply); } void Aura::<API key>(bool apply, bool Real) { // only at real add/remove aura if (!Real) return; Unit* target = GetTarget(); WorldPacket data; if (apply) data.Initialize(<API key>, 8 + 4); else data.Initialize(<API key>, 8 + 4); data << target->GetPackGUID(); data << uint32(0); target->SendMessageToSet(&data, true); // start fall from current height if (!apply && target->GetTypeId() == TYPEID_PLAYER) ((Player*)target)->SetFallInformation(0, target->GetPositionZ()); } void Aura::HandleAuraHover(bool apply, bool Real) { // only at real add/remove aura if (!Real) return; WorldPacket data; if (apply) data.Initialize(SMSG_MOVE_SET_HOVER, 8 + 4); else data.Initialize(<API key>, 8 + 4); data << GetTarget()->GetPackGUID(); data << uint32(0); GetTarget()->SendMessageToSet(&data, true); } void Aura::<API key>(bool /*apply*/, bool /*Real*/) { // update timers in client if (GetTarget()->GetTypeId() == TYPEID_PLAYER) ((Player*)GetTarget())->UpdateMirrorTimers(); } void Aura::<API key>(bool apply, bool Real) { if (!Real) return; ShapeshiftForm form = ShapeshiftForm(m_modifier.m_miscvalue); <API key> const* ssEntry = <API key>.LookupEntry(form); if (!ssEntry) { sLog.outError("Unknown shapeshift form %u in spell %u", form, GetId()); return; } uint32 modelid = 0; Powers PowerType = POWER_MANA; Unit* target = GetTarget(); if (ssEntry->modelID_A) { // i will asume that creatures will always take the defined model from the dbc // since no field in creature_templates describes wether an alliance or // horde modelid should be used at shapeshifting if (target->GetTypeId() != TYPEID_PLAYER) modelid = ssEntry->modelID_A; else { // players are a bit different since the dbc has seldomly an horde modelid if (Player::TeamForRace(target->getRace()) == HORDE) { // get model for race ( in 2.2.4 no horde models in dbc field, only 0 in it modelid = sObjectMgr.GetModelForRace(ssEntry->modelID_A, target->getRaceMask()); } // nothing found in above, so use default if (!modelid) modelid = ssEntry->modelID_A; } } // remove polymorph before changing display id to keep new display id switch (form) { case FORM_CAT: case FORM_TREE: case FORM_TRAVEL: case FORM_AQUA: case FORM_BEAR: case FORM_DIREBEAR: case FORM_FLIGHT_EPIC: case FORM_FLIGHT: case FORM_MOONKIN: { // remove movement affects target-><API key>(SPELL_AURA_MOD_ROOT, GetHolder()); Unit::AuraList const& slowingAuras = target->GetAurasByType(<API key>); for (Unit::AuraList::const_iterator iter = slowingAuras.begin(); iter != slowingAuras.end();) { SpellEntry const* aurSpellInfo = (*iter)->GetSpellProto(); uint32 aurMechMask = <API key>(aurSpellInfo); // If spell that caused this aura has Croud Control or Daze effect if ((aurMechMask & <API key>) || // some Daze spells have these parameters instead of MECHANIC_DAZE (skip snare spells) (aurSpellInfo->SpellIconID == 15 && aurSpellInfo->Dispel == 0 && (aurMechMask & (1 << (MECHANIC_SNARE - 1))) == 0)) { ++iter; continue; } // All OK, remove aura now target-><API key>(aurSpellInfo->Id); iter = slowingAuras.begin(); } // and polymorphic affects if (target->IsPolymorphed()) target-><API key>(target->getTransForm()); break; } default: break; } if (apply) { // remove other shapeshift before applying a new one target-><API key>(<API key>, GetHolder()); if (modelid > 0) target->SetDisplayId(modelid); // now only powertype must be set switch (form) { case FORM_CAT: PowerType = POWER_ENERGY; break; case FORM_BEAR: case FORM_DIREBEAR: case FORM_BATTLESTANCE: case <API key>: case <API key>: PowerType = POWER_RAGE; break; default: break; } if (PowerType != POWER_MANA) { // reset power to default values only at power change if (target->getPowerType() != PowerType) target->setPowerType(PowerType); switch (form) { case FORM_CAT: case FORM_BEAR: case FORM_DIREBEAR: { // get furor proc chance int32 furorChance = 0; Unit::AuraList const& mDummy = target->GetAurasByType(SPELL_AURA_DUMMY); for (Unit::AuraList::const_iterator i = mDummy.begin(); i != mDummy.end(); ++i) { if ((*i)->GetSpellProto()->SpellIconID == 238) { furorChance = (*i)->GetModifier()->m_amount; break; } } if (m_modifier.m_miscvalue == FORM_CAT) { target->SetPower(POWER_ENERGY, 0); if (irand(1, 100) <= furorChance) target->CastSpell(target, 17099, true, NULL, this); } else { target->SetPower(POWER_RAGE, 0); if (irand(1, 100) <= furorChance) target->CastSpell(target, 17057, true, NULL, this); } break; } case FORM_BATTLESTANCE: case <API key>: case <API key>: { uint32 Rage_val = 0; // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch) if (target->GetTypeId() == TYPEID_PLAYER) { PlayerSpellMap const& sp_list = ((Player*)target)->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { if (itr->second.state == PLAYERSPELL_REMOVED) continue; SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first); if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) Rage_val += target-><API key>(target, spellInfo, EFFECT_INDEX_0) * 10; } } if (target->GetPower(POWER_RAGE) > Rage_val) target->SetPower(POWER_RAGE, Rage_val); break; } default: break; } } target->SetShapeshiftForm(form); // a form can give the player a new castbar with some spells.. this is a clientside process.. // serverside just needs to register the new spells so that player isn't kicked as cheater if (target->GetTypeId() == TYPEID_PLAYER) for (uint32 i = 0; i < 8; ++i) if (ssEntry->spellId[i]) ((Player*)target)->addSpell(ssEntry->spellId[i], true, false, false, false); } else { if (modelid > 0) target->SetDisplayId(target->GetNativeDisplayId()); if (target->getClass() == CLASS_DRUID) target->setPowerType(POWER_MANA); target->SetShapeshiftForm(FORM_NONE); switch (form) { // Nordrassil Harness - bonus case FORM_BEAR: case FORM_DIREBEAR: case FORM_CAT: if (Aura* dummy = target->GetDummyAura(37315)) target->CastSpell(target, 37316, true, NULL, dummy); break; // Nordrassil Regalia - bonus case FORM_MOONKIN: if (Aura* dummy = target->GetDummyAura(37324)) target->CastSpell(target, 37325, true, NULL, dummy); break; default: break; } // look at the comment in apply-part if (target->GetTypeId() == TYPEID_PLAYER) for (uint32 i = 0; i < 8; ++i) if (ssEntry->spellId[i]) ((Player*)target)->removeSpell(ssEntry->spellId[i], false, false, false); } // adding/removing linked auras // add/remove the shapeshift aura's boosts <API key>(apply); if (target->GetTypeId() == TYPEID_PLAYER) ((Player*)target)->InitDataForForm(); } void Aura::HandleAuraTransform(bool apply, bool Real) { Unit* target = GetTarget(); if (apply) { // special case (spell specific functionality) if (m_modifier.m_miscvalue == 0) { switch (GetId()) { case 16739: // Orb of Deception { uint32 orb_model = target->GetNativeDisplayId(); switch (orb_model) { // Troll Female case 1479: target->SetDisplayId(10134); break; // Troll Male case 1478: target->SetDisplayId(10135); break; // Tauren Male case 59: target->SetDisplayId(10136); break; // Human Male case 49: target->SetDisplayId(10137); break; // Human Female case 50: target->SetDisplayId(10138); break; // Orc Male case 51: target->SetDisplayId(10139); break; // Orc Female case 52: target->SetDisplayId(10140); break; // Dwarf Male case 53: target->SetDisplayId(10141); break; // Dwarf Female case 54: target->SetDisplayId(10142); break; // NightElf Male case 55: target->SetDisplayId(10143); break; // NightElf Female case 56: target->SetDisplayId(10144); break; // Undead Female case 58: target->SetDisplayId(10145); break; // Undead Male case 57: target->SetDisplayId(10146); break; // Tauren Female case 60: target->SetDisplayId(10147); break; // Gnome Male case 1563: target->SetDisplayId(10148); break; // Gnome Female case 1564: target->SetDisplayId(10149); break; // BloodElf Female case 15475: target->SetDisplayId(17830); break; // BloodElf Male case 15476: target->SetDisplayId(17829); break; // Dranei Female case 16126: target->SetDisplayId(17828); break; // Dranei Male case 16125: target->SetDisplayId(17827); break; default: break; } break; } case 42365: // Murloc costume target->SetDisplayId(21723); break; // case 44186: // Gossip NPC Appearance - All, Brewfest // break; // case 48305: // Gossip NPC Appearance - All, Spirit of Competition // break; case 50517: // Dread Corsair case 51926: // Corsair Costume { // expected for players uint32 race = target->getRace(); switch (race) { case RACE_HUMAN: target->SetDisplayId(target->getGender() == GENDER_MALE ? 25037 : 25048); break; case RACE_ORC: target->SetDisplayId(target->getGender() == GENDER_MALE ? 25039 : 25050); break; case RACE_DWARF: target->SetDisplayId(target->getGender() == GENDER_MALE ? 25034 : 25045); break; case RACE_NIGHTELF: target->SetDisplayId(target->getGender() == GENDER_MALE ? 25038 : 25049); break; case RACE_UNDEAD: target->SetDisplayId(target->getGender() == GENDER_MALE ? 25042 : 25053); break; case RACE_TAUREN: target->SetDisplayId(target->getGender() == GENDER_MALE ? 25040 : 25051); break; case RACE_GNOME: target->SetDisplayId(target->getGender() == GENDER_MALE ? 25035 : 25046); break; case RACE_TROLL: target->SetDisplayId(target->getGender() == GENDER_MALE ? 25041 : 25052); break; case RACE_GOBLIN: // not really player race (3.x), but model exist target->SetDisplayId(target->getGender() == GENDER_MALE ? 25036 : 25047); break; case RACE_BLOODELF: target->SetDisplayId(target->getGender() == GENDER_MALE ? 25032 : 25043); break; case RACE_DRAENEI: target->SetDisplayId(target->getGender() == GENDER_MALE ? 25033 : 25044); break; } break; } // case 50531: // Gossip NPC Appearance - All, Pirate Day // break; // case 51010: // Dire Brew // break; default: sLog.outError("Aura::HandleAuraTransform, spell %u does not have creature entry defined, need custom defined model.", GetId()); break; } } else // m_modifier.m_miscvalue != 0 { uint32 model_id; CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(m_modifier.m_miscvalue); if (!ci) { model_id = 16358; // pig pink ^_^ sLog.outError("Auras: unknown creature id = %d (only need its modelid) Form Spell Aura Transform in Spell ID = %d", m_modifier.m_miscvalue, GetId()); } else model_id = Creature::ChooseDisplayId(ci); // Will use the default model here target->SetDisplayId(model_id); // creature case, need to update equipment if additional provided if (ci && target->GetTypeId() == TYPEID_UNIT) ((Creature*)target)->LoadEquipment(ci->equipmentId, false); // Dragonmaw Illusion (set mount model also) if (GetId() == 42016 && target->GetMountID() && !target->GetAurasByType(<API key>).empty()) target->SetUInt32Value(<API key>, 16314); } // update active transform spell only not set or not overwriting negative by positive case if (!target->getTransForm() || !IsPositiveSpell(GetId()) || IsPositiveSpell(target->getTransForm())) target->setTransForm(GetId()); // polymorph case if (Real && target->GetTypeId() == TYPEID_PLAYER && target->IsPolymorphed()) { // for players, start regeneration after 1s (in polymorph fast regeneration case) // only if caster is Player (after patch 2.4.2) if (GetCasterGuid().IsPlayer()) ((Player*)target)->setRegenTimer(1 * IN_MILLISECONDS); // dismount polymorphed target (after patch 2.4.2) if (target->IsMounted()) target-><API key>(SPELL_AURA_MOUNTED, GetHolder()); } } else // !apply { // ApplyModifier(true) will reapply it if need target->setTransForm(0); target->SetDisplayId(target->GetNativeDisplayId()); // apply default equipment for creature case if (target->GetTypeId() == TYPEID_UNIT) ((Creature*)target)->LoadEquipment(((Creature*)target)->GetCreatureInfo()->equipmentId, true); // re-apply some from still active with preference negative cases Unit::AuraList const& otherTransforms = target->GetAurasByType(<API key>); if (!otherTransforms.empty()) { // look for other transform auras Aura* handledAura = *otherTransforms.begin(); for (Unit::AuraList::const_iterator i = otherTransforms.begin(); i != otherTransforms.end(); ++i) { // negative auras are preferred if (!IsPositiveSpell((*i)->GetSpellProto()->Id)) { handledAura = *i; break; } } handledAura->ApplyModifier(true); } // Dragonmaw Illusion (restore mount model) if (GetId() == 42016 && target->GetMountID() == 16314) { if (!target->GetAurasByType(SPELL_AURA_MOUNTED).empty()) { uint32 cr_id = target->GetAurasByType(SPELL_AURA_MOUNTED).front()->GetModifier()->m_miscvalue; if (CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(cr_id)) { uint32 display_id = Creature::ChooseDisplayId(ci); CreatureModelInfo const* minfo = sObjectMgr.<API key>(display_id); if (minfo) display_id = minfo->modelid; target->SetUInt32Value(<API key>, display_id); } } } } } void Aura::HandleForceReaction(bool apply, bool Real) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; if (!Real) return; Player* player = (Player*)GetTarget(); uint32 faction_id = m_modifier.m_miscvalue; ReputationRank faction_rank = ReputationRank(m_modifier.m_amount); player->GetReputationMgr().ApplyForceReaction(faction_id, faction_rank, apply); player->GetReputationMgr().SendForceReactions(); // stop fighting if at apply forced rank friendly or at remove real rank friendly if ((apply && faction_rank >= REP_FRIENDLY) || (!apply && player->GetReputationRank(faction_id) >= REP_FRIENDLY)) player->StopAttackFaction(faction_id); } void Aura::HandleAuraModSkill(bool apply, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; uint32 prot = GetSpellProto()->EffectMiscValue[m_effIndex]; int32 points = GetModifier()->m_amount; ((Player*)GetTarget())->ModifySkillBonus(prot, (apply ? points : -points), m_modifier.m_auraname == <API key>); if (prot == SKILL_DEFENSE) ((Player*)GetTarget())-><API key>(); } void Aura::<API key>(bool apply, bool Real) { if (Real && !apply) { if (m_removeMode != <API key>) return; // Item amount if (m_modifier.m_amount <= 0) return; SpellEntry const* spellInfo = GetSpellProto(); if (spellInfo->EffectItemType[m_effIndex] == 0) return; Unit* victim = GetTarget(); Unit* caster = GetCaster(); if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return; // Soul Shard (target req.) if (spellInfo->EffectItemType[m_effIndex] == 6265) { // Only from non-grey units if (!((Player*)caster)->isHonorOrXPTarget(victim) || (victim->GetTypeId() == TYPEID_UNIT && !((Player*)caster)->isAllowedToLoot((Creature*)victim))) return; } // Adding items uint32 noSpaceForCount = 0; uint32 count = m_modifier.m_amount; ItemPosCountVec dest; InventoryResult msg = ((Player*)caster)->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, spellInfo->EffectItemType[m_effIndex], count, &noSpaceForCount); if (msg != EQUIP_ERR_OK) { count -= noSpaceForCount; ((Player*)caster)->SendEquipError(msg, NULL, NULL, spellInfo->EffectItemType[m_effIndex]); if (count == 0) return; } Item* newitem = ((Player*)caster)->StoreNewItem(dest, spellInfo->EffectItemType[m_effIndex], true); ((Player*)caster)->SendNewItem(newitem, count, true, true); } } void Aura::HandleBindSight(bool apply, bool /*Real*/) { Unit* caster = GetCaster(); if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return; Camera& camera = ((Player*)caster)->GetCamera(); if (apply) camera.SetView(GetTarget()); else camera.ResetView(); } void Aura::HandleFarSight(bool apply, bool /*Real*/) { Unit* caster = GetCaster(); if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return; Camera& camera = ((Player*)caster)->GetCamera(); if (apply) camera.SetView(GetTarget()); else camera.ResetView(); } void Aura::<API key>(bool apply, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; if (apply) GetTarget()-><API key>(GetHolder()); if (apply) GetTarget()->SetFlag(<API key>, uint32(1) << (m_modifier.m_miscvalue - 1)); else GetTarget()->RemoveFlag(<API key>, uint32(1) << (m_modifier.m_miscvalue - 1)); } void Aura::<API key>(bool apply, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; if (apply) GetTarget()-><API key>(GetHolder()); if (apply) GetTarget()->SetFlag(<API key>, uint32(1) << (m_modifier.m_miscvalue - 1)); else GetTarget()->RemoveFlag(<API key>, uint32(1) << (m_modifier.m_miscvalue - 1)); } void Aura::<API key>(bool apply, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; if (apply) GetTarget()-><API key>(GetHolder()); GetTarget()->ApplyModByteFlag(PLAYER_FIELD_BYTES, 0, <API key>, apply); } void Aura::HandleAuraModScale(bool apply, bool /*Real*/) { GetTarget()-><API key>(<API key>, float(m_modifier.m_amount), apply); GetTarget()->UpdateModelData(); } void Aura::HandleModPossess(bool apply, bool Real) { if (!Real) return; Unit* target = GetTarget(); // not possess yourself if (GetCasterGuid() == target->GetObjectGuid()) return; Unit* caster = GetCaster(); if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return; Player* p_caster = (Player*)caster; Camera& camera = p_caster->GetCamera(); if (apply) { target->addUnitState(<API key>); target->SetFlag(UNIT_FIELD_FLAGS, <API key>); target->SetCharmerGuid(p_caster->GetObjectGuid()); target->setFaction(p_caster->getFaction()); // target should became visible at SetView call(if not visible before): // otherwise client\p_caster will ignore packets from the target(SetClientControl for example) camera.SetView(target); p_caster->SetCharm(target); p_caster->SetClientControl(target, 1); p_caster->SetMover(target); target->CombatStop(true); target->DeleteThreatList(); target-><API key>().deleteReferences(); if (CharmInfo* charmInfo = target->InitCharmInfo(target)) { charmInfo-><API key>(); charmInfo->SetReactState(REACT_PASSIVE); charmInfo->SetCommandState(COMMAND_STAY); } p_caster-><API key>(); if (target->GetTypeId() == TYPEID_UNIT) { ((Creature*)target)->AIM_Initialize(); } else if (target->GetTypeId() == TYPEID_PLAYER) { ((Player*)target)->SetClientControl(target, 0); } } else { p_caster->SetCharm(NULL); p_caster->SetClientControl(target, 0); p_caster->SetMover(NULL); // there is a possibility that target became invisible for client\p_caster at ResetView call: // it must be called after movement control unapplying, not before! the reason is same as at aura applying camera.ResetView(); p_caster->RemovePetActionBar(); // on delete only do caster related effects if (m_removeMode == <API key>) return; target->clearUnitState(<API key>); target->CombatStop(true); target->DeleteThreatList(); target-><API key>().deleteReferences(); target->RemoveFlag(UNIT_FIELD_FLAGS, <API key>); target->SetCharmerGuid(ObjectGuid()); if (target->GetTypeId() == TYPEID_PLAYER) { ((Player*)target)->setFactionForRace(target->getRace()); ((Player*)target)->SetClientControl(target, 1); } else if (target->GetTypeId() == TYPEID_UNIT) { CreatureInfo const* cinfo = ((Creature*)target)->GetCreatureInfo(); target->setFaction(cinfo->faction_A); } if (target->GetTypeId() == TYPEID_UNIT) { ((Creature*)target)->AIM_Initialize(); target->AttackedBy(caster); } } } void Aura::HandleModPossessPet(bool apply, bool Real) { if (!Real) return; Unit* caster = GetCaster(); if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return; Unit* target = GetTarget(); if (target->GetTypeId() != TYPEID_UNIT || !((Creature*)target)->IsPet()) return; Pet* pet = (Pet*)target; Player* p_caster = (Player*)caster; Camera& camera = p_caster->GetCamera(); if (apply) { pet->addUnitState(<API key>); // target should became visible at SetView call(if not visible before): // otherwise client\p_caster will ignore packets from the target(SetClientControl for example) camera.SetView(pet); p_caster->SetCharm(pet); p_caster->SetClientControl(pet, 1); ((Player*)caster)->SetMover(pet); pet->SetFlag(UNIT_FIELD_FLAGS, <API key>); pet->StopMoving(); pet->GetMotionMaster()->Clear(false); pet->GetMotionMaster()->MoveIdle(); } else { p_caster->SetCharm(NULL); p_caster->SetClientControl(pet, 0); p_caster->SetMover(NULL); // there is a possibility that target became invisible for client\p_caster at ResetView call: // it must be called after movement control unapplying, not before! the reason is same as at aura applying camera.ResetView(); // on delete only do caster related effects if (m_removeMode == <API key>) return; pet->clearUnitState(<API key>); pet->RemoveFlag(UNIT_FIELD_FLAGS, <API key>); pet->AttackStop(); // out of range pet dismissed if (!pet->IsWithinDistInMap(p_caster, pet->GetMap()-><API key>())) { p_caster->RemovePet(PET_SAVE_REAGENTS); } else { pet->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); } } } void Aura::HandleModCharm(bool apply, bool Real) { if (!Real) return; Unit* target = GetTarget(); // not charm yourself if (GetCasterGuid() == target->GetObjectGuid()) return; Unit* caster = GetCaster(); if (!caster) return; if (apply) { // is it really need after spell check checks? target-><API key>(<API key>, GetHolder()); target-><API key>(<API key>, GetHolder()); target->SetCharmerGuid(GetCasterGuid()); target->setFaction(caster->getFaction()); target->CastStop(target == caster ? GetId() : 0); caster->SetCharm(target); target->CombatStop(true); target->DeleteThreatList(); target-><API key>().deleteReferences(); if (target->GetTypeId() == TYPEID_UNIT) { ((Creature*)target)->AIM_Initialize(); CharmInfo* charmInfo = target->InitCharmInfo(target); charmInfo-><API key>(); charmInfo->SetReactState(REACT_DEFENSIVE); if (caster->GetTypeId() == TYPEID_PLAYER && caster->getClass() == CLASS_WARLOCK) { CreatureInfo const* cinfo = ((Creature*)target)->GetCreatureInfo(); if (cinfo && cinfo->type == CREATURE_TYPE_DEMON) { // creature with pet number expected have class set if (target->GetByteValue(UNIT_FIELD_BYTES_0, 1) == 0) { if (cinfo->unit_class == 0) sLog.outErrorDb("Creature (Entry: %u) have unit_class = 0 but used in charmed spell, that will be result client crash.", cinfo->Entry); else sLog.outError("Creature (Entry: %u) have unit_class = %u but at charming have class 0!!! that will be result client crash.", cinfo->Entry, cinfo->unit_class); target->SetByteValue(UNIT_FIELD_BYTES_0, 1, CLASS_MAGE); } // just to enable stat window charmInfo->SetPetNumber(sObjectMgr.GeneratePetNumber(), true); // if charmed two demons the same session, the 2nd gets the 1st one's name target->SetUInt32Value(<API key>, uint32(time(NULL))); } } } if (caster->GetTypeId() == TYPEID_PLAYER) ((Player*)caster)-><API key>(); } else { target->SetCharmerGuid(ObjectGuid()); if (target->GetTypeId() == TYPEID_PLAYER) ((Player*)target)->setFactionForRace(target->getRace()); else { CreatureInfo const* cinfo = ((Creature*)target)->GetCreatureInfo(); // restore faction if (((Creature*)target)->IsPet()) { if (Unit* owner = target->GetOwner()) target->setFaction(owner->getFaction()); else if (cinfo) target->setFaction(cinfo->faction_A); } else if (cinfo) // normal creature target->setFaction(cinfo->faction_A); // restore UNIT_FIELD_BYTES_0 if (cinfo && caster->GetTypeId() == TYPEID_PLAYER && caster->getClass() == CLASS_WARLOCK && cinfo->type == CREATURE_TYPE_DEMON) { // DB must have proper class set in field at loading, not req. restore, including workaround case at apply // m_target->SetByteValue(UNIT_FIELD_BYTES_0, 1, cinfo->unit_class); if (target->GetCharmInfo()) target->GetCharmInfo()->SetPetNumber(0, true); else sLog.outError("Aura::HandleModCharm: target (GUID: %u TypeId: %u) has a charm aura but no charm info!", target->GetGUIDLow(), target->GetTypeId()); } } caster->SetCharm(NULL); if (caster->GetTypeId() == TYPEID_PLAYER) ((Player*)caster)->RemovePetActionBar(); target->CombatStop(true); target->DeleteThreatList(); target-><API key>().deleteReferences(); if (target->GetTypeId() == TYPEID_UNIT) { ((Creature*)target)->AIM_Initialize(); target->AttackedBy(caster); } } } void Aura::HandleModConfuse(bool apply, bool Real) { if (!Real) return; GetTarget()->SetConfused(apply, GetCasterGuid(), GetId()); } void Aura::HandleModFear(bool apply, bool Real) { if (!Real) return; GetTarget()->SetFeared(apply, GetCasterGuid(), GetId()); } void Aura::HandleFeignDeath(bool apply, bool Real) { if (!Real) return; GetTarget()->SetFeignDeath(apply, GetCasterGuid(), GetId()); } void Aura::HandleAuraModDisarm(bool apply, bool Real) { if (!Real) return; Unit* target = GetTarget(); if (!apply && target->HasAuraType(GetModifier()->m_auraname)) return; target->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED, apply); if (target->GetTypeId() != TYPEID_PLAYER) return; // main-hand attack speed already set to special value for feral form already and don't must change and reset at remove. if (target->IsInFeralForm()) return; if (apply) target->SetAttackTime(BASE_ATTACK, BASE_ATTACK_TIME); else ((Player*)target)-><API key>(); target-><API key>(BASE_ATTACK); } void Aura::HandleAuraModStun(bool apply, bool Real) { if (!Real) return; Unit* target = GetTarget(); if (apply) { // Frost stun aura -> freeze/unfreeze target if (GetSpellSchoolMask(GetSpellProto()) & <API key>) target->ModifyAuraState(AURA_STATE_FROZEN, apply); target->addUnitState(UNIT_STAT_STUNNED); target->SetTargetGuid(ObjectGuid()); target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); target->CastStop(target->GetObjectGuid() == GetCasterGuid() ? GetId() : 0); // Creature specific if (target->GetTypeId() != TYPEID_PLAYER) target->StopMoving(); else { ((Player*)target)->m_movementInfo.SetMovementFlags(MOVEFLAG_NONE); target->SetStandState(<API key>);// in 1.5 client } target->SetRoot(true); // Summon the Naj'entus Spine GameObject on target if spell is Impaling Spine if (GetId() == 39837) { GameObject* pObj = new GameObject; if (pObj->Create(target->GetMap()-><API key>(HIGHGUID_GAMEOBJECT), 185584, target->GetMap(), target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation())) { pObj->SetRespawnTime(GetAuraDuration() / IN_MILLISECONDS); pObj->SetSpellId(GetId()); target->AddGameObject(pObj); target->GetMap()->Add(pObj); } else delete pObj; } } else { // Frost stun aura -> freeze/unfreeze target if (GetSpellSchoolMask(GetSpellProto()) & <API key>) { bool found_another = false; for (AuraType const* itr = &frozenAuraTypes[0]; *itr != SPELL_AURA_NONE; ++itr) { Unit::AuraList const& auras = target->GetAurasByType(*itr); for (Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); ++i) { if (GetSpellSchoolMask((*i)->GetSpellProto()) & <API key>) { found_another = true; break; } } if (found_another) break; } if (!found_another) target->ModifyAuraState(AURA_STATE_FROZEN, apply); } // Real remove called after current aura remove from lists, check if other similar auras active if (target->HasAuraType(SPELL_AURA_MOD_STUN)) return; target->clearUnitState(UNIT_STAT_STUNNED); target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); if (!target->hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect { if (target->getVictim() && target->isAlive()) target->SetTargetGuid(target->getVictim()->GetObjectGuid()); target->SetRoot(false); } // Wyvern Sting if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_HUNTER && GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000100000000000)) { Unit* caster = GetCaster(); if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return; uint32 spell_id = 0; switch (GetId()) { case 19386: spell_id = 24131; break; case 24132: spell_id = 24134; break; case 24133: spell_id = 24135; break; case 27068: spell_id = 27069; break; default: sLog.outError("Spell selection called for unexpected original spell %u, new spell for this spell family?", GetId()); return; } SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id); if (!spellInfo) return; caster->CastSpell(target, spellInfo, true, NULL, this); return; } } } void Aura::HandleModStealth(bool apply, bool Real) { Unit* target = GetTarget(); if (apply) { // drop flag at stealth in bg target-><API key>(<API key>); // only at real aura add if (Real) { target->SetStandFlags(<API key>); if (target->GetTypeId() == TYPEID_PLAYER) target->SetByteFlag(PLAYER_FIELD_BYTES2, 1, <API key>); // apply only if not in GM invisibility (and overwrite invisibility state) if (target->GetVisibility() != VISIBILITY_OFF) { target->SetVisibility(<API key>); target->SetVisibility(<API key>); } // for RACE_NIGHTELF stealth if (target->GetTypeId() == TYPEID_PLAYER && GetId() == 20580) target->CastSpell(target, 21009, true, NULL, this); // apply full stealth period bonuses only at first stealth aura in stack if (target->GetAurasByType(<API key>).size() <= 1) { Unit::AuraList const& mDummyAuras = target->GetAurasByType(SPELL_AURA_DUMMY); for (Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) { // Master of Subtlety if ((*i)->GetSpellProto()->SpellIconID == 2114) { target-><API key>(31666); int32 bp = (*i)->GetModifier()->m_amount; target->CastCustomSpell(target, 31665, &bp, NULL, NULL, true); break; } } } } } else { // for RACE_NIGHTELF stealth if (Real && target->GetTypeId() == TYPEID_PLAYER && GetId() == 20580) target-><API key>(21009); // only at real aura remove of _last_ <API key> if (Real && !target->HasAuraType(<API key>)) { // if no GM invisibility if (target->GetVisibility() != VISIBILITY_OFF) { target->RemoveStandFlags(<API key>); if (target->GetTypeId() == TYPEID_PLAYER) target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 1, <API key>); // restore invisibility if any if (target->HasAuraType(<API key>)) { target->SetVisibility(<API key>); target->SetVisibility(<API key>); } else target->SetVisibility(VISIBILITY_ON); } // apply delayed talent bonus remover at last stealth aura remove Unit::AuraList const& mDummyAuras = target->GetAurasByType(SPELL_AURA_DUMMY); for (Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) { // Master of Subtlety if ((*i)->GetSpellProto()->SpellIconID == 2114) { target->CastSpell(target, 31666, true); break; } } } } } void Aura::HandleInvisibility(bool apply, bool Real) { Unit* target = GetTarget(); if (apply) { target->m_invisibilityMask |= (1 << m_modifier.m_miscvalue); target-><API key>(<API key>); if (Real && target->GetTypeId() == TYPEID_PLAYER) { // apply glow vision target->SetByteFlag(PLAYER_FIELD_BYTES2, 1, <API key>); } // apply only if not in GM invisibility and not stealth if (target->GetVisibility() == VISIBILITY_ON) { // Aura not added yet but visibility code expect temporary add aura target->SetVisibility(<API key>); target->SetVisibility(<API key>); } } else { // recalculate value at modifier remove (current aura already removed) target->m_invisibilityMask = 0; Unit::AuraList const& auras = target->GetAurasByType(<API key>); for (Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) target->m_invisibilityMask |= (1 << (*itr)->GetModifier()->m_miscvalue); // only at real aura remove and if not have different invisibility auras. if (Real && target->m_invisibilityMask == 0) { // remove glow vision if (target->GetTypeId() == TYPEID_PLAYER) target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 1, <API key>); // apply only if not in GM invisibility & not stealthed while invisible if (target->GetVisibility() != VISIBILITY_OFF) { // if have stealth aura then already have stealth visibility if (!target->HasAuraType(<API key>)) target->SetVisibility(VISIBILITY_ON); } } } } void Aura::<API key>(bool apply, bool Real) { Unit* target = GetTarget(); if (apply) { target-><API key> |= (1 << m_modifier.m_miscvalue); } else { // recalculate value at modifier remove (current aura already removed) target-><API key> = 0; Unit::AuraList const& auras = target->GetAurasByType(<API key>); for (Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) target-><API key> |= (1 << (*itr)->GetModifier()->m_miscvalue); } if (Real && target->GetTypeId() == TYPEID_PLAYER) ((Player*)target)->GetCamera().<API key>(); } void Aura::HandleDetectAmore(bool apply, bool /*real*/) { GetTarget()->ApplyModByteFlag(PLAYER_FIELD_BYTES2, 1, (<API key> << m_modifier.m_amount), apply); } void Aura::HandleAuraModRoot(bool apply, bool Real) { // only at real add/remove aura if (!Real) return; Unit* target = GetTarget(); if (apply) { // Frost root aura -> freeze/unfreeze target if (GetSpellSchoolMask(GetSpellProto()) & <API key>) target->ModifyAuraState(AURA_STATE_FROZEN, apply); target->addUnitState(UNIT_STAT_ROOT); target->SetTargetGuid(ObjectGuid()); // Save last orientation if (target->getVictim()) target->SetOrientation(target->GetAngle(target->getVictim())); if (target->GetTypeId() == TYPEID_PLAYER) { target->SetRoot(true); // Clear unit movement flags ((Player*)target)->m_movementInfo.SetMovementFlags(MOVEFLAG_NONE); } else target->StopMoving(); } else { // Frost root aura -> freeze/unfreeze target if (GetSpellSchoolMask(GetSpellProto()) & <API key>) { bool found_another = false; for (AuraType const* itr = &frozenAuraTypes[0]; *itr != SPELL_AURA_NONE; ++itr) { Unit::AuraList const& auras = target->GetAurasByType(*itr); for (Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); ++i) { if (GetSpellSchoolMask((*i)->GetSpellProto()) & <API key>) { found_another = true; break; } } if (found_another) break; } if (!found_another) target->ModifyAuraState(AURA_STATE_FROZEN, apply); } // Real remove called after current aura remove from lists, check if other similar auras active if (target->HasAuraType(SPELL_AURA_MOD_ROOT)) return; target->clearUnitState(UNIT_STAT_ROOT); if (!target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect { if (target->getVictim() && target->isAlive()) target->SetTargetGuid(target->getVictim()->GetObjectGuid()); if (target->GetTypeId() == TYPEID_PLAYER) target->SetRoot(false); } } } void Aura::<API key>(bool apply, bool Real) { // only at real add/remove aura if (!Real) return; Unit* target = GetTarget(); if (apply) { target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED); // Stop cast only spells vs PreventionType == <API key> for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i))) if (spell->m_spellInfo->PreventionType == <API key>) // Stop spells on prepare or casting state target->InterruptSpell(CurrentSpellTypes(i), false); switch (GetId()) { // Arcane Torrent (Energy) case 25046: { Unit* caster = GetCaster(); if (!caster) return; // Search Mana Tap auras on caster Aura* dummy = caster->GetDummyAura(28734); if (dummy) { int32 bp = dummy->GetStackAmount() * 10; caster->CastCustomSpell(caster, 25048, &bp, NULL, NULL, true); caster-><API key>(28734); } } } } else { // Real remove called after current aura remove from lists, check if other similar auras active if (target->HasAuraType(<API key>)) return; target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED); } } void Aura::HandleModThreat(bool apply, bool Real) { // only at real add/remove aura if (!Real) return; Unit* target = GetTarget(); if (!target->isAlive()) return; int level_diff = 0; int multiplier = 0; switch (GetId()) { // Arcane Shroud case 26400: level_diff = target->getLevel() - 60; multiplier = 2; break; // The Eye of Diminution case 28862: level_diff = target->getLevel() - 60; multiplier = 1; break; } if (level_diff > 0) m_modifier.m_amount += multiplier * level_diff; if (target->GetTypeId() == TYPEID_PLAYER) for (int8 x = 0; x < MAX_SPELL_SCHOOL; ++x) if (m_modifier.m_miscvalue & int32(1 << x)) <API key>(target->m_threatModifier[x], float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool Real) { // only at real add/remove aura if (!Real) return; Unit* target = GetTarget(); if (!target->isAlive() || target->GetTypeId() != TYPEID_PLAYER) return; Unit* caster = GetCaster(); if (!caster || !caster->isAlive()) return; float threatMod = apply ? float(m_modifier.m_amount) : float(-m_modifier.m_amount); target-><API key>().threatAssist(caster, threatMod, GetSpellProto()); } void Aura::HandleModTaunt(bool apply, bool Real) { // only at real add/remove aura if (!Real) return; Unit* target = GetTarget(); if (!target->isAlive() || !target->CanHaveThreatList()) return; Unit* caster = GetCaster(); if (!caster || !caster->isAlive()) return; if (apply) target->TauntApply(caster); else { // When taunt aura fades out, mob will switch to previous target if current has less than 1.1 * secondthreat target->TauntFadeOut(caster); } } /*** MODIFY SPEED ***/ void Aura::<API key>(bool /*apply*/, bool Real) { // all applied/removed only at real aura add/remove if (!Real) return; GetTarget()->UpdateSpeed(MOVE_RUN, true); } void Aura::<API key>(bool /*apply*/, bool Real) { // all applied/removed only at real aura add/remove if (!Real) return; GetTarget()->UpdateSpeed(MOVE_RUN, true); } void Aura::<API key>(bool apply, bool Real) { // all applied/removed only at real aura add/remove if (!Real) return; Unit* target = GetTarget(); // Enable Fly mode for flying mounts if (m_modifier.m_auraname == <API key>) { WorldPacket data; if (apply) data.Initialize(<API key>, 12); else data.Initialize(<API key>, 12); data << target->GetPackGUID(); data << uint32(0); // unknown target->SendMessageToSet(&data, true); // Players on flying mounts must be immune to polymorph if (target->GetTypeId() == TYPEID_PLAYER) target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply); // Dragonmaw Illusion (overwrite mount model, mounted aura already applied) if (apply && target->HasAura(42016, EFFECT_INDEX_0) && target->GetMountID()) target->SetUInt32Value(<API key>, 16314); } target->UpdateSpeed(MOVE_FLIGHT, true); } void Aura::<API key>(bool /*apply*/, bool Real) { // all applied/removed only at real aura add/remove if (!Real) return; GetTarget()->UpdateSpeed(MOVE_SWIM, true); } void Aura::<API key>(bool apply, bool Real) { // all applied/removed only at real aura add/remove if (!Real) return; Unit* target = GetTarget(); if (apply) { // Gronn Lord's Grasp, becomes stoned if (GetId() == 33572) { if (GetStackAmount() >= 5 && !target->HasAura(33652)) target->CastSpell(target, 33652, true); } } target->UpdateSpeed(MOVE_RUN, true); target->UpdateSpeed(MOVE_SWIM, true); target->UpdateSpeed(MOVE_FLIGHT, true); } void Aura::<API key>(bool /*apply*/, bool Real) { // all applied/removed only at real aura add/remove if (!Real) return; Unit* target = GetTarget(); target->UpdateSpeed(MOVE_RUN, true); target->UpdateSpeed(MOVE_SWIM, true); target->UpdateSpeed(MOVE_FLIGHT, true); } /*** IMMUNITY ***/ void Aura::<API key>(bool apply, bool /*Real*/) { uint32 misc = m_modifier.m_miscvalue; Unit* target = GetTarget(); if (apply && GetSpellProto()->HasAttribute(<API key>)) { uint32 mechanic = 1 << (misc - 1); // immune movement impairment and loss of control (spell data have special structure for mark this case) if (<API key>(GetSpellProto())) mechanic = <API key>; target-><API key>(mechanic, GetId()); } target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, misc, apply); // special cases switch (misc) { case <API key>: target->ModifyAuraState(<API key>, apply); break; case MECHANIC_SHIELD: target->ModifyAuraState(<API key>, apply); break; } // Bestial Wrath if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_HUNTER && GetSpellProto()->SpellIconID == 1680) { // The Beast Within cast on owner if talent present if (Unit* owner = target->GetOwner()) { // Search talent The Beast Within Unit::AuraList const& dummyAuras = owner->GetAurasByType(SPELL_AURA_DUMMY); for (Unit::AuraList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i) { if ((*i)->GetSpellProto()->SpellIconID == 2229) { if (apply) owner->CastSpell(owner, 34471, true, NULL, this); else owner-><API key>(34471); break; } } } } } void Aura::<API key>(bool apply, bool /*Real*/) { uint32 mechanic = m_modifier.m_miscvalue; if (apply && GetSpellProto()->HasAttribute(<API key>)) GetTarget()-><API key>(mechanic, GetId()); // check implemented in Unit::IsImmuneToSpell and Unit::<API key> } // this method is called whenever we add / remove aura which gives m_target some imunity to some spell effect void Aura::<API key>(bool apply, bool /*Real*/) { Unit* target = GetTarget(); // when removing flag aura, handle flag drop if (!apply && target->GetTypeId() == TYPEID_PLAYER && (GetSpellProto()->AuraInterruptFlags & <API key>)) { Player* player = (Player*)target; if (BattleGround* bg = player->GetBattleGround()) bg-><API key>(player); else if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(player->GetCachedZoneId())) outdoorPvP->HandleDropFlag(player, GetSpellProto()->Id); } target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, m_modifier.m_miscvalue, apply); } void Aura::<API key>(bool apply, bool Real) { if (apply && Real && GetSpellProto()->HasAttribute(<API key>)) { Unit::AuraList const& auraList = GetTarget()->GetAurasByType(AuraType(m_modifier.m_miscvalue)); for (Unit::AuraList::const_iterator itr = auraList.begin(); itr != auraList.end();) { if (auraList.front() != this) // skip itself aura (it already added) { GetTarget()-><API key>(auraList.front()->GetId()); itr = auraList.begin(); } else ++itr; } } GetTarget()->ApplySpellImmune(GetId(), IMMUNITY_STATE, m_modifier.m_miscvalue, apply); } void Aura::<API key>(bool apply, bool Real) { Unit* target = GetTarget(); target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, m_modifier.m_miscvalue, apply); // remove all flag auras (they are positive, but they must be removed when you are immune) if (GetSpellProto()->HasAttribute(<API key>) && GetSpellProto()->HasAttribute(<API key>)) target-><API key>(<API key>); // TODO: optimalize this cycle - use <API key> call or something else if (Real && apply && GetSpellProto()->HasAttribute(<API key>) && IsPositiveSpell(GetId())) // Only positive immunity removes auras { uint32 school_mask = m_modifier.m_miscvalue; Unit::SpellAuraHolderMap& Auras = target-><API key>(); for (Unit::SpellAuraHolderMap::iterator iter = Auras.begin(), next; iter != Auras.end(); iter = next) { next = iter; ++next; SpellEntry const* spell = iter->second->GetSpellProto(); if ((GetSpellSchoolMask(spell) & school_mask) // Check for school mask && !spell->HasAttribute(<API key>) // Spells unaffected by invulnerability && !iter->second->IsPositive() // Don't remove positive spells && spell->Id != GetId()) // Don't remove self { target-><API key>(spell->Id); if (Auras.empty()) break; else next = Auras.begin(); } } } if (Real && GetSpellProto()->Mechanic == MECHANIC_BANISH) { if (apply) target->addUnitState(UNIT_STAT_ISOLATED); else target->clearUnitState(UNIT_STAT_ISOLATED); } } void Aura::<API key>(bool apply, bool /*Real*/) { GetTarget()->ApplySpellImmune(GetId(), IMMUNITY_DAMAGE, m_modifier.m_miscvalue, apply); } void Aura::<API key>(bool apply, bool Real) { // all applied/removed only at real aura add/remove if (!Real) return; GetTarget()-><API key>(GetSpellProto(), DispelType(m_modifier.m_miscvalue), apply); } void Aura::<API key>(bool apply, bool Real) { if (!Real) return; Unit* target = GetTarget(); switch (GetId()) { // some spell have charges by functionality not have its in spell data case 28200: // Ascendance (Talisman of Ascendance trinket) if (apply) GetHolder()->SetAuraCharges(6); break; default: break; } } void Aura::<API key>(bool apply, bool /*Real*/) { // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND if (apply) GetTarget()->SetFlag(UNIT_DYNAMIC_FLAGS, <API key>); else GetTarget()->RemoveFlag(UNIT_DYNAMIC_FLAGS, <API key>); } /*** PERIODIC ***/ void Aura::<API key>(bool apply, bool /*Real*/) { m_isPeriodic = apply; Unit* target = GetTarget(); if (!apply) { switch (GetId()) { case 66: // Invisibility if (m_removeMode == <API key>) target->CastSpell(target, 32612, true, NULL, this); return; case 29213: // Curse of the Plaguebringer if (m_removeMode != <API key>) // Cast Wrath of the Plaguebringer if not dispelled target->CastSpell(target, 29214, true, 0, this); return; case 42783: // Wrath of the Astrom... if (m_removeMode == <API key> && GetEffIndex() + 1 < MAX_EFFECT_INDEX) target->CastSpell(target, GetSpellProto()-><API key>(SpellEffectIndex(GetEffIndex() + 1)), true); return; default: break; } } } void Aura::<API key>(bool apply, bool /*Real*/) { m_isPeriodic = apply; } void Aura::<API key>(bool apply, bool /*Real*/) { m_isPeriodic = apply; } void Aura::HandleAuraPowerBurn(bool apply, bool /*Real*/) { m_isPeriodic = apply; } void Aura::<API key>(bool apply, bool Real) { // spells required only Real aura add/remove if (!Real) return; Unit* target = GetTarget(); // For prevent double apply bonuses bool loading = (target->GetTypeId() == TYPEID_PLAYER && ((Player*)target)->GetSession()->PlayerLoading()); SpellEntry const* spell = GetSpellProto(); switch (spell->SpellFamilyName) { case SPELLFAMILY_ROGUE: { // Master of Subtlety if (spell->Id == 31666 && !apply) { target-><API key>(31665); break; } break; } case SPELLFAMILY_HUNTER: { // Aspect of the Viper if (spell->SpellFamilyFlags & UI64LIT(0x0004000000000000)) { // Update regen on remove if (!apply && target->GetTypeId() == TYPEID_PLAYER) ((Player*)target)->UpdateManaRegen(); break; } break; } } m_isPeriodic = apply; } void Aura::HandlePeriodicHeal(bool apply, bool /*Real*/) { m_isPeriodic = apply; Unit* target = GetTarget(); // For prevent double apply bonuses bool loading = (target->GetTypeId() == TYPEID_PLAYER && ((Player*)target)->GetSession()->PlayerLoading()); // Custom damage calculation after if (apply) { if (loading) return; Unit* caster = GetCaster(); if (!caster) return; m_modifier.m_amount = caster-><API key>(target, GetSpellProto(), m_modifier.m_amount, DOT, GetStackAmount()); } } void Aura::<API key>(bool apply, bool Real) { // spells required only Real aura add/remove if (!Real) return; m_isPeriodic = apply; Unit* target = GetTarget(); SpellEntry const* spellProto = GetSpellProto(); // For prevent double apply bonuses bool loading = (target->GetTypeId() == TYPEID_PLAYER && ((Player*)target)->GetSession()->PlayerLoading()); // Custom damage calculation after if (apply) { if (loading) return; Unit* caster = GetCaster(); if (!caster) return; switch (spellProto->SpellFamilyName) { case SPELLFAMILY_WARRIOR: { // Rend if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000020)) { // 0.00743*(($MWB+$mwb)/2+$AP/14*$MWS) bonus per tick float ap = caster-><API key>(BASE_ATTACK); int32 mws = caster->GetAttackTime(BASE_ATTACK); float mwb_min = caster-><API key>(BASE_ATTACK, MINDAMAGE); float mwb_max = caster-><API key>(BASE_ATTACK, MAXDAMAGE); m_modifier.m_amount += int32(((mwb_min + mwb_max) / 2 + ap * mws / 14000) * 0.00743f); } break; } case SPELLFAMILY_DRUID: { // Rip if (spellProto->SpellFamilyFlags & UI64LIT(<API key>)) { if (caster->GetTypeId() != TYPEID_PLAYER) break; // $AP * min(0.06*$cp, 0.24)/6 [Yes, there is no difference, whether 4 or 5 CPs are being used] uint8 cp = ((Player*)caster)->GetComboPoints(); // Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs Unit::AuraList const& dummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY); for (Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) { if ((*itr)->GetId() == 34241) { m_modifier.m_amount += cp * (*itr)->GetModifier()->m_amount; break; } } if (cp > 4) cp = 4; m_modifier.m_amount += int32(caster-><API key>(BASE_ATTACK) * cp / 100); } break; } case SPELLFAMILY_ROGUE: { // Rupture if (spellProto->SpellFamilyFlags & UI64LIT(<API key>)) { if (caster->GetTypeId() != TYPEID_PLAYER) break; // Dmg/tick = $AP*min(0.01*$cp, 0.03) [Like Rip: only the first three CP increase the contribution from AP] uint8 cp = ((Player*)caster)->GetComboPoints(); if (cp > 3) cp = 3; m_modifier.m_amount += int32(caster-><API key>(BASE_ATTACK) * cp / 100); } break; } default: break; } if (m_modifier.m_auraname == <API key>) { // <API key> for magic spells if (spellProto->DmgClass == <API key> || spellProto->DmgClass == <API key>) m_modifier.m_amount = caster-><API key>(target, GetSpellProto(), m_modifier.m_amount, DOT, GetStackAmount()); // <API key> for weapon based spells else { WeaponAttackType attackType = GetWeaponAttackType(GetSpellProto()); m_modifier.m_amount = caster-><API key>(target, m_modifier.m_amount, attackType, GetSpellProto(), DOT, GetStackAmount()); } } } // remove time effects else { // Parasitic Shadowfiend - handle summoning of two Shadowfiends on DoT expire if (spellProto->Id == 41917) target->CastSpell(target, 41915, true); } } void Aura::<API key>(bool apply, bool /*Real*/) { m_isPeriodic = apply; } void Aura::HandlePeriodicLeech(bool apply, bool /*Real*/) { m_isPeriodic = apply; // For prevent double apply bonuses bool loading = (GetTarget()->GetTypeId() == TYPEID_PLAYER && ((Player*)GetTarget())->GetSession()->PlayerLoading()); // Custom damage calculation after if (apply) { if (loading) return; Unit* caster = GetCaster(); if (!caster) return; m_modifier.m_amount = caster-><API key>(GetTarget(), GetSpellProto(), m_modifier.m_amount, DOT, GetStackAmount()); } } void Aura::<API key>(bool apply, bool /*Real*/) { m_isPeriodic = apply; } void Aura::<API key>(bool apply, bool /*Real*/) { m_isPeriodic = apply; // For prevent double apply bonuses bool loading = (GetTarget()->GetTypeId() == TYPEID_PLAYER && ((Player*)GetTarget())->GetSession()->PlayerLoading()); // Custom damage calculation after if (apply) { if (loading) return; Unit* caster = GetCaster(); if (!caster) return; m_modifier.m_amount = caster-><API key>(GetTarget(), GetSpellProto(), m_modifier.m_amount, DOT, GetStackAmount()); } } /*** MODIFY STATS ***/ /*** RESISTANCE ***/ void Aura::<API key>(bool apply, bool /*Real*/) { for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; ++x) { if (m_modifier.m_miscvalue & int32(1 << x)) { GetTarget()->HandleStatModifier(UnitMods(<API key> + x), BASE_VALUE, float(m_modifier.m_amount), apply); if (GetTarget()->GetTypeId() == TYPEID_PLAYER) GetTarget()-><API key>(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply); } } } void Aura::<API key>(bool apply, bool /*Real*/) { for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; ++x) { if (m_modifier.m_miscvalue & int32(1 << x)) { GetTarget()->HandleStatModifier(UnitMods(<API key> + x), TOTAL_VALUE, float(m_modifier.m_amount), apply); if (GetTarget()->GetTypeId() == TYPEID_PLAYER || ((Creature*)GetTarget())->IsPet()) GetTarget()-><API key>(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply); } } } void Aura::<API key>(bool apply, bool /*Real*/) { // only players have base stats if (GetTarget()->GetTypeId() != TYPEID_PLAYER) { // pets only have base armor if (((Creature*)GetTarget())->IsPet() && (m_modifier.m_miscvalue & <API key>)) GetTarget()->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(m_modifier.m_amount), apply); } else { for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; ++x) { if (m_modifier.m_miscvalue & int32(1 << x)) GetTarget()->HandleStatModifier(UnitMods(<API key> + x), BASE_PCT, float(m_modifier.m_amount), apply); } } } void Aura::<API key>(bool apply, bool /*Real*/) { Unit* target = GetTarget(); for (int8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) { if (m_modifier.m_miscvalue & int32(1 << i)) { target->HandleStatModifier(UnitMods(<API key> + i), TOTAL_PCT, float(m_modifier.m_amount), apply); if (target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->IsPet()) { target-><API key>(SpellSchools(i), true, float(m_modifier.m_amount), apply); target-><API key>(SpellSchools(i), false, float(m_modifier.m_amount), apply); } } } } void Aura::<API key>(bool apply, bool /*Real*/) { // only players have base stats if (GetTarget()->GetTypeId() != TYPEID_PLAYER) { // only pets have base stats if (((Creature*)GetTarget())->IsPet() && (m_modifier.m_miscvalue & <API key>)) GetTarget()->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(m_modifier.m_amount), apply); } else { for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) if (m_modifier.m_miscvalue & (1 << i)) GetTarget()->HandleStatModifier(UnitMods(<API key> + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); } } /*** STAT ***/ void Aura::HandleAuraModStat(bool apply, bool /*Real*/) { if (m_modifier.m_miscvalue < -2 || m_modifier.m_miscvalue > 4) { sLog.outError("WARNING: Spell %u effect %u have unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), m_modifier.m_miscvalue); return; } for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i) { // -1 or -2 is all stats ( misc < -2 checked in function beginning ) if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue == i) { // m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply); GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); if (GetTarget()->GetTypeId() == TYPEID_PLAYER || ((Creature*)GetTarget())->IsPet()) GetTarget()->ApplyStatBuffMod(Stats(i), float(m_modifier.m_amount), apply); } } } void Aura::<API key>(bool apply, bool /*Real*/) { if (m_modifier.m_miscvalue < -1 || m_modifier.m_miscvalue > 4) { sLog.outError("WARNING: Misc Value for <API key> not valid"); return; } // only players have base stats if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i) { if (m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_modifier.m_amount), apply); } } void Aura::<API key>(bool /*apply*/, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Magic damage modifiers implemented in Unit::<API key> // This information for client side use only // Recalculate bonus ((Player*)GetTarget())-><API key>(); } void Aura::<API key>(bool /*apply*/, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Recalculate bonus ((Player*)GetTarget())-><API key>(); } void Aura::<API key>(bool apply, bool Real) { if (!Real || !apply) return; if (GetId() == 33206) GetTarget()->CastSpell(GetTarget(), 44416, true, NULL, this, GetCasterGuid()); } void Aura::<API key>(bool /*apply*/, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Magic damage modifiers implemented in Unit::<API key> // This information for client side use only // Recalculate bonus ((Player*)GetTarget())-><API key>(); } void Aura::<API key>(bool /*apply*/, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Recalculate bonus ((Player*)GetTarget())-><API key>(); } void Aura::<API key>(bool /*apply*/, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // implemented in Unit::<API key> // this information is for client side only ((Player*)GetTarget())-><API key>(); } void Aura::<API key>(bool apply, bool /*Real*/) { if (m_modifier.m_miscvalue < -1 || m_modifier.m_miscvalue > 4) { sLog.outError("WARNING: Misc Value for <API key> not valid"); return; } Unit* target = GetTarget(); // save current and max HP before applying aura uint32 curHPValue = target->GetHealth(); uint32 maxHPValue = target->GetMaxHealth(); for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i) { if (m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) { target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); if (target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->IsPet()) target-><API key>(Stats(i), float(m_modifier.m_amount), apply); } } // recalculate current HP/MP after applying aura modifications (only for spells with 0x10 flag) if (m_modifier.m_miscvalue == STAT_STAMINA && maxHPValue > 0 && GetSpellProto()->HasAttribute(SPELL_ATTR_UNK4)) { // newHP = (curHP / maxHP) * newMaxHP = (newMaxHP * curHP) / maxHP -> which is better because no int -> double -> int conversion is needed uint32 newHPValue = (target->GetMaxHealth() * curHPValue) / maxHPValue; target->SetHealth(newHPValue); } } void Aura::<API key>(bool /*apply*/, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; if (m_modifier.m_miscvalue != <API key>) { // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update // and include in UpdateResistence same code as in UpdateArmor for aura mod apply. sLog.outError("Aura <API key>(182) need adding support for non-armor resistances!"); return; } // Recalculate Armor GetTarget()->UpdateArmor(); } /*** HEAL & ENERGIZE ***/ void Aura::<API key>(bool apply, bool /*Real*/) { m_isPeriodic = apply; } void Aura::<API key>(bool apply, bool /*Real*/) { if (m_modifier.periodictime == 0) m_modifier.periodictime = 1000; m_periodicTimer = m_modifier.periodictime; m_isPeriodic = apply; } void Aura::HandleModRegen(bool apply, bool /*Real*/) // eating { if (m_modifier.periodictime == 0) m_modifier.periodictime = 5000; m_periodicTimer = 5000; m_isPeriodic = apply; } void Aura::HandleModPowerRegen(bool apply, bool Real) // drinking { if (!Real) return; Powers pt = GetTarget()->getPowerType(); if (m_modifier.periodictime == 0) { // Anger Management (only spell use this aura for rage) if (pt == POWER_RAGE) m_modifier.periodictime = 3000; else m_modifier.periodictime = 2000; } m_periodicTimer = 5000; if (GetTarget()->GetTypeId() == TYPEID_PLAYER && m_modifier.m_miscvalue == POWER_MANA) ((Player*)GetTarget())->UpdateManaRegen(); m_isPeriodic = apply; } void Aura::<API key>(bool /*apply*/, bool Real) { // spells required only Real aura add/remove if (!Real) return; if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Update manaregen value if (m_modifier.m_miscvalue == POWER_MANA) ((Player*)GetTarget())->UpdateManaRegen(); } void Aura::HandleModManaRegen(bool /*apply*/, bool Real) { // spells required only Real aura add/remove if (!Real) return; if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Note: an increase in regen does NOT cause threat. ((Player*)GetTarget())->UpdateManaRegen(); } void Aura::<API key>(bool apply, bool /*Real*/) { if (apply) GetTarget()->SetFlag(UNIT_FIELD_FLAGS_2, <API key>); else GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS_2, <API key>); } void Aura::<API key>(bool apply, bool Real) { Unit* target = GetTarget(); // Special case with temporary increase max/current health switch (GetId()) { case 12976: // Warrior Last Stand triggered spell case 28726: // Nightmare Seed ( Nightmare Seed ) case 34511: // Valor (Bulwark of Kings, Bulwark of the Ancient Kings) case 44055: // Tremendous Fortitude (Battlemaster's Alacrity) { if (Real) { if (apply) { target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); target->ModifyHealth(m_modifier.m_amount); } else { if (int32(target->GetHealth()) > m_modifier.m_amount) target->ModifyHealth(-m_modifier.m_amount); else target->SetHealth(1); target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); } } return; } } // generic case target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool /*Real*/) { Unit* target = GetTarget(); uint32 oldhealth = target->GetHealth(); double healthPercentage = (double)oldhealth / (double)target->GetMaxHealth(); target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); // refresh percentage if (oldhealth > 0) { uint32 newhealth = uint32(ceil((double)target->GetMaxHealth() * healthPercentage)); if (newhealth == 0) newhealth = 1; target->SetHealth(newhealth); } } void Aura::<API key>(bool apply, bool /*Real*/) { Unit* target = GetTarget(); Powers powerType = target->getPowerType(); if (int32(powerType) != m_modifier.m_miscvalue) return; UnitMods unitMod = UnitMods(<API key> + powerType); target->HandleStatModifier(unitMod, TOTAL_VALUE, float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool /*Real*/) { Powers powerType = GetTarget()->getPowerType(); if (int32(powerType) != m_modifier.m_miscvalue) return; UnitMods unitMod = UnitMods(<API key> + powerType); GetTarget()->HandleStatModifier(unitMod, TOTAL_PCT, float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool /*Real*/) { GetTarget()->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(m_modifier.m_amount), apply); } /*** FIGHT ***/ void Aura::<API key>(bool /*apply*/, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; ((Player*)GetTarget())-><API key>(); } void Aura::<API key>(bool /*apply*/, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; ((Player*)GetTarget())-><API key>(); // sLog.outError("BONUS DODGE CHANCE: + %f", float(m_modifier.m_amount)); } void Aura::<API key>(bool /*apply*/, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; ((Player*)GetTarget())-><API key>(); // sLog.outError("BONUS BLOCK CHANCE: + %f", float(m_modifier.m_amount)); } void Aura::<API key>(bool /*apply*/, bool Real) { // spells required only Real aura add/remove if (!Real) return; if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; ((Player*)GetTarget())->UpdateManaRegen(); } void Aura::<API key>(bool apply, bool Real) { Unit* target = GetTarget(); if (target->GetTypeId() != TYPEID_PLAYER) return; // apply item specific bonuses for already equipped weapon if (Real) { for (int i = 0; i < MAX_ATTACK; ++i) if (Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i), true, false)) ((Player*)target)-><API key>(pItem, WeaponAttackType(i), this, apply); } // mods must be applied base at equipped weapon class and subclass comparison // with spell->EquippedItemClass and <API key> and <API key> // m_modifier.m_miscvalue comparison with item generated damage types if (GetSpellProto()->EquippedItemClass == -1) { ((Player*)target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float(m_modifier.m_amount), apply); ((Player*)target)->HandleBaseModValue(<API key>, FLAT_MOD, float(m_modifier.m_amount), apply); ((Player*)target)->HandleBaseModValue(<API key>, FLAT_MOD, float(m_modifier.m_amount), apply); } else { // done in Player::<API key> } } void Aura::HandleModHitChance(bool apply, bool /*Real*/) { Unit* target = GetTarget(); if (target->GetTypeId() == TYPEID_PLAYER) { ((Player*)target)-><API key>(); ((Player*)target)-><API key>(); } else { target->m_modMeleeHitChance += apply ? m_modifier.m_amount : (-m_modifier.m_amount); target-><API key> += apply ? m_modifier.m_amount : (-m_modifier.m_amount); } } void Aura::<API key>(bool apply, bool /*Real*/) { if (GetTarget()->GetTypeId() == TYPEID_PLAYER) { ((Player*)GetTarget())-><API key>(); } else { GetTarget()->m_modSpellHitChance += apply ? m_modifier.m_amount : (-m_modifier.m_amount); } } void Aura::<API key>(bool apply, bool Real) { // spells required only Real aura add/remove if (!Real) return; if (GetTarget()->GetTypeId() == TYPEID_PLAYER) { ((Player*)GetTarget())-><API key>(); } else { GetTarget()-><API key> += apply ? m_modifier.m_amount : (-m_modifier.m_amount); } } void Aura::<API key>(bool /*apply*/, bool Real) { // spells required only Real aura add/remove if (!Real) return; if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school) if (m_modifier.m_miscvalue & (1 << school)) ((Player*)GetTarget())-><API key>(school); } /*** ATTACK SPEED ***/ void Aura::<API key>(bool apply, bool /*Real*/) { GetTarget()-><API key>(float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool /*Real*/) { Unit* target = GetTarget(); target-><API key>(BASE_ATTACK, float(m_modifier.m_amount), apply); target-><API key>(OFF_ATTACK, float(m_modifier.m_amount), apply); target-><API key>(RANGED_ATTACK, float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool /*Real*/) { Unit* target = GetTarget(); target-><API key>(float(m_modifier.m_amount), apply); target-><API key>(BASE_ATTACK, float(m_modifier.m_amount), apply); target-><API key>(OFF_ATTACK, float(m_modifier.m_amount), apply); target-><API key>(RANGED_ATTACK, float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool /*Real*/) { GetTarget()-><API key>(BASE_ATTACK, float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool /*Real*/) { Unit* target = GetTarget(); target-><API key>(BASE_ATTACK, float(m_modifier.m_amount), apply); target-><API key>(OFF_ATTACK, float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool /*Real*/) { GetTarget()-><API key>(RANGED_ATTACK, float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; GetTarget()-><API key>(RANGED_ATTACK, float(m_modifier.m_amount), apply); } /*** ATTACK POWER ***/ void Aura::<API key>(bool apply, bool /*Real*/) { GetTarget()->HandleStatModifier(<API key>, TOTAL_VALUE, float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool /*Real*/) { if ((GetTarget()->getClassMask() & <API key>) != 0) return; GetTarget()->HandleStatModifier(<API key>, TOTAL_VALUE, float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool /*Real*/) { // <API key> = multiplier - 1 GetTarget()->HandleStatModifier(<API key>, TOTAL_PCT, float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool /*Real*/) { if ((GetTarget()->getClassMask() & <API key>) != 0) return; // <API key> = multiplier - 1 GetTarget()->HandleStatModifier(<API key>, TOTAL_PCT, float(m_modifier.m_amount), apply); } void Aura::<API key>(bool /*apply*/, bool Real) { // spells required only Real aura add/remove if (!Real) return; // Recalculate bonus if (GetTarget()->GetTypeId() == TYPEID_PLAYER && !(GetTarget()->getClassMask() & <API key>)) ((Player*)GetTarget())-><API key>(true); } /*** DAMAGE BONUS ***/ void Aura::HandleModDamageDone(bool apply, bool Real) { Unit* target = GetTarget(); // apply item specific bonuses for already equipped weapon if (Real && target->GetTypeId() == TYPEID_PLAYER) { for (int i = 0; i < MAX_ATTACK; ++i) if (Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i), true, false)) ((Player*)target)-><API key>(pItem, WeaponAttackType(i), this, apply); } // m_modifier.m_miscvalue is bitmask of spell schools // 1 ( 0-bit ) - normal school damage (<API key>) // 126 - full bitmask all magic damages (<API key>) including wands // 127 - full bitmask any damages // mods must be applied base at equipped weapon class and subclass comparison // with spell->EquippedItemClass and <API key> and <API key> // m_modifier.m_miscvalue comparison with item generated damage types if ((m_modifier.m_miscvalue & <API key>) != 0) { // apply generic physical damage bonuses including wand case if (GetSpellProto()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER) { target->HandleStatModifier(<API key>, TOTAL_VALUE, float(m_modifier.m_amount), apply); target->HandleStatModifier(<API key>, TOTAL_VALUE, float(m_modifier.m_amount), apply); target->HandleStatModifier(<API key>, TOTAL_VALUE, float(m_modifier.m_amount), apply); } else { // done in Player::<API key> } if (target->GetTypeId() == TYPEID_PLAYER) { if (m_positive) target->ApplyModUInt32Value(<API key>, m_modifier.m_amount, apply); else target->ApplyModUInt32Value(<API key>, m_modifier.m_amount, apply); } } // Skip non magic case for speedup if ((m_modifier.m_miscvalue & <API key>) == 0) return; if (GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()-><API key> != 0) { // wand magic case (skip generic to all item spell bonuses) // done in Player::<API key> // Skip item specific requirements for not wand magic damage return; } // Magic damage modifiers implemented in Unit::<API key> // This information for client side use only if (target->GetTypeId() == TYPEID_PLAYER) { if (m_positive) { for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) { if ((m_modifier.m_miscvalue & (1 << i)) != 0) target->ApplyModUInt32Value(<API key> + i, m_modifier.m_amount, apply); } } else { for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) { if ((m_modifier.m_miscvalue & (1 << i)) != 0) target->ApplyModUInt32Value(<API key> + i, m_modifier.m_amount, apply); } } Pet* pet = target->GetPet(); if (pet) pet-><API key>(); } } void Aura::<API key>(bool apply, bool Real) { DEBUG_FILTER_LOG(<API key>, "AURA MOD DAMAGE type:%u negative:%u", m_modifier.m_miscvalue, m_positive ? 0 : 1); Unit* target = GetTarget(); // apply item specific bonuses for already equipped weapon if (Real && target->GetTypeId() == TYPEID_PLAYER) { for (int i = 0; i < MAX_ATTACK; ++i) if (Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i), true, false)) ((Player*)target)-><API key>(pItem, WeaponAttackType(i), this, apply); } // m_modifier.m_miscvalue is bitmask of spell schools // 1 ( 0-bit ) - normal school damage (<API key>) // 126 - full bitmask all magic damages (<API key>) including wand // 127 - full bitmask any damages // mods must be applied base at equipped weapon class and subclass comparison // with spell->EquippedItemClass and <API key> and <API key> // m_modifier.m_miscvalue comparison with item generated damage types if ((m_modifier.m_miscvalue & <API key>) != 0) { // apply generic physical damage bonuses including wand case if (GetSpellProto()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER) { target->HandleStatModifier(<API key>, TOTAL_PCT, float(m_modifier.m_amount), apply); target->HandleStatModifier(<API key>, TOTAL_PCT, float(m_modifier.m_amount), apply); target->HandleStatModifier(<API key>, TOTAL_PCT, float(m_modifier.m_amount), apply); } else { // done in Player::<API key> } // For show in client if (target->GetTypeId() == TYPEID_PLAYER) target-><API key>(<API key>, m_modifier.m_amount / 100.0f, apply); } // Skip non magic case for speedup if ((m_modifier.m_miscvalue & <API key>) == 0) return; if (GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()-><API key> != 0) { // wand magic case (skip generic to all item spell bonuses) // done in Player::<API key> // Skip item specific requirements for not wand magic damage return; } // Magic damage percent modifiers implemented in Unit::<API key> // Send info to client if (target->GetTypeId() == TYPEID_PLAYER) for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) target-><API key>(<API key> + i, m_modifier.m_amount / 100.0f, apply); } void Aura::<API key>(bool apply, bool Real) { // spells required only Real aura add/remove if (!Real) return; DEBUG_FILTER_LOG(<API key>, "AURA MOD OFFHAND DAMAGE"); GetTarget()->HandleStatModifier(<API key>, TOTAL_PCT, float(m_modifier.m_amount), apply); } /*** POWER COST ***/ void Aura::<API key>(bool apply, bool Real) { // spells required only Real aura add/remove if (!Real) return; float amount = m_modifier.m_amount / 100.0f; for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) if (m_modifier.m_miscvalue & (1 << i)) GetTarget()-><API key>(<API key> + i, amount, apply); } void Aura::HandleModPowerCost(bool apply, bool Real) { // spells required only Real aura add/remove if (!Real) return; for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) if (m_modifier.m_miscvalue & (1 << i)) GetTarget()->ApplyModInt32Value(<API key> + i, m_modifier.m_amount, apply); } /*** OTHERS ***/ void Aura::<API key>(bool apply) { uint32 spellId1 = 0; uint32 spellId2 = 0; uint32 HotWSpellId = 0; ShapeshiftForm form = ShapeshiftForm(GetModifier()->m_miscvalue); Unit* target = GetTarget(); switch (form) { case FORM_CAT: spellId1 = 3025; HotWSpellId = 24900; break; case FORM_TREE: spellId1 = 5420; break; case FORM_TRAVEL: spellId1 = 5419; break; case FORM_AQUA: spellId1 = 5421; break; case FORM_BEAR: spellId1 = 1178; spellId2 = 21178; HotWSpellId = 24899; break; case FORM_DIREBEAR: spellId1 = 9635; spellId2 = 21178; HotWSpellId = 24899; break; case FORM_BATTLESTANCE: spellId1 = 21156; break; case <API key>: spellId1 = 7376; break; case <API key>: spellId1 = 7381; break; case FORM_MOONKIN: spellId1 = 24905; break; case FORM_FLIGHT: spellId1 = 33948; spellId2 = 34764; break; case FORM_FLIGHT_EPIC: spellId1 = 40122; spellId2 = 40121; break; case <API key>: spellId1 = 27792; spellId2 = 27795; // must be second, this important at aura remove to prevent to early iterator invalidation. break; case FORM_GHOSTWOLF: case FORM_AMBIENT: case FORM_GHOUL: case FORM_SHADOW: case FORM_STEALTH: case FORM_CREATURECAT: case FORM_CREATUREBEAR: break; } if (apply) { if (spellId1) target->CastSpell(target, spellId1, true, NULL, this); if (spellId2) target->CastSpell(target, spellId2, true, NULL, this); if (target->GetTypeId() == TYPEID_PLAYER) { const PlayerSpellMap& sp_list = ((Player*)target)->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { if (itr->second.state == PLAYERSPELL_REMOVED) continue; if (itr->first == spellId1 || itr->first == spellId2) continue; SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first); if (!spellInfo || !<API key>(spellInfo, form)) continue; target->CastSpell(target, itr->first, true, NULL, this); } // Leader of the Pack if (((Player*)target)->HasSpell(17007)) { SpellEntry const* spellInfo = sSpellStore.LookupEntry(24932); if (spellInfo && spellInfo->Stances & (1 << (form - 1))) target->CastSpell(target, 24932, true, NULL, this); } // Heart of the Wild if (HotWSpellId) { Unit::AuraList const& mModTotalStatPct = target->GetAurasByType(<API key>); for (Unit::AuraList::const_iterator i = mModTotalStatPct.begin(); i != mModTotalStatPct.end(); ++i) { if ((*i)->GetSpellProto()->SpellIconID == 240 && (*i)->GetModifier()->m_miscvalue == 3) { int32 HotWMod = (*i)->GetModifier()->m_amount; if (GetModifier()->m_miscvalue == FORM_CAT) HotWMod /= 2; target->CastCustomSpell(target, HotWSpellId, &HotWMod, NULL, NULL, true, NULL, this); break; } } } } } else { if (spellId1) target-><API key>(spellId1); if (spellId2) target-><API key>(spellId2); Unit::SpellAuraHolderMap& tAuras = target-><API key>(); for (Unit::SpellAuraHolderMap::iterator itr = tAuras.begin(); itr != tAuras.end();) { if (itr->second-><API key>()) { target-><API key>(itr->second->GetId()); itr = tAuras.begin(); } else ++itr; } } } void Aura::HandleAuraEmpathy(bool apply, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_UNIT) return; CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(GetTarget()->GetEntry()); if (ci && ci->type == CREATURE_TYPE_BEAST) GetTarget()->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, <API key>, apply); } void Aura::<API key>(bool apply, bool /*Real*/) { if (apply) GetTarget()->SetByteFlag(UNIT_FIELD_BYTES_1, 3, <API key>); else GetTarget()->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, <API key>); } void Aura::HandleAuraModPacify(bool apply, bool /*Real*/) { if (apply) GetTarget()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); else GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); } void Aura::<API key>(bool apply, bool Real) { HandleAuraModPacify(apply, Real); <API key>(apply, Real); } void Aura::HandleAuraGhost(bool apply, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; if (apply) { GetTarget()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST); } else { GetTarget()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST); } } void Aura::<API key>(bool apply, bool Real) { // all applied/removed only at real aura add/remove if (!Real) return; // allow fly WorldPacket data; if (apply) data.Initialize(<API key>, 12); else data.Initialize(<API key>, 12); data << GetTarget()->GetPackGUID(); data << uint32(0); // unk GetTarget()->SendMessageToSet(&data, true); } void Aura::HandleModRating(bool apply, bool Real) { // spells required only Real aura add/remove if (!Real) return; if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating) if (m_modifier.m_miscvalue & (1 << rating)) ((Player*)GetTarget())->ApplyRatingMod(CombatRating(rating), m_modifier.m_amount, apply); } void Aura::<API key>(bool apply, bool Real) { if (!Real) return; if (apply) GetTarget()->SetFlag(UNIT_FIELD_FLAGS_2, <API key>); else GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS_2, <API key>); } void Aura::<API key>(bool /*apply*/, bool /*Real*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; ((Player*)GetTarget())->UpdateExpertise(BASE_ATTACK); ((Player*)GetTarget())->UpdateExpertise(OFF_ATTACK); } void Aura::<API key>(bool apply, bool Real) { // spells required only Real aura add/remove if (!Real) return; Unit* target = GetTarget(); // applied to damage as <API key> in Unit::<API key> and Unit::<API key> // show armor penetration if (target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & <API key>)) target->ApplyModInt32Value(<API key>, m_modifier.m_amount, apply); // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy if (target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & <API key>) == <API key>) target->ApplyModInt32Value(<API key>, m_modifier.m_amount, apply); } void Aura::<API key>(bool apply, bool /*Real*/) { BaseModType modType = FLAT_MOD; if (m_modifier.m_auraname == <API key>) modType = PCT_MOD; if (GetTarget()->GetTypeId() == TYPEID_PLAYER) ((Player*)GetTarget())->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(m_modifier.m_amount), apply); } void Aura::<API key>(bool apply, bool Real) { // spells required only Real aura add/remove if (!Real) return; if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; Player* target = (Player*)GetTarget(); // combo points was added in <API key> handler // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost) if (!apply && m_removeMode == <API key> && target->GetComboTargetGuid()) if (Unit* unit = ObjectAccessor::GetUnit(*GetTarget(), target->GetComboTargetGuid())) target->AddComboPoints(unit, -m_modifier.m_amount); } void Aura::<API key>(bool Apply, bool Real) { if (Real && Apply) { GetTarget()->CombatStop(); GetTarget()-><API key>(<API key>); } GetTarget()->ApplyModFlag(UNIT_FIELD_FLAGS, <API key>, Apply); } void Aura::<API key>(bool apply, bool Real) { // spells required only Real aura add/remove if (!Real) return; Unit* target = GetTarget(); // prepare spirit state if (apply) { if (target->GetTypeId() == TYPEID_PLAYER) { // disable breath/etc timers ((Player*)target)->StopMirrorTimers(); // set stand state (expected in this form) if (!target->IsStandState()) target->SetStandState(<API key>); } target->SetHealth(1); } // die at aura end else target->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, <API key>, GetSpellProto(), false); } void Aura::HandleSchoolAbsorb(bool apply, bool Real) { if (!Real) return; Unit* caster = GetCaster(); if (!caster) return; Unit* target = GetTarget(); SpellEntry const* spellProto = GetSpellProto(); if (apply) { // prevent double apply bonuses if (target->GetTypeId() != TYPEID_PLAYER || !((Player*)target)->GetSession()->PlayerLoading()) { float DoneActualBenefit = 0.0f; switch (spellProto->SpellFamilyName) { case SPELLFAMILY_PRIEST: // Power Word: Shield if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001)) { //+30% from +healing bonus DoneActualBenefit = caster-><API key>(GetSpellSchoolMask(spellProto)) * 0.3f; break; } break; case SPELLFAMILY_MAGE: // Frost Ward, Fire Ward if (spellProto->IsFitToFamilyMask(UI64LIT(0x0000000100080108))) //+10% from +spell bonus DoneActualBenefit = caster-><API key>(GetSpellSchoolMask(spellProto)) * 0.1f; break; case SPELLFAMILY_WARLOCK: // Shadow Ward if (spellProto->SpellFamilyFlags == UI64LIT(0x00)) //+10% from +spell bonus DoneActualBenefit = caster-><API key>(GetSpellSchoolMask(spellProto)) * 0.1f; break; default: break; } DoneActualBenefit *= caster-><API key>(GetSpellProto()); m_modifier.m_amount += (int32)DoneActualBenefit; } } } void Aura::PeriodicTick() { Unit* target = GetTarget(); SpellEntry const* spellProto = GetSpellProto(); switch (m_modifier.m_auraname) { case <API key>: case <API key>: { // don't damage target if not alive, possible death persistent effects if (!target->isAlive()) return; Unit* pCaster = GetCaster(); if (!pCaster) return; if (spellProto->Effect[GetEffIndex()] == <API key> && pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) return; // Check for immune (not use charges) if (target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) return; // some auras remove at specific health level or more if (m_modifier.m_auraname == <API key>) { switch (GetId()) { case 43093: case 31956: case 38801: case 35321: case 38363: case 39215: case 48920: { if (target->GetHealth() == target->GetMaxHealth()) { target-><API key>(GetId()); return; } break; } case 38772: { uint32 percent = GetEffIndex() < EFFECT_INDEX_2 && spellProto->Effect[GetEffIndex()] == SPELL_EFFECT_DUMMY ? pCaster-><API key>(target, spellProto, SpellEffectIndex(GetEffIndex() + 1)) : 100; if (target->GetHealth() * 100 >= target->GetMaxHealth() * percent) { target-><API key>(GetId()); return; } break; } default: break; } } uint32 absorb = 0; uint32 resist = 0; CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL); // ignore non positive values (can be result apply spellmods to aura damage uint32 amount = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; uint32 pdamage; if (m_modifier.m_auraname == <API key>) pdamage = amount; else pdamage = uint32(target->GetMaxHealth() * amount / 100); // SpellDamageBonus for magic spells if (spellProto->DmgClass == <API key> || spellProto->DmgClass == <API key>) pdamage = target-><API key>(pCaster, spellProto, pdamage, DOT, GetStackAmount()); // MeleeDamagebonus for weapon based spells else { WeaponAttackType attackType = GetWeaponAttackType(spellProto); pdamage = target-><API key>(pCaster, pdamage, attackType, spellProto, DOT, GetStackAmount()); } // Calculate armor mitigation if it is a physical spell // But not for bleed mechanic spells if (GetSpellSchoolMask(spellProto) & <API key> && GetEffectMechanic(spellProto, m_effIndex) != MECHANIC_BLEED) { uint32 <API key> = pCaster-><API key>(target, pdamage); cleanDamage.damage += pdamage - <API key>; pdamage = <API key>; } // Curse of Agony damage-per-tick calculation if (spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000400)) && spellProto->SpellIconID == 544) { // 1..4 ticks, 1/2 from normal tick damage if (GetAuraTicks() <= 4) pdamage = pdamage / 2; // 9..12 ticks, 3/2 from normal tick damage else if (GetAuraTicks() >= 9) pdamage += (pdamage + 1) / 2; // +1 prevent 0.5 damage possible lost at 1..4 ticks // 5..8 ticks have normal tick damage } // As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit // Reduce dot damage from resilience for players if (target->GetTypeId() == TYPEID_PLAYER) pdamage -= ((Player*)target)-><API key>(pdamage); target-><API key>(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !GetSpellProto()->HasAttribute(<API key>)); DETAIL_FILTER_LOG(<API key>, "PeriodicTick: %s attacked %s for %u dmg inflicted by %u", GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId()); pCaster->DealDamageMods(target, pdamage, &absorb); // Set trigger flag uint32 procAttacker = <API key>; // | <API key>; uint32 procVictim = <API key>;// | <API key>; pdamage = (pdamage <= absorb + resist) ? 0 : (pdamage - absorb - resist); <API key> pInfo(this, pdamage, absorb, resist, 0.0f); target->SendPeriodicAuraLog(&pInfo); if (pdamage) procVictim |= <API key>; pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto); pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(spellProto), spellProto, true); break; } case <API key>: case <API key>: { // don't damage target if not alive, possible death persistent effects if (!target->isAlive()) return; Unit* pCaster = GetCaster(); if (!pCaster) return; if (!pCaster->isAlive()) return; if (spellProto->Effect[GetEffIndex()] == <API key> && pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) return; // Check for immune if (target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) return; uint32 absorb = 0; uint32 resist = 0; CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL); uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; // Calculate armor mitigation if it is a physical spell if (GetSpellSchoolMask(spellProto) & <API key>) { uint32 <API key> = pCaster-><API key>(target, pdamage); cleanDamage.damage += pdamage - <API key>; pdamage = <API key>; } pdamage = target-><API key>(pCaster, spellProto, pdamage, DOT, GetStackAmount()); // As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit // Reduce dot damage from resilience for players if (target->GetTypeId() == TYPEID_PLAYER) pdamage -= ((Player*)target)-><API key>(pdamage); target-><API key>(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !spellProto->HasAttribute(<API key>)); if (target->GetHealth() < pdamage) pdamage = uint32(target->GetHealth()); DETAIL_FILTER_LOG(<API key>, "PeriodicTick: %s health leech of %s for %u dmg inflicted by %u abs is %u", GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId(), absorb); pCaster->DealDamageMods(target, pdamage, &absorb); pCaster-><API key>(target, GetId(), pdamage, GetSpellSchoolMask(spellProto), absorb, resist, false, 0); float multiplier = spellProto->EffectMultipleValue[GetEffIndex()] > 0 ? spellProto->EffectMultipleValue[GetEffIndex()] : 1; // Set trigger flag uint32 procAttacker = <API key>; // | <API key>; uint32 procVictim = <API key>;// | <API key>; pdamage = (pdamage <= absorb + resist) ? 0 : (pdamage - absorb - resist); if (pdamage) procVictim |= <API key>; pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto); int32 new_damage = pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(spellProto), spellProto, false); if (!target->isAlive() && pCaster-><API key>(false)) for (uint32 i = <API key>; i < CURRENT_MAX_SPELL; ++i) if (Spell* spell = pCaster->GetCurrentSpell(CurrentSpellTypes(i))) if (spell->m_spellInfo->Id == GetId()) spell->cancel(); if (Player* modOwner = pCaster->GetSpellModOwner()) modOwner->ApplySpellMod(GetId(), <API key>, multiplier); uint32 heal = pCaster-><API key>(pCaster, spellProto, int32(new_damage * multiplier), DOT, GetStackAmount()); int32 gain = pCaster->DealHeal(pCaster, heal, spellProto); pCaster-><API key>().threatAssist(pCaster, gain * 0.5f * sSpellMgr.<API key>(spellProto), spellProto); break; } case <API key>: case <API key>: { // don't heal target if not alive, mostly death persistent effects from items if (!target->isAlive()) return; Unit* pCaster = GetCaster(); if (!pCaster) return; // heal for caster damage (must be alive) if (target != pCaster && spellProto->SpellVisual == 163 && !pCaster->isAlive()) return; // ignore non positive values (can be result apply spellmods to aura damage uint32 amount = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; uint32 pdamage; if (m_modifier.m_auraname == <API key>) pdamage = uint32(target->GetMaxHealth() * amount / 100); else pdamage = amount; pdamage = target-><API key>(pCaster, spellProto, pdamage, DOT, GetStackAmount()); DETAIL_FILTER_LOG(<API key>, "PeriodicTick: %s heal of %s for %u health inflicted by %u", GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId()); int32 gain = target->ModifyHealth(pdamage); <API key> pInfo(this, pdamage, 0, 0, 0.0f); target->SendPeriodicAuraLog(&pInfo); // Set trigger flag uint32 procAttacker = <API key>; uint32 procVictim = <API key>; uint32 procEx = PROC_EX_NORMAL_HIT | <API key>; pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, gain, BASE_ATTACK, spellProto); // add HoTs to amount healed in bgs if (pCaster->GetTypeId() == TYPEID_PLAYER) if (BattleGround* bg = ((Player*)pCaster)->GetBattleGround()) bg->UpdatePlayerScore(((Player*)pCaster), SCORE_HEALING_DONE, gain); target-><API key>().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.<API key>(spellProto), spellProto); // heal for caster damage if (target != pCaster && spellProto->SpellVisual == 163) { uint32 dmg = spellProto->manaPerSecond; if (pCaster->GetHealth() <= dmg && pCaster->GetTypeId() == TYPEID_PLAYER) { pCaster-><API key>(GetId()); // finish current generic/channeling spells, don't affect autorepeat pCaster->FinishSpell(<API key>); pCaster->FinishSpell(<API key>); } else { uint32 damage = gain; uint32 absorb = 0; pCaster->DealDamageMods(pCaster, damage, &absorb); pCaster-><API key>(pCaster, GetId(), damage, GetSpellSchoolMask(spellProto), absorb, 0, false, 0, false); CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL); pCaster->DealDamage(pCaster, damage, &cleanDamage, NODAMAGE, GetSpellSchoolMask(spellProto), spellProto, true); } } break; } case <API key>: { // don't damage target if not alive, possible death persistent effects if (!target->isAlive()) return; if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS) return; Powers power = Powers(m_modifier.m_miscvalue); // power type might have changed between aura applying and tick (druid's shapeshift) if (target->getPowerType() != power) return; Unit* pCaster = GetCaster(); if (!pCaster) return; if (!pCaster->isAlive()) return; if (GetSpellProto()->Effect[GetEffIndex()] == <API key> && pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) return; // Check for immune (not use charges) if (target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) return; // ignore non positive values (can be result apply spellmods to aura damage uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; DETAIL_FILTER_LOG(<API key>, "PeriodicTick: %s power leech of %s for %u dmg inflicted by %u", GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId()); int32 drain_amount = target->GetPower(power) > pdamage ? pdamage : target->GetPower(power); // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) if (power == POWER_MANA && target->GetTypeId() == TYPEID_PLAYER) drain_amount -= ((Player*)target)-><API key>(drain_amount); target->ModifyPower(power, -drain_amount); float gain_multiplier = 0.0f; if (pCaster->GetMaxPower(power) > 0) { gain_multiplier = spellProto->EffectMultipleValue[GetEffIndex()]; if (Player* modOwner = pCaster->GetSpellModOwner()) modOwner->ApplySpellMod(GetId(), <API key>, gain_multiplier); } <API key> pInfo(this, drain_amount, 0, 0, gain_multiplier); target->SendPeriodicAuraLog(&pInfo); if (int32 gain_amount = int32(drain_amount * gain_multiplier)) { int32 gain = pCaster->ModifyPower(power, gain_amount); if (GetId() == 5138) // Drain Mana if (Aura* petPart = GetHolder()-><API key>(EFFECT_INDEX_1)) if (int pet_gain = gain_amount * petPart->GetModifier()->m_amount / 100) pCaster->CastCustomSpell(pCaster, 32554, &pet_gain, NULL, NULL, true); target->AddThreat(pCaster, float(gain) * 0.5f, false, GetSpellSchoolMask(spellProto), spellProto); } // Some special cases switch (GetId()) { case 32960: // Mark of Kazzak { if (target->GetTypeId() == TYPEID_PLAYER && target->getPowerType() == POWER_MANA) { // Drain 5% of target's mana pdamage = target->GetMaxPower(POWER_MANA) * 5 / 100; drain_amount = target->GetPower(POWER_MANA) > pdamage ? pdamage : target->GetPower(POWER_MANA); target->ModifyPower(POWER_MANA, -drain_amount); <API key> pInfo(this, drain_amount, 0, 0, 0.0f); target->SendPeriodicAuraLog(&pInfo); } // no break here } case 21056: // Mark of Kazzak case 31447: // Mark of Kaz'rogal { uint32 triggerSpell = 0; switch (GetId()) { case 21056: triggerSpell = 21058; break; case 31447: triggerSpell = 31463; break; case 32960: triggerSpell = 32961; break; } if (target->GetTypeId() == TYPEID_PLAYER && target->GetPower(power) == 0) { target->CastSpell(target, triggerSpell, true, NULL, this); target-><API key>(GetId()); } break; } } break; } case <API key>: { // don't energize target if not alive, possible death persistent effects if (!target->isAlive()) return; // ignore non positive values (can be result apply spellmods to aura damage uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; DETAIL_FILTER_LOG(<API key>, "PeriodicTick: %s energize %s for %u dmg inflicted by %u", GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId()); if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS) break; Powers power = Powers(m_modifier.m_miscvalue); if (target->GetMaxPower(power) == 0) break; <API key> pInfo(this, pdamage, 0, 0, 0.0f); target->SendPeriodicAuraLog(&pInfo); int32 gain = target->ModifyPower(power, pdamage); if (Unit* pCaster = GetCaster()) target-><API key>().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.<API key>(spellProto), spellProto); break; } case <API key>: { // don't energize target if not alive, possible death persistent effects if (!target->isAlive()) return; // ignore non positive values (can be result apply spellmods to aura damage uint32 amount = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; uint32 pdamage = uint32(target->GetMaxPower(POWER_MANA) * amount / 100); DETAIL_FILTER_LOG(<API key>, "PeriodicTick: %s energize %s for %u mana inflicted by %u", GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId()); if (target->GetMaxPower(POWER_MANA) == 0) break; <API key> pInfo(this, pdamage, 0, 0, 0.0f); target->SendPeriodicAuraLog(&pInfo); int32 gain = target->ModifyPower(POWER_MANA, pdamage); if (Unit* pCaster = GetCaster()) target-><API key>().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.<API key>(spellProto), spellProto); break; } case <API key>: { // don't mana burn target if not alive, possible death persistent effects if (!target->isAlive()) return; Unit* pCaster = GetCaster(); if (!pCaster) return; // Check for immune (not use charges) if (target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) return; int32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; Powers powerType = Powers(m_modifier.m_miscvalue); if (!target->isAlive() || target->getPowerType() != powerType) return; // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) if (powerType == POWER_MANA && target->GetTypeId() == TYPEID_PLAYER) pdamage -= ((Player*)target)-><API key>(pdamage); uint32 gain = uint32(-target->ModifyPower(powerType, -pdamage)); gain = uint32(gain * spellProto->EffectMultipleValue[GetEffIndex()]); // maybe has to be sent different to client, but not by <API key> SpellNonMeleeDamage damageInfo(pCaster, target, spellProto->Id, SpellSchoolMask(spellProto->SchoolMask)); pCaster-><API key>(&damageInfo, gain, spellProto); damageInfo.target-><API key>(pCaster, &damageInfo, spellProto); pCaster->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); pCaster-><API key>(&damageInfo); // Set trigger flag uint32 procAttacker = <API key>; // | <API key>; uint32 procVictim = <API key>;// | <API key>; uint32 procEx = <API key>(&damageInfo, SPELL_MISS_NONE); if (damageInfo.damage) procVictim |= <API key>; pCaster->ProcDamageAndSpell(damageInfo.target, procAttacker, procVictim, procEx, damageInfo.damage, BASE_ATTACK, spellProto); pCaster->DealSpellDamage(&damageInfo, true); break; } case <API key>: { // don't heal target if not alive, possible death persistent effects if (!target->isAlive()) return; int32 gain = target->ModifyHealth(m_modifier.m_amount); if (Unit* caster = GetCaster()) target-><API key>().threatAssist(caster, float(gain) * 0.5f * sSpellMgr.<API key>(spellProto), spellProto); break; } case <API key>: { // don't energize target if not alive, possible death persistent effects if (!target->isAlive()) return; Powers pt = target->getPowerType(); if (int32(pt) != m_modifier.m_miscvalue) return; if (spellProto->AuraInterruptFlags & <API key>) { // eating anim target->HandleEmoteCommand(EMOTE_ONESHOT_EAT); } else if (GetId() == 20577) { // cannibalize anim target->HandleEmoteCommand(<API key>); } // Anger Management // amount = 1+ 16 = 17 = 3,4*5 = 10,2*5/3 // so 17 is rounded amount for 5 sec tick grow ~ 1 range grow in 3 sec if (pt == POWER_RAGE) target->ModifyPower(pt, m_modifier.m_amount * 3 / 5); break; } // Here tick dummy auras case SPELL_AURA_DUMMY: // some spells have dummy aura case <API key>: { PeriodicDummyTick(); break; } case <API key>: { TriggerSpell(); break; } case <API key>: { <API key>(); break; } default: break; } } void Aura::PeriodicDummyTick() { SpellEntry const* spell = GetSpellProto(); Unit* target = GetTarget(); switch (spell->SpellFamilyName) { case SPELLFAMILY_GENERIC: { switch (spell->Id) { // Forsaken Skills case 7054: { // Possibly need cast one of them (but // 7038 Forsaken Skill: Swords // 7039 Forsaken Skill: Axes // 7040 Forsaken Skill: Daggers // 7041 Forsaken Skill: Maces // 7042 Forsaken Skill: Staves // 7043 Forsaken Skill: Bows // 7044 Forsaken Skill: Guns // 7045 Forsaken Skill: 2H Axes // 7046 Forsaken Skill: 2H Maces // 7047 Forsaken Skill: 2H Swords // 7048 Forsaken Skill: Defense // 7049 Forsaken Skill: Fire // 7050 Forsaken Skill: Frost // 7051 Forsaken Skill: Holy // 7053 Forsaken Skill: Shadow return; } case 7057: // Haunting Spirits if (roll_chance_i(33)) target->CastSpell(target, m_modifier.m_amount, true, NULL, this); return; // // Panda // case 19230: break; // // Gossip NPC Periodic - Talk // case 33208: break; // // Gossip NPC Periodic - Despawn // case 33209: break; // // Steal Weapon // case 36207: break; // // Simon Game START timer, (DND) // case 39993: break; // // Harpooner's Mark // case 40084: break; // // Old Mount Spell // case 40154: break; // // Magnetic Pull // case 40581: break; // // Ethereal Ring: break; The Bolt Burst // case 40801: break; // // Crystal Prison // case 40846: break; // // Copy Weapon // case 41054: break; // // Ethereal Ring Visual, Lightning Aura // case 41477: break; // // Ethereal Ring Visual, Lightning Aura (Fork) // case 41525: break; // // Ethereal Ring Visual, Lightning Jumper Aura // case 41567: break; // // No Man's Land // case 41955: break; // // Headless Horseman - Fire // case 42074: break; // // Headless Horseman - Visual - Large Fire // case 42075: break; // // Headless Horseman - Start Fire, Periodic Aura // case 42140: break; // // Ram Speed Boost // case 42152: break; // // Headless Horseman - Fires Out Victory Aura // case 42235: break; // // Pumpkin Life Cycle // case 42280: break; // // Brewfest Request Chick Chuck Mug Aura // case 42537: break; // // Squashling // case 42596: break; // // Headless Horseman Climax, Head: Periodic // case 42603: break; case 42621: // Fire Bomb { // Cast the summon spells (42622 to 42627) with increasing chance uint32 rand = urand(0, 99); for (uint32 i = 1; i <= 6; ++i) { if (rand < i * (i + 1) / 2 * 5) { target->CastSpell(target, spell->Id + i, true); break; } } break; } // // Headless Horseman - Conflagrate, Periodic Aura // case 42637: break; // // Headless Horseman - Create Pumpkin Treats Aura // case 42774: break; // // Headless Horseman Climax - Summoning Rhyme Aura // case 42879: break; // // Tricky Treat // case 42919: break; // // Giddyup! // case 42924: break; // // Ram - Trot // case 42992: break; // // Ram - Canter // case 42993: break; // // Ram - Gallop // case 42994: break; // // Ram Level - Neutral // case 43310: break; // // Headless Horseman - Maniacal Laugh, Maniacal, Delayed 17 // case 43884: break; // // Headless Horseman - Maniacal Laugh, Maniacal, other, Delayed 17 // case 44000: break; // // Energy Feedback // case 44328: break; // // Romantic Picnic // case 45102: break; // // Romantic Picnic // case 45123: break; // // Looking for Love // case 45124: break; // // Kite - Lightning Strike Kite Aura // case 45197: break; // // Rocket Chicken // case 45202: break; // // Copy Offhand Weapon // case 45205: break; // // Upper Deck - Kite - Lightning Periodic Aura // case 45207: break; // // Kite -Sky Lightning Strike Kite Aura // case 45251: break; // // Ribbon Pole Dancer Check Aura // case 45390: break; // // Holiday - Midsummer, Ribbon Pole Periodic Visual // case 45406: break; // // Alliance Flag, Extra Damage Debuff // case 45898: break; // // Horde Flag, Extra Damage Debuff // case 45899: break; // // Ahune - Summoning Rhyme Aura // case 45926: break; // // Ahune - Slippery Floor // case 45945: break; // // Ahune's Shield // case 45954: break; // // Nether Vapor Lightning // case 45960: break; // // Darkness // case 45996: break; case 46041: // Summon Blood Elves Periodic target->CastSpell(target, 46037, true, NULL, this); target->CastSpell(target, roll_chance_i(50) ? 46038 : 46039, true, NULL, this); target->CastSpell(target, 46040, true, NULL, this); return; // // Transform Visual Missile Periodic // case 46205: break; // // Find Opening Beam End // case 46333: break; // // Ice Spear Control Aura // case 46371: break; // // Hailstone Chill // case 46458: break; // // Hailstone Chill, Internal // case 46465: break; // // Chill, Internal Shifter // case 46549: break; // // Summon Ice Spear Knockback Delayer // case 46878: break; // // Send Mug Control Aura // case 47369: break; // // Direbrew's Disarm (precast) // case 47407: break; // // Mole Machine Port Schedule // case 47489: break; // // Mole Machine Portal Schedule // case 49466: break; // // Drink Coffee // case 49472: break; // // Listening to Music // case 50493: break; // // Love Rocket Barrage // case 50530: break; // Exist more after, need add later default: break; } // Drink (item drink spells) if (GetEffIndex() > EFFECT_INDEX_0 && spell->EffectApplyAuraName[GetEffIndex()-1] == <API key>) { if (target->GetTypeId() != TYPEID_PLAYER) return; // Search <API key> aura for this spell and add bonus if (Aura* aura = GetHolder()-><API key>(SpellEffectIndex(GetEffIndex() - 1))) { aura->GetModifier()->m_amount = m_modifier.m_amount; ((Player*)target)->UpdateManaRegen(); // Disable continue m_isPeriodic = false; return; } return; } break; } case SPELLFAMILY_HUNTER: { // Aspect of the Viper switch (spell->Id) { case 34074: { if (target->GetTypeId() != TYPEID_PLAYER) return; // Should be manauser if (target->getPowerType() != POWER_MANA) return; Unit* caster = GetCaster(); if (!caster) return; // Regen amount is max (100% from spell) on 21% or less mana and min on 92.5% or greater mana (20% from spell) int mana = target->GetPower(POWER_MANA); int max_mana = target->GetMaxPower(POWER_MANA); int32 base_regen = caster-><API key>(target, GetSpellProto(), m_effIndex, &m_currentBasePoints); float regen_pct = 1.20f - 1.1f * mana / max_mana; if (regen_pct > 1.0f) regen_pct = 1.0f; else if (regen_pct < 0.2f) regen_pct = 0.2f; m_modifier.m_amount = int32(base_regen * regen_pct); ((Player*)target)->UpdateManaRegen(); return; } // // Knockdown Fel Cannon: break; The Aggro Burst // case 40119: break; } break; } default: break; } } void Aura::<API key>(bool apply, bool Real) { if (!Real) return; Unit::AuraList const& fearAuras = GetTarget()->GetAurasByType(SPELL_AURA_MOD_FEAR); if (!fearAuras.empty()) { if (apply) GetTarget()->SetFeared(false, fearAuras.front()->GetCasterGuid()); else GetTarget()->SetFeared(true); } } void Aura::HandleManaShield(bool apply, bool Real) { if (!Real) return; // prevent double apply bonuses if (apply && (GetTarget()->GetTypeId() != TYPEID_PLAYER || !((Player*)GetTarget())->GetSession()->PlayerLoading())) { if (Unit* caster = GetCaster()) { float DoneActualBenefit = 0.0f; switch (GetSpellProto()->SpellFamilyName) { case SPELLFAMILY_MAGE: if (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000008000)) { // Mana Shield // +50% from +spd bonus DoneActualBenefit = caster-><API key>(GetSpellSchoolMask(GetSpellProto())) * 0.5f; break; } break; default: break; } DoneActualBenefit *= caster-><API key>(GetSpellProto()); m_modifier.m_amount += (int32)DoneActualBenefit; } } } void Aura::<API key>(bool apply, bool Real) { if (!Real) return; Unit* target = GetTarget(); target->ApplyModFlag(UNIT_FIELD_FLAGS, <API key>, apply); if (apply) { // max regen powers at start preparation target->SetHealth(target->GetMaxHealth()); target->SetPower(POWER_MANA, target->GetMaxPower(POWER_MANA)); target->SetPower(POWER_ENERGY, target->GetMaxPower(POWER_ENERGY)); } else { // reset originally 0 powers at start/leave target->SetPower(POWER_RAGE, 0); } } void Aura::<API key>(bool apply, bool Real) { if (!Real) return; // Target of aura should always be creature (ref Spell::CheckCast) Creature* pCreature = (Creature*)GetTarget(); if (apply) { // Caster can be player or creature, the unit who pCreature will become an clone of. Unit* caster = GetCaster(); pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 0, caster->getRace()); pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 1, caster->getClass()); pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 2, caster->getGender()); pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 3, caster->getPowerType()); pCreature->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_CLONED); pCreature->SetDisplayId(caster->GetNativeDisplayId()); } else { const CreatureInfo* cinfo = pCreature->GetCreatureInfo(); const CreatureModelInfo* minfo = sObjectMgr.<API key>(pCreature->GetNativeDisplayId()); pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 0, 0); pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 1, cinfo->unit_class); pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender); pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 3, 0); pCreature->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_CLONED); pCreature->SetDisplayId(pCreature->GetNativeDisplayId()); } } void Aura::HandleAuraSafeFall(bool Apply, bool Real) { // implemented in WorldSession::<API key> // only special case if (Apply && Real && GetId() == 32474 && GetTarget()->GetTypeId() == TYPEID_PLAYER) ((Player*)GetTarget())->ActivateTaxiPathTo(506, GetId()); } bool Aura::IsLastAuraOnHolder() { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) if (i != GetEffIndex() && GetHolder()->m_auras[i]) return false; return true; } bool Aura::HasMechanic(uint32 mechanic) const { return GetSpellProto()->Mechanic == mechanic || GetSpellProto()->EffectMechanic[m_effIndex] == mechanic; } SpellAuraHolder::SpellAuraHolder(SpellEntry const* spellproto, Unit* target, WorldObject* caster, Item* castItem) : m_spellProto(spellproto), m_target(target), m_castItemGuid(castItem ? castItem->GetObjectGuid() : ObjectGuid()), m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1), m_timeCla(1000), m_removeMode(<API key>), m_AuraDRGroup(DIMINISHING_NONE), m_permanent(false), <API key>(true), m_deleted(false), m_in_use(0) { MANGOS_ASSERT(target); MANGOS_ASSERT(spellproto && spellproto == sSpellStore.LookupEntry(spellproto->Id) && "`info` must be pointer to sSpellStore element"); if (!caster) m_casterGuid = target->GetObjectGuid(); else { // remove this assert when not unit casters will be supported MANGOS_ASSERT(caster->isType(TYPEMASK_UNIT)) m_casterGuid = caster->GetObjectGuid(); } m_applyTime = time(NULL); m_isPassive = IsPassiveSpell(spellproto); m_isDeathPersist = <API key>(spellproto); m_trackedAuraType= IsSingleTargetSpell(spellproto) ? <API key> : <API key>; m_procCharges = spellproto->procCharges; <API key> = (GetCasterGuid() == m_target->GetObjectGuid() && m_spellProto->Stances && !m_spellProto->HasAttribute(<API key>) && !m_spellProto->HasAttribute(<API key>)); Unit* unitCaster = caster && caster->isType(TYPEMASK_UNIT) ? (Unit*)caster : NULL; m_duration = m_maxDuration = <API key>(spellproto, unitCaster); if (m_maxDuration == -1 || (m_isPassive && spellproto->DurationIndex == 0)) m_permanent = true; if (unitCaster) { if (Player* modOwner = unitCaster->GetSpellModOwner()) modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, m_procCharges); } // some custom stack values at aura holder create switch (m_spellProto->Id) { // some auras applied with max stack case 24575: // Brittle Armor case 24659: // Unstable Power case 24662: // Restless Strength case 26464: // Mercurial Shield m_stackAmount = m_spellProto->StackAmount; break; } for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) m_auras[i] = NULL; } void SpellAuraHolder::AddAura(Aura* aura, SpellEffectIndex index) { m_auras[index] = aura; } void SpellAuraHolder::RemoveAura(SpellEffectIndex index) { m_auras[index] = NULL; } void SpellAuraHolder::ApplyAuraModifiers(bool apply, bool real) { for (int32 i = 0; i < MAX_EFFECT_INDEX && !IsDeleted(); ++i) if (Aura* aur = <API key>(SpellEffectIndex(i))) aur->ApplyModifier(apply, real); } void SpellAuraHolder::_AddSpellAuraHolder() { if (!GetId()) return; if (!m_target) return; // Try find slot for aura uint8 slot = NULL_AURA_SLOT; Unit* caster = GetCaster(); // Lookup free slot // will be < MAX_AURAS slot (if find free) with !secondaura if (IsNeedVisibleSlot(caster)) { if (IsPositive()) // empty positive slot { for (uint8 i = 0; i < MAX_POSITIVE_AURAS; i++) { if (m_target->GetUInt32Value((uint16)(UNIT_FIELD_AURA + i)) == 0) { slot = i; break; } } } else // empty negative slot { for (uint8 i = MAX_POSITIVE_AURAS; i < MAX_AURAS; i++) { if (m_target->GetUInt32Value((uint16)(UNIT_FIELD_AURA + i)) == 0) { slot = i; break; } } } } // set infinity cooldown state for spells if (caster && caster->GetTypeId() == TYPEID_PLAYER) { if (m_spellProto->HasAttribute(<API key>)) { Item* castItem = m_castItemGuid ? ((Player*)caster)->GetItemByGuid(m_castItemGuid) : NULL; ((Player*)caster)-><API key>(m_spellProto, castItem ? castItem->GetEntry() : 0, NULL, true); } } SetAuraSlot(slot); // Not update fields for not first spell's aura, all data already in fields if (slot < MAX_AURAS) // slot found { SetAura(slot, false); SetAuraFlag(slot, true); SetAuraLevel(slot, caster ? caster->getLevel() : sWorld.getConfig(<API key>)); <API key>(); // update for out of range group members m_target->UpdateAuraForGroup(slot); UpdateAuraDuration(); }
# CMAKE generated file: DO NOT EDIT! # Generated by "Unix Makefiles" Generator, CMake Version 2.8 # The generator used is: SET(<API key> "Unix Makefiles") # The top level Makefile was generated from the following files: SET(<API key> "CMakeCache.txt" "/home/guillaume/tf-cadence/gnuradio/zedboard/<API key>.cmake" "../CMakeLists.txt" "../apps/CMakeLists.txt" "CMakeFiles/CMakeCCompiler.cmake" "CMakeFiles/CMakeCXXCompiler.cmake" "CMakeFiles/CMakeSystem.cmake" "../cmake/Modules/<API key>.cmake" "../cmake/Modules/FindCppUnit.cmake" "../cmake/Modules/FindGnuradioRuntime.cmake" "../cmake/Modules/GrMiscUtils.cmake" "../cmake/Modules/GrPlatform.cmake" "../cmake/Modules/GrPython.cmake" "../cmake/Modules/GrSwig.cmake" "../cmake/Modules/GrTest.cmake" "../cmake/cmake_uninstall.cmake.in" "../docs/CMakeLists.txt" "../grc/CMakeLists.txt" "../include/test1/CMakeLists.txt" "../lib/CMakeLists.txt" "../python/CMakeLists.txt" "../swig/CMakeLists.txt" "/usr/share/cmake-2.8/Modules/CMakeCCompiler.cmake.in" "/usr/share/cmake-2.8/Modules/CMakeCInformation.cmake" "/usr/share/cmake-2.8/Modules/CMakeCXXCompiler.cmake.in" "/usr/share/cmake-2.8/Modules/CMakeCXXInformation.cmake" "/usr/share/cmake-2.8/Modules/CMakeClDeps.cmake" "/usr/share/cmake-2.8/Modules/<API key>.cmake" "/usr/share/cmake-2.8/Modules/<API key>.cmake" "/usr/share/cmake-2.8/Modules/<API key>.cmake" "/usr/share/cmake-2.8/Modules/<API key>.cmake" "/usr/share/cmake-2.8/Modules/<API key>.cmake" "/usr/share/cmake-2.8/Modules/CMakeFindBinUtils.cmake" "/usr/share/cmake-2.8/Modules/CMakeFindFrameworks.cmake" "/usr/share/cmake-2.8/Modules/CMakeGenericSystem.cmake" "/usr/share/cmake-2.8/Modules/CMakeParseArguments.cmake" "/usr/share/cmake-2.8/Modules/CMakeSystem.cmake.in" "/usr/share/cmake-2.8/Modules/<API key>.cmake" "/usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake" "/usr/share/cmake-2.8/Modules/<API key>.cmake" "/usr/share/cmake-2.8/Modules/<API key>.cmake" "/usr/share/cmake-2.8/Modules/CMakeUnixFindMake.cmake" "/usr/share/cmake-2.8/Modules/Compiler/GNU-C.cmake" "/usr/share/cmake-2.8/Modules/Compiler/GNU-CXX.cmake" "/usr/share/cmake-2.8/Modules/Compiler/GNU.cmake" "/usr/share/cmake-2.8/Modules/FindBoost.cmake" "/usr/share/cmake-2.8/Modules/FindDoxygen.cmake" "/usr/share/cmake-2.8/Modules/<API key>.cmake" "/usr/share/cmake-2.8/Modules/FindPackageMessage.cmake" "/usr/share/cmake-2.8/Modules/FindPkgConfig.cmake" "/usr/share/cmake-2.8/Modules/FindPythonInterp.cmake" "/usr/share/cmake-2.8/Modules/FindPythonLibs.cmake" "/usr/share/cmake-2.8/Modules/FindSWIG.cmake" "/usr/share/cmake-2.8/Modules/Platform/Linux-GNU-C.cmake" "/usr/share/cmake-2.8/Modules/Platform/Linux-GNU-CXX.cmake" "/usr/share/cmake-2.8/Modules/Platform/Linux-GNU.cmake" "/usr/share/cmake-2.8/Modules/Platform/Linux.cmake" "/usr/share/cmake-2.8/Modules/Platform/UnixPaths.cmake" "/usr/share/cmake-2.8/Modules/<API key>.cmake" "/usr/share/cmake-2.8/Modules/UseSWIG.cmake" ) # The corresponding makefile is: SET(<API key> "Makefile" "CMakeFiles/cmake.check_cache" ) # Byproducts of CMake generate step: SET(<API key> "CMakeFiles/<API key>.cmake" "include/test1/CMakeFiles/<API key>.cmake" "lib/CMakeFiles/<API key>.cmake" "swig/CMakeFiles/<API key>.cmake" "python/CMakeFiles/<API key>.cmake" "grc/CMakeFiles/<API key>.cmake" "apps/CMakeFiles/<API key>.cmake" "docs/CMakeFiles/<API key>.cmake" ) # Dependency information for all targets: SET(<API key> "CMakeFiles/uninstall.dir/DependInfo.cmake" "lib/CMakeFiles/gnuradio-test1.dir/DependInfo.cmake" "lib/CMakeFiles/test-test1.dir/DependInfo.cmake" "swig/CMakeFiles/_test1_swig.dir/DependInfo.cmake" "swig/CMakeFiles/<API key>.dir/DependInfo.cmake" "swig/CMakeFiles/pygen_swig_104a7.dir/DependInfo.cmake" "python/CMakeFiles/pygen_python_30562.dir/DependInfo.cmake" "apps/CMakeFiles/pygen_apps_9a6dd.dir/DependInfo.cmake" )
<?php $<API key> = 'yes'; // Begin standart header $titre_page = "Saisie de commentaires-types"; // Initialisations files require_once("../lib/initialisations.inc.php"); // Resume session $resultat_session = $session_gepi->security_check(); if ($resultat_session == 'c') { header("Location: ../utilisateurs/mon_compte.php?change_mdp=yes"); die(); } else if ($resultat_session == '0') { header("Location: ../logout.php?auto=1"); die(); } // Check access // INSERT INTO droits VALUES ('/saisie/commentaires_types.php', 'V', 'V', 'V', 'V', 'F', 'F', 'V', 'Saisie de commentaires-types', ''); if (!checkAccess()) { header("Location: ../logout.php?auto=1"); die(); } // End standart header require_once("../lib/header.inc.php"); if (!loadSettings()) { die("Erreur chargement settings"); } $sql="CREATE TABLE IF NOT EXISTS `commentaires_types` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , `commentaire` TEXT NOT NULL , `num_periode` INT NOT NULL , `id_classe` INT NOT NULL ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;"; $<API key>=mysqli_query($GLOBALS["mysqli"], $sql); function get_classe_from_id($id){ //$sql="SELECT * FROM classes WHERE id='$id_classe[0]'"; $sql="SELECT * FROM classes WHERE id='$id'"; $resultat_classe=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($resultat_classe)!=1){ echo "<p>ERREUR! La classe d'identifiant '$id' n'a pas pu être identifiée.</p>"; } else{ $ligne_classe=mysqli_fetch_object($resultat_classe); $classe=$ligne_classe->classe; return $classe; } } ?> <p class="bold"><a href="../accueil.php">Retour</a> | <a href="commentaires_types.php">Saisir des commentaires</a> | <a href="commentaires_types.php?recopie=oui">Recopier des commentaires</a> </p> <?php if ((($_SESSION['statut']=='professeur') AND (getSettingValue("CommentairesTypesPP")=='yes') AND (mysqli_num_rows(mysqli_query($GLOBALS["mysqli"], "SELECT 1=1 FROM <API key> WHERE professeur='".$_SESSION['login']."'"))>0)) OR (($_SESSION['statut']=='scolarite') AND (getSettingValue("<API key>")=='yes')) OR (($_SESSION['statut']=='cpe') AND (getSettingValue("<API key>")=='yes')) ) { } else{ die("Droits insuffisants pour effectuer cette opération"); } ?> <form name="formulaire" action="commentaires_types.php" method="post"> <?php echo add_token_field(); //echo "\$_GET['recopie']=".$_GET['recopie']."<br />"; $recopie=isset($_GET['recopie']) ? $_GET['recopie'] : (isset($_POST['recopie']) ? $_POST['recopie'] : ""); //echo "\$recopie=$recopie<br />"; if($recopie!="oui"){ if(!isset($_POST['id_classe'])){ // Choix de la classe echo "<p>Pour quelle classe souhaitez-vous définir/modifier les commentaires-type?</p>\n"; echo "<blockquote>\n"; //$sql="select distinct id,classe from classes order by classe"; // if ((($_SESSION['statut']=='professeur') AND (getSettingValue("CommentairesTypesPP")=='yes') AND (mysql_num_rows(mysql_query("SELECT 1=1 FROM <API key> WHERE professeur='".$_SESSION['login']."'"))>0)) // OR (($_SESSION['statut']=='scolarite') AND (getSettingValue("<API key>")=='yes'))) if($_SESSION['statut']=='professeur'){ $sql="SELECT DISTINCT c.id,c.classe FROM j_eleves_classes jec, classes c, <API key> jep WHERE jec.id_classe=c.id AND jec.login=jep.login AND jep.professeur='".$_SESSION['login']."' ORDER BY c.classe"; } elseif($_SESSION['statut']=='scolarite'){ $sql="SELECT DISTINCT c.id,c.classe FROM j_scol_classes jsc, classes c WHERE jsc.id_classe=c.id AND jsc.login='".$_SESSION['login']."' ORDER BY c.classe"; } elseif(($_SESSION['statut']=='cpe')&&(getSettingAOui('GepiRubConseilCpe'))) { $sql="SELECT DISTINCT c.id,c.classe FROM j_eleves_cpe jecpe, j_eleves_classes jec, classes c WHERE jec.id_classe=c.id AND jec.login=jecpe.e_login AND jecpe.cpe_login='".$_SESSION['login']."' ORDER BY c.classe"; } elseif(($_SESSION['statut']=='cpe')&&(getSettingAOui('<API key>'))) { $sql="select distinct id,classe from classes order by classe"; } else { // CA NE DEVRAIT PAS ARRIVER... //$sql="select distinct id,classe from classes order by classe"; echo "<p>Statut incorrect.</p>\n"; die(); require("../lib/footer.inc.php"); } $resultat_classes=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($resultat_classes)==0){ echo "<p>Aucune classe n'est encore définie...</p>\n</form>\n</body>\n</html>\n"; exit(); } /* $cpt=0; while($ligne_classe=mysql_fetch_object($resultat_classes)){ if($cpt==0){ $checked="checked "; } else{ $checked=""; } //echo "<input type='radio' name='id_classe' value='$ligne_classe->id' $checked/> $ligne_classe->classe<br />\n"; echo "<input type='radio' name='id_classe' id='id_classe".$ligne_classe->id."' value='$ligne_classe->id' $checked/><label for='id_classe".$ligne_classe->id."' style='cursor: pointer;'> $ligne_classe->classe</label><br />\n"; $cpt++; } */ $nb_classes=mysqli_num_rows($resultat_classes); $<API key>=round($nb_classes/3); echo "<table width='100%'>\n"; echo "<tr valign='top' align='center'>\n"; $cpt=0; //echo "<td style='padding: 0 10px 0 10px'>\n"; echo "<td align='left'>\n"; while($ligne_classe=mysqli_fetch_object($resultat_classes)){ if(($cpt>0)&&(round($cpt/$<API key>)==$cpt/$<API key>)){ echo "</td>\n"; //echo "<td style='padding: 0 10px 0 10px'>\n"; echo "<td align='left'>\n"; } if($cpt==0){ $checked="checked "; } else{ $checked=""; } //echo "<input type='radio' name='id_classe' value='$ligne_classe->id' /> $ligne_classe->classe<br />\n"; echo "<input type='radio' name='id_classe' id='id_classe".$ligne_classe->id."' value='$ligne_classe->id' $checked/><label for='id_classe".$ligne_classe->id."' style='cursor: pointer;'> $ligne_classe->classe</label><br />\n"; $cpt++; } echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</blockquote>\n"; echo "<center><input type='submit' name='ok' value='Valider' /></center>\n"; } else{ if(!isset($_POST['num_periode'])){ $id_classe=$_POST['id_classe']; //echo "\$id_classe=$id_classe<br />\n"; echo "<h2>Saisie/Modification des commentaires-types pour la classe de ".get_classe_from_id($id_classe)."</h2>\n"; $sql="select * from periodes where id_classe='$id_classe' order by num_periode"; //echo "$sql<br />"; $<API key>=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($<API key>)==0){ echo "Aucune période n'est encore définie pour cette classe...<br />\n"; echo "</body>\n</html>\n"; exit(); } else{ echo "<p>Voici les commentaires-type actuellement saisis pour cette classe:</p>\n"; echo "<ul>\n"; while($ligne_periode=mysqli_fetch_object($<API key>)){ //for($i=0;$i<count($num_periode);$i++){ echo "<li>\n"; //$sql="select nom_periode from periodes where num_periode='$ligne_periode->num_periode'"; //$resultat_periode=mysql_query($sql); //$ligne_nom_periode=mysql_fetch_object($resultat_periode); //echo "<p><b>$ligne_nom_periode->nom_periode</b>:</p>\n"; echo "<p><b>$ligne_periode->nom_periode</b>:</p>\n"; // AFFICHER LES COMMENTAIRES-TYPE POUR CHAQUE PERIODE $sql="select * from commentaires_types where id_classe='$id_classe' and num_periode='$ligne_periode->num_periode' order by commentaire"; $<API key>=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($<API key>)>0){ echo "<ul>\n"; while($ligne_commentaires=mysqli_fetch_object($<API key>)){ echo "<li>".stripslashes(nl2br(trim($ligne_commentaires->commentaire)))."</li>\n"; } echo "</ul>\n"; } else{ echo "<p style='color:red;'>Aucun commentaire-type n'est saisi pour cette classe sur cette période.</p>\n"; } echo "</li>\n"; } echo "</ul>\n"; } echo "<p>Pour quelles périodes souhaitez-vous définir/modifier les commentaires-type?</p>\n"; //echo "<p>\n"; echo "<input type='hidden' name='id_classe' value='$id_classe' />\n"; $sql="select * from classes where id='$id_classe'"; $resultat_classe=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($resultat_classe)==0){ echo "<p>L'identifiant de la classe semble erroné.</p>\n</form>\n</body>\n</html>\n"; exit(); } $ligne_classe=mysqli_fetch_object($resultat_classe); $classe_courante="$ligne_classe->classe"; echo "<p><b>$classe_courante</b>: "; $sql="select * from periodes where id_classe='$id_classe' order by num_periode"; //echo "$sql<br />"; $<API key>=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($<API key>)==0){ echo "Aucune période n'est encore définie pour cette classe...<br />\n"; } else{ /* $ligne_num_periode=mysql_fetch_object($<API key>); $sql="select * from periodes where num_periode='$ligne_num_periode->num_periode'"; $resultat_periode=mysql_query($sql); $ligne_periode=mysql_fetch_object($resultat_periode); //echo "<input type='checkbox' name='num_periode[]' value='$ligne_periode->num_periode'> $ligne_periode->nom_periode\n"; echo "<input type='checkbox' name='num_periode[]' id='num_periode_".$ligne_periode->num_periode."' value='$ligne_periode->num_periode' /><label for='num_periode_".$ligne_periode->num_periode."' style='cursor: pointer;'> $ligne_periode->nom_periode</label>\n"; while($ligne_num_periode=mysql_fetch_object($<API key>)){ //$cpt++; $sql="select * from periodes where num_periode='$ligne_num_periode->num_periode'"; $resultat_periode=mysql_query($sql); $ligne_periode=mysql_fetch_object($resultat_periode); //echo " &nbsp;&nbsp;&nbsp;- <input type='checkbox' name='num_periode[]' value='$ligne_periode->num_periode'> $ligne_periode->nom_periode\n"; echo " &nbsp;&nbsp;&nbsp;- <input type='checkbox' name='num_periode[]' id='num_periode_".$ligne_periode->num_periode."' value='$ligne_periode->num_periode' /><label for='num_periode_".$ligne_periode->num_periode."' style='cursor: pointer;'> $ligne_periode->nom_periode</label>\n"; } */ $cpt_per=0; while($ligne_num_periode=mysqli_fetch_object($<API key>)){ if($cpt_per>0) {echo " &nbsp;&nbsp;&nbsp;- ";} echo "<input type='checkbox' name='num_periode[]' id='num_periode_".$ligne_num_periode->num_periode."' value='$ligne_num_periode->num_periode' /><label for='num_periode_".$ligne_num_periode->num_periode."' style='cursor: pointer;'> $ligne_num_periode->nom_periode</label>\n"; $cpt_per++; } echo "<br />\n"; } echo "</p>\n"; echo "<center><input type='submit' name='ok' value='Valider' /></center>\n"; } else { check_token(false); // Saisie, modification, suppression, validation des commentaires $id_classe=$_POST['id_classe']; $num_periode=$_POST['num_periode']; $suppr=isset($_POST['suppr']) ? $_POST['suppr'] : ""; /* $nom_log = "app_eleve_".$k."_".$i; //echo "\$nom_log=$nom_log<br />"; if (isset($NON_PROTECT[$nom_log])){ $app = <API key>(corriger_caracteres($NON_PROTECT[$nom_log])); } else{ $app = ""; } */ $<API key>=isset($_POST['<API key>']) ? $_POST['<API key>'] : NULL; //if(isset($_POST['commentaire_1'])){ if(isset($<API key>)){ //if(isset($_POST['commentaire'])){ //$commentaire=$_POST['commentaire']; //$commentaire=html_entity_decode($_POST['commentaire']); $sql="delete from commentaires_types where id_classe='$id_classe' and (num_periode='$num_periode[0]'"; for($i=1;$i<count($num_periode);$i++){ $sql=$sql." or num_periode='$num_periode[$i]'"; } $sql=$sql.")"; //echo "sql=$sql<br />"; $resultat_nettoyage=mysqli_query($GLOBALS["mysqli"], $sql); // Validation des saisies/modifs... //for($i=1;$i<=count($commentaire);$i++){ for($i=1;$i<=$<API key>;$i++){ //echo "\$suppr[$i]=$suppr[$i]<br />"; //if(($suppr[$i]=="")&&($commentaire[$i]!="")){ //if((!isset($suppr[$i]))&&($commentaire[$i]!="")){ if(!isset($suppr[$i])) { $nom_log = "commentaire_".$i; if (isset($NON_PROTECT[$nom_log])){ $commentaire_courant = <API key>(corriger_caracteres($NON_PROTECT[$nom_log])); if($commentaire_courant!=""){ for($j=0;$j<count($num_periode);$j++){ //$sql="insert into commentaires_types values('','$commentaire[$i]','$num_periode[$j]','$id_classe')"; // MODIF: boireaus 20071121 //$sql="insert into commentaires_types values('','".html_entity_decode($commentaire[$i])."','$num_periode[$j]','$id_classe')"; //$tmp_commentaire=my_ereg_replace("&#039;","'",html_entity_decode($commentaire[$i])); //$sql="insert into commentaires_types values('','".addslashes($tmp_commentaire)."','$num_periode[$j]','$id_classe')"; //$sql="insert into commentaires_types values('','".addslashes($commentaire_courant)."','$num_periode[$j]','$id_classe')"; $sql="insert into commentaires_types values('','".$commentaire_courant."','$num_periode[$j]','$id_classe')"; //echo "sql=$sql<br />"; $<API key>=mysqli_query($GLOBALS["mysqli"], $sql); } } } } } } echo "<input type='hidden' name='id_classe' value='$id_classe' />\n"; /* echo "$id_classe: "; for($i=0;$i<count($num_periode);$i++){ echo "$num_periode[$i] -"; } echo "<br />"; */ $sql="select * from classes where id='$id_classe'"; $resultat_classe=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($resultat_classe)==0){ echo "<p>L'identifiant de la classe semble erroné.</p>\n</form>\n</body>\n</html>\n"; exit(); } $ligne_classe=mysqli_fetch_object($resultat_classe); $classe_courante="$ligne_classe->classe"; //echo "<p><b>Classe de $classe_courante</b></p>\n"; echo "<h2>Classe de $classe_courante</h2>\n"; //$sql="select * from commentaires_types where id_classe='$id_classe' and (num_periode='$num_periode[0]'"; //$sql="select distinct commentaire,id from commentaires_types where id_classe='$id_classe' and (num_periode='$num_periode[0]'"; $sql="select distinct commentaire,id from commentaires_types where id_classe='$id_classe' and (num_periode='$num_periode[0]'"; echo "<input type='hidden' name='num_periode[0]' value='$num_periode[0]' />\n"; for($i=1;$i<count($num_periode);$i++){ $sql=$sql." or num_periode='$num_periode[$i]'"; echo "<input type='hidden' name='num_periode[$i]' value='$num_periode[$i]' />\n"; } //$sql=$sql.")"; $sql=$sql.") order by commentaire"; //echo "$sql"; $<API key>=mysqli_query($GLOBALS["mysqli"], $sql); $cpt=1; if(mysqli_num_rows($<API key>)!=0){ echo "<p>Voici la liste des commentaires-type existants pour la classe et la/les période(s) choisie(s):</p>\n"; echo "<blockquote>\n"; echo "<table class='boireaus' border='1'>\n"; echo "<tr style='text-align:center;'>\n"; echo "<th>Commentaire</th>\n"; echo "<th>Supprimer</th>\n"; echo "</tr>\n"; $<API key>=""; //$cpt=1; $alt=1; while($ligne_commentaire=mysqli_fetch_object($<API key>)){ if("$ligne_commentaire->commentaire"!="$<API key>"){ $alt=$alt*(-1); echo "<tr class='lig$alt' style='text-align:center;'>\n"; echo "<td>"; //echo "<textarea name='commentaire[$cpt]' cols='60'>".stripslashes($ligne_commentaire->commentaire)."</textarea>"; echo "<textarea name='<API key>".$cpt."' cols='60' onchange='changement()'>".stripslashes($ligne_commentaire->commentaire)."</textarea>"; echo "</td>\n"; echo "<td><input type='checkbox' name='suppr[$cpt]' value='$ligne_commentaire->id' /></td>\n"; echo "</tr>\n"; $cpt++; $<API key>="$ligne_commentaire->commentaire"; } } echo "</table>\n"; echo "</blockquote>\n"; } echo "<p>Saisie d'un nouveau commentaire:</p>"; echo "<blockquote>\n"; //echo "<textarea name='commentaire[$cpt]' cols='60'></textarea><br />\n"; echo "<textarea name='<API key>".$cpt."' id='<API key>".$cpt."' cols='60' onchange='changement()'></textarea><br />\n"; echo "<input type='hidden' name='<API key>' value='$cpt' />\n"; echo "<center><input type='submit' name='ok' value='Valider' /></center>\n"; echo "</blockquote>\n"; echo "<script type='text/javascript'> document.getElementById('<API key>".$cpt."').focus(); </script>\n"; } } } else{ // Recopie de commentaires-type echo "<input type='hidden' name='recopie' value='oui' />\n"; if(!isset($_POST['id_classe'])){ echo "<p>De quelle classe souhaitez-vous recopier les commentaires-type?</p>\n"; echo "<blockquote>\n"; $sql="select distinct id,classe from classes order by classe"; $resultat_classes=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($resultat_classes)==0){ echo "<p>Aucune classe n'est encore définie...</p>\n</form>\n</body>\n</html>\n"; exit(); } $nb_classes=mysqli_num_rows($resultat_classes); $<API key>=round($nb_classes/3); echo "<table width='100%'>\n"; echo "<tr valign='top' align='center'>\n"; $cpt=0; //echo "<td style='padding: 0 10px 0 10px'>\n"; echo "<td align='left'>\n"; while($ligne_classe=mysqli_fetch_object($resultat_classes)){ if(($cpt>0)&&(round($cpt/$<API key>)==$cpt/$<API key>)){ echo "</td>\n"; //echo "<td style='padding: 0 10px 0 10px'>\n"; echo "<td align='left'>\n"; } //echo "<input type='radio' name='id_classe' value='$ligne_classe->id' /> $ligne_classe->classe<br />\n"; echo "<input type='radio' name='id_classe' id='id_classe".$ligne_classe->id."' value='$ligne_classe->id' /><label for='id_classe".$ligne_classe->id."' style='cursor: pointer;'> $ligne_classe->classe</label><br />\n"; $cpt++; } echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</blockquote>\n"; echo "<center><input type='submit' name='ok' value='Valider' /></center>\n"; } else{ $id_classe=$_POST['id_classe']; echo "<h2>Recopie de commentaires-types</h2>\n"; /* echo "<p>Voici les commentaires-type saisis pour cette classe:</p>\n"; echo "<ul>\n"; for($i=0;$i<count($num_periode);$i++){ echo "<li>\n"; $sql="select nom_periode from periodes where num_periode='$num_periode[$i]'"; $resultat_periode=mysql_query($sql); $ligne_nom_periode=mysql_fetch_object($resultat_periode); echo "<p><b>$ligne_nom_periode->nom_periode</b>:</p>\n"; echo "<input type='hidden' name='num_periode[$i]' value='$num_periode[$i]'>\n"; // AFFICHER LES COMMENTAIRES-TYPE POUR CHAQUE PERIODE $sql="select * from commentaires_types where id_classe='$id_classe' and num_periode='$num_periode[$i]' order by commentaire"; $<API key>=mysql_query($sql); echo "<ul>\n"; while($ligne_commentaires=mysql_fetch_object($<API key>)){ echo "<li>".stripslashes(nl2br(trim($ligne_commentaires->commentaire)))."</li>\n"; } echo "</ul>\n"; echo "</li>\n"; } echo "</ul>\n"; */ echo "<input type='hidden' name='id_classe' value='$id_classe' />\n"; $sql="select * from classes where id='$id_classe'"; $resultat_classe=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($resultat_classe)==0){ echo "<p>L'identifiant de la classe semble erroné.</p>\n</form>\n</body>\n</html>\n"; exit(); } $ligne_classe=mysqli_fetch_object($resultat_classe); $classe_source="$ligne_classe->classe"; echo "<p><b>Classe modèle:</b> $classe_source</p>\n"; if(!isset($_POST['num_periode'])){ $sql="select * from periodes where id_classe='$id_classe' order by num_periode"; //echo "$sql<br />"; $<API key>=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($<API key>)==0){ echo "Aucune période n'est encore définie pour cette classe...<br />\n"; echo "</body>\n</html>\n"; exit(); } else{ $<API key>=0; echo "<p>Voici les commentaires-type saisis pour cette classe:</p>\n"; echo "<ul>\n"; while($ligne_periode=mysqli_fetch_object($<API key>)){ //for($i=0;$i<count($num_periode);$i++){ echo "<li>\n"; //$sql="select nom_periode from periodes where num_periode='$ligne_periode->num_periode'"; //$resultat_periode=mysql_query($sql); //$ligne_nom_periode=mysql_fetch_object($resultat_periode); //echo "<p><b>$ligne_nom_periode->nom_periode</b>:</p>\n"; echo "<p><b>$ligne_periode->nom_periode</b>:</p>\n"; // AFFICHER LES COMMENTAIRES-TYPE POUR CHAQUE PERIODE $sql="select * from commentaires_types where id_classe='$id_classe' and num_periode='$ligne_periode->num_periode' order by commentaire"; $<API key>=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($<API key>)>0){ echo "<ul>\n"; while($ligne_commentaires=mysqli_fetch_object($<API key>)){ echo "<li>".stripslashes(nl2br(trim($ligne_commentaires->commentaire)))."</li>\n"; $<API key>++; } echo "</ul>\n"; } else{ echo "<p style='color:red;'>Aucun commentaire-type n'est saisi pour cette classe sur cette période.</p>\n"; //echo "</body>\n</html>\n"; //exit(); } echo "</li>\n"; } echo "</ul>\n"; if($<API key>==0){ echo "</body>\n</html>\n"; exit(); } } echo "<p>Pour quelles périodes souhaitez-vous recopier les commentaires-type?</p>\n"; //echo "<p>\n"; //echo "<input type='hidden' name='id_classe' value='$id_classe'>\n"; //echo "<p><b>$classe_source</b>: "; $sql="select * from periodes where id_classe='$id_classe' order by num_periode"; //echo "$sql<br />"; $<API key>=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($<API key>)==0){ echo "<p>Aucune période n'est encore définie pour cette classe...</p>\n"; } else{ /* $ligne_num_periode=mysql_fetch_object($<API key>); $sql="select * from periodes where num_periode='$ligne_num_periode->num_periode'"; $resultat_periode=mysql_query($sql); $ligne_periode=mysql_fetch_object($resultat_periode); //echo "<input type='checkbox' name='num_periode[]' value='$ligne_periode->num_periode'> $ligne_periode->nom_periode\n"; echo "<input type='checkbox' name='num_periode[]' id='num_periode_".$ligne_periode->num_periode."' value='$ligne_periode->num_periode' /><label for='num_periode_".$ligne_periode->num_periode."' style='cursor: pointer;'> $ligne_periode->nom_periode</label>\n"; while($ligne_num_periode=mysql_fetch_object($<API key>)){ //$cpt++; $sql="select * from periodes where num_periode='$ligne_num_periode->num_periode'"; $resultat_periode=mysql_query($sql); $ligne_periode=mysql_fetch_object($resultat_periode); //echo " &nbsp;&nbsp;&nbsp;- <input type='checkbox' name='num_periode[]' value='$ligne_periode->num_periode'> $ligne_periode->nom_periode\n"; echo " &nbsp;&nbsp;&nbsp;- <input type='checkbox' name='num_periode[]' id='num_periode_".$ligne_periode->num_periode."' value='$ligne_periode->num_periode' /><label for='num_periode_".$ligne_periode->num_periode."' style='cursor: pointer;'> $ligne_periode->nom_periode</label>\n"; } */ $cpt_per=0; while($ligne_num_periode=mysqli_fetch_object($<API key>)){ if($cpt_per>0) {echo " &nbsp;&nbsp;&nbsp;- ";} echo "<input type='checkbox' name='num_periode[]' id='num_periode_".$ligne_num_periode->num_periode."' value='$ligne_num_periode->num_periode' /><label for='num_periode_".$ligne_num_periode->num_periode."' style='cursor: pointer;'> $ligne_num_periode->nom_periode</label>\n"; $cpt_per++; } echo "<br />\n"; echo "<center><input type='submit' name='ok' value='Valider' /></center>\n"; } //echo "</p>\n"; //echo "<input type='submit' name='ok' value='Valider'>\n"; } else{ $num_periode=$_POST['num_periode']; /* echo "<p>Voici les commentaires-type saisis pour cette classe:</p>\n"; echo "<ul>\n"; for($i=0;$i<count($num_periode);$i++){ echo "<li>\n"; $sql="select nom_periode from periodes where num_periode='$num_periode[$i]'"; $resultat_periode=mysql_query($sql); $ligne_nom_periode=mysql_fetch_object($resultat_periode); echo "<p><b>$ligne_nom_periode->nom_periode</b>:</p>\n"; echo "<input type='hidden' name='num_periode[$i]' value='$num_periode[$i]'>\n"; // AFFICHER LES COMMENTAIRES-TYPE POUR CHAQUE PERIODE $sql="select * from commentaires_types where id_classe='$id_classe' and num_periode='$num_periode[$i]' order by commentaire"; $<API key>=mysql_query($sql); echo "<ul>\n"; while($ligne_commentaires=mysql_fetch_object($<API key>)){ echo "<li>".stripslashes(nl2br(trim($ligne_commentaires->commentaire)))."</li>\n"; } echo "</ul>\n"; echo "</li>\n"; } echo "</ul>\n"; */ if(!isset($_POST['id_dest_classe'])){ // Choix des classes vers lesquelles la recopie doit se faire echo "<p>Voici les commentaires-type saisis pour cette classe et les périodes choisies:</p>\n"; echo "<ul>\n"; for($i=0;$i<count($num_periode);$i++){ echo "<li>\n"; $sql="select nom_periode from periodes where num_periode='$num_periode[$i]'"; $resultat_periode=mysqli_query($GLOBALS["mysqli"], $sql); $ligne_nom_periode=mysqli_fetch_object($resultat_periode); echo "<p><b>$ligne_nom_periode->nom_periode</b>:</p>\n"; echo "<input type='hidden' name='num_periode[$i]' value='$num_periode[$i]' />\n"; // AFFICHER LES COMMENTAIRES-TYPE POUR CHAQUE PERIODE $sql="select * from commentaires_types where id_classe='$id_classe' and num_periode='$num_periode[$i]' order by commentaire"; $<API key>=mysqli_query($GLOBALS["mysqli"], $sql); echo "<ul>\n"; while($ligne_commentaires=mysqli_fetch_object($<API key>)){ echo "<li>".stripslashes(nl2br(trim($ligne_commentaires->commentaire)))."</li>\n"; } echo "</ul>\n"; echo "</li>\n"; } echo "</ul>\n"; echo "<p>Pour quelles classes souhaitez-vous supprimer les commentaires-type existant et les remplacer par ceux de $classe_source?</p>\n"; // AJOUTER UN JavaScript POUR 'Tout cocher' //$sql="select distinct id,classe from classes order by classe"; if($_SESSION['statut']=='professeur'){ $sql="SELECT DISTINCT c.id,c.classe FROM j_eleves_classes jec, classes c, <API key> jep WHERE jec.id_classe=c.id AND jec.login=jep.login AND jep.professeur='".$_SESSION['login']."' ORDER BY c.classe"; } elseif($_SESSION['statut']=='scolarite'){ $sql="SELECT DISTINCT c.id,c.classe FROM j_scol_classes jsc, classes c WHERE jsc.id_classe=c.id AND jsc.login='".$_SESSION['login']."' ORDER BY c.classe"; } else{ // CA NE DEVRAIT PAS ARRIVER... $sql="select distinct id,classe from classes order by classe"; } $resultat_classes=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($resultat_classes)==0){ echo "<p>Aucune classe n'est encore définie...</p>\n</form>\n</body>\n</html>\n"; exit(); } $cpt=0; while($ligne_classe=mysqli_fetch_object($resultat_classes)){ if("$ligne_classe->id"!="$id_classe"){ echo "<label for='id_dest_classe$cpt' style='cursor: pointer;'><input type='checkbox' name='id_dest_classe[]' id='id_dest_classe$cpt' value='$ligne_classe->id' /> $ligne_classe->classe</label><br />\n"; $cpt++; } } //echo "</blockquote>\n"; echo "<!--script language='JavaScript' <script language='JavaScript' type='text/javascript'> function tout_cocher(){ for(i=0;i<$cpt;i++){ document.getElementById('id_dest_classe'+i).checked=true; } } function tout_decocher(){ for(i=0;i<$cpt;i++){ document.getElementById('id_dest_classe'+i).checked=false; } } </script> "; echo "<input type='button' name='toutcocher' value='Tout cocher' onClick='tout_cocher();' /> - \n"; echo "<input type='button' name='toutdecocher' value='Tout décocher' onClick='tout_decocher();' />\n"; echo "<center><input type='submit' name='ok' value='Valider' /></center>\n"; } else { check_token(false); // Recopie proprement dite $id_dest_classe=$_POST['id_dest_classe']; //echo count($num_periode)."<br />"; //flush(); for($i=0;$i<count($id_dest_classe);$i++){ $sql="delete from commentaires_types where id_classe='$id_dest_classe[$i]' and (num_periode='$num_periode[0]'"; //for($i=0;$i<count($num_periode);$i++){ for($j=1;$j<count($num_periode);$j++){ $sql=$sql." or num_periode='$num_periode[$j]'"; } $sql=$sql.")"; //echo "sql=$sql<br />"; $resultat_nettoyage=mysqli_query($GLOBALS["mysqli"], $sql); } for($i=0;$i<count($num_periode);$i++){ $sql="select nom_periode from periodes where num_periode='$num_periode[$i]'"; $resultat_periode=mysqli_query($GLOBALS["mysqli"], $sql); $ligne_nom_periode=mysqli_fetch_object($resultat_periode); echo "<p><b>$ligne_nom_periode->nom_periode</b>:</p>\n"; echo "<blockquote>\n"; $sql="select commentaire from commentaires_types where id_classe='$id_classe' and num_periode='$num_periode[$i]' order by commentaire"; //echo "sql=$sql<br />"; $<API key>=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($<API key>)==0){ echo "<p>C'est malin... il n'existe pas de commentaires-type pour la classe modèle et la période choisie.<br />\nDe plus, les commentaires existants pour les classes destination ont été supprimés...</p>\n"; } else{ while($<API key>=mysqli_fetch_object($<API key>)){ echo "<table>\n"; for($j=0;$j<count($id_dest_classe);$j++){ $sql="select classe from classes where id='$id_dest_classe[$j]'"; $<API key>=mysqli_query($GLOBALS["mysqli"], $sql); $ligne_classe_dest=mysqli_fetch_object($<API key>); //echo "<b>Insertion pour $ligne_classe_dest->classe:</b><br /> ".stripslashes(nl2br(trim($<API key>->commentaire)))."<br />\n"; echo "<tr valign=\"top\"><td><b>Insertion pour $ligne_classe_dest->classe:</b></td><td> ".stripslashes(nl2br(trim($<API key>->commentaire)))."</td></tr>\n"; //$sql="insert into commentaires_types values('','$<API key>->commentaire','$num_periode[$i]','$id_dest_classe[$j]')"; $commentaire_courant=<API key>(corriger_caracteres($<API key>->commentaire)); $sql="insert into commentaires_types values('','$commentaire_courant','$num_periode[$i]','$id_dest_classe[$j]')"; //echo "sql=$sql<br />"; $<API key>=mysqli_query($GLOBALS["mysqli"], $sql); } echo "</table>\n"; } echo "<p>Insertions terminées pour la période.</p>\n"; } echo "</blockquote>\n"; } /* // Validation des saisies/modifs... for($i=1;$i<=count($commentaire);$i++){ echo "\$suppr[$i]=$suppr[$i]<br />"; if(($suppr[$i]=="")&&($commentaire[$i]!="")){ for($j=0;$j<count($num_periode);$j++){ $sql="insert into commentaires_types values('','$commentaire[$i]','$num_periode[$j]','$id_classe')"; echo "sql=$sql<br />"; $<API key>=mysql_query($sql); } } } */ } } } } ?> </form> <p><br /></p> <?php require("../lib/footer.inc.php"); ?>
# Makefile.in generated by automake 1.13.3 from Makefile.am. # Makefile. Generated from Makefile.in by configure. # This Makefile.in is free software; the Free Software Foundation # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # PARTICULAR PURPOSE. am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' <API key> = \ case $${target_option-} in \ ?) ;; \ *) echo "<API key>: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]* esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(<API key>)) am__make_keepgoing = (target_option=k; $(<API key>)) pkgincludedir = $(includedir)/libtool pkglibdir = $(libdir)/libtool pkglibexecdir = $(libexecdir)/libtool am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(<API key>) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = i686-pc-linux-gnu host_triplet = i686-pc-linux-gnu DIST_COMMON = $(srcdir)/libltdl/Makefile.inc INSTALL NEWS README \ AUTHORS ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ $(srcdir)/config-h.in $(top_srcdir)/libltdl/lt__dirent.c \ $(top_srcdir)/libltdl/argz.c $(top_srcdir)/libltdl/lt__strl.c \ $(top_srcdir)/libltdl/config/depcomp $(<API key>) \ $(top_srcdir)/libltdl/config/mdate-sh \ $(srcdir)/doc/version.texi $(srcdir)/doc/stamp-vti \ $(top_srcdir)/libltdl/config/texinfo.tex $(dist_man1_MANS) \ $(<API key>) $(<API key>) \ $(top_srcdir)/libltdl/config/test-driver COPYING THANKS TODO \ libltdl/config/compile libltdl/config/config.guess \ libltdl/config/config.sub libltdl/config/depcomp \ libltdl/config/install-sh libltdl/config/mdate-sh \ libltdl/config/missing libltdl/config/texinfo.tex \ libltdl/config/ltmain.sh $(top_srcdir)/libltdl/config/compile \ $(top_srcdir)/libltdl/config/config.guess \ $(top_srcdir)/libltdl/config/config.sub \ $(top_srcdir)/libltdl/config/install-sh \ $(top_srcdir)/libltdl/config/ltmain.sh \ $(top_srcdir)/libltdl/config/missing am__append_1 = libltdl/ltdl.h am__append_2 = libltdl/libltdl.la #am__append_3 = libltdl/libltdlc.la am__append_4 = $(CXX_TESTS) # f77demo-static-exec.test might be interactive on MSYS. am__append_5 = $(F77_TESTS) am__append_6 = $(FC_TESTS) subdir = . SUBDIRS = ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/libltdl/m4/argz.m4 \ $(top_srcdir)/libltdl/m4/autobuild.m4 \ $(top_srcdir)/libltdl/m4/libtool.m4 \ $(top_srcdir)/libltdl/m4/ltdl.m4 \ $(top_srcdir)/libltdl/m4/ltoptions.m4 \ $(top_srcdir)/libltdl/m4/ltsugar.m4 \ $(top_srcdir)/libltdl/m4/ltversion.m4 \ $(top_srcdir)/libltdl/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(<API key>) \ $(ACLOCAL_M4) <API key> = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = <API key> = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 <API key> = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(<API key>); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' <API key> = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(includedir)" "$(DESTDIR)$(ltdlincludedir)" LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) <API key> = am__dirstamp = $(am__leading_dot)dirstamp <API key> = libltdl/loaders/dld_link.lo <API key> = $(<API key>) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(<API key>)) am__v_lt_0 = --silent am__v_lt_1 = <API key> = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(<API key>) \ $(LDFLAGS) -o $@ am__DEPENDENCIES_1 = <API key> = $(am__DEPENDENCIES_1) <API key> = libltdl/loaders/dlopen.lo <API key> = $(<API key>) <API key> = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(<API key>) $(LDFLAGS) \ -o $@ <API key> = <API key> = libltdl/loaders/dyld.lo <API key> = $(<API key>) <API key> = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(<API key>) $(LDFLAGS) \ -o $@ LIBOBJDIR = libltdl/ <API key> = \ libltdl/loaders/<API key>.lo \ libltdl/<API key>.lo \ libltdl/<API key>.lo \ libltdl/<API key>.lo \ libltdl/<API key>.lo \ libltdl/<API key>.lo <API key> = $(<API key>) <API key> = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(<API key>) \ $(LDFLAGS) -o $@ <API key> = -rpath $(libdir) am__objects_1 = libltdl/loaders/<API key>.lo \ libltdl/<API key>.lo \ libltdl/<API key>.lo \ libltdl/<API key>.lo \ libltdl/<API key>.lo \ libltdl/<API key>.lo <API key> = $(am__objects_1) <API key> = $(<API key>) <API key> = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(<API key>) \ $(LDFLAGS) -o $@ #<API key> = <API key> = <API key> = libltdl/loaders/load_add_on.lo <API key> = $(<API key>) <API key> = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(<API key>) \ $(LDFLAGS) -o $@ <API key> = <API key> = libltdl/loaders/loadlibrary.lo <API key> = $(<API key>) <API key> = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(<API key>) \ $(LDFLAGS) -o $@ <API key> = $(am__DEPENDENCIES_1) <API key> = libltdl/loaders/shl_load.lo <API key> = $(<API key>) <API key> = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(<API key>) \ $(LDFLAGS) -o $@ SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_$(V)) am__v_P_ = $(am__v_P_$(<API key>)) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(<API key>)) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(<API key>)) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I. depcomp = $(SHELL) $(top_srcdir)/libltdl/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(<API key>)) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(<API key>)) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(<API key>) $(<API key>) \ $(<API key>) $(<API key>) \ $(<API key>) \ $(<API key>) \ $(<API key>) \ $(<API key>) DIST_SOURCES = $(<API key>) \ $(<API key>) $(<API key>) \ $(<API key>) $(<API key>) \ $(<API key>) \ $(<API key>) \ $(<API key>) AM_V_DVIPS = $(am__v_DVIPS_$(V)) am__v_DVIPS_ = $(am__v_DVIPS_$(<API key>)) am__v_DVIPS_0 = @echo " DVIPS " $@; am__v_DVIPS_1 = AM_V_MAKEINFO = $(am__v_MAKEINFO_$(V)) am__v_MAKEINFO_ = $(am__v_MAKEINFO_$(<API key>)) am__v_MAKEINFO_0 = @echo " MAKEINFO" $@; am__v_MAKEINFO_1 = AM_V_INFOHTML = $(am__v_INFOHTML_$(V)) am__v_INFOHTML_ = $(am__v_INFOHTML_$(<API key>)) am__v_INFOHTML_0 = @echo " INFOHTML" $@; am__v_INFOHTML_1 = AM_V_TEXI2DVI = $(am__v_TEXI2DVI_$(V)) am__v_TEXI2DVI_ = $(am__v_TEXI2DVI_$(<API key>)) am__v_TEXI2DVI_0 = @echo " TEXI2DVI" $@; am__v_TEXI2DVI_1 = AM_V_TEXI2PDF = $(am__v_TEXI2PDF_$(V)) am__v_TEXI2PDF_ = $(am__v_TEXI2PDF_$(<API key>)) am__v_TEXI2PDF_0 = @echo " TEXI2PDF" $@; am__v_TEXI2PDF_1 = AM_V_texinfo = $(am__v_texinfo_$(V)) am__v_texinfo_ = $(am__v_texinfo_$(<API key>)) am__v_texinfo_0 = -q am__v_texinfo_1 = AM_V_texidevnull = $(am__v_texidevnull_$(V)) am__v_texidevnull_ = $(am__v_texidevnull_$(<API key>)) am__v_texidevnull_0 = > /dev/null am__v_texidevnull_1 = INFO_DEPS = $(srcdir)/doc/libtool.info TEXINFO_TEX = $(top_srcdir)/libltdl/config/texinfo.tex am__TEXINFO_TEX_DIR = $(top_srcdir)/libltdl/config DVIS = doc/libtool.dvi PDFS = doc/libtool.pdf PSS = doc/libtool.ps HTMLS = doc/libtool.html TEXINFOS = doc/libtool.texi TEXI2DVI = texi2dvi TEXI2PDF = $(TEXI2DVI) --pdf --batch MAKEINFOHTML = $(MAKEINFO) --html <API key> = $(AM_MAKEINFOFLAGS) DVIPS = dvips RECURSIVE_TARGETS = all-recursive check-recursive <API key> \ ctags-recursive dvi-recursive html-recursive info-recursive \ <API key> <API key> \ <API key> <API key> \ <API key> <API key> \ <API key> install-recursive <API key> \ <API key> pdf-recursive ps-recursive \ tags-recursive uninstall-recursive <API key> = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac man1dir = $(mandir)/man1 NROFF = nroff MANS = $(dist_man1_MANS) <API key> = libltdl/ltdl.h <API key> = libltdl/libltdl/lt_system.h \ libltdl/libltdl/lt_error.h libltdl/libltdl/lt_dlloader.h HEADERS = $(include_HEADERS) $(ltdlinclude_HEADERS) <API key> = <API key> clean-recursive \ distclean-recursive <API key> <API key> = \ $(RECURSIVE_TARGETS) \ $(<API key>) \ $(<API key>) <API key> = $(<API key>:-recursive=) TAGS CTAGS \ cscope check recheck distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config-h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. <API key> = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope <API key> = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(<API key>); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* <API key> = ^[ ]*:global-test-result:[ ]* <API key> = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". <API key> = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. <API key> = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(<API key>)/) \ { \ sub("$(<API key>)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(<API key>)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. <API key> = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$<API key>" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup <API key> (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ <API key>=no; \ else \ <API key>=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(<API key>) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also '<API key>.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = .test am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/libltdl/config/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$ esac;; \ *) \ b='$*';; \ esac DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi <API key> = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done <API key>: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(<API key>) mostlyclean-compile: -rm -f *.$(OBJEXT) $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ fi; \ rm -rf $$backupdir; exit $$rc doc/libtool.dvi: doc/libtool.texi $(srcdir)/doc/version.texi $(<API key>) doc/$(am__dirstamp) $(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ $(TEXI2DVI) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@ $(AM_V_texidevnull) \ `test -f 'doc/libtool.texi' || echo '$(srcdir)/'`doc/libtool.texi doc/libtool.pdf: doc/libtool.texi $(srcdir)/doc/version.texi $(<API key>) doc/$(am__dirstamp) $(AM_V_TEXI2PDF)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ $(TEXI2PDF) $(AM_V_texinfo) --build-dir=$(@:.pdf=.t2p) -o $@ $(AM_V_texidevnull) \ `test -f 'doc/libtool.texi' || echo '$(srcdir)/'`doc/libtool.texi doc/libtool.html: doc/libtool.texi $(srcdir)/doc/version.texi $(<API key>) doc/$(am__dirstamp) $(AM_V_MAKEINFO)rm -rf $(@:.html=.htp) $(AM_V_at)if $(MAKEINFOHTML) $(<API key>) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \ -o $(@:.html=.htp) `test -f 'doc/libtool.texi' || echo '$(srcdir)/'`doc/libtool.texi; \ then \ rm -rf $@; \ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ else \ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ exit 1; \ fi $(srcdir)/doc/version.texi: $(srcdir)/doc/stamp-vti $(srcdir)/doc/stamp-vti: doc/libtool.texi $(top_srcdir)/configure test -f doc/$(am__dirstamp) || $(MAKE) $(AM_MAKEFLAGS) doc/$(am__dirstamp) @(dir=.; test -f ./doc/libtool.texi || dir=$(srcdir); \ set `$(SHELL) $(top_srcdir)/libltdl/config/mdate-sh $$dir/doc/libtool.texi`; \ echo "@set UPDATED $$1 $$2 $$3"; \ echo "@set UPDATED-MONTH $$2 $$3"; \ echo "@set EDITION $(VERSION)"; \ echo "@set VERSION $(VERSION)") > vti.tmp @cmp -s vti.tmp $(srcdir)/doc/version.texi \ || (echo "Updating $(srcdir)/doc/version.texi"; \ cp vti.tmp $(srcdir)/doc/version.texi) -@rm -f vti.tmp @cp $(srcdir)/doc/version.texi $@ mostlyclean-vti: -rm -f vti.tmp <API key>: -rm -f $(srcdir)/doc/stamp-vti $(srcdir)/doc/version.texi .dvi.ps: $(AM_V_DVIPS)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ $(DVIPS) $(AM_V_texinfo) -o $@ $< uninstall-dvi-am: @$(NORMAL_UNINSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ rm -f "$(DESTDIR)$(dvidir)/$$f"; \ done uninstall-html-am: @$(NORMAL_UNINSTALL) @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ done uninstall-info-am: @$(PRE_UNINSTALL) @if test -d '$(DESTDIR)$(infodir)' && $(<API key>); then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \ done; \ else :; fi @$(NORMAL_UNINSTALL) @list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ else :; fi); \ done uninstall-pdf-am: @$(NORMAL_UNINSTALL) @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ done uninstall-ps-am: @$(NORMAL_UNINSTALL) @list='$(PSS)'; test -n "$(psdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ rm -f "$(DESTDIR)$(psdir)/$$f"; \ done dist-info: $(INFO_DEPS) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; \ for base in $$list; do \ case $$base in \ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$base; then d=.; else d=$(srcdir); fi; \ base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ if test -f $$file; then \ relfile=`expr "$$file" : "$$d/\(.*\)"`; \ test -f "$(distdir)/$$relfile" || \ cp -p $$file "$(distdir)/$$relfile"; \ else :; fi; \ done; \ done mostlyclean-aminfo: -rm -rf doc/libtool.t2d doc/libtool.t2p clean-aminfo: -test -z "doc/libtool.dvi doc/libtool.pdf doc/libtool.ps doc/libtool.html" \ || rm -rf doc/libtool.dvi doc/libtool.pdf doc/libtool.ps doc/libtool.html <API key>: @list='$(INFO_DEPS)'; for i in $$list; do \ i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ done install-man1: $(dist_man1_MANS) @$(NORMAL_INSTALL) @list1='$(dist_man1_MANS)'; \ list2=''; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(<API key>) <API key>: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done <API key>: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(<API key>) <API key>: $(ltdlinclude_HEADERS) @$(NORMAL_INSTALL) @list='$(ltdlinclude_HEADERS)'; test -n "$(ltdlincludedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(ltdlincludedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(ltdlincludedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(ltdlincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(ltdlincludedir)" || exit $$?; \ done <API key>: @$(NORMAL_UNINSTALL) @list='$(ltdlinclude_HEADERS)'; test -n "$(ltdlincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(ltdlincludedir)'; $(<API key>) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(<API key>): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(<API key>); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(<API key>); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(<API key>); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: <API key> cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ else \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ <API key> () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ <API key> --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(<API key>); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ <API key> --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(<API key>)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(<API key>) $(<API key>) $(<API key>) -- $(TEST_LOG_COMPILE) \ "$$tst" $(<API key>) #.test$(EXEEXT).log: # $(am__set_b); \ # $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ # --log-file $$b.log --trs-file $$b.trs \ # $(<API key>) $(<API key>) $(<API key>) -- $(TEST_LOG_COMPILE) \ # "$$tst" $(<API key>) distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: <API key>=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ <API key>=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-info dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(<API key>) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(<API key>) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(<API key>) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(<API key>) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(<API key>) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(<API key>) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(<API key>) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) <API key>='@:' $(<API key>) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(<API key>) \ $(<API key>) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) <API key>="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ <API key>="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(<API key>) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(<API key>)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(<API key>)' >&2; \ exit 1; \ }; \ $(am__cd) '$(<API key>)' || { \ echo 'ERROR: cannot chdir into $(<API key>)' >&2; \ exit 1; \ }; \ test `$(<API key>) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(<API key>) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(<API key>) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(<API key>) ; \ exit 1; } >&2 check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(INFO_DEPS) $(LTLIBRARIES) $(SCRIPTS) $(MANS) \ $(HEADERS) config.h all-local installdirs: <API key> installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(ltdlincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: <API key> install-data: <API key> uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: <API key> install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(<API key>)" \ install_sh_PROGRAM="$(<API key>)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(<API key>)" \ install_sh_PROGRAM="$(<API key>)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(LIBOBJS)" || rm -f $(LIBOBJS) -test -z "$(LTLIBOBJS)" || rm -f $(LTLIBOBJS) -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(<API key>)" || rm -f $(<API key>) -rm -f doc/$(am__dirstamp) -rm -f libltdl/$(DEPDIR)/$(am__dirstamp) -rm -f libltdl/$(am__dirstamp) -rm -f libltdl/loaders/$(DEPDIR)/$(am__dirstamp) -rm -f libltdl/loaders/$(am__dirstamp) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) <API key>: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(<API key>)" || rm -f $(<API key>) clean: clean-recursive clean-am: clean-aminfo clean-generic <API key> \ clean-libtool clean-local <API key> \ mostlyclean-am distclean: distclean-recursive -rm -f $(<API key>) -rm -rf libltdl/$(DEPDIR) libltdl/loaders/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: $(DVIS) html: html-recursive html-am: $(HTMLS) info: info-recursive info-am: $(INFO_DEPS) install-data-am: install-data-local <API key> \ install-info-am <API key> install-man install-dvi: <API key> install-dvi-am: $(DVIS) @$(NORMAL_INSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ done install-exec-am: install-binSCRIPTS <API key> install-html: <API key> install-html-am: $(HTMLS) @$(NORMAL_INSTALL) @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ $(am__strip_dir) \ d2=$$d$$p; \ if test -d "$$d2"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ if test -f $$ifile; then \ echo "$$ifile"; \ else : ; fi; \ done; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done @$(POST_INSTALL) @if $(<API key>); then \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ done; \ else : ; fi install-man: install-man1 install-pdf: <API key> install-pdf-am: $(PDFS) @$(NORMAL_INSTALL) @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done install-ps: <API key> install-ps-am: $(PSS) @$(NORMAL_INSTALL) @list='$(PSS)'; test -n "$(psdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done installcheck-am: installcheck-local maintainer-clean: <API key> -rm -f $(<API key>) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf libltdl/$(DEPDIR) libltdl/loaders/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am <API key> \ <API key> <API key> mostlyclean: <API key> mostlyclean-am: mostlyclean-aminfo mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool mostlyclean-vti pdf: pdf-recursive pdf-am: $(PDFS) ps: ps-recursive ps-am: $(PSS) uninstall-am: <API key> uninstall-dvi-am uninstall-html-am \ <API key> uninstall-info-am \ <API key> <API key> \ uninstall-man uninstall-pdf-am uninstall-ps-am @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook uninstall-man: uninstall-man1 .MAKE: $(<API key>) all check check-am install install-am \ install-strip uninstall-am .PHONY: $(<API key>) CTAGS GTAGS TAGS all all-am all-local \ am--refresh check check-TESTS check-am check-local clean \ clean-aminfo clean-cscope clean-generic <API key> \ clean-libtool clean-local <API key> cscope \ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-hook dist-info dist-lzip dist-shar dist-tarZ \ dist-xz dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-binSCRIPTS install-data install-data-am \ install-data-local install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am \ <API key> install-info install-info-am \ <API key> <API key> install-man \ install-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installcheck-local installdirs installdirs-am maintainer-clean \ <API key> <API key> \ <API key> mostlyclean mostlyclean-aminfo \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ mostlyclean-vti pdf pdf-am ps ps-am recheck tags tags-am \ uninstall uninstall-am <API key> uninstall-dvi-am \ uninstall-hook uninstall-html-am <API key> \ uninstall-info-am <API key> \ <API key> uninstall-man uninstall-man1 \ uninstall-pdf-am uninstall-ps-am $(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in configure.ac ChangeLog @target='$(srcdir)/$(m4dir)/ltversion.m4'; $(rebuild); \ if test -f "$$target"; then \ set dummy `sed -n '/^# serial /p' "$$target"`; shift; \ actualver=1.$$3; \ test "$$actualver" = "$$correctver" && rebuild=false; \ fi; \ for prereq in $?; do \ case $$prereq in *ChangeLog | *configure.ac);; *) rebuild=:;; esac; \ done; \ if $$rebuild; then \ cd $(srcdir); \ rm -f $(m4dir)/ltversion.tmp; \ serial=`echo "$$correctver" | sed 's,^1[.],,g'`; \ echo $(bootstrap_edit) \ $(srcdir)/$(m4dir)/ltversion.in \> $(srcdir)/$(m4dir)/ltversion.m4; \ $(bootstrap_edit) \ $(m4dir)/ltversion.in > $(m4dir)/ltversion.tmp; \ chmod a-w $(m4dir)/ltversion.tmp; \ mv -f $(m4dir)/ltversion.tmp $(m4dir)/ltversion.m4; \ fi $(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) $(auxdir)/ltmain.m4sh configure.ac ChangeLog @target='$(srcdir)/$(auxdir)/ltmain.sh'; $(rebuild); \ if test -f "$$target"; then \ eval `sed -n '/^package_revision=/p' "$$target"`; \ actualver=$$package_revision; \ test "$$actualver" = "$$correctver" && rebuild=false; \ fi; \ for prereq in $?; do \ case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \ done; \ if $$rebuild; then \ cd $(srcdir); \ rm -f $(auxdir)/ltmain.in $(auxdir)/ltmain.tmp \ $(auxdir)/ltmain.sh; \ echo $(M4SH) -B $(auxdir) $(auxdir)/ltmain.m4sh \ \> $(auxdir)/ltmain.in; \ $(M4SH) -B $(auxdir) $(auxdir)/ltmain.m4sh \ > $(auxdir)/ltmain.in; \ echo $(bootstrap_edit) \ $(srcdir)/$(auxdir)/ltmain.in "> $$target"; \ $(bootstrap_edit) -e '/^: \$${.*="@.*@"}$$/d' \ $(auxdir)/ltmain.in > $(auxdir)/ltmain.tmp; \ rm -f $(auxdir)/ltmain.in; \ chmod a-w $(auxdir)/ltmain.tmp; \ mv -f $(auxdir)/ltmain.tmp $(auxdir)/ltmain.sh; \ fi $(srcdir)/libtoolize.in: $(sh_files) libtoolize.m4sh Makefile.am cd $(srcdir); \ rm -f libtoolize.in libtoolize.tmp; \ $(M4SH) -B $(auxdir) libtoolize.m4sh > libtoolize.tmp; \ $(bootstrap_edit) libtoolize.tmp > libtoolize.in; \ rm -f libtoolize.tmp $(srcdir)/libltdl/Makefile.am: $(srcdir)/libltdl/Makefile.inc cd $(srcdir); \ in=libltdl/Makefile.inc; out=libltdl/Makefile.am; \ rm -f $$out; \ ( $(SED) -n '1,/^.. DO NOT REMOVE THIS LINE -- /p' $$in; \ { echo 'ACLOCAL_AMFLAGS = -I m4'; \ echo 'AUTOMAKE_OPTIONS = foreign'; \ echo 'AM_CPPFLAGS ='; \ echo 'AM_LDFLAGS ='; \ echo 'BUILT_SOURCES ='; \ echo 'include_HEADERS ='; \ echo 'noinst_LTLIBRARIES ='; \ echo 'lib_LTLIBRARIES ='; \ echo 'EXTRA_LTLIBRARIES ='; \ echo 'EXTRA_DIST ='; \ echo 'CLEANFILES ='; \ echo 'MOSTLYCLEANFILES ='; \ }; \ $(SED) -n '/^.. DO NOT REMOVE THIS LINE -- /,$$p' $$in | \ $(SED) -e 's,libltdl_,,; s,libltdl/,,; s,: libltdl/,: ,' \ -e 's,\$$(libltdl_,$$(,' \ ) | \ $(SED) -e '/^.. DO NOT REMOVE THIS LINE -e '1s,^\(.. Makefile.\)inc.*,\1am -- Process this file with automake to produce Makefile.in,' > $$out; chmod a-w $(srcdir)/libltdl/Makefile.am all-local: $(LTDL_BOOTSTRAP_DEPS) libtoolize: $(srcdir)/libtoolize.in $(top_builddir)/config.status rm -f libtoolize.tmp libtoolize $(configure_edit) \ $(srcdir)/libtoolize.in > libtoolize.tmp chmod a+x libtoolize.tmp chmod a-w libtoolize.tmp mv -f libtoolize.tmp libtoolize # We used to do this with a 'stamp-vcl' file, but non-gmake builds # would rerun configure on every invocation, so now we manually # check the version numbers from the build rule when necessary. libtool: $(top_builddir)/config.status $(srcdir)/$(auxdir)/ltmain.sh ChangeLog @target=libtool; $(rebuild); \ if test -f "$$target"; then \ set dummy `./$$target --version | sed 1q`; actualver="$$5"; \ test "$$actualver" = "$$correctver" && rebuild=false; \ fi; \ for prereq in $?; do \ case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \ done; \ if $$rebuild; then \ echo $(SHELL) ./config.status $$target; \ cd $(top_builddir) && $(SHELL) ./config.status $$target; \ fi .PHONY: configure-subdirs configure-subdirs distdir: $(DIST_MAKEFILE_LIST) tests/cdemo/Makefile tests/demo/Makefile tests/depdemo/Makefile tests/f77demo/Makefile tests/fcdemo/Makefile tests/mdemo/Makefile tests/mdemo2/Makefile tests/pdemo/Makefile tests/tagdemo/Makefile : dir=`echo $@ | sed 's,^[^/]*$$,.,;s,/[^/]*$$,,'`; \ test -d $$dir || mkdir $$dir || exit 1; \ abs_srcdir=`$(lt__cd) $(srcdir) && pwd`; \ (cd $$dir && $$abs_srcdir/$$dir/configure --with-dist) || exit 1 # We need the following in order to create an <argz.h> when the system # doesn't have one that works with the given compiler. all-local $(lib_OBJECTS): libltdl/$(ARGZ_H) libltdl/argz.h: libltdl/argz_.h $(mkinstalldirs) . libltdl/ cp $(srcdir)/libltdl/argz_.h $@-t mv $@-t $@ $(srcdir)/libltdl/Makefile.in: $(srcdir)/libltdl/Makefile.am \ $(srcdir)/libltdl/aclocal.m4 cd $(srcdir)/libltdl && $(AUTOMAKE) Makefile $(srcdir)/libltdl/stamp-mk: $(srcdir)/libltdl/Makefile.in cd $(srcdir)/libltdl && \ sed -e 's,config/mdate-sh,,' -e 's,config/texinfo.tex,,' \ -e 's,config/mkinstalldirs,,' \ < Makefile.in > Makefile.inT && \ mv -f Makefile.inT Makefile.in echo stamp > $@ $(srcdir)/libltdl/aclocal.m4: $(sub_aclocal_m4_deps) cd $(srcdir)/libltdl && $(ACLOCAL) -I m4 $(srcdir)/libltdl/configure: $(sub_configure_deps) cd $(srcdir)/libltdl && $(AUTOCONF) $(srcdir)/libltdl/config-h.in: $(sub_configure_deps) cd $(srcdir)/libltdl && $(AUTOHEADER) touch $@ all-local: $(srcdir)/doc/notes.txt $(srcdir)/doc/notes.txt: $(srcdir)/doc/notes.texi cd $(srcdir)/doc && \ $(MAKEINFO) --no-headers $(MAKEINFOFLAGS) -o notes.txt notes.texi $(srcdir)/doc/libtool.1: $(srcdir)/$(auxdir)/ltmain.sh $(update_mans) --help-option=--help-all libtool $(srcdir)/doc/libtoolize.1: $(srcdir)/libtoolize.in $(update_mans) libtoolize install-data-local: libltdl/Makefile.in @$(NORMAL_INSTALL) -rm -rf $(DESTDIR)$(pkgdatadir)/* $(mkinstalldirs) $(DESTDIR)$(aclocaldir) @list='$(aclocalfiles)'; for p in $$list; do \ f=`echo "$$p" | sed 's|^.*/||'`; \ echo " $(INSTALL_DATA) '$(srcdir)/$(m4dir)/$$f' '$(DESTDIR)$(aclocaldir)/$$f'"; \ $(INSTALL_DATA) "$(srcdir)/$(m4dir)/$$f" "$(DESTDIR)$(aclocaldir)/$$f"; \ done $(mkinstalldirs) $(DESTDIR)$(pkgdatadir) $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/config @list='$(auxexefiles)' && for p in $$list; do \ echo " $(INSTALL_SCRIPT) '$(srcdir)/libltdl/$$p' '$(DESTDIR)$(pkgdatadir)/$$p'"; \ $(INSTALL_SCRIPT) "$(srcdir)/libltdl/$$p" "$(DESTDIR)$(pkgdatadir)/$$p"; \ done $(INSTALL_DATA) "$(srcdir)/libltdl/config/ltmain.sh" "$(DESTDIR)$(pkgdatadir)/config/ltmain.sh" $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/libltdl $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/libltdl/libltdl $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/libltdl/loaders @list='$(ltdldatafiles)' && for p in $$list; do \ echo " $(INSTALL_DATA) '$(srcdir)/$$p' '$(DESTDIR)$(pkgdatadir)/$$p'"; \ $(INSTALL_DATA) "$(srcdir)/$$p" "$(DESTDIR)$(pkgdatadir)/$$p"; \ done -chmod a+x $(DESTDIR)$(pkgdatadir)/libltdl/configure uninstall-hook: @$(NORMAL_UNINSTALL) @list='$(ltdldatafiles) $(auxfiles)'; for f in $$list; do \ echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \ done @for p in $(aclocalfiles); do \ f=`echo "$$p" | sed 's|^.*/||'`; \ echo " rm -f '$(DESTDIR)$(aclocaldir)/$$f'"; \ rm -f "$(DESTDIR)$(aclocaldir)/$$f"; \ done dist-hook: case $(VERSION) in \ *[a-z]) $(SHELL) $(srcdir)/$(edit_readme_alpha) $(distdir)/README ;; \ esac for macro in LT_INIT AC_PROG_LIBTOOL AM_PROG_LIBTOOL; do \ if grep $$macro $(srcdir)/aclocal.m4 $(srcdir)/libltdl/aclocal.m4; then \ echo "Bogus $$macro macro contents in an aclocal.m4 file." >&2; \ exit 1; \ else :; fi; \ done # Use `$(srcdir)' for the benefit of non-GNU makes: this is # how `testsuite' appears in our dependencies. $(srcdir)/$(TESTSUITE): $(srcdir)/tests/package.m4 $(TESTSUITE_AT) Makefile.am cd $(srcdir)/tests && \ $(AUTOTEST) `echo $(TESTSUITE_AT) | sed 's,tests/,,g'` -o testsuite.tmp && \ mv -f testsuite.tmp testsuite $(srcdir)/tests/package.m4: $(srcdir)/configure.ac Makefile.am { \ echo '# Signature of the current package.'; \ echo 'm4_define([AT_PACKAGE_NAME], [GNU Libtool])'; \ echo 'm4_define([AT_PACKAGE_TARNAME], [libtool])'; \ echo 'm4_define([AT_PACKAGE_VERSION], [2.4.2])'; \ echo 'm4_define([AT_PACKAGE_STRING], [GNU Libtool 2.4.2])'; \ echo 'm4_define([<API key>], [bug-libtool@gnu.org])'; \ echo 'm4_define([AT_PACKAGE_URL], [http: } | $(bootstrap_edit) > $(srcdir)/tests/package.m4 tests/atconfig: $(top_builddir)/config.status $(SHELL) ./config.status tests/atconfig # Hook the test suite into the check rule check-local: $(<API key>) $(CD_TESTDIR); \ CONFIG_SHELL="$(SHELL)" $(SHELL) $$abs_srcdir/$(TESTSUITE) \ $(TESTS_ENVIRONMENT) $(<API key>) $(TESTSUITEFLAGS) # Run the test suite on the *installed* tree. installcheck-local: $(testsuite_deps) $(CD_TESTDIR); \ CONFIG_SHELL="$(SHELL)" $(SHELL) $$abs_srcdir/$(TESTSUITE) \ $(TESTS_ENVIRONMENT) $(<API key>) $(TESTSUITEFLAGS) \ AUTOTEST_PATH="$(exec_prefix)/bin" <API key>: $(MAKE) $(AM_MAKEFLAGS) check-TESTS TESTS='$(<API key>)' <API key>: $(MAKE) $(AM_MAKEFLAGS) check-TESTS TESTS='$(INTERACTIVE_TESTS)' # Run only noninteractive parts of the new testsuite. <API key>: $(<API key>) $(CD_TESTDIR); \ CONFIG_SHELL="$(SHELL)" $(SHELL) $$abs_srcdir/$(TESTSUITE) \ $(TESTS_ENVIRONMENT) $(<API key>) \ -k !interactive <API key>=",!interactive" \ $(TESTSUITEFLAGS) # Run only interactive parts of the new testsuite. <API key>: $(<API key>) $(CD_TESTDIR); \ CONFIG_SHELL="$(SHELL)" $(SHELL) $$abs_srcdir/$(TESTSUITE) \ $(TESTS_ENVIRONMENT) $(<API key>) \ -k interactive -k recursive <API key>=",interactive" \ $(TESTSUITEFLAGS) check-interactive: <API key> <API key> <API key>: <API key> <API key> # We need to remove any file droppings left behind by testsuite clean-local: clean-local-legacy -$(CD_TESTDIR); \ test -f $$abs_srcdir/$(TESTSUITE) && \ $(SHELL) $$abs_srcdir/$(TESTSUITE) --clean tests/tagdemo-undef-exec.log: tests/tagdemo-undef-make.log tests/tagdemo-undef-make.log: tests/tagdemo-undef.log tests/tagdemo-undef.log: tests/tagdemo-shared-exec.log tests/tagdemo-shared-exec.log: tests/tagdemo-shared-make.log tests/tagdemo-shared-make.log: tests/tagdemo-shared.log tests/tagdemo-shared.log: tests/tagdemo-exec.log tests/tagdemo-exec.log: tests/tagdemo-make.log tests/tagdemo-make.log: tests/tagdemo-conf.log tests/tagdemo-conf.log: tests/tagdemo-static-exec.log tests/tagdemo-static-exec.log: tests/tagdemo-static-make.log tests/tagdemo-static-make.log: tests/tagdemo-static.log tests/f77demo-shared-exec.log: tests/f77demo-shared-make.log tests/f77demo-shared-make.log: tests/f77demo-shared.log tests/f77demo-shared.log: tests/f77demo-exec.log tests/f77demo-exec.log: tests/f77demo-make.log tests/f77demo-make.log: tests/f77demo-conf.log tests/f77demo-conf.log: tests/f77demo-static-exec.log tests/f77demo-static-exec.log: tests/f77demo-static-make.log tests/f77demo-static-make.log: tests/f77demo-static.log tests/fcdemo-shared-exec.log: tests/fcdemo-shared-make.log tests/fcdemo-shared-make.log: tests/fcdemo-shared.log tests/fcdemo-shared.log: tests/fcdemo-exec.log tests/fcdemo-exec.log: tests/fcdemo-make.log tests/fcdemo-make.log: tests/fcdemo-conf.log tests/fcdemo-conf.log: tests/fcdemo-static-exec.log tests/fcdemo-static-exec.log: tests/fcdemo-static-make.log tests/fcdemo-static-make.log: tests/fcdemo-static.log tests/cdemo-undef-exec.log: tests/cdemo-undef-make.log tests/cdemo-undef-make.log: tests/cdemo-undef.log tests/cdemo-undef.log: | tests/cdemo-shared-exec.log tests/cdemo-shared-exec.log: tests/cdemo-shared-make.log tests/cdemo-shared-make.log: tests/cdemo-shared.log tests/cdemo-shared.log: | tests/cdemo-exec.log tests/cdemo-exec.log: tests/cdemo-make.log tests/cdemo-make.log: tests/cdemo-conf.log tests/cdemo-conf.log: | tests/cdemo-static-exec.log tests/cdemo-static-exec.log: tests/cdemo-static-make.log tests/cdemo-static-make.log: tests/cdemo-static.log tests/demo-shared-unst.log: tests/demo-noinst-link.log tests/demo-noinst-link.log: tests/demo-relink.log tests/demo-relink.log: tests/demo-hardcode.log tests/demo-hardcode.log: tests/demo-shared-inst.log tests/demo-shared-inst.log: tests/demo-shared-exec.log tests/demo-shared-exec.log: tests/demo-shared-make.log tests/demo-shared-make.log: tests/demo-shared.log tests/demo-shared.log: | tests/demo-nopic-exec.log tests/demo-nopic-exec.log: tests/demo-nopic-make.log tests/demo-nopic-make.log: tests/demo-nopic.log tests/demo-nopic.log: | tests/demo-pic-exec.log tests/demo-pic-exec.log: tests/demo-pic-make.log tests/demo-pic-make.log: tests/demo-pic.log tests/demo-pic.log: | tests/demo-nofast-unst.log tests/demo-nofast-unst.log: tests/demo-nofast-inst.log tests/demo-nofast-inst.log: tests/demo-nofast-exec.log tests/demo-nofast-exec.log: tests/demo-nofast-make.log tests/demo-nofast-make.log: tests/demo-nofast.log tests/demo-nofast.log: | tests/demo-deplibs.log tests/demo-deplibs.log: tests/demo-unst.log tests/demo-unst.log: tests/demo-inst.log tests/demo-inst.log: tests/demo-exec.log tests/demo-exec.log: tests/demo-make.log tests/demo-make.log: tests/demo-conf.log tests/demo-conf.log: | tests/demo-static-unst.log tests/demo-static-unst.log: tests/demo-static-inst.log tests/demo-static-inst.log: tests/demo-static-exec.log tests/demo-static-exec.log: tests/demo-static-make.log tests/demo-static-make.log: tests/demo-static.log tests/depdemo-shared-unst.log: tests/depdemo-relink.log tests/depdemo-relink.log: tests/depdemo-shared-inst.log tests/depdemo-shared-inst.log: tests/depdemo-shared-exec.log tests/depdemo-shared-exec.log: tests/depdemo-shared-make.log tests/depdemo-shared-make.log: tests/depdemo-shared.log tests/depdemo-shared.log: | tests/depdemo-nofast-unst.log tests/depdemo-nofast-unst.log: tests/depdemo-nofast-inst.log tests/depdemo-nofast-inst.log: tests/depdemo-nofast-exec.log tests/depdemo-nofast-exec.log: tests/depdemo-nofast-make.log tests/depdemo-nofast-make.log: tests/depdemo-nofast.log tests/depdemo-nofast.log: | tests/depdemo-unst.log tests/depdemo-unst.log: tests/depdemo-inst.log tests/depdemo-inst.log: tests/depdemo-exec.log tests/depdemo-exec.log: tests/depdemo-make.log tests/depdemo-make.log: tests/depdemo-conf.log tests/depdemo-conf.log: | tests/depdemo-static-unst.log tests/depdemo-static-unst.log: tests/depdemo-static-inst.log tests/depdemo-static-inst.log: tests/depdemo-static-exec.log tests/depdemo-static-exec.log: tests/depdemo-static-make.log tests/depdemo-static-make.log: tests/depdemo-static.log tests/mdemo-shared-unst.log: tests/mdemo-shared-inst.log tests/mdemo-shared-inst.log: tests/mdemo-shared-exec.log tests/mdemo-shared-exec.log: tests/mdemo-shared-make.log tests/mdemo-shared-make.log: tests/mdemo-shared.log tests/mdemo-shared.log: | tests/mdemo-dryrun.log \ tests/mdemo2-exec.log tests/mdemo-dryrun.log: tests/mdemo-unst.log tests/mdemo-unst.log: tests/mdemo-inst.log tests/mdemo-inst.log: tests/mdemo-exec.log tests/mdemo-exec.log: tests/mdemo-make.log tests/mdemo-make.log: tests/mdemo-conf.log tests/mdemo-conf.log: | tests/mdemo-static-unst.log tests/mdemo-static-unst.log: tests/mdemo-static-inst.log tests/mdemo-static-inst.log: tests/mdemo-static-exec.log tests/mdemo-static-exec.log: tests/mdemo-static-make.log tests/mdemo-static-make.log: tests/mdemo-static.log tests/mdemo2-exec.log: tests/mdemo2-make.log tests/mdemo2-make.log: tests/mdemo2-conf.log \ tests/mdemo-dryrun.log tests/pdemo-inst.log: tests/pdemo-exec.log tests/pdemo-exec.log: tests/pdemo-make.log tests/pdemo-make.log: tests/pdemo-conf.log # The defs script shouldn't be recreated whenever the Makefile is # regenerated since the source tree can be read-only. check-recursive: tests/defs tests/defs: $(srcdir)/tests/defs.in rm -f tests/defs.tmp tests/defs; \ $(configure_edit) $(srcdir)/tests/defs.in > tests/defs.tmp; \ mv -f tests/defs.tmp tests/defs # Use `$(srcdir)/tests' for the benefit of non-GNU makes: this is # how defs.in appears in our dependencies. $(srcdir)/tests/defs.in: $(auxdir)/general.m4sh tests/defs.m4sh Makefile.am cd $(srcdir); \ rm -f tests/defs.in; \ $(M4SH) -B $(auxdir) tests/defs.m4sh > tests/defs.in # We need to remove any files that the above tests created. clean-local-legacy: -for dir in $(CONF_SUBDIRS); do \ if test -f $$dir/Makefile; then \ (cd $$dir && $(MAKE) $(AM_MAKEFLAGS) distclean); \ else :; fi; \ done rm -rf _inst _inst-* $(distclean_recursive): <API key> .PHONY: <API key> <API key>: -for dir in $(CONF_SUBDIRS); do \ if test ! -f $$dir/Makefile; then \ $(mkinstalldirs) $$dir; \ echo 'distclean: ; rm -f Makefile' > $$dir/Makefile; \ else :; fi; \ done $(TESTS): tests/defs # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT:
#include <iomanip> #include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, p_i; cin >> n; double total = 0.0; for (size_t i = 0; i < n; i++) { cin >> p_i; total += p_i; } cout << setprecision(12) << fixed << (total / n) << endl; }
<?php //no direct accees defined ('_JEXEC') or die ('restricted access'); class <API key> extends SppagebuilderAddons { public function render() { $class = (isset($this->addon->settings->class) && $this->addon->settings->class) ? $this->addon->settings->class : ''; $style = (isset($this->addon->settings->style) && $this->addon->settings->style) ? $this->addon->settings->style : ''; $title = (isset($this->addon->settings->title) && $this->addon->settings->title) ? $this->addon->settings->title : ''; $heading_selector = (isset($this->addon->settings->heading_selector) && $this->addon->settings->heading_selector) ? $this->addon->settings->heading_selector : 'h3'; //Output $output = '<div class="sppb-addon sppb-addon-tab ' . $class . '">'; $output .= ($title) ? '<'.$heading_selector.' class="sppb-addon-title">' . $title . '</'.$heading_selector.'>' : ''; $output .= '<div class="sppb-addon-content sppb-tab">'; //Tab Title $output .='<ul class="sppb-nav sppb-nav-' . $style . '">'; foreach ($this->addon->settings->sp_tab_item as $key => $tab) { $title = (isset($tab->icon) && $tab->icon) ? '<i class="fa ' . $tab->icon . '"></i> ' . $tab->title : $tab->title; $output .='<li class="'. ( ($key==0) ? "active" : "").'"><a data-toggle="sppb-tab" href="#sppb-tab-'. ($this->addon->id + $key) .'">'. $title .'</a></li>'; } $output .='</ul>'; //Tab Contnet $output .='<div class="sppb-tab-content sppb-nav-' . $style . '-content">'; foreach ($this->addon->settings->sp_tab_item as $key => $tab) { $output .='<div id="sppb-tab-'. ($this->addon->id + $key) .'" class="sppb-tab-pane sppb-fade'. ( ($key==0) ? " active in" : "").'">' . $tab->content .'</div>'; } $output .='</div>'; $output .= '</div>'; $output .= '</div>'; return $output; } public function css() { $addon_id = '#sppb-addon-' . $this->addon->id; $tab_style = (isset($this->addon->settings->style) && $this->addon->settings->style) ? $this->addon->settings->style : ''; $style = (isset($this->addon->settings->active_tab_color) && $this->addon->settings->active_tab_color) ? 'color: ' . $this->addon->settings->active_tab_color . ';': ''; $css = ''; if($tab_style == 'pills') { $style .= (isset($this->addon->settings->active_tab_bg) && $this->addon->settings->active_tab_bg) ? 'background-color: ' . $this->addon->settings->active_tab_bg . ';': ''; if($style) { $css .= $addon_id . ' .sppb-nav-pills > li.active > a,' . $addon_id . ' .sppb-nav-pills > li.active > a:hover,' . $addon_id . ' .sppb-nav-pills > li.active > a:focus {'; $css .= $style; $css .= '}'; } } else if ($tab_style == 'lines') { $style .= (isset($this->addon->settings->active_tab_bg) && $this->addon->settings->active_tab_bg) ? 'border-bottom-color: ' . $this->addon->settings->active_tab_bg . ';': ''; if($style) { $css .= $addon_id . ' .sppb-nav-lines > li.active > a,' . $addon_id . ' .sppb-nav-lines > li.active > a:hover,' . $addon_id . ' .sppb-nav-lines > li.active > a:focus {'; $css .= $style; $css .= '}'; } } return $css; } }
/** * @file * null audio source */ #include <inttypes.h> #include <stdio.h> #include "libavutil/channel_layout.h" #include "libavutil/internal.h" #include "avfilter.h" #include "internal.h" static int request_frame(AVFilterLink *link) { return AVERROR_EOF; } static const AVFilterPad <API key>[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, .request_frame = request_frame, }, { NULL } }; AVFilter <API key> = { .name = "anullsrc", .description = <API key>("Null audio source, never return audio frames."), .inputs = NULL, .outputs = <API key>, };
var ajaxManager = (function() { $jq = jQuery.noConflict(); var requests = []; return { addReq: function(opt) { requests.push(opt); }, removeReq: function(opt) { if($jq.inArray(opt, requests) > -1) { requests.splice($jq.inArray(opt, requests), 1); } }, run: function() { var self = this, orgSuc; if(requests.length) { oriSuc = requests[0].complete; requests[0].complete = function() { if(typeof oriSuc === 'function') { oriSuc(); } requests.shift(); self.run.apply(self, []); }; $jq.ajax(requests[0]); } else { self.tid = setTimeout(function() { self.run.apply(self, []); }, 1000); } }, stop: function() { requests = []; clearTimeout(this.tid); } }; }()); ajaxManager.run(); (function($){ $(document).ready(function(){ $('.purAddToCart, .purAddToCartImage').click(function() { $(this).attr('disabled', 'disabled'); }) $('.Cart66AjaxWarning').hide(); // Added to remove error on double-click when add to cart is clicked $('.purAddToCart, .purAddToCartImage').click(function() { $(this).attr('disabled', 'disabled'); }) $('.ajax-button').click(function() { $(this).attr('disabled', true); var id = $(this).attr('id').replace('addToCart_', ''); $('#task_' + id).val('ajax'); var product = C66.products[id]; if(C66.trackInventory) { inventoryCheck(id, C66.ajaxurl, product.ajax, product.name, product.returnUrl, product.addingText); } else { if(product.ajax === 'no') { $('#task_' + id).val('addToCart'); $('#cartButtonForm_' + id).submit(); return false; } else if(product.ajax === 'yes' || product.ajax === 'true') { buttonTransform(id, C66.ajaxurl, product.name, product.returnUrl, product.addingText); } } return false; }); $('.modalClose').click(function() { $('.Cart66Unavailable, .Cart66Warning, .Cart66Error, .alert-message').fadeOut(800); }); $('#<API key>').click(function() { return confirm('Are you sure you want to cancel your subscription?\n'); }); var original_methods = $('#shipping_method_id').html(); var selected_country = $('#<API key>').val(); $('.methods-country').each(function() { if(!$(this).hasClass(selected_country) && !$(this).hasClass('all-countries') && !$(this).hasClass('select')) { $(this).remove(); } }); $('#<API key>').change(function() { var selected_country = $(this).val(); $('#shipping_method_id').html(original_methods); $('.methods-country').each(function() { if(!$(this).hasClass(selected_country) && !$(this).hasClass('all-countries') && !$(this).hasClass('select')) { $(this).remove(); } }); $("#shipping_method_id option:eq(1)").attr('selected','selected').change(); }); $('#shipping_method_id').change(function() { $('#Cart66CartForm').submit(); }); $('#live_rates').change(function() { $('#Cart66CartForm').submit(); }); $('.showEntriesLink').click(function() { var panel = $(this).attr('rel'); $('#' + panel).toggle(); return false; }); $('#<API key>').click(function() { $('#<API key>').toggle(); return false; }); }) })(jQuery); function <API key>(formId) { $jq = jQuery.noConflict(); var theForm = $jq('#' + formId); var str = ''; $jq('input:not([type=checkbox], :radio), input[type=checkbox]:checked, input:radio:checked, select, textarea', theForm).each( function() { var name = $jq(this).attr('name'); var val = $jq(this).val(); str += name + '=' + encodeURIComponent(val) + '&'; } ); return str.substring(0, str.length-1); } function inventoryCheck(formId, ajaxurl, useAjax, productName, productUrl, addingText) { $jq = jQuery.noConflict(); var mydata = <API key>('cartButtonForm_' + formId); ajaxManager.addReq({ type: "POST", url: ajaxurl + '=1', data: mydata, dataType: 'json', success: function(response) { if(response[0]) { $jq('#task_' + formId).val('addToCart'); if(useAjax == 'no') { $jq('#cartButtonForm_' + formId).submit(); } else { buttonTransform(formId, ajaxurl, productName, productUrl, addingText); } } else { $jq('.modalClose').show(); $jq('#stock_message_box_' + formId).fadeIn(300); $jq('#stock_message_' + formId).html(response[1]); $jq('#addToCart_' + formId).removeAttr('disabled'); } }, error: function(xhr,err){ alert("readyState: "+xhr.readyState+"\nstatus: "+xhr.status); } }); } function addToCartAjax(formId, ajaxurl, productName, productUrl, buttonText) { $jq = jQuery.noConflict(); var options1 = $jq('#cartButtonForm_' + formId + ' .cart66Options.options_1').val(); var options2 = $jq('#cartButtonForm_' + formId + ' .cart66Options.options_2').val(); var itemQuantity = $jq('#<API key>' + formId).val(); var itemUserPrice = $jq('#<API key>' + formId).val(); var cleanProductId = formId.split('_'); cleanProductId = cleanProductId[0]; var data = { cart66ItemId: cleanProductId, itemName: productName, options_1: options1, options_2: options2, item_quantity: itemQuantity, item_user_price: itemUserPrice, product_url: productUrl }; ajaxManager.addReq({ type: "POST", url: ajaxurl + '=2', data: data, dataType: 'json', success: function(response) { $jq('#addToCart_' + formId).removeAttr('disabled'); $jq('#addToCart_' + formId).removeClass('ajaxPurAddToCart'); $jq('#addToCart_' + formId).val(buttonText); $jq.hookExecute('addToCartAjaxHook', response); <API key>(ajaxurl); if($jq('.<API key>').length > 0) { $jq('.<API key>').show().html(response.msg); $jq.hookExecute('<API key>', response); } else { if((response.msgId) == 0){ $jq('.success_' + formId).fadeIn(300); $jq('.success_message_' + formId).html(response.msg); if(typeof response.msgHeader !== 'undefined') { $jq('.success' + formId + ' .message-header').html(response.msgHeader); } $jq('.success_' + formId).delay(2000).fadeOut(300); } if((response.msgId) == -1){ $jq('.warning_' + formId).fadeIn(300); $jq('.warning_message_' + formId).html(response.msg); if(typeof response.msgHeader !== 'undefined') { $jq('.warning' + formId + ' .message-header').html(response.msgHeader); } } if((response.msgId) == -2){ $jq('.error_' + formId).fadeIn(300); $jq('.error_message_' + formId).html(response.msg); if(typeof response.msgHeader !== 'undefined') { $jq('.error_' + formId + ' .message-header').html(response.msgHeader); } } } } }) } function buttonTransform(formId, ajaxurl, productName, productUrl, addingText) { $jq = jQuery.noConflict(); var buttonText = $jq('#addToCart_' + formId).val(); $jq('#addToCart_' + formId).attr('disabled', 'disabled'); $jq('#addToCart_' + formId).addClass('ajaxPurAddToCart'); $jq('#addToCart_' + formId).val(addingText); addToCartAjax(formId, ajaxurl, productName, productUrl, buttonText); } function <API key>(ajaxurl) { $jq = jQuery.noConflict(); var widgetId = $jq('.Cart66CartWidget').attr('id'); var data = { action: "ajax_cart_elements" }; ajaxManager.addReq({ type: "POST", url: ajaxurl + '=3', data: data, dataType: 'json', success: function(response) { $jq.hookExecute('<API key>', response); $jq('#<API key>, #<API key>').show(); $jq('.<API key>, #<API key>').hide(); $jq('#<API key>').each(function(){ widgetContent = "<span id=\"<API key>\">" + response.summary.count + "</span>"; widgetContent += "<span id=\"<API key>\">" + response.summary.items + "</span>"; widgetContent += "<span id=\"<API key>\"> – </span>" widgetContent += "<span id=\"<API key>\">" + response.summary.amount + "</span>"; $jq(this).html(widgetContent).fadeIn('slow'); }); $jq('.<API key>').each(function(){ if(response.shipping == 1) { $jq(this).show(); } }) $jq('#<API key>').each(function(){ widgetContent = C66.youHave + ' ' + response.summary.count + " " + response.summary.items + " (" + response.summary.amount + ") " + C66.inYourShoppingCart; $jq(this).html(widgetContent).fadeIn('slow'); }); $jq("#<API key> .product_items").remove(); $jq.each(response.products.reverse(), function(index, array){ widgetContent = "<tr class=\"product_items\"><td>"; widgetContent += "<span class=\"Cart66ProductTitle\">" + array.productName + "</span>"; widgetContent += "<span class=\"Cart66QuanPrice\">"; widgetContent += "<span class=\"<API key>\">" + array.productQuantity + "</span>"; widgetContent += "<span class=\"Cart66MetaSep\"> x </span>"; widgetContent += "<span class=\"Cart66ProductPrice\">" + array.productPrice + "</span>"; widgetContent += "</span>"; widgetContent += "</td><td class=\"<API key>\">"; widgetContent += "<span class=\"<API key>\">" + array.productSubtotal + "</span>"; widgetContent += "</td></tr>"; $jq("#<API key> tbody").prepend(widgetContent).fadeIn("slow"); }); $jq('.Cart66Subtotal').each(function(){ $jq(this).html(response.subtotal) }); $jq('.Cart66Shipping').each(function(){ $jq(this).html(response.shippingAmount) }); } }) } jQuery.extend({ hookExecute: function (function_name, response){ if (typeof window[function_name] == "function"){ window[function_name](response); return true; } else{ return false; } } });
<?php session_start(); ob_start(); include ('connect.php'); if(($_SESSION['LOGIN'] == "NO") or (!$_SESSION['LOGIN'])) header('Location: index.php'); function cssifysize($img) { $dimensions = getimagesize($img); $dimensions = str_replace("=\"", ":", $dimensions['3']); $dimensions = str_replace("\"", "px;", $dimensions); return $dimensions; }; ?> <br /><br /><a href="index.php">RETURN</a><br /><br /> <form action="image_folder.php" method="POST" enctype="multipart/form-data"> <p> Image Name: <input type="text" name="name_image"> </p> <p>Locate Image: <input type="file" name="userfile" id="file"></p> <p><input type="submit" value="Upload"></p> </form> <br /><br /> <?php if(($_POST['name_image'])){ $nameimg = $_POST['name_image']; $uploaddir = 'img/'; $uploadfile = $uploaddir . $nameimg; //basename($_FILES['userfile']['name']); if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { $query=mysql_query("INSERT INTO IMG_NEWSLETTER (NAME_IMG, DELETED) VALUES ('$nameimg', 'NO') ") or die (mysql_error()) ; if($query) header('Location: image_folder?img_upload=success'); } else { echo "<br />Upload failed<br /><br />"; } }; $query=mysql_query("SELECT * FROM IMG_NEWSLETTER WHERE DELETED LIKE 'NO' ") or die (mysql_error()); $count = 0; while($array=mysql_fetch_array($query)){ $count++; ?> <?php $img = "img/".$array['NAME_IMG']; ?> <p><b>Real Size:</b> <?php echo cssifysize($img); ?></p> <p><b>Display below:</b> width:200px; height:150px; </p> <p><a href="<?php echo "img/".$array['NAME_IMG']; ?>" target="_blank" ><img src="<?php echo "img/".$array['NAME_IMG']; ?>" width="200" height="150"></a></p><p><b><font size="+2"> <?php echo $array['NAME_IMG']; ?></b></font><input type="button" value="DELETE" onClick="javascript: document.location.href = 'delimg.php?idimg=<?php echo $array['ID_IMG_NEWSLETTER']; ?>';" /></p> <br />-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br /> <?php }; if($count == 0 ) echo "No image found."; if($_GET['delete']) echo "<br />The Image has been deleted successfully."; if($_GET['img_upload']) echo "<br />The Image has been uploaded successfully."; ?> <br /><br /><a href="index.php">RETURN</a><br /><br />
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <errno.h> #include <iostream> #include "ftfilemapper.h" //#define DEBUG_FILEMAPPER ftFileMapper::ftFileMapper(uint64_t file_size,uint32_t chunk_size) : _file_size(file_size),_chunk_size(chunk_size) { int nb_chunks = (int)(file_size / (uint64_t)chunk_size) + ( (file_size % chunk_size)==0 ?0:1 ) ; #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) Creating ftFileMapper for file of size " << file_size << ", with " << nb_chunks << " chunks." << std::endl; #endif _first_free_chunk = 0 ; _mapped_chunks.clear() ; _mapped_chunks.resize(nb_chunks,-1) ; _data_chunks.clear() ; _data_chunks.resize(nb_chunks,-1) ; } bool ftFileMapper::<API key>(uint64_t offset,uint64_t& storage_offset) const { // Compute the chunk number for this offset uint32_t cid = (uint32_t)(offset / (uint64_t)_chunk_size) ; // Check that the cid is in the allowed range. That should always be the case. if(cid < _mapped_chunks.size() && _mapped_chunks[cid] >= 0) { storage_offset = _mapped_chunks[cid]*_chunk_size + (offset % (uint64_t)_chunk_size) ; return true ; } else { #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) ftFileMapper::<API key>(): offset " << offset << " corresponds to chunk number " << cid << " which is not mapped!!" << std::endl; #endif return false ; } } bool ftFileMapper::writeData(uint64_t offset,uint32_t size,void *data,FILE *fd) const { if (0 != fseeko64(fd, offset, SEEK_SET)) { std::cerr << "(EE) ftFileMapper::ftFileMapper::writeData() Bad fseek at offset " << offset << ", fd=" << (void*)fd << ", size=" << size << ", errno=" << errno << std::endl; return false; } if (1 != fwrite(data, size, 1, fd)) { std::cerr << "(EE) ftFileMapper::ftFileCreator::addFileData() Bad fwrite." << std::endl; std::cerr << "ERRNO: " << errno << std::endl; return false; } fflush(fd) ; return true ; } bool ftFileMapper::storeData(void *data, uint32_t data_size, uint64_t offset,FILE *fd) { uint64_t real_offset = 0; #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) ftFileMapper::storeData(): storing data size " << data_size << " for offset "<< offset << std::endl; #endif // we compute the real place of the data in the mapped file. Several cases: // 1 - the place corresponds to a mapped place // => write there. // 2 - the place does not correspond to a mapped place. // 2.0 - we allocate a new chunk at the end of the file. // 2.0.1 - the chunk corresponds to a mapped chunk somewhere before // => we move it, and use the other chunk as writing position // 2.0.2 - the chunk does not correspond to a mapped chunk somewhere before // => we use it // 2.1 - the place is in the range of existing data // => we move the existing data at the end of the file, and update the mapping // 2.2 - the place is outside the range of existing data // => we allocate a new chunk at the end of the file, and write there. // 2.2.1 - we look for the first chunk that is not already mapped before. if(!<API key>(offset,real_offset)) { uint32_t cid = (uint32_t)(offset / (uint64_t)_chunk_size) ; #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) real offset unknown. chunk id is " << cid << std::endl; #endif uint32_t empty_chunk = <API key>(fd) ; #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) allocated new empty chunk " << empty_chunk << std::endl; #endif if(cid < _first_free_chunk && cid != empty_chunk) // the place is already occupied by some data { #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) chunk already in use. " << std::endl; std::cerr << "(DD) swapping with first free chunk: " << empty_chunk << std::endl; #endif if(!moveChunk(cid, empty_chunk,fd)) { std::cerr << "(EE) ftFileMapper::writeData(): cannot move chunk " << empty_chunk << " and " << cid << std::endl ; return false ; } // Get the old chunk id that was mapping to this place int oid = _data_chunks[cid] ; if(oid < 0) { std::cerr << "(EE) ftFileMapper::writeData(): cannot find chunk that was previously mapped to place " << cid << std::endl ; return false ; } #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) old chunk now pointing to: " << empty_chunk << std::endl; std::cerr << "(DD) new chunk now pointing to: " << cid << std::endl; #endif _mapped_chunks[cid] = cid ; // this one is in place, since we swapped it _mapped_chunks[oid] = empty_chunk ; _data_chunks[cid] = cid ; _data_chunks[empty_chunk] = oid ; } else // allocate a new chunk at end of the file. { #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) allocating new storage place at first free chunk: " << empty_chunk << std::endl; #endif _mapped_chunks[cid] = empty_chunk ; _data_chunks[empty_chunk] = cid ; } real_offset = _mapped_chunks[cid]*_chunk_size + (offset % (uint64_t)_chunk_size) ; } #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) real offset = " << real_offset << ", data size=" << data_size << std::endl; std::cerr << "(DD) writing data " << std::endl; #endif return writeData(real_offset,data_size,data,fd) ; } uint32_t ftFileMapper::<API key>(FILE *fd_out) { // look into _first_free_chunk. Is it the place of a chunk already mapped before? #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) ftFileMapper::getFirstEmptyChunk()" << std::endl; #endif if(_mapped_chunks[_first_free_chunk] >= 0 && _mapped_chunks[_first_free_chunk] < (int)_first_free_chunk) { uint32_t old_chunk = _mapped_chunks[_first_free_chunk] ; #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) first free chunk " << _first_free_chunk << " is actually mapped to " << old_chunk << ". Moving it." << std::endl; #endif moveChunk(_mapped_chunks[_first_free_chunk],_first_free_chunk,fd_out) ; _mapped_chunks[_first_free_chunk] = _first_free_chunk ; _data_chunks[_first_free_chunk] = _first_free_chunk ; _first_free_chunk++ ; #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) Returning " << old_chunk << std::endl; #endif return old_chunk ; } else { #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) first free chunk is fine. Returning " << _first_free_chunk << ", and making room" << std::endl; #endif // We need to wipe the entire chunk, since it might be moved before beign completely written, which would cause // a fread error. wipeChunk(_first_free_chunk,fd_out) ; return _first_free_chunk++ ; } } bool ftFileMapper::wipeChunk(uint32_t cid,FILE *fd) const { uint32_t size = (cid == _mapped_chunks.size()-1)?(_file_size - cid*_chunk_size) : _chunk_size ; void *buf = malloc(size) ; if(buf == NULL) { std::cerr << "(EE) ftFileMapper::wipeChunk(): cannot allocate temporary buf of size " << size << std::endl; return false ; } if(fseeko64(fd, cid*_chunk_size, SEEK_SET)!= 0) { std::cerr << "(EE) ftFileMapper::wipeChunk(): cannot fseek file at position " << cid*_chunk_size << std::endl; free(buf) ; return false ; } if(1 != fwrite(buf, size, 1, fd)) { std::cerr << "(EE) ftFileMapper::wipeChunk(): cannot write to file" << std::endl; free(buf) ; return false ; } free(buf) ; return true ; } bool ftFileMapper::moveChunk(uint32_t to_move, uint32_t new_place,FILE *fd_out) { // Read the old chunk, write at the new place assert(to_move != new_place) ; fflush(fd_out) ; #ifdef DEBUG_FILEMAPPER std::cerr << "(DD) ftFileMapper::moveChunk(): moving chunk " << to_move << " to place " << new_place << std::endl ; #endif uint32_t new_place_size = (new_place == _mapped_chunks.size()-1)?(_file_size - (_mapped_chunks.size()-1)*_chunk_size) : _chunk_size ; uint32_t to_move_size = (new_place == _mapped_chunks.size()-1)?(_file_size - (_mapped_chunks.size()-1)*_chunk_size) : _chunk_size ; uint32_t size = std::min(new_place_size,to_move_size) ; void *buff = malloc(size) ; if(buff == NULL) { std::cerr << "(EE) ftFileMapper::moveChunk(): cannot open temporary buffer. Out of memory??" << std::endl; return false ; } if(fseeko64(fd_out, to_move*_chunk_size, SEEK_SET) != 0) { std::cerr << "(EE) ftFileMapper::moveChunk(): cannot fseek file at position " << to_move*_chunk_size << std::endl; return false ; } size_t rd ; if(size != (rd = fread(buff, 1, size, fd_out))) { std::cerr << "(EE) ftFileMapper::moveChunk(): cannot read from file" << std::endl; std::cerr << "(EE) errno = " << errno << std::endl; std::cerr << "(EE) feof = " << feof(fd_out) << std::endl; std::cerr << "(EE) size = " << size << std::endl; std::cerr << "(EE) rd = " << rd << std::endl; return false ; } if(fseeko64(fd_out, new_place*_chunk_size, SEEK_SET)!= 0) { std::cerr << "(EE) ftFileMapper::moveChunk(): cannot fseek file at position " << new_place*_chunk_size << std::endl; return false ; } if(1 != fwrite(buff, size, 1, fd_out)) { std::cerr << "(EE) ftFileMapper::moveChunk(): cannot write to file" << std::endl; return false ; } free(buff) ; return true ; } void ftFileMapper::print() const { std::cerr << "ftFileMapper:: [ " ; for(uint32_t i=0;i<_mapped_chunks.size();++i) { std::cerr << _mapped_chunks[i] << " " ; } std::cerr << "] - ffc = " << _first_free_chunk << " - [ "; for(uint32_t i=0;i<_data_chunks.size();++i) std::cerr << _data_chunks[i] << " " ; std::cerr << " ] " << std::endl; }
# Endpoints for user to control the home. from datetime import datetime from flask import Blueprint, jsonify, request from services import elements_services, home_services home_api = Blueprint('/home_api', __name__) elements_services = elements_services.ElementsServices() home_services = home_services.HomeServices() @home_api.route('/profiles') def profiles(): """Gets all profiles for all elements for user application to display and manipulate elements""" return jsonify(home_services.get_profiles()) @home_api.route('/element', methods=['POST']) def update_element(): """Updates single element with all new values received from the user application""" received_element = request.get_json() home_services.update_element(received_element) return 'OK' @home_api.route('/elements', methods=['POST']) def update_elements(): """Updates all elements with all new values received from the user application""" received_elements = request.get_json() home_services.update_elements(received_elements) return 'OK' @home_api.route('/elementdelete', methods=['POST']) def delete_element(): """Deletes a single element with given hid""" element = request.get_json() home_services.delete_element(element['hid']) return 'OK' @home_api.route('/timerules', methods=['POST']) def timerules(): """Adds, Updates or deletes time rule for the given element""" rules = request.get_json() if len(rules) == 0: raise Exception("No elements in the list") for rule in rules: if 'id' not in rule: rule['id'] = None home_services.save_time_rules(rules) return 'OK' @home_api.route('/timerules/<string:hid>') def get_timerules(hid): """Gets list of timerules for given hid""" timerules= home_services.read_time_rules(hid) return jsonify(timerules)
#include "stdafx.h" #include "Utilities/Log.h" #include "Utilities/File.h" #include "git-version.h" #include "rpcs3/Ini.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/GameInfo.h" #include "Emu/SysCalls/ModuleManager.h" #include "Emu/Cell/PPUThread.h" #include "Emu/Cell/SPUThread.h" #include "Emu/Cell/PPUInstrTable.h" #include "Emu/FS/vfsFile.h" #include "Emu/FS/vfsLocalFile.h" #include "Emu/FS/vfsDeviceLocalFile.h" #include "Emu/DbgCommand.h" #include "Emu/CPU/CPUThreadManager.h" #include "Emu/SysCalls/Callback.h" #include "Emu/IdManager.h" #include "Emu/Io/Pad.h" #include "Emu/Io/Keyboard.h" #include "Emu/Io/Mouse.h" #include "Emu/RSX/GSManager.h" #include "Emu/Audio/AudioManager.h" #include "Emu/FS/VFS.h" #include "Emu/Event.h" #include "Loader/PSF.h" #include "Loader/ELF64.h" #include "Loader/ELF32.h" #include "../Crypto/unself.h" #include <fstream> using namespace PPU_instr; static const std::string& BreakPointsDBName = "BreakPoints.dat"; static const u16 bpdb_version = 0x1000; extern std::atomic<u32> g_thread_count; extern u64 get_system_time(); extern void <API key>(); Emulator::Emulator() : m_status(Stopped) , m_mode(DisAsm) , m_rsx_callback(0) , m_thread_manager(new CPUThreadManager()) , m_pad_manager(new PadManager()) , m_keyboard_manager(new KeyboardManager()) , m_mouse_manager(new MouseManager()) , m_gs_manager(new GSManager()) , m_audio_manager(new AudioManager()) , m_callback_manager(new CallbackManager()) , m_event_manager(new EventManager()) , m_module_manager(new ModuleManager()) , m_vfs(new VFS()) { m_loader.register_handler(new loader::handlers::elf32); m_loader.register_handler(new loader::handlers::elf64); } Emulator::~Emulator() { } void Emulator::Init() { } void Emulator::SetPath(const std::string& path, const std::string& elf_path) { m_path = path; m_elf_path = elf_path; } void Emulator::SetTitleID(const std::string& id) { m_title_id = id; } void Emulator::SetTitle(const std::string& title) { m_title = title; } bool Emulator::BootGame(const std::string& path, bool direct) { static const char* elf_path[6] = { "/PS3_GAME/USRDIR/BOOT.BIN", "/USRDIR/BOOT.BIN", "/BOOT.BIN", "/PS3_GAME/USRDIR/EBOOT.BIN", "/USRDIR/EBOOT.BIN", "/EBOOT.BIN" }; auto curpath = path; if (direct) { if (fs::is_file(curpath)) { SetPath(curpath); Load(); return true; } } for (int i = 0; i < sizeof(elf_path) / sizeof(*elf_path); i++) { curpath = path + elf_path[i]; if (fs::is_file(curpath)) { SetPath(curpath); Load(); return true; } } return false; } void Emulator::Load() { m_status = Ready; GetModuleManager().Init(); if (!fs::is_file(m_path)) { m_status = Stopped; return; } const std::string elf_dir = m_path.substr(0, m_path.find_last_of("/\\", std::string::npos, 2) + 1); if (IsSelf(m_path)) { const std::string full_name = m_path.substr(elf_dir.length()); const std::string base_name = full_name.substr(0, full_name.find_last_of('.', std::string::npos)); const std::string ext = full_name.substr(base_name.length()); if (fmt::toupper(full_name) == "EBOOT.BIN") { m_path = elf_dir + "BOOT.BIN"; } else if (fmt::toupper(ext) == ".SELF") { m_path = elf_dir + base_name + ".elf"; } else if (fmt::toupper(ext) == ".SPRX") { m_path = elf_dir + base_name + ".prx"; } else { m_path = elf_dir + base_name + ".decrypted" + ext; } LOG_NOTICE(LOADER, "Decrypting '%s%s'...", elf_dir, full_name); if (!DecryptSelf(m_path, elf_dir + full_name)) { m_status = Stopped; return; } } LOG_NOTICE(LOADER, "Loading '%s'...", m_path.c_str()); ResetInfo(); GetVFS().Init(elf_dir); // /dev_bdvd/ mounting vfsFile f("/app_home/../dev_bdvd.path"); if (f.IsOpened()) { // load specified /dev_bdvd/ directory and mount it std::string bdvd; bdvd.resize(f.GetSize()); f.Read(&bdvd[0], bdvd.size()); Emu.GetVFS().Mount("/dev_bdvd/", bdvd, new vfsDeviceLocalFile()); } else if (fs::is_file(elf_dir + "../../PS3_DISC.SFB")) // guess loading disc game { const auto dir_list = fmt::split(elf_dir, { "/", "\\" }); // check latest two directories if (dir_list.size() >= 2 && dir_list.back() == "USRDIR" && *(dir_list.end() - 2) == "PS3_GAME") { // mount detected /dev_bdvd/ directory Emu.GetVFS().Mount("/dev_bdvd/", elf_dir.substr(0, elf_dir.length() - 17), new vfsDeviceLocalFile()); } } LOG_NOTICE(LOADER, ""); LOG_NOTICE(LOADER, "Mount info:"); for (uint i = 0; i < GetVFS().m_devices.size(); ++i) { LOG_NOTICE(LOADER, "%s -> %s", GetVFS().m_devices[i]->GetPs3Path().c_str(), GetVFS().m_devices[i]->GetLocalPath().c_str()); } LOG_NOTICE(LOADER, ""); LOG_NOTICE(LOADER, "RPCS3 version: %s", RPCS3_GIT_VERSION); LOG_NOTICE(LOADER, ""); LOG_NOTICE(LOADER, "Settings:"); LOG_NOTICE(LOADER, "CPU: %s", Ini.CPUIdToString(Ini.CPUDecoderMode.GetValue())); LOG_NOTICE(LOADER, "SPU: %s", Ini.SPUIdToString(Ini.SPUDecoderMode.GetValue())); LOG_NOTICE(LOADER, "Renderer: %s", Ini.RendererIdToString(Ini.GSRenderMode.GetValue())); if (Ini.GSRenderMode.GetValue() == 2) { LOG_NOTICE(LOADER, "D3D Adapter: %s", Ini.AdapterIdToString(Ini.GSD3DAdaptater.GetValue())); } LOG_NOTICE(LOADER, "Resolution: %s", Ini.<API key>(Ini.GSResolution.GetValue())); LOG_NOTICE(LOADER, "Write Depth Buffer: %s", Ini.GSDumpDepthBuffer.GetValue() ? "Yes" : "No"); LOG_NOTICE(LOADER, "Write Color Buffers: %s", Ini.GSDumpColorBuffers.GetValue() ? "Yes" : "No"); LOG_NOTICE(LOADER, "Read Color Buffer: %s", Ini.GSReadColorBuffer.GetValue() ? "Yes" : "No"); LOG_NOTICE(LOADER, "Audio Out: %s", Ini.AudioOutIdToString(Ini.AudioOutMode.GetValue())); LOG_NOTICE(LOADER, "Log Everything: %s", Ini.HLELogging.GetValue() ? "Yes" : "No"); LOG_NOTICE(LOADER, "RSX Logging: %s", Ini.RSXLogging.GetValue() ? "Yes" : "No"); LOG_NOTICE(LOADER, ""); f.Open("/app_home/../PARAM.SFO"); const PSFLoader psf(f); std::string title = psf.GetString("TITLE"); std::string title_id = psf.GetString("TITLE_ID"); LOG_NOTICE(LOADER, "Title: %s", title.c_str()); LOG_NOTICE(LOADER, "Serial: %s", title_id.c_str()); title.length() ? SetTitle(title) : SetTitle(m_path); SetTitleID(title_id); if (m_elf_path.empty()) { GetVFS().GetDeviceLocal(m_path, m_elf_path); LOG_NOTICE(LOADER, "Elf path: %s", m_elf_path); LOG_NOTICE(LOADER, ""); } f.Open(m_elf_path); if (!f.IsOpened()) { LOG_ERROR(LOADER, "Opening '%s' failed", m_path.c_str()); m_status = Stopped; return; } if (!m_loader.load(f)) { LOG_ERROR(LOADER, "Loading '%s' failed", m_path.c_str()); LOG_NOTICE(LOADER, ""); m_status = Stopped; vm::close(); return; } LoadPoints(BreakPointsDBName); GetGSManager().Init(); GetCallbackManager().Init(); GetAudioManager().Init(); GetEventManager().Init(); SendDbgCommand(DID_READY_EMU); } void Emulator::Run() { if (!IsReady()) { Load(); if(!IsReady()) return; } if (IsRunning()) Stop(); if (IsPaused()) { Resume(); return; } SendDbgCommand(DID_START_EMU); m_pause_start_time = 0; m_pause_amend_time = 0; m_status = Running; GetCPU().Exec(); SendDbgCommand(DID_STARTED_EMU); } void Emulator::Pause() { const u64 start = get_system_time(); // try to set Paused status if (!<API key>(&m_status, Running, Paused)) { return; } // update pause start time if (m_pause_start_time.exchange(start)) { LOG_ERROR(GENERAL, "Emulator::Pause() error: concurrent access"); } SendDbgCommand(DID_PAUSE_EMU); for (auto& t : GetCPU().GetAllThreads()) { t->sleep(); // trigger status check } SendDbgCommand(DID_PAUSED_EMU); } void Emulator::Resume() { // get pause start time const u64 time = m_pause_start_time.exchange(0); // try to increment summary pause time if (time) { m_pause_amend_time += get_system_time() - time; } // try to resume if (!<API key>(&m_status, Paused, Running)) { return; } if (!time) { LOG_ERROR(GENERAL, "Emulator::Resume() error: concurrent access"); } SendDbgCommand(DID_RESUME_EMU); for (auto& t : GetCPU().GetAllThreads()) { t->awake(); // untrigger status check and signal } SendDbgCommand(DID_RESUMED_EMU); } extern std::map<u32, std::string> g_armv7_dump; void Emulator::Stop() { LOG_NOTICE(GENERAL, "Stopping emulator..."); if (<API key>(&m_status, Stopped) == Stopped) { return; } SendDbgCommand(DID_STOP_EMU); { LV2_LOCK; // notify all threads for (auto& t : GetCPU().GetAllThreads()) { std::lock_guard<std::mutex> lock(t->mutex); t->sleep(); // trigger status check t->cv.notify_one(); // signal } } LOG_NOTICE(GENERAL, "All threads signaled..."); while (g_thread_count) { std::this_thread::sleep_for(std::chrono::milliseconds(1)); } LOG_NOTICE(GENERAL, "All threads stopped..."); idm::clear(); fxm::clear(); LOG_NOTICE(GENERAL, "Objects cleared..."); <API key>(); for (auto& v : decltype(g_armv7_dump)(std::move(g_armv7_dump))) { LOG_NOTICE(ARMv7, v.second); } m_rsx_callback = 0; // TODO: check finalization order SavePoints(BreakPointsDBName); m_break_points.clear(); m_marked_points.clear(); GetVFS().UnMountAll(); GetGSManager().Close(); GetAudioManager().Close(); GetEventManager().Clear(); GetCPU().Close(); GetPadManager().Close(); GetKeyboardManager().Close(); GetMouseManager().Close(); GetCallbackManager().Clear(); GetModuleManager().Close(); CurGameInfo.Reset(); RSXIOMem.Clear(); vm::close(); SendDbgCommand(DID_STOPPED_EMU); } void Emulator::SavePoints(const std::string& path) { std::ofstream f(path, std::ios::binary | std::ios::trunc); u32 break_count = (u32)m_break_points.size(); u32 marked_count = (u32)m_marked_points.size(); f.write((char*)(&bpdb_version), sizeof(bpdb_version)); f.write((char*)(&break_count), sizeof(break_count)); f.write((char*)(&marked_count), sizeof(marked_count)); if (break_count) { f.write((char*)(m_break_points.data()), sizeof(u64) * break_count); } if (marked_count) { f.write((char*)(m_marked_points.data()), sizeof(u64) * marked_count); } } bool Emulator::LoadPoints(const std::string& path) { if (!fs::is_file(path)) return false; std::ifstream f(path, std::ios::binary); if (!f.is_open()) return false; f.seekg(0, std::ios::end); u64 length = (u64)f.tellg(); f.seekg(0, std::ios::beg); u16 version; u32 break_count, marked_count; u64 expected_length = sizeof(bpdb_version) + sizeof(break_count) + sizeof(marked_count); if (length < expected_length) { LOG_ERROR(LOADER, "'%s' breakpoint db is broken (file is too short, length=0x%x)", path, length); return false; } f.read((char*)(&version), sizeof(version)); if (version != bpdb_version) { LOG_ERROR(LOADER, "'%s' breakpoint db version is unsupported (version=0x%x, length=0x%x)", path, version, length); return false; } f.read((char*)(&break_count), sizeof(break_count)); f.read((char*)(&marked_count), sizeof(marked_count)); expected_length += break_count * sizeof(u64) + marked_count * sizeof(u64); if (expected_length != length) { LOG_ERROR(LOADER, "'%s' breakpoint db format is incorrect " "(version=0x%x, break_count=0x%x, marked_count=0x%x, length=0x%x)", path, version, break_count, marked_count, length); return false; } if (break_count > 0) { m_break_points.resize(break_count); f.read((char*)(m_break_points.data()), sizeof(u64) * break_count); } if (marked_count > 0) { m_marked_points.resize(marked_count); f.read((char*)(m_marked_points.data()), sizeof(u64) * marked_count); } return true; } Emulator Emu; CallAfterCbType CallAfterCallback = nullptr; void CallAfter(std::function<void()> func) { CallAfterCallback(func); } void <API key>(CallAfterCbType cb) { CallAfterCallback = cb; }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/> <meta name="keywords" content="TEMU, dynamic analysis, binary analysis, dynamic taint analysis"/> <meta name="description" content="C/C++/OCaml Source Code Documentation for the TEMU Project."/> <title>TEMU: xed-encoder-hl.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head><body> <p class="title">TEMU: Dynamic Binary Analysis Platform</p> <!-- Generated by Doxygen 1.5.8 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main&nbsp;Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> <li> <form action="search.php" method="get"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td> <td><input type="text" name="query" value="" size="20" accesskey="s"/></td> </tr> </table> </form> </li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File&nbsp;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="<API key>.html">temu-1.0</a>&nbsp;&raquo&nbsp;<a class="el" href="<API key>.html">shared</a>&nbsp;&raquo&nbsp;<a class="el" href="<API key>.html">xed2</a>&nbsp;&raquo&nbsp;<a class="el" href="<API key>.html">xed2-ia32</a>&nbsp;&raquo&nbsp;<a class="el" href="<API key>.html">include</a> </div> </div> <div class="contents"> <a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="preprocessor">#ifndef _XED_ENCODER_HL_H_</span> <a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor"># define _XED_ENCODER_HL_H_</span> <a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#include "xed-types.h"</span> <a name="l00035"></a>00035 <span class="preprocessor">#include "xed-reg-enum.h"</span> <a name="l00036"></a>00036 <span class="preprocessor">#include "xed-state.h"</span> <a name="l00037"></a>00037 <span class="preprocessor">#include "xed-iclass-enum.h"</span> <a name="l00038"></a>00038 <span class="preprocessor">#include "xed-portability.h"</span> <a name="l00039"></a>00039 <span class="preprocessor">#include "xed-encode.h"</span> <a name="l00040"></a>00040 <a name="l00041"></a>00041 <a name="l00042"></a><a class="code" href="<API key>.html">00042</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ <a name="l00043"></a><a class="code" href="<API key>.html#<API key>">00043</a> xed_uint64_t displacement; <a name="l00044"></a><a class="code" href="<API key>.html#<API key>">00044</a> xed_uint32_t displacement_width; <a name="l00045"></a>00045 } <a class="code" href="<API key>.html"><API key></a>; <span class="comment">/* fixme bad name */</span> <a name="l00046"></a>00046 <span class="comment"></span> <a name="l00047"></a>00047 <span class="comment">/// @name Memory Displacement</span> <a name="l00048"></a>00048 <span class="comment"></span><span class="comment">//@{</span> <a name="l00049"></a>00049 <span class="comment"></span><span class="comment">/// @ingroup ENCHL</span> <a name="l00050"></a>00050 <span class="comment"></span><span class="comment">/// a memory displacement (not for branches)</span> <a name="l00051"></a><a class="code" href="<API key>.html#<API key>">00051</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xdisp</a>(xed_uint64_t displacement, <a name="l00052"></a>00052 xed_uint32_t displacement_width ) { <a name="l00053"></a>00053 <a class="code" href="<API key>.html"><API key></a> x; <a name="l00054"></a>00054 x.<a class="code" href="<API key>.html#<API key>">displacement</a> = displacement; <a name="l00055"></a>00055 x.<a class="code" href="<API key>.html#<API key>">displacement_width</a> = displacement_width; <a name="l00056"></a>00056 <span class="keywordflow">return</span> x; <a name="l00057"></a>00057 }<span class="comment"></span> <a name="l00058"></a>00058 <span class="comment">//@}</span> <a name="l00059"></a>00059 <span class="comment"></span> <a name="l00060"></a><a class="code" href="structxed__memop__t.html">00060</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ <a name="l00061"></a><a class="code" href="structxed__memop__t.html#<API key>">00061</a> <a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> seg; <a name="l00062"></a><a class="code" href="structxed__memop__t.html#<API key>">00062</a> <a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> base; <a name="l00063"></a><a class="code" href="structxed__memop__t.html#<API key>">00063</a> <a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> index; <a name="l00064"></a><a class="code" href="structxed__memop__t.html#<API key>">00064</a> xed_uint32_t scale; <a name="l00065"></a><a class="code" href="structxed__memop__t.html#<API key>">00065</a> <a class="code" href="<API key>.html"><API key></a> disp; <a name="l00066"></a>00066 } <a class="code" href="structxed__memop__t.html">xed_memop_t</a>; <a name="l00067"></a>00067 <a name="l00068"></a>00068 <a name="l00069"></a><a class="code" href="<API key>.html#<API key>">00069</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> { <a name="l00070"></a><a class="code" href="<API key>.html#<SHA256-like>">00070</a> <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>, <a name="l00071"></a><a class="code" href="<API key>.html#<SHA256-like>">00071</a> <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>, <a name="l00072"></a><a class="code" href="<API key>.html#<SHA256-like>">00072</a> <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>, <a name="l00073"></a><a class="code" href="<API key>.html#<SHA256-like>">00073</a> <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>, <a name="l00074"></a><a class="code" href="<API key>.html#<SHA256-like>">00074</a> <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>, <a name="l00075"></a><a class="code" href="<API key>.html#<SHA256-like>">00075</a> <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>, <a name="l00076"></a><a class="code" href="<API key>.html#<SHA256-like>">00076</a> <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>, <a name="l00077"></a><a class="code" href="<API key>.html#<SHA256-like>">00077</a> <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>, <a name="l00078"></a><a class="code" href="<API key>.html#<SHA256-like>">00078</a> <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>, <span class="comment">/* special for things with suppressed implicit memops */</span> <a name="l00079"></a><a class="code" href="<API key>.html#<SHA256-like>">00079</a> <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>, <span class="comment">/* special for things with suppressed implicit memops */</span> <a name="l00080"></a><a class="code" href="<API key>.html#<SHA256-like>">00080</a> <a class="code" href="<API key>.html#<SHA256-like>"><API key></a> <span class="comment">/* specific operand storage fields -- must supply a name */</span> <a name="l00081"></a>00081 } <a class="code" href="<API key>.html#<API key>"><API key></a>; <a name="l00082"></a>00082 <a name="l00083"></a><a class="code" href="<API key>.html">00083</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ <a name="l00084"></a><a class="code" href="<API key>.html#<API key>">00084</a> <a class="code" href="<API key>.html#<API key>"><API key></a> type; <a name="l00085"></a>00085 <span class="keyword">union </span>{ <a name="l00086"></a><a class="code" href="<API key>.html#<API key>">00086</a> <a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> reg; <a name="l00087"></a><a class="code" href="<API key>.html#<API key>">00087</a> xed_int32_t brdisp; <a name="l00088"></a><a class="code" href="<API key>.html#<API key>">00088</a> xed_uint64_t <a class="code" href="<API key>.html#<API key>">imm0</a>; <a name="l00089"></a><a class="code" href="<API key>.html#<API key>">00089</a> xed_uint8_t <a class="code" href="<API key>.html#<API key>">imm1</a>; <a name="l00090"></a>00090 <span class="keyword">struct </span>{ <a name="l00091"></a><a class="code" href="<API key>.html#<API key>">00091</a> <a class="code" href="<API key>.html#<API key>">xed_operand_enum_t</a> operand_name; <a name="l00092"></a><a class="code" href="<API key>.html#<API key>">00092</a> xed_uint32_t value; <a name="l00093"></a>00093 } s; <a name="l00094"></a><a class="code" href="<API key>.html#<API key>">00094</a> <a class="code" href="structxed__memop__t.html">xed_memop_t</a> mem; <a name="l00095"></a>00095 } u; <a name="l00096"></a><a class="code" href="<API key>.html#<API key>">00096</a> xed_uint32_t width; <a name="l00097"></a>00097 } <a class="code" href="<API key>.html"><API key></a>; <a name="l00098"></a>00098 <span class="comment"></span> <a name="l00099"></a>00099 <span class="comment">/// @name Branch Displacement</span> <a name="l00100"></a>00100 <span class="comment"></span><span class="comment">//@{</span> <a name="l00101"></a>00101 <span class="comment"></span><span class="comment">/// @ingroup ENCHL</span> <a name="l00102"></a>00102 <span class="comment"></span><span class="comment">/// a relative branch displacement operand</span> <a name="l00103"></a><a class="code" href="<API key>.html#<API key>">00103</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xrelbr</a>(xed_int32_t brdisp, <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> width) { <a name="l00104"></a>00104 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00105"></a>00105 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00106"></a>00106 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">brdisp</a> = brdisp; <a name="l00107"></a>00107 o.<a class="code" href="<API key>.html#<API key>">width</a> = width; <a name="l00108"></a>00108 <span class="keywordflow">return</span> o; <a name="l00109"></a>00109 }<span class="comment"></span> <a name="l00110"></a>00110 <span class="comment">//@}</span> <a name="l00111"></a>00111 <span class="comment"></span><span class="comment"></span> <a name="l00112"></a>00112 <span class="comment">/// @name Pointer Displacement</span> <a name="l00113"></a>00113 <span class="comment"></span><span class="comment">//@{</span> <a name="l00114"></a>00114 <span class="comment"></span><span class="comment">/// @ingroup ENCHL</span> <a name="l00115"></a>00115 <span class="comment"></span><span class="comment">/// a relative displacement for a PTR operand -- the subsequent imm0 holds the 16b selector</span> <a name="l00116"></a><a class="code" href="<API key>.html#<API key>">00116</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xptr</a>(xed_int32_t brdisp, <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> width) { <a name="l00117"></a>00117 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00118"></a>00118 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00119"></a>00119 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">brdisp</a> = brdisp; <a name="l00120"></a>00120 o.<a class="code" href="<API key>.html#<API key>">width</a> = width; <a name="l00121"></a>00121 <span class="keywordflow">return</span> o; <a name="l00122"></a>00122 }<span class="comment"></span> <a name="l00123"></a>00123 <span class="comment">//@}</span> <a name="l00124"></a>00124 <span class="comment"></span><span class="comment"></span> <a name="l00125"></a>00125 <span class="comment">/// @name Register and Immmediate Operands</span> <a name="l00126"></a>00126 <span class="comment"></span><span class="comment">//@{</span> <a name="l00127"></a>00127 <span class="comment"></span><span class="comment">/// @ingroup ENCHL</span> <a name="l00128"></a>00128 <span class="comment"></span><span class="comment">/// a register operand</span> <a name="l00129"></a><a class="code" href="<API key>.html#<API key>">00129</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xreg</a>(<a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> reg) { <a name="l00130"></a>00130 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00131"></a>00131 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00132"></a>00132 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">reg</a> = reg; <a name="l00133"></a>00133 o.<a class="code" href="<API key>.html#<API key>">width</a> = 0; <a name="l00134"></a>00134 <span class="keywordflow">return</span> o; <a name="l00135"></a>00135 } <a name="l00136"></a>00136 <span class="comment"></span> <a name="l00137"></a>00137 <span class="comment">/// @ingroup ENCHL</span> <a name="l00138"></a>00138 <span class="comment">/// a first immediate operand (known as IMM0)</span> <a name="l00139"></a><a class="code" href="<API key>.html#<API key>">00139</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">imm0</a>(xed_uint64_t v, <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> width) { <a name="l00140"></a>00140 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00141"></a>00141 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00142"></a>00142 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">imm0</a> = v; <a name="l00143"></a>00143 o.<a class="code" href="<API key>.html#<API key>">width</a> = width; <a name="l00144"></a>00144 <span class="keywordflow">return</span> o; <a name="l00145"></a>00145 }<span class="comment"></span> <a name="l00146"></a>00146 <span class="comment">/// @ingroup ENCHL</span> <a name="l00147"></a>00147 <span class="comment">/// an 32b signed immediate operand</span> <a name="l00148"></a><a class="code" href="<API key>.html#<API key>">00148</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">simm0</a>(xed_int32_t v, <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> width) { <a name="l00149"></a>00149 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00150"></a>00150 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00155"></a>00155 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">imm0</a> = v; <a name="l00156"></a>00156 o.<a class="code" href="<API key>.html#<API key>">width</a> = width; <a name="l00157"></a>00157 <span class="keywordflow">return</span> o; <a name="l00158"></a>00158 } <a name="l00159"></a>00159 <span class="comment"></span> <a name="l00160"></a>00160 <span class="comment">/// @ingroup ENCHL</span> <a name="l00161"></a>00161 <span class="comment">/// an second immediate operand (known as IMM1)</span> <a name="l00162"></a><a class="code" href="<API key>.html#<API key>">00162</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">imm1</a>(xed_uint8_t v) { <a name="l00163"></a>00163 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00164"></a>00164 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00165"></a>00165 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">imm1</a> = v; <a name="l00166"></a>00166 o.<a class="code" href="<API key>.html#<API key>">width</a> = 8; <a name="l00167"></a>00167 <span class="keywordflow">return</span> o; <a name="l00168"></a>00168 } <a name="l00169"></a>00169 <a name="l00170"></a>00170 <span class="comment"></span> <a name="l00171"></a>00171 <span class="comment">/// @ingroup ENCHL</span> <a name="l00172"></a>00172 <span class="comment">/// an operand storage field name and value</span> <a name="l00173"></a><a class="code" href="<API key>.html#<API key>">00173</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xother</a>(<a class="code" href="<API key>.html#<API key>">xed_operand_enum_t</a> operand_name, <a name="l00174"></a>00174 xed_int32_t value) { <a name="l00175"></a>00175 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00176"></a>00176 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00177"></a>00177 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">s</a>.operand_name = operand_name; <a name="l00178"></a>00178 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">s</a>.value = value; <a name="l00179"></a>00179 o.<a class="code" href="<API key>.html#<API key>">width</a> = 0; <a name="l00180"></a>00180 <span class="keywordflow">return</span> o; <a name="l00181"></a>00181 }<span class="comment"></span> <a name="l00182"></a>00182 <span class="comment">//@}</span> <a name="l00183"></a>00183 <span class="comment"></span> <a name="l00184"></a>00184 <span class="comment"></span> <a name="l00185"></a>00185 <span class="comment">//@}</span> <a name="l00186"></a>00186 <span class="comment"></span><span class="comment"></span> <a name="l00187"></a>00187 <span class="comment">/// @name Memory and Segment-releated Operands</span> <a name="l00188"></a>00188 <span class="comment"></span><span class="comment">//@{</span> <a name="l00189"></a>00189 <span class="comment"></span><span class="comment"></span> <a name="l00190"></a>00190 <span class="comment">/// @ingroup ENCHL</span> <a name="l00191"></a>00191 <span class="comment">/// seg reg override for implicit suppressed memory ops</span> <a name="l00192"></a><a class="code" href="<API key>.html#<API key>">00192</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xseg0</a>(<a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> seg0) { <a name="l00193"></a>00193 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00194"></a>00194 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00195"></a>00195 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">reg</a> = seg0; <a name="l00196"></a>00196 <span class="keywordflow">return</span> o; <a name="l00197"></a>00197 } <a name="l00198"></a>00198 <span class="comment"></span> <a name="l00199"></a>00199 <span class="comment">/// @ingroup ENCHL</span> <a name="l00200"></a>00200 <span class="comment">/// seg reg override for implicit suppressed memory ops</span> <a name="l00201"></a><a class="code" href="<API key>.html#<API key>">00201</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xseg1</a>(<a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> seg1) { <a name="l00202"></a>00202 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00203"></a>00203 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00204"></a>00204 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">reg</a> = seg1; <a name="l00205"></a>00205 <span class="keywordflow">return</span> o; <a name="l00206"></a>00206 } <a name="l00207"></a>00207 <span class="comment"></span> <a name="l00208"></a>00208 <span class="comment">/// @ingroup ENCHL</span> <a name="l00209"></a>00209 <span class="comment">/// memory operand - base only </span> <a name="l00210"></a><a class="code" href="<API key>.html#<API key>">00210</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xmem_b</a>(<a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> base, <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> width) { <a name="l00211"></a>00211 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00212"></a>00212 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00213"></a>00213 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">base</a> = base; <a name="l00214"></a>00214 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">seg</a> = <a class="code" href="<API key>.html#<SHA256-like>">XED_REG_INVALID</a>; <a name="l00215"></a>00215 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">index</a>= <a class="code" href="<API key>.html#<SHA256-like>">XED_REG_INVALID</a>; <a name="l00216"></a>00216 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">scale</a> = 0; <a name="l00217"></a>00217 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">disp</a>.<a class="code" href="<API key>.html#<API key>">displacement</a> = 0; <a name="l00218"></a>00218 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">disp</a>.<a class="code" href="<API key>.html#<API key>">displacement_width</a> = 0; <a name="l00219"></a>00219 o.<a class="code" href="<API key>.html#<API key>">width</a> = width; <a name="l00220"></a>00220 <span class="keywordflow">return</span> o; <a name="l00221"></a>00221 } <a name="l00222"></a>00222 <span class="comment"></span> <a name="l00223"></a>00223 <span class="comment">/// @ingroup ENCHL</span> <a name="l00224"></a>00224 <span class="comment">/// memory operand - base and displacement only </span> <a name="l00225"></a><a class="code" href="<API key>.html#<API key>">00225</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xmem_bd</a>(<a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> base, <a name="l00226"></a>00226 <a class="code" href="<API key>.html"><API key></a> disp, <a name="l00227"></a>00227 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> width) { <a name="l00228"></a>00228 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00229"></a>00229 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00230"></a>00230 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">base</a> = base; <a name="l00231"></a>00231 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">seg</a> = <a class="code" href="<API key>.html#<SHA256-like>">XED_REG_INVALID</a>; <a name="l00232"></a>00232 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">index</a>= <a class="code" href="<API key>.html#<SHA256-like>">XED_REG_INVALID</a>; <a name="l00233"></a>00233 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">scale</a> = 0; <a name="l00234"></a>00234 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">disp</a> =disp; <a name="l00235"></a>00235 o.<a class="code" href="<API key>.html#<API key>">width</a> = width; <a name="l00236"></a>00236 <span class="keywordflow">return</span> o; <a name="l00237"></a>00237 } <a name="l00238"></a>00238 <span class="comment"></span> <a name="l00239"></a>00239 <span class="comment">/// @ingroup ENCHL</span> <a name="l00240"></a>00240 <span class="comment">/// memory operand - base, index, scale, displacement</span> <a name="l00241"></a><a class="code" href="<API key>.html#<API key>">00241</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xmem_bisd</a>(<a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> base, <a name="l00242"></a>00242 <a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> index, <a name="l00243"></a>00243 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> scale, <a name="l00244"></a>00244 <a class="code" href="<API key>.html"><API key></a> disp, <a name="l00245"></a>00245 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> width) { <a name="l00246"></a>00246 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00247"></a>00247 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00248"></a>00248 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">base</a> = base; <a name="l00249"></a>00249 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">seg</a> = <a class="code" href="<API key>.html#<SHA256-like>">XED_REG_INVALID</a>; <a name="l00250"></a>00250 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">index</a>= index; <a name="l00251"></a>00251 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">scale</a> = scale; <a name="l00252"></a>00252 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">disp</a> = disp; <a name="l00253"></a>00253 o.<a class="code" href="<API key>.html#<API key>">width</a> = width; <a name="l00254"></a>00254 <span class="keywordflow">return</span> o; <a name="l00255"></a>00255 } <a name="l00256"></a>00256 <a name="l00257"></a>00257 <span class="comment"></span> <a name="l00258"></a>00258 <span class="comment">/// @ingroup ENCHL</span> <a name="l00259"></a>00259 <span class="comment">/// memory operand - segment and base only</span> <a name="l00260"></a><a class="code" href="<API key>.html#<API key>">00260</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xmem_gb</a>(<a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> seg, <a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> base, <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> width) { <a name="l00261"></a>00261 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00262"></a>00262 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00263"></a>00263 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">base</a> = base; <a name="l00264"></a>00264 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">seg</a> = seg; <a name="l00265"></a>00265 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">index</a>= <a class="code" href="<API key>.html#<SHA256-like>">XED_REG_INVALID</a>; <a name="l00266"></a>00266 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">scale</a> = 0; <a name="l00267"></a>00267 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">disp</a>.<a class="code" href="<API key>.html#<API key>">displacement</a> = 0; <a name="l00268"></a>00268 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">disp</a>.<a class="code" href="<API key>.html#<API key>">displacement_width</a> = 0; <a name="l00269"></a>00269 o.<a class="code" href="<API key>.html#<API key>">width</a> = width; <a name="l00270"></a>00270 <span class="keywordflow">return</span> o; <a name="l00271"></a>00271 } <a name="l00272"></a>00272 <span class="comment"></span> <a name="l00273"></a>00273 <span class="comment">/// @ingroup ENCHL</span> <a name="l00274"></a>00274 <span class="comment">/// memory operand - segment, base and displacement only</span> <a name="l00275"></a><a class="code" href="<API key>.html#<API key>">00275</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xmem_gbd</a>(<a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> seg, <a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> base, <a name="l00276"></a>00276 <a class="code" href="<API key>.html"><API key></a> disp, <a name="l00277"></a>00277 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> width) { <a name="l00278"></a>00278 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00279"></a>00279 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00280"></a>00280 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">base</a> = base; <a name="l00281"></a>00281 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">seg</a> = seg; <a name="l00282"></a>00282 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">index</a>= <a class="code" href="<API key>.html#<SHA256-like>">XED_REG_INVALID</a>; <a name="l00283"></a>00283 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">scale</a> = 0; <a name="l00284"></a>00284 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">disp</a> = disp; <a name="l00285"></a>00285 o.<a class="code" href="<API key>.html#<API key>">width</a> = width; <a name="l00286"></a>00286 <span class="keywordflow">return</span> o; <a name="l00287"></a>00287 } <a name="l00288"></a>00288 <span class="comment"></span> <a name="l00289"></a>00289 <span class="comment">/// @ingroup ENCHL</span> <a name="l00290"></a>00290 <span class="comment">/// memory operand - segment and displacement only</span> <a name="l00291"></a><a class="code" href="<API key>.html#<API key>">00291</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xmem_gd</a>(<a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> seg, <a name="l00292"></a>00292 <a class="code" href="<API key>.html"><API key></a> disp, <a name="l00293"></a>00293 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> width) { <a name="l00294"></a>00294 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00295"></a>00295 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00296"></a>00296 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">base</a> = <a class="code" href="<API key>.html#<SHA256-like>">XED_REG_INVALID</a>; <a name="l00297"></a>00297 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">seg</a> = seg; <a name="l00298"></a>00298 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">index</a>= <a class="code" href="<API key>.html#<SHA256-like>">XED_REG_INVALID</a>; <a name="l00299"></a>00299 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">scale</a> = 0; <a name="l00300"></a>00300 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">disp</a> = disp; <a name="l00301"></a>00301 o.<a class="code" href="<API key>.html#<API key>">width</a> = width; <a name="l00302"></a>00302 <span class="keywordflow">return</span> o; <a name="l00303"></a>00303 } <a name="l00304"></a>00304 <span class="comment"></span> <a name="l00305"></a>00305 <span class="comment">/// @ingroup ENCHL</span> <a name="l00306"></a>00306 <span class="comment">/// memory operand - segment, base, index, scale, and displacement</span> <a name="l00307"></a><a class="code" href="<API key>.html#<API key>">00307</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <a class="code" href="<API key>.html"><API key></a> <a class="code" href="<API key>.html#<API key>">xmem_gbisd</a>(<a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> seg, <a name="l00308"></a>00308 <a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> base, <a name="l00309"></a>00309 <a class="code" href="<API key>.html#<API key>">xed_reg_enum_t</a> index, <a name="l00310"></a>00310 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> scale, <a name="l00311"></a>00311 <a class="code" href="<API key>.html"><API key></a> disp, <a name="l00312"></a>00312 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> width) { <a name="l00313"></a>00313 <a class="code" href="<API key>.html"><API key></a> o; <a name="l00314"></a>00314 o.<a class="code" href="<API key>.html#<API key>">type</a> = <a class="code" href="<API key>.html#<SHA256-like>"><API key></a>; <a name="l00315"></a>00315 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">base</a> = base; <a name="l00316"></a>00316 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">seg</a> = seg; <a name="l00317"></a>00317 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">index</a>= index; <a name="l00318"></a>00318 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">scale</a> = scale; <a name="l00319"></a>00319 o.<a class="code" href="<API key>.html#<API key>">u</a>.<a class="code" href="<API key>.html#<API key>">mem</a>.<a class="code" href="structxed__memop__t.html#<API key>">disp</a> = disp; <a name="l00320"></a>00320 o.<a class="code" href="<API key>.html#<API key>">width</a> = width; <a name="l00321"></a>00321 <span class="keywordflow">return</span> o; <a name="l00322"></a>00322 }<span class="comment"></span> <a name="l00323"></a>00323 <span class="comment">//@}</span> <a name="l00324"></a>00324 <span class="comment"></span> <a name="l00325"></a><a class="code" href="<API key>.html">00325</a> <span class="keyword">typedef</span> <span class="keyword">union </span>{ <a name="l00326"></a>00326 <span class="keyword">struct </span>{ <a name="l00327"></a><a class="code" href="<API key>.html#<API key>">00327</a> xed_uint32_t rep :1; <a name="l00328"></a><a class="code" href="<API key>.html#<API key>">00328</a> xed_uint32_t repne :1; <a name="l00329"></a><a class="code" href="<API key>.html#<API key>">00329</a> xed_uint32_t lock :1; <a name="l00330"></a><a class="code" href="<API key>.html#<API key>">00330</a> xed_uint32_t br_hint_taken :1; <a name="l00331"></a><a class="code" href="<API key>.html#<API key>">00331</a> xed_uint32_t br_hint_not_taken :1; <a name="l00332"></a>00332 } s; <a name="l00333"></a><a class="code" href="<API key>.html#<API key>">00333</a> xed_uint32_t i; <a name="l00334"></a>00334 } <a class="code" href="<API key>.html"><API key></a>; <a name="l00335"></a>00335 <a name="l00336"></a>00336 <span class="preprocessor">#define <API key> 5 </span><span class="comment">/* FIXME */</span> <a name="l00337"></a><a class="code" href="<API key>.html">00337</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ <a name="l00338"></a><a class="code" href="<API key>.html#<API key>">00338</a> <a class="code" href="group__INIT.html#<API key>">xed_state_t</a> mode; <a name="l00339"></a><a class="code" href="<API key>.html#<API key>">00339</a> <a class="code" href="<API key>.html#<API key>">xed_iclass_enum_t</a> iclass; <span class="comment">/*FIXME: use iform instead? or allow either */</span> <a name="l00340"></a><a class="code" href="<API key>.html#<API key>">00340</a> xed_uint32_t <API key>; <a name="l00341"></a>00341 <a name="l00342"></a>00342 <span class="comment">/* the <API key> is only requires to be set for</span> <a name="l00343"></a>00343 <span class="comment"> * instructions * with implicit suppressed memops or memops with no</span> <a name="l00344"></a>00344 <span class="comment"> * base or index regs. When base or index regs are present, XED pick</span> <a name="l00345"></a>00345 <span class="comment"> * this up automatically from the register names.</span> <a name="l00346"></a>00346 <span class="comment"></span> <a name="l00347"></a>00347 <span class="comment"> * FIXME: make <API key> required by all encodes for</span> <a name="l00348"></a>00348 <span class="comment"> * unifority. Add to xed_inst[0123]() APIs??? */</span> <a name="l00349"></a><a class="code" href="<API key>.html#<API key>">00349</a> xed_uint32_t <API key>; <a name="l00350"></a>00350 <a name="l00351"></a><a class="code" href="<API key>.html#<API key>">00351</a> <a class="code" href="<API key>.html"><API key></a> prefixes; <a name="l00352"></a><a class="code" href="<API key>.html#<API key>">00352</a> xed_uint32_t noperands; <a name="l00353"></a><a class="code" href="<API key>.html#<API key>">00353</a> <a class="code" href="<API key>.html"><API key></a> operands[<API key>]; <a name="l00354"></a>00354 } <a class="code" href="<API key>.html"><API key></a>; <a name="l00355"></a>00355 <span class="comment"></span> <a name="l00356"></a>00356 <span class="comment">/// @name Instruction Properties and prefixes</span> <a name="l00357"></a>00357 <span class="comment"></span><span class="comment">//@{</span> <a name="l00358"></a>00358 <span class="comment"></span><span class="comment">/// @ingroup ENCHL</span> <a name="l00359"></a>00359 <span class="comment"></span><span class="comment">/// This is to specify effective address size different than the</span> <a name="l00360"></a>00360 <span class="comment"></span><span class="comment">/// default. For things with base or index regs, XED picks it up from the</span> <a name="l00361"></a>00361 <span class="comment"></span><span class="comment">/// registers. But for things that have implicit memops, or no base or index</span> <a name="l00362"></a>00362 <span class="comment"></span><span class="comment">/// reg, we must allow the user to set the address width directly.</span> <a name="l00363"></a><a class="code" href="<API key>.html#<API key>">00363</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="<API key>.html#<API key>">xaddr</a>(<a class="code" href="<API key>.html"><API key></a>* x, <a name="l00364"></a>00364 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> width) { <a name="l00365"></a>00365 x-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = width; <a name="l00366"></a>00366 } <a name="l00367"></a>00367 <a name="l00368"></a>00368 <span class="comment"></span> <a name="l00369"></a>00369 <span class="comment">/// @ingroup ENCHL</span> <a name="l00370"></a><a class="code" href="<API key>.html#<API key>">00370</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="<API key>.html#<API key>">xrep</a>(<a class="code" href="<API key>.html"><API key></a>* x) { <a name="l00371"></a>00371 x-&gt;<a class="code" href="<API key>.html#<API key>">prefixes</a>.<a class="code" href="<API key>.html#<API key>">s</a>.<a class="code" href="<API key>.html#<API key>">rep</a>=1; <a name="l00372"></a>00372 } <a name="l00373"></a>00373 <span class="comment"></span> <a name="l00374"></a>00374 <span class="comment">/// @ingroup ENCHL</span> <a name="l00375"></a><a class="code" href="<API key>.html#<API key>">00375</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="<API key>.html#<API key>">xrepne</a>(<a class="code" href="<API key>.html"><API key></a>* x) { <a name="l00376"></a>00376 x-&gt;<a class="code" href="<API key>.html#<API key>">prefixes</a>.<a class="code" href="<API key>.html#<API key>">s</a>.<a class="code" href="<API key>.html#<API key>">repne</a>=1; <a name="l00377"></a>00377 } <a name="l00378"></a>00378 <span class="comment"></span> <a name="l00379"></a>00379 <span class="comment">/// @ingroup ENCHL</span> <a name="l00380"></a><a class="code" href="<API key>.html#<API key>">00380</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="<API key>.html#<API key>">xlock</a>(<a class="code" href="<API key>.html"><API key></a>* x) { <a name="l00381"></a>00381 x-&gt;<a class="code" href="<API key>.html#<API key>">prefixes</a>.<a class="code" href="<API key>.html#<API key>">s</a>.<a class="code" href="<API key>.html#<API key>">lock</a>=1; <a name="l00382"></a>00382 } <a name="l00383"></a>00383 <a name="l00384"></a>00384 <a name="l00385"></a>00385 <a name="l00386"></a>00386 <span class="comment"></span> <a name="l00387"></a>00387 <span class="comment">/// @ingroup ENCHL</span> <a name="l00388"></a>00388 <span class="comment">/// convert a #<API key> to a #<API key> for encoding</span> <a name="l00389"></a>00389 <span class="comment"></span><a class="code" href="<API key>.html#<API key>">xed_bool_t</a> <a class="code" href="<API key>.html#<API key>"><API key></a>(<a class="code" href="<API key>.html#<API key>"><API key></a>* out, <a name="l00390"></a>00390 <a class="code" href="<API key>.html"><API key></a>* in); <a name="l00391"></a>00391 <span class="comment"></span> <a name="l00392"></a>00392 <span class="comment">//@}</span> <a name="l00393"></a>00393 <span class="comment"></span><span class="comment"></span> <a name="l00394"></a>00394 <span class="comment">////////////////////////////////////////////////////////////////////////////</span> <a name="l00395"></a>00395 <span class="comment"></span><span class="comment">/* FIXME: rather than return the <API key> I can make</span> <a name="l00396"></a>00396 <span class="comment"> * another version that returns a <API key>. Saves silly</span> <a name="l00397"></a>00397 <span class="comment"> * copying. Although the <API key> might be handy for</span> <a name="l00398"></a>00398 <span class="comment"> * having code templates that get customized &amp; passed to encoder later. */</span><span class="comment"></span> <a name="l00399"></a>00399 <span class="comment">////////////////////////////////////////////////////////////////////////////</span> <a name="l00400"></a>00400 <span class="comment">/// @name Creating instructions from operands</span> <a name="l00401"></a>00401 <span class="comment"></span><span class="comment">//@{</span> <a name="l00402"></a>00402 <span class="comment"></span><span class="comment"></span> <a name="l00403"></a>00403 <span class="comment">/// @ingroup ENCHL</span> <a name="l00404"></a>00404 <span class="comment">/// instruction with no operands</span> <a name="l00405"></a><a class="code" href="<API key>.html#<API key>">00405</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="<API key>.html#<API key>">xed_inst0</a>( <a name="l00406"></a>00406 <a class="code" href="<API key>.html"><API key></a>* inst, <a name="l00407"></a>00407 <a class="code" href="group__INIT.html#<API key>">xed_state_t</a> mode, <a name="l00408"></a>00408 <a class="code" href="<API key>.html#<API key>">xed_iclass_enum_t</a> iclass, <a name="l00409"></a>00409 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> <API key>) { <a name="l00410"></a>00410 <a name="l00411"></a>00411 inst-&gt;<a class="code" href="<API key>.html#<API key>">mode</a>=mode; <a name="l00412"></a>00412 inst-&gt;<a class="code" href="<API key>.html#<API key>">iclass</a> = iclass; <a name="l00413"></a>00413 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = <API key>; <a name="l00414"></a>00414 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = 0; <a name="l00415"></a>00415 inst-&gt;<a class="code" href="<API key>.html#<API key>">prefixes</a>.<a class="code" href="<API key>.html#<API key>">i</a> = 0; <a name="l00416"></a>00416 inst-&gt;<a class="code" href="<API key>.html#<API key>">noperands</a> = 0; <a name="l00417"></a>00417 } <a name="l00418"></a>00418 <span class="comment"></span> <a name="l00419"></a>00419 <span class="comment">/// @ingroup ENCHL</span> <a name="l00420"></a>00420 <span class="comment">/// instruction with one operand</span> <a name="l00421"></a><a class="code" href="<API key>.html#<API key>">00421</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="<API key>.html#<API key>">xed_inst1</a>( <a name="l00422"></a>00422 <a class="code" href="<API key>.html"><API key></a>* inst, <a name="l00423"></a>00423 <a class="code" href="group__INIT.html#<API key>">xed_state_t</a> mode, <a name="l00424"></a>00424 <a class="code" href="<API key>.html#<API key>">xed_iclass_enum_t</a> iclass, <a name="l00425"></a>00425 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> <API key>, <a name="l00426"></a>00426 <a class="code" href="<API key>.html"><API key></a> op0) { <a name="l00427"></a>00427 <a name="l00428"></a>00428 inst-&gt;<a class="code" href="<API key>.html#<API key>">mode</a>=mode; <a name="l00429"></a>00429 inst-&gt;<a class="code" href="<API key>.html#<API key>">iclass</a> = iclass; <a name="l00430"></a>00430 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = <API key>; <a name="l00431"></a>00431 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = 0; <a name="l00432"></a>00432 inst-&gt;<a class="code" href="<API key>.html#<API key>">prefixes</a>.<a class="code" href="<API key>.html#<API key>">i</a> = 0; <a name="l00433"></a>00433 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[0] = op0; <a name="l00434"></a>00434 inst-&gt;<a class="code" href="<API key>.html#<API key>">noperands</a> = 1; <a name="l00435"></a>00435 } <a name="l00436"></a>00436 <span class="comment"></span> <a name="l00437"></a>00437 <span class="comment">/// @ingroup ENCHL</span> <a name="l00438"></a>00438 <span class="comment">/// instruction with two operands</span> <a name="l00439"></a><a class="code" href="<API key>.html#<API key>">00439</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="<API key>.html#<API key>">xed_inst2</a>( <a name="l00440"></a>00440 <a class="code" href="<API key>.html"><API key></a>* inst, <a name="l00441"></a>00441 <a class="code" href="group__INIT.html#<API key>">xed_state_t</a> mode, <a name="l00442"></a>00442 <a class="code" href="<API key>.html#<API key>">xed_iclass_enum_t</a> iclass, <a name="l00443"></a>00443 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> <API key>, <a name="l00444"></a>00444 <a class="code" href="<API key>.html"><API key></a> op0, <a name="l00445"></a>00445 <a class="code" href="<API key>.html"><API key></a> op1) { <a name="l00446"></a>00446 <a name="l00447"></a>00447 inst-&gt;<a class="code" href="<API key>.html#<API key>">mode</a>=mode; <a name="l00448"></a>00448 inst-&gt;<a class="code" href="<API key>.html#<API key>">iclass</a> = iclass; <a name="l00449"></a>00449 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = <API key>; <a name="l00450"></a>00450 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = 0; <a name="l00451"></a>00451 inst-&gt;<a class="code" href="<API key>.html#<API key>">prefixes</a>.<a class="code" href="<API key>.html#<API key>">i</a> = 0; <a name="l00452"></a>00452 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[0] = op0; <a name="l00453"></a>00453 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[1] = op1; <a name="l00454"></a>00454 inst-&gt;<a class="code" href="<API key>.html#<API key>">noperands</a> = 2; <a name="l00455"></a>00455 } <a name="l00456"></a>00456 <span class="comment"></span> <a name="l00457"></a>00457 <span class="comment">/// @ingroup ENCHL</span> <a name="l00458"></a>00458 <span class="comment">/// instruction with three operands</span> <a name="l00459"></a><a class="code" href="<API key>.html#<API key>">00459</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="<API key>.html#<API key>">xed_inst3</a>( <a name="l00460"></a>00460 <a class="code" href="<API key>.html"><API key></a>* inst, <a name="l00461"></a>00461 <a class="code" href="group__INIT.html#<API key>">xed_state_t</a> mode, <a name="l00462"></a>00462 <a class="code" href="<API key>.html#<API key>">xed_iclass_enum_t</a> iclass, <a name="l00463"></a>00463 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> <API key>, <a name="l00464"></a>00464 <a class="code" href="<API key>.html"><API key></a> op0, <a name="l00465"></a>00465 <a class="code" href="<API key>.html"><API key></a> op1, <a name="l00466"></a>00466 <a class="code" href="<API key>.html"><API key></a> op2) { <a name="l00467"></a>00467 <a name="l00468"></a>00468 inst-&gt;<a class="code" href="<API key>.html#<API key>">mode</a>=mode; <a name="l00469"></a>00469 inst-&gt;<a class="code" href="<API key>.html#<API key>">iclass</a> = iclass; <a name="l00470"></a>00470 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = <API key>; <a name="l00471"></a>00471 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = 0; <a name="l00472"></a>00472 inst-&gt;<a class="code" href="<API key>.html#<API key>">prefixes</a>.<a class="code" href="<API key>.html#<API key>">i</a> = 0; <a name="l00473"></a>00473 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[0] = op0; <a name="l00474"></a>00474 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[1] = op1; <a name="l00475"></a>00475 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[2] = op2; <a name="l00476"></a>00476 inst-&gt;<a class="code" href="<API key>.html#<API key>">noperands</a> = 3; <a name="l00477"></a>00477 } <a name="l00478"></a>00478 <a name="l00479"></a>00479 <span class="comment"></span> <a name="l00480"></a>00480 <span class="comment">/// @ingroup ENCHL</span> <a name="l00481"></a>00481 <span class="comment">/// instruction with four operands</span> <a name="l00482"></a><a class="code" href="<API key>.html#<API key>">00482</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="<API key>.html#<API key>">xed_inst4</a>( <a name="l00483"></a>00483 <a class="code" href="<API key>.html"><API key></a>* inst, <a name="l00484"></a>00484 <a class="code" href="group__INIT.html#<API key>">xed_state_t</a> mode, <a name="l00485"></a>00485 <a class="code" href="<API key>.html#<API key>">xed_iclass_enum_t</a> iclass, <a name="l00486"></a>00486 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> <API key>, <a name="l00487"></a>00487 <a class="code" href="<API key>.html"><API key></a> op0, <a name="l00488"></a>00488 <a class="code" href="<API key>.html"><API key></a> op1, <a name="l00489"></a>00489 <a class="code" href="<API key>.html"><API key></a> op2, <a name="l00490"></a>00490 <a class="code" href="<API key>.html"><API key></a> op3) { <a name="l00491"></a>00491 <a name="l00492"></a>00492 inst-&gt;<a class="code" href="<API key>.html#<API key>">mode</a>=mode; <a name="l00493"></a>00493 inst-&gt;<a class="code" href="<API key>.html#<API key>">iclass</a> = iclass; <a name="l00494"></a>00494 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = <API key>; <a name="l00495"></a>00495 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = 0; <a name="l00496"></a>00496 inst-&gt;<a class="code" href="<API key>.html#<API key>">prefixes</a>.<a class="code" href="<API key>.html#<API key>">i</a> = 0; <a name="l00497"></a>00497 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[0] = op0; <a name="l00498"></a>00498 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[1] = op1; <a name="l00499"></a>00499 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[2] = op2; <a name="l00500"></a>00500 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[3] = op3; <a name="l00501"></a>00501 inst-&gt;<a class="code" href="<API key>.html#<API key>">noperands</a> = 4; <a name="l00502"></a>00502 } <a name="l00503"></a>00503 <span class="comment"></span> <a name="l00504"></a>00504 <span class="comment">/// @ingroup ENCHL</span> <a name="l00505"></a>00505 <span class="comment">/// instruction with five operands</span> <a name="l00506"></a><a class="code" href="<API key>.html#<API key>">00506</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="<API key>.html#<API key>">xed_inst5</a>( <a name="l00507"></a>00507 <a class="code" href="<API key>.html"><API key></a>* inst, <a name="l00508"></a>00508 <a class="code" href="group__INIT.html#<API key>">xed_state_t</a> mode, <a name="l00509"></a>00509 <a class="code" href="<API key>.html#<API key>">xed_iclass_enum_t</a> iclass, <a name="l00510"></a>00510 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> <API key>, <a name="l00511"></a>00511 <a class="code" href="<API key>.html"><API key></a> op0, <a name="l00512"></a>00512 <a class="code" href="<API key>.html"><API key></a> op1, <a name="l00513"></a>00513 <a class="code" href="<API key>.html"><API key></a> op2, <a name="l00514"></a>00514 <a class="code" href="<API key>.html"><API key></a> op3, <a name="l00515"></a>00515 <a class="code" href="<API key>.html"><API key></a> op4) { <a name="l00516"></a>00516 <a name="l00517"></a>00517 inst-&gt;<a class="code" href="<API key>.html#<API key>">mode</a>=mode; <a name="l00518"></a>00518 inst-&gt;<a class="code" href="<API key>.html#<API key>">iclass</a> = iclass; <a name="l00519"></a>00519 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = <API key>; <a name="l00520"></a>00520 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = 0; <a name="l00521"></a>00521 inst-&gt;<a class="code" href="<API key>.html#<API key>">prefixes</a>.<a class="code" href="<API key>.html#<API key>">i</a> = 0; <a name="l00522"></a>00522 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[0] = op0; <a name="l00523"></a>00523 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[1] = op1; <a name="l00524"></a>00524 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[2] = op2; <a name="l00525"></a>00525 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[3] = op3; <a name="l00526"></a>00526 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[4] = op4; <a name="l00527"></a>00527 inst-&gt;<a class="code" href="<API key>.html#<API key>">noperands</a> = 5; <a name="l00528"></a>00528 } <a name="l00529"></a>00529 <a name="l00530"></a>00530 <span class="comment"></span> <a name="l00531"></a>00531 <span class="comment">/// @ingroup ENCHL</span> <a name="l00532"></a>00532 <span class="comment">/// instruction with an array of operands. The maximum number is</span> <a name="l00533"></a>00533 <span class="comment">/// <API key>. The array's contents are copied.</span> <a name="l00534"></a><a class="code" href="<API key>.html#<API key>">00534</a> <span class="comment"></span>XED_INLINE <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="<API key>.html#<API key>">xed_inst</a>( <a name="l00535"></a>00535 <a class="code" href="<API key>.html"><API key></a>* inst, <a name="l00536"></a>00536 <a class="code" href="group__INIT.html#<API key>">xed_state_t</a> mode, <a name="l00537"></a>00537 <a class="code" href="<API key>.html#<API key>">xed_iclass_enum_t</a> iclass, <a name="l00538"></a>00538 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> <API key>, <a name="l00539"></a>00539 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> number_of_operands, <a name="l00540"></a>00540 <span class="keyword">const</span> <a class="code" href="<API key>.html"><API key></a>* operand_array) { <a name="l00541"></a>00541 <a name="l00542"></a>00542 <a class="code" href="<API key>.html#<API key>">xed_uint_t</a> i; <a name="l00543"></a>00543 inst-&gt;<a class="code" href="<API key>.html#<API key>">mode</a>=mode; <a name="l00544"></a>00544 inst-&gt;<a class="code" href="<API key>.html#<API key>">iclass</a> = iclass; <a name="l00545"></a>00545 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = <API key>; <a name="l00546"></a>00546 inst-&gt;<a class="code" href="<API key>.html#<API key>"><API key></a> = 0; <a name="l00547"></a>00547 inst-&gt;<a class="code" href="<API key>.html#<API key>">prefixes</a>.<a class="code" href="<API key>.html#<API key>">i</a> = 0; <a name="l00548"></a>00548 xed_assert(number_of_operands &lt; <API key>); <a name="l00549"></a>00549 <span class="keywordflow">for</span>(i=0;i&lt;number_of_operands;i++) { <a name="l00550"></a>00550 inst-&gt;<a class="code" href="<API key>.html#<API key>">operands</a>[i] = operand_array[i]; <a name="l00551"></a>00551 } <a name="l00552"></a>00552 inst-&gt;<a class="code" href="<API key>.html#<API key>">noperands</a> = number_of_operands; <a name="l00553"></a>00553 } <a name="l00554"></a>00554 <span class="comment"></span> <a name="l00555"></a>00555 <span class="comment">//@}</span> <a name="l00556"></a>00556 <span class="comment"></span> <a name="l00557"></a>00557 <span class="comment">/*</span> <a name="l00558"></a>00558 <span class="comment"> <API key> x,y;</span> <a name="l00559"></a>00559 <span class="comment"></span> <a name="l00560"></a>00560 <span class="comment"> xed_inst2(&amp;x, state, XED_ICLASS_ADD, 32, </span> <a name="l00561"></a>00561 <span class="comment"> xreg(XED_REG_EAX), </span> <a name="l00562"></a>00562 <span class="comment"> xmem_bd(XED_REG_EDX, xdisp(0x11223344, 32), 32));</span> <a name="l00563"></a>00563 <span class="comment"> </span> <a name="l00564"></a>00564 <span class="comment"> xed_inst2(&amp;y, state, XED_ICLASS_ADD, 32, </span> <a name="l00565"></a>00565 <span class="comment"> xreg(XED_REG_EAX), </span> <a name="l00566"></a>00566 <span class="comment"> xmem_gbisd(XED_REG_FS, XED_REG_EAX, XED_REG_ESI,4, xdisp(0x11223344, 32), 32));</span> <a name="l00567"></a>00567 <span class="comment"></span> <a name="l00568"></a>00568 <span class="comment"> */</span> <a name="l00569"></a>00569 <a name="l00570"></a>00570 <span class="preprocessor">#endif</span> </pre></div></div> <hr> <p class="footer"> Generated on Fri Mar 30 16:18:24 2012 for <a href="http://bitblaze.cs.berkeley.edu/temu.html">TEMU</a> by <a href="http: align="middle" border="0"/>1.5.8</a><br/> Copyright &copy; 2008-2009, BitBlaze Project. All Rights Reserved.</p> <hr> <!--#include virtual="/attrib.incl" --> </body> </html>
BoardConnetServer ============== server application that run on embedded linux based development boards ( Begalbone Bone, Beagleboard, Altera SocKit, Xilinx ZedBoard ) connects to android app
<!DOCTYPE html PUBLIC "- <html xmlns="http: <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>Luayats: src/src/bssrc.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.1 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main&nbsp;Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File&nbsp;List</span></a></li> <li><a href="globals.html"><span>File&nbsp;Members</span></a></li> </ul> </div> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="comment">// changed 2004-10-15: included <API key> variable.</span> <a name="l00031"></a>00031 <span class="comment">// If <API key> is set to 1, the burst and silence</span> <a name="l00032"></a>00032 <span class="comment">// lengths are fix, not chosen from a distribution</span> <a name="l00033"></a>00033 <a name="l00034"></a>00034 <span class="preprocessor">#ifndef _BSSRC_H_</span> <a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor">#define _BSSRC_H_</span> <a name="l00036"></a>00036 <span class="preprocessor"></span> <a name="l00037"></a>00037 <span class="preprocessor">#include &quot;<a class="code" href="in1out_8h.html">in1out.h</a>&quot;</span> <a name="l00038"></a>00038 <a name="l00039"></a>00039 <span class="comment">//tolua_begin</span> <a name="l00040"></a><a class="code" href="classbssrc.html">00040</a> <span class="keyword">class </span><a class="code" href="classbssrc.html">bssrc</a>: <span class="keyword">public</span> <a class="code" href="classin1out.html">in1out</a> { <a name="l00041"></a>00041 <span class="keyword">typedef</span> <a class="code" href="classin1out.html">in1out</a> <a class="code" href="classino.html">baseclass</a>; <a name="l00042"></a>00042 <a name="l00043"></a>00043 <span class="keyword">public</span>: <a name="l00044"></a>00044 <a class="code" href="classbssrc.html#<API key>">bssrc</a>(); <a name="l00045"></a>00045 <a class="code" href="classbssrc.html#<API key>">~bssrc</a>(); <a name="l00046"></a>00046 <a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classbssrc.html#<API key>">SetDeterministicEx</a>(<span class="keywordtype">int</span> det); <span class="comment">// included 2004-10-29</span> <a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classbssrc.html#<API key>">SetDeterministicEs</a>(<span class="keywordtype">int</span> det); <span class="comment">// included 2004-10-29</span> <a name="l00049"></a>00049 <a name="l00050"></a>00050 <span class="keywordtype">int</span> <a class="code" href="classbssrc.html#<API key>">act</a>(<span class="keywordtype">void</span>); <a name="l00051"></a>00051 <a name="l00052"></a><a class="code" href="classbssrc.html#<API key>">00052</a> <span class="keywordtype">double</span> <a class="code" href="classbssrc.html#<API key>">ex</a>; <a name="l00053"></a><a class="code" href="classbssrc.html#<API key>">00053</a> <span class="keywordtype">double</span> <a class="code" href="classbssrc.html#<API key>">es</a>; <a name="l00054"></a><a class="code" href="classbssrc.html#<API key>">00054</a> <span class="keywordtype">int</span> <a class="code" href="classbssrc.html#<API key>">delta</a>; <a name="l00055"></a><a class="code" href="classbssrc.html#<API key>">00055</a> <span class="keywordtype">int</span> <a class="code" href="classbssrc.html#<API key>">dist_burst</a>; <a name="l00056"></a><a class="code" href="classbssrc.html#<API key>">00056</a> <span class="keywordtype">int</span> <a class="code" href="classbssrc.html#<API key>">dist_silence</a>; <a name="l00057"></a><a class="code" href="classbssrc.html#<API key>">00057</a> <span class="keywordtype">int</span> <a class="code" href="classbssrc.html#<API key>">state</a>; <span class="comment">/* current state:</span> <a name="l00058"></a>00058 <span class="comment"> * is decremented with each sent cell. If</span> <a name="l00059"></a>00059 <span class="comment"> * state = 0, the current burst is finished</span> <a name="l00060"></a>00060 <span class="comment"> */</span> <a name="l00061"></a><a class="code" href="classbssrc.html#<API key>">00061</a> <span class="keywordtype">int</span> <a class="code" href="classbssrc.html#<API key>">deterministic_ex</a>; <span class="comment">// included 2004-10-15</span> <a name="l00062"></a><a class="code" href="classbssrc.html#<API key>">00062</a> <span class="keywordtype">int</span> <a class="code" href="classbssrc.html#<API key>">deterministic_es</a>; <span class="comment">// included 2004-10-15</span> <a name="l00063"></a>00063 <span class="comment">//tolua_end</span> <a name="l00064"></a>00064 <a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classbssrc.html#<API key>">early</a>(<a class="code" href="classevent.html">event</a> *); <a name="l00066"></a>00066 }; <span class="comment">//tolua_export</span> <a name="l00067"></a>00067 <a name="l00068"></a>00068 <span class="preprocessor">#endif // _BSSRC_H_</span> </pre></div></div> <hr size="1"/><address style="text-align: right;"><small>Generated on Sun Feb 14 12:31:42 2010 for Luayats by&nbsp; <a href="http: <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> </body> </html>
<?php defined('GANTRY_VERSION') or die; gantry_import('core.config.gantryformgroup'); gantry_import('core.config.gantryformfield'); class <API key> extends GantryFormGroup { protected $type = 'enabledgroup'; protected $baseetype = 'group'; protected $sets = array(); protected $enabler; public function getInput() { global $gantry; $buffer = ''; // get the sets just below foreach ($this->fields as $field) { if ($field->type == 'set') { $this->sets[] = $field; } } $buffer .= "<div class='wrapper'>\n"; foreach ($this->fields as $field) { if ((string)$field->type != 'set') { $enabler = false; if ($field->element['enabler'] && (string)$field->element['enabler'] == true){ $this->enabler = $field; $enabler = true; } $itemName = $this->fieldname . "-" . $field->fieldname; $buffer .= '<div class="chain ' . $itemName . ' chain-' . strtolower($field->type) . '">' . "\n"; if (strlen($field->getLabel())) $buffer .= '<span class="chain-label">' . JText::_($field->getLabel()) . '</span>' . "\n"; if ($enabler) $buffer .= '<div class="enabledset-enabler">'."\n"; $buffer .= $field->getInput(); if ($enabler) $buffer .= '</div>'."\n"; $buffer .= "</div>" . "\n"; } } $buffer .= "</div>" . "\n"; return $buffer; } public function render($callback) { $buffer = parent::render($callback); $cls = ' <API key>'; if (!empty($this->sets)){ $set = array_shift($this->sets); if (isset($this->enabler) && (int)$this->enabler->value == 0){ $cls = ' <API key>'; } $buffer .= '<div class="enabledset-fields'.$cls.'" id="set-'.(string)$set->element['name'].'">'; foreach ($set->fields as $field) { if ($field->type == 'hidden') $buffer .= $field->getInput(); else { $buffer .= $field->render($callback); } } $buffer .= '</div>'; } return $buffer; } }
<div class="form-horizontal"> <h3>Create a new Data</h3> <div class="form-group"> <div class="col-md-offset-2 col-sm-2"> <a id="Create" name="Create" class="btn btn-primary" href="#/DataConfig/new"><span class="glyphicon glyphicon-plus-sign"></span> Create</a> </div> </div> </div> <hr /> <div> <h3>Search for Data</h3> <form id="DataConfigSearch" class="form-horizontal"> <div class="form-group"> <label for="project" class="col-sm-2 control-label">Project</label> <div class="col-sm-10"> <input id="project" name="project" class="form-control" type="text" ng-model="search.baseConfig.id.project" placeholder="Enter the Project Name"></input> </div> </div> <div class="form-group"> <label for="buildVersion" class="col-sm-2 control-label">Build Version</label> <div class="col-sm-10"> <input id="buildVersion" name="buildVersion" class="form-control" type="text" ng-model="search.baseConfig.id.buildVersion" placeholder="Enter the Build Version"></input> </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-sm-10"> <a id="Search" name="Search" class="btn btn-primary" ng-click="performSearch()"><span class="glyphicon glyphicon-search"></span> Search</a> </div> </div> </form> </div> <div id="search-results"> <div class="table-responsive"> <table class="table table-responsive table-bordered table-striped clearfix"> <thead> <tr> <th>Name</th> <th>Browser</th> <th>Status</th> <th>Description</th> </tr> </thead> <tbody id="search-results-body"> <tr ng-repeat="result in searchResults | searchFilter:searchResults | startFrom:currentPage*pageSize | limitTo:pageSize"> <td><a href="#/DataConfig/edit/{{result.id}}">{{result.scriptName}}</a></td> <td><a href="#/DataConfig/edit/{{result.id}}">{{result.browser}}</a></td> <td><a href="#/DataConfig/edit/{{result.id}}">{{result.status}}</a></td> <td><a href="#/DataConfig/edit/{{result.id}}">{{result.description}}</a></td> </tr> </tbody> </table> </div> <ul class="pagination pagination-centered"> <li ng-class="{disabled:currentPage == 0}"><a id="prev" href ng-click="previous()">«</a></li> <li ng-repeat="n in pageRange" ng-class="{active:currentPage == n}" ng-click="setPage(n)"><a href ng-bind="n + 1">1</a></li> <li ng-class="{disabled: currentPage == (numberOfPages() - 1)}"> <a id="next" href ng-click="next()">»</a> </li> </ul> </div>
% custom packages \usepackage{config/textpos} \setlength{\TPHorizModule}{1cm} \setlength{\TPVertModule}{1cm} \newcommand\crule[1][black]{\textcolor{#1}{\rule{2cm}{2cm}}} \newcommand{\hugetextsc}[1]{ { \begin{spacing}{\linespaceone} \textsc{\fontsize{\fontsizeone}{\fontsizeone}{\notosansfont \end{spacing} } } \newcommand{\btVFill}{\vskip0pt plus 1filll} \newcommand{\frameanimation}[4]{ { \<API key>{% \setbeamercolor{background canvas}{bg=black} \tikz[overlay,remember picture] \node[opacity=1, at=(current page.center)] { \animategraphics[loop,width=\paperwidth,autoplay]{#4}{#1}{#2}{#3} }; } \begin{frame}[plain] \end{frame} } } \usepackage{animate} \usepackage{graphicx} \usepackage{multimedia} \usepackage{media9}[2013/11/04] % Partial derivatives \newcommand*{\pd}[3][]{\ensuremath{\frac{\partial^{#1} #2}{\partial #3}}} % Letters \newcommand{\R}{\mathbb{R}} % Algorithms \usepackage{algorithm} \usepackage[noend]{algpseudocode}
#ifndef <API key> #define <API key> #include <list> #include <string> #include <kvdb/kvdb.h> #include <fileutil/dso.h> #include <decoderbase/decoder.h> #include <kvalobs/kvTypes.h> #include <boost/noncopyable.hpp> #include <miconfparser/miconfparser.h> /** * \addtogroup kvdecoder * * @{ */ extern "C" { typedef kvalobs::decoder::DecoderBase* (*decoderFactory)(dnmi::db::Connection &con_, const ParamList &params, const std::list<kvalobs::kvTypes> &typeList, int decoderId_, const std::string &observationType_, const std::string &observation_); typedef void (*releaseDecoderFunc)(kvalobs::decoder::DecoderBase* decoder); typedef std::list<std::string> (*getObsTypes)(); typedef std::list<std::string> (*getObsTypesExt)( miutil::conf::ConfSection *theKvConf); typedef void (*setKvConf)(kvalobs::decoder::DecoderBase* decoder, miutil::conf::ConfSection *theKvConf); } namespace kvalobs { namespace decoder { /** * \brief DecoderMgr is responsible for loading of decoders. */ class DecoderMgr { struct DecoderItem : public boost::noncopyable { decoderFactory factory; releaseDecoderFunc releaseFunc; setKvConf setConf; dnmi::file::DSO *dso; time_t modTime; int decoderCount; int decoderId; std::list<std::string> obsTypes; DecoderItem(decoderFactory factory_, releaseDecoderFunc releaseFunc_, setKvConf setKvConf_, dnmi::file::DSO *dso_, time_t mTime) : factory(factory_), releaseFunc(releaseFunc_), setConf(setKvConf_), dso(dso_), modTime(mTime), decoderCount(0), decoderId(-1) { } ~DecoderItem() { delete dso; } }; typedef std::list<DecoderItem*> DecoderList; typedef std::list<DecoderItem*>::iterator IDecoderList; typedef std::list<DecoderItem*>::const_iterator CIDecoderList; DecoderList decoders; std::string decoderPath; std::string soVersion; miutil::conf::ConfSection *theKvConf; public: DecoderMgr(const std::string &decoderPath_, miutil::conf::ConfSection *theKvConf); DecoderMgr() : theKvConf(0) { } ; ~DecoderMgr(); std::string fixDecoderName(const std::string &driver); void setTheKvConf(miutil::conf::ConfSection *theKvConf); void setDecoderPath(const std::string &decoderPath_); /** * returns true when all decoder has a decoderCount of 0. */ bool readyForUpdate(); void updateDecoders(miutil::conf::ConfSection *theKvConf); void updateDecoders(); DecoderBase *findDecoder(dnmi::db::Connection &connection, const ParamList &params, const std::list<kvalobs::kvTypes> &typeList, const std::string &obsType, const std::string &obs, std::string &errorMsg); void releaseDecoder(DecoderBase *dec); int numberOfDecoders() const { return decoders.size(); } void obsTypes(std::list<std::string> &list); private: void clearDecoders(); }; } } #endif
// This program is free software: you can redistribute it and/or modify // (at your option) any later version. // This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the namespace LeagueSharp.SDK { using System; using System.Collections.Generic; using System.Linq; using LeagueSharp.Data.Enumerations; using LeagueSharp.SDK.Polygons; using LeagueSharp.SDK.Utils; using SharpDX; <summary> Collision class, calculates collision for moving objects. </summary> public static class Collision { #region Static Fields private static MissileClient yasuoWallLeft, yasuoWallRight; private static RectanglePoly yasuoWallPoly; #endregion #region Constructors and Destructors <summary> Initializes static members of the <see cref="Collision" /> class. Static Constructor </summary> static Collision() { GameObject.OnCreate += (sender, args) => { var missile = sender as MissileClient; var spellCaster = missile?.SpellCaster as Obj_AI_Hero; if (spellCaster == null || spellCaster.ChampionName != "Yasuo" || spellCaster.Team == GameObjects.Player.Team) { return; } switch (missile.SData.Name) { case "<API key>": yasuoWallLeft = missile; break; case "<API key>": yasuoWallRight = missile; break; case "<API key>": yasuoWallRight = missile; break; } }; GameObject.OnDelete += (sender, args) => { var missile = sender as MissileClient; if (missile == null) { return; } if (missile.Compare(yasuoWallLeft)) { yasuoWallLeft = null; } else if (missile.Compare(yasuoWallRight)) { yasuoWallRight = null; } }; } #endregion #region Public Methods and Operators <summary> Returns the list of the units that the skill-shot will hit before reaching the set positions. </summary> <param name="positions"> The positions. </param> <param name="input"> The input. </param> <returns> A list of <c>Obj_AI_Base</c>s which the input collides with. </returns> public static List<Obj_AI_Base> GetCollision(List<Vector3> positions, PredictionInput input) { var result = new List<Obj_AI_Base>(); foreach (var position in positions) { if (input.CollisionObjects.HasFlag(<API key>.Minions)) { result.AddRange( GameObjects.EnemyMinions.Where(i => i.IsMinion() || i.IsPet()) .Concat(GameObjects.Jungle) .Where( minion => minion.IsValidTarget( Math.Min(input.Range + input.Radius + 100, 2000), true, input.RangeCheckFrom) && IsHitCollision(minion, input, position, 20))); } if (input.CollisionObjects.HasFlag(<API key>.Heroes)) { result.AddRange( GameObjects.EnemyHeroes.Where( hero => hero.IsValidTarget( Math.Min(input.Range + input.Radius + 100, 2000), true, input.RangeCheckFrom) && IsHitCollision(hero, input, position, 50))); } if (input.CollisionObjects.HasFlag(<API key>.Walls)) { var step = position.Distance(input.From) / 20; for (var i = 0; i < 20; i++) { if (input.From.ToVector2().Extend(position, step * i).IsWall()) { result.Add(GameObjects.Player); } } } if (input.CollisionObjects.HasFlag(<API key>.YasuoWall)) { if (yasuoWallLeft == null || yasuoWallRight == null) { continue; } yasuoWallPoly = new RectanglePoly(yasuoWallLeft.Position, yasuoWallRight.Position, 75); var intersections = new List<Vector2>(); for (var i = 0; i < yasuoWallPoly.Points.Count; i++) { var inter = yasuoWallPoly.Points[i].Intersection( yasuoWallPoly.Points[i != yasuoWallPoly.Points.Count - 1 ? i + 1 : 0], input.From.ToVector2(), position.ToVector2()); if (inter.Intersects) { intersections.Add(inter.Point); } } if (intersections.Count > 0) { result.Add(GameObjects.Player); } } } return result.Distinct().ToList(); } #endregion #region Methods private static bool IsHitCollision(Obj_AI_Base collision, PredictionInput input, Vector3 pos, float extraRadius) { var inputSub = input.Clone() as PredictionInput; if (inputSub == null) { return false; } inputSub.Unit = collision; var predPos = Movement.GetPrediction(inputSub, false, false).UnitPosition.ToVector2(); return predPos.Distance(input.From) < input.Radius + input.Unit.BoundingRadius / 2 || predPos.Distance(pos) < input.Radius + input.Unit.BoundingRadius / 2 || predPos.DistanceSquared(input.From.ToVector2(), pos.ToVector2(), true) <= Math.Pow(input.Radius + input.Unit.BoundingRadius + extraRadius, 2); } #endregion } }