answer
stringlengths 15
1.25M
|
|---|
package ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMU.status;
import ch.quantasy.iot.mqtt.base.AHandler;
import ch.quantasy.iot.mqtt.base.message.AStatus;
import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMU.IMU;
import org.eclipse.paho.client.mqttv3.MqttAsyncClient;
/**
*
* @author Reto E. Koenig <reto.koenig@bfh.ch>
*/
public class AllDataPeriodStatus extends AStatus {
public AllDataPeriodStatus(AHandler deviceHandler, String statusTopic, MqttAsyncClient mqttClient) {
super(deviceHandler, statusTopic, "allData", mqttClient);
super.addDescription(IMU.PERIOD, Long.class, "JSON", "0", "..", "" + Long.MAX_VALUE);
}
}
|
#ifndef MUX_CLOCK_H
#define MUX_CLOCK_H
/**
* Initializes main system clock.
* @ms time between each tick in milliseconds
* @tick function to run every tick
*/
void clock_init(int ms, void (*tick)());
/**
* Starts main system clock.
*/
void clock_start();
/**
* Stops main system clock.
*/
void clock_stop();
#endif
|
package com.karniyarik.common.util;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import org.apache.commons.lang.StringUtils;
import com.karniyarik.common.<API key>;
import com.karniyarik.common.config.system.DeploymentConfig;
import com.karniyarik.common.config.system.WebConfig;
public class IndexMergeUtil
{
public static final String SITE_NAME_PARAMETER = "s";
public static final void callMergeSiteIndex(String siteName) throws Throwable
{
callMergeSiteIndex(siteName, false);
}
public static final void callMergeSiteIndex(String siteName, boolean reduceBoost) throws Throwable
{
WebConfig webConfig = <API key>.getInstance().getConfig().<API key>().getWebConfig();
DeploymentConfig config = <API key>.getInstance().getConfig().<API key>().getDeploymentConfig();
String url = config.getMasterWebUrl();
URL servletURL = null;
URLConnection connection = null;
InputStream is = null;
String tail = webConfig.<API key>() + "?" + SITE_NAME_PARAMETER + "=" + siteName;
if (StringUtils.isNotBlank(url))
{
if(!tail.startsWith("/") && !url.endsWith("/"))
{
url += "/";
}
url += tail;
if(reduceBoost)
{
url += "&rb=true";
}
servletURL = new URL(url);
connection = servletURL.openConnection();
connection.connect();
is = connection.getInputStream();
is.close();
}
servletURL = null;
connection = null;
is = null;
tail = null;
}
public static void callReduceSiteIndex(String siteName) throws Throwable{
callMergeSiteIndex(siteName, true);
}
public static void main(String[] args) throws Throwable{
String[] sites = new String[]{
"hataystore",
"damakzevki", "robertopirlanta", "bebekken", "elektrikmalzemem", "starsexshop", "altinsarrafi", "budatoys", "taffybaby", "medikalcim", "beyazdepo", "tasarimbookshop", "boviza",
"evdepo", "bonnyfood", "beyazkutu", "koctas", "bizimmarket", "narbebe", "gonayakkabi", "tgrtpazarlama", "pasabahce", "vatanbilgisayar", "egerate-store", "dr", "hipernex", "ensarshop",
"yesil", "dealextreme", "petsrus", "otoyedekparcaburada", "elektrikdeposu", "alisveris", "radikalteknoloji", "ekopasaj", "strawberrynet", "yenisayfa", "adresimegelsin",
"juenpetmarket", "nadirkitap"};
for(String site: sites)
{
System.out.println(site);
callMergeSiteIndex(site);
Thread.sleep(10000);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using Newtonsoft.Json;
namespace lit
{
class HttpTransferModule : ITransferModule
{
public const string ConnectionRequest = "subscribe";
public const string StatusRequest = "getstatus";
public const string StatusReport = "status";
private List<string> connections = new List<string>();
private IDictionary<string, string> myRecord;
private readonly HttpListener myListener = new HttpListener();
public List<string> Prefixes { get; set; }
public HttpTransferModule(IConfiguration configuration)
{
if (!HttpListener.IsSupported)
{
throw new <API key>("Needs Windows XP SP2, Server 2003 or later.");
}
// URI prefixes are required, for example
if (string.IsNullOrEmpty(configuration.Transfer.Prefix))
{
throw new ArgumentException("Prefix");
}
Console.WriteLine("using prefix {0}", configuration.Transfer.Prefix);
myListener.Prefixes.Add(configuration.Transfer.Prefix);
}
public void Start()
{
myListener.Start();
ThreadPool.QueueUserWorkItem((o) =>
{
Console.WriteLine("Webserver is running...");
try
{
while (myListener.IsListening)
{
ThreadPool.QueueUserWorkItem((c) =>
{
var ctx = c as HttpListenerContext;
try
{
var simpleResponse = Response(ctx.Request);
var buf = Encoding.UTF8.GetBytes(simpleResponse.Content);
ctx.Response.ContentLength64 = buf.Length;
ctx.Response.OutputStream.Write(buf, 0, buf.Length);
ctx.Response.StatusCode = (int)simpleResponse.StatusCode;
}
catch { } // suppress any exceptions
finally
{
// always close the stream
ctx.Response.OutputStream.Close();
}
}, myListener.GetContext());
}
}
catch { } // suppress any exceptions
});
}
public void ReceiveChanges(IDictionary<string, string> record)
{
myRecord = record;
Console.WriteLine(string.Join(", ",
new List<string>() { "TimeStamp", "Build", "Assembly", "TC", "Status" }.Select(f => record.ContainsKey(f) ? record[f] : "")));
}
public void Stop()
{
myListener.Stop();
myListener.Close();
}
public void Dispose()
{
Stop();
}
private HttpSimpleResponse Response(HttpListenerRequest httpRequest)
{
if (null == httpRequest)
{
return new HttpSimpleResponse(HttpStatusCode.BadRequest, "null");
}
var request = httpRequest.Url.LocalPath.Trim('/');
var client = httpRequest.RemoteEndPoint.Address.ToString();
Console.WriteLine("http {0} request received from {1}: {2}", httpRequest.HttpMethod, client, request);
switch (request)
{
case ConnectionRequest:
if (connections.All(c => c != client))
{
connections.Add(client);
Console.WriteLine("connection request accepted from {0}", client);
}
return new HttpSimpleResponse(HttpStatusCode.OK, RecordAsJson);
case StatusRequest:
return new HttpSimpleResponse(HttpStatusCode.OK, RecordAsJson);
default:
return new HttpSimpleResponse(HttpStatusCode.BadRequest, "he?!");
}
}
private string RecordAsJson
{
get
{
return JsonConvert.SerializeObject(myRecord, typeof(Dictionary<string, string>), Formatting.None,
new <API key>()
{
NullValueHandling = NullValueHandling.Ignore,
<API key> = <API key>.Ignore,
});
}
}
}
}
|
// This file is part of par2cmdline (a PAR 2.0 compatible file verification and
// par2cmdline is free software; you can redistribute it and/or modify
// (at your option) any later version.
// par2cmdline 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// 11/1/05 gmilow - Modified
#include "stdafx.h"
#include "par2cmdline.h"
#ifdef _MSC_VER
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
#endif
// Construct the creator packet.
// The only external information required to complete construction is
// the set_id_hash (which is normally computed from information in the
// main packet).
bool CreatorPacket::Create(const MD5Hash &setid)
{
string creator = "Created by PACKAGE version VERSION .";
// Allocate a packet just large enough for creator name
CREATORPACKET *packet = (CREATORPACKET *)AllocatePacket(sizeof(*packet) + (~3 & (3+(u32)creator.size())));
// Fill in the details the we know
packet->header.magic = packet_magic;
packet->header.length = packetlength;
//packet->header.hash; // Compute shortly
packet->header.setid = setid;
packet->header.type = creatorpacket_type;
// Copy the creator description into the packet
memcpy(packet->client, creator.c_str(), creator.size());
// Compute the packet hash
MD5Context packetcontext;
packetcontext.Update(&packet->header.setid, packetlength - offsetof(PACKET_HEADER, setid));
packetcontext.Final(packet->header.hash);
return true;
}
// Load the packet from disk.
bool CreatorPacket::Load(DiskFile *diskfile, u64 offset, PACKET_HEADER &header)
{
// Is the packet long enough
if (header.length <= sizeof(CREATORPACKET))
{
return false;
}
// Is the packet too large (what is the longest reasonable creator description)
if (header.length - sizeof(CREATORPACKET) > 100000)
{
return false;
}
// Allocate the packet (with a little extra so we will have NULLs after the description)
CREATORPACKET *packet = (CREATORPACKET *)AllocatePacket((size_t)header.length, 4);
packet->header = header;
// Load the rest of the packet from disk
return diskfile->Read(offset + sizeof(PACKET_HEADER),
packet->client,
(size_t)packet->header.length - sizeof(PACKET_HEADER));
}
|
<!DOCTYPE html>
<html itemscope itemtype="http:
<head>
<title>2010 Vanderbilt Commodores Statistics | College Football at Sports-Reference.com</title>
<script type="text/javascript">var sr_gzipEnabled = false;</script>
<script type="text/javascript" src="http://d2ft4b0ve1aur1.cloudfront.net/js-237/sr.gzipcheck.js.jgz"></script>
<noscript>
<link type="text/css" rel="stylesheet" href="http://d2ft4b0ve1aur1.cloudfront.net/css-237/sr-cfb-min.css">
</noscript>
<script type="text/javascript">
(function () {
var sr_css_file = 'http://d2ft4b0ve1aur1.cloudfront.net/css-237/sr-cfb-min.css';
if (sr_gzipEnabled) {
sr_css_file = 'http://d2ft4b0ve1aur1.cloudfront.net/css-237/sr-cfb-min-gz.css';
}
var head = document.<API key>("head")[0];
if (head) {
var scriptStyles = document.createElement("link");
scriptStyles.rel = "stylesheet";
scriptStyles.type = "text/css";
scriptStyles.href = sr_css_file;
head.appendChild(scriptStyles);
//alert('adding css to header:'+sr_css_file);
}
}());
</script>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="college, ncaa, football, stats, statistics, history, Vanderbilt Commodores, 2010, stats">
<meta property="fb:admins" content="34208645" />
<meta property="fb:page_id" content="185855008121268" />
<meta property="og:site_name" content="College Football at <API key>.com">
<meta property="og:image" content="http://d2ft4b0ve1aur1.cloudfront.net/images-237/SR-College-Football.png">
<meta itemprop="image" content="http://d2ft4b0ve1aur1.cloudfront.net/images-237/SR-College-Football.png">
<meta property="og:description" content="Statistics, Game Logs, Splits, and much more">
<meta property="og:title" content="2010 Vanderbilt Commodores">
<meta property="og:url" content="http:
<meta property="og:type" content="team">
<link rel="canonical" href="http:
<meta itemprop="name" content="2010 Vanderbilt Commodores">
<meta itemprop="description" content="Statistics, Game Logs, Splits, and much more">
<div></div><!-- to prevent hangs on some browsers -->
<link rel="icon" type="image/vnd.microsoft.icon" href="http://d2ft4b0ve1aur1.cloudfront.net/images-237/favicon-cfb.ico">
<link rel="shortcut icon" type="image/vnd.microsoft.icon" href="http://d2ft4b0ve1aur1.cloudfront.net/images-237/favicon-cfb.ico">
<link rel="search" type="application/<API key>+xml" href="http://d2ft4b0ve1aur1.cloudfront.net/os-237/opensearch-cfb.xml" title="CFB-Ref Search">
<!--[if lte IE 6]>
<style type="text/css">
.hovermenu,.hovermenu_ajax,.sub_index,#quick_index {display:none!important}
</style>
<![endif]
</head>
<body>
<div id="page_container">
<div id="top_nav">
<div id="site_header">
<div id="sr_header">
<div class="float_right">
<a href="http:
<a href="http:
<a href="http://www.<API key>.com/">NBA</a> ·
<a href="http:
<a href="http://www.<API key>.com">NFL</a> ·
<span class="bold_text">CFB</span> |
<a href="http:
<a href="http:
<a href="http:
</div>
<div class="clear_both clearfix float_right margin_left padding_top_half">
<a class="sprite-twitter" title="Follow us on Twitter" href="http:
</div>
<div class="float_right">
<form method="get" id="f" name="f" action="/cfb/search.cgi">
<input x-webkit-speech type="search" placeholder="" id="search" name="search" class="search long">
<input type="submit" value="Search" class="submit">
</form>
</div>
</div>
<div class="float_left padding_bottom_half">
<a href="/cfb/"><img src="http://d2ft4b0ve1aur1.cloudfront.net/images-237/SR-College-Football.png" width="464" height="49" class="border0" alt="College Football Statistics & History | College Football at Sports-Reference.com"></a>
</div>
</div>
<div id="<API key>">
<div id="quick_index">
<ul class="hovermenu_ajax navbar">
<li class=""><a href="/cfb/play-index/">play index</a><ul class="li_margin" id="header_playindex"></ul></li>
<li class=""><a href="/cfb/boxscores/">box scores</a><ul class="li_margin" id="header_boxscores"></ul></li>
<li class=""><a href="/cfb/players/">players</a><ul class="li_margin" id="header_players"></ul></li>
<li class="active"><a href="/cfb/schools/">schools</a><ul class="li_margin" id="header_schools"></ul></li>
<li class=""><a href="/cfb/years/">seasons</a><ul class="li_margin" id="header_years"></ul></li>
<li class=""><a href="/cfb/conferences/">conferences</a><ul class="li_margin" id="header_conferences"></ul></li>
<li class=""><a href="/cfb/coaches/">coaches</a><ul class="li_margin" id="header_coaches"></ul></li>
<li class=""><a href="/cfb/leaders/">leaders</a><ul class="li_margin" id="header_leaders"></ul></li>
<li class=""><a href="/cfb/awards/">awards</a><ul class="li_margin" id="header_awards"></ul></li>
<li class=""><a href="/cfb/bowls/">bowls</a><ul class="li_margin" id="header_bowls"></ul></li>
<li class=""><a href="">more [+]</a>
<ul class="li_margin" id="header_more_links">
<li>
<a class="bold_text" href="/cfb/about/">About</a>:
<a href="/cfb/about/what-is-major.html">What is Major?</a>,
<a href="/cfb/about/glossary.html#srs">Simple Rating System</a>,
<a href="/cfb/about/glossary.html">Glossary</a>,
<a href="/cfb/about/sources.html">Sources</a>,
<a href="/cfb/about/contact.html">Contacts</a>,
<a href="/cfb/about/philosophy.html">Philosophy</a>
</li>
<li><a class="bold_text" href="http:
<li>
<a class="bold_text" href="/cfb/friv/">Frivolities</a>:
<a href="/cfb/friv/elo.cgi">Elo School Rater</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="you_are_here">
<p><strong>You Are Here</strong> > <a href="/cfb/">SR/CFB</a> > <a href="/cfb/schools/">Schools</a> > <a href="/cfb/schools/vanderbilt/">Vanderbilt Commodores</a> > <strong>2010</strong></p>
</div>
<style>
.site_news { color:#fff!important; background-color:#747678;
border-top:1px solid #000;
border-bottom: 1px solid #000;
clear:both;
font-size:.875em; width:100%; }
.site_news p { margin:0; padding:.35em .7em; }
.site_news a { color:#fff; }
</style>
<div class="site_news"><p><span class="bold_text">News:</span> <span class="poptip" tip="Just a friendly reminder to check out our Olympics site, which is being updated daily throughout the London games.">s-r blog:<a onClick="try { pageTracker._trackEvent('blog','click','area-yah'); } catch (err) {};"
href="http:
</div>
<div id="info_box">
<div class="advert300x250">
<script type="text/deferscript">
var _ad_d = Math.floor(Math.random()*9999999999+1);
document.write('<scr' + 'ipt src=http://ad.doubleclick.net/adj/<API key>.fsv/ros;sect=ros;fantasy=no;game=no;tile=3;sz=300x250;ord=' + _ad_d + '?></scr' + 'ipt>');
</script>
<noscript>
<a href="http://ad.doubleclick.net/jump/<API key>.fsv/ros;sect=ros;fantasy=no;game=no;tile=3;sz=300x250;ord=?"
><img alt="" SRC="http://ad.doubleclick.net/ad/<API key>.fsv/ros;sect=ros;fantasy=no;game=no;tile=3;sz=300x250;ord=?" border="0" width="300" height="250" ></a>
</noscript>
</div>
<h1>2010 Vanderbilt Commodores Statistics</h1>
<div class="social_media">
<div class="float_left"><span id="fb-root"></span><fb:like width="200" show_faces="0" height="35" ref="team_like"></fb:like></div>
<div class="float_left"><div class="g-plusone" data-size="medium" data-annotation="inline" data-width="150"></div></div>
</div>
<p><a href="/cfb/schools/vanderbilt/">School Index:</a> <a href="/cfb/schools/vanderbilt/2009.html">Previous Year</a> ▪ <a href="/cfb/schools/vanderbilt/2011.html">Next Year</a></p>
<form class="sr_standard inline" name="pages" action="">
<strong>Navigation:</strong>
<select name="cfb_pages" onchange="sr_goto_page('cfb_pages','',this.form);">
<option value="" disabled >Select Page
<option value="/cfb/schools/vanderbilt/2010.html" selected>Statistics
<option value="/cfb/schools/vanderbilt/2010-schedule.html">Schedule and Results
<option value="/cfb/schools/vanderbilt/2010-roster.html">Roster
<option value="/cfb/schools/vanderbilt/2010/gamelog/">Game Log
<option value="/cfb/schools/vanderbilt/2010/splits/">Splits
</select>
</form>
<p class="margin_top"><strong>Conference:</strong> <a href="/cfb/conferences/sec/2010.html">SEC</a> (East Division)
<br><strong>Record:</strong> 2-10, .167 W-L% (109th of 120) (<a href="/cfb/schools/vanderbilt/2010-schedule.html">Schedule and Results</a>)
<br><strong>Coach:</strong> <a href="/cfb/coaches/robbie-caldwell-1.html">Robbie Caldwell</a> (2-10)
<p><strong>PTS/G:</strong> 16.9 (112th of 120) ▪ <strong>Opp PTS/G:</strong> 31.2 (94th of 120)
<br><strong><a href="/cfb/about/glossary.html#srs" onmouseover="Tip('Simple Rating System; a rating that takes into account average point differential and strength of schedule. The rating is denominated in points above/below average, where zero is average.')">SRS</a>:</strong> -9.59 (99th of 120) ▪ <strong><a href="/cfb/about/glossary.html#sos" onmouseover="Tip('Strength of Schedule; a rating of strength of schedule. The rating is denominated in points above/below average, where zero is average.')">SOS</a>:</strong> 4.09 (30th of 120)
</div>
<div class="advert728x90">
<script type="text/deferscript">
var _ad_c = Math.floor(Math.random()*9999999999+1);
document.write('<scr' + 'ipt src=http://ad.doubleclick.net/adj/<API key>.fsv/ros;sect=ros;fantasy=no;game=no;tile=1;dcopt=ist;sz=728x90;ord=' + _ad_c + '?></scr' + 'ipt>');
</script>
<noscript>
<a href="http://ad.doubleclick.net/jump/<API key>.fsv/ros;sect=ros;fantasy=no;game=no;tile=1;sz=728x90;ord='+_ad_c+'?"
><img src="http://ad.doubleclick.net/ad/<API key>.fsv/ros;sect=ros;fantasy=no;game=no;tile=1;sz=728x90;ord='+_ad_c+'?" border="0" height="90" width="728"></a>
</noscript>
</div><div class="clear_both margin0 padding0"></div>
<div id="page_content">
<div class="table_heading">
<h2 style="">Team Statistics</h2>
<div class="table_heading_text">Most values are per game averages</div>
</div>
<div class="table_container" id="div_team">
<table class=" show_controls stats_table" id="team">
<colgroup><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup>
<thead>
<tr class=" over_header">
<th></th>
<th></th>
<th align="center" colspan=5 class="bold_text over_header" >Passing</th>
<th align="center" colspan=4 class="bold_text over_header" >Rushing</th>
<th align="center" colspan=3 class="bold_text over_header" >Total Offense</th>
<th align="center" colspan=4 class="bold_text over_header" >First Downs</th>
<th align="center" colspan=2 class="bold_text over_header" >Penalties</th>
<th align="center" colspan=3 class="bold_text over_header" >Turnovers</th>
</tr>
<tr class="">
<th align="left" class=" sort_default_asc" >Split</th>
<th align="right" class="" tip="Games">G</th>
<th align="right" class="" tip="Pass Completions">Cmp</th>
<th align="right" class="" tip="Pass Attempts">Att</th>
<th align="right" class="" tip="Pass Completion Percentage">Pct</th>
<th align="right" class="" tip="Passing Yards">Yds</th>
<th align="right" class="" tip="Passing Touchdowns">TD</th>
<th align="right" class="" tip="Rush Attempts">Att</th>
<th align="right" class="" tip="Rushing Yards">Yds</th>
<th align="right" class="" tip="Rushing Yards Per Attempt">Avg</th>
<th align="right" class="" tip="Rushing Touchdowns">TD</th>
<th align="right" class="" tip="Plays (Pass Attempts plus Rush Attempts)">Plays</th>
<th align="right" class="" tip="Total Yards (Passing Yards plus Rushing Yards)">Yds</th>
<th align="right" class="" tip="Total Yards Per Play">Avg</th>
<th align="right" class="" tip="First Downs by Pass">Pass</th>
<th align="right" class="" tip="First Downs by Rush">Rush</th>
<th align="right" class="" tip="First Downs by Penalty">Pen</th>
<th align="right" class="" tip="First Downs">Tot</th>
<th align="right" class="" tip="Penalties">No.</th>
<th align="right" class="" tip="Penalty Yards">Yds</th>
<th align="right" class="" tip="Fumbles Lost">Fum</th>
<th align="right" class="" tip="Passing Interceptions">Int</th>
<th align="right" class="" tip="Turnovers">Tot</th>
</tr>
</thead>
<tbody>
<tr class="">
<td align="left" >Offense</td>
<td align="right" >12</td>
<td align="right" >14.1</td>
<td align="right" >30.0</td>
<td align="right" >46.9</td>
<td align="right" >159.4</td>
<td align="right" >0.9</td>
<td align="right" >35.1</td>
<td align="right" >138.8</td>
<td align="right" >4.0</td>
<td align="right" >1.1</td>
<td align="right" >65.1</td>
<td align="right" >298.3</td>
<td align="right" >4.6</td>
<td align="right" >6.8</td>
<td align="right" >7.3</td>
<td align="right" >0.9</td>
<td align="right" >15.0</td>
<td align="right" >5.6</td>
<td align="right" >44.7</td>
<td align="right" >0.7</td>
<td align="right" >0.9</td>
<td align="right" >1.6</td>
</tr>
<tr class="">
<td align="left" >Defense</td>
<td align="right" >12</td>
<td align="right" >18.4</td>
<td align="right" >29.1</td>
<td align="right" >63.3</td>
<td align="right" >226.3</td>
<td align="right" >1.5</td>
<td align="right" >43.3</td>
<td align="right" >193.0</td>
<td align="right" >4.5</td>
<td align="right" >2.1</td>
<td align="right" >72.3</td>
<td align="right" >419.3</td>
<td align="right" >5.8</td>
<td align="right" >9.0</td>
<td align="right" >10.1</td>
<td align="right" >0.8</td>
<td align="right" >19.9</td>
<td align="right" >6.0</td>
<td align="right" >50.6</td>
<td align="right" >0.5</td>
<td align="right" >0.8</td>
<td align="right" >1.3</td>
</tr>
<tr class="">
<td align="left" >Difference</td>
<td align="right" ></td>
<td align="right" >-4.3</td>
<td align="right" >+0.9</td>
<td align="right" >-16.4</td>
<td align="right" >-66.9</td>
<td align="right" >-0.6</td>
<td align="right" >-8.2</td>
<td align="right" >-54.2</td>
<td align="right" >-0.5</td>
<td align="right" >-1.0</td>
<td align="right" >-7.2</td>
<td align="right" >-121.0</td>
<td align="right" >-1.2</td>
<td align="right" >-2.2</td>
<td align="right" >-2.8</td>
<td align="right" >+0.1</td>
<td align="right" >-4.9</td>
<td align="right" >-0.4</td>
<td align="right" >-5.9</td>
<td align="right" >+0.2</td>
<td align="right" >+0.1</td>
<td align="right" >+0.3</td>
</tr>
</tbody>
</table>
</div>
<div class="table_heading">
<h2 style="">Passing</h2>
<div class="table_heading_text"></div>
</div>
<div class="table_container" id="div_passing">
<table class="sortable stats_table" id="passing">
<colgroup><col><col><col><col><col><col><col><col><col><col><col></colgroup>
<thead>
<tr class=" over_header">
<th align="CENTER" colspan=2 class="tooltip over_header" ></th>
<th align="center" colspan=9 class="bold_text over_header" >Passing</th>
</tr>
<tr class="">
<th align="right" class="ranker sort_default_asc" tip="Rank">Rk</th>
<th align="left" class="tooltip sort_default_asc" >Player</th>
<th align="right" class="tooltip" tip="Pass Completions">Cmp</th>
<th align="right" class="tooltip" tip="Pass Attempts">Att</th>
<th align="right" class="tooltip" tip="Pass Completion Percentage">Pct</th>
<th align="right" class="tooltip" tip="Passing Yards">Yds</th>
<th align="right" class="tooltip" tip="Passing Yards Per Attempt">Y/A</th>
<th align="right" class="tooltip" tip="Adjusted Passing Yards Per Attempt; the formula is (Yds + 20 * TD - 45 * Int) / Att">AY/A</th>
<th align="right" class="tooltip" tip="Passing Touchdowns">TD</th>
<th align="right" class="tooltip" tip="Passing Interceptions">Int</th>
<th align="right" class="tooltip" tip="Passing Efficiency Rating; the formula is (8.4 * Yds + 330 * TD - 200 * Int + 100 * Cmp) / Att">Rate</th>
</tr>
</thead>
<tbody>
<tr class="">
<td align="right" csk="1">1</td>
<td align="left" csk="Smith,Larry"><a href="/cfb/players/larry-smith-1.html">Larry Smith</a></td>
<td align="right" >117</td>
<td align="right" >247</td>
<td align="right" >47.4</td>
<td align="right" >1262</td>
<td align="right" >5.1</td>
<td align="right" >4.7</td>
<td align="right" >6</td>
<td align="right" >5</td>
<td align="right" >94.3</td>
</tr>
<tr class="">
<td align="right" csk="2">2</td>
<td align="left" csk="Funk,Jared"><a href="/cfb/players/jared-funk-1.html">Jared Funk</a></td>
<td align="right" >52</td>
<td align="right" >109</td>
<td align="right" >47.7</td>
<td align="right" >651</td>
<td align="right" >6.0</td>
<td align="right" >4.4</td>
<td align="right" >5</td>
<td align="right" >6</td>
<td align="right" >102.0</td>
</tr>
<tr class="">
<td align="right" csk="3">3</td>
<td align="left" csk="Barden,Brandon"><a href="/cfb/players/brandon-barden-1.html">Brandon Barden</a></td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >0.0</td>
<td align="right" >0</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" >0</td>
<td align="right" >0</td>
<td align="right" >0.0</td>
</tr>
<tr class="">
<td align="right" csk="4">4</td>
<td align="left" csk="Cole,John"><a href="/cfb/players/john-cole-1.html">John Cole</a></td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >0.0</td>
<td align="right" >0</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" >0</td>
<td align="right" >0</td>
<td align="right" >0.0</td>
</tr>
<tr class="">
<td align="right" csk="5">5</td>
<td align="left" csk="Fowler,Ryan"><a href="/cfb/players/ryan-fowler-2.html">Ryan Fowler</a></td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >0.0</td>
<td align="right" >0</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" >0</td>
<td align="right" >0</td>
<td align="right" >0.0</td>
</tr>
<tr class="">
<td align="right" csk="6">6</td>
<td align="left" csk="Wimberly,Turner"><a href="/cfb/players/turner-wimberly-1.html">Turner Wimberly</a></td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >0.0</td>
<td align="right" >0</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" >0</td>
<td align="right" >0</td>
<td align="right" >0.0</td>
</tr>
</tbody>
</table>
</div>
<div class="table_heading">
<h2 style="">Rushing & Receiving</h2>
<div class="table_heading_text"></div>
</div>
<div class="table_container" id="<API key>">
<table class="sortable stats_table" id="<API key>">
<colgroup><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup>
<thead>
<tr class=" over_header">
<th align="CENTER" colspan=2 class="tooltip over_header" ></th>
<th align="center" colspan=4 class="bold_text over_header" >Rushing</th>
<th align="center" colspan=4 class="bold_text over_header" >Receiving</th>
<th align="center" colspan=4 class="bold_text over_header" >Scrimmage</th>
</tr>
<tr class="">
<th align="right" class="ranker sort_default_asc" tip="Rank">Rk</th>
<th align="left" class="tooltip sort_default_asc" >Player</th>
<th align="right" class="tooltip" tip="Rush Attempts">Att</th>
<th align="right" class="tooltip" tip="Rushing Yards">Yds</th>
<th align="right" class="tooltip" tip="Rushing Yards Per Attempt">Avg</th>
<th align="right" class="tooltip" tip="Rushing Touchdowns">TD</th>
<th align="right" class="tooltip" tip="Receptions">Rec</th>
<th align="right" class="tooltip" tip="Receiving Yards">Yds</th>
<th align="right" class="tooltip" tip="Receiving Yards Per Reception">Avg</th>
<th align="right" class="tooltip" tip="Receiving Touchdowns">TD</th>
<th align="right" class="tooltip" tip="Plays From Scrimmage (Rush Attempts plus Receptions)">Plays</th>
<th align="right" class="tooltip" tip="Yards From Scrimmage (Rushing Yards plus Receiving Yards)">Yds</th>
<th align="right" class="tooltip" tip="Yards From Scrimmage Per Play">Avg</th>
<th align="right" class="tooltip" tip="Touchdowns From Scrimmage (Rushing Touchdowns plus Receiving Touchdowns)">TD</th>
</tr>
</thead>
<tbody>
<tr class="">
<td align="right" csk="1">1</td>
<td align="left" csk="Smith,Larry"><a href="/cfb/players/larry-smith-1.html">Larry Smith</a></td>
<td align="right" >105</td>
<td align="right" >248</td>
<td align="right" >2.4</td>
<td align="right" >4</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >105</td>
<td align="right" >248</td>
<td align="right" >2.4</td>
<td align="right" >4</td>
</tr>
<tr class="">
<td align="right" csk="2">2</td>
<td align="left" csk="Norman,Warren"><a href="/cfb/players/warren-norman-1.html">Warren Norman</a></td>
<td align="right" >77</td>
<td align="right" >459</td>
<td align="right" >6.0</td>
<td align="right" >4</td>
<td align="right" >11</td>
<td align="right" >110</td>
<td align="right" >10.0</td>
<td align="right" >0</td>
<td align="right" >88</td>
<td align="right" >569</td>
<td align="right" >6.5</td>
<td align="right" >4</td>
</tr>
<tr class="">
<td align="right" csk="3">3</td>
<td align="left" csk="Reeves,Kennard"><a href="/cfb/players/kennard-reeves-1.html">Kennard Reeves</a></td>
<td align="right" >76</td>
<td align="right" >306</td>
<td align="right" >4.0</td>
<td align="right" >0</td>
<td align="right" >4</td>
<td align="right" >35</td>
<td align="right" >8.8</td>
<td align="right" >0</td>
<td align="right" >80</td>
<td align="right" >341</td>
<td align="right" >4.3</td>
<td align="right" >0</td>
</tr>
<tr class="">
<td align="right" csk="4">4</td>
<td align="left" csk="Stacy,Zac"><a href="/cfb/players/zac-stacy-1.html">Zac Stacy</a></td>
<td align="right" >66</td>
<td align="right" >331</td>
<td align="right" >5.0</td>
<td align="right" >3</td>
<td align="right" >9</td>
<td align="right" >32</td>
<td align="right" >3.6</td>
<td align="right" >0</td>
<td align="right" >75</td>
<td align="right" >363</td>
<td align="right" >4.8</td>
<td align="right" >3</td>
</tr>
<tr class="">
<td align="right" csk="5">5</td>
<td align="left" csk="Tate,Wesley"><a href="/cfb/players/wesley-tate-1.html">Wesley Tate</a></td>
<td align="right" >40</td>
<td align="right" >140</td>
<td align="right" >3.5</td>
<td align="right" >0</td>
<td align="right" >5</td>
<td align="right" >25</td>
<td align="right" >5.0</td>
<td align="right" >0</td>
<td align="right" >45</td>
<td align="right" >165</td>
<td align="right" >3.7</td>
<td align="right" >0</td>
</tr>
<tr class="">
<td align="right" csk="6">6</td>
<td align="left" csk="Funk,Jared"><a href="/cfb/players/jared-funk-1.html">Jared Funk</a></td>
<td align="right" >24</td>
<td align="right" >67</td>
<td align="right" >2.8</td>
<td align="right" >0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >24</td>
<td align="right" >67</td>
<td align="right" >2.8</td>
<td align="right" >0</td>
</tr>
<tr class="">
<td align="right" csk="7">7</td>
<td align="left" csk="Samuels,Eric"><a href="/cfb/players/eric-samuels-1.html">Eric Samuels</a></td>
<td align="right" >10</td>
<td align="right" >43</td>
<td align="right" >4.3</td>
<td align="right" >0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >10</td>
<td align="right" >43</td>
<td align="right" >4.3</td>
<td align="right" >0</td>
</tr>
<tr class="">
<td align="right" csk="8">8</td>
<td align="left" csk="Krause,Jonathan"><a href="/cfb/players/jonathan-krause-1.html">Jonathan Krause</a></td>
<td align="right" >6</td>
<td align="right" >121</td>
<td align="right" >20.2</td>
<td align="right" >2</td>
<td align="right" >24</td>
<td align="right" >243</td>
<td align="right" >10.1</td>
<td align="right" >0</td>
<td align="right" >30</td>
<td align="right" >364</td>
<td align="right" >12.1</td>
<td align="right" >2</td>
</tr>
<tr class="">
<td align="right" csk="9">9</td>
<td align="left" csk="Jelesky,Josh"><a href="/cfb/players/josh-jelesky-1.html">Josh Jelesky</a></td>
<td align="right" >1</td>
<td align="right" >4</td>
<td align="right" >4.0</td>
<td align="right" >0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" >4</td>
<td align="right" >4.0</td>
<td align="right" >0</td>
</tr>
<tr class="">
<td align="right" csk="10">10</td>
<td align="left" csk="Kent,Richard"><a href="/cfb/players/richard-kent-1.html">Richard Kent</a></td>
<td align="right" >1</td>
<td align="right" >0</td>
<td align="right" >0.0</td>
<td align="right" >0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" >0</td>
<td align="right" >0.0</td>
<td align="right" >0</td>
</tr>
<tr class="">
<td align="right" csk="11">11</td>
<td align="left" csk="Cole,John"><a href="/cfb/players/john-cole-1.html">John Cole</a></td>
<td align="right" >1</td>
<td align="right" >-1</td>
<td align="right" >-1.0</td>
<td align="right" >0</td>
<td align="right" >25</td>
<td align="right" >317</td>
<td align="right" >12.7</td>
<td align="right" >1</td>
<td align="right" >26</td>
<td align="right" >316</td>
<td align="right" >12.2</td>
<td align="right" >1</td>
</tr>
<tr class="">
<td align="right" csk="12">12</td>
<td align="left" csk="Barden,Brandon"><a href="/cfb/players/brandon-barden-1.html">Brandon Barden</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >34</td>
<td align="right" >425</td>
<td align="right" >12.5</td>
<td align="right" >3</td>
<td align="right" >34</td>
<td align="right" >425</td>
<td align="right" >12.5</td>
<td align="right" >3</td>
</tr>
<tr class="">
<td align="right" csk="13">13</td>
<td align="left" csk="Matthews,Jordan"><a href="/cfb/players/jordan-matthews-1.html">Jordan Matthews</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >15</td>
<td align="right" >181</td>
<td align="right" >12.1</td>
<td align="right" >4</td>
<td align="right" >15</td>
<td align="right" >181</td>
<td align="right" >12.1</td>
<td align="right" >4</td>
</tr>
<tr class="">
<td align="right" csk="14">14</td>
<td align="left" csk="Herndon,Tray"><a href="/cfb/players/tray-herndon-1.html">Tray Herndon</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >13</td>
<td align="right" >122</td>
<td align="right" >9.4</td>
<td align="right" >0</td>
<td align="right" >13</td>
<td align="right" >122</td>
<td align="right" >9.4</td>
<td align="right" >0</td>
</tr>
<tr class="">
<td align="right" csk="15">15</td>
<td align="left" csk="Umoh,Udom"><a href="/cfb/players/udom-umoh-1.html">Udom Umoh</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >12</td>
<td align="right" >194</td>
<td align="right" >16.2</td>
<td align="right" >2</td>
<td align="right" >12</td>
<td align="right" >194</td>
<td align="right" >16.2</td>
<td align="right" >2</td>
</tr>
<tr class="">
<td align="right" csk="16">16</td>
<td align="left" csk="Wimberly,Turner"><a href="/cfb/players/turner-wimberly-1.html">Turner Wimberly</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >10</td>
<td align="right" >170</td>
<td align="right" >17.0</td>
<td align="right" >0</td>
<td align="right" >10</td>
<td align="right" >170</td>
<td align="right" >17.0</td>
<td align="right" >0</td>
</tr>
<tr class="">
<td align="right" csk="17">17</td>
<td align="left" csk="Johnston,Mason"><a href="/cfb/players/mason-johnston-1.html">Mason Johnston</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >6</td>
<td align="right" >56</td>
<td align="right" >9.3</td>
<td align="right" >1</td>
<td align="right" >6</td>
<td align="right" >56</td>
<td align="right" >9.3</td>
<td align="right" >1</td>
</tr>
<tr class="">
<td align="right" csk="18">18</td>
<td align="left" csk="Lassing,Fitz"><a href="/cfb/players/fitz-lassing-1.html">Fitz Lassing</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" >3</td>
<td align="right" >3.0</td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >3</td>
<td align="right" >3.0</td>
<td align="right" >0</td>
</tr>
</tbody>
</table>
</div>
<div class="table_heading">
<h2 style="">Defense & Fumbles</h2>
<div class="table_heading_text"></div>
</div>
<div class="table_container" id="<API key>">
<table class="sortable stats_table" id="defense_and_fumbles">
<colgroup><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup>
<thead>
<tr class=" over_header">
<th align="CENTER" colspan=2 class="tooltip over_header" ></th>
<th align="center" colspan=5 class="bold_text over_header" >Tackles</th>
<th align="center" colspan=5 class="bold_text over_header" >Def Int</th>
<th align="center" colspan=4 class="bold_text over_header" >Fumbles</th>
</tr>
<tr class="">
<th align="right" class="ranker sort_default_asc" tip="Rank">Rk</th>
<th align="left" class="tooltip sort_default_asc" >Player</th>
<th align="right" class="tooltip" tip="Solo Tackles">Solo</th>
<th align="right" class="tooltip" tip="Assisted Tackles">Ast</th>
<th align="right" class="tooltip" tip="Total Tackles">Tot</th>
<th align="right" class="tooltip" tip="Tackles for Loss">Loss</th>
<th align="right" class="tooltip" tip="Sacks">Sk</th>
<th align="right" class="tooltip" tip="Interceptions">Int</th>
<th align="right" class="tooltip" tip="Interception Return Yards">Yds</th>
<th align="right" class="tooltip" tip="Interception Return Yards Per Interception">Avg</th>
<th align="right" class="tooltip" tip="Interception Return Touchdowns">TD</th>
<th align="right" class="tooltip" tip="Passes Defended">PD</th>
<th align="right" class="tooltip" tip="Fumbles Recovered">FR</th>
<th align="right" class="tooltip" tip="Fumble Recovery Return Yards">Yds</th>
<th align="right" class="tooltip" tip="Fumble Recovery Return Touchdowns">TD</th>
<th align="right" class="tooltip" tip="Fumbles Forced">FF</th>
</tr>
</thead>
<tbody>
<tr class="">
<td align="right" csk="1">1</td>
<td align="left" csk="Richardson,Sean"><a href="/cfb/players/sean-richardson-1.html">Sean Richardson</a></td>
<td align="right" >62</td>
<td align="right" >37</td>
<td align="right" >99</td>
<td align="right" >7.0</td>
<td align="right" >1.5</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >5</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="2">2</td>
<td align="left" csk="Marve,Chris"><a href="/cfb/players/chris-marve-1.html">Chris Marve</a></td>
<td align="right" >45</td>
<td align="right" >35</td>
<td align="right" >80</td>
<td align="right" >8.0</td>
<td align="right" >2.5</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >2</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="3">3</td>
<td align="left" csk="Stokes,John"><a href="/cfb/players/john-stokes-2.html">John Stokes</a></td>
<td align="right" >44</td>
<td align="right" >34</td>
<td align="right" >78</td>
<td align="right" >6.5</td>
<td align="right" >0.5</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >3</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
</tr>
<tr class="">
<td align="right" csk="4">4</td>
<td align="left" csk="Hayward,Casey"><a href="/cfb/players/casey-hayward-1.html">Casey Hayward</a></td>
<td align="right" >56</td>
<td align="right" >14</td>
<td align="right" >70</td>
<td align="right" >2.0</td>
<td align="right" >0.0</td>
<td align="right" >6</td>
<td align="right" >13</td>
<td align="right" >2.2</td>
<td align="right" >0</td>
<td align="right" >17</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
</tr>
<tr class="">
<td align="right" csk="5">5</td>
<td align="left" csk="Ladler,Kenny"><a href="/cfb/players/kenny-ladler-1.html">Kenny Ladler</a></td>
<td align="right" >40</td>
<td align="right" >17</td>
<td align="right" >57</td>
<td align="right" >5.5</td>
<td align="right" >0.0</td>
<td align="right" >1</td>
<td align="right" >0</td>
<td align="right" >0.0</td>
<td align="right" >0</td>
<td align="right" >3</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
</tr>
<tr class="">
<td align="right" csk="6">6</td>
<td align="left" csk="Foster,Eddie"><a href="/cfb/players/eddie-foster-1.html">Eddie Foster</a></td>
<td align="right" >36</td>
<td align="right" >17</td>
<td align="right" >53</td>
<td align="right" >6.0</td>
<td align="right" >0.0</td>
<td align="right" >1</td>
<td align="right" >21</td>
<td align="right" >21.0</td>
<td align="right" >1</td>
<td align="right" >4</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
</tr>
<tr class="">
<td align="right" csk="7">7</td>
<td align="left" csk="Lohr,Rob"><a href="/cfb/players/rob-lohr-1.html">Rob Lohr</a></td>
<td align="right" >24</td>
<td align="right" >11</td>
<td align="right" >35</td>
<td align="right" >7.5</td>
<td align="right" >3.5</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="8">8</td>
<td align="left" csk="Nichter,Colt"><a href="/cfb/players/colt-nichter-1.html">Colt Nichter</a></td>
<td align="right" >16</td>
<td align="right" >16</td>
<td align="right" >32</td>
<td align="right" >5.5</td>
<td align="right" >3.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="9">9</td>
<td align="left" csk="Fullam,Jay"><a href="/cfb/players/jay-fullam-1.html">Jay Fullam</a></td>
<td align="right" >19</td>
<td align="right" >11</td>
<td align="right" >30</td>
<td align="right" >1.5</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >2</td>
</tr>
<tr class="">
<td align="right" csk="10">10</td>
<td align="left" csk="May,Walker"><a href="/cfb/players/walker-may-1.html">Walker May</a></td>
<td align="right" >16</td>
<td align="right" >13</td>
<td align="right" >29</td>
<td align="right" >6.0</td>
<td align="right" >1.5</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="11">11</td>
<td align="left" csk="Greenstone,T.J."><a href="/cfb/players/tj-greenstone-1.html">T.J. Greenstone</a></td>
<td align="right" >13</td>
<td align="right" >15</td>
<td align="right" >28</td>
<td align="right" >4.5</td>
<td align="right" >1.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="12">12</td>
<td align="left" csk="Campbell,Nate"><a href="/cfb/players/nate-campbell-1.html">Nate Campbell</a></td>
<td align="right" >21</td>
<td align="right" >6</td>
<td align="right" >27</td>
<td align="right" >4.5</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
</tr>
<tr class="">
<td align="right" csk="13">13</td>
<td align="left" csk="Samuels,Eric"><a href="/cfb/players/eric-samuels-1.html">Eric Samuels</a></td>
<td align="right" >14</td>
<td align="right" >13</td>
<td align="right" >27</td>
<td align="right" >1.5</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >3</td>
<td align="right" ></td>
<td align="right" >2</td>
<td align="right" ></td>
<td align="right" >1</td>
</tr>
<tr class="">
<td align="right" csk="14">14</td>
<td align="left" csk="Kadri,Theron"><a href="/cfb/players/theron-kadri-1.html">Theron Kadri</a></td>
<td align="right" >13</td>
<td align="right" >14</td>
<td align="right" >27</td>
<td align="right" >2.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="15">15</td>
<td align="left" csk="Fugger,Tim"><a href="/cfb/players/tim-fugger-1.html">Tim Fugger</a></td>
<td align="right" >13</td>
<td align="right" >9</td>
<td align="right" >22</td>
<td align="right" >5.0</td>
<td align="right" >3.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >4</td>
</tr>
<tr class="">
<td align="right" csk="16">16</td>
<td align="left" csk="Thomas,Johnell"><a href="/cfb/players/johnell-thomas-1.html">Johnell Thomas</a></td>
<td align="right" >11</td>
<td align="right" >11</td>
<td align="right" >22</td>
<td align="right" >3.5</td>
<td align="right" >1.5</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="17">17</td>
<td align="left" csk="Clarke,Steven"><a href="/cfb/players/steven-clarke-1.html">Steven Clarke</a></td>
<td align="right" >10</td>
<td align="right" >6</td>
<td align="right" >16</td>
<td align="right" >1.0</td>
<td align="right" >1.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="18">18</td>
<td align="left" csk="Hal,Andre"><a href="/cfb/players/andre-hal-1.html">Andre Hal</a></td>
<td align="right" >10</td>
<td align="right" >5</td>
<td align="right" >15</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="19">19</td>
<td align="left" csk="Jelesky,Josh"><a href="/cfb/players/josh-jelesky-1.html">Josh Jelesky</a></td>
<td align="right" >5</td>
<td align="right" >10</td>
<td align="right" >15</td>
<td align="right" >2.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="20">20</td>
<td align="left" csk="Jones,Deandre"><a href="/cfb/players/deandre-jones-1.html">Deandre Jones</a></td>
<td align="right" >9</td>
<td align="right" >4</td>
<td align="right" >13</td>
<td align="right" >2.5</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="21">21</td>
<td align="left" csk="Barnes,Archibald"><a href="/cfb/players/archibald-barnes-1.html">Archibald Barnes</a></td>
<td align="right" >7</td>
<td align="right" >4</td>
<td align="right" >11</td>
<td align="right" >1.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
</tr>
<tr class="">
<td align="right" csk="22">22</td>
<td align="left" csk="Wilson,Trey"><a href="/cfb/players/trey-wilson-1.html">Trey Wilson</a></td>
<td align="right" >8</td>
<td align="right" >3</td>
<td align="right" >11</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="23">23</td>
<td align="left" csk="Brannon,Teriall"><a href="/cfb/players/teriall-brannon-1.html">Teriall Brannon</a></td>
<td align="right" >5</td>
<td align="right" >4</td>
<td align="right" >9</td>
<td align="right" >2.5</td>
<td align="right" >1.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="24">24</td>
<td align="left" csk="Graham,Jamie"><a href="/cfb/players/jamie-graham-1.html">Jamie Graham</a></td>
<td align="right" >8</td>
<td align="right" >1</td>
<td align="right" >9</td>
<td align="right" >1.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="25">25</td>
<td align="left" csk="Garnham,Chase"><a href="/cfb/players/chase-garnham-1.html">Chase Garnham</a></td>
<td align="right" >3</td>
<td align="right" >5</td>
<td align="right" >8</td>
<td align="right" >0.5</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="26">26</td>
<td align="left" csk="Loftley,Taylor"><a href="/cfb/players/taylor-loftley-1.html">Taylor Loftley</a></td>
<td align="right" >4</td>
<td align="right" >3</td>
<td align="right" >7</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="27">27</td>
<td align="left" csk="Morse,Jared"><a href="/cfb/players/jared-morse-1.html">Jared Morse</a></td>
<td align="right" >5</td>
<td align="right" >2</td>
<td align="right" >7</td>
<td align="right" >1.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="28">28</td>
<td align="left" csk="Daniels,Dexter"><a href="/cfb/players/dexter-daniels-2.html">Dexter Daniels</a></td>
<td align="right" >6</td>
<td align="right" >0</td>
<td align="right" >6</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="29">29</td>
<td align="left" csk="Umoh,Udom"><a href="/cfb/players/udom-umoh-1.html">Udom Umoh</a></td>
<td align="right" >5</td>
<td align="right" >1</td>
<td align="right" >6</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="30">30</td>
<td align="left" csk="Marshall,Javon"><a href="/cfb/players/javon-marshall-1.html">Javon Marshall</a></td>
<td align="right" >1</td>
<td align="right" >3</td>
<td align="right" >4</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
</tr>
<tr class="">
<td align="right" csk="31">31</td>
<td align="left" csk="Matthews,Jordan"><a href="/cfb/players/jordan-matthews-1.html">Jordan Matthews</a></td>
<td align="right" >3</td>
<td align="right" >1</td>
<td align="right" >4</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="32">32</td>
<td align="left" csk="Simmons,Andre"><a href="/cfb/players/andre-simmons-2.html">Andre Simmons</a></td>
<td align="right" >4</td>
<td align="right" >0</td>
<td align="right" >4</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="33">33</td>
<td align="left" csk="Butler,Karl"><a href="/cfb/players/karl-butler-1.html">Karl Butler</a></td>
<td align="right" >1</td>
<td align="right" >2</td>
<td align="right" >3</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" >1</td>
<td align="right" >33</td>
<td align="right" >33.0</td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="34">34</td>
<td align="left" csk="Krause,Jonathan"><a href="/cfb/players/jonathan-krause-1.html">Jonathan Krause</a></td>
<td align="right" >3</td>
<td align="right" >0</td>
<td align="right" >3</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="35">35</td>
<td align="left" csk="Strong,Tristan"><a href="/cfb/players/tristan-strong-1.html">Tristan Strong</a></td>
<td align="right" >2</td>
<td align="right" >1</td>
<td align="right" >3</td>
<td align="right" >0.5</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="36">36</td>
<td align="left" csk="Van Rensburg,Ryan"><a href="/cfb/players/ryan-van-rensburg-1.html">Ryan Van Rensburg</a></td>
<td align="right" >2</td>
<td align="right" >1</td>
<td align="right" >3</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="37">37</td>
<td align="left" csk="Fischer,Kyle"><a href="/cfb/players/kyle-fischer-1.html">Kyle Fischer</a></td>
<td align="right" >2</td>
<td align="right" >0</td>
<td align="right" >2</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="38">38</td>
<td align="left" csk="Powell,Micah"><a href="/cfb/players/micah-powell-1.html">Micah Powell</a></td>
<td align="right" >2</td>
<td align="right" >0</td>
<td align="right" >2</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="39">39</td>
<td align="left" csk="Smotherman,Adam"><a href="/cfb/players/adam-smotherman-1.html">Adam Smotherman</a></td>
<td align="right" >2</td>
<td align="right" >0</td>
<td align="right" >2</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="40">40</td>
<td align="left" csk="Spear,Carey"><a href="/cfb/players/carey-spear-1.html">Carey Spear</a></td>
<td align="right" >2</td>
<td align="right" >0</td>
<td align="right" >2</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="41">41</td>
<td align="left" csk="Cole,John"><a href="/cfb/players/john-cole-1.html">John Cole</a></td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >1</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="42">42</td>
<td align="left" csk="Funk,Jared"><a href="/cfb/players/jared-funk-1.html">Jared Funk</a></td>
<td align="right" >1</td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="43">43</td>
<td align="left" csk="Giller,David"><a href="/cfb/players/david-giller-1.html">David Giller</a></td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >1</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="44">44</td>
<td align="left" csk="Kent,Richard"><a href="/cfb/players/richard-kent-1.html">Richard Kent</a></td>
<td align="right" >1</td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="45">45</td>
<td align="left" csk="McHaney,Thad"><a href="/cfb/players/thad-mchaney-1.html">Thad McHaney</a></td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >1</td>
<td align="right" >0.5</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="46">46</td>
<td align="left" csk="Panu,Marc"><a href="/cfb/players/marc-panu-1.html">Marc Panu</a></td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >1</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="47">47</td>
<td align="left" csk="Stacy,Zac"><a href="/cfb/players/zac-stacy-1.html">Zac Stacy</a></td>
<td align="right" >1</td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="48">48</td>
<td align="left" csk="Vaughn,Duane"><a href="/cfb/players/duane-vaughn-1.html">Duane Vaughn</a></td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >1</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="49">49</td>
<td align="left" csk="Wimberly,Turner"><a href="/cfb/players/turner-wimberly-1.html">Turner Wimberly</a></td>
<td align="right" >1</td>
<td align="right" >0</td>
<td align="right" >1</td>
<td align="right" >0.0</td>
<td align="right" >0.0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
</tbody>
</table>
</div>
<div class="table_heading">
<h2 style="">Kick & Punt Returns</h2>
<div class="table_heading_text"></div>
</div>
<div class="table_container" id="div_returns">
<table class="sortable stats_table" id="returns">
<colgroup><col><col><col><col><col><col><col><col><col><col></colgroup>
<thead>
<tr class=" over_header">
<th align="CENTER" colspan=2 class="tooltip over_header" ></th>
<th align="center" colspan=4 class="bold_text over_header" >Kick Ret</th>
<th align="center" colspan=4 class="bold_text over_header" >Punt Ret</th>
</tr>
<tr class="">
<th align="right" class="ranker sort_default_asc" tip="Rank">Rk</th>
<th align="left" class="tooltip sort_default_asc" >Player</th>
<th align="right" class="tooltip" tip="Kickoff Returns">Ret</th>
<th align="right" class="tooltip" tip="Kickoff Return Yards">Yds</th>
<th align="right" class="tooltip" tip="Kickoff Return Yards Per Return">Avg</th>
<th align="right" class="tooltip" tip="Kickoff Return Touchdowns">TD</th>
<th align="right" class="tooltip" tip="Punt Returns">Ret</th>
<th align="right" class="tooltip" tip="Punt Return Yards">Yds</th>
<th align="right" class="tooltip" tip="Punt Return Yards Per Return">Avg</th>
<th align="right" class="tooltip" tip="Punt Return Touchdowns">TD</th>
</tr>
</thead>
<tbody>
<tr class="">
<td align="right" csk="1">1</td>
<td align="left" csk="Samuels,Eric"><a href="/cfb/players/eric-samuels-1.html">Eric Samuels</a></td>
<td align="right" >27</td>
<td align="right" >549</td>
<td align="right" >20.3</td>
<td align="right" >0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="2">2</td>
<td align="left" csk="Norman,Warren"><a href="/cfb/players/warren-norman-1.html">Warren Norman</a></td>
<td align="right" >22</td>
<td align="right" >558</td>
<td align="right" >25.4</td>
<td align="right" >0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="3">3</td>
<td align="left" csk="Hal,Andre"><a href="/cfb/players/andre-hal-1.html">Andre Hal</a></td>
<td align="right" >11</td>
<td align="right" >260</td>
<td align="right" >23.6</td>
<td align="right" >0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="4">4</td>
<td align="left" csk="Wilson,Trey"><a href="/cfb/players/trey-wilson-1.html">Trey Wilson</a></td>
<td align="right" >1</td>
<td align="right" >2</td>
<td align="right" >2.0</td>
<td align="right" >0</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="5">5</td>
<td align="left" csk="Cole,John"><a href="/cfb/players/john-cole-1.html">John Cole</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >18</td>
<td align="right" >143</td>
<td align="right" >7.9</td>
<td align="right" >0</td>
</tr>
<tr class="">
<td align="right" csk="6">6</td>
<td align="left" csk="Stacy,Zac"><a href="/cfb/players/zac-stacy-1.html">Zac Stacy</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >5</td>
<td align="right" >12</td>
<td align="right" >2.4</td>
<td align="right" >0</td>
</tr>
<tr class="">
<td align="right" csk="7">7</td>
<td align="left" csk="Van Rensburg,Ryan"><a href="/cfb/players/ryan-van-rensburg-1.html">Ryan Van Rensburg</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" >18</td>
<td align="right" >18.0</td>
<td align="right" >0</td>
</tr>
<tr class="">
<td align="right" csk="8">8</td>
<td align="left" csk="Krause,Jonathan"><a href="/cfb/players/jonathan-krause-1.html">Jonathan Krause</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" >4</td>
<td align="right" >4.0</td>
<td align="right" >0</td>
</tr>
</tbody>
</table>
</div>
<div class="table_heading">
<h2 style="">Kicking & Punting</h2>
<div class="table_heading_text"></div>
</div>
<div class="table_container" id="<API key>">
<table class="sortable stats_table" id="kicking_and_punting">
<colgroup><col><col><col><col><col><col><col><col><col><col><col><col></colgroup>
<thead>
<tr class=" over_header">
<th align="CENTER" colspan=2 class="tooltip over_header" ></th>
<th align="center" colspan=7 class="bold_text over_header" >Kicking</th>
<th align="center" colspan=3 class="bold_text over_header" >Punting</th>
</tr>
<tr class="">
<th align="right" class="ranker sort_default_asc" tip="Rank">Rk</th>
<th align="left" class="tooltip sort_default_asc" >Player</th>
<th align="right" class="tooltip" tip="Extra Points Made">XPM</th>
<th align="right" class="tooltip" tip="Extra Point Attempts">XPA</th>
<th align="right" class="tooltip" tip="Extra Point Percentage">XP%</th>
<th align="right" class="tooltip" tip="Field Goals Made">FGM</th>
<th align="right" class="tooltip" tip="Field Goal Attempts">FGA</th>
<th align="right" class="tooltip" tip="Field Goal Percentage">FG%</th>
<th align="right" class="tooltip" tip="Points Kicking">Pts</th>
<th align="right" class="tooltip" tip="Punts">Punts</th>
<th align="right" class="tooltip" tip="Punting Yards">Yds</th>
<th align="right" class="tooltip" tip="Punting Yards Per Punt">Avg</th>
</tr>
</thead>
<tbody>
<tr class="">
<td align="right" csk="1">1</td>
<td align="left" csk="Fowler,Ryan"><a href="/cfb/players/ryan-fowler-2.html">Ryan Fowler</a></td>
<td align="right" >23</td>
<td align="right" >24</td>
<td align="right" >95.8</td>
<td align="right" >8</td>
<td align="right" >13</td>
<td align="right" >61.5</td>
<td align="right" >47</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
</tr>
<tr class="">
<td align="right" csk="2">2</td>
<td align="left" csk="Kent,Richard"><a href="/cfb/players/richard-kent-1.html">Richard Kent</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >84</td>
<td align="right" >3511</td>
<td align="right" >41.8</td>
</tr>
</tbody>
</table>
</div>
<div class="table_heading">
<h2 style="">Scoring</h2>
<div class="table_heading_text"></div>
</div>
<div class="table_container" id="div_scoring">
<table class="sortable stats_table" id="scoring">
<colgroup><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup>
<thead>
<tr class=" over_header">
<th align="CENTER" colspan=2 class="tooltip over_header" ></th>
<th align="center" colspan=8 class="bold_text over_header" >Touchdowns</th>
<th align="center" colspan=2 class="bold_text over_header" >Kicking</th>
<th align="CENTER" colspan=2 class="tooltip over_header" ></th>
<th></th>
</tr>
<tr class="">
<th align="right" class="ranker sort_default_asc" tip="Rank">Rk</th>
<th align="left" class="tooltip sort_default_asc" >Player</th>
<th align="right" class="tooltip" tip="Rushing Touchdowns">Rush</th>
<th align="right" class="tooltip" tip="Receiving Touchdowns">Rec</th>
<th align="right" class="tooltip" tip="Interception Return Touchdowns">Int</th>
<th align="right" class="tooltip" tip="Fumble Recovery Return Touchdowns">FR</th>
<th align="right" class="tooltip" tip="Punt Return Touchdowns">PR</th>
<th align="right" class="tooltip" tip="Kick Return Touchdowns">KR</th>
<th align="right" class="tooltip" tip="Other Touchdowns">Oth</th>
<th align="right" class="tooltip" tip="Total Touchdowns">Tot</th>
<th align="right" class="tooltip" tip="Extra Points Made">XPM</th>
<th align="right" class="tooltip" tip="Field Goals Made">FGM</th>
<th align="right" class="tooltip" tip="Two-Point Conversions Made">2PM</th>
<th align="right" class="tooltip" tip="Safeties">Sfty</th>
<th align="right" class="tooltip" tip="Points">Pts</th>
</tr>
</thead>
<tbody>
<tr class="">
<td align="right" csk="1">1</td>
<td align="left" csk="Fowler,Ryan"><a href="/cfb/players/ryan-fowler-2.html">Ryan Fowler</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >23</td>
<td align="right" >8</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >47</td>
</tr>
<tr class="">
<td align="right" csk="2">2</td>
<td align="left" csk="Smith,Larry"><a href="/cfb/players/larry-smith-1.html">Larry Smith</a></td>
<td align="right" >4</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >4</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >24</td>
</tr>
<tr class="">
<td align="right" csk="3">3</td>
<td align="left" csk="Norman,Warren"><a href="/cfb/players/warren-norman-1.html">Warren Norman</a></td>
<td align="right" >4</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >4</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >24</td>
</tr>
<tr class="">
<td align="right" csk="4">4</td>
<td align="left" csk="Matthews,Jordan"><a href="/cfb/players/jordan-matthews-1.html">Jordan Matthews</a></td>
<td align="right" ></td>
<td align="right" >4</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >4</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >24</td>
</tr>
<tr class="">
<td align="right" csk="5">5</td>
<td align="left" csk="Barden,Brandon"><a href="/cfb/players/brandon-barden-1.html">Brandon Barden</a></td>
<td align="right" ></td>
<td align="right" >3</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >3</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >18</td>
</tr>
<tr class="">
<td align="right" csk="6">6</td>
<td align="left" csk="Stacy,Zac"><a href="/cfb/players/zac-stacy-1.html">Zac Stacy</a></td>
<td align="right" >3</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >3</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >18</td>
</tr>
<tr class="">
<td align="right" csk="7">7</td>
<td align="left" csk="Krause,Jonathan"><a href="/cfb/players/jonathan-krause-1.html">Jonathan Krause</a></td>
<td align="right" >2</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >2</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >12</td>
</tr>
<tr class="">
<td align="right" csk="8">8</td>
<td align="left" csk="Umoh,Udom"><a href="/cfb/players/udom-umoh-1.html">Udom Umoh</a></td>
<td align="right" ></td>
<td align="right" >2</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >2</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >12</td>
</tr>
<tr class="">
<td align="right" csk="9">9</td>
<td align="left" csk="Cole,John"><a href="/cfb/players/john-cole-1.html">John Cole</a></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >6</td>
</tr>
<tr class="">
<td align="right" csk="10">10</td>
<td align="left" csk="Johnston,Mason"><a href="/cfb/players/mason-johnston-1.html">Mason Johnston</a></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >6</td>
</tr>
<tr class="">
<td align="right" csk="11">11</td>
<td align="left" csk="Marshall,Javon"><a href="/cfb/players/javon-marshall-1.html">Javon Marshall</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >6</td>
</tr>
<tr class="">
<td align="right" csk="12">12</td>
<td align="left" csk="Foster,Eddie"><a href="/cfb/players/eddie-foster-1.html">Eddie Foster</a></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >1</td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" ></td>
<td align="right" >6</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="sr_js"></div>
<script type="text/javascript">
(function () {
var sr_js_file = 'http://d2ft4b0ve1aur1.cloudfront.net/js-237/sr-cfb-min.js';
if (sr_gzipEnabled) {
sr_js_file = 'http://d2ft4b0ve1aur1.cloudfront.net/js-237/sr-cfb-min.js.jgz';
}
var sr_script_tag = document.getElementById("sr_js");
if (sr_script_tag) {
var scriptStyles = document.createElement("script");
scriptStyles.type = "text/javascript";
scriptStyles.src = sr_js_file;
sr_script_tag.appendChild(scriptStyles);
//alert('adding js to footer:'+sr_js_file);
}
}());
</script>
<div id="site_footer">
<div class="margin border">
<script type="text/javascript">
google_ad_client = "<API key>";
/* Page Bottom - CFB */
google_ad_slot = "6637784901";
google_ad_width = 728;
google_ad_height = 90;
</script>
<script type="text/deferscript" defersrc="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
<div id="sr_footer">
Copyright © 2000-2012
<a href="http:
All rights reserved.
<form class="inline margin_left" method="get" name="f_footer" action="/cfb/search.cgi">
<input x-webkit-speech type="text" id="search_footer" name="search" class="search long">
<input type="submit" value="Search" class="submit">
</form>
<div class="blockquote clear_both margin_top">
<a href="http:
<a href="/cfb/about/">About SR/CFB</a> |
<a href="/cfb/feedback/">Found a bug or have a suggestion?</a><br>
<a href="http:
<a href="http:
<a href="http:
</div>
<div class="blockquote italic_text clear_both margin_top">
Some school's results have been altered by retroactive NCAA penalties. As a
matter of policy, Sports Reference only report the results of games as
played on the field. See our list of <a
href="/cfb/friv/forfeits.cgi">forfeits and vacated games</a> for more
details.
</div>
<div class="blockquote clear_both margin_top margin_bottom">
Part of the <a target="_blank" title="USA TODAY Sports"
href="http://Sports.USATODAY.com/">USA TODAY Sports Media Group</a>.
</div>
</div><!-- div#sr_footer -->
</div><!-- div#site_footer -->
<!-- google +1 code -->
<script type="text/deferscript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.<API key>('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<!-- google analytics code -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https:
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._createTracker("UA-1890630-11");
pageTracker._setCookiePath("/cfb/");
pageTracker._trackPageview();
pageTracker._trackPageLoadTime();
var sr_tracker = _gat._createTracker("UA-1890630-9");
sr_tracker._setDomainName('none');
sr_tracker._setAllowLinker(true);
sr_tracker._setAllowHash(false);
sr_tracker._setCustomVar(1,"site","cfb",3);
sr_tracker._trackPageview();
} catch(err) {}</script>
<!-- End Google Analytics Tag -->
<!-- Begin comScore Tag -->
<script type="text/deferscript">
document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https:
</script>
<script type="text/deferscript">
COMSCORE.beacon({
c1:2,
c2:"6035210",
c3:"",
c4:"www.sports-reference.com/cfb",
c5:"",
c6:"",
c15:""
});
</script>
<noscript>
<img src="http:
</noscript>
<!-- End comScore Tag -->
<script type="text/deferscript">
(function(d, s, id) {
var js, fjs = d.<API key>(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=220051088022369";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<!-- google +1 code -->
<script type="text/deferscript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.<API key>('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
</div>
</body>
</html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http:
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Search — ORMPY 0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var <API key> = {
URL_ROOT: './',
VERSION: '0.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/searchtools.js"></script>
<link rel="top" title="ORMPY 0.1 documentation" href="index.html" />
<script type="text/javascript">
jQuery(function() { Search.loadIndex("searchindex.js"); });
</script>
<script type="text/javascript" id="searchindexloader"></script>
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">ORMPY 0.1 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<h1 id="<API key>">Search</h1>
<div id="fallback" class="admonition warning">
<script type="text/javascript">$('#fallback').hide();</script>
<p>
Please activate JavaScript to enable the search
functionality.
</p>
</div>
<p>
From here you can search these documents. Enter your search
words into the box below and click "search". Note that the search
function will automatically search for all of the words. Pages
containing fewer words won't appear in the result list.
</p>
<form action="" method="get">
<input type="text" name="q" value="" />
<input type="submit" value="search" />
<span id="search-progress" style="padding-left: 10px"></span>
</form>
<div id="search-results">
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="<API key>">
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">ORMPY 0.1 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2014, Matthew Nizol.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>
|
#include "Common.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "SpellMgr.h"
#include "Player.h"
#include "Unit.h"
#include "Spell.h"
#include "SpellAuras.h"
#include "Totem.h"
#include "Creature.h"
#include "Formulas.h"
#include "CreatureAI.h"
#include "Util.h"
pAuraProcHandler AuraProcHandler[TOTAL_AURAS]=
{
&Unit::HandleNULLProc, // 0 SPELL_AURA_NONE
&Unit::HandleNULLProc, // 1 <API key>
&Unit::HandleNULLProc, // 2 <API key>
&Unit::HandleNULLProc, // 3 <API key>
&Unit::HandleDummyAuraProc, // 4 SPELL_AURA_DUMMY
&Unit::<API key>, // 5 <API key>
&Unit::HandleNULLProc, // 6 <API key>
&Unit::<API key>, // 7 SPELL_AURA_MOD_FEAR
&Unit::HandleNULLProc, // 8 <API key>
&Unit::HandleNULLProc, // 9 <API key>
&Unit::HandleNULLProc, // 10 <API key>
&Unit::HandleNULLProc, // 11 <API key>
&Unit::HandleNULLProc, // 12 SPELL_AURA_MOD_STUN
&Unit::HandleNULLProc, // 13 <API key>
&Unit::HandleNULLProc, // 14 <API key>
&Unit::HandleNULLProc, // 15 <API key>
&Unit::<API key>, // 16 <API key>
&Unit::HandleNULLProc, // 17 <API key>
&Unit::<API key>, // 18 <API key>
&Unit::HandleNULLProc, // 19 <API key>
&Unit::HandleNULLProc, // 20 <API key>
&Unit::HandleNULLProc, // 21 <API key>
&Unit::HandleNULLProc, // 22 <API key>
&Unit::HandleNULLProc, // 23 <API key>
&Unit::HandleNULLProc, // 24 <API key>
&Unit::HandleNULLProc, // 25 <API key>
&Unit::<API key>, // 26 SPELL_AURA_MOD_ROOT
&Unit::HandleNULLProc, // 27 <API key>
&Unit::HandleNULLProc, // 28 <API key>
&Unit::HandleNULLProc, // 29 SPELL_AURA_MOD_STAT
&Unit::HandleNULLProc, // 30 <API key>
&Unit::HandleNULLProc, // 31 <API key>
&Unit::HandleNULLProc, // 32 <API key>
&Unit::HandleNULLProc, // 33 <API key>
&Unit::HandleNULLProc, // 34 <API key>
&Unit::HandleNULLProc, // 35 <API key>
&Unit::HandleNULLProc, // 36 <API key>
&Unit::HandleNULLProc, // 37 <API key>
&Unit::HandleNULLProc, // 38 <API key>
&Unit::HandleNULLProc, // 39 <API key>
&Unit::HandleNULLProc, // 40 <API key>
&Unit::HandleNULLProc, // 41 <API key>
&Unit::<API key>, // 42 <API key>
&Unit::<API key>, // 43 <API key>
&Unit::HandleNULLProc, // 44 <API key>
&Unit::HandleNULLProc, // 45 <API key>
&Unit::HandleNULLProc, // 46 SPELL_AURA_46 (used in test spells 54054 and 54058, and spell 48050) (3.0.8a-3.2.2a)
&Unit::HandleNULLProc, // 47 <API key>
&Unit::HandleNULLProc, // 48 SPELL_AURA_48 spell Napalm (area damage spell with additional delayed damage effect)
&Unit::HandleNULLProc, // 49 <API key>
&Unit::HandleNULLProc, // 50 <API key>
&Unit::HandleNULLProc, // 51 <API key>
&Unit::HandleNULLProc, // 52 <API key>
&Unit::HandleNULLProc, // 53 <API key>
&Unit::HandleNULLProc, // 54 <API key>
&Unit::HandleNULLProc, // 55 <API key>
&Unit::HandleNULLProc, // 56 <API key>
&Unit::<API key>, // 57 <API key>
&Unit::HandleNULLProc, // 58 <API key>
&Unit::HandleNULLProc, // 59 <API key>
&Unit::<API key>, // 60 <API key>
&Unit::HandleNULLProc, // 61 <API key>
&Unit::HandleNULLProc, // 62 <API key>
&Unit::HandleNULLProc, // 63 unused (3.0.8a-3.2.2a) old <API key>
&Unit::HandleNULLProc, // 64 <API key>
&Unit::<API key>, // 65 <API key>
&Unit::HandleNULLProc, // 66 <API key>
&Unit::HandleNULLProc, // 67 <API key>
&Unit::HandleNULLProc, // 68 <API key>
&Unit::HandleNULLProc, // 69 <API key>
&Unit::HandleNULLProc, // 70 <API key> Useless, used by only one spell 41560 that has only visual effect (3.2.2a)
&Unit::HandleNULLProc, // 71 <API key>
&Unit::<API key>, // 72 <API key>
&Unit::<API key>, // 73 <API key>
&Unit::<API key>, // 74 <API key>
&Unit::HandleNULLProc, // 75 <API key>
&Unit::HandleNULLProc, // 76 <API key>
&Unit::<API key>, // 77 <API key>
&Unit::HandleNULLProc, // 78 SPELL_AURA_MOUNTED
&Unit::<API key>, // 79 <API key>
&Unit::HandleNULLProc, // 80 <API key>
&Unit::HandleNULLProc, // 81 <API key>
&Unit::HandleNULLProc, // 82 <API key>
&Unit::HandleNULLProc, // 83 <API key>
&Unit::HandleNULLProc, // 84 <API key>
&Unit::HandleCantTrigger, // 85 <API key>
&Unit::HandleNULLProc, // 86 <API key>
&Unit::HandleNULLProc, // 87 <API key>
&Unit::HandleNULLProc, // 88 <API key>
&Unit::HandleNULLProc, // 89 <API key>
&Unit::HandleNULLProc, // 90 unused (3.0.8a-3.2.2a) old <API key>
&Unit::HandleNULLProc, // 91 <API key>
&Unit::HandleNULLProc, // 92 <API key>
&Unit::HandleNULLProc, // 93 <API key>
&Unit::HandleNULLProc, // 94 <API key>
&Unit::HandleNULLProc, // 95 SPELL_AURA_GHOST
&Unit::HandleNULLProc, // 96 <API key>
&Unit::HandleNULLProc, // 97 <API key>
&Unit::HandleNULLProc, // 98 <API key>
&Unit::HandleNULLProc, // 99 <API key>
&Unit::HandleNULLProc, //100 <API key> obsolete 3.x? all player can see all auras now, but still have 2 spells including GM-spell (1852,2855)
&Unit::HandleNULLProc, //101 <API key>
&Unit::HandleNULLProc, //102 <API key>
&Unit::HandleNULLProc, //103 <API key>
&Unit::HandleNULLProc, //104 <API key>
&Unit::HandleNULLProc, //105 <API key>
&Unit::HandleNULLProc, //106 SPELL_AURA_HOVER
&Unit::<API key>, //107 <API key>
&Unit::<API key>, //108 <API key>
&Unit::HandleNULLProc, //109 <API key>
&Unit::HandleNULLProc, //110 <API key>
&Unit::HandleNULLProc, //111 <API key>
&Unit::<API key>, //112 <API key>
&Unit::HandleNULLProc, //113 <API key>
&Unit::HandleNULLProc, //114 <API key>
&Unit::HandleNULLProc, //115 <API key>
&Unit::HandleNULLProc, //116 <API key>
&Unit::<API key>, //117 <API key>
&Unit::HandleNULLProc, //118 <API key>
&Unit::HandleNULLProc, //119 unused (3.0.8a-3.2.2a) old <API key>
&Unit::HandleNULLProc, //120 <API key>
&Unit::HandleNULLProc, //121 SPELL_AURA_EMPATHY
&Unit::HandleNULLProc, //122 <API key>
&Unit::HandleNULLProc, //123 <API key>
&Unit::HandleNULLProc, //124 <API key>
&Unit::HandleNULLProc, //125 <API key>
&Unit::HandleNULLProc, //126 <API key>
&Unit::HandleNULLProc, //127 <API key>
&Unit::HandleNULLProc, //128 <API key>
&Unit::HandleNULLProc, //129 <API key>
&Unit::HandleNULLProc, //130 <API key>
&Unit::HandleNULLProc, //131 <API key>
&Unit::HandleNULLProc, //132 <API key>
&Unit::HandleNULLProc, //133 <API key>
&Unit::HandleNULLProc, //134 <API key>
&Unit::HandleNULLProc, //135 <API key>
&Unit::HandleNULLProc, //136 <API key>
&Unit::HandleNULLProc, //137 <API key>
&Unit::HandleHasteAuraProc, //138 <API key>
&Unit::HandleNULLProc, //139 <API key>
&Unit::HandleNULLProc, //140 <API key>
&Unit::HandleNULLProc, //141 <API key>
&Unit::HandleNULLProc, //142 <API key>
&Unit::HandleNULLProc, //143 <API key>
&Unit::HandleNULLProc, //144 <API key>
&Unit::HandleNULLProc, //145 <API key>
&Unit::HandleNULLProc, //146 <API key>
&Unit::HandleNULLProc, //147 <API key>
&Unit::HandleNULLProc, //148 <API key>
&Unit::HandleCantTrigger, //149 <API key>
&Unit::HandleNULLProc, //150 <API key>
&Unit::HandleNULLProc, //151 <API key>
&Unit::HandleNULLProc, //152 <API key>
&Unit::HandleNULLProc, //153 <API key>
&Unit::HandleNULLProc, //154 <API key>
&Unit::HandleNULLProc, //155 <API key>
&Unit::HandleNULLProc, //156 <API key>
&Unit::HandleNULLProc, //157 <API key> (single test like spell 20782, also single for 214 aura)
&Unit::HandleNULLProc, //158 <API key>
&Unit::HandleNULLProc, //159 <API key>
&Unit::HandleNULLProc, //160 <API key>
&Unit::HandleNULLProc, //161 <API key>
&Unit::HandleNULLProc, //162 <API key>
&Unit::HandleNULLProc, //163 <API key>
&Unit::HandleNULLProc, //164 unused (3.0.8a-3.2.2a), only one test spell 10654
&Unit::HandleNULLProc, //165 <API key>
&Unit::HandleNULLProc, //166 <API key>
&Unit::HandleNULLProc, //167 <API key>
&Unit::HandleNULLProc, //168 <API key>
&Unit::HandleNULLProc, //169 <API key>
&Unit::HandleNULLProc, //170 <API key> different spells that ignore transformation effects
&Unit::HandleNULLProc, //171 <API key>
&Unit::HandleNULLProc, //172 <API key>
&Unit::HandleNULLProc, //173 unused (3.0.8a-3.2.2a) no spells, old <API key> only for Proclaim Champion spell
&Unit::HandleNULLProc, //174 <API key>
&Unit::HandleNULLProc, //175 <API key>
&Unit::HandleNULLProc, //176 <API key> only for Spirit of Redemption spell, die at aura end
&Unit::HandleNULLProc, //177 <API key> (22 spells)
&Unit::HandleNULLProc, //178 <API key>
&Unit::HandleNULLProc, //179 <API key>
&Unit::HandleNULLProc, //180 <API key>
&Unit::HandleNULLProc, //181 unused (3.0.8a-3.2.2a) old <API key>
&Unit::HandleNULLProc, //182 <API key>
&Unit::HandleNULLProc, //183 <API key> only used in 28746
&Unit::HandleNULLProc, //184 <API key>
&Unit::HandleNULLProc, //185 <API key>
&Unit::HandleNULLProc, //186 <API key>
&Unit::HandleNULLProc, //187 <API key>
&Unit::HandleNULLProc, //188 <API key>
&Unit::HandleModRating, //189 <API key>
&Unit::HandleNULLProc, //190 <API key>
&Unit::HandleNULLProc, //191 <API key>
&Unit::HandleNULLProc, //192 <API key>
&Unit::HandleNULLProc, //193 <API key> (in fact combat (any type attack) speed pct)
&Unit::HandleNULLProc, //194 <API key>
&Unit::HandleNULLProc, //195 <API key>
&Unit::HandleNULLProc, //196 <API key> (single spell 24818 in 3.2.2a)
&Unit::HandleNULLProc, //197 <API key>
&Unit::HandleNULLProc, //198 unused (3.0.8a-3.2.2a) old <API key>
&Unit::HandleNULLProc, //199 <API key>
&Unit::HandleNULLProc, //200 <API key>
&Unit::HandleNULLProc, //201 SPELL_AURA_FLY this aura enable flight mode...
&Unit::HandleNULLProc, //202 <API key>
&Unit::HandleNULLProc, //203 <API key>
&Unit::HandleNULLProc, //204 <API key>
&Unit::HandleNULLProc, //205 <API key>
&Unit::HandleNULLProc, //206 <API key>
&Unit::HandleNULLProc, //207 <API key>
&Unit::HandleNULLProc, //208 <API key>
&Unit::HandleNULLProc, //209 <API key>
&Unit::HandleNULLProc, //210 <API key>
&Unit::HandleNULLProc, //211 <API key>
&Unit::HandleNULLProc, //212 <API key>
&Unit::HandleNULLProc, //213 <API key> implemented in Player::RewardRage
&Unit::HandleNULLProc, //214 Tamed Pet Passive (single test like spell 20782, also single for 157 aura)
&Unit::HandleNULLProc, //215 <API key>
&Unit::HandleNULLProc, //216 <API key>
&Unit::HandleNULLProc, //217 unused (3.0.8a-3.2.2a)
&Unit::HandleNULLProc, //218 <API key>
&Unit::HandleNULLProc, //219 <API key>
&Unit::HandleNULLProc, //220 <API key>
&Unit::HandleNULLProc, //221 ignored
&Unit::HandleNULLProc, //222 unused (3.0.8a-3.2.2a) only for spell 44586 that not used in real spell cast
&Unit::HandleNULLProc, //223 dummy code (cast damage spell to attacker) and another dymmy (jump to another nearby raid member)
&Unit::HandleNULLProc, //224 unused (3.0.8a-3.2.2a)
&Unit::<API key>, //225 <API key>
&Unit::<API key>, //226 <API key>
&Unit::HandleNULLProc, //227 <API key>
&Unit::HandleNULLProc, //228 <API key>
&Unit::HandleNULLProc, //229 <API key>
&Unit::HandleNULLProc, //230 Commanding Shout
&Unit::<API key>, //231 <API key>
&Unit::HandleNULLProc, //232 <API key>
&Unit::HandleNULLProc, //233 set model id to the one of the creature with id m_modifier.m_miscvalue
&Unit::HandleNULLProc, //234 <API key>
&Unit::HandleNULLProc, //235 <API key>
&Unit::HandleNULLProc, //236 <API key>
&Unit::HandleNULLProc, //237 <API key>
&Unit::HandleNULLProc, //238 <API key>
&Unit::HandleNULLProc, //239 <API key> only in Noggenfogger Elixir (16595) before 2.3.0 aura 61
&Unit::HandleNULLProc, //240 <API key>
&Unit::HandleNULLProc, //241 Forces the player to move forward
&Unit::HandleNULLProc, //242 <API key> (only 2 test spels in 3.2.2a)
&Unit::HandleNULLProc, //243 faction reaction override spells
&Unit::HandleNULLProc, //244 <API key>
&Unit::HandleNULLProc, //245 <API key>
&Unit::HandleNULLProc, //246 <API key>
&Unit::HandleNULLProc, //247 target to become a clone of the caster
&Unit::HandleNULLProc, //248 <API key>
&Unit::HandleNULLProc, //249 <API key>
&Unit::HandleNULLProc, //250 <API key>
&Unit::HandleNULLProc, //251 <API key>
&Unit::HandleNULLProc, //252 SPELL_AURA_SLOW_ALL
&Unit::HandleNULLProc, //253 <API key>
&Unit::HandleNULLProc, //254 <API key> disarm Shield
&Unit::HandleNULLProc, //255 <API key>
&Unit::HandleNULLProc, //256 <API key> Use SpellClassMask for spell select
&Unit::HandleNULLProc, //257 <API key> Use SpellClassMask for spell select
&Unit::HandleNULLProc, //258 <API key>
&Unit::HandleNULLProc, //259 corrupt healing over time spell
&Unit::HandleNULLProc, //260 <API key> (miscvalue = id in ScreenEffect.dbc) not required any code
&Unit::HandleNULLProc, //261 SPELL_AURA_PHASE undetectable invisibility?
&Unit::HandleNULLProc, //262 <API key>
&Unit::HandleNULLProc, //263 <API key> player can use only abilities set in SpellClassMask
&Unit::HandleNULLProc, //264 unused (3.0.8a-3.2.2a)
&Unit::HandleNULLProc, //265 unused (3.0.8a-3.2.2a)
&Unit::HandleNULLProc, //266 unused (3.0.8a-3.2.2a)
&Unit::HandleNULLProc, //267 <API key>
&Unit::HandleNULLProc, //268 <API key>
&Unit::HandleNULLProc, //269 <API key>
&Unit::HandleNULLProc, //270 <API key> (unused in 3.2.2a)
&Unit::<API key>, //271 <API key>
&Unit::HandleNULLProc, //272 <API key> (unclear use for aura, it used in (3.2.2a...3.3.0) in single spell 53817 that spellmode stacked and charged spell expected to be drop as stack
&Unit::HandleNULLProc, //273 SPELL_AURA_X_RAY (client side implementation)
&Unit::HandleNULLProc, //274 proc free shot?
&Unit::HandleNULLProc, //275 <API key> Use SpellClassMask for spell select
&Unit::HandleNULLProc, //276 mod damage % mechanic?
&Unit::HandleNULLProc, //277 <API key> Use SpellClassMask for spell select
&Unit::HandleNULLProc, //278 <API key> disarm ranged weapon
&Unit::HandleNULLProc, //279 visual effects? 58836 and 57507
&Unit::HandleNULLProc, //280 <API key>
&Unit::HandleNULLProc, //281 <API key>
&Unit::HandleNULLProc, //282 <API key>
&Unit::HandleNULLProc, //283 <API key>
&Unit::HandleNULLProc, //284 51 spells
&Unit::HandleNULLProc, //285 <API key>
&Unit::HandleNULLProc, //286 <API key>
&Unit::HandleNULLProc, //287 <API key>
&Unit::HandleNULLProc, //288 increase parry/deflect, prevent attack (single spell used 67801)
&Unit::HandleNULLProc, //289 unused (3.2.2a)
&Unit::HandleNULLProc, //290 <API key>
&Unit::HandleNULLProc, //291 <API key>
&Unit::HandleNULLProc, //292 call stabled pet
&Unit::HandleNULLProc, //293 3 spells
&Unit::HandleNULLProc, //294 2 spells, possible prevent mana regen
&Unit::HandleNULLProc, //295 unused (3.2.2a)
&Unit::HandleNULLProc, //296 2 spells
&Unit::HandleNULLProc, //297 1 spell (counter spell school?)
&Unit::HandleNULLProc, //298 unused (3.2.2a)
&Unit::HandleNULLProc, //299 unused (3.2.2a)
&Unit::HandleNULLProc, //300 3 spells (share damage?)
&Unit::HandleNULLProc, //301 5 spells
&Unit::HandleNULLProc, //302 unused (3.2.2a)
&Unit::HandleNULLProc, //303 17 spells
&Unit::HandleNULLProc, //304 2 spells (alcohol effect?)
&Unit::HandleNULLProc, //305 <API key>
&Unit::HandleNULLProc, //306 1 spell
&Unit::HandleNULLProc, //307 absorb healing?
&Unit::HandleNULLProc, //308 new aura for hunter traps
&Unit::HandleNULLProc, //309 absorb healing?
&Unit::HandleNULLProc, //310 pet avoidance passive?
&Unit::HandleNULLProc, //311 0 spells in 3.3
&Unit::HandleNULLProc, //312 0 spells in 3.3
&Unit::HandleNULLProc, //313 0 spells in 3.3
&Unit::HandleNULLProc, //314 1 test spell (reduce duration of silince/magic)
&Unit::HandleNULLProc, //315 underwater walking
&Unit::HandleNULLProc //316 makes haste affect HOT/DOT ticks
};
bool Unit::<API key>(Unit *pVictim, SpellAuraHolder* holder, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, SpellProcEventEntry const*& spellProcEvent )
{
SpellEntry const* spellProto = holder->GetSpellProto ();
// Get proc Event Entry
spellProcEvent = sSpellMgr.GetSpellProcEvent(spellProto->Id);
// Get EventProcFlag
uint32 EventProcFlag;
if (spellProcEvent && spellProcEvent->procFlags) // if exist get custom spellProcEvent->procFlags
EventProcFlag = spellProcEvent->procFlags;
else
EventProcFlag = spellProto->procFlags; // else get from spell proto
// Continue if no trigger exist
if (!EventProcFlag)
return false;
// Check spellProcEvent data requirements
if(!SpellMgr::<API key>(spellProcEvent, EventProcFlag, procSpell, procFlag, procExtra))
return false;
// In most cases req get honor or XP from kill
if (EventProcFlag & PROC_FLAG_KILL && GetTypeId() == TYPEID_PLAYER)
{
bool allow = ((Player*)this)->isHonorOrXPTarget(pVictim);
// Shadow Word: Death - can trigger from every kill
if (holder->GetId() == 32409)
allow = true;
if (!allow)
return false;
}
// Aura added by spell can`t trigger from self (prevent drop charges/do triggers)
// But except periodic triggers (can triggered from self)
if(procSpell && procSpell->Id == spellProto->Id && !(spellProto->procFlags & <API key>))
return false;
// Check if current equipment allows aura to proc
if(!isVictim && GetTypeId() == TYPEID_PLAYER)
{
if(spellProto->EquippedItemClass == ITEM_CLASS_WEAPON)
{
Item *item = NULL;
if(attType == BASE_ATTACK)
item = ((Player*)this)->GetItemByPos(<API key>, <API key>);
else if (attType == OFF_ATTACK)
item = ((Player*)this)->GetItemByPos(<API key>, <API key>);
else
item = ((Player*)this)->GetItemByPos(<API key>, <API key>);
if(!item || item->IsBroken() || item->GetProto()->Class != ITEM_CLASS_WEAPON || !((1<<item->GetProto()->SubClass) & spellProto-><API key>))
return false;
}
else if(spellProto->EquippedItemClass == ITEM_CLASS_ARMOR)
{
// Check if player is wearing shield
Item *item = ((Player*)this)->GetItemByPos(<API key>, <API key>);
if(!item || item->IsBroken() || !<API key>(OFF_ATTACK) || item->GetProto()->Class != ITEM_CLASS_ARMOR || !((1<<item->GetProto()->SubClass) & spellProto-><API key>))
return false;
}
}
// Get chance from spell
float chance = (float)spellProto->procChance;
// If in spellProcEvent exist custom chance, chance = spellProcEvent->customChance;
if(spellProcEvent && spellProcEvent->customChance)
chance = spellProcEvent->customChance;
// If PPM exist calculate chance from PPM
if(!isVictim && spellProcEvent && spellProcEvent->ppmRate != 0)
{
uint32 WeaponSpeed = GetAttackTime(attType);
chance = GetPPMProcChance(WeaponSpeed, spellProcEvent->ppmRate);
}
// Apply chance modifier aura
if(Player* modOwner = GetSpellModOwner())
{
modOwner->ApplySpellMod(spellProto->Id,<API key>,chance);
modOwner->ApplySpellMod(spellProto->Id,<API key>,chance);
}
return roll_chance_f(chance);
}
SpellAuraProcResult Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const * /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
{
SpellEntry const *hasteSpell = triggeredByAura->GetSpellProto();
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
uint32 triggered_spell_id = 0;
Unit* target = pVictim;
int32 basepoints0 = 0;
switch(hasteSpell->SpellFamilyName)
{
case SPELLFAMILY_ROGUE:
{
switch(hasteSpell->Id)
{
// Blade Flurry
case 13877:
case 33735:
{
target = <API key>(pVictim);
if(!target)
return <API key>;
basepoints0 = damage;
triggered_spell_id = 22482;
break;
}
}
break;
}
}
// processed charge only counting case
if(!triggered_spell_id)
return SPELL_AURA_PROC_OK;
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
if(!triggerEntry)
{
sLog.outError("Unit::HandleHasteAuraProc: Spell %u have nonexistent triggered spell %u",hasteSpell->Id,triggered_spell_id);
return <API key>;
}
// default case
if (!target || (target != this && !target->isAlive()))
return <API key>;
if (cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
return <API key>;
if (basepoints0)
CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
else
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
if (cooldown && GetTypeId()==TYPEID_PLAYER)
((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return SPELL_AURA_PROC_OK;
}
SpellAuraProcResult Unit::<API key>(Unit *pVictim, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
{
if (!procSpell)
return <API key>;
SpellEntry const *<API key> = triggeredByAura->GetSpellProto();
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
uint32 triggered_spell_id = 0;
Unit* target = pVictim;
int32 basepoints0 = 0;
switch(<API key>->SpellFamilyName)
{
case SPELLFAMILY_MAGE:
{
switch(<API key>->Id)
{
// Focus Magic
case 54646:
{
Unit* caster = triggeredByAura->GetCaster();
if (!caster)
return <API key>;
triggered_spell_id = 54648;
target = caster;
break;
}
}
}
}
// processed charge only counting case
if (!triggered_spell_id)
return SPELL_AURA_PROC_OK;
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
if(!triggerEntry)
{
sLog.outError("Unit::HandleHasteAuraProc: Spell %u have nonexistent triggered spell %u",<API key>->Id,triggered_spell_id);
return <API key>;
}
// default case
if (!target || (target != this && !target->isAlive()))
return <API key>;
if (cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
return <API key>;
if (basepoints0)
CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
else
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
if (cooldown && GetTypeId()==TYPEID_PLAYER)
((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return SPELL_AURA_PROC_OK;
}
SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
{
SpellEntry const *dummySpell = triggeredByAura->GetSpellProto ();
SpellEffectIndex effIndex = triggeredByAura->GetEffIndex();
int32 triggerAmount = triggeredByAura->GetModifier()->m_amount;
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
// some dummy spells have trigger spell in spell data already (from 3.0.3)
uint32 triggered_spell_id = dummySpell->EffectApplyAuraName[effIndex] == SPELL_AURA_DUMMY ? dummySpell->EffectTriggerSpell[effIndex] : 0;
Unit* target = pVictim;
int32 basepoints[MAX_EFFECT_INDEX] = {0, 0, 0};
ObjectGuid originalCaster = ObjectGuid();
switch(dummySpell->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
{
switch (dummySpell->Id)
{
// Eye for an Eye
case 9799:
case 25988:
{
// return damage % to attacker but < 50% own total health
basepoints[0] = triggerAmount*int32(damage)/100;
if (basepoints[0] > (int32)GetMaxHealth()/2)
basepoints[0] = (int32)GetMaxHealth()/2;
triggered_spell_id = 25997;
break;
}
// Sweeping Strikes (NPC spells may be)
case 18765:
case 35429:
{
// prevent chain of triggered spell from same triggered spell
if (procSpell && procSpell->Id == 26654)
return <API key>;
target = <API key>(pVictim);
if(!target)
return <API key>;
triggered_spell_id = 26654;
break;
}
// Twisted Reflection (boss spell)
case 21063:
triggered_spell_id = 21064;
break;
// Unstable Power
case 24658:
{
if (!procSpell || procSpell->Id == 24659)
return <API key>;
// Need remove one 24659 aura
<API key>(24659);
return SPELL_AURA_PROC_OK;
}
// Restless Strength
case 24661:
{
// Need remove one 24662 aura
<API key>(24662);
return SPELL_AURA_PROC_OK;
}
// Adaptive Warding (Frostfire Regalia set)
case 28764:
{
if(!procSpell)
return <API key>;
// find Mage Armor
bool found = false;
AuraList const& mRegenInterupt = GetAurasByType(<API key>);
for(AuraList::const_iterator iter = mRegenInterupt.begin(); iter != mRegenInterupt.end(); ++iter)
{
if(SpellEntry const* iterSpellProto = (*iter)->GetSpellProto())
{
if(iterSpellProto->SpellFamilyName==SPELLFAMILY_MAGE && (iterSpellProto->SpellFamilyFlags & UI64LIT(0x10000000)))
{
found=true;
break;
}
}
}
if(!found)
return <API key>;
switch(<API key>(GetSpellSchoolMask(procSpell)))
{
case SPELL_SCHOOL_NORMAL:
case SPELL_SCHOOL_HOLY:
return <API key>; // ignored
case SPELL_SCHOOL_FIRE: triggered_spell_id = 28765; break;
case SPELL_SCHOOL_NATURE: triggered_spell_id = 28768; break;
case SPELL_SCHOOL_FROST: triggered_spell_id = 28766; break;
case SPELL_SCHOOL_SHADOW: triggered_spell_id = 28769; break;
case SPELL_SCHOOL_ARCANE: triggered_spell_id = 28770; break;
default:
return <API key>;
}
target = this;
break;
}
// Obsidian Armor (Justice Bearer`s Pauldrons shoulder)
case 27539:
{
if(!procSpell)
return <API key>;
switch(<API key>(GetSpellSchoolMask(procSpell)))
{
case SPELL_SCHOOL_NORMAL:
return <API key>; // ignore
case SPELL_SCHOOL_HOLY: triggered_spell_id = 27536; break;
case SPELL_SCHOOL_FIRE: triggered_spell_id = 27533; break;
case SPELL_SCHOOL_NATURE: triggered_spell_id = 27538; break;
case SPELL_SCHOOL_FROST: triggered_spell_id = 27534; break;
case SPELL_SCHOOL_SHADOW: triggered_spell_id = 27535; break;
case SPELL_SCHOOL_ARCANE: triggered_spell_id = 27540; break;
default:
return <API key>;
}
target = this;
break;
}
// Mana Leech (Passive) (Priest Pet Aura)
case 28305:
{
// Cast on owner
target = GetOwner();
if(!target)
return <API key>;
triggered_spell_id = 34650;
break;
}
// Divine purpose
case 31871:
case 31872:
{
// Roll chance
if (!roll_chance_i(triggerAmount))
return <API key>;
// Remove any stun effect on target
SpellAuraHolderMap& Auras = pVictim-><API key>();
for(SpellAuraHolderMap::const_iterator iter = Auras.begin(); iter != Auras.end();)
{
SpellEntry const *spell = iter->second->GetSpellProto();
if( spell->Mechanic == MECHANIC_STUN ||
iter->second->HasMechanic(MECHANIC_STUN))
{
pVictim-><API key>(spell->Id);
iter = Auras.begin();
}
else
++iter;
}
return SPELL_AURA_PROC_OK;
}
// Mark of Malice
case 33493:
{
// Cast finish spell at last charge
if (triggeredByAura->GetHolder()->GetAuraCharges() > 1)
return <API key>;
target = this;
triggered_spell_id = 33494;
break;
}
// Vampiric Aura (boss spell)
case 38196:
{
basepoints[0] = 3 * damage; // 300%
if (basepoints[0] < 0)
return <API key>;
triggered_spell_id = 31285;
target = this;
break;
}
// Aura of Madness (Darkmoon Card: Madness trinket)
// 39511 Sociopath: +35 strength (Paladin, Rogue, Druid, Warrior)
// 40997 Delusional: +70 attack power (Rogue, Hunter, Paladin, Warrior, Druid)
// 40998 Kleptomania: +35 agility (Warrior, Rogue, Paladin, Hunter, Druid)
// 40999 Megalomania: +41 damage/healing (Druid, Shaman, Priest, Warlock, Mage, Paladin)
// 41002 Paranoia: +35 spell/melee/ranged crit strike rating (All classes)
// 41005 Manic: +35 haste (spell, melee and ranged) (All classes)
// 41009 Narcissism: +35 intellect (Druid, Shaman, Priest, Warlock, Mage, Paladin, Hunter)
// 41011 Martyr Complex: +35 stamina (All classes)
// 41406 Dementia: Every 5 seconds either gives you +5% damage/healing. (Druid, Shaman, Priest, Warlock, Mage, Paladin)
// 41409 Dementia: Every 5 seconds either gives you -5% damage/healing. (Druid, Shaman, Priest, Warlock, Mage, Paladin)
case 39446:
{
if(GetTypeId() != TYPEID_PLAYER)
return <API key>;
// Select class defined buff
switch (getClass())
{
case CLASS_PALADIN: // 39511,40997,40998,40999,41002,41005,41009,41011,41409
case CLASS_DRUID: // 39511,40997,40998,40999,41002,41005,41009,41011,41409
{
uint32 RandomSpell[]={39511,40997,40998,40999,41002,41005,41009,41011,41409};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_ROGUE: // 39511,40997,40998,41002,41005,41011
case CLASS_WARRIOR: // 39511,40997,40998,41002,41005,41011
{
uint32 RandomSpell[]={39511,40997,40998,41002,41005,41011};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_PRIEST: // 40999,41002,41005,41009,41011,41406,41409
case CLASS_SHAMAN: // 40999,41002,41005,41009,41011,41406,41409
case CLASS_MAGE: // 40999,41002,41005,41009,41011,41406,41409
case CLASS_WARLOCK: // 40999,41002,41005,41009,41011,41406,41409
{
uint32 RandomSpell[]={40999,41002,41005,41009,41011,41406,41409};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_HUNTER: // 40997,40999,41002,41005,41009,41011,41406,41409
{
uint32 RandomSpell[]={40997,40999,41002,41005,41009,41011,41406,41409};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
default:
return <API key>;
}
target = this;
if (roll_chance_i(10))
((Player*)this)->Say("This is Madness!", LANG_UNIVERSAL);
break;
}
// Sunwell Exalted Caster Neck (Shattered Sun Pendant of Acumen neck)
// cast 45479 Light's Wrath if Exalted by Aldor
// cast 45429 Arcane Bolt if Exalted by Scryers
case 45481:
{
if(GetTypeId() != TYPEID_PLAYER)
return <API key>;
// Get Aldor reputation rank
if (((Player *)this)->GetReputationRank(932) == REP_EXALTED)
{
target = this;
triggered_spell_id = 45479;
break;
}
// Get Scryers reputation rank
if (((Player *)this)->GetReputationRank(934) == REP_EXALTED)
{
// triggered at positive/self casts also, current attack target used then
if(IsFriendlyTo(target))
{
target = getVictim();
if(!target)
{
target = ObjectAccessor::GetUnit(*this,((Player *)this)->GetSelectionGuid());
if(!target)
return <API key>;
}
if(IsFriendlyTo(target))
return <API key>;
}
triggered_spell_id = 45429;
break;
}
return <API key>;
}
// Sunwell Exalted Melee Neck (Shattered Sun Pendant of Might neck)
// cast 45480 Light's Strength if Exalted by Aldor
// cast 45428 Arcane Strike if Exalted by Scryers
case 45482:
{
if(GetTypeId() != TYPEID_PLAYER)
return <API key>;
// Get Aldor reputation rank
if (((Player *)this)->GetReputationRank(932) == REP_EXALTED)
{
target = this;
triggered_spell_id = 45480;
break;
}
// Get Scryers reputation rank
if (((Player *)this)->GetReputationRank(934) == REP_EXALTED)
{
triggered_spell_id = 45428;
break;
}
return <API key>;
}
// Sunwell Exalted Tank Neck (Shattered Sun Pendant of Resolve neck)
// cast 45431 Arcane Insight if Exalted by Aldor
// cast 45432 Light's Ward if Exalted by Scryers
case 45483:
{
if(GetTypeId() != TYPEID_PLAYER)
return <API key>;
// Get Aldor reputation rank
if (((Player *)this)->GetReputationRank(932) == REP_EXALTED)
{
target = this;
triggered_spell_id = 45432;
break;
}
// Get Scryers reputation rank
if (((Player *)this)->GetReputationRank(934) == REP_EXALTED)
{
target = this;
triggered_spell_id = 45431;
break;
}
return <API key>;
}
// Sunwell Exalted Healer Neck (Shattered Sun Pendant of Restoration neck)
// cast 45478 Light's Salvation if Exalted by Aldor
// cast 45430 Arcane Surge if Exalted by Scryers
case 45484:
{
if(GetTypeId() != TYPEID_PLAYER)
return <API key>;
// Get Aldor reputation rank
if (((Player *)this)->GetReputationRank(932) == REP_EXALTED)
{
target = this;
triggered_spell_id = 45478;
break;
}
// Get Scryers reputation rank
if (((Player *)this)->GetReputationRank(934) == REP_EXALTED)
{
triggered_spell_id = 45430;
break;
}
return <API key>;
}
/*
// Sunwell Exalted Caster Neck (??? neck)
// cast ??? Light's Wrath if Exalted by Aldor
// cast ??? Arcane Bolt if Exalted by Scryers*/
case 46569:
return <API key>; // old unused version
// Living Seed
case 48504:
{
triggered_spell_id = 48503;
basepoints[0] = triggerAmount;
target = this;
break;
}
// Health Leech (used by Bloodworms)
case 50453:
{
Unit *owner = GetOwner();
if (!owner)
return <API key>;
triggered_spell_id = 50454;
basepoints[0] = int32(damage*1.69);
target = owner;
break;
}
// Vampiric Touch (generic, used by some boss)
case 52723:
case 60501:
{
triggered_spell_id = 52724;
basepoints[0] = damage / 2;
target = this;
break;
}
// Shadowfiend Death (Gain mana if pet dies with Glyph of Shadowfiend)
case 57989:
{
Unit *owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
return <API key>;
// Glyph of Shadowfiend (need cast as self cast for owner, no hidden cooldown)
owner->CastSpell(owner,58227,true,castItem,triggeredByAura);
return SPELL_AURA_PROC_OK;
}
// Kill Command, pet aura
case 58914:
{
// also decrease owner buff stack
if (Unit* owner = GetOwner())
owner-><API key>(34027);
// Remove only single aura from stack
if (triggeredByAura->GetStackAmount() > 1 && !triggeredByAura->GetHolder()->ModStackAmount(-1))
return <API key>;
}
// Glyph of Life Tap
case 63320:
triggered_spell_id = 63321;
break;
// Shiny Shard of the Scale - Equip Effect
case 69739:
// Cauterizing Heal or Searing Flame
triggered_spell_id = (procFlag & <API key>) ? 69734 : 69730;
break;
// Purified Shard of the Scale - Equip Effect
case 69755:
// Cauterizing Heal or Searing Flame
triggered_spell_id = (procFlag & <API key>) ? 69733 : 69729;
break;
case 70871:
// Soul of Blood qween
triggered_spell_id = 70872;
basepoints[0] = int32(triggerAmount* damage /100);
if (basepoints[0] < 0)
return <API key>;
break;
// Glyph of Shadowflame
case 63310:
{
triggered_spell_id = 63311;
break;
}
// Item - Shadowmourne Legendary
case 71903:
{
if (!roll_chance_i(triggerAmount))
return <API key>;
triggered_spell_id = 71905; // Soul Fragment
SpellAuraHolder *aurHolder = GetSpellAuraHolder(triggered_spell_id);
// will added first to stack
if (!aurHolder)
CastSpell(this, 72521, true); // Shadowmourne Visual Low
// half stack
else if (aurHolder->GetStackAmount() + 1 == 6)
CastSpell(this, 72523, true); // Shadowmourne Visual High
// full stack
else if (aurHolder->GetStackAmount() + 1 >= aurHolder->GetSpellProto()->StackAmount)
{
<API key>(triggered_spell_id);
CastSpell(this, 71904, true); // Chaos Bane
return SPELL_AURA_PROC_OK;
}
break;
}
// Deathbringer's Will (Item - Icecrown 25 Normal Melee Trinket)
// 71492 Speed of the Vrykul: +600 haste rating (Death Knight, Druid, Paladin, Rogue, Warrior, Shaman)
// 71485 Agility of the Vrykul: +600 agility (Druid, Hunter, Rogue, Shaman)
// 71486 Power of the Taunka: +1200 attack power (Hunter, Rogue, Shaman)
// 71484 Strength of the Taunka: +600 strength (Death Knight, Druid, Paladin, Warrior)
// 71491 Aim of the Iron Dwarves: +600 critical strike rating (Death Knight, Hunter, Paladin, Warrior)
case 71519:
{
if(GetTypeId() != TYPEID_PLAYER)
return <API key>;
if(HasAura(71491) || HasAura(71484) || HasAura(71492) || HasAura(71486) || HasAura(71485))
return <API key>;
// Select class defined buff
switch (getClass())
{
case CLASS_PALADIN:
{
uint32 RandomSpell[]={71492,71484,71491};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_DRUID:
{
uint32 RandomSpell[]={71492,71485,71484};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_ROGUE:
{
uint32 RandomSpell[]={71492,71485,71486};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_WARRIOR:
{
uint32 RandomSpell[]={71492,71484,71491};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_SHAMAN:
{
uint32 RandomSpell[]={71485,71486,71492};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_HUNTER:
{
uint32 RandomSpell[]={71485,71486,71491};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_DEATH_KNIGHT:
{
uint32 RandomSpell[]={71484,71492,71491};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
default:
return <API key>;
}
break;
}
// Deathbringer's Will (Item - Icecrown 25 Heroic Melee Trinket)
// 71560 Speed of the Vrykul: +700 haste rating (Death Knight, Druid, Paladin, Rogue, Warrior, Shaman)
// 71556 Agility of the Vrykul: +700 agility (Druid, Hunter, Rogue, Shaman)
// 71558 Power of the Taunka: +1400 attack power (Hunter, Rogue, Shaman)
// 71561 Strength of the Taunka: +700 strength (Death Knight, Druid, Paladin, Warrior)
// 71559 Aim of the Iron Dwarves: +700 critical strike rating (Death Knight, Hunter, Paladin, Warrior)
case 71562:
{
if(GetTypeId() != TYPEID_PLAYER)
return <API key>;
if(HasAura(71559) || HasAura(71561) || HasAura(71560) || HasAura(71556) || HasAura(71558))
return <API key>;
// Select class defined buff
switch (getClass())
{
case CLASS_PALADIN:
{
uint32 RandomSpell[]={71560,71561,71559};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_DRUID:
{
uint32 RandomSpell[]={71560,71556,71561};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_ROGUE:
{
uint32 RandomSpell[]={71560,71556,71558,};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_WARRIOR:
{
uint32 RandomSpell[]={71560,71561,71559,};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_SHAMAN:
{
uint32 RandomSpell[]={71556,71558,71560};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_HUNTER:
{
uint32 RandomSpell[]={71556,71558,71559};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
case CLASS_DEATH_KNIGHT:
{
uint32 RandomSpell[]={71561,71560,71559};
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
break;
}
default:
return <API key>;
}
break;
}
// Necrotic Touch item 50692
case 71875:
case 71877:
{
basepoints[0] = damage * triggerAmount / 100;
target = pVictim;
triggered_spell_id = 71879;
break;
}
}
break;
}
case SPELLFAMILY_MAGE:
{
// Magic Absorption
if (dummySpell->SpellIconID == 459) // only this spell have SpellIconID == 459 and dummy aura
{
if (getPowerType() != POWER_MANA)
return <API key>;
// mana reward
basepoints[0] = (triggerAmount * GetMaxPower(POWER_MANA) / 100);
target = this;
triggered_spell_id = 29442;
break;
}
// Master of Elements
if (dummySpell->SpellIconID == 1920)
{
if(!procSpell)
return <API key>;
// mana cost save
int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100;
basepoints[0] = cost * triggerAmount/100;
if (basepoints[0] <=0)
return <API key>;
target = this;
triggered_spell_id = 29077;
break;
}
// Arcane Potency
if (dummySpell->SpellIconID == 2120)
{
if(!procSpell || procSpell->Id == 44401)
return <API key>;
target = this;
switch (dummySpell->Id)
{
case 31571: triggered_spell_id = 57529; break;
case 31572: triggered_spell_id = 57531; break;
default:
sLog.outError("Unit::HandleDummyAuraProc: non handled spell id: %u",dummySpell->Id);
return <API key>;
}
break;
}
// Hot Streak
if (dummySpell->SpellIconID == 2999)
{
if (effIndex != EFFECT_INDEX_0)
return SPELL_AURA_PROC_OK;
Aura *counter = GetAura(triggeredByAura->GetId(), EFFECT_INDEX_1);
if (!counter)
return SPELL_AURA_PROC_OK;
// Count spell criticals in a row in second aura
Modifier *mod = counter->GetModifier();
if (procEx & <API key>)
{
mod->m_amount *=2;
if (mod->m_amount < 100) // not enough
return SPELL_AURA_PROC_OK;
// Critical counted -> roll chance
if (roll_chance_i(triggerAmount))
CastSpell(this, 48108, true, castItem, triggeredByAura);
}
mod->m_amount = 25;
return SPELL_AURA_PROC_OK;
}
// Burnout
if (dummySpell->SpellIconID == 2998)
{
if(!procSpell)
return <API key>;
int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100;
basepoints[0] = cost * triggerAmount/100;
if (basepoints[0] <=0)
return <API key>;
triggered_spell_id = 44450;
target = this;
break;
}
// Incanter's Regalia set (add trigger chance to Mana Shield)
if (dummySpell->SpellFamilyFlags & UI64LIT(0x0000000000008000))
{
if (GetTypeId() != TYPEID_PLAYER)
return <API key>;
target = this;
triggered_spell_id = 37436;
break;
}
switch(dummySpell->Id)
{
// Ignite
case 11119:
case 11120:
case 12846:
case 12847:
case 12848:
{
switch (dummySpell->Id)
{
case 11119: basepoints[0] = int32(0.04f*damage); break;
case 11120: basepoints[0] = int32(0.08f*damage); break;
case 12846: basepoints[0] = int32(0.12f*damage); break;
case 12847: basepoints[0] = int32(0.16f*damage); break;
case 12848: basepoints[0] = int32(0.20f*damage); break;
default:
sLog.outError("Unit::HandleDummyAuraProc: non handled spell id: %u (IG)",dummySpell->Id);
return <API key>;
}
triggered_spell_id = 12654;
break;
}
// Empowered Fire (mana regen)
case 12654:
{
Unit* caster = triggeredByAura->GetCaster();
// it should not be triggered from other ignites
if (caster && pVictim && caster->GetGUID() == pVictim->GetGUID())
{
Unit::AuraList const& auras = caster->GetAurasByType(<API key>);
for (Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); i++)
{
switch((*i)->GetId())
{
case 31656:
case 31657:
case 31658:
{
if(roll_chance_i(int32((*i)->GetSpellProto()->procChance)))
{
caster->CastSpell(caster, 67545, true);
return SPELL_AURA_PROC_OK;
}
else
return <API key>;
}
}
}
}
return <API key>;
}
// Arcane Blast proc-off only from arcane school and not from self
case 36032:
{
if(procSpell->EffectTriggerSpell[1] == 36032 || GetSpellSchoolMask(procSpell) != <API key>)
return <API key>;
}
// Glyph of Ice Block
case 56372:
{
if (GetTypeId() != TYPEID_PLAYER)
return <API key>;
// not 100% safe with client version switches but for 3.1.3 no spells with cooldown that can have mage player except Frost Nova.
((Player*)this)-><API key>(35, true);
return SPELL_AURA_PROC_OK;
}
// Glyph of Icy Veins
case 56374:
{
Unit::AuraList const& hasteAuras = GetAurasByType(<API key>);
for(Unit::AuraList::const_iterator i = hasteAuras.begin(); i != hasteAuras.end();)
{
if (!IsPositiveSpell((*i)->GetId()))
{
<API key>((*i)->GetId());
i = hasteAuras.begin();
}
else
++i;
}
<API key>(<API key>);
<API key>(<API key>);
return SPELL_AURA_PROC_OK;
}
// Glyph of Polymorph
case 56375:
{
if (!pVictim || !pVictim->isAlive())
return <API key>;
pVictim-><API key>(<API key>);
pVictim-><API key>(<API key>);
pVictim-><API key>(<API key>);
return SPELL_AURA_PROC_OK;
}
// Blessing of Ancient Kings
case 64411:
{
// for DOT procs
if (!IsPositiveSpell(procSpell->Id))
return <API key>;
triggered_spell_id = 64413;
basepoints[0] = damage * 15 / 100;
break;
}
}
break;
}
case SPELLFAMILY_WARRIOR:
{
// Retaliation
if (dummySpell->SpellFamilyFlags == UI64LIT(0x0000000800000000))
{
// check attack comes not from behind
if (!HasInArc(M_PI_F, pVictim))
return <API key>;
triggered_spell_id = 22858;
break;
}
// Second Wind
if (dummySpell->SpellIconID == 1697)
{
// only for spells and hit/crit (trigger start always) and not start from self casted spells (5530 Mace Stun Effect for example)
if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT|<API key>)) || this == pVictim)
return <API key>;
// Need stun or root mechanic
if (!(<API key>(procSpell) & <API key>))
return <API key>;
switch (dummySpell->Id)
{
case 29838: triggered_spell_id=29842; break;
case 29834: triggered_spell_id=29841; break;
case 42770: triggered_spell_id=42771; break;
default:
sLog.outError("Unit::HandleDummyAuraProc: non handled spell id: %u (SW)",dummySpell->Id);
return <API key>;
}
target = this;
break;
}
// Damage Shield
if (dummySpell->SpellIconID == 3214)
{
triggered_spell_id = 59653;
basepoints[0] = GetShieldBlockValue() * triggerAmount / 100;
break;
}
// Sweeping Strikes
if (dummySpell->Id == 12328)
{
// prevent chain of triggered spell from same triggered spell
if(procSpell && procSpell->Id == 26654)
return <API key>;
target = <API key>(pVictim);
if(!target)
return <API key>;
triggered_spell_id = 26654;
break;
}
// Glyph of Sunder Armor
if (dummySpell->Id == 58387)
{
if (!procSpell)
return <API key>;
target = <API key>(pVictim);
if (!target)
return <API key>;
triggered_spell_id = 58567;
break;
}
break;
}
case SPELLFAMILY_WARLOCK:
{
// Seed of Corruption
if (dummySpell->SpellFamilyFlags & UI64LIT(0x0000001000000000))
{
Modifier* mod = triggeredByAura->GetModifier();
// if damage is more than need or target die from damage deal finish spell
if( mod->m_amount <= (int32)damage || GetHealth() <= damage )
{
// remember guid before aura delete
ObjectGuid casterGuid = triggeredByAura->GetCasterGuid();
// Remove aura (before cast for prevent infinite loop handlers)
<API key>(triggeredByAura->GetId());
// Cast finish spell (triggeredByAura already not exist!)
CastSpell(this, 27285, true, castItem, NULL, casterGuid);
return SPELL_AURA_PROC_OK; // no hidden cooldown
}
// Damage counting
mod->m_amount-=damage;
return SPELL_AURA_PROC_OK;
}
// Seed of Corruption (Mobs cast) - no die req
if (dummySpell->SpellFamilyFlags == UI64LIT(0x0) && dummySpell->SpellIconID == 1932)
{
Modifier* mod = triggeredByAura->GetModifier();
// if damage is more than need deal finish spell
if( mod->m_amount <= (int32)damage )
{
// remember guid before aura delete
ObjectGuid casterGuid = triggeredByAura->GetCasterGuid();
// Remove aura (before cast for prevent infinite loop handlers)
<API key>(triggeredByAura->GetId());
// Cast finish spell (triggeredByAura already not exist!)
CastSpell(this, 32865, true, castItem, NULL, casterGuid);
return SPELL_AURA_PROC_OK; // no hidden cooldown
}
// Damage counting
mod->m_amount-=damage;
return SPELL_AURA_PROC_OK;
}
// Fel Synergy
if (dummySpell->SpellIconID == 3222)
{
target = GetPet();
if (!target)
return <API key>;
basepoints[0] = damage * triggerAmount / 100;
triggered_spell_id = 54181;
break;
}
switch(dummySpell->Id)
{
// Nightfall & Glyph of Corruption
case 18094:
case 18095:
case 56218:
{
target = this;
triggered_spell_id = 17941;
break;
}
//Soul Leech
case 30293:
case 30295:
case 30296:
{
// health
basepoints[0] = int32(damage*triggerAmount/100);
target = this;
triggered_spell_id = 30294;
// check for Improved Soul Leech
AuraList const& pDummyAuras = GetAurasByType(SPELL_AURA_DUMMY);
for (AuraList::const_iterator itr = pDummyAuras.begin(); itr != pDummyAuras.end(); ++itr)
{
SpellEntry const* spellInfo = (*itr)->GetSpellProto();
if (spellInfo->SpellFamilyName != SPELLFAMILY_WARLOCK || (*itr)->GetSpellProto()->SpellIconID != 3176)
continue;
if ((*itr)->GetEffIndex() == SpellEffectIndex(0))
{
// energize Proc pet (implicit target is pet)
CastCustomSpell(this, 59118, &((*itr)->GetModifier()->m_amount), NULL, NULL, true, NULL, (*itr));
// energize Proc master
CastCustomSpell(this, 59117, &((*itr)->GetModifier()->m_amount), NULL, NULL, true, NULL, (*itr));
}
else if (roll_chance_i((*itr)->GetModifier()->m_amount))
{
// Replenishment proc
CastSpell(this, 57669, true, NULL, (*itr));
}
}
break;
}
// Shadowflame (Voidheart Raiment set bonus)
case 37377:
{
triggered_spell_id = 37379;
break;
}
// Pet Healing (Corruptor Raiment or Rift Stalker Armor)
case 37381:
{
target = GetPet();
if (!target)
return <API key>;
// heal amount
basepoints[0] = damage * triggerAmount/100;
triggered_spell_id = 37382;
break;
}
// Shadowflame Hellfire (Voidheart Raiment set bonus)
case 39437:
{
triggered_spell_id = 37378;
break;
}
// Siphon Life
case 63108:
{
// Glyph of Siphon Life
if (Aura *aur = GetAura(56216, EFFECT_INDEX_0))
triggerAmount += triggerAmount * aur->GetModifier()->m_amount / 100;
basepoints[0] = int32(damage * triggerAmount / 100);
triggered_spell_id = 63106;
break;
}
}
break;
}
case SPELLFAMILY_PRIEST:
{
// Vampiric Touch
if (dummySpell->SpellFamilyFlags & UI64LIT(0x0000040000000000))
{
if (!pVictim || !pVictim->isAlive())
return <API key>;
// pVictim is caster of aura
if (triggeredByAura->GetCasterGuid() != pVictim->GetObjectGuid())
return <API key>;
// Energize 0.25% of max. mana
pVictim->CastSpell(pVictim, 57669, true, castItem, triggeredByAura);
return SPELL_AURA_PROC_OK; // no hidden cooldown
}
switch(dummySpell->SpellIconID)
{
// Improved Shadowform
case 217:
{
if(!roll_chance_i(triggerAmount))
return <API key>;
<API key>(SPELL_AURA_MOD_ROOT);
<API key>(<API key>);
break;
}
// Divine Aegis
case 2820:
{
if(!pVictim || !pVictim->isAlive())
return <API key>;
// find Divine Aegis on the target and get absorb amount
Aura* DivineAegis = pVictim->GetAura(47753,EFFECT_INDEX_0);
if (DivineAegis)
basepoints[0] = DivineAegis->GetModifier()->m_amount;
basepoints[0] += damage * triggerAmount/100;
// limit absorb amount
int32 levelbonus = pVictim->getLevel()*125;
if (basepoints[0] > levelbonus)
basepoints[0] = levelbonus;
triggered_spell_id = 47753;
break;
}
// Empowered Renew
case 3021:
{
if (!procSpell)
return <API key>;
// Renew
Aura* healingAura = pVictim->GetAura(<API key>, SPELLFAMILY_PRIEST, UI64LIT(0x40), 0, GetGUID());
if (!healingAura)
return <API key>;
int32 healingfromticks = healingAura->GetModifier()->m_amount * <API key>(procSpell);
basepoints[0] = healingfromticks * triggerAmount / 100;
triggered_spell_id = 63544;
break;
}
// Improved Devouring Plague
case 3790:
{
if (!procSpell)
return <API key>;
Aura* leachAura = pVictim->GetAura(<API key>, SPELLFAMILY_PRIEST, UI64LIT(0x02000000), 0, GetGUID());
if (!leachAura)
return <API key>;
int32 damagefromticks = leachAura->GetModifier()->m_amount * <API key>(procSpell);
basepoints[0] = damagefromticks * triggerAmount / 100;
triggered_spell_id = 63675;
break;
}
}
switch(dummySpell->Id)
{
// Vampiric Embrace
case 15286:
{
// Return if self damage
if (this == pVictim)
return <API key>;
// Heal amount - Self/Team
int32 team = triggerAmount*damage/500;
int32 self = triggerAmount*damage/100 - team;
CastCustomSpell(this,15290,&team,&self,NULL,true,castItem,triggeredByAura);
return SPELL_AURA_PROC_OK; // no hidden cooldown
}
// Priest Tier 6 Trinket (Ashtongue Talisman of Acumen)
case 40438:
{
// Shadow Word: Pain
if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000008000))
triggered_spell_id = 40441;
// Renew
else if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000010))
triggered_spell_id = 40440;
else
return <API key>;
target = this;
break;
}
// Oracle Healing Bonus ("Garments of the Oracle" set)
case 26169:
{
// heal amount
basepoints[0] = int32(damage * 10/100);
target = this;
triggered_spell_id = 26170;
break;
}
// Frozen Shadoweave (Shadow's Embrace set) warning! its not only priest set
case 39372:
{
if(!procSpell || (GetSpellSchoolMask(procSpell) & (<API key> | <API key>))==0 )
return <API key>;
// heal amount
basepoints[0] = damage * triggerAmount/100;
target = this;
triggered_spell_id = 39373;
break;
}
// Greater Heal (Vestments of Faith (Priest Tier 3) - 4 pieces bonus)
case 28809:
{
triggered_spell_id = 28810;
break;
}
// Glyph of Dispel Magic
case 55677:
{
if(!target->IsFriendlyTo(this))
return <API key>;
if (target->GetTypeId() == TYPEID_PLAYER)
basepoints[0] = int32(target->GetMaxHealth() * triggerAmount / 100);
else if (Unit* caster = triggeredByAura->GetCaster())
basepoints[0] = int32(caster->GetMaxHealth() * triggerAmount / 100);
// triggered_spell_id in spell data
break;
}
// Item - Priest T10 Healer 4P Bonus
case 70799:
{
if (GetTypeId() != TYPEID_PLAYER)
return <API key>;
// Circle of Healing
((Player*)this)-><API key>(1204, true);
// Penance
((Player*)this)-><API key>(1230, true);
return SPELL_AURA_PROC_OK;
}
// Glyph of Prayer of Healing
case 55680:
{
basepoints[0] = int32(damage * triggerAmount / 200); // 10% each tick
triggered_spell_id = 56161;
break;
}
}
break;
}
case SPELLFAMILY_DRUID:
{
switch(dummySpell->Id)
{
// Leader of the Pack
case 24932:
{
// dummy m_amount store health percent (!=0 if Improved Leader of the Pack applied)
int32 heal_percent = triggeredByAura->GetModifier()->m_amount;
if (!heal_percent)
return <API key>;
// check explicitly only to prevent mana cast when halth cast cooldown
if (cooldown && ((Player*)this)->HasSpellCooldown(34299))
return <API key>;
// health
triggered_spell_id = 34299;
basepoints[0] = GetMaxHealth() * heal_percent / 100;
target = this;
// mana to caster
if (triggeredByAura->GetCasterGuid() == GetObjectGuid())
{
if (SpellEntry const* manaCastEntry = sSpellStore.LookupEntry(60889))
{
int32 mana_percent = manaCastEntry-><API key>(EFFECT_INDEX_0) * heal_percent;
CastCustomSpell(this, manaCastEntry, &mana_percent, NULL, NULL, true, castItem, triggeredByAura);
}
}
break;
}
// Healing Touch (Dreamwalker Raiment set)
case 28719:
{
// mana back
basepoints[0] = int32(procSpell->manaCost * 30 / 100);
target = this;
triggered_spell_id = 28742;
break;
}
// Healing Touch Refund (Idol of Longevity trinket)
case 28847:
{
target = this;
triggered_spell_id = 28848;
break;
}
// Mana Restore (Malorne Raiment set / Malorne Regalia set)
case 37288:
case 37295:
{
target = this;
triggered_spell_id = 37238;
break;
}
// Druid Tier 6 Trinket
case 40442:
{
float chance;
// Starfire
if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000004))
{
triggered_spell_id = 40445;
chance = 25.0f;
}
// Rejuvenation
else if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000010))
{
triggered_spell_id = 40446;
chance = 25.0f;
}
// Mangle (Bear) and Mangle (Cat)
else if (procSpell->SpellFamilyFlags & UI64LIT(0x0000044000000000))
{
triggered_spell_id = 40452;
chance = 40.0f;
}
else
return <API key>;
if (!roll_chance_f(chance))
return <API key>;
target = this;
break;
}
// Maim Interrupt
case 44835:
{
// Deadly Interrupt Effect
triggered_spell_id = 32747;
break;
}
// Glyph of Starfire
case 54845:
{
triggered_spell_id = 54846;
break;
}
// Glyph of Shred
case 54815:
{
triggered_spell_id = 63974;
break;
}
// Glyph of Rejuvenation
case 54754:
{
// less 50% health
if (pVictim->GetMaxHealth() < 2 * pVictim->GetHealth())
return <API key>;
basepoints[0] = triggerAmount * damage / 100;
triggered_spell_id = 54755;
break;
}
// Glyph of Rake
case 54821:
{
triggered_spell_id = 54820;
break;
}
// Item - Druid T10 Restoration 4P Bonus (Rejuvenation)
case 70664:
{
if (!procSpell || GetTypeId() != TYPEID_PLAYER)
return <API key>;
float radius;
if (procSpell->EffectRadiusIndex[EFFECT_INDEX_0])
radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(procSpell->EffectRadiusIndex[EFFECT_INDEX_0]));
else
radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(procSpell->rangeIndex));
((Player*)this)->ApplySpellMod(procSpell->Id, SPELLMOD_RADIUS, radius,NULL);
Unit *second = pVictim-><API key>(pVictim, radius);
if (!second)
return <API key>;
pVictim->CastSpell(second, procSpell, true, NULL, triggeredByAura, GetGUID());
return SPELL_AURA_PROC_OK;
}
// Item - Druid T10 Balance 4P Bonus
case 70723:
{
basepoints[0] = int32( triggerAmount * damage / 100 );
basepoints[0] = int32( basepoints[0] / 2);
triggered_spell_id = 71023;
break;
}
}
// King of the Jungle
if (dummySpell->SpellIconID == 2850)
{
switch (effIndex)
{
case EFFECT_INDEX_0: // Enrage (bear)
{
// note : aura removal is done in SpellAuraHolder::<API key>
basepoints[0] = triggerAmount;
triggered_spell_id = 51185;
break;
}
case EFFECT_INDEX_1: // Tiger's Fury (cat)
{
basepoints[0] = triggerAmount;
triggered_spell_id = 51178;
break;
}
default:
return <API key>;
}
}
// Eclipse
else if (dummySpell->SpellIconID == 2856)
{
if (!procSpell)
return <API key>;
// Wrath crit
if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000001))
{
if (HasAura(48517))
return <API key>;
if (!roll_chance_i(60))
return <API key>;
triggered_spell_id = 48518;
target = this;
break;
}
// Starfire crit
if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000004))
{
if (HasAura(48518))
return <API key>;
triggered_spell_id = 48517;
target = this;
break;
}
return <API key>;
}
// Living Seed
else if (dummySpell->SpellIconID == 2860)
{
triggered_spell_id = 48504;
basepoints[0] = triggerAmount * damage / 100;
break;
}
break;
}
case SPELLFAMILY_ROGUE:
{
switch(dummySpell->Id)
{
// Clean Escape
case 23582:
// triggered spell have same masks and etc with main Vanish spell
if (!procSpell || procSpell->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_NONE)
return <API key>;
triggered_spell_id = 23583;
break;
// Deadly Throw Interrupt
case 32748:
{
// Prevent cast Deadly Throw Interrupt on self from last effect (apply dummy) of Deadly Throw
if (this == pVictim)
return <API key>;
triggered_spell_id = 32747;
break;
}
// Glyph of Backstab
case 56800:
{
if (Aura* aura = target->GetAura(<API key>, SPELLFAMILY_ROGUE, UI64LIT(0x00100000), 0, GetGUID()))
{
uint32 countMin = aura->GetAuraMaxDuration();
uint32 countMax = GetSpellMaxDuration(aura->GetSpellProto());
countMax += 3 * triggerAmount * 1000;
countMax += HasAura(56801) ? 4000 : 0;
if (countMin < countMax)
{
aura->SetAuraDuration(aura->GetAuraDuration() + triggerAmount * 1000);
aura->SetAuraMaxDuration(countMin + triggerAmount * 1000);
aura->GetHolder()->SendAuraUpdate(false);
return SPELL_AURA_PROC_OK;
}
}
return <API key>;
}
// Tricks of the trade
case 57934:
{
triggered_spell_id = 57933; // Tricks of the Trade, increased damage buff
target = <API key>().<API key>();
if (!target)
return <API key>;
CastSpell(this, 59628, true); // Tricks of the Trade (caster timer)
break;
}
}
// Cut to the Chase
if (dummySpell->SpellIconID == 2909)
{
// "refresh your Slice and Dice duration to its 5 combo point maximum"
// lookup Slice and Dice
AuraList const& sd = GetAurasByType(<API key>);
for(AuraList::const_iterator itr = sd.begin(); itr != sd.end(); ++itr)
{
SpellEntry const *spellProto = (*itr)->GetSpellProto();
if (spellProto->SpellFamilyName == SPELLFAMILY_ROGUE &&
(spellProto->SpellFamilyFlags & UI64LIT(0x0000000000040000)))
{
int32 duration = GetSpellMaxDuration(spellProto);
if(GetTypeId() == TYPEID_PLAYER)
static_cast<Player*>(this)->ApplySpellMod(spellProto->Id, SPELLMOD_DURATION, duration);
(*itr)->SetAuraMaxDuration(duration);
(*itr)->GetHolder()->RefreshHolder();
return SPELL_AURA_PROC_OK;
}
}
return <API key>;
}
// Deadly Brew
if (dummySpell->SpellIconID == 2963)
{
triggered_spell_id = 44289;
break;
}
// Quick Recovery
if (dummySpell->SpellIconID == 2116)
{
if(!procSpell)
return <API key>;
//do not proc from spells that do not need combo points
if(!NeedsComboPoints(procSpell))
return <API key>;
// energy cost save
basepoints[0] = procSpell->manaCost * triggerAmount/100;
if (basepoints[0] <= 0)
return <API key>;
target = this;
triggered_spell_id = 31663;
break;
}
break;
}
case SPELLFAMILY_HUNTER:
{
// Thrill of the Hunt
if (dummySpell->SpellIconID == 2236)
{
if (!procSpell)
return <API key>;
// mana cost save
int32 mana = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100;
basepoints[0] = mana * 40/100;
if (basepoints[0] <= 0)
return <API key>;
target = this;
triggered_spell_id = 34720;
break;
}
// Hunting Party
if (dummySpell->SpellIconID == 3406)
{
triggered_spell_id = 57669;
target = this;
break;
}
// Lock and Load
if ( dummySpell->SpellIconID == 3579 )
{
// Proc only from periodic (from trap activation proc another aura of this spell)
if (!(procFlag & <API key>) || !roll_chance_i(triggerAmount))
return <API key>;
triggered_spell_id = 56453;
target = this;
break;
}
// Rapid Recuperation
if ( dummySpell->SpellIconID == 3560 )
{
// This effect only from Rapid Killing (mana regen)
if (!(procSpell->SpellFamilyFlags & UI64LIT(0x0100000000000000)))
return <API key>;
target = this;
switch(dummySpell->Id)
{
case 53228: // Rank 1
triggered_spell_id = 56654;
break;
case 53232: // Rank 2
triggered_spell_id = 58882;
break;
}
break;
}
// Glyph of Mend Pet
if(dummySpell->Id == 57870)
{
pVictim->CastSpell(pVictim, 57894, true, NULL, NULL, GetGUID());
return SPELL_AURA_PROC_OK;
}
// Misdirection
else if(dummySpell->Id == 34477)
{
triggered_spell_id = 35079; // 4 sec buff on self
target = this;
break;
}
// Guard Dog
else if (dummySpell->SpellIconID == 201 && procSpell->SpellIconID == 201)
{
triggered_spell_id = 54445;
target = this;
if (pVictim)
pVictim->AddThreat(this,procSpell->EffectBasePoints[0] * triggerAmount / 100.0f);
break;
}
break;
}
case SPELLFAMILY_PALADIN:
{
// Seal of Righteousness - melee proc dummy (addition ${$MWS*(0.022*$AP+0.044*$SPH)} damage)
if ((dummySpell->SpellFamilyFlags & UI64LIT(0x000000008000000)) && effIndex == EFFECT_INDEX_0)
{
triggered_spell_id = 25742;
float ap = <API key>(BASE_ATTACK);
int32 holy = <API key>(<API key>);
if (holy < 0)
holy = 0;
basepoints[0] = GetAttackTime(BASE_ATTACK) * int32(ap*0.022f + 0.044f * holy) / 1000;
break;
}
// Righteous Vengeance
if (dummySpell->SpellIconID == 3025)
{
// 4 damage tick
basepoints[0] = triggerAmount*damage/400;
triggered_spell_id = 61840;
break;
}
// Sheath of Light
if (dummySpell->SpellIconID == 3030)
{
// 4 healing tick
basepoints[0] = triggerAmount*damage/400;
triggered_spell_id = 54203;
break;
}
switch(dummySpell->Id)
{
// Judgement of Light
case 20185:
{
if (pVictim == this)
return <API key>;
basepoints[0] = int32( pVictim->GetMaxHealth() * triggeredByAura->GetModifier()->m_amount / 100 );
pVictim->CastCustomSpell(pVictim, 20267, &basepoints[0], NULL, NULL, true, NULL, triggeredByAura);
return SPELL_AURA_PROC_OK;
}
// Judgement of Wisdom
case 20186:
{
if (pVictim->getPowerType() == POWER_MANA)
{
// 2% of maximum base mana
basepoints[0] = int32(pVictim->GetCreateMana() * 2 / 100);
pVictim->CastCustomSpell(pVictim, 20268, &basepoints[0], NULL, NULL, true, NULL, triggeredByAura);
}
return SPELL_AURA_PROC_OK;
}
// Heart of the Crusader (Rank 1)
case 20335:
triggered_spell_id = 21183;
break;
// Heart of the Crusader (Rank 2)
case 20336:
triggered_spell_id = 54498;
break;
// Heart of the Crusader (Rank 3)
case 20337:
triggered_spell_id = 54499;
break;
case 20911: // Blessing of Sanctuary
case 25899: // Greater Blessing of Sanctuary
{
target = this;
switch (target->getPowerType())
{
case POWER_MANA:
triggered_spell_id = 57319;
break;
default:
return <API key>;
}
break;
}
// Holy Power (Redemption Armor set)
case 28789:
{
if(!pVictim)
return <API key>;
// Set class defined buff
switch (pVictim->getClass())
{
case CLASS_PALADIN:
case CLASS_PRIEST:
case CLASS_SHAMAN:
case CLASS_DRUID:
triggered_spell_id = 28795; // Increases the friendly target's mana regeneration by $s1 per 5 sec. for $d.
break;
case CLASS_MAGE:
case CLASS_WARLOCK:
triggered_spell_id = 28793; // Increases the friendly target's spell damage and healing by up to $s1 for $d.
break;
case CLASS_HUNTER:
case CLASS_ROGUE:
triggered_spell_id = 28791; // Increases the friendly target's attack power by $s1 for $d.
break;
case CLASS_WARRIOR:
triggered_spell_id = 28790; // Increases the friendly target's armor
break;
default:
return <API key>;
}
break;
}
// Spiritual Attunement
case 31785:
case 33776:
{
// if healed by another unit (pVictim)
if (this == pVictim)
return <API key>;
// dont count overhealing
uint32 diff = GetMaxHealth()-GetHealth();
if (!diff)
return <API key>;
if (damage > diff)
basepoints[0] = triggerAmount*diff/100;
else
basepoints[0] = triggerAmount*damage/100;
target = this;
triggered_spell_id = 31786;
break;
}
// Seal of Vengeance (damage calc on apply aura)
case 31801:
{
if (effIndex != EFFECT_INDEX_0) // effect 1,2 used by seal unleashing code
return <API key>;
// At melee attack or Hammer of the Righteous spell damage considered as melee attack
if ((procFlag & <API key>) || (procSpell && procSpell->Id == 53595) )
triggered_spell_id = 31803; // Holy Vengeance
// Add 5-stack effect from Holy Vengeance
uint32 stacks = 0;
AuraList const& auras = target->GetAurasByType(<API key>);
for(AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
{
if (((*itr)->GetId() == 31803) && (*itr)->GetCasterGuid() == GetObjectGuid())
{
stacks = (*itr)->GetStackAmount();
break;
}
}
if (stacks >= 5)
CastSpell(target,42463,true,NULL,triggeredByAura);
break;
}
// Judgements of the Wise
case 31876:
case 31877:
case 31878:
// triggered only at casted Judgement spells, not at additional Judgement effects
if(!procSpell || procSpell->Category != 1210)
return <API key>;
target = this;
triggered_spell_id = 31930;
// Replenishment
CastSpell(this, 57669, true, NULL, triggeredByAura);
break;
// Paladin Tier 6 Trinket (Ashtongue Talisman of Zeal)
case 40470:
{
if (!procSpell)
return <API key>;
float chance;
// Flash of light/Holy light
if (procSpell->SpellFamilyFlags & UI64LIT(0x00000000C0000000))
{
triggered_spell_id = 40471;
chance = 15.0f;
}
// Judgement (any)
else if (GetSpellSpecific(procSpell->Id)==SPELL_JUDGEMENT)
{
triggered_spell_id = 40472;
chance = 50.0f;
}
else
return <API key>;
if (!roll_chance_f(chance))
return <API key>;
break;
}
// Light's Beacon (heal target area aura)
case 53651:
{
// not do bonus heal for explicit beacon focus healing
if (GetObjectGuid() == triggeredByAura->GetCasterGuid())
return <API key>;
// beacon
Unit* beacon = triggeredByAura->GetCaster();
if (!beacon)
return <API key>;
if (procSpell->Id == 20267)
return <API key>;
// find caster main aura at beacon
Aura* dummy = NULL;
Unit::AuraList const& baa = beacon->GetAurasByType(<API key>);
for(Unit::AuraList::const_iterator i = baa.begin(); i != baa.end(); ++i)
{
if ((*i)->GetId() == 53563 && (*i)->GetCasterGuid() == pVictim->GetObjectGuid())
{
dummy = (*i);
break;
}
}
// original heal must be form beacon caster
if (!dummy)
return <API key>;
triggered_spell_id = 53652; // Beacon of Light
basepoints[0] = triggeredByAura->GetModifier()->m_amount*damage/100;
// cast with original caster set but beacon to beacon for apply caster mods and avoid LoS check
beacon->CastCustomSpell(beacon,triggered_spell_id,&basepoints[0],NULL,NULL,true,castItem,triggeredByAura,pVictim->GetGUID());
return SPELL_AURA_PROC_OK;
}
// Seal of Corruption (damage calc on apply aura)
case 53736:
{
if (effIndex != EFFECT_INDEX_0) // effect 1,2 used by seal unleashing code
return <API key>;
// At melee attack or Hammer of the Righteous spell damage considered as melee attack
if ((procFlag & <API key>) || (procSpell && procSpell->Id == 53595))
triggered_spell_id = 53742; // Blood Corruption
// Add 5-stack effect from Blood Corruption
uint32 stacks = 0;
AuraList const& auras = target->GetAurasByType(<API key>);
for(AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
{
if (((*itr)->GetId() == 53742) && (*itr)->GetCasterGuid() == GetObjectGuid())
{
stacks = (*itr)->GetStackAmount();
break;
}
}
if (stacks >= 5)
CastSpell(target,53739,true,NULL,triggeredByAura);
break;
}
// Glyph of Holy Light
case 54937:
{
triggered_spell_id = 54968;
basepoints[0] = triggerAmount*damage/100;
break;
}
// Sacred Shield (buff)
case 58597:
{
triggered_spell_id = 66922;
SpellEntry const* triggeredEntry = sSpellStore.LookupEntry(triggered_spell_id);
if (!triggeredEntry)
return <API key>;
if(pVictim)
if(!pVictim->HasAura(53569, EFFECT_INDEX_0) && !pVictim->HasAura(53576, EFFECT_INDEX_0))
return <API key>;
basepoints[0] = int32(damage / (GetSpellDuration(triggeredEntry) / triggeredEntry->EffectAmplitude[EFFECT_INDEX_0]));
target = this;
break;
}
// Sacred Shield (talent rank)
case 53601:
{
// triggered_spell_id in spell data
target = this;
break;
}
// Item - Paladin T10 Holy 2P Bonus
case 70755:
{
triggered_spell_id = 71166;
break;
}
// Item - Paladin T10 Retribution 2P Bonus
case 70765:
{
if (GetTypeId() != TYPEID_PLAYER)
return <API key>;
((Player*)this)->RemoveSpellCooldown(53385, true);
return SPELL_AURA_PROC_OK;
}
// Anger Capacitor
case 71406: // normal
case 71545: // heroic
{
if (!pVictim)
return <API key>;
SpellEntry const* mote = sSpellStore.LookupEntry(71432);
if (!mote)
return <API key>;
uint32 maxStack = mote->StackAmount - (dummySpell->Id == 71545 ? 1 : 0);
SpellAuraHolder *aurHolder = GetSpellAuraHolder(71432);
if (aurHolder && uint32(aurHolder->GetStackAmount() +1) >= maxStack)
{
<API key>(71432); // Mote of Anger
// Manifest Anger (main hand/off hand)
CastSpell(pVictim, !haveOffhandWeapon() || roll_chance_i(50) ? 71433 : 71434, true);
return SPELL_AURA_PROC_OK;
}
else
triggered_spell_id = 71432;
break;
}
// Heartpierce, Item - Icecrown 25 Normal Dagger Proc
case 71880:
{
if(GetTypeId() != TYPEID_PLAYER)
return <API key>;
switch (this->getPowerType())
{
case POWER_ENERGY: triggered_spell_id = 71882; break;
case POWER_RAGE: triggered_spell_id = 71883; break;
case POWER_MANA: triggered_spell_id = 71881; break;
default:
return <API key>;
}
break;
}
// Heartpierce, Item - Icecrown 25 Heroic Dagger Proc
case 71892:
{
if(GetTypeId() != TYPEID_PLAYER)
return <API key>;
switch (this->getPowerType())
{
case POWER_ENERGY: triggered_spell_id = 71887; break;
case POWER_RAGE: triggered_spell_id = 71886; break;
case POWER_MANA: triggered_spell_id = 71888; break;
default:
return <API key>;
}
break;
}
}
break;
}
case SPELLFAMILY_SHAMAN:
{
switch(dummySpell->Id)
{
// Totemic Power (The Earthshatterer set)
case 28823:
{
if (!pVictim)
return <API key>;
// Set class defined buff
switch (pVictim->getClass())
{
case CLASS_PALADIN:
case CLASS_PRIEST:
case CLASS_SHAMAN:
case CLASS_DRUID:
triggered_spell_id = 28824; // Increases the friendly target's mana regeneration by $s1 per 5 sec. for $d.
break;
case CLASS_MAGE:
case CLASS_WARLOCK:
triggered_spell_id = 28825; // Increases the friendly target's spell damage and healing by up to $s1 for $d.
break;
case CLASS_HUNTER:
case CLASS_ROGUE:
triggered_spell_id = 28826; // Increases the friendly target's attack power by $s1 for $d.
break;
case CLASS_WARRIOR:
triggered_spell_id = 28827; // Increases the friendly target's armor
break;
default:
return <API key>;
}
break;
}
// Lesser Healing Wave (Totem of Flowing Water Relic)
case 28849:
{
target = this;
triggered_spell_id = 28850;
break;
}
// Windfury Weapon (Passive) 1-5 Ranks
case 33757:
{
if(GetTypeId()!=TYPEID_PLAYER)
return <API key>;
if(!castItem || !castItem->IsEquipped())
return <API key>;
// custom cooldown processing case
if (cooldown && ((Player*)this)->HasSpellCooldown(dummySpell->Id))
return <API key>;
// Now amount of extra power stored in 1 effect of Enchant spell
// Get it by item enchant id
uint32 spellId;
switch (castItem->GetEnchantmentId(EnchantmentSlot(<API key>)))
{
case 283: spellId = 8232; break; // 1 Rank
case 284: spellId = 8235; break; // 2 Rank
case 525: spellId = 10486; break; // 3 Rank
case 1669:spellId = 16362; break; // 4 Rank
case 2636:spellId = 25505; break; // 5 Rank
case 3785:spellId = 58801; break; // 6 Rank
case 3786:spellId = 58803; break; // 7 Rank
case 3787:spellId = 58804; break; // 8 Rank
default:
{
sLog.outError("Unit::HandleDummyAuraProc: non handled item enchantment (rank?) %u for spell id: %u (Windfury)",
castItem->GetEnchantmentId(EnchantmentSlot(<API key>)),dummySpell->Id);
return <API key>;
}
}
SpellEntry const* windfurySpellEntry = sSpellStore.LookupEntry(spellId);
if(!windfurySpellEntry)
{
sLog.outError("Unit::HandleDummyAuraProc: nonexistent spell id: %u (Windfury)",spellId);
return <API key>;
}
int32 extra_attack_power = <API key>(pVictim, windfurySpellEntry, EFFECT_INDEX_1);
// Totem of Splintering
if (Aura* aura = GetAura(60764, EFFECT_INDEX_0))
extra_attack_power += aura->GetModifier()->m_amount;
// Off-Hand case
if (castItem->GetSlot() == <API key>)
{
// Value gained from additional AP
basepoints[0] = int32(extra_attack_power/14.0f * GetAttackTime(OFF_ATTACK)/1000/2);
triggered_spell_id = 33750;
}
// Main-Hand case
else
{
// Value gained from additional AP
basepoints[0] = int32(extra_attack_power/14.0f * GetAttackTime(BASE_ATTACK)/1000);
triggered_spell_id = 25504;
}
// apply cooldown before cast to prevent processing itself
if( cooldown )
((Player*)this)->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
// Attack Twice
for ( uint32 i = 0; i<2; ++i )
CastCustomSpell(pVictim,triggered_spell_id,&basepoints[0],NULL,NULL,true,castItem,triggeredByAura);
return SPELL_AURA_PROC_OK;
}
// Shaman Tier 6 Trinket
case 40463:
{
if (!procSpell)
return <API key>;
float chance;
if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000001))
{
triggered_spell_id = 40465; // Lightning Bolt
chance = 15.0f;
}
else if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000080))
{
triggered_spell_id = 40465; // Lesser Healing Wave
chance = 10.0f;
}
else if (procSpell->SpellFamilyFlags & UI64LIT(0x0000001000000000))
{
triggered_spell_id = 40466; // Stormstrike
chance = 50.0f;
}
else
return <API key>;
if (!roll_chance_f(chance))
return <API key>;
target = this;
break;
}
// Earthen Power
case 51523:
case 51524:
{
triggered_spell_id = 63532;
break;
}
// Glyph of Healing Wave
case 55440:
{
// Not proc from self heals
if (this==pVictim)
return <API key>;
basepoints[0] = triggerAmount * damage / 100;
target = this;
triggered_spell_id = 55533;
break;
}
// Spirit Hunt
case 58877:
{
// Cast on owner
target = GetOwner();
if (!target)
return <API key>;
basepoints[0] = triggerAmount * damage / 100;
triggered_spell_id = 58879;
break;
}
// Glyph of Totem of Wrath
case 63280:
{
Totem* totem = GetTotem(TOTEM_SLOT_FIRE);
if (!totem)
return <API key>;
// find totem aura bonus
AuraList const& spellPower = totem->GetAurasByType(SPELL_AURA_NONE);
for(AuraList::const_iterator i = spellPower.begin();i != spellPower.end(); ++i)
{
// select proper aura for format aura type in spell proto
if ((*i)->GetTarget()==totem && (*i)->GetSpellProto()->EffectApplyAuraName[(*i)->GetEffIndex()] == <API key> &&
(*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && (*i)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000004000000))
{
basepoints[0] = triggerAmount * (*i)->GetModifier()->m_amount / 100;
break;
}
}
if (!basepoints[0])
return <API key>;
basepoints[1] = basepoints[0];
triggered_spell_id = 63283; // Totem of Wrath, caster bonus
target = this;
break;
}
// Shaman T8 Elemental 4P Bonus
case 64928:
{
basepoints[0] = int32( basepoints[0] / 2); // basepoints is for 1 tick, not all DoT amount
triggered_spell_id = 64930; // Electrified
break;
}
// Shaman T9 Elemental 4P Bonus
case 67228:
{
basepoints[0] = int32( basepoints[0] / 3); // basepoints is for 1 tick, not all DoT amount
triggered_spell_id = 71824;
break;
}
// Item - Shaman T10 Restoration 4P Bonus
case 70808:
{
basepoints[0] = int32( triggerAmount * damage / 100 );
basepoints[0] = int32( basepoints[0] / 3); // basepoints is for 1 tick, not all DoT amount
triggered_spell_id = 70809;
break;
}
// Item - Shaman T10 Elemental 4P Bonus
case 70817:
{
if (Aura *aur = pVictim->GetAura(<API key>, SPELLFAMILY_SHAMAN, UI64LIT(0x0000000010000000), 0, GetGUID()))
{
int32 amount = aur->GetAuraDuration() + triggerAmount * IN_MILLISECONDS;
aur->SetAuraDuration(amount);
aur->UpdateAura(false);
return SPELL_AURA_PROC_OK;
}
return <API key>;
}
}
// Storm, Earth and Fire
if (dummySpell->SpellIconID == 3063)
{
// Earthbind Totem summon only
if(procSpell->Id != 2484)
return <API key>;
if (!roll_chance_i(triggerAmount))
return <API key>;
triggered_spell_id = 64695;
break;
}
// Ancestral Awakening
if (dummySpell->SpellIconID == 3065)
{
triggered_spell_id = 52759;
basepoints[0] = triggerAmount * damage / 100;
target = this;
break;
}
// Flametongue Weapon (Passive), Ranks
if (dummySpell->SpellFamilyFlags & UI64LIT(0x0000000000200000))
{
if (GetTypeId()!=TYPEID_PLAYER || !castItem)
return <API key>;
// Only proc for enchanted weapon
Item *usedWeapon = ((Player *)this)->GetWeaponForAttack(procFlag & <API key> ? OFF_ATTACK : BASE_ATTACK, true, true);
if (usedWeapon != castItem)
return <API key>;
switch (dummySpell->Id)
{
case 10400: triggered_spell_id = 8026; break; // Rank 1
case 15567: triggered_spell_id = 8028; break; // Rank 2
case 15568: triggered_spell_id = 8029; break; // Rank 3
case 15569: triggered_spell_id = 10445; break; // Rank 4
case 16311: triggered_spell_id = 16343; break; // Rank 5
case 16312: triggered_spell_id = 16344; break; // Rank 6
case 16313: triggered_spell_id = 25488; break; // Rank 7
case 58784: triggered_spell_id = 58786; break; // Rank 8
case 58791: triggered_spell_id = 58787; break; // Rank 9
case 58792: triggered_spell_id = 58788; break; // Rank 10
default:
return <API key>;
}
break;
}
// Earth Shield
if (dummySpell->SpellFamilyFlags & UI64LIT(0x0000040000000000))
{
originalCaster = triggeredByAura->GetCasterGuid();
target = this;
basepoints[0] = triggerAmount;
// Glyph of Earth Shield
if (Aura* aur = GetDummyAura(63279))
{
int32 aur_mod = aur->GetModifier()->m_amount;
basepoints[0] = int32(basepoints[0] * (aur_mod + 100.0f) / 100.0f);
}
triggered_spell_id = 379;
break;
}
// Improved Water Shield
if (dummySpell->SpellIconID == 2287)
{
// Lesser Healing Wave need aditional 60% roll
if ((procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000080)) && !roll_chance_i(60))
return <API key>;
// Chain Heal needs additional 30% roll
if ((procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000100)) && !roll_chance_i(30))
return <API key>;
// lookup water shield
AuraList const& vs = GetAurasByType(<API key>);
for(AuraList::const_iterator itr = vs.begin(); itr != vs.end(); ++itr)
{
if ((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN &&
((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000002000000000)))
{
uint32 spell = (*itr)->GetSpellProto()->EffectTriggerSpell[(*itr)->GetEffIndex()];
CastSpell(this, spell, true, castItem, triggeredByAura);
return SPELL_AURA_PROC_OK;
}
}
return <API key>;
}
// Lightning Overload
if (dummySpell->SpellIconID == 2018) // only this spell have SpellFamily Shaman SpellIconID == 2018 and dummy aura
{
if(!procSpell || GetTypeId() != TYPEID_PLAYER || !pVictim )
return <API key>;
// custom cooldown processing case
if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(dummySpell->Id))
return <API key>;
uint32 spellId = 0;
// Every Lightning Bolt and Chain Lightning spell have duplicate vs half damage and zero cost
switch (procSpell->Id)
{
// Lightning Bolt
case 403: spellId = 45284; break; // Rank 1
case 529: spellId = 45286; break; // Rank 2
case 548: spellId = 45287; break; // Rank 3
case 915: spellId = 45288; break; // Rank 4
case 943: spellId = 45289; break; // Rank 5
case 6041: spellId = 45290; break; // Rank 6
case 10391: spellId = 45291; break; // Rank 7
case 10392: spellId = 45292; break; // Rank 8
case 15207: spellId = 45293; break; // Rank 9
case 15208: spellId = 45294; break; // Rank 10
case 25448: spellId = 45295; break; // Rank 11
case 25449: spellId = 45296; break; // Rank 12
case 49237: spellId = 49239; break; // Rank 13
case 49238: spellId = 49240; break; // Rank 14
// Chain Lightning
case 421: spellId = 45297; break; // Rank 1
case 930: spellId = 45298; break; // Rank 2
case 2860: spellId = 45299; break; // Rank 3
case 10605: spellId = 45300; break; // Rank 4
case 25439: spellId = 45301; break; // Rank 5
case 25442: spellId = 45302; break; // Rank 6
case 49270: spellId = 49268; break; // Rank 7
case 49271: spellId = 49269; break; // Rank 8
default:
sLog.outError("Unit::HandleDummyAuraProc: non handled spell id: %u (LO)", procSpell->Id);
return <API key>;
}
// Remove cooldown (Chain Lightning - have Category Recovery time)
if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000002))
((Player*)this)->RemoveSpellCooldown(spellId);
CastSpell(pVictim, spellId, true, castItem, triggeredByAura);
if (cooldown && GetTypeId() == TYPEID_PLAYER)
((Player*)this)->AddSpellCooldown(dummySpell->Id, 0, time(NULL) + cooldown);
return SPELL_AURA_PROC_OK;
}
// Static Shock
if(dummySpell->SpellIconID == 3059)
{
// lookup Lightning Shield
AuraList const& vs = GetAurasByType(<API key>);
for(AuraList::const_iterator itr = vs.begin(); itr != vs.end(); ++itr)
{
if ((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN &&
((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000400)))
{
uint32 spell = 0;
switch ((*itr)->GetId())
{
case 324: spell = 26364; break;
case 325: spell = 26365; break;
case 905: spell = 26366; break;
case 945: spell = 26367; break;
case 8134: spell = 26369; break;
case 10431: spell = 26370; break;
case 10432: spell = 26363; break;
case 25469: spell = 26371; break;
case 25472: spell = 26372; break;
case 49280: spell = 49278; break;
case 49281: spell = 49279; break;
default:
return <API key>;
}
CastSpell(target, spell, true, castItem, triggeredByAura);
if ((*itr)->GetHolder()->DropAuraCharge())
<API key>((*itr)->GetId());
return SPELL_AURA_PROC_OK;
}
}
return <API key>;
}
// Frozen Power
if (dummySpell->SpellIconID == 3780)
{
Unit *caster = triggeredByAura->GetCaster();
if (!procSpell || !caster)
return <API key>;
float distance = caster->GetDistance(pVictim);
int32 chance = triggerAmount;
if (distance < 15.0f || !roll_chance_i(chance))
return <API key>;
// make triggered cast apply after current damage spell processing for prevent remove by it
if(Spell* spell = GetCurrentSpell(<API key>))
spell->AddTriggeredSpell(63685);
return SPELL_AURA_PROC_OK;
}
break;
}
case <API key>:
{
// Butchery
if (dummySpell->SpellIconID == 2664)
{
basepoints[0] = triggerAmount;
triggered_spell_id = 50163;
target = this;
break;
}
// Dancing Rune Weapon
if (dummySpell->Id == 49028)
{
// 1 dummy aura for dismiss rune blade
if (effIndex != EFFECT_INDEX_1)
return <API key>;
Pet* runeBlade = <API key>(27893);
if (runeBlade && pVictim && damage && procSpell)
{
int32 procDmg = damage * 0.5;
runeBlade->CastCustomSpell(pVictim, procSpell->Id, &procDmg, NULL, NULL, true, NULL, NULL, runeBlade->GetGUID());
<API key>(pVictim, procSpell->Id, procDmg, <API key>, 0, 0, false, 0, false);
break;
}
else
return <API key>;
}
// Mark of Blood
if (dummySpell->Id == 49005)
{
if (target->GetTypeId() != TYPEID_PLAYER)
return <API key>;
// TODO: need more info (cooldowns/PPM)
target->CastSpell(target, 61607, true, NULL, triggeredByAura);
return SPELL_AURA_PROC_OK;
}
// Unholy Blight
if (dummySpell->Id == 49194)
{
basepoints[0] = damage * triggerAmount / 100;
// Glyph of Unholy Blight
if (Aura *aura = GetDummyAura(63332))
basepoints[0] += basepoints[0] * aura->GetModifier()->m_amount / 100;
// Split between 10 ticks
basepoints[0] /= 10;
triggered_spell_id = 50536;
break;
}
// Vendetta
if (dummySpell->SpellFamilyFlags & UI64LIT(0x0000000000010000))
{
basepoints[0] = triggerAmount * GetMaxHealth() / 100;
triggered_spell_id = 50181;
target = this;
break;
}
// Necrosis
if (dummySpell->SpellIconID == 2709)
{
// only melee auto attack affected and Rune Strike
if (procSpell && procSpell->Id != 56815)
return <API key>;
basepoints[0] = triggerAmount * damage / 100;
triggered_spell_id = 51460;
break;
}
// Threat of Thassarian
if (dummySpell->SpellIconID == 2023)
{
// Must Dual Wield
if (!procSpell || !haveOffhandWeapon())
return <API key>;
// Chance as basepoints for dummy aura
if (!roll_chance_i(triggerAmount))
return <API key>;
switch (procSpell->Id)
{
// Obliterate
case 49020: // Rank 1
triggered_spell_id = 66198; break;
case 51423: // Rank 2
triggered_spell_id = 66972; break;
case 51424: // Rank 3
triggered_spell_id = 66973; break;
case 51425: // Rank 4
triggered_spell_id = 66974; break;
// Frost Strike
case 49143: // Rank 1
triggered_spell_id = 66196; break;
case 51416: // Rank 2
triggered_spell_id = 66958; break;
case 51417: // Rank 3
triggered_spell_id = 66959; break;
case 51418: // Rank 4
triggered_spell_id = 66960; break;
case 51419: // Rank 5
triggered_spell_id = 66961; break;
case 55268: // Rank 6
triggered_spell_id = 66962; break;
// Plague Strike
case 45462: // Rank 1
triggered_spell_id = 66216; break;
case 49917: // Rank 2
triggered_spell_id = 66988; break;
case 49918: // Rank 3
triggered_spell_id = 66989; break;
case 49919: // Rank 4
triggered_spell_id = 66990; break;
case 49920: // Rank 5
triggered_spell_id = 66991; break;
case 49921: // Rank 6
triggered_spell_id = 66992; break;
// Death Strike
case 49998: // Rank 1
triggered_spell_id = 66188; break;
case 49999: // Rank 2
triggered_spell_id = 66950; break;
case 45463: // Rank 3
triggered_spell_id = 66951; break;
case 49923: // Rank 4
triggered_spell_id = 66952; break;
case 49924: // Rank 5
triggered_spell_id = 66953; break;
// Rune Strike
case 56815:
triggered_spell_id = 66217; break;
// Blood Strike
case 45902: // Rank 1
triggered_spell_id = 66215; break;
case 49926: // Rank 2
triggered_spell_id = 66975; break;
case 49927: // Rank 3
triggered_spell_id = 66976; break;
case 49928: // Rank 4
triggered_spell_id = 66977; break;
case 49929: // Rank 5
triggered_spell_id = 66978; break;
case 49930: // Rank 6
triggered_spell_id = 66979; break;
default:
return <API key>;
}
break;
}
// Runic Power Back on Snare/Root
if (dummySpell->Id == 61257)
{
// only for spells and hit/crit (trigger start always) and not start from self casted spells
if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT|<API key>)) || this == pVictim)
return <API key>;
// Need snare or root mechanic
if (!(<API key>(procSpell) & <API key>))
return <API key>;
triggered_spell_id = 61258;
target = this;
break;
}
// Sudden Doom
if (dummySpell->SpellIconID == 1939)
{
if (!target || !target->isAlive() || this->GetTypeId() != TYPEID_PLAYER)
return <API key>;
// get highest rank of Death Coil spell
const PlayerSpellMap& sp_list = ((Player*)this)->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
{
if(!itr->second.active || itr->second.disabled || itr->second.state == PLAYERSPELL_REMOVED)
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (!spellInfo)
continue;
if (spellInfo->SpellFamilyName == <API key> && spellInfo->SpellFamilyFlags & UI64LIT(0x2000))
{
triggered_spell_id = spellInfo->Id;
break;
}
}
break;
}
// Wandering Plague
if (dummySpell->SpellIconID == 1614)
{
if (!roll_chance_f(<API key>(BASE_ATTACK, pVictim)))
return <API key>;
basepoints[0] = triggerAmount * damage / 100;
triggered_spell_id = 50526;
break;
}
// Blood of the North and Reaping
if (dummySpell->SpellIconID == 3041 || dummySpell->SpellIconID == 22)
{
if(GetTypeId()!=TYPEID_PLAYER)
return <API key>;
Player *player = (Player*)this;
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
if (player->GetCurrentRune(i) == RUNE_BLOOD)
{
if(!player->GetRuneCooldown(i))
player->ConvertRune(i, RUNE_DEATH, dummySpell->Id);
else
{
// search for another rune that might be available
for (uint32 iter = i; iter < MAX_RUNES; ++iter)
{
if(player->GetCurrentRune(iter) == RUNE_BLOOD && !player->GetRuneCooldown(iter))
{
player->ConvertRune(iter, RUNE_DEATH, dummySpell->Id);
triggeredByAura-><API key>(0);
return SPELL_AURA_PROC_OK;
}
}
player->SetNeedConvertRune(i, true, dummySpell->Id);
}
triggeredByAura-><API key>(0);
return SPELL_AURA_PROC_OK;
}
}
return <API key>;
}
// Death Rune Mastery
if (dummySpell->SpellIconID == 2622)
{
if(GetTypeId()!=TYPEID_PLAYER)
return <API key>;
Player *player = (Player*)this;
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
RuneType currRune = player->GetCurrentRune(i);
if (currRune == RUNE_UNHOLY || currRune == RUNE_FROST)
{
uint16 cd = player->GetRuneCooldown(i);
if(!cd)
player->ConvertRune(i, RUNE_DEATH, dummySpell->Id);
else // there is a cd
player->SetNeedConvertRune(i, true, dummySpell->Id);
// no break because it converts all
}
}
triggeredByAura-><API key>(0);
return SPELL_AURA_PROC_OK;
}
// Hungering Cold - not break from diseases
if (dummySpell->SpellIconID == 2797)
{
if (procSpell && procSpell->Dispel == DISPEL_DISEASE)
return <API key>;
}
// Blood-Caked Blade
if (dummySpell->SpellIconID == 138)
{
// only main hand melee auto attack affected and Rune Strike
if ((procFlag & <API key>) || procSpell && procSpell->Id != 56815)
return <API key>;
// triggered_spell_id in spell data
break;
}
break;
}
case SPELLFAMILY_PET:
{
// Improved Cower
if (dummySpell->SpellIconID == 958 && procSpell->SpellIconID == 958)
{
triggered_spell_id = dummySpell->Id == 53180 ? 54200 : 54201;
target = this;
break;
}
// Guard Dog
if (dummySpell->SpellIconID == 201 && procSpell->SpellIconID == 201)
{
triggered_spell_id = 54445;
target = this;
break;
}
// Silverback
if (dummySpell->SpellIconID == 1582 && procSpell->SpellIconID == 201)
{
triggered_spell_id = dummySpell->Id == 62764 ? 62800 : 62801;
target = this;
break;
}
break;
}
default:
break;
}
// processed charge only counting case
if (!triggered_spell_id)
return SPELL_AURA_PROC_OK;
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
if (!triggerEntry)
{
sLog.outError("Unit::HandleDummyAuraProc: Spell %u have nonexistent triggered spell %u",dummySpell->Id,triggered_spell_id);
return <API key>;
}
// default case
if (!target || (target != this && !target->isAlive()))
return <API key>;
if (cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
return <API key>;
if (basepoints[EFFECT_INDEX_0] || basepoints[EFFECT_INDEX_1] || basepoints[EFFECT_INDEX_2])
CastCustomSpell(target, triggerEntry,
basepoints[EFFECT_INDEX_0] ? &basepoints[EFFECT_INDEX_0] : NULL,
basepoints[EFFECT_INDEX_1] ? &basepoints[EFFECT_INDEX_1] : NULL,
basepoints[EFFECT_INDEX_2] ? &basepoints[EFFECT_INDEX_2] : NULL,
true, castItem, triggeredByAura, originalCaster);
else
CastSpell(target, triggerEntry, true, castItem, triggeredByAura);
if (cooldown && GetTypeId()==TYPEID_PLAYER)
((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return SPELL_AURA_PROC_OK;
}
SpellAuraProcResult Unit::<API key>(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlags, uint32 procEx, uint32 cooldown)
{
// Get triggered aura spell info
SpellEntry const* auraSpellInfo = triggeredByAura->GetSpellProto();
// Basepoints of trigger aura
int32 triggerAmount = triggeredByAura->GetModifier()->m_amount;
// Set trigger spell id, target, custom basepoints
uint32 trigger_spell_id = auraSpellInfo->EffectTriggerSpell[triggeredByAura->GetEffIndex()];
Unit* target = NULL;
int32 basepoints[MAX_EFFECT_INDEX] = {0, 0, 0};
if(triggeredByAura->GetModifier()->m_auraname == <API key>)
basepoints[0] = triggerAmount;
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
// Try handle unknown trigger spells
// Custom requirements (not listed in procEx) Warning! damage dealing after this
// Custom triggered spells
switch (auraSpellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
switch(auraSpellInfo->Id)
{
//case 191: // Elemental Response
// switch (procSpell->School)
// case SPELL_SCHOOL_FIRE: trigger_spell_id = 34192; break;
// case SPELL_SCHOOL_FROST: trigger_spell_id = 34193; break;
// case SPELL_SCHOOL_ARCANE:trigger_spell_id = 34194; break;
// case SPELL_SCHOOL_NATURE:trigger_spell_id = 34195; break;
// case SPELL_SCHOOL_SHADOW:trigger_spell_id = 34196; break;
// case SPELL_SCHOOL_HOLY: trigger_spell_id = 34197; break;
// case SPELL_SCHOOL_NORMAL:trigger_spell_id = 34198; break;
// break;
//case 5301: break; // Defensive State (DND)
//case 7137: break: // Shadow Charge (Rank 1)
//case 7377: break: // Take Immune Periodic Damage <Not Working>
//case 13358: break; // Defensive State (DND)
//case 16092: break; // Defensive State (DND)
//case 18943: break; // Double Attack
//case 19194: break; // Double Attack
//case 19817: break; // Double Attack
//case 19818: break; // Double Attack
//case 22835: break; // Drunken Rage
// trigger_spell_id = 14822; break;
case 23780: // Aegis of Preservation (Aegis of Preservation trinket)
trigger_spell_id = 23781;
break;
//case 24949: break; // Defensive State 2 (DND)
case 27522: // Mana Drain Trigger
case 40336: // Mana Drain Trigger
// On successful melee or ranged attack gain $29471s1 mana and if possible drain $27526s1 mana from the target.
if (isAlive())
CastSpell(this, 29471, true, castItem, triggeredByAura);
if (pVictim && pVictim->isAlive())
CastSpell(pVictim, 27526, true, castItem, triggeredByAura);
return SPELL_AURA_PROC_OK;
case 31255: // Deadly Swiftness (Rank 1)
// whenever you deal damage to a target who is below 20% health.
if (pVictim->GetHealth() > pVictim->GetMaxHealth() / 5)
return <API key>;
target = this;
trigger_spell_id = 22588;
break;
//case 33207: break; // Gossip NPC Periodic - Fidget
case 33896: // Desperate Defense (Stonescythe Whelp, Stonescythe Alpha, Stonescythe Ambusher)
trigger_spell_id = 33898;
break;
//case 34082: break; // Advantaged State (DND)
//case 34783: break: // Spell Reflection
//case 35205: break: // Vanish
//case 35321: break; // Gushing Wound
//case 36096: break: // Spell Reflection
//case 36207: break: // Steal Weapon
//case 36576: break: // Shaleskin (Shaleskin Flayer, Shaleskin Ripper) 30023 trigger
//case 37030: break; // Chaotic Temperament
case 38164: // Unyielding Knights
if (pVictim->GetEntry() != 19457)
return <API key>;
break;
//case 38363: break; // Gushing Wound
//case 39215: break; // Gushing Wound
//case 40250: break; // Improved Duration
//case 40329: break; // Demo Shout Sensor
//case 40364: break; // Entangling Roots Sensor
//case 41054: break; // Copy Weapon
// trigger_spell_id = 41055; break;
//case 41248: break; // Consuming Strikes
// trigger_spell_id = 41249; break;
//case 42730: break: // Woe Strike
//case 43453: break: // Rune Ward
//case 43504: break; // Alterac Valley OnKill Proc Aura
//case 44326: break: // Pure Energy Passive
//case 44526: break; // Hate Monster (Spar) (30 sec)
//case 44527: break; // Hate Monster (Spar Buddy) (30 sec)
//case 44819: break; // Hate Monster (Spar Buddy) (>30% Health)
//case 44820: break; // Hate Monster (Spar) (<30%)
case 45057: // Evasive Maneuvers (Commendation of Kael`thas trinket)
// reduce you below $s1% health
if (GetHealth() - damage > GetMaxHealth() * triggerAmount / 100)
return <API key>;
break;
//case 45903: break: // Offensive State
//case 46146: break: // [PH] Ahune Spanky Hands
//case 46939: break; // Black Bow of the Betrayer
// trigger_spell_id = 29471; - gain mana
// 27526; - drain mana if possible
case 43820: // Charm of the Witch Doctor (Amani Charm of the Witch Doctor trinket)
// Pct value stored in dummy
basepoints[0] = pVictim->GetCreateHealth() * auraSpellInfo-><API key>(EFFECT_INDEX_1) / 100;
target = pVictim;
break;
//case 45205: break; // Copy Offhand Weapon
//case 45343: break; // Dark Flame Aura
//case 47300: break; // Dark Flame Aura
//case 48876: break; // Beast's Mark
// trigger_spell_id = 48877; break;
//case 49059: break; // Horde, Hate Monster (Spar Buddy) (>30% Health)
//case 50051: break; // Ethereal Pet Aura
//case 50689: break; // Blood Presence (Rank 1)
//case 50844: break; // Blood Mirror
//case 52856: break; // Charge
//case 54072: break; // Knockback Ball Passive
//case 54476: break; // Blood Presence
//case 54775: break; // Abandon Vehicle on Poly
case 56702:
{
trigger_spell_id = 56701;
break;
}
case 57345: // Darkmoon Card: Greatness
{
float stat = 0.0f;
// strength
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 60229;stat = GetStat(STAT_STRENGTH); }
// agility
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 60233;stat = GetStat(STAT_AGILITY); }
// intellect
if (GetStat(STAT_INTELLECT)> stat) { trigger_spell_id = 60234;stat = GetStat(STAT_INTELLECT);}
// spirit
if (GetStat(STAT_SPIRIT) > stat) { trigger_spell_id = 60235; }
break;
}
//case 55580: break: // Mana Link
//case 57587: break: // Steal Ranged ()
//case 57594: break; // Copy Ranged Weapon
//case 59237: break; // Beast's Mark
// trigger_spell_id = 59233; break;
//case 59288: break; // Infra-Green Shield
//case 59532: break; // Abandon Passengers on Poly
//case 59735: break: // Woe Strike
case 64415: // // Val'anyr Hammer of Ancient Kings - Equip Effect
{
// for DOT procs
if (!IsPositiveSpell(procSpell->Id))
return <API key>;
break;
}
case 64440: // Blade Warding
{
trigger_spell_id = 64442;
// need scale damage base at stack size
if (SpellEntry const* trigEntry = sSpellStore.LookupEntry(trigger_spell_id))
basepoints[EFFECT_INDEX_0] = trigEntry-><API key>(EFFECT_INDEX_0) * triggeredByAura->GetStackAmount();
break;
}
case 64568: // Blood Reserve
{
// Check health condition - should drop to less 35%
if (!(10*(int32(GetHealth() - damage)) < 3.5 * GetMaxHealth()))
return <API key>;
if (!roll_chance_f(50))
return <API key>;
trigger_spell_id = 64569;
basepoints[0] = triggerAmount;
break;
}
case 67702: // Death's Choice, Item - Coliseum 25 Normal Melee Trinket
{
float stat = 0.0f;
// strength
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67708;stat = GetStat(STAT_STRENGTH); }
// agility
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67703; }
break;
}
case 67771: // Death's Choice (heroic), Item - Coliseum 25 Heroic Melee Trinket
{
float stat = 0.0f;
// strength
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67773;stat = GetStat(STAT_STRENGTH); }
// agility
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67772; }
break;
}
case 72178: // Blood link Saurfang aura
{
target = this;
trigger_spell_id = 72195;
break;
}
}
break;
case SPELLFAMILY_MAGE:
if (auraSpellInfo->SpellIconID == 2127) // Blazing Speed
{
switch (auraSpellInfo->Id)
{
case 31641: // Rank 1
case 31642: // Rank 2
trigger_spell_id = 31643;
break;
default:
sLog.outError("Unit::<API key>: Spell %u miss possibly Blazing Speed",auraSpellInfo->Id);
return <API key>;
}
}
else if(auraSpellInfo->Id == 26467) // Persistent Shield (Scarab Brooch trinket)
{
// This spell originally trigger 13567 - Dummy Trigger (vs dummy effect)
basepoints[0] = damage * 15 / 100;
target = pVictim;
trigger_spell_id = 26470;
}
else if(auraSpellInfo->Id == 71761) // Deep Freeze Immunity State
{
// spell applied only to permanent immunes to stun targets (bosses)
if (pVictim->GetTypeId() != TYPEID_UNIT ||
(((Creature*)pVictim)->GetCreatureInfo()->MechanicImmuneMask & (1 << (MECHANIC_STUN - 1))) == 0)
return <API key>;
}
break;
case SPELLFAMILY_WARRIOR:
// Deep Wounds (replace triggered spells to directly apply DoT), dot spell have familyflags
if (auraSpellInfo->SpellFamilyFlags == UI64LIT(0x0) && auraSpellInfo->SpellIconID == 243)
{
float weaponDamage;
// DW should benefit of attack power, damage percent mods etc.
// TODO: check if using offhand damage is correct and if it should be divided by 2
if (haveOffhandWeapon() && getAttackTimer(BASE_ATTACK) > getAttackTimer(OFF_ATTACK))
weaponDamage = (GetFloatValue(<API key>) + GetFloatValue(<API key>))/2;
else
weaponDamage = (GetFloatValue(<API key>) + GetFloatValue(<API key>))/2;
switch (auraSpellInfo->Id)
{
case 12834: basepoints[0] = int32(weaponDamage * 16 / 100); break;
case 12849: basepoints[0] = int32(weaponDamage * 32 / 100); break;
case 12867: basepoints[0] = int32(weaponDamage * 48 / 100); break;
// Impossible case
default:
sLog.outError("Unit::<API key>: DW unknown spell rank %u",auraSpellInfo->Id);
return <API key>;
}
// 1 tick/sec * 6 sec = 6 ticks
basepoints[0] /= 6;
trigger_spell_id = 12721;
break;
}
if (auraSpellInfo->Id == 50421) // Scent of Blood
trigger_spell_id = 50422;
break;
case SPELLFAMILY_WARLOCK:
{
// Drain Soul
if (auraSpellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000))
{
// search for "Improved Drain Soul" dummy aura
Unit::AuraList const& mDummyAura = GetAurasByType(SPELL_AURA_DUMMY);
for(Unit::AuraList::const_iterator i = mDummyAura.begin(); i != mDummyAura.end(); ++i)
{
if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (*i)->GetSpellProto()->SpellIconID == 113)
{
// basepoints of trigger spell stored in dummyeffect of spellProto
int32 basepoints = GetMaxPower(POWER_MANA) * (*i)->GetSpellProto()-><API key>(EFFECT_INDEX_2) / 100;
CastCustomSpell(this, 18371, &basepoints, NULL, NULL, true, castItem, triggeredByAura);
break;
}
}
// Not remove charge (aura removed on death in any cases)
// Need for correct work Drain Soul <API key> aura
return <API key>;
}
// Nether Protection
else if (auraSpellInfo->SpellIconID == 1985)
{
if (!procSpell)
return <API key>;
switch(<API key>(GetSpellSchoolMask(procSpell)))
{
case SPELL_SCHOOL_NORMAL:
return <API key>; // ignore
case SPELL_SCHOOL_HOLY: trigger_spell_id = 54370; break;
case SPELL_SCHOOL_FIRE: trigger_spell_id = 54371; break;
case SPELL_SCHOOL_NATURE: trigger_spell_id = 54375; break;
case SPELL_SCHOOL_FROST: trigger_spell_id = 54372; break;
case SPELL_SCHOOL_SHADOW: trigger_spell_id = 54374; break;
case SPELL_SCHOOL_ARCANE: trigger_spell_id = 54373; break;
default:
return <API key>;
}
}
// Cheat Death
else if (auraSpellInfo->Id == 28845)
{
// When your health drops below 20% ....
if (GetHealth() - damage > GetMaxHealth() / 5 || GetHealth() < GetMaxHealth() / 5)
return <API key>;
}
// Decimation
else if (auraSpellInfo->Id == 63156 || auraSpellInfo->Id == 63158)
{
// Looking for dummy effect
Aura *aur = GetAura(auraSpellInfo->Id, EFFECT_INDEX_1);
if (!aur)
return <API key>;
// If target's health is not below equal certain value (35%) not proc
if (int32(pVictim->GetHealth() * 100 / pVictim->GetMaxHealth()) > aur->GetModifier()->m_amount)
return <API key>;
}
break;
}
case SPELLFAMILY_PRIEST:
{
// Greater Heal Refund (Avatar Raiment set)
if (auraSpellInfo->Id==37594)
{
// Not give if target already have full health
if (pVictim->GetHealth() == pVictim->GetMaxHealth())
return <API key>;
// If your Greater Heal brings the target to full health, you gain $37595s1 mana.
if (pVictim->GetHealth() + damage < pVictim->GetMaxHealth())
return <API key>;
trigger_spell_id = 37595;
}
// Blessed Recovery
else if (auraSpellInfo->SpellIconID == 1875)
{
switch (auraSpellInfo->Id)
{
case 27811: trigger_spell_id = 27813; break;
case 27815: trigger_spell_id = 27817; break;
case 27816: trigger_spell_id = 27818; break;
default:
sLog.outError("Unit::<API key>: Spell %u not handled in BR", auraSpellInfo->Id);
return <API key>;
}
basepoints[0] = damage * triggerAmount / 100 / 3;
target = this;
}
// Glyph of Shadow Word: Pain
else if (auraSpellInfo->Id == 55681)
basepoints[0] = triggerAmount * GetCreateMana() / 100;
break;
}
case SPELLFAMILY_DRUID:
{
// Druid Forms Trinket
if (auraSpellInfo->Id==37336)
{
switch(GetShapeshiftForm())
{
case FORM_NONE: trigger_spell_id = 37344;break;
case FORM_CAT: trigger_spell_id = 37341;break;
case FORM_BEAR:
case FORM_DIREBEAR: trigger_spell_id = 37340;break;
case FORM_TREE: trigger_spell_id = 37342;break;
case FORM_MOONKIN: trigger_spell_id = 37343;break;
default:
return <API key>;
}
}
// Druid T9 Feral Relic (Lacerate, Swipe, Mangle, and Shred)
else if (auraSpellInfo->Id==67353)
{
switch(GetShapeshiftForm())
{
case FORM_CAT: trigger_spell_id = 67355; break;
case FORM_BEAR:
case FORM_DIREBEAR: trigger_spell_id = 67354; break;
default:
return <API key>;
}
}
break;
}
case SPELLFAMILY_ROGUE:
// Item - Rogue T10 2P Bonus
if (auraSpellInfo->Id == 70805)
{
if (pVictim != this)
return <API key>;
}
// Item - Rogue T10 4P Bonus
else if (auraSpellInfo->Id == 70803)
{
if (!procSpell)
return <API key>;
// only allow melee finishing move to proc
if (!(procSpell->AttributesEx & <API key>) || procSpell->Id == 26679)
return <API key>;
trigger_spell_id = 70802;
target = this;
}
break;
case SPELLFAMILY_HUNTER:
{
// Piercing Shots
if (auraSpellInfo->SpellIconID == 3247 && auraSpellInfo->SpellVisual[0] == 0)
{
basepoints[0] = damage * triggerAmount / 100 / 8;
trigger_spell_id = 63468;
target = pVictim;
}
// Rapid Recuperation
else if (auraSpellInfo->Id == 53228 || auraSpellInfo->Id == 53232)
{
// This effect only from Rapid Fire (ability cast)
if (!(procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000020)))
return <API key>;
}
// Entrapment correction
else if ((auraSpellInfo->Id == 19184 || auraSpellInfo->Id == 19387 || auraSpellInfo->Id == 19388) &&
!(procSpell->SpellFamilyFlags & UI64LIT(0x200000000000) || procSpell->SpellFamilyFlags2 & UI64LIT(0x40000)))
return <API key>;
// Lock and Load
else if (auraSpellInfo->SpellIconID == 3579)
{
// Check for Lock and Load Marker
if (HasAura(67544))
return <API key>;
}
break;
}
case SPELLFAMILY_PALADIN:
{
/*
// Blessed Life
if (auraSpellInfo->SpellIconID == 2137)
{
switch (auraSpellInfo->Id)
{
case 31828: // Rank 1
case 31829: // Rank 2
case 31830: // Rank 3
break;
default:
sLog.outError("Unit::<API key>: Spell %u miss posibly Blessed Life", auraSpellInfo->Id);
return <API key>;
}
}
*/
// Healing Discount
if (auraSpellInfo->Id==37705)
{
trigger_spell_id = 37706;
target = this;
}
// Soul Preserver
if (auraSpellInfo->Id==60510)
{
trigger_spell_id = 60515;
target = this;
}
// Illumination
else if (auraSpellInfo->SpellIconID==241)
{
if(!procSpell)
return <API key>;
// procspell is triggered spell but we need mana cost of original casted spell
uint32 originalSpellId = procSpell->Id;
// Holy Shock heal
if (procSpell->SpellFamilyFlags & UI64LIT(0x0001000000000000))
{
switch(procSpell->Id)
{
case 25914: originalSpellId = 20473; break;
case 25913: originalSpellId = 20929; break;
case 25903: originalSpellId = 20930; break;
case 27175: originalSpellId = 27174; break;
case 33074: originalSpellId = 33072; break;
case 48820: originalSpellId = 48824; break;
case 48821: originalSpellId = 48825; break;
default:
sLog.outError("Unit::<API key>: Spell %u not handled in HShock",procSpell->Id);
return <API key>;
}
}
SpellEntry const *originalSpell = sSpellStore.LookupEntry(originalSpellId);
if(!originalSpell)
{
sLog.outError("Unit::<API key>: Spell %u unknown but selected as original in Illu",originalSpellId);
return <API key>;
}
// percent stored in effect 1 (class scripts) base points
int32 cost = originalSpell->manaCost + originalSpell->ManaCostPercentage * GetCreateMana() / 100;
basepoints[0] = cost*auraSpellInfo-><API key>(EFFECT_INDEX_1)/100;
trigger_spell_id = 20272;
target = this;
}
// Lightning Capacitor
else if (auraSpellInfo->Id==37657)
{
if(!pVictim || !pVictim->isAlive())
return <API key>;
// stacking
CastSpell(this, 37658, true, NULL, triggeredByAura);
Aura * dummy = GetDummyAura(37658);
// release at 3 aura in stack (cont contain in basepoint of trigger aura)
if(!dummy || dummy->GetStackAmount() < uint32(triggerAmount))
return <API key>;
<API key>(37658);
trigger_spell_id = 37661;
target = pVictim;
}
// Bonus Healing (Crystal Spire of Karabor mace)
else if (auraSpellInfo->Id == 40971)
{
// If your target is below $s1% health
if (pVictim->GetHealth() > pVictim->GetMaxHealth() * triggerAmount / 100)
return <API key>;
}
// Thunder Capacitor
else if (auraSpellInfo->Id == 54841)
{
if(!pVictim || !pVictim->isAlive())
return <API key>;
// stacking
CastSpell(this, 54842, true, NULL, triggeredByAura);
// counting
Aura * dummy = GetDummyAura(54842);
// release at 3 aura in stack (cont contain in basepoint of trigger aura)
if(!dummy || dummy->GetStackAmount() < uint32(triggerAmount))
return <API key>;
<API key>(54842);
trigger_spell_id = 54843;
target = pVictim;
}
break;
}
case SPELLFAMILY_SHAMAN:
{
// Lightning Shield (overwrite non existing triggered spell call in spell.dbc
if (auraSpellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000400) && auraSpellInfo->SpellVisual[0] == 37)
{
switch(auraSpellInfo->Id)
{
case 324: // Rank 1
trigger_spell_id = 26364; break;
case 325: // Rank 2
trigger_spell_id = 26365; break;
case 905: // Rank 3
trigger_spell_id = 26366; break;
case 945: // Rank 4
trigger_spell_id = 26367; break;
case 8134: // Rank 5
trigger_spell_id = 26369; break;
case 10431: // Rank 6
trigger_spell_id = 26370; break;
case 10432: // Rank 7
trigger_spell_id = 26363; break;
case 25469: // Rank 8
trigger_spell_id = 26371; break;
case 25472: // Rank 9
trigger_spell_id = 26372; break;
case 49280: // Rank 10
trigger_spell_id = 49278; break;
case 49281: // Rank 11
trigger_spell_id = 49279; break;
default:
sLog.outError("Unit::<API key>: Spell %u not handled in LShield", auraSpellInfo->Id);
return <API key>;
}
}
// Lightning Shield (The Ten Storms set)
else if (auraSpellInfo->Id == 23551)
{
trigger_spell_id = 23552;
target = pVictim;
}
// Damage from Lightning Shield (The Ten Storms set)
else if (auraSpellInfo->Id == 23552)
trigger_spell_id = 27635;
// Mana Surge (The Earthfury set)
else if (auraSpellInfo->Id == 23572)
{
if(!procSpell)
return <API key>;
basepoints[0] = procSpell->manaCost * 35 / 100;
trigger_spell_id = 23571;
target = this;
}
// Nature's Guardian
else if (auraSpellInfo->SpellIconID == 2013)
{
// Check health condition - should drop to less 30% (damage deal after this!)
if (!(10*(int32(GetHealth() - damage)) < int32(3 * GetMaxHealth())))
return <API key>;
if(pVictim && pVictim->isAlive())
pVictim->getThreatManager().modifyThreatPercent(this,-10);
basepoints[0] = triggerAmount * GetMaxHealth() / 100;
trigger_spell_id = 31616;
target = this;
}
// Item - Shaman T10 Restoration 2P Bonus
else if (auraSpellInfo->Id == 70807)
{
if (!procSpell)
return <API key>;
// only allow Riptide to proc
switch(procSpell->Id)
{
case 61295: // Rank 1
case 61299: // Rank 2
case 61300: // Rank 3
case 61301: // Rank 4
break;
default:
return <API key>;
}
trigger_spell_id = 70806;
target = this;
}
break;
}
case <API key>:
{
// Acclimation
if (auraSpellInfo->SpellIconID == 1930)
{
if (!procSpell)
return <API key>;
switch(<API key>(GetSpellSchoolMask(procSpell)))
{
case SPELL_SCHOOL_NORMAL:
return <API key>; // ignore
case SPELL_SCHOOL_HOLY: trigger_spell_id = 50490; break;
case SPELL_SCHOOL_FIRE: trigger_spell_id = 50362; break;
case SPELL_SCHOOL_NATURE: trigger_spell_id = 50488; break;
case SPELL_SCHOOL_FROST: trigger_spell_id = 50485; break;
case SPELL_SCHOOL_SHADOW: trigger_spell_id = 50489; break;
case SPELL_SCHOOL_ARCANE: trigger_spell_id = 50486; break;
default:
return <API key>;
}
}
// Glyph of Death's Embrace
else if (auraSpellInfo->Id == 58677)
{
if (procSpell->Id != 47633)
return <API key>;
}
//Glyph of Death Grip
if (auraSpellInfo->Id == 62259)
{
//remove cooldown of Death Grip
if (GetTypeId() == TYPEID_PLAYER)
((Player*)this)->RemoveSpellCooldown(49576, true);
return SPELL_AURA_PROC_OK;
}
// Item - Death Knight T10 Melee 4P Bonus
else if (auraSpellInfo->Id == 70656)
{
if (GetTypeId() != TYPEID_PLAYER || getClass() != CLASS_DEATH_KNIGHT)
return <API key>;
for(uint32 i = 0; i < MAX_RUNES; ++i)
if (((Player*)this)->GetRuneCooldown(i) == 0)
return <API key>;
}
// Blade Barrier
else if (auraSpellInfo->SpellIconID == 85)
{
if (GetTypeId() != TYPEID_PLAYER || getClass() != CLASS_DEATH_KNIGHT ||
!((Player*)this)-><API key>(RUNE_BLOOD))
return <API key>;
}
// Improved Blood Presence
else if (auraSpellInfo->Id == 63611)
{
if (GetTypeId() != TYPEID_PLAYER || !((Player*)this)->isHonorOrXPTarget(pVictim) || !damage)
return <API key>;
basepoints[0] = triggerAmount * damage / 100;
trigger_spell_id = 50475;
}
// Glyph of Death's Embrace
else if (auraSpellInfo->Id == 58677)
{
if (procSpell->Id != 47633)
return <API key>;
}
break;
}
default:
break;
}
// All ok. Check current trigger spell
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(trigger_spell_id);
if (!triggerEntry)
{
// Not cast unknown spell
// sLog.outError("Unit::<API key>: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",auraSpellInfo->Id,triggeredByAura->GetEffIndex());
return <API key>;
}
// not allow proc extra attack spell at extra attack
if (m_extraAttacks && IsSpellHaveEffect(triggerEntry, <API key>))
return <API key>;
// Custom basepoints/target for exist spell
// dummy basepoints or other customs
switch(trigger_spell_id)
{
// Cast positive spell on enemy target
case 7099: // Curse of Mending
case 39647: // Curse of Mending
case 29494: // Temptation
case 20233: // Improved Lay on Hands (cast on target)
{
target = pVictim;
break;
}
// Combo points add triggers (need add combopoint only for main target, and after possible combopoints reset)
case 15250: // Rogue Setup
{
if(!pVictim || pVictim != getVictim()) // applied only for main target
return <API key>;
break; // continue normal case
}
// Finishing moves that add combo points
case 14189: // Seal Fate (Netherblade set)
case 14157: // Ruthlessness
case 70802: // Mayhem (Shadowblade sets)
{
// Need add combopoint AFTER finishing move (or they get dropped in finish phase)
if (Spell* spell = GetCurrentSpell(<API key>))
{
spell->AddTriggeredSpell(trigger_spell_id);
return SPELL_AURA_PROC_OK;
}
return <API key>;
}
// Bloodthirst (($m/100)% of max health)
case 23880:
{
basepoints[0] = int32(GetMaxHealth() * triggerAmount / 100);
break;
}
// Shamanistic Rage triggered spell
case 30824:
{
basepoints[0] = int32(<API key>(BASE_ATTACK) * triggerAmount / 100);
break;
}
// Enlightenment (trigger only from mana cost spells)
case 35095:
{
if(!procSpell || procSpell->powerType!=POWER_MANA || procSpell->manaCost==0 && procSpell->ManaCostPercentage==0 && procSpell->manaCostPerlevel==0)
return <API key>;
break;
}
// Demonic Pact
case 48090:
{
// As the spell is proced from pet's attack - find owner
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
return <API key>;
// This spell doesn't stack, but refreshes duration. So we receive current bonuses to minus them later.
int32 curBonus = 0;
if (Aura* aur = owner->GetAura(48090, EFFECT_INDEX_0))
curBonus = aur->GetModifier()->m_amount;
int32 spellDamage = owner-><API key>(<API key>) - curBonus;
if(spellDamage <= 0)
return <API key>;
// percent stored in owner talent dummy
AuraList const& dummyAuras = owner->GetAurasByType(SPELL_AURA_DUMMY);
for (AuraList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i)
{
if ((*i)->GetSpellProto()->SpellIconID == 3220)
{
basepoints[0] = basepoints[1] = int32(spellDamage * (*i)->GetModifier()->m_amount / 100);
break;
}
}
break;
}
// Sword and Board
case 50227:
{
// Remove cooldown on Shield Slam
if (GetTypeId() == TYPEID_PLAYER)
((Player*)this)-><API key>(1209, true);
break;
}
// Maelstrom Weapon
case 53817:
{
// Item - Shaman T10 Enhancement 4P Bonus
// Calculate before roll_chance of ranks
if (Aura * dummy = GetDummyAura(70832))
{
if (SpellAuraHolder *aurHolder = GetSpellAuraHolder(53817))
if ((aurHolder->GetStackAmount() == aurHolder->GetSpellProto()->StackAmount) && roll_chance_i(dummy->GetBasePoints()))
CastSpell(this,70831,true,castItem,triggeredByAura);
}
// have rank dependent proc chance, ignore too often cases
// PPM = 2.5 * (rank of talent),
uint32 rank = sSpellMgr.GetSpellRank(auraSpellInfo->Id);
// 5 rank -> 100% 4 rank -> 80% and etc from full rate
if(!roll_chance_i(20*rank))
return <API key>;
// Item - Shaman T10 Enhancement 4P Bonus
if (Aura *aur = GetAura(70832, EFFECT_INDEX_0))
{
Aura *maelBuff = GetAura(trigger_spell_id, EFFECT_INDEX_0);
if (maelBuff && maelBuff->GetStackAmount() + 1 == maelBuff->GetSpellProto()->StackAmount)
if (roll_chance_i(aur->GetModifier()->m_amount))
CastSpell(this, 70831, true, NULL, aur);
}
break;
}
// Brain Freeze
case 57761:
{
if(!procSpell)
return <API key>;
// For trigger from Blizzard need exist Improved Blizzard
if (procSpell->SpellFamilyName==SPELLFAMILY_MAGE && (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000080)))
{
bool found = false;
AuraList const& <API key> = GetAurasByType(<API key>);
for(AuraList::const_iterator i = <API key>.begin(); i != <API key>.end(); ++i)
{
int32 script = (*i)->GetModifier()->m_miscvalue;
if(script==836 || script==988 || script==989)
{
found=true;
break;
}
}
if(!found)
return <API key>;
}
break;
}
// Astral Shift
case 52179:
{
if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT|<API key>)) || this == pVictim)
return <API key>;
// Need stun, fear or silence mechanic
if (!(<API key>(procSpell) & <API key>))
return <API key>;
break;
}
// Burning Determination
case 54748:
{
if(!procSpell)
return <API key>;
// Need Interrupt or Silenced mechanic
if (!(<API key>(procSpell) & <API key>))
return <API key>;
break;
}
// Lock and Load
case 56453:
{
// Proc only from trap activation (from periodic proc another aura of this spell)
// because some spells have both flags (ON_TRAP_ACTIVATION and ON_PERIODIC), but should only proc ON_PERIODIC!!
if (!(procFlags & <API key>) || !procSpell ||
!(procSpell->SchoolMask & <API key>) || !roll_chance_i(triggerAmount))
return <API key>;
break;
}
// Freezing Fog (Rime triggered)
case 59052:
{
// Howling Blast cooldown reset
if (GetTypeId() == TYPEID_PLAYER)
((Player*)this)-><API key>(1248, true);
break;
}
// Druid - Savage Defense
case 62606:
{
basepoints[0] = int32(<API key>(BASE_ATTACK) * triggerAmount / 100);
break;
}
// Hack for Blood mark (ICC Saurfang)
case 72255:
case 72444:
case 72445:
case 72446:
{
float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(auraSpellInfo->EffectRadiusIndex[EFFECT_INDEX_0]));
Map::PlayerList const& pList = GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
if (itr->getSource() && itr->getSource()->IsWithinDistInMap(this,radius) && itr->getSource()->HasAura(triggerEntry->targetAuraSpell))
{
target = itr->getSource();
break;
}
break;
}
}
if (cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(trigger_spell_id))
return <API key>;
// try detect target manually if not set
if (target == NULL)
target = !(procFlags & <API key>) && IsPositiveSpell(trigger_spell_id) ? this : pVictim;
// default case
if (!target || (target != this && !target->isAlive()))
return <API key>;
if (SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(trigger_spell_id))
{
if (basepoints[EFFECT_INDEX_0] || basepoints[EFFECT_INDEX_1] || basepoints[EFFECT_INDEX_2])
CastCustomSpell(target,triggeredSpellInfo,
basepoints[EFFECT_INDEX_0] ? &basepoints[EFFECT_INDEX_0] : NULL,
basepoints[EFFECT_INDEX_1] ? &basepoints[EFFECT_INDEX_1] : NULL,
basepoints[EFFECT_INDEX_2] ? &basepoints[EFFECT_INDEX_2] : NULL,
true, castItem, triggeredByAura);
else
CastSpell(target,triggeredSpellInfo,true,castItem,triggeredByAura);
}
else
{
sLog.outError("<API key>: unknown spell id %u by caster: %s triggered by aura %u (eff %u)", trigger_spell_id, GetGuidStr().c_str(), triggeredByAura->GetId(), triggeredByAura->GetEffIndex());
return <API key>;
}
if (cooldown && GetTypeId()==TYPEID_PLAYER)
((Player*)this)->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown);
return SPELL_AURA_PROC_OK;
}
SpellAuraProcResult Unit::<API key>(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlags, uint32 procEx, uint32 cooldown)
{
SpellEntry const *spellInfo = triggeredByAura->GetSpellProto();
DEBUG_FILTER_LOG(<API key>, "ProcDamageAndSpell: doing %u damage from spell id %u (triggered by auratype %u of spell %u)",
triggeredByAura->GetModifier()->m_amount, spellInfo->Id, triggeredByAura->GetModifier()->m_auraname, triggeredByAura->GetId());
SpellNonMeleeDamage damageInfo(this, pVictim, spellInfo->Id, SpellSchoolMask(spellInfo->SchoolMask));
<API key>(&damageInfo, triggeredByAura->GetModifier()->m_amount, spellInfo);
damageInfo.target-><API key>(this, &damageInfo, spellInfo);
DealDamageMods(damageInfo.target,damageInfo.damage,&damageInfo.absorb);
<API key>(&damageInfo);
DealSpellDamage(&damageInfo, true);
return SPELL_AURA_PROC_OK;
}
SpellAuraProcResult Unit::<API key>(Unit *pVictim, uint32 /*damage*/, Aura *triggeredByAura, SpellEntry const *procSpell, uint32 /*procFlag*/, uint32 /*procEx*/ ,uint32 cooldown)
{
int32 scriptId = triggeredByAura->GetModifier()->m_miscvalue;
if(!pVictim || !pVictim->isAlive())
return <API key>;
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
// Basepoints of trigger aura
int32 triggerAmount = triggeredByAura->GetModifier()->m_amount;
uint32 triggered_spell_id = 0;
switch(scriptId)
{
case 836: // Improved Blizzard (Rank 1)
{
if (!procSpell || procSpell->SpellVisual[0]!=9487)
return <API key>;
triggered_spell_id = 12484;
break;
}
case 988: // Improved Blizzard (Rank 2)
{
if (!procSpell || procSpell->SpellVisual[0]!=9487)
return <API key>;
triggered_spell_id = 12485;
break;
}
case 989: // Improved Blizzard (Rank 3)
{
if (!procSpell || procSpell->SpellVisual[0]!=9487)
return <API key>;
triggered_spell_id = 12486;
break;
}
case 4086: // Improved Mend Pet (Rank 1)
case 4087: // Improved Mend Pet (Rank 2)
{
if(!roll_chance_i(triggerAmount))
return <API key>;
triggered_spell_id = 24406;
break;
}
case 4533: // Dreamwalker Raiment 2 pieces bonus
{
// Chance 50%
if (!roll_chance_i(50))
return <API key>;
switch (pVictim->getPowerType())
{
case POWER_MANA: triggered_spell_id = 28722; break;
case POWER_RAGE: triggered_spell_id = 28723; break;
case POWER_ENERGY: triggered_spell_id = 28724; break;
default:
return <API key>;
}
break;
}
case 4537: // Dreamwalker Raiment 6 pieces bonus
triggered_spell_id = 28750; // Blessing of the Claw
break;
case 5497: // Improved Mana Gems (Serpent-Coil Braid)
triggered_spell_id = 37445; // Mana Surge
break;
case 6953: // Warbringer
<API key>(<API key>,0,true);
return SPELL_AURA_PROC_OK;
case 7010: // Revitalize (rank 1)
case 7011: // Revitalize (rank 2)
case 7012: // Revitalize (rank 3)
{
if(!roll_chance_i(triggerAmount))
return <API key>;
switch( pVictim->getPowerType() )
{
case POWER_MANA: triggered_spell_id = 48542; break;
case POWER_RAGE: triggered_spell_id = 48541; break;
case POWER_ENERGY: triggered_spell_id = 48540; break;
case POWER_RUNIC_POWER: triggered_spell_id = 48543; break;
default: return <API key>;
}
break;
}
case 7282: // Crypt Fever & Ebon Plaguebringer
{
if (!procSpell || pVictim == this)
return <API key>;
bool HasEP = false;
Unit::AuraList const& scriptAuras = GetAurasByType(<API key>);
for(Unit::AuraList::const_iterator i = scriptAuras.begin(); i != scriptAuras.end(); ++i)
{
if ((*i)->GetSpellProto()->SpellIconID == 1766)
{
HasEP = true;
break;
}
}
if (!HasEP)
switch(triggeredByAura->GetId())
{
case 49032: triggered_spell_id = 50508; break;
case 49631: triggered_spell_id = 50509; break;
case 49632: triggered_spell_id = 50510; break;
default: return <API key>;
}
else
switch(triggeredByAura->GetId())
{
case 51099: triggered_spell_id = 51726; break;
case 51160: triggered_spell_id = 51734; break;
case 51161: triggered_spell_id = 51735; break;
default: return <API key>;
}
break;
}
}
// not processed
if(!triggered_spell_id)
return <API key>;
// standard non-dummy case
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
if(!triggerEntry)
{
sLog.outError("Unit::<API key>: Spell %u triggering for class script id %u",triggered_spell_id,scriptId);
return <API key>;
}
if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
return <API key>;
CastSpell(pVictim, triggered_spell_id, true, castItem, triggeredByAura);
if( cooldown && GetTypeId()==TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return SPELL_AURA_PROC_OK;
}
SpellAuraProcResult Unit::<API key>( Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/ )
{
// aura can be deleted at casts
SpellEntry const* spellProto = triggeredByAura->GetSpellProto();
SpellEffectIndex effIdx = triggeredByAura->GetEffIndex();
int32 heal = triggeredByAura->GetModifier()->m_amount;
ObjectGuid caster_guid = triggeredByAura->GetCasterGuid();
// jumps
int32 jumps = triggeredByAura->GetHolder()->GetAuraCharges()-1;
// current aura expire
triggeredByAura->GetHolder()->SetAuraCharges(1); // will removed at next charges decrease
// next target selection
if (jumps > 0 && GetTypeId()==TYPEID_PLAYER && caster_guid.IsPlayer())
{
float radius;
if (spellProto->EffectRadiusIndex[effIdx])
radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx]));
else
radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(spellProto->rangeIndex));
if(Player* caster = ((Player*)triggeredByAura->GetCaster()))
{
caster->ApplySpellMod(spellProto->Id, SPELLMOD_RADIUS, radius,NULL);
if(Player* target = ((Player*)this)-><API key>(radius))
{
// aura will applied from caster, but spell casted from current aura holder
SpellModifier *mod = new SpellModifier(SPELLMOD_CHARGES,SPELLMOD_FLAT,jumps-5,spellProto->Id,spellProto->SpellFamilyFlags,spellProto->SpellFamilyFlags2);
// remove before apply next (locked against deleted)
triggeredByAura->SetInUse(true);
<API key>(spellProto->Id,caster->GetGUID());
caster->AddSpellMod(mod, true);
CastCustomSpell(target,spellProto->Id,&heal,NULL,NULL,true,NULL,triggeredByAura,caster->GetGUID());
caster->AddSpellMod(mod, false);
triggeredByAura->SetInUse(false);
}
}
}
// heal
CastCustomSpell(this,33110,&heal,NULL,NULL,true,NULL,NULL,caster_guid);
return SPELL_AURA_PROC_OK;
}
SpellAuraProcResult Unit::<API key>(Unit* /*pVictim*/, uint32 /*damage*/, Aura* /*triggeredByAura*/, SpellEntry const* procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/)
{
// Skip melee hits or instant cast spells
return !(procSpell == NULL || GetSpellCastTime(procSpell) == 0) ? SPELL_AURA_PROC_OK : <API key>;
}
SpellAuraProcResult Unit::<API key>(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const* procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/)
{
// Skip Melee hits and spells ws wrong school
return !(procSpell == NULL || (triggeredByAura->GetModifier()->m_miscvalue & procSpell->SchoolMask) == 0) ? SPELL_AURA_PROC_OK : <API key>;
}
SpellAuraProcResult Unit::<API key>(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const* procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/)
{
// Skip melee hits and spells ws wrong school or zero cost
return !(procSpell == NULL ||
(procSpell->manaCost == 0 && procSpell->ManaCostPercentage == 0) || // Cost check
(triggeredByAura->GetModifier()->m_miscvalue & procSpell->SchoolMask) == 0) ? SPELL_AURA_PROC_OK : <API key>; // School check
}
SpellAuraProcResult Unit::<API key>(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const* procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/)
{
// Compare mechanic
return !(procSpell==NULL || int32(procSpell->Mechanic) != triggeredByAura->GetModifier()->m_miscvalue)
? SPELL_AURA_PROC_OK : <API key>;
}
SpellAuraProcResult Unit::<API key>(Unit* pVictim, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/)
{
// Compare casters
return triggeredByAura->GetCasterGuid() == pVictim->GetObjectGuid() ? SPELL_AURA_PROC_OK : <API key>;
}
SpellAuraProcResult Unit::<API key>(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const * /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/)
{
SpellEntry const *spellInfo = triggeredByAura->GetSpellProto();
if (spellInfo->Id == 55166) // Tidal Force
{
// Remove only single aura from stack
if (triggeredByAura->GetStackAmount() > 1 && !triggeredByAura->GetHolder()->ModStackAmount(-1))
return <API key>;
}
return SPELL_AURA_PROC_OK;
}
SpellAuraProcResult Unit::<API key>(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 /*procFlag*/, uint32 procEx, uint32 /*cooldown*/)
{
SpellEntry const *spellInfo = triggeredByAura->GetSpellProto();
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
switch(spellInfo->SpellFamilyName)
{
case SPELLFAMILY_MAGE:
{
// Combustion
if (spellInfo->Id == 11129)
{
//last charge and crit
if (triggeredByAura->GetHolder()->GetAuraCharges() <= 1 && (procEx & <API key>) )
return SPELL_AURA_PROC_OK; // charge counting (will removed)
CastSpell(this, 28682, true, castItem, triggeredByAura);
return (procEx & <API key>) ? SPELL_AURA_PROC_OK : <API key>; // charge update only at crit hits, no hidden cooldowns
}
break;
}
case SPELLFAMILY_PRIEST:
{
// Serendipity
if (spellInfo->SpellIconID == 2900)
{
<API key>(spellInfo->Id);
return SPELL_AURA_PROC_OK;
}
break;
}
case SPELLFAMILY_PALADIN:
{
// Glyph of Divinity
if (spellInfo->Id == 11129)
{
// Lookup base amount mana restore
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{
if (procSpell->Effect[i] == <API key>)
{
int32 mana = procSpell-><API key>(SpellEffectIndex(i));
CastCustomSpell(this, 54986, NULL, &mana, NULL, true, castItem, triggeredByAura);
break;
}
}
return SPELL_AURA_PROC_OK;
}
break;
}
}
return SPELL_AURA_PROC_OK;
}
SpellAuraProcResult Unit::<API key>(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 /*procFlag*/, uint32 procEx, uint32 cooldown)
{
SpellEntry const *spellInfo = triggeredByAura->GetSpellProto();
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
// Aspect of the Viper
if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->SpellFamilyFlags & UI64LIT(0x4000000000000))
{
uint32 maxmana = GetMaxPower(POWER_MANA);
int32 bp = int32(maxmana* GetAttackTime(RANGED_ATTACK)/1000.0f/100.0f);
if(cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(34075))
return <API key>;
CastCustomSpell(this, 34075, &bp, NULL, NULL, true, castItem, triggeredByAura);
}
// Arcane Blast
else if (spellInfo->Id == 36032 && procSpell->SpellFamilyName == SPELLFAMILY_MAGE && procSpell->SpellIconID == 2294)
// prevent proc from self(spell that triggered this aura)
return <API key>;
return SPELL_AURA_PROC_OK;
}
SpellAuraProcResult Unit::<API key>(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/)
{
if (!triggeredByAura)
return <API key>;
SpellEntry const *spellProto = triggeredByAura->GetSpellProto();
if (!spellProto)
return <API key>;
switch (spellProto->SpellFamilyName)
{
case <API key>:
{
switch (spellProto->SpellIconID)
{
// Reaping
// Death Rune Mastery
// Blood of the North
case 22:
case 2622:
case 3041:
{
if(!procSpell)
return <API key>;
if (getClass() != CLASS_DEATH_KNIGHT)
return <API key>;
Player * plr = GetTypeId() == TYPEID_PLAYER? ((Player*)this) : NULL;
if (!plr)
return <API key>;
//get spell rune cost
SpellRuneCostEntry const *runeCost = sSpellRuneCostStore.LookupEntry(procSpell->runeCostID);
if (!runeCost)
return <API key>;
//convert runes to death
for (uint32 i = 0; i < NUM_RUNE_TYPES -1/*don't count death rune*/; ++i)
{
uint32 remainingCost = runeCost->RuneCost[i];
while(remainingCost)
{
int32 <API key> = -1;
uint32 convertedRune = i;
for(uint32 j = 0; j < MAX_RUNES; ++j)
{
// convert only valid runes
if (RuneType(i) != plr->GetCurrentRune(j) &&
RuneType(i) != plr->GetBaseRune(j))
continue;
// select rune with longest cooldown
if (<API key> < plr->GetRuneCooldown(j))
{
<API key> = int32(plr->GetRuneCooldown(j));
convertedRune = j;
}
}
if (<API key> >= 0)
plr->ConvertRune(convertedRune, RUNE_DEATH);
--remainingCost;
}
}
return SPELL_AURA_PROC_OK;
}
default:
break;
}
break;
}
default:
break;
}
return SPELL_AURA_PROC_OK;
}
SpellAuraProcResult Unit::HandleModRating(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const * /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/)
{
SpellEntry const *spellInfo = triggeredByAura->GetSpellProto();
if (spellInfo->Id == 71564) // Deadly Precision
{
// Remove only single aura from stack
if (triggeredByAura->GetStackAmount() > 1 && !triggeredByAura->GetHolder()->ModStackAmount(-1))
return <API key>;
}
return SPELL_AURA_PROC_OK;
}
SpellAuraProcResult Unit::<API key>(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
{
triggeredByAura->SetInUse(true);
<API key>(triggeredByAura->GetSpellProto()->Id, triggeredByAura->GetCasterGUID());
triggeredByAura->SetInUse(false);
return SPELL_AURA_PROC_OK;
}
SpellAuraProcResult Unit::<API key>(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
{
// The chance to dispel an aura depends on the damage taken with respect to the casters level.
uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50;
float chance = float(damage) / max_dmg * 100.0f;
if (roll_chance_f(chance))
return <API key>(pVictim, damage, triggeredByAura, procSpell, procFlag, procEx, cooldown);
return <API key>;
}
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, absolute_import
import ctypes
from nidaba import storage
from nidaba.celery import app
from nidaba.tasks.helper import NidabaTask
from nidaba.nidabaexceptions import (<API key>,
<API key>,
<API key>)
leptlib = 'liblept.so'
def setup(*args, **kwargs):
try:
ctypes.cdll.LoadLibrary(leptlib)
except Exception as e:
raise <API key>(e.message)
@app.task(base=NidabaTask, name=u'nidaba.binarize.sauvola',
arg_values={'whsize': 'int', 'factor': (0.0, 1.0)})
def sauvola(doc, method=u'sauvola', whsize=10, factor=0.35):
input_path = storage.get_abs_path(*doc)
output_path = storage.insert_suffix(input_path, method, unicode(whsize),
unicode(factor))
lept_sauvola(input_path, output_path, whsize, factor)
return storage.get_storage_path(output_path)
def lept_sauvola(image_path, output_path, whsize=10, factor=0.35):
if whsize < 2 or factor >= 1.0 or factor < 0:
raise <API key>('Parameters ({}, {}) outside of valid range'.format(whsize, factor))
try:
lept = ctypes.cdll.LoadLibrary(leptlib)
except OSError as e:
raise <API key>('Loading leptonica failed: ' +
e.message)
pix = ctypes.c_void_p(lept.pixRead(image_path.encode('utf-8')))
opix = ctypes.c_void_p()
if lept.pixGetDepth(pix) != 8:
lept.pixDestroy(ctypes.byref(pix))
raise <API key>('Input image is not grayscale')
if lept.pixSauvolaBinarize(pix, whsize, ctypes.c_float(factor), 0, None,
None, None, ctypes.byref(opix)):
lept.pixDestroy(ctypes.byref(pix))
raise <API key>('Binarization failed for unknown '
'reason.')
if lept.<API key>(output_path.encode('utf-8'), opix, 100, 0):
lept.pixDestroy(ctypes.byref(pix))
lept.pixDestroy(ctypes.byref(pix))
raise <API key>('Writing binarized PIX failed')
lept.pixDestroy(ctypes.byref(opix))
lept.pixDestroy(ctypes.byref(pix))
@app.task(base=NidabaTask, name=u'nidaba.img.dewarp')
def dewarp(doc, method=u'dewarp'):
"""
Removes perspective distortion (as commonly exhibited by overhead scans)
from an 1bpp input image.
Args:
doc (unicode, unicode): The input document tuple.
method (unicode): The suffix string appended to all output files.
Returns:
(unicode, unicode): Storage tuple of the output file
"""
input_path = storage.get_abs_path(*doc)
output_path = storage.insert_suffix(input_path, method)
lept_dewarp(input_path, output_path)
return storage.get_storage_path(output_path)
def lept_dewarp(image_path, output_path):
"""
Removes perspective distortion from an 1bpp input image.
Args:
image_path (unicode): Path to the input image
output_path (unicode): Path to the output image
Raises:
<API key> if one of leptonica's functions failed.
"""
try:
lept = ctypes.cdll.LoadLibrary(leptlib)
except OSError as e:
raise <API key>('Loading leptonica failed: ' +
e.message)
pix = ctypes.c_void_p(lept.pixRead(image_path.encode('utf-8')))
opix = ctypes.c_void_p()
ret = lept.dewarpSinglePage(pix, 0, 1, 1, ctypes.byref(opix), None, 0)
if ret == 1 or ret is None:
lept.pixDestroy(ctypes.byref(pix))
lept.pixDestroy(ctypes.byref(opix))
raise <API key>('Dewarping failed for unknown reason.')
if lept.<API key>(output_path.encode('utf-8'), opix, 100, 0):
lept.pixDestroy(ctypes.byref(pix))
lept.pixDestroy(ctypes.byref(opix))
raise <API key>('Writing dewarped PIX failed')
lept.pixDestroy(ctypes.byref(pix))
lept.pixDestroy(ctypes.byref(opix))
@app.task(base=NidabaTask, name=u'nidaba.img.deskew')
def deskew(doc, method=u'deskew'):
"""
Removes skew (rotational distortion) from an 1bpp input image.
Args:
doc (unicode, unicode): The input document tuple.
method (unicode): The suffix string appended to all output files.
Returns:
(unicode, unicode): Storage tuple of the output file
"""
input_path = storage.get_abs_path(*doc)
output_path = storage.insert_suffix(input_path, method)
lept_deskew(input_path, output_path)
return storage.get_storage_path(output_path)
def lept_deskew(image_path, output_path):
"""
Removes skew (rotational distortion from an 1bpp input image.
Args:
image_path (unicode): Input image
output_path (unicode): Path to the output document
Raises:
<API key> if one of leptonica's functions failed.
"""
try:
lept = ctypes.cdll.LoadLibrary(leptlib)
except OSError as e:
raise <API key>('Loading leptonica failed: ' +
e.message)
pix = ctypes.c_void_p(lept.pixRead(image_path.encode('utf-8')))
opix = ctypes.c_void_p(lept.<API key>(pix, 4, None, None))
if opix is None:
lept.pixDestroy(ctypes.byref(pix))
raise <API key>('Deskewing failed for unknown reason.')
if lept.<API key>(output_path.encode('utf-8'), opix, 100, 0):
lept.pixDestroy(ctypes.byref(pix))
lept.pixDestroy(ctypes.byref(opix))
raise <API key>('Writing deskewed PIX failed')
lept.pixDestroy(ctypes.byref(pix))
lept.pixDestroy(ctypes.byref(opix))
|
/*!
* @file ipu_csi_enc.c
*
* @brief CSI Use case for video capture
*
* @ingroup IPU
*/
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/ipu.h>
#include <mach/mipi_csi2.h>
#include "mxc_v4l2_capture.h"
#include "ipu_prp_sw.h"
#ifdef CAMERA_DBG
#define CAMERA_TRACE(x) (printk)x
#else
#define CAMERA_TRACE(x)
#endif
/*
* Function definitions
*/
/*!
* csi ENC callback function.
*
* @param irq int irq line
* @param dev_id void * device id
*
* @return status IRQ_HANDLED for handled
*/
static irqreturn_t csi_enc_callback(int irq, void *dev_id)
{
cam_data *cam = (cam_data *) dev_id;
if (cam->enc_callback == NULL)
return IRQ_HANDLED;
cam->enc_callback(irq, dev_id);
return IRQ_HANDLED;
}
/*!
* CSI ENC enable channel setup function
*
* @param cam struct cam_data * mxc capture instance
*
* @return status
*/
static int csi_enc_setup(cam_data *cam)
{
<API key> params;
u32 pixel_fmt;
int err = 0, sensor_protocol = 0;
dma_addr_t dummy = cam->dummy_frame.buffer.m.offset;
#ifdef <API key>
void *mipi_csi2_info;
int ipu_id;
int csi_id;
#endif
CAMERA_TRACE("In csi_enc_setup\n");
if (!cam) {
printk(KERN_ERR "cam private is NULL\n");
return -ENXIO;
}
memset(¶ms, 0, sizeof(<API key>));
params.csi_mem.csi = cam->csi;
sensor_protocol = <API key>(cam->ipu, cam->csi);
switch (sensor_protocol) {
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
params.csi_mem.interlaced = false;
break;
case <API key>:
case <API key>:
case <API key>:
params.csi_mem.interlaced = true;
break;
default:
printk(KERN_ERR "sensor protocol unsupported\n");
return -EINVAL;
}
if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV420)
pixel_fmt = IPU_PIX_FMT_YUV420P;
else if (cam->v2f.fmt.pix.pixelformat == <API key>)
pixel_fmt = IPU_PIX_FMT_YUV422P;
else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_UYVY)
pixel_fmt = IPU_PIX_FMT_UYVY;
else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_YUYV)
pixel_fmt = IPU_PIX_FMT_YUYV;
else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_NV12)
pixel_fmt = IPU_PIX_FMT_NV12;
else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_BGR24)
pixel_fmt = IPU_PIX_FMT_BGR24;
else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_RGB24)
pixel_fmt = IPU_PIX_FMT_RGB24;
else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_RGB565)
pixel_fmt = IPU_PIX_FMT_RGB565;
else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_BGR32)
pixel_fmt = IPU_PIX_FMT_BGR32;
else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_RGB32)
pixel_fmt = IPU_PIX_FMT_RGB32;
else {
printk(KERN_ERR "format not supported\n");
return -EINVAL;
}
#ifdef <API key>
mipi_csi2_info = mipi_csi2_get_info();
if (mipi_csi2_info) {
if (<API key>(mipi_csi2_info)) {
ipu_id = <API key>(mipi_csi2_info);
csi_id = <API key>(mipi_csi2_info);
if (cam->ipu == ipu_get_soc(ipu_id)
&& cam->csi == csi_id) {
params.csi_mem.mipi_en = true;
params.csi_mem.mipi_vc =
<API key>(mipi_csi2_info);
params.csi_mem.mipi_id =
<API key>(mipi_csi2_info);
<API key>(mipi_csi2_info);
} else {
params.csi_mem.mipi_en = false;
params.csi_mem.mipi_vc = 0;
params.csi_mem.mipi_id = 0;
}
} else {
params.csi_mem.mipi_en = false;
params.csi_mem.mipi_vc = 0;
params.csi_mem.mipi_id = 0;
}
} else {
printk(KERN_ERR "Fail to get mipi_csi2_info!\n");
return -EPERM;
}
#endif
err = ipu_init_channel(cam->ipu, CSI_MEM, ¶ms);
if (err != 0) {
printk(KERN_ERR "ipu_init_channel %d\n", err);
return err;
}
err = <API key>(cam->ipu, CSI_MEM, IPU_OUTPUT_BUFFER,
pixel_fmt, cam->v2f.fmt.pix.width,
cam->v2f.fmt.pix.height,
cam->v2f.fmt.pix.bytesperline,
cam->rotation,
dummy, dummy, 0,
cam->offset.u_offset,
cam->offset.v_offset);
if (err != 0) {
printk(KERN_ERR "CSI_MEM output buffer\n");
return err;
}
err = ipu_enable_channel(cam->ipu, CSI_MEM);
if (err < 0) {
printk(KERN_ERR "ipu_enable_channel CSI_MEM\n");
return err;
}
return err;
}
/*!
* function to update physical buffer address for encorder IDMA channel
*
* @param eba physical buffer address for encorder IDMA channel
* @param buffer_num int buffer 0 or buffer 1
*
* @return status
*/
static int csi_enc_eba_update(struct ipu_soc *ipu, dma_addr_t eba, int *buffer_num)
{
int err = 0;
pr_debug("eba %x\n", eba);
err = <API key>(ipu, CSI_MEM, IPU_OUTPUT_BUFFER,
*buffer_num, eba);
if (err != 0) {
<API key>(ipu, CSI_MEM, IPU_OUTPUT_BUFFER,
*buffer_num);
err = <API key>(ipu, CSI_MEM, IPU_OUTPUT_BUFFER,
*buffer_num, eba);
if (err != 0) {
pr_err("ERROR: v4l2 capture: fail to update "
"buf%d\n", *buffer_num);
return err;
}
}
ipu_select_buffer(ipu, CSI_MEM, IPU_OUTPUT_BUFFER, *buffer_num);
*buffer_num = (*buffer_num == 0) ? 1 : 0;
return 0;
}
/*!
* Enable encoder task
* @param private struct cam_data * mxc capture instance
*
* @return status
*/
static int <API key>(void *private)
{
cam_data *cam = (cam_data *) private;
int err = 0;
CAMERA_TRACE("IPU:In <API key>\n");
if (cam->dummy_frame.vaddress &&
cam->dummy_frame.buffer.length
< PAGE_ALIGN(cam->v2f.fmt.pix.sizeimage)) {
dma_free_coherent(0, cam->dummy_frame.buffer.length,
cam->dummy_frame.vaddress,
cam->dummy_frame.paddress);
cam->dummy_frame.vaddress = 0;
}
if (!cam->dummy_frame.vaddress) {
cam->dummy_frame.vaddress = dma_alloc_coherent(0,
PAGE_ALIGN(cam->v2f.fmt.pix.sizeimage),
&cam->dummy_frame.paddress,
GFP_DMA | GFP_KERNEL);
if (cam->dummy_frame.vaddress == 0) {
pr_err("ERROR: v4l2 capture: Allocate dummy frame "
"failed.\n");
return -ENOBUFS;
}
cam->dummy_frame.buffer.length =
PAGE_ALIGN(cam->v2f.fmt.pix.sizeimage);
}
cam->dummy_frame.buffer.type = <API key>;
cam->dummy_frame.buffer.m.offset = cam->dummy_frame.paddress;
ipu_clear_irq(cam->ipu, <API key>);
err = ipu_request_irq(cam->ipu, <API key>,
csi_enc_callback, 0, "Mxc Camera", cam);
if (err != 0) {
printk(KERN_ERR "Error registering rot irq\n");
return err;
}
err = csi_enc_setup(cam);
if (err != 0) {
printk(KERN_ERR "csi_enc_setup %d\n", err);
return err;
}
return err;
}
/*!
* Disable encoder task
* @param private struct cam_data * mxc capture instance
*
* @return int
*/
static int <API key>(void *private)
{
cam_data *cam = (cam_data *) private;
int err = 0;
#ifdef <API key>
void *mipi_csi2_info;
int ipu_id;
int csi_id;
#endif
err = ipu_disable_channel(cam->ipu, CSI_MEM, true);
ipu_uninit_channel(cam->ipu, CSI_MEM);
#ifdef <API key>
mipi_csi2_info = mipi_csi2_get_info();
if (mipi_csi2_info) {
if (<API key>(mipi_csi2_info)) {
ipu_id = <API key>(mipi_csi2_info);
csi_id = <API key>(mipi_csi2_info);
if (cam->ipu == ipu_get_soc(ipu_id)
&& cam->csi == csi_id)
<API key>(mipi_csi2_info);
}
} else {
printk(KERN_ERR "Fail to get mipi_csi2_info!\n");
return -EPERM;
}
#endif
return err;
}
/*!
* Enable csi
* @param private struct cam_data * mxc capture instance
*
* @return status
*/
static int csi_enc_enable_csi(void *private)
{
cam_data *cam = (cam_data *) private;
return ipu_enable_csi(cam->ipu, cam->csi);
}
/*!
* Disable csi
* @param private struct cam_data * mxc capture instance
*
* @return status
*/
static int csi_enc_disable_csi(void *private)
{
cam_data *cam = (cam_data *) private;
/* free csi eof irq firstly.
* when disable csi, wait for idmac eof.
* it requests eof irq again */
ipu_free_irq(cam->ipu, <API key>, cam);
return ipu_disable_csi(cam->ipu, cam->csi);
}
/*!
* function to select CSI ENC as the working path
*
* @param private struct cam_data * mxc capture instance
*
* @return int
*/
int csi_enc_select(void *private)
{
cam_data *cam = (cam_data *) private;
int err = 0;
if (cam) {
cam->enc_update_eba = csi_enc_eba_update;
cam->enc_enable = <API key>;
cam->enc_disable = <API key>;
cam->enc_enable_csi = csi_enc_enable_csi;
cam->enc_disable_csi = csi_enc_disable_csi;
} else {
err = -EIO;
}
return err;
}
/*!
* function to de-select CSI ENC as the working path
*
* @param private struct cam_data * mxc capture instance
*
* @return int
*/
int csi_enc_deselect(void *private)
{
cam_data *cam = (cam_data *) private;
int err = 0;
if (cam) {
cam->enc_update_eba = NULL;
cam->enc_enable = NULL;
cam->enc_disable = NULL;
cam->enc_enable_csi = NULL;
cam->enc_disable_csi = NULL;
}
return err;
}
/*!
* Init the Encorder channels
*
* @return Error code indicating success or failure
*/
__init int csi_enc_init(void)
{
return 0;
}
/*!
* Deinit the Encorder channels
*
*/
void __exit csi_enc_exit(void)
{
}
module_init(csi_enc_init);
module_exit(csi_enc_exit);
EXPORT_SYMBOL(csi_enc_select);
EXPORT_SYMBOL(csi_enc_deselect);
MODULE_AUTHOR("Freescale Semiconductor, Inc.");
MODULE_DESCRIPTION("CSI ENC Driver");
MODULE_LICENSE("GPL");
|
<?php
defined('_JEXEC') or die;
jimport('joomla.application.component.modellist');
/**
* Methods supporting a list of Jazz_mastering records.
*/
class <API key> extends JModelList {
/**
* Constructor.
*
* @param array An optional associative array of configuration settings.
* @see JController
* @since 1.6
*/
public function __construct($config = array()) {
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null) {
// Initialise variables.
$app = JFactory::getApplication();
// List state information
$limit = $app-><API key>('global.list.limit', 'limit', $app->getCfg('list_limit'));
$this->setState('list.limit', $limit);
$limitstart = JFactory::getApplication()->input->getInt('limitstart', 0);
$this->setState('list.start', $limitstart);
// List state information.
parent::populateState($ordering, $direction);
}
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
* @since 1.6
*/
protected function getListQuery() {
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select', 'a.*'
)
);
$query->from('`#<API key>` AS a');
$query->select('<API key>.name AS <API key>');
$query->join('LEFT', '#__users AS <API key> ON <API key>.id = a.<API key>');
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search)) {
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
} else {
$search = $db->Quote('%'.$db->escape($search, true).'%');
}
}
return $query;
}
}
|
/*
* This file handles the generic file mmap semantics used by
* most "normal" filesystems (but you don't /have/ to use this:
* the NFS filesystem used to do this differently, for example)
*/
#include <linux/export.h>
#include <linux/compiler.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/aio.h>
#include <linux/capability.h>
#include <linux/kernel_stat.h>
#include <linux/gfp.h>
#include <linux/mm.h>
#include <linux/swap.h>
#include <linux/mman.h>
#include <linux/pagemap.h>
#include <linux/file.h>
#include <linux/uio.h>
#include <linux/hash.h>
#include <linux/writeback.h>
#include <linux/backing-dev.h>
#include <linux/pagevec.h>
#include <linux/blkdev.h>
#include <linux/security.h>
#include <linux/cpuset.h>
#include <linux/hardirq.h> /* for BUG_ON(!in_atomic()) only */
#include <linux/memcontrol.h>
#include <linux/cleancache.h>
#include "internal.h"
#include "../fs/sreadahead_prof.h"
/*
* FIXME: remove all knowledge of the buffer layer from the core VM
*/
#include <linux/buffer_head.h> /* for try_to_free_buffers */
#include <asm/mman.h>
/*
* Shared mappings implemented 30.11.1994. It's not fully working yet,
* though.
*
* Shared mappings now work. 15.8.1995 Bruno.
*
* finished 'unifying' the page and buffer cache and SMP-threaded the
* page-cache, 21.05.1999, Ingo Molnar <mingo@redhat.com>
*
* SMP-threaded pagemap-LRU 1999, Andrea Arcangeli <andrea@suse.de>
*/
/*
* Lock ordering:
*
* ->i_mmap_mutex (truncate_pagecache)
* ->private_lock (__free_pte-><API key>)
* ->swap_lock (exclusive_swap_page, others)
* ->mapping->tree_lock
*
* ->i_mutex
* ->i_mmap_mutex (truncate->unmap_mapping_range)
*
* ->mmap_sem
* ->i_mmap_mutex
* ->page_table_lock or pte_lock (various, mainly in memory.c)
* ->mapping->tree_lock (arch-dependent <API key>)
*
* ->mmap_sem
* ->lock_page (access_process_vm)
*
* ->i_mutex (<API key>)
* ->mmap_sem (<API key>->do_page_fault)
*
* bdi->wb.list_lock
* sb_lock (fs/fs-writeback.c)
* ->mapping->tree_lock (__sync_single_inode)
*
* ->i_mmap_mutex
* ->anon_vma.lock (vma_adjust)
*
* ->anon_vma.lock
* ->page_table_lock or pte_lock (anon_vma_prepare and various)
*
* ->page_table_lock or pte_lock
* ->swap_lock (try_to_unmap_one)
* ->private_lock (try_to_unmap_one)
* ->tree_lock (try_to_unmap_one)
* ->zone.lru_lock (follow_page->mark_page_accessed)
* ->zone.lru_lock (check_pte_range->isolate_lru_page)
* ->private_lock (page_remove_rmap->set_page_dirty)
* ->tree_lock (page_remove_rmap->set_page_dirty)
* bdi.wb->list_lock (page_remove_rmap->set_page_dirty)
* ->inode->i_lock (page_remove_rmap->set_page_dirty)
* bdi.wb->list_lock (zap_pte_range->set_page_dirty)
* ->inode->i_lock (zap_pte_range->set_page_dirty)
* ->private_lock (zap_pte_range-><API key>)
*
* ->i_mmap_mutex
* ->tasklist_lock (memory_failure, collect_procs_ao)
*/
/*
* Delete a page from the page cache and free it. Caller has to make
* sure the page is locked and that nobody else uses it - or that usage
* is safe. The caller must hold the mapping's tree_lock.
*/
void <API key>(struct page *page)
{
struct address_space *mapping = page->mapping;
/*
* if we're uptodate, flush out into the cleancache, otherwise
* invalidate any existing cleancache entries. We can't leave
* stale data around in the cleancache once our page is gone
*/
if (PageUptodate(page) && PageMappedToDisk(page))
cleancache_put_page(page);
else
<API key>(mapping, page);
radix_tree_delete(&mapping->page_tree, page->index);
page->mapping = NULL;
/* Leave page->index set: truncation lookup relies upon it */
mapping->nrpages
<API key>(page, NR_FILE_PAGES);
if (PageSwapBacked(page))
<API key>(page, NR_SHMEM);
BUG_ON(page_mapped(page));
/*
* Some filesystems seem to re-dirty the page even after
* the VM has canceled the dirty bit (eg ext3 journaling).
*
* Fix it up by doing a final dirty accounting check after
* having removed the page entirely.
*/
if (PageDirty(page) && <API key>(mapping)) {
dec_zone_page_state(page, NR_FILE_DIRTY);
dec_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);
}
}
/**
* <API key> - delete page from page cache
* @page: the page which the kernel is trying to remove from page cache
*
* This must be called only on pages that have been verified to be in the page
* cache and locked. It will never put the page into the free list, the caller
* has a reference on the page.
*/
void <API key>(struct page *page)
{
struct address_space *mapping = page->mapping;
void (*freepage)(struct page *);
BUG_ON(!PageLocked(page));
freepage = mapping->a_ops->freepage;
spin_lock_irq(&mapping->tree_lock);
<API key>(page);
spin_unlock_irq(&mapping->tree_lock);
<API key>(page);
if (freepage)
freepage(page);
page_cache_release(page);
}
EXPORT_SYMBOL(<API key>);
static int sleep_on_page(void *word)
{
io_schedule();
return 0;
}
static int <API key>(void *word)
{
sleep_on_page(word);
return <API key>(current) ? -EINTR : 0;
}
/**
* <API key> - start writeback on mapping dirty pages in range
* @mapping: address space structure to write
* @start: offset in bytes where the range starts
* @end: offset in bytes where the range ends (inclusive)
* @sync_mode: enable synchronous operation
*
* Start writeback against all of a mapping's dirty pages that lie
* within the byte offsets <start, end> inclusive.
*
* If sync_mode is WB_SYNC_ALL then this is a "data integrity" operation, as
* opposed to a regular memory cleansing writeback. The difference between
* these two operations is that if a dirty page/buffer is encountered, it must
* be waited upon, and not just skipped over.
*/
int <API key>(struct address_space *mapping, loff_t start,
loff_t end, int sync_mode)
{
int ret;
struct writeback_control wbc = {
.sync_mode = sync_mode,
.nr_to_write = LONG_MAX,
.range_start = start,
.range_end = end,
};
if (!<API key>(mapping))
return 0;
ret = do_writepages(mapping, &wbc);
return ret;
}
static inline int <API key>(struct address_space *mapping,
int sync_mode)
{
return <API key>(mapping, 0, LLONG_MAX, sync_mode);
}
int filemap_fdatawrite(struct address_space *mapping)
{
return <API key>(mapping, WB_SYNC_ALL);
}
EXPORT_SYMBOL(filemap_fdatawrite);
int <API key>(struct address_space *mapping, loff_t start,
loff_t end)
{
return <API key>(mapping, start, end, WB_SYNC_ALL);
}
EXPORT_SYMBOL(<API key>);
/**
* filemap_flush - mostly a non-blocking flush
* @mapping: target address_space
*
* This is a mostly non-blocking flush. Not suitable for data-integrity
* purposes - I/O may not be started against all dirty pages.
*/
int filemap_flush(struct address_space *mapping)
{
return <API key>(mapping, WB_SYNC_NONE);
}
EXPORT_SYMBOL(filemap_flush);
/**
* <API key> - wait for writeback to complete
* @mapping: address space structure to wait for
* @start_byte: offset in bytes where the range starts
* @end_byte: offset in bytes where the range ends (inclusive)
*
* Walk the list of under-writeback pages of the given address space
* in the given range and wait for all of them.
*/
int <API key>(struct address_space *mapping, loff_t start_byte,
loff_t end_byte)
{
pgoff_t index = start_byte >> PAGE_CACHE_SHIFT;
pgoff_t end = end_byte >> PAGE_CACHE_SHIFT;
struct pagevec pvec;
int nr_pages;
int ret = 0;
if (end_byte < start_byte)
return 0;
pagevec_init(&pvec, 0);
while ((index <= end) &&
(nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
<API key>,
min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1)) != 0) {
unsigned i;
for (i = 0; i < nr_pages; i++) {
struct page *page = pvec.pages[i];
/* until radix tree lookup accepts end_index */
if (page->index > end)
continue;
<API key>(page);
if (TestClearPageError(page))
ret = -EIO;
}
pagevec_release(&pvec);
cond_resched();
}
/* Check for outstanding write errors */
if (test_and_clear_bit(AS_ENOSPC, &mapping->flags))
ret = -ENOSPC;
if (test_and_clear_bit(AS_EIO, &mapping->flags))
ret = -EIO;
return ret;
}
EXPORT_SYMBOL(<API key>);
/**
* filemap_fdatawait - wait for all under-writeback pages to complete
* @mapping: address space structure to wait for
*
* Walk the list of under-writeback pages of the given address space
* and wait for all of them.
*/
int filemap_fdatawait(struct address_space *mapping)
{
loff_t i_size = i_size_read(mapping->host);
if (i_size == 0)
return 0;
return <API key>(mapping, 0, i_size - 1);
}
EXPORT_SYMBOL(filemap_fdatawait);
int <API key>(struct address_space *mapping)
{
int err = 0;
if (mapping->nrpages) {
err = filemap_fdatawrite(mapping);
/*
* Even if the above returned error, the pages may be
* written partially (e.g. -ENOSPC), so we wait for it.
* But the -EIO is special case, it may indicate the worst
* thing (e.g. bug) happened, so we avoid waiting for it.
*/
if (err != -EIO) {
int err2 = filemap_fdatawait(mapping);
if (!err)
err = err2;
}
}
return err;
}
EXPORT_SYMBOL(<API key>);
/**
* <API key> - write out & wait on a file range
* @mapping: the address_space for the pages
* @lstart: offset in bytes where the range starts
* @lend: offset in bytes where the range ends (inclusive)
*
* Write out and wait upon file offsets lstart->lend, inclusive.
*
* Note that `lend' is inclusive (describes the last byte to be written) so
* that this function can be used to write to the very end-of-file (end = -1).
*/
int <API key>(struct address_space *mapping,
loff_t lstart, loff_t lend)
{
int err = 0;
if (mapping->nrpages) {
err = <API key>(mapping, lstart, lend,
WB_SYNC_ALL);
/* See comment of <API key>() */
if (err != -EIO) {
int err2 = <API key>(mapping,
lstart, lend);
if (!err)
err = err2;
}
}
return err;
}
EXPORT_SYMBOL(<API key>);
/**
* <API key> - replace a pagecache page with a new one
* @old: page to be replaced
* @new: page to replace with
* @gfp_mask: allocation mode
*
* This function replaces a page in the pagecache with a new one. On
* success it acquires the pagecache reference for the new page and
* drops it for the old page. Both the old and new pages must be
* locked. This function does not add the new page to the LRU, the
* caller must do that.
*
* The remove + add is atomic. The only way this function can fail is
* memory allocation failure.
*/
int <API key>(struct page *old, struct page *new, gfp_t gfp_mask)
{
int error;
VM_BUG_ON(!PageLocked(old));
VM_BUG_ON(!PageLocked(new));
VM_BUG_ON(new->mapping);
error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM);
if (!error) {
struct address_space *mapping = old->mapping;
void (*freepage)(struct page *);
pgoff_t offset = old->index;
freepage = mapping->a_ops->freepage;
page_cache_get(new);
new->mapping = mapping;
new->index = offset;
spin_lock_irq(&mapping->tree_lock);
<API key>(old);
error = radix_tree_insert(&mapping->page_tree, offset, new);
BUG_ON(error);
mapping->nrpages++;
<API key>(new, NR_FILE_PAGES);
if (PageSwapBacked(new))
<API key>(new, NR_SHMEM);
spin_unlock_irq(&mapping->tree_lock);
/* mem_cgroup codes must not be called under tree_lock */
<API key>(old, new);
<API key>();
if (freepage)
freepage(old);
page_cache_release(old);
}
return error;
}
EXPORT_SYMBOL_GPL(<API key>);
/**
* <API key> - add a locked page to the pagecache
* @page: page to add
* @mapping: the page's address_space
* @offset: page index
* @gfp_mask: page allocation mode
*
* This function is used to add a page to the pagecache. It must be locked.
* This function does not add the page to the LRU. The caller must do that.
*/
int <API key>(struct page *page, struct address_space *mapping,
pgoff_t offset, gfp_t gfp_mask)
{
int error;
VM_BUG_ON(!PageLocked(page));
VM_BUG_ON(PageSwapBacked(page));
error = <API key>(page, current->mm,
gfp_mask & GFP_RECLAIM_MASK);
if (error)
goto out;
error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM);
if (error == 0) {
page_cache_get(page);
page->mapping = mapping;
page->index = offset;
spin_lock_irq(&mapping->tree_lock);
error = radix_tree_insert(&mapping->page_tree, offset, page);
if (likely(!error)) {
mapping->nrpages++;
<API key>(page, NR_FILE_PAGES);
spin_unlock_irq(&mapping->tree_lock);
} else {
page->mapping = NULL;
/* Leave page->index set: truncation relies upon it */
spin_unlock_irq(&mapping->tree_lock);
<API key>(page);
page_cache_release(page);
}
<API key>();
} else
<API key>(page);
out:
return error;
}
EXPORT_SYMBOL(<API key>);
int <API key>(struct page *page, struct address_space *mapping,
pgoff_t offset, gfp_t gfp_mask)
{
int ret;
ret = add_to_page_cache(page, mapping, offset, gfp_mask);
if (ret == 0)
lru_cache_add_file(page);
return ret;
}
EXPORT_SYMBOL_GPL(<API key>);
#ifdef CONFIG_NUMA
struct page *__page_cache_alloc(gfp_t gfp)
{
int n;
struct page *page;
if (<API key>()) {
unsigned int cpuset_mems_cookie;
do {
cpuset_mems_cookie = get_mems_allowed();
n = <API key>();
page = <API key>(n, gfp, 0);
} while (!put_mems_allowed(cpuset_mems_cookie) && !page);
return page;
}
return alloc_pages(gfp, 0);
}
EXPORT_SYMBOL(__page_cache_alloc);
#endif
/*
* In order to wait for pages to become available there must be
* waitqueues associated with pages. By using a hash table of
* waitqueues where the bucket discipline is to maintain all
* waiters on the same queue and wake all when any of the pages
* become available, and for the woken contexts to check to be
* sure the appropriate page became available, this saves space
* at a cost of "thundering herd" phenomena during rare hash
* collisions.
*/
static wait_queue_head_t *page_waitqueue(struct page *page)
{
const struct zone *zone = page_zone(page);
return &zone->wait_table[hash_ptr(page, zone->wait_table_bits)];
}
static inline void wake_up_page(struct page *page, int bit)
{
__wake_up_bit(page_waitqueue(page), &page->flags, bit);
}
void wait_on_page_bit(struct page *page, int bit_nr)
{
DEFINE_WAIT_BIT(wait, &page->flags, bit_nr);
if (test_bit(bit_nr, &page->flags))
__wait_on_bit(page_waitqueue(page), &wait, sleep_on_page,
<API key>);
}
EXPORT_SYMBOL(wait_on_page_bit);
int <API key>(struct page *page, int bit_nr)
{
DEFINE_WAIT_BIT(wait, &page->flags, bit_nr);
if (!test_bit(bit_nr, &page->flags))
return 0;
return __wait_on_bit(page_waitqueue(page), &wait,
<API key>, TASK_KILLABLE);
}
/**
* add_page_wait_queue - Add an arbitrary waiter to a page's wait queue
* @page: Page defining the wait queue of interest
* @waiter: Waiter to add to the queue
*
* Add an arbitrary @waiter to the wait queue for the nominated @page.
*/
void add_page_wait_queue(struct page *page, wait_queue_t *waiter)
{
wait_queue_head_t *q = page_waitqueue(page);
unsigned long flags;
spin_lock_irqsave(&q->lock, flags);
__add_wait_queue(q, waiter);
<API key>(&q->lock, flags);
}
EXPORT_SYMBOL_GPL(add_page_wait_queue);
/**
* unlock_page - unlock a locked page
* @page: the page
*
* Unlocks the page and wakes up sleepers in <API key>().
* Also wakes sleepers in <API key>() because the wakeup
* mechananism between PageLocked pages and PageWriteback pages is shared.
* But that's OK - sleepers in <API key>() just go back to sleep.
*
* The mb is necessary to enforce ordering between the clear_bit and the read
* of the waitqueue (to avoid SMP races with a parallel wait_on_page_locked()).
*/
void unlock_page(struct page *page)
{
VM_BUG_ON(!PageLocked(page));
clear_bit_unlock(PG_locked, &page->flags);
<API key>();
wake_up_page(page, PG_locked);
}
EXPORT_SYMBOL(unlock_page);
/**
* end_page_writeback - end writeback against a page
* @page: the page
*/
void end_page_writeback(struct page *page)
{
if (<API key>(page))
<API key>(page);
if (!<API key>(page))
BUG();
<API key>();
wake_up_page(page, PG_writeback);
}
EXPORT_SYMBOL(end_page_writeback);
/**
* __lock_page - get a lock on the page, assuming we need to sleep to get it
* @page: the page to lock
*/
void __lock_page(struct page *page)
{
DEFINE_WAIT_BIT(wait, &page->flags, PG_locked);
__wait_on_bit_lock(page_waitqueue(page), &wait, sleep_on_page,
<API key>);
}
EXPORT_SYMBOL(__lock_page);
int <API key>(struct page *page)
{
DEFINE_WAIT_BIT(wait, &page->flags, PG_locked);
return __wait_on_bit_lock(page_waitqueue(page), &wait,
<API key>, TASK_KILLABLE);
}
EXPORT_SYMBOL_GPL(<API key>);
int <API key>(struct page *page, struct mm_struct *mm,
unsigned int flags)
{
if (flags & <API key>) {
/*
* CAUTION! In this case, mmap_sem is not released
* even though return 0.
*/
if (flags & <API key>)
return 0;
up_read(&mm->mmap_sem);
if (flags & FAULT_FLAG_KILLABLE)
<API key>(page);
else
wait_on_page_locked(page);
return 0;
} else {
if (flags & FAULT_FLAG_KILLABLE) {
int ret;
ret = <API key>(page);
if (ret) {
up_read(&mm->mmap_sem);
return 0;
}
} else
__lock_page(page);
return 1;
}
}
/**
* find_get_page - find and get a page reference
* @mapping: the address_space to search
* @offset: the page index
*
* Is there a pagecache struct page at the given (mapping, offset) tuple?
* If yes, increment its refcount and return it; if no, return NULL.
*/
struct page *find_get_page(struct address_space *mapping, pgoff_t offset)
{
void **pagep;
struct page *page;
rcu_read_lock();
repeat:
page = NULL;
pagep = <API key>(&mapping->page_tree, offset);
if (pagep) {
page = <API key>(pagep);
if (unlikely(!page))
goto out;
if (<API key>(page)) {
if (<API key>(page))
goto repeat;
/*
* Otherwise, shmem/tmpfs must be storing a swap entry
* here as an exceptional entry: so return it without
* attempting to raise page count.
*/
goto out;
}
if (!<API key>(page))
goto repeat;
/*
* Has the page moved?
* This is part of the lockless pagecache protocol. See
* include/linux/pagemap.h for details.
*/
if (unlikely(page != *pagep)) {
page_cache_release(page);
goto repeat;
}
}
out:
rcu_read_unlock();
return page;
}
EXPORT_SYMBOL(find_get_page);
/**
* find_lock_page - locate, pin and lock a pagecache page
* @mapping: the address_space to search
* @offset: the page index
*
* Locates the desired pagecache page, locks it, increments its reference
* count and returns its address.
*
* Returns zero if the page was not present. find_lock_page() may sleep.
*/
struct page *find_lock_page(struct address_space *mapping, pgoff_t offset)
{
struct page *page;
repeat:
page = find_get_page(mapping, offset);
if (page && !<API key>(page)) {
lock_page(page);
/* Has the page been truncated? */
if (unlikely(page->mapping != mapping)) {
unlock_page(page);
page_cache_release(page);
goto repeat;
}
VM_BUG_ON(page->index != offset);
}
return page;
}
EXPORT_SYMBOL(find_lock_page);
/**
* find_or_create_page - locate or add a pagecache page
* @mapping: the page's address_space
* @index: the page's index into the mapping
* @gfp_mask: page allocation mode
*
* Locates a page in the pagecache. If the page is not present, a new page
* is allocated using @gfp_mask and is added to the pagecache and to the VM's
* LRU list. The returned page is locked and has its reference count
* incremented.
*
* find_or_create_page() may sleep, even if @gfp_flags specifies an atomic
* allocation!
*
* find_or_create_page() returns the desired page's address, or zero on
* memory exhaustion.
*/
struct page *find_or_create_page(struct address_space *mapping,
pgoff_t index, gfp_t gfp_mask)
{
struct page *page;
int err;
repeat:
page = find_lock_page(mapping, index);
if (!page) {
page = __page_cache_alloc(gfp_mask);
if (!page)
return NULL;
/*
* We want a regular kernel memory (not highmem or DMA etc)
* allocation for the radix tree nodes, but we need to honour
* the context-specific requirements the caller has asked for.
* GFP_RECLAIM_MASK collects those requirements.
*/
err = <API key>(page, mapping, index,
(gfp_mask & GFP_RECLAIM_MASK));
if (unlikely(err)) {
page_cache_release(page);
page = NULL;
if (err == -EEXIST)
goto repeat;
}
}
return page;
}
EXPORT_SYMBOL(find_or_create_page);
/**
* find_get_pages - gang pagecache lookup
* @mapping: The address_space to search
* @start: The starting page index
* @nr_pages: The maximum number of pages
* @pages: Where the resulting pages are placed
*
* find_get_pages() will search for and return a group of up to
* @nr_pages pages in the mapping. The pages are placed at @pages.
* find_get_pages() takes a reference against the returned pages.
*
* The search returns a group of mapping-contiguous pages with ascending
* indexes. There may be holes in the indices due to not-present pages.
*
* find_get_pages() returns the number of pages which were found.
*/
unsigned find_get_pages(struct address_space *mapping, pgoff_t start,
unsigned int nr_pages, struct page **pages)
{
struct radix_tree_iter iter;
void **slot;
unsigned ret = 0;
if (unlikely(!nr_pages))
return 0;
rcu_read_lock();
restart:
<API key>(slot, &mapping->page_tree, &iter, start) {
struct page *page;
repeat:
page = <API key>(slot);
if (unlikely(!page))
continue;
if (<API key>(page)) {
if (<API key>(page)) {
/*
* Transient condition which can only trigger
* when entry at index 0 moves out of or back
* to root: none yet gotten, safe to restart.
*/
WARN_ON(iter.index);
goto restart;
}
/*
* Otherwise, shmem/tmpfs must be storing a swap entry
* here as an exceptional entry: so skip over it -
* we only reach this from <API key>().
*/
continue;
}
if (!<API key>(page))
goto repeat;
/* Has the page moved? */
if (unlikely(page != *slot)) {
page_cache_release(page);
goto repeat;
}
pages[ret] = page;
if (++ret == nr_pages)
break;
}
rcu_read_unlock();
return ret;
}
/**
* <API key> - gang contiguous pagecache lookup
* @mapping: The address_space to search
* @index: The starting page index
* @nr_pages: The maximum number of pages
* @pages: Where the resulting pages are placed
*
* <API key>() works exactly like find_get_pages(), except
* that the returned number of pages are guaranteed to be contiguous.
*
* <API key>() returns the number of pages which were found.
*/
unsigned <API key>(struct address_space *mapping, pgoff_t index,
unsigned int nr_pages, struct page **pages)
{
struct radix_tree_iter iter;
void **slot;
unsigned int ret = 0;
if (unlikely(!nr_pages))
return 0;
rcu_read_lock();
restart:
<API key>(slot, &mapping->page_tree, &iter, index) {
struct page *page;
repeat:
page = <API key>(slot);
/* The hole, there no reason to continue */
if (unlikely(!page))
break;
if (<API key>(page)) {
if (<API key>(page)) {
/*
* Transient condition which can only trigger
* when entry at index 0 moves out of or back
* to root: none yet gotten, safe to restart.
*/
goto restart;
}
/*
* Otherwise, shmem/tmpfs must be storing a swap entry
* here as an exceptional entry: so stop looking for
* contiguous pages.
*/
break;
}
if (!<API key>(page))
goto repeat;
/* Has the page moved? */
if (unlikely(page != *slot)) {
page_cache_release(page);
goto repeat;
}
/*
* must check mapping and index after taking the ref.
* otherwise we can get both false positives and false
* negatives, which is just confusing to the caller.
*/
if (page->mapping == NULL || page->index != iter.index) {
page_cache_release(page);
break;
}
pages[ret] = page;
if (++ret == nr_pages)
break;
}
rcu_read_unlock();
return ret;
}
EXPORT_SYMBOL(<API key>);
/**
* find_get_pages_tag - find and return pages that match @tag
* @mapping: the address_space to search
* @index: the starting page index
* @tag: the tag index
* @nr_pages: the maximum number of pages
* @pages: where the resulting pages are placed
*
* Like find_get_pages, except we only return pages which are tagged with
* @tag. We update @index to index the next page for the traversal.
*/
unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index,
int tag, unsigned int nr_pages, struct page **pages)
{
struct radix_tree_iter iter;
void **slot;
unsigned ret = 0;
if (unlikely(!nr_pages))
return 0;
rcu_read_lock();
restart:
<API key>(slot, &mapping->page_tree,
&iter, *index, tag) {
struct page *page;
repeat:
page = <API key>(slot);
if (unlikely(!page))
continue;
if (<API key>(page)) {
if (<API key>(page)) {
/*
* Transient condition which can only trigger
* when entry at index 0 moves out of or back
* to root: none yet gotten, safe to restart.
*/
goto restart;
}
/*
* This function is never used on a shmem/tmpfs
* mapping, so a swap entry won't be found here.
*/
BUG();
}
if (!<API key>(page))
goto repeat;
/* Has the page moved? */
if (unlikely(page != *slot)) {
page_cache_release(page);
goto repeat;
}
pages[ret] = page;
if (++ret == nr_pages)
break;
}
rcu_read_unlock();
if (ret)
*index = pages[ret - 1]->index + 1;
return ret;
}
EXPORT_SYMBOL(find_get_pages_tag);
/**
* <API key> - returns locked page at given index in given cache
* @mapping: target address_space
* @index: the page index
*
* Same as grab_cache_page(), but do not wait if the page is unavailable.
* This is intended for speculative data generators, where the data can
* be regenerated if the page couldn't be grabbed. This routine should
* be safe to call while holding the lock for another page.
*
* Clear __GFP_FS when allocating the page to avoid recursion into the fs
* and deadlock against the caller's locked page.
*/
struct page *
<API key>(struct address_space *mapping, pgoff_t index)
{
struct page *page = find_get_page(mapping, index);
if (page) {
if (trylock_page(page))
return page;
page_cache_release(page);
return NULL;
}
page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~__GFP_FS);
if (page && <API key>(page, mapping, index, GFP_NOFS)) {
page_cache_release(page);
page = NULL;
}
return page;
}
EXPORT_SYMBOL(<API key>);
static void <API key>(struct file *filp,
struct file_ra_state *ra)
{
ra->ra_pages /= 4;
}
/**
* <API key> - generic file read routine
* @filp: the file to read
* @ppos: current file position
* @desc: read_descriptor
* @actor: read method
*
* This is a generic file read routine, and uses the
* mapping->a_ops->readpage() function for the actual low-level stuff.
*
* This is really ugly. But the goto's actually try to clarify some
* of the logic when it comes to error handling etc.
*/
static void <API key>(struct file *filp, loff_t *ppos,
read_descriptor_t *desc, read_actor_t actor)
{
struct address_space *mapping = filp->f_mapping;
struct inode *inode = mapping->host;
struct file_ra_state *ra = &filp->f_ra;
pgoff_t index;
pgoff_t last_index;
pgoff_t prev_index;
unsigned long offset; /* offset into pagecache page */
unsigned int prev_offset;
int error;
index = *ppos >> PAGE_CACHE_SHIFT;
prev_index = ra->prev_pos >> PAGE_CACHE_SHIFT;
prev_offset = ra->prev_pos & (PAGE_CACHE_SIZE-1);
last_index = (*ppos + desc->count + PAGE_CACHE_SIZE-1) >> PAGE_CACHE_SHIFT;
offset = *ppos & ~PAGE_CACHE_MASK;
for (;;) {
struct page *page;
pgoff_t end_index;
loff_t isize;
unsigned long nr, ret;
cond_resched();
find_page:
page = find_get_page(mapping, index);
if (!page) {
<API key>(mapping,
ra, filp,
index, last_index - index);
page = find_get_page(mapping, index);
if (unlikely(page == NULL))
goto no_cached_page;
}
if (PageReadahead(page)) {
<API key>(mapping,
ra, filp, page,
index, last_index - index);
}
if (!PageUptodate(page)) {
if (inode->i_blkbits == PAGE_CACHE_SHIFT ||
!mapping->a_ops-><API key>)
goto page_not_up_to_date;
if (!trylock_page(page))
goto page_not_up_to_date;
/* Did it get truncated before we got the lock? */
if (!page->mapping)
goto <API key>;
if (!mapping->a_ops-><API key>(page,
desc, offset))
goto <API key>;
unlock_page(page);
}
page_ok:
/*
* i_size must be checked after we know the page is Uptodate.
*
* Checking i_size after the check allows us to calculate
* the correct value for "nr", which means the zero-filled
* part of the page is not copied back to userspace (unless
* another truncate extends the file - this is desired though).
*/
isize = i_size_read(inode);
end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
if (unlikely(!isize || index > end_index)) {
page_cache_release(page);
goto out;
}
/* nr is the maximum number of bytes to copy from this page */
nr = PAGE_CACHE_SIZE;
if (index == end_index) {
nr = ((isize - 1) & ~PAGE_CACHE_MASK) + 1;
if (nr <= offset) {
page_cache_release(page);
goto out;
}
}
nr = nr - offset;
/* If users can be writing to this page using arbitrary
* virtual addresses, take care about potential aliasing
* before reading the page on the kernel side.
*/
if (<API key>(mapping))
flush_dcache_page(page);
/*
* When a sequential read accesses a page several times,
* only mark it as accessed the first time.
*/
if (prev_index != index || offset != prev_offset)
mark_page_accessed(page);
prev_index = index;
/*
* Ok, we have the page, and it's up-to-date, so
* now we can copy it to user space...
*
* The actor routine returns how many bytes were actually used..
* NOTE! This may not be the same as how much of a user buffer
* we filled up (we may be padding etc), so we can only update
* "pos" here (the actor routine has to update the user buffer
* pointers and the remaining count).
*/
ret = actor(desc, page, offset, nr);
offset += ret;
index += offset >> PAGE_CACHE_SHIFT;
offset &= ~PAGE_CACHE_MASK;
prev_offset = offset;
page_cache_release(page);
if (ret == nr && desc->count)
continue;
goto out;
page_not_up_to_date:
/* Get exclusive access to the page ... */
error = lock_page_killable(page);
if (unlikely(error))
goto readpage_error;
<API key>:
/* Did it get truncated before we got the lock? */
if (!page->mapping) {
unlock_page(page);
page_cache_release(page);
continue;
}
/* Did somebody else fill it already? */
if (PageUptodate(page)) {
unlock_page(page);
goto page_ok;
}
readpage:
/*
* A previous I/O error may have been due to temporary
* failures, eg. multipath errors.
* PG_error will be set again if readpage fails.
*/
ClearPageError(page);
/* Start the actual read. The read will unlock the page. */
error = mapping->a_ops->readpage(filp, page);
if (unlikely(error)) {
if (error == AOP_TRUNCATED_PAGE) {
page_cache_release(page);
goto find_page;
}
goto readpage_error;
}
if (!PageUptodate(page)) {
error = lock_page_killable(page);
if (unlikely(error))
goto readpage_error;
if (!PageUptodate(page)) {
if (page->mapping == NULL) {
/*
* <API key> got it
*/
unlock_page(page);
page_cache_release(page);
goto find_page;
}
unlock_page(page);
<API key>(filp, ra);
error = -EIO;
goto readpage_error;
}
unlock_page(page);
}
goto page_ok;
readpage_error:
/* UHHUH! A synchronous read error occurred. Report it */
desc->error = error;
page_cache_release(page);
goto out;
no_cached_page:
/*
* Ok, it wasn't cached, so we need to create a new
* page..
*/
page = <API key>(mapping);
if (!page) {
desc->error = -ENOMEM;
goto out;
}
error = <API key>(page, mapping,
index, GFP_KERNEL);
if (error) {
page_cache_release(page);
if (error == -EEXIST)
goto find_page;
desc->error = error;
goto out;
}
goto readpage;
}
out:
ra->prev_pos = prev_index;
ra->prev_pos <<= PAGE_CACHE_SHIFT;
ra->prev_pos |= prev_offset;
*ppos = ((loff_t)index << PAGE_CACHE_SHIFT) + offset;
file_accessed(filp);
}
/*
* Performs necessary checks before doing a write
* @iov: io vector request
* @nr_segs: number of segments in the iovec
* @count: number of bytes to write
* @access_flags: type of access: %VERIFY_READ or %VERIFY_WRITE
*
* Adjust number of segments and amount of bytes to write (nr_segs should be
* properly initialized first). Returns appropriate error code that caller
* should return or zero in case that write should be allowed.
*/
int <API key>(const struct iovec *iov,
unsigned long *nr_segs, size_t *count, int access_flags)
{
unsigned long seg;
size_t cnt = 0;
for (seg = 0; seg < *nr_segs; seg++) {
const struct iovec *iv = &iov[seg];
/*
* If any segment has a negative length, or the cumulative
* length ever wraps negative then return -EINVAL.
*/
cnt += iv->iov_len;
if (unlikely((ssize_t)(cnt|iv->iov_len) < 0))
return -EINVAL;
if (access_ok(access_flags, iv->iov_base, iv->iov_len))
continue;
if (seg == 0)
return -EFAULT;
*nr_segs = seg;
cnt -= iv->iov_len; /* This segment is no good */
break;
}
*count = cnt;
return 0;
}
EXPORT_SYMBOL(<API key>);
int <API key>(read_descriptor_t *desc, struct page *page,
unsigned long offset, unsigned long size)
{
struct iov_iter *iter = desc->arg.data;
unsigned long copied = 0;
if (size > desc->count)
size = desc->count;
copied = <API key>(page, iter, offset, size);
if (copied < size)
desc->error = -EFAULT;
iov_iter_advance(iter, copied);
desc->count -= copied;
desc->written += copied;
return copied;
}
/**
* <API key> - generic filesystem read routine
* @iocb: kernel I/O control block
* @iov_iter: memory vector
* @pos: current file position
*/
ssize_t
<API key>(struct kiocb *iocb, struct iov_iter *iter, loff_t pos)
{
struct file *filp = iocb->ki_filp;
read_descriptor_t desc;
ssize_t retval = 0;
size_t count = iov_iter_count(iter);
loff_t *ppos = &iocb->ki_pos;
/* coalesce the iovecs and go direct-to-BIO for O_DIRECT */
if (filp->f_flags & O_DIRECT) {
loff_t size;
struct address_space *mapping;
struct inode *inode;
mapping = filp->f_mapping;
inode = mapping->host;
if (!count)
goto out; /* skip atime */
size = i_size_read(inode);
if (pos < size) {
retval = <API key>(mapping, pos,
pos + count - 1);
if (!retval) {
struct blk_plug plug;
blk_start_plug(&plug);
retval = mapping->a_ops->direct_IO(READ, iocb,
iter, pos);
blk_finish_plug(&plug);
}
if (retval > 0) {
*ppos = pos + retval;
count -= retval;
}
/*
* Btrfs can have a short DIO read if we encounter
* compressed extents, so if there was an error, or if
* we've already read everything we wanted to, or if
* there was a short read because we hit EOF, go ahead
* and return. Otherwise fallthrough to buffered io for
* the rest of the read.
*/
if (retval < 0 || !count || *ppos >= size) {
file_accessed(filp);
goto out;
}
}
}
desc.written = 0;
desc.arg.data = iter;
desc.count = count;
desc.error = 0;
<API key>(filp, ppos, &desc, <API key>);
if (desc.written)
retval = desc.written;
else
retval = desc.error;
out:
return retval;
}
EXPORT_SYMBOL(<API key>);
/**
* <API key> - generic filesystem read routine
* @iocb: kernel I/O control block
* @iov: io vector request
* @nr_segs: number of segments in the iovec
* @pos: current file position
*
* This is the "read()" routine for all filesystems
* that can use the page cache directly.
*/
ssize_t
<API key>(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
struct iov_iter iter;
int ret;
size_t count;
count = 0;
ret = <API key>(iov, &nr_segs, &count, VERIFY_WRITE);
if (ret)
return ret;
iov_iter_init(&iter, iov, nr_segs, count, 0);
return <API key>(iocb, &iter, pos);
}
EXPORT_SYMBOL(<API key>);
#ifdef CONFIG_MMU
/**
* page_cache_read - adds requested page to the page cache if not already there
* @file: file to read
* @offset: page index
*
* This adds the requested page to the page cache if it isn't already there,
* and schedules an I/O to read in its contents from disk.
*/
static int page_cache_read(struct file *file, pgoff_t offset)
{
struct address_space *mapping = file->f_mapping;
struct page *page;
int ret;
do {
page = <API key>(mapping);
if (!page)
return -ENOMEM;
ret = <API key>(page, mapping, offset, GFP_KERNEL);
if (ret == 0)
ret = mapping->a_ops->readpage(file, page);
else if (ret == -EEXIST)
ret = 0; /* losing race to add is OK */
page_cache_release(page);
} while (ret == AOP_TRUNCATED_PAGE);
return ret;
}
#define MMAP_LOTSAMISS (100)
/*
* Synchronous readahead happens when we don't even find
* a page in the page cache at all.
*/
static void <API key>(struct vm_area_struct *vma,
struct file_ra_state *ra,
struct file *file,
pgoff_t offset)
{
unsigned long ra_pages;
struct address_space *mapping = file->f_mapping;
/* If we don't want any read-ahead, don't bother */
if (VM_RandomReadHint(vma))
return;
if (!ra->ra_pages)
return;
if (<API key>(vma)) {
<API key>(mapping, ra, file, offset,
ra->ra_pages);
return;
}
/* Avoid banging the cache line if not needed */
if (ra->mmap_miss < MMAP_LOTSAMISS * 10)
ra->mmap_miss++;
/*
* Do we miss much more than hit in this file? If so,
* stop bothering with read-ahead. It will only hurt.
*/
if (ra->mmap_miss > MMAP_LOTSAMISS)
return;
/*
* mmap read-around
*/
ra_pages = max_sane_readahead(ra->ra_pages);
ra->start = max_t(long, 0, offset - ra_pages / 2);
ra->size = ra_pages;
ra->async_size = ra_pages / 4;
ra_submit(ra, mapping, file);
}
/*
* Asynchronous readahead happens when we find the page and PG_readahead,
* so we want to possibly extend the readahead further..
*/
static void <API key>(struct vm_area_struct *vma,
struct file_ra_state *ra,
struct file *file,
struct page *page,
pgoff_t offset)
{
struct address_space *mapping = file->f_mapping;
/* If we don't want any read-ahead, don't bother */
if (VM_RandomReadHint(vma))
return;
if (ra->mmap_miss > 0)
ra->mmap_miss
if (PageReadahead(page))
<API key>(mapping, ra, file,
page, offset, ra->ra_pages);
}
/**
* filemap_fault - read in file data for page fault handling
* @vma: vma in which the fault was taken
* @vmf: struct vm_fault containing details of the fault
*
* filemap_fault() is invoked via the vma operations vector for a
* mapped memory region to read in file data during a page fault.
*
* The goto's are kind of ugly, but this streamlines the normal case of having
* it in the page cache, and handles the special cases reasonably without
* having a lot of duplicated code.
*/
int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
{
int error;
struct file *file = vma->vm_file;
struct address_space *mapping = file->f_mapping;
struct file_ra_state *ra = &file->f_ra;
struct inode *inode = mapping->host;
pgoff_t offset = vmf->pgoff;
struct page *page;
pgoff_t size;
int ret = 0;
size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
if (offset >= size)
return VM_FAULT_SIGBUS;
/*
* Do we have something in the page cache already?
*/
page = find_get_page(mapping, offset);
if (likely(page)) {
/*
* We found the page, so try async readahead before
* waiting for the lock.
*/
<API key>(vma, ra, file, page, offset);
} else {
/* No page in the page cache at all */
<API key>(vma, ra, file, offset);
count_vm_event(PGMAJFAULT);
sreadahead_prof(file, 0, 0);
<API key>(vma->vm_mm, PGMAJFAULT);
ret = VM_FAULT_MAJOR;
retry_find:
page = find_get_page(mapping, offset);
if (!page)
goto no_cached_page;
}
if (!lock_page_or_retry(page, vma->vm_mm, vmf->flags)) {
page_cache_release(page);
return ret | VM_FAULT_RETRY;
}
/* Did it get truncated? */
if (unlikely(page->mapping != mapping)) {
unlock_page(page);
put_page(page);
goto retry_find;
}
VM_BUG_ON(page->index != offset);
/*
* We have a locked page in the page cache, now we need to check
* that it's up-to-date. If not, it is going to be due to an error.
*/
if (unlikely(!PageUptodate(page)))
goto page_not_uptodate;
/*
* Found the page and have a reference on it.
* We must recheck i_size under page lock.
*/
size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
if (unlikely(offset >= size)) {
unlock_page(page);
page_cache_release(page);
return VM_FAULT_SIGBUS;
}
vmf->page = page;
return ret | VM_FAULT_LOCKED;
no_cached_page:
/*
* We're only likely to ever get here if MADV_RANDOM is in
* effect.
*/
error = page_cache_read(file, offset);
/*
* The page we want has now been added to the page cache.
* In the unlikely event that someone removed it in the
* meantime, we'll just come back here and read it again.
*/
if (error >= 0)
goto retry_find;
/*
* An error return from page_cache_read can result if the
* system is low on memory, or a problem occurs while trying
* to schedule I/O.
*/
if (error == -ENOMEM)
return VM_FAULT_OOM;
return VM_FAULT_SIGBUS;
page_not_uptodate:
/*
* Umm, take care of errors if the page isn't up-to-date.
* Try to re-read it _once_. We do this synchronously,
* because there really aren't any performance issues here
* and we need to check for errors.
*/
ClearPageError(page);
error = mapping->a_ops->readpage(file, page);
if (!error) {
wait_on_page_locked(page);
if (!PageUptodate(page))
error = -EIO;
}
page_cache_release(page);
if (!error || error == AOP_TRUNCATED_PAGE)
goto retry_find;
/* Things didn't work out. Return zero to tell the mm layer so. */
<API key>(file, ra);
return VM_FAULT_SIGBUS;
}
EXPORT_SYMBOL(filemap_fault);
int <API key>(struct vm_area_struct *vma, struct vm_fault *vmf)
{
struct page *page = vmf->page;
struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
int ret = VM_FAULT_LOCKED;
sb_start_pagefault(inode->i_sb);
file_update_time(vma->vm_file);
lock_page(page);
if (page->mapping != inode->i_mapping) {
unlock_page(page);
ret = VM_FAULT_NOPAGE;
goto out;
}
/*
* We mark the page dirty already here so that when freeze is in
* progress, we are guaranteed that writeback during freezing will
* see the dirty page and writeprotect it again.
*/
set_page_dirty(page);
out:
sb_end_pagefault(inode->i_sb);
return ret;
}
EXPORT_SYMBOL(<API key>);
const struct <API key> generic_file_vm_ops = {
.fault = filemap_fault,
.page_mkwrite = <API key>,
};
/* This is used for a general mmap of a disk file */
int generic_file_mmap(struct file * file, struct vm_area_struct * vma)
{
struct address_space *mapping = file->f_mapping;
if (!mapping->a_ops->readpage)
return -ENOEXEC;
file_accessed(file);
vma->vm_ops = &generic_file_vm_ops;
vma->vm_flags |= VM_CAN_NONLINEAR;
return 0;
}
/*
* This is for filesystems which do not implement ->writepage.
*/
int <API key>(struct file *file, struct vm_area_struct *vma)
{
if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_MAYWRITE))
return -EINVAL;
return generic_file_mmap(file, vma);
}
#else
int generic_file_mmap(struct file * file, struct vm_area_struct * vma)
{
return -ENOSYS;
}
int <API key>(struct file * file, struct vm_area_struct * vma)
{
return -ENOSYS;
}
#endif /* CONFIG_MMU */
EXPORT_SYMBOL(generic_file_mmap);
EXPORT_SYMBOL(<API key>);
static struct page *__read_cache_page(struct address_space *mapping,
pgoff_t index,
int (*filler)(void *, struct page *),
void *data,
gfp_t gfp)
{
struct page *page;
int err;
repeat:
page = find_get_page(mapping, index);
if (!page) {
page = __page_cache_alloc(gfp | __GFP_COLD);
if (!page)
return ERR_PTR(-ENOMEM);
err = <API key>(page, mapping, index, gfp);
if (unlikely(err)) {
page_cache_release(page);
if (err == -EEXIST)
goto repeat;
/* Presumably ENOMEM for radix tree node */
return ERR_PTR(err);
}
err = filler(data, page);
if (err < 0) {
page_cache_release(page);
page = ERR_PTR(err);
}
}
return page;
}
static struct page *do_read_cache_page(struct address_space *mapping,
pgoff_t index,
int (*filler)(void *, struct page *),
void *data,
gfp_t gfp)
{
struct page *page;
int err;
retry:
page = __read_cache_page(mapping, index, filler, data, gfp);
if (IS_ERR(page))
return page;
if (PageUptodate(page))
goto out;
lock_page(page);
if (!page->mapping) {
unlock_page(page);
page_cache_release(page);
goto retry;
}
if (PageUptodate(page)) {
unlock_page(page);
goto out;
}
err = filler(data, page);
if (err < 0) {
page_cache_release(page);
return ERR_PTR(err);
}
out:
mark_page_accessed(page);
return page;
}
/**
* <API key> - read into page cache, fill it if needed
* @mapping: the page's address_space
* @index: the page index
* @filler: function to perform the read
* @data: first arg to filler(data, page) function, often left as NULL
*
* Same as read_cache_page, but don't wait for page to become unlocked
* after submitting it to the filler.
*
* Read into the page cache. If a page already exists, and PageUptodate() is
* not set, try to fill the page but don't wait for it to become unlocked.
*
* If the page does not get brought uptodate, return -EIO.
*/
struct page *<API key>(struct address_space *mapping,
pgoff_t index,
int (*filler)(void *, struct page *),
void *data)
{
return do_read_cache_page(mapping, index, filler, data, mapping_gfp_mask(mapping));
}
EXPORT_SYMBOL(<API key>);
static struct page *wait_on_page_read(struct page *page)
{
if (!IS_ERR(page)) {
wait_on_page_locked(page);
if (!PageUptodate(page)) {
page_cache_release(page);
page = ERR_PTR(-EIO);
}
}
return page;
}
/**
* read_cache_page_gfp - read into page cache, using specified page allocation flags.
* @mapping: the page's address_space
* @index: the page index
* @gfp: the page allocator flags to use if allocating
*
* This is the same as "read_mapping_page(mapping, index, NULL)", but with
* any new page allocations done using the specified allocation flags.
*
* If the page does not get brought uptodate, return -EIO.
*/
struct page *read_cache_page_gfp(struct address_space *mapping,
pgoff_t index,
gfp_t gfp)
{
filler_t *filler = (filler_t *)mapping->a_ops->readpage;
return wait_on_page_read(do_read_cache_page(mapping, index, filler, NULL, gfp));
}
EXPORT_SYMBOL(read_cache_page_gfp);
/**
* read_cache_page - read into page cache, fill it if needed
* @mapping: the page's address_space
* @index: the page index
* @filler: function to perform the read
* @data: first arg to filler(data, page) function, often left as NULL
*
* Read into the page cache. If a page already exists, and PageUptodate() is
* not set, try to fill the page then wait for it to become unlocked.
*
* If the page does not get brought uptodate, return -EIO.
*/
struct page *read_cache_page(struct address_space *mapping,
pgoff_t index,
int (*filler)(void *, struct page *),
void *data)
{
return wait_on_page_read(<API key>(mapping, index, filler, data));
}
EXPORT_SYMBOL(read_cache_page);
/*
* The logic we want is
*
* if suid or (sgid and xgrp)
* remove privs
*/
int should_remove_suid(struct dentry *dentry)
{
umode_t mode = dentry->d_inode->i_mode;
int kill = 0;
/* suid always must be killed */
if (unlikely(mode & S_ISUID))
kill = ATTR_KILL_SUID;
/*
* sgid without any exec bits is just a mandatory locking mark; leave
* it alone. If some exec bits are set, it's a real sgid; kill it.
*/
if (unlikely((mode & S_ISGID) && (mode & S_IXGRP)))
kill |= ATTR_KILL_SGID;
if (unlikely(kill && !capable(CAP_FSETID) && S_ISREG(mode)))
return kill;
return 0;
}
EXPORT_SYMBOL(should_remove_suid);
static int __remove_suid(struct dentry *dentry, int kill)
{
struct iattr newattrs;
newattrs.ia_valid = ATTR_FORCE | kill;
return notify_change(dentry, &newattrs);
}
int file_remove_suid(struct file *file)
{
struct dentry *dentry = file->f_path.dentry;
struct inode *inode = dentry->d_inode;
int killsuid;
int killpriv;
int error = 0;
/* Fast path for nothing security related */
if (IS_NOSEC(inode))
return 0;
killsuid = should_remove_suid(dentry);
killpriv = <API key>(dentry);
if (killpriv < 0)
return killpriv;
if (killpriv)
error = <API key>(dentry);
if (!error && killsuid)
error = __remove_suid(dentry, killsuid);
if (!error && (inode->i_sb->s_flags & MS_NOSEC))
inode->i_flags |= S_NOSEC;
return error;
}
EXPORT_SYMBOL(file_remove_suid);
/*
* Performs necessary checks before doing a write
*
* Can adjust writing position or amount of bytes to write.
* Returns appropriate error code that caller should return or
* zero in case that write should be allowed.
*/
inline int <API key>(struct file *file, loff_t *pos, size_t *count, int isblk)
{
struct inode *inode = file->f_mapping->host;
unsigned long limit = rlimit(RLIMIT_FSIZE);
if (unlikely(*pos < 0))
return -EINVAL;
if (!isblk) {
/* FIXME: this is for backwards compatibility with 2.4 */
if (file->f_flags & O_APPEND)
*pos = i_size_read(inode);
if (limit != RLIM_INFINITY) {
if (*pos >= limit) {
send_sig(SIGXFSZ, current, 0);
return -EFBIG;
}
if (*count > limit - (typeof(limit))*pos) {
*count = limit - (typeof(limit))*pos;
}
}
}
/*
* LFS rule
*/
if (unlikely(*pos + *count > MAX_NON_LFS &&
!(file->f_flags & O_LARGEFILE))) {
if (*pos >= MAX_NON_LFS) {
return -EFBIG;
}
if (*count > MAX_NON_LFS - (unsigned long)*pos) {
*count = MAX_NON_LFS - (unsigned long)*pos;
}
}
/*
* Are we about to exceed the fs block limit ?
*
* If we have written data it becomes a short write. If we have
* exceeded without writing data we send a signal and return EFBIG.
* Linus frestrict idea will clean these up nicely..
*/
if (likely(!isblk)) {
if (unlikely(*pos >= inode->i_sb->s_maxbytes)) {
if (*count || *pos > inode->i_sb->s_maxbytes) {
return -EFBIG;
}
/* zero-length writes at ->s_maxbytes are OK */
}
if (unlikely(*pos + *count > inode->i_sb->s_maxbytes))
*count = inode->i_sb->s_maxbytes - *pos;
} else {
#ifdef CONFIG_BLOCK
loff_t isize;
if (bdev_read_only(I_BDEV(inode)))
return -EPERM;
isize = i_size_read(inode);
if (*pos >= isize) {
if (*count || *pos > isize)
return -ENOSPC;
}
if (*pos + *count > isize)
*count = isize - *pos;
#else
return -EPERM;
#endif
}
return 0;
}
EXPORT_SYMBOL(<API key>);
int <API key>(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned flags,
struct page **pagep, void **fsdata)
{
const struct <API key> *aops = mapping->a_ops;
return aops->write_begin(file, mapping, pos, len, flags,
pagep, fsdata);
}
EXPORT_SYMBOL(<API key>);
int pagecache_write_end(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned copied,
struct page *page, void *fsdata)
{
const struct <API key> *aops = mapping->a_ops;
mark_page_accessed(page);
return aops->write_end(file, mapping, pos, len, copied, page, fsdata);
}
EXPORT_SYMBOL(pagecache_write_end);
ssize_t
<API key>(struct kiocb *iocb, struct iov_iter *iter,
loff_t pos, loff_t *ppos, size_t count)
{
struct file *file = iocb->ki_filp;
struct address_space *mapping = file->f_mapping;
struct inode *inode = mapping->host;
ssize_t written;
size_t write_len;
pgoff_t end;
if (count != iov_iter_count(iter)) {
written = iov_iter_shorten(iter, count);
if (written)
goto out;
}
write_len = count;
end = (pos + write_len - 1) >> PAGE_CACHE_SHIFT;
written = <API key>(mapping, pos, pos + write_len - 1);
if (written)
goto out;
/*
* After a write we want buffered reads to be sure to go to disk to get
* the new data. We invalidate clean cached page from the region we're
* about to write. We do this *before* the write so that we can return
* without clobbering -EIOCBQUEUED from ->direct_IO().
*/
if (mapping->nrpages) {
written = <API key>(mapping,
pos >> PAGE_CACHE_SHIFT, end);
/*
* If a page can not be invalidated, return 0 to fall back
* to buffered write.
*/
if (written) {
if (written == -EBUSY)
return 0;
goto out;
}
}
written = mapping->a_ops->direct_IO(WRITE, iocb, iter, pos);
/*
* Finally, try again to invalidate clean pages which might have been
* cached by non-direct readahead, or faulted in by get_user_pages()
* if the source of the write was an mmap'ed region of the file
* we're writing. Either one is a pretty crazy thing to do,
* so we don't support it 100%. If this invalidation
* fails, tough, the write still worked...
*/
if (mapping->nrpages) {
<API key>(mapping,
pos >> PAGE_CACHE_SHIFT, end);
}
if (written > 0) {
pos += written;
if (pos > i_size_read(inode) && !S_ISBLK(inode->i_mode)) {
i_size_write(inode, pos);
mark_inode_dirty(inode);
}
*ppos = pos;
}
out:
return written;
}
EXPORT_SYMBOL(<API key>);
ssize_t
<API key>(struct kiocb *iocb, const struct iovec *iov,
unsigned long *nr_segs, loff_t pos, loff_t *ppos,
size_t count, size_t ocount)
{
struct iov_iter iter;
ssize_t ret;
iov_iter_init(&iter, iov, *nr_segs, ocount, 0);
ret = <API key>(iocb, &iter, pos, ppos, count);
/* <API key>() might have shortened the vec */
if (*nr_segs != iter.nr_segs)
*nr_segs = iter.nr_segs;
return ret;
}
EXPORT_SYMBOL(<API key>);
/*
* Find or create a page at the given pagecache position. Return the locked
* page. This function is specifically for buffered writes.
*/
struct page *<API key>(struct address_space *mapping,
pgoff_t index, unsigned flags)
{
int status;
gfp_t gfp_mask;
struct page *page;
gfp_t gfp_notmask = 0;
gfp_mask = mapping_gfp_mask(mapping);
if (<API key>(mapping))
gfp_mask |= __GFP_WRITE;
if (flags & AOP_FLAG_NOFS)
gfp_notmask = __GFP_FS;
repeat:
page = find_lock_page(mapping, index);
if (page)
goto found;
retry:
page = __page_cache_alloc(gfp_mask & ~gfp_notmask);
if (!page)
return NULL;
if (is_cma_pageblock(page)) {
__free_page(page);
gfp_notmask |= __GFP_MOVABLE;
goto retry;
}
status = <API key>(page, mapping, index,
GFP_KERNEL & ~gfp_notmask);
if (unlikely(status)) {
page_cache_release(page);
if (status == -EEXIST)
goto repeat;
return NULL;
}
found:
<API key>(page);
return page;
}
EXPORT_SYMBOL(<API key>);
static ssize_t <API key>(struct file *file,
struct iov_iter *i, loff_t pos)
{
struct address_space *mapping = file->f_mapping;
const struct <API key> *a_ops = mapping->a_ops;
long status = 0;
ssize_t written = 0;
unsigned int flags = 0;
/*
* Copies from kernel address space cannot fail (NFSD is a big user).
*/
if (segment_eq(get_fs(), KERNEL_DS))
flags |= <API key>;
do {
struct page *page;
unsigned long offset; /* Offset into pagecache page */
unsigned long bytes; /* Bytes to write to page */
size_t copied; /* Bytes copied from user */
void *fsdata;
offset = (pos & (PAGE_CACHE_SIZE - 1));
bytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset,
iov_iter_count(i));
again:
/*
* Bring in the user page that we will copy from _first_.
* Otherwise there's a nasty deadlock on copying from the
* same page as we're writing to, without it being marked
* up-to-date.
*
* Not only is this an optimisation, but it is also required
* to check that the address is actually valid, when atomic
* usercopies are used, below.
*/
if (unlikely(<API key>(i, bytes))) {
status = -EFAULT;
break;
}
status = a_ops->write_begin(file, mapping, pos, bytes, flags,
&page, &fsdata);
if (unlikely(status))
break;
if (<API key>(mapping))
flush_dcache_page(page);
pagefault_disable();
copied = <API key>(page, i, offset, bytes);
pagefault_enable();
flush_dcache_page(page);
mark_page_accessed(page);
status = a_ops->write_end(file, mapping, pos, bytes, copied,
page, fsdata);
if (unlikely(status < 0))
break;
copied = status;
cond_resched();
iov_iter_advance(i, copied);
if (unlikely(copied == 0)) {
/*
* If we were unable to copy any data at all, we must
* fall back to a single segment length write.
*
* If we didn't fallback here, we could livelock
* because not all segments in the iov can be copied at
* once without a pagefault.
*/
bytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset,
<API key>(i));
goto again;
}
pos += copied;
written += copied;
<API key>(mapping);
if (<API key>(current)) {
status = -EINTR;
break;
}
} while (iov_iter_count(i));
return written ? written : status;
}
ssize_t
<API key>(struct kiocb *iocb, struct iov_iter *iter,
loff_t pos, loff_t *ppos, size_t count, ssize_t written)
{
struct file *file = iocb->ki_filp;
ssize_t status;
if ((count + written) != iov_iter_count(iter)) {
int rc = iov_iter_shorten(iter, count + written);
if (rc)
return rc;
}
status = <API key>(file, iter, pos);
if (likely(status >= 0)) {
written += status;
*ppos = pos + status;
}
return written ? written : status;
}
EXPORT_SYMBOL(<API key>);
ssize_t
<API key>(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos, loff_t *ppos,
size_t count, ssize_t written)
{
struct iov_iter iter;
iov_iter_init(&iter, iov, nr_segs, count, written);
return <API key>(iocb, &iter, pos, ppos,
count, written);
}
EXPORT_SYMBOL(<API key>);
/**
* <API key> - write data to a file
* @iocb: IO state structure (file, offset, etc.)
* @iter: iov_iter specifying memory to write
* @ppos: position where to write
*
* This function does all the work needed for actually writing data to a
* file. It does all basic checks, removes SUID from the file, updates
* modification times and calls proper subroutines depending on whether we
* do direct IO or a standard buffered write.
*
* It expects i_mutex to be grabbed unless we work on a block device or similar
* object which does not need locking at all.
*
* This function does *not* take care of syncing data in case of O_SYNC write.
* A caller has to handle it. This is mainly due to the fact that we want to
* avoid syncing under i_mutex.
*/
ssize_t <API key>(struct kiocb *iocb, struct iov_iter *iter,
loff_t *ppos)
{
struct file *file = iocb->ki_filp;
struct address_space * mapping = file->f_mapping;
size_t count; /* after file limit checks */
struct inode *inode = mapping->host;
loff_t pos;
ssize_t written;
ssize_t err;
count = iov_iter_count(iter);
pos = *ppos;
/* We can write back this queue in page reclaim */
current->backing_dev_info = mapping->backing_dev_info;
written = 0;
err = <API key>(file, &pos, &count, S_ISBLK(inode->i_mode));
if (err)
goto out;
if (count == 0)
goto out;
err = file_remove_suid(file);
if (err)
goto out;
err = file_update_time(file);
if (err)
goto out;
/* coalesce the iovecs and go direct-to-BIO for O_DIRECT */
if (unlikely(file->f_flags & O_DIRECT)) {
loff_t endbyte;
ssize_t written_buffered;
written = <API key>(iocb, iter, pos,
ppos, count);
if (written < 0 || written == count)
goto out;
/*
* direct-io write to a hole: fall through to buffered I/O
* for completing the rest of the request.
*/
pos += written;
count -= written;
iov_iter_advance(iter, written);
written_buffered = <API key>(iocb, iter,
pos, ppos, count, written);
/*
* If <API key>() retuned a synchronous error
* then we want to return the number of bytes which were
* direct-written, or the error code if that was zero. Note
* that this differs from normal direct-io semantics, which
* will return -EFOO even if some bytes were written.
*/
if (written_buffered < 0) {
err = written_buffered;
goto out;
}
/*
* We need to ensure that the page cache pages are written to
* disk and invalidated to preserve the expected O_DIRECT
* semantics.
*/
endbyte = pos + written_buffered - written - 1;
err = <API key>(file->f_mapping, pos, endbyte);
if (err == 0) {
written = written_buffered;
<API key>(mapping,
pos >> PAGE_CACHE_SHIFT,
endbyte >> PAGE_CACHE_SHIFT);
} else {
/*
* We don't know how much we wrote, so just return
* the number of bytes which were direct-written
*/
}
} else {
iter->count = count;
written = <API key>(iocb, iter,
pos, ppos, count, written);
}
out:
current->backing_dev_info = NULL;
return written ? written : err;
}
EXPORT_SYMBOL(<API key>);
ssize_t <API key>(struct kiocb *iocb, struct iov_iter *iter,
loff_t pos)
{
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host;
ssize_t ret;
mutex_lock(&inode->i_mutex);
ret = <API key>(iocb, iter, &iocb->ki_pos);
mutex_unlock(&inode->i_mutex);
if (ret > 0 || ret == -EIOCBQUEUED) {
ssize_t err;
err = generic_write_sync(file, pos, ret);
if (err < 0 && ret > 0)
ret = err;
}
return ret;
}
EXPORT_SYMBOL(<API key>);
ssize_t
<API key>(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t *ppos)
{
struct iov_iter iter;
size_t count;
int ret;
count = 0;
ret = <API key>(iov, &nr_segs, &count, VERIFY_READ);
if (ret)
goto out;
iov_iter_init(&iter, iov, nr_segs, count, 0);
ret = <API key>(iocb, &iter, ppos);
out:
return ret;
}
EXPORT_SYMBOL(<API key>);
/**
* <API key> - write data to a file
* @iocb: IO state structure
* @iov: vector with data to write
* @nr_segs: number of segments in the vector
* @pos: position in file where to write
*
* This is a wrapper around <API key>() to be used by most
* filesystems. It takes care of syncing the file in case of O_SYNC file
* and acquires i_mutex as needed.
*/
ssize_t <API key>(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host;
struct blk_plug plug;
ssize_t ret;
BUG_ON(iocb->ki_pos != pos);
sb_start_write(inode->i_sb);
mutex_lock(&inode->i_mutex);
blk_start_plug(&plug);
ret = <API key>(iocb, iov, nr_segs, &iocb->ki_pos);
mutex_unlock(&inode->i_mutex);
if (ret > 0 || ret == -EIOCBQUEUED) {
ssize_t err;
err = generic_write_sync(file, pos, ret);
if (err < 0 && ret > 0)
ret = err;
}
blk_finish_plug(&plug);
sb_end_write(inode->i_sb);
return ret;
}
EXPORT_SYMBOL(<API key>);
/**
* try_to_release_page() - release old fs-specific metadata on a page
*
* @page: the page which the kernel is trying to free
* @gfp_mask: memory allocation flags (and I/O mode)
*
* The address_space is to try to release any data against the page
* (presumably at page->private). If the release was successful, return `1'.
* Otherwise return zero.
*
* This may also be called if PG_fscache is set on a page, indicating that the
* page is known to the local caching routines.
*
* The @gfp_mask argument specifies whether I/O may be performed to release
* this page (__GFP_IO), and whether the call may block (__GFP_WAIT & __GFP_FS).
*
*/
int try_to_release_page(struct page *page, gfp_t gfp_mask)
{
struct address_space * const mapping = page->mapping;
BUG_ON(!PageLocked(page));
if (PageWriteback(page))
return 0;
if (mapping && mapping->a_ops->releasepage)
return mapping->a_ops->releasepage(page, gfp_mask);
return try_to_free_buffers(page);
}
EXPORT_SYMBOL(try_to_release_page);
|
#ifndef <API key>
#define <API key>
/* linkage.h ... for including arch/x86/lib/memcpy_64.S */
#define ENTRY(name) \
.globl name; \
name:
#define ENDPROC(name)
#endif /* <API key> */
|
#pragma once
#include <Nena\Window.h>
#include <Nena\StepTimer.h>
#include <Nena\DeviceResources.h>
#include <Nena\RenderTargetOverlay.h>
#include "TextRenderer.h"
namespace Framework
{
namespace Application
{
void Start();
void Stop();
struct Window;
struct Dispatcher
{
Framework::Application::Window *Host;
Framework::Application::Dispatcher::Dispatcher(
Framework::Application::Window *host
);
LRESULT Framework::Application::Dispatcher::Process(
_In_::HWND hwnd,
_In_::UINT umsg,
_In_::WPARAM wparam,
_In_::LPARAM lparam
);
};
struct WindowDeviceNotify : Nena::Graphics::IDeviceNotify
{
Framework::Application::Window *Host;
Framework::Application::WindowDeviceNotify::WindowDeviceNotify(Framework::Application::Window *host);
virtual void OnDeviceLost() override;
virtual void OnDeviceRestored() override;
};
struct Window : Nena::Application::Window
{
friend WindowDeviceNotify;
Framework::Application::Window::Window();
::BOOL Framework::Application::Window::Update();
LRESULT Framework::Application::Window::<API key>(_In_ ::INT16 x, _In_ ::INT16 y);
LRESULT Framework::Application::Window::<API key>(_In_ ::INT16 x, _In_ ::INT16 y);
LRESULT Framework::Application::Window::<API key>(_In_ ::INT16 x, _In_ ::INT16 y);
LRESULT Framework::Application::Window::<API key>(_In_::INT16 x, _In_::INT16 y);
LRESULT Framework::Application::Window::OnMouseMoved(_In_::INT16 x, _In_::INT16 y);
LRESULT Framework::Application::Window::OnKeyPressed(::UINT16 virtualKey);
LRESULT Framework::Application::Window::OnResized();
static Framework::Application::Window *Framework::Application::Window::GetForCurrentThread();
Nena::Graphics::OverlayResources Overlay;
Nena::Graphics::DeviceResources Graphics;
Nena::Simulation::StepTimer Timer;
TextRenderer Renderer;
WindowDeviceNotify DeviceNotify;
Dispatcher EventHandler;
};
}
}
|
#include "Card.h"
#include "Game.h"
#include <iostream>
#include <array>
#include <string>
#include <vector>
#include <algorithm>
#include <random>
#include <cstdlib>
#include <ctime>
using namespace std;
using namespace zks::game::card;
int test_deck() {
CardDeck deck(1);
CardDeck d1, d2;
deck.shuffle();
cout << "deck: " << deck.str() << endl;
cout << "d1: " << d1.str() << endl;
cout << "d2: " << d2.str() << endl;
cout << "\nget from back:\n";
for (auto i = 0; i<10; ++i) {
d1.put_card(deck.get_card());
cout << d1.str() << endl;
}
cout << "\nget from front:\n";
for (auto i = 0; i<10; ++i) {
d2.put_card(deck.get_card(false));
cout << d2.str() << endl;
}
cout << "\n";
cout << "deck: " << deck.str() << endl;
return 0;
}
int main() {
Game g;
cout << "game: \n" << g.str() << endl;
g.prepare();
cout << "game: \n" << g.str() << endl;
g.play();
cout << "game: \n" << g.str() << endl;
g.post();
cout << "game: \n" << g.str() << endl;
return 0;
}
int test_suite() {
for (const auto& s : Suite()) {
cout << to_string(s) << ", ";
}
cout << endl;
return 0;
}
int test_number() {
for (const auto& n : Number()) {
cout << to_string(n) << ", ";
}
cout << endl;
return 0;
}
int test_card() {
vector<Card> deck;
for (auto s = begin(Suite()); s<Suite::JOKER; ++s) {
for (const auto& n : Number()) {
deck.emplace_back(s, n);
}
}
cout << "\n";
for (auto const& c : deck) {
cout << to_string(c) << ", ";
}
cout << "\n";
std::srand(std::time(0));
std::array<int, std::mt19937::state_size> seed_data;
std::generate(seed_data.begin(), seed_data.end(), std::rand);
std::seed_seq seq(seed_data.begin(), seed_data.end());
std::mt19937 g(seq);
std::shuffle(deck.begin(), deck.end(), g);
cout << "\n";
for (auto const& c : deck) {
cout << to_string(c) << ", ";
}
cout << "\n";
return 0;
}
|
/* This file defines the control system */
/* Dependencies - Serial */
#ifndef MICAV_CONTROLLER
#define MICAV_CONTROLLER
#include "config.h"
#include "drivers.h"
#include "PID.h"
#include <stdint.h>
#define MAX_DYAW 100
#define MIN_DYAW -100
#define MAX_DPITCH 100
#define MIN_DPITCH -100
#define MAX_DROLL 100
#define MIN_DROLL -100
#define MAX_DYAW 100
#define MIN_DYAW -100
#define MAX_DPITCH 100
#define MIN_DPITCH -100
#define MAX_ROLL 150
#define MIN_ROLL -150 /*Degrees*10*/
void update_input();
void update_state(float []);
//void update_control();
//void update_output();
void write_output();
#endif /* MICAV_CONTROLLER */
|
CREATE TABLE IF NOT EXISTS `#<API key>` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(4) NOT NULL,
`regex` tinyint(1) NOT NULL,
`match` text NOT NULL,
`php` tinyint(1) NOT NULL,
`sql` tinyint(1) NOT NULL,
`js` tinyint(1) NOT NULL,
`uploads` tinyint(1) NOT NULL,
`reason` text NOT NULL,
`date` datetime NOT NULL,
`published` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
<?php
/* @particles/assets.html.twig */
class <API key> extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
// line 1
$this->parent = $this->loadTemplate("@nucleus/partials/particle.html.twig", "@particles/assets.html.twig", 1);
$this->blocks = array(
'stylesheets' => array($this, 'block_stylesheets'),
'javascript' => array($this, 'block_javascript'),
'javascript_footer' => array($this, '<API key>'),
);
}
protected function doGetParent(array $context)
{
return "@nucleus/partials/particle.html.twig";
}
protected function doDisplay(array $context, array $blocks = array())
{
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_stylesheets($context, array $blocks = array())
{
// line 4
echo " ";
if ($this->getAttribute((isset($context["particle"]) ? $context["particle"] : null), "enabled", array())) {
// line 5
echo " ";
$context['_parent'] = $context;
$context['_seq'] = <API key>($this->getAttribute((isset($context["particle"]) ? $context["particle"] : null), "css", array()));
foreach ($context['_seq'] as $context["_key"] => $context["css"]) {
// line 6
echo " ";
$context["attr_extra"] = "";
// line 7
echo " ";
if ($this->getAttribute($context["css"], "extra", array())) {
// line 8
echo " ";
$context['_parent'] = $context;
$context['_seq'] = <API key>($this->getAttribute($context["css"], "extra", array()));
foreach ($context['_seq'] as $context["_key"] => $context["attributes"]) {
// line 9
echo " ";
$context['_parent'] = $context;
$context['_seq'] = <API key>($context["attributes"]);
foreach ($context['_seq'] as $context["key"] => $context["value"]) {
// line 10
echo " ";
$context["attr_extra"] = ((((((isset($context["attr_extra"]) ? $context["attr_extra"] : null) . " ") . twig_escape_filter($this->env, $context["key"])) . "=\"") . twig_escape_filter($this->env, $context["value"], "html_attr")) . "\"");
// line 11
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['key'], $context['value'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 12
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['attributes'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 13
echo " ";
}
// line 14
echo "
";
// line 15
if ($this->getAttribute($context["css"], "location", array())) {
// line 16
echo " <link rel=\"stylesheet\" href=\"";
echo twig_escape_filter($this->env, $this->env->getExtension('GantryTwig')->urlFunc($this->getAttribute($context["css"], "location", array())), "html", null, true);
echo "\" type=\"text/css\"";
echo (isset($context["attr_extra"]) ? $context["attr_extra"] : null);
echo " />
";
}
// line 18
echo "
";
// line 19
if ($this->getAttribute($context["css"], "inline", array())) {
// line 20
echo " <style type=\"text/css\"";
echo (isset($context["attr_extra"]) ? $context["attr_extra"] : null);
echo ">";
echo $this->getAttribute($context["css"], "inline", array());
echo "</style>
";
}
// line 22
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['css'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 23
echo " ";
}
}
// line 26
public function block_javascript($context, array $blocks = array())
{
// line 27
echo " ";
if ($this->getAttribute((isset($context["particle"]) ? $context["particle"] : null), "enabled", array())) {
// line 28
echo " ";
$context['_parent'] = $context;
$context['_seq'] = <API key>($this->getAttribute((isset($context["particle"]) ? $context["particle"] : null), "javascript", array()));
foreach ($context['_seq'] as $context["_key"] => $context["script"]) {
// line 29
echo " ";
if (($this->getAttribute($context["script"], "in_footer", array()) == false)) {
// line 30
echo " ";
$context["attr_extra"] = "";
// line 31
echo " ";
if ($this->getAttribute($context["script"], "extra", array())) {
// line 32
echo " ";
$context['_parent'] = $context;
$context['_seq'] = <API key>($this->getAttribute($context["script"], "extra", array()));
foreach ($context['_seq'] as $context["_key"] => $context["attributes"]) {
// line 33
echo " ";
$context['_parent'] = $context;
$context['_seq'] = <API key>($context["attributes"]);
foreach ($context['_seq'] as $context["key"] => $context["value"]) {
// line 34
echo " ";
$context["attr_extra"] = ((((((isset($context["attr_extra"]) ? $context["attr_extra"] : null) . " ") . twig_escape_filter($this->env, $context["key"])) . "=\"") . twig_escape_filter($this->env, $context["value"], "html_attr")) . "\"");
// line 35
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['key'], $context['value'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 36
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['attributes'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 37
echo " ";
}
// line 38
echo "
";
// line 39
if ($this->getAttribute($context["script"], "location", array())) {
// line 40
echo " <script src=\"";
echo twig_escape_filter($this->env, $this->env->getExtension('GantryTwig')->urlFunc($this->getAttribute($context["script"], "location", array())), "html", null, true);
echo "\" type=\"text/javascript\"";
echo (isset($context["attr_extra"]) ? $context["attr_extra"] : null);
echo "></script>
";
}
// line 42
echo "
";
// line 43
if ($this->getAttribute($context["script"], "inline", array())) {
// line 44
echo " <script type=\"text/javascript\"";
echo (isset($context["attr_extra"]) ? $context["attr_extra"] : null);
echo ">";
echo $this->getAttribute($context["script"], "inline", array());
echo "</script>
";
}
// line 46
echo " ";
}
// line 47
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['script'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 48
echo " ";
}
}
// line 51
public function <API key>($context, array $blocks = array())
{
// line 52
echo " ";
if ($this->getAttribute((isset($context["particle"]) ? $context["particle"] : null), "enabled", array())) {
// line 53
echo " ";
$context['_parent'] = $context;
$context['_seq'] = <API key>($this->getAttribute((isset($context["particle"]) ? $context["particle"] : null), "javascript", array()));
foreach ($context['_seq'] as $context["_key"] => $context["script"]) {
// line 54
echo " ";
if (($this->getAttribute($context["script"], "in_footer", array()) == true)) {
// line 55
echo " ";
$context["attr_extra"] = "";
// line 56
echo "
";
// line 57
if ($this->getAttribute($context["script"], "extra", array())) {
// line 58
echo " ";
$context['_parent'] = $context;
$context['_seq'] = <API key>($this->getAttribute($context["script"], "extra", array()));
foreach ($context['_seq'] as $context["_key"] => $context["attributes"]) {
// line 59
echo " ";
$context['_parent'] = $context;
$context['_seq'] = <API key>($context["attributes"]);
foreach ($context['_seq'] as $context["key"] => $context["value"]) {
// line 60
echo " ";
$context["attr_extra"] = ((((((isset($context["attr_extra"]) ? $context["attr_extra"] : null) . " ") . twig_escape_filter($this->env, $context["key"])) . "=\"") . twig_escape_filter($this->env, $context["value"], "html_attr")) . "\"");
// line 61
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['key'], $context['value'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 62
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['attributes'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 63
echo " ";
}
// line 64
echo "
";
// line 65
if ($this->getAttribute($context["script"], "location", array())) {
// line 66
echo " <script src=\"";
echo twig_escape_filter($this->env, $this->env->getExtension('GantryTwig')->urlFunc($this->getAttribute($context["script"], "location", array())), "html", null, true);
echo "\" type=\"text/javascript\"";
echo (isset($context["attr_extra"]) ? $context["attr_extra"] : null);
echo "></script>
";
}
// line 68
echo "
";
// line 69
if ($this->getAttribute($context["script"], "inline", array())) {
// line 70
echo " <script type=\"text/javascript\"";
echo (isset($context["attr_extra"]) ? $context["attr_extra"] : null);
echo ">";
echo $this->getAttribute($context["script"], "inline", array());
echo "</script>
";
}
// line 72
echo " ";
}
// line 73
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['script'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 74
echo " ";
}
}
public function getTemplateName()
{
return "@particles/assets.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 285 => 74, 279 => 73, 276 => 72, 268 => 70, 266 => 69, 263 => 68, 255 => 66, 253 => 65, 250 => 64, 247 => 63, 241 => 62, 235 => 61, 232 => 60, 227 => 59, 222 => 58, 220 => 57, 217 => 56, 214 => 55, 211 => 54, 206 => 53, 203 => 52, 200 => 51, 195 => 48, 189 => 47, 186 => 46, 178 => 44, 176 => 43, 173 => 42, 165 => 40, 163 => 39, 160 => 38, 157 => 37, 151 => 36, 145 => 35, 142 => 34, 137 => 33, 132 => 32, 129 => 31, 126 => 30, 123 => 29, 118 => 28, 115 => 27, 112 => 26, 107 => 23, 101 => 22, 93 => 20, 91 => 19, 88 => 18, 80 => 16, 78 => 15, 75 => 14, 72 => 13, 66 => 12, 60 => 11, 57 => 10, 52 => 9, 47 => 8, 44 => 7, 41 => 6, 36 => 5, 33 => 4, 30 => 3, 11 => 1,);
}
}
/* {% extends '@nucleus/partials/particle.html.twig' %}*/
/* {% block stylesheets %}*/
/* {% if (particle.enabled) %}*/
/* {% for css in particle.css %}*/
/* {% set attr_extra = '' %}*/
/* {% if css.extra %}*/
/* {% for attributes in css.extra %}*/
/* {% for key, value in attributes %}*/
/* {% set attr_extra = attr_extra ~ ' ' ~ key|e ~ '="' ~ value|e('html_attr') ~ '"' %}*/
/* {% endfor %}*/
/* {% endfor %}*/
/* {% endif %}*/
/* {% if css.location %}*/
/* <link rel="stylesheet" href="{{ url(css.location) }}" type="text/css"{{ attr_extra|raw }} />*/
/* {% endif %}*/
/* {% if css.inline %}*/
/* <style type="text/css"{{ attr_extra|raw }}>{{ css.inline|raw }}</style>*/
/* {% endif %}*/
/* {% endfor %}*/
/* {% endif %}*/
/* {% endblock %}*/
/* {% block javascript %}*/
/* {% if particle.enabled %}*/
/* {% for script in particle.javascript %}*/
/* {% if script.in_footer == false %}*/
/* {% set attr_extra = '' %}*/
/* {% if script.extra %}*/
/* {% for attributes in script.extra %}*/
/* {% for key, value in attributes %}*/
/* {% set attr_extra = attr_extra ~ ' ' ~ key|e ~ '="' ~ value|e('html_attr') ~ '"' %}*/
/* {% endfor %}*/
/* {% endfor %}*/
/* {% endif %}*/
/* {% if script.location %}*/
/* <script src="{{ url(script.location) }}" type="text/javascript"{{ attr_extra|raw }}></script>*/
/* {% endif %}*/
/* {% if script.inline %}*/
/* <script type="text/javascript"{{ attr_extra|raw }}>{{ script.inline|raw }}</script>*/
/* {% endif %}*/
/* {% endif %}*/
/* {% endfor %}*/
/* {% endif %}*/
/* {% endblock %}*/
/* {% block javascript_footer %}*/
/* {% if particle.enabled %}*/
/* {% for script in particle.javascript %}*/
/* {% if script.in_footer == true %}*/
/* {% set attr_extra = '' %}*/
/* {% if script.extra %}*/
/* {% for attributes in script.extra %}*/
/* {% for key, value in attributes %}*/
/* {% set attr_extra = attr_extra ~ ' ' ~ key|e ~ '="' ~ value|e('html_attr') ~ '"' %}*/
/* {% endfor %}*/
/* {% endfor %}*/
/* {% endif %}*/
/* {% if script.location %}*/
/* <script src="{{ url(script.location) }}" type="text/javascript"{{ attr_extra|raw }}></script>*/
/* {% endif %}*/
/* {% if script.inline %}*/
/* <script type="text/javascript"{{ attr_extra|raw }}>{{ script.inline|raw }}</script>*/
/* {% endif %}*/
/* {% endif %}*/
/* {% endfor %}*/
/* {% endif %}*/
/* {% endblock %}*/
|
#include "avcodec.h"
#include "internal.h"
static av_cold int yuv4_encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
return AVERROR(ENOMEM);
}
return 0;
}
static int yuv4_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *pic, int *got_packet)
{
uint8_t *dst;
uint8_t *y, *u, *v;
int i, j, ret;
if ((ret = ff_alloc_packet2(avctx, pkt, 6 * (avctx->width + 1 >> 1) * (avctx->height + 1 >> 1))) < 0)
return ret;
dst = pkt->data;
avctx->coded_frame->key_frame = 1;
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
y = pic->data[0];
u = pic->data[1];
v = pic->data[2];
for (i = 0; i < avctx->height + 1 >> 1; i++) {
for (j = 0; j < avctx->width + 1 >> 1; j++) {
*dst++ = u[j] ^ 0x80;
*dst++ = v[j] ^ 0x80;
*dst++ = y[ 2 * j ];
*dst++ = y[ 2 * j + 1];
*dst++ = y[pic->linesize[0] + 2 * j ];
*dst++ = y[pic->linesize[0] + 2 * j + 1];
}
y += 2 * pic->linesize[0];
u += pic->linesize[1];
v += pic->linesize[2];
}
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
return 0;
}
static av_cold int yuv4_encode_close(AVCodecContext *avctx)
{
av_freep(&avctx->coded_frame);
return 0;
}
AVCodec ff_yuv4_encoder = {
.name = "yuv4",
.long_name = <API key>("Uncompressed packed 4:2:0"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_YUV4,
.init = yuv4_encode_init,
.encode2 = yuv4_encode_frame,
.close = yuv4_encode_close,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
};
|
#ifndef MANGOSSERVER_PATH_H
#define MANGOSSERVER_PATH_H
#include "Common.h"
#include <vector>
struct SimplePathNode
{
float x,y,z;
};
template<typename PathElem, typename PathNode = PathElem>
class Path
{
public:
size_t size() const { return i_nodes.size(); }
bool empty() const { return i_nodes.empty(); }
void resize(unsigned int sz) { i_nodes.resize(sz); }
void clear() { i_nodes.clear(); }
void erase(uint32 idx) { i_nodes.erase(i_nodes.begin()+idx); }
float GetTotalLength(uint32 start, uint32 end) const
{
float len = 0.0f;
for(unsigned int idx=start+1; idx < end; ++idx)
{
PathNode const& node = i_nodes[idx];
PathNode const& prev = i_nodes[idx-1];
float xd = node.x - prev.x;
float yd = node.y - prev.y;
float zd = node.z - prev.z;
len += sqrtf( xd*xd + yd*yd + zd*zd );
}
return len;
}
float GetTotalLength() const { return GetTotalLength(0,size()); }
float GetPassedLength(uint32 curnode, float x, float y, float z) const
{
float len = GetTotalLength(0,curnode);
if (curnode > 0)
{
PathNode const& node = i_nodes[curnode-1];
float xd = x - node.x;
float yd = y - node.y;
float zd = z - node.z;
len += sqrtf( xd*xd + yd*yd + zd*zd );
}
return len;
}
PathNode& operator[](size_t idx) { return i_nodes[idx]; }
PathNode const& operator[](size_t idx) const { return i_nodes[idx]; }
void set(size_t idx, PathElem elem) { i_nodes[idx] = elem; }
protected:
std::vector<PathElem> i_nodes;
};
typedef Path<SimplePathNode> SimplePath;
#endif
|
#ifndef SI3226X_INTF_H
#define SI3226X_INTF_H
/*
**
** Si3226x General Constants
**
*/
#define SI3226X_REVA 0
#define SI3226X_REVB 1
#define SI3226X_REVC 3 /* This is revC bug - shows revD revision code */
#define DEVICE_KEY_MIN 0x64
#define DEVICE_KEY_MAX 0x6D
/*
** Calibration Constants
*/
#define <API key> 0xC0
#define <API key> 0x18
/* Timeouts in 10s of ms */
#define <API key> 200
#define <API key> 200
/*
**
** PROSLIC INITIALIZATION FUNCTIONS
**
*/
/*
** Function: PROSLIC_Reset
**
** Description:
** Resets the ProSLIC
**
** Input Parameters:
** pProslic: pointer to PROSLIC object
**
** Return:
** none
*/
int Si3226x_Reset (proslicChanType_ptr hProslic);
/*
** Function: <API key>
**
** Description:
** Safely shutdown channel w/o interruption to
** other active channels
**
** Input Parameters:
** pProslic: pointer to PROSLIC object
**
** Return:
** none
*/
int <API key> (proslicChanType_ptr hProslic);
/*
** Function: <API key>
**
** Description:
** Initializes the ProSLIC w/ selected general parameters
**
** Input Parameters:
** pProslic: pointer to PROSLIC object
** size: number of channels
** preset: general configuration preset
**
** Return:
** none
*/
int <API key> (proslicChanType_ptr *hProslic,int size,int preset);
/*
** Function: PROSLIC_Init
**
** Description:
** Initializes the ProSLIC
**
** Input Parameters:
** pProslic: pointer to PROSLIC object
**
** Return:
** none
*/
int Si3226x_Init (proslicChanType_ptr *hProslic,int size);
/*
** Function: PROSLIC_Reinit
**
** Description:
** Soft reset and initialization
**
** Input Parameters:
** pProslic: pointer to PROSLIC object
**
** Return:
** none
*/
int Si3226x_Reinit (proslicChanType_ptr hProslic,int size);
/*
** Function: <API key>
**
** Description:
** Verify SPI port read capabilities
**
** Input Parameters:
** pProslic: pointer to PROSLIC object
**
** Return:
** none
*/
int <API key> (proslicChanType_ptr hProslic);
uInt8 Si3226x_ReadReg (proslicChanType_ptr hProslic,uInt8 addr);
int Si3226x_WriteReg (proslicChanType_ptr hProslic,uInt8 addr,uInt8 data);
ramData Si3226x_ReadRAM (proslicChanType_ptr hProslic,uInt16 addr);
int Si3226x_WriteRAM (proslicChanType_ptr hProslic,uInt16 addr, ramData data);
/*
** Function: <API key>
**
** Description:
** Register and RAM dump utility
**
** Input Parameters:
** pProslic: pointer to PROSLIC object
**
** Return:
** none
*/
int <API key> (proslicChanType_ptr hProslic);
/*
** Function: <API key>
**
** Description:
** Register dump utility
**
** Input Parameters:
** pProslic: pointer to PROSLIC object
**
** Return:
** none
*/
int <API key> (proslicChanType_ptr hProslic);
/*
** Function: <API key>
**
** Description:
** RAM dump utility
**
** Input Parameters:
** pProslic: pointer to PROSLIC object
**
** Return:
** none
*/
int <API key> (proslicChanType_ptr hProslic);
/*
** Function: <API key>
**
** Description:
** Powers all DC/DC converters sequentially with delay to minimize
** peak power draw on VDC.
**
** Returns:
** int (error)
**
*/
int <API key>(proslicChanType_ptr hProslic);
/*
** Function: <API key>
**
** Description:
** Power down DCDC converter (selected channel only)
**
** Returns:
** int (error)
**
*/
int <API key>(proslicChanType_ptr hProslic);
/*
** Function: Si3226x_Calibrate
**
** Description:
** Generic calibration function for Si3226x
**
** Input Parameters:
** pProslic: pointer to PROSLIC object,
** size: maximum number of channels
** calr: array of CALRx register values
** maxTime: cal timeout (in ms)
**
** Return:
** int
*/
int Si3226x_Calibrate (proslicChanType_ptr *hProslic, int size, uInt8 *calr, int maxTime);
/*
** Function: PROSLIC_Cal
**
** Description:
** Calibrates the ProSLIC
**
** Input Parameters:
** pProslic: pointer to PROSLIC object
**
** Return:
** none
*/
int Si3226x_Cal (proslicChanType_ptr *hProslic, int size);
/*
** Function: <API key>
**
** Description:
** Loads registers and ram in the ProSLIC
**
** Input Parameters:
** pProslic: pointer to PROSLIC object
** pRamTable: pointer to ram values to load
** pRegTable: pointer to register values to load
**
**
** Return:
** none
*/
int <API key> (proslicChanType_ptr *hProslic, ProslicRAMInit *pRamTable, ProslicRegInit *pRegTable,int size);
/*
** Function: PROSLIC_LoadPatch
**
** Description:
** Loads patch to the ProSLIC
**
** Input Parameters:
** pProslic: pointer to PROSLIC object
** pPatch: pointer to patch data
**
** Return:
** none
*/
int Si3226x_LoadPatch (proslicChanType_ptr hProslic, const proslicPatch *pPatch);
/*
** Function: PROSLIC_VerifyPatch
**
** Description:
** Verifies patch to the ProSLIC
**
** Input Parameters:
** pProslic: pointer to PROSLIC object
** pPatch: pointer to patch data
**
** Return:
** none
*/
int Si3226x_VerifyPatch (proslicChanType_ptr hProslic, const proslicPatch *pPatch);
/*
** Function: <API key>
**
** Description:
** Enables interrupts
**
** Input Parameters:
** hProslic: pointer to Proslic object
**
** Return:
**
*/
int <API key> (proslicChanType_ptr hProslic);
int <API key> (proslicChanType_ptr hProslic);
/*
** Function: <API key>
**
** Description:
** Set loopback test mode
**
** Input Parameters:
** hProslic: pointer to Proslic object
**
** Return:
**
*/
int <API key> (proslicChanType_ptr hProslic, <API key> newMode);
/*
** Function: <API key>
**
** Description:
** Set mute(s)
**
** Input Parameters:
** hProslic: pointer to Proslic object
**
** Return:
**
*/
int <API key> (proslicChanType_ptr hProslic, ProslicMuteModes muteEn);
/*
**
** PROSLIC CONFIGURATION FUNCTIONS
**
*/
/*
** Function: PROSLIC_RingSetup
**
** Description:
** configure ringing
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pRingSetup: pointer to ringing config structure
**
** Return:
** none
*/
int Si3226x_RingSetup (proslicChanType *pProslic, int preset);
/*
** Function: <API key>
**
** Description:
** configure tone generators
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pTone: pointer to tones config structure
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic, int preset);
/*
** Function: PROSLIC_FSKSetup
**
** Description:
** configure fsk
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pFsk: pointer to fsk config structure
**
** Return:
** none
*/
int Si3226x_FSKSetup (proslicChanType *pProslic, int preset);
/*
* Function: <API key>
*
* Description: To change the FSK start/stop bits field.
* Returns RC_NONE if OK.
*/
int <API key>(proslicChanType_ptr pProslic, uInt8 enable_startStop);
/*
** Function: <API key>
**
** Description:
** configure dtmf decode
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pDTMFDec: pointer to dtmf decoder config structure
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic, int preset);
/*
** Function: PROSLIC_SetProfile
**
** Description:
** set country profile of the proslic
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pCountryData: pointer to country config structure
**
** Return:
** none
*/
int Si3226x_SetProfile (proslicChanType *pProslic, int preset);
/*
** Function: PROSLIC_ZsynthSetup
**
** Description:
** configure impedence synthesis
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pZynth: pointer to zsynth config structure
**
** Return:
** none
*/
int Si3226x_ZsynthSetup (proslicChanType *pProslic, int preset);
/*
** Function: PROSLIC_GciCISetup
**
** Description:
** configure CI bits (GCI mode)
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pCI: pointer to ringing config structure
**
** Return:
** none
*/
int Si3226x_GciCISetup (proslicChanType *pProslic, int preset);
/*
** Function: <API key>
**
** Description:
** configure modem detector
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pModemDet: pointer to modem det config structure
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic, int preset);
/*
** Function: <API key>
**
** Description:
** configure audio gains
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pAudio: pointer to audio gains config structure
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic, int preset);
int <API key> (proslicChanType *pProslic, int preset);
#define <API key> <API key>
int <API key> (proslicChanType *pProslic, int preset, uInt32 pga_scale, uInt32 eq_scale);
int <API key> (proslicChanType *pProslic, int preset, uInt32 pga_scale, uInt32 eq_scale);
/*
** Function: PROSLIC_HybridSetup
**
** Description:
** configure Proslic hybrid
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pHybridCfg: pointer to ringing config structure
**
** Return:
** none
*/
int Si3226x_HybridSetup (proslicChanType *pProslic, int preset);
/*
** Function: <API key>
**
** Description:
** configure audio equalizers
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pAudioEQ: pointer to ringing config structure
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic, int preset);
/*
** Function: PROSLIC_DCFeedSetup
**
** Description:
** configure dc feed
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pDcFeed: pointer to dc feed config structure
**
** Return:
** none
*/
int Si3226x_DCFeedSetup (proslicChanType *pProslic,int preset);
int <API key> (proslicChanType *pProslic,ProSLIC_DCfeed_Cfg *cfg,int preset);
/*
** Function: PROSLIC_GPIOSetup
**
** Description:
** configure gpio
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pGpio: pointer to gpio config structure
**
** Return:
** none
*/
int Si3226x_GPIOSetup (proslicChanType *pProslic);
/*
** Function: PROSLIC_PCMSetup
**
** Description:
** configure pcm
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pPcm: pointer to pcm config structure
**
** Return:
** none
*/
int Si3226x_PCMSetup (proslicChanType *pProslic, int preset);
int <API key> (proslicChanType *pProslic, uInt16 rxcount, uInt16 txcount);
/*
**
** PROSLIC CONTROL FUNCTIONS
**
*/
/*
** Function: <API key>
**
** Description:
** Enables interrupts
**
** Input Parameters:
** hProslic: pointer to Proslic object
** pIntData: pointer to interrupt info retrieved
**
** Return:
**
*/
int <API key> (proslicChanType_ptr hProslic, proslicIntType *pIntData);
/*
** Function: <API key>
**
** Description:
** Determine hook status
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pHookStat: current hook status
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic,uInt8 *pHookStat);
/*
** Function: <API key>
**
** Description:
** Sets linefeed state
**
** Input Parameters:
** pProslic: pointer to Proslic object
** newLinefeed: new linefeed state
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic,uInt8 newLinefeed);
/*
** Function: <API key>
**
** Description:
** Sets linefeed state
**
** Input Parameters:
** pProslic: pointer to Proslic object
** newLinefeed: new linefeed state
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic, uInt8 newLinefeed);
/*
** Function: PROSLIC_PolRev
**
** Description:
** Sets polarity reversal state
**
** Input Parameters:
** pProslic: pointer to Proslic object
** abrupt: set this to 1 for abrupt pol rev
** newPolRevState: new pol rev state
**
** Return:
** none
*/
int Si3226x_PolRev (proslicChanType *pProslic,uInt8 abrupt, uInt8 newPolRevState);
/*
** Function: PROSLIC_GPIOControl
**
** Description:
** Sets gpio of the proslic
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pGpioData: pointer to gpio status
** read: set to 1 to read status, 0 to write
**
** Return:
** none
*/
int Si3226x_GPIOControl (proslicChanType *pProslic,uInt8 *pGpioData, uInt8 read);
/*
** Function: ProSLIC_MWISetup
**
** Description:
** Modify default MWI amplitude and switch debounce parameters
**
** Input Parameters:
** pProslic: pointer to Proslic object
** vpk_mag: peak flash voltgage (vpk) - passing a 0 results
** in no change to VBATH_NEON
** lcmrmask_mwi: LCR mask time (ms) after MWI state switch - passing
** a 0 results in no change to LCRMASK_MWI
**
** Return:
** none
*/
int Si3226x_MWISetup (proslicChanType *pProslic,uInt16 vpk_mag,uInt16 lcrmask_mwi);
/*
** Function: ProSLIC_MWIEnable
**
** Description:
** Enable MWI feature
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int Si3226x_MWIEnable (proslicChanType *pProslic);
/*
** Function: ProSLIC_MWIDisable
**
** Description:
** Disable MWI feature
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int Si3226x_MWIDisable (proslicChanType *pProslic);
/*
** Function: ProSLIC_SetMWIState
**
** Description:
** Set MWI state
**
** Input Parameters:
** pProslic: pointer to Proslic object
** flash_on: 0 = low, 1 = high (VBATH_NEON)
**
** Return:
** none
*/
int Si3226x_SetMWIState (proslicChanType *pProslic,uInt8 flash_on);
/*
** Function: ProSLIC_GetMWIState
**
** Description:
** Read MWI state
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** 0 - Flash OFF, 1 - Flash ON, RC_MWI_NOT_ENABLED
*/
int Si3226x_GetMWIState (proslicChanType *pProslic);
/*
** Function: ProSLIC_MWI
**
** Description:
** implements message waiting indicator
**
** Input Parameters:
** pProslic: pointer to Proslic object
** lampOn: 0 = turn lamp off, 1 = turn lamp on
**
** Return:
** none
**
** Use Deprecated.
*/
int Si3226x_MWI (proslicChanType *pProslic,uInt8 lampOn);
/*
** Function: <API key>
**
** Description:
** Initializes and start tone generators
**
** Input Parameters:
** pProslic: pointer to Proslic object
** timerEn: specifies whether to enable the tone generator timers
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic, uInt8 timerEn);
/*
** Function: PROSLIC_StopTone
**
** Description:
** Stops tone generators
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int Si3226x_ToneGenStop (proslicChanType *pProslic);
/*
** Function: PROSLIC_StartRing
**
** Description:
** Initializes and start ring generator
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int Si3226x_RingStart (proslicChanType *pProslic);
/*
** Function: PROSLIC_StopRing
**
** Description:
** Stops ring generator
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int Si3226x_RingStop (proslicChanType *pProslic);
/*
** Function: PROSLIC_EnableCID
**
** Description:
** enable fsk
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int Si3226x_EnableCID (proslicChanType *pProslic);
/*
** Function: PROSLIC_DisableCID
**
** Description:
** disable fsk
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int Si3226x_DisableCID (proslicChanType *pProslic);
/*
** Function: PROSLIC_SendCID
**
** Description:
** send fsk data
**
** Input Parameters:
** pProslic: pointer to Proslic object
** buffer: buffer to send
** numBytes: num of bytes in the buffer
**
** Return:
** none
*/
int Si3226x_SendCID (proslicChanType *pProslic, uInt8 *buffer, uInt8 numBytes);
int <API key> (proslicChanType *pProslic, uInt8 *fsk_buf_avail);
/*
** Function: PROSLIC_StartPCM
**
** Description:
** Starts PCM
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int Si3226x_PCMStart (proslicChanType *pProslic);
/*
** Function: PROSLIC_StopPCM
**
** Description:
** Disables PCM
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int Si3226x_PCMStop (proslicChanType *pProslic);
/*
** Function: <API key>
**
** Description:
** Read DTMF digit (would be called after DTMF interrupt to collect digit)
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pDigit: digit read
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic,uInt8 *pDigit);
/*
** Function: <API key>
**
** Description:
** initiates pll free run mode
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic);
/*
** Function: <API key>
**
** Description:
** exit pll free run mode
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic);
/*
** Function: <API key>
**
** Description:
** configure pulse metering
**
** Input Parameters:
** pProslic: pointer to Proslic object
** pPulseCfg: pointer to pulse metering config structure
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic, int preset);
/*
** Function: <API key>
**
** Description:
** enable pulse meter generation
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic);
/*
** Function: <API key>
**
** Description:
** disable pulse meter generation
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic);
/*
** Function: <API key>
**
** Description:
** start pulse meter tone
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic);
/*
** Function: <API key>
**
** Description:
** stop pulse meter tone
**
** Input Parameters:
** pProslic: pointer to Proslic object
**
** Return:
** none
*/
int <API key> (proslicChanType *pProslic);
/*
** Function: PROSLIC_LBCal
**
** Description:
** Execute longitudinal balance calibration
**
** Input Parameters:
** hProslic: pointer to array of Proslic objects
**
** Return:
**
*/
int Si3226x_LBCal (proslicChanType_ptr *pProslic, int size);
int <API key> (proslicChanType *pProslic,int32 *result1,int32 *result2,int32 *result3,int32 *result4);
int <API key> (proslicChanType *pProslic,int32 *result);
int <API key> (proslicChanType *pProslic,int32 result1,int32 result2,int32 result3,int32 result4);
int <API key> (proslicChanType *pProslic,int32 *result);
/*
** Function: <API key>
**
** Description:
** provisionary function for setting up
** dcfeed given desired open circuit voltage
** and loop current.
*/
int <API key> (proslicChanType *pProslic, uInt32 v_vlim_val, uInt32 i_ilim_val, int32 preset);
/*
** Function: <API key>
**
** Description:
** provisionary function for setting up
** dcfeed given desired open circuit voltage
** and loop current.
*/
int <API key> (proslicChanType *pProslic, uInt32 v_vlim_val, int32 preset);
/*
** Function: <API key>
**
** Description:
** provisionary function for setting up
** dcfeed given desired open circuit voltage
** and loop current.
*/
int <API key> (proslicChanType *pProslic, uInt32 i_ilim_val, int32 preset);
/*
** Function: <API key>
**
** Description:
** Provisionary function for setting up
** Ring type, frequency, amplitude and dc offset.
** Main use will be by peek/poke applications.
*/
int <API key> (proslicChanType *pProslic, ProSLIC_dbgRingCfg *ringCfg, int preset);
/*
** Function: <API key>
**
** Description:
** Provisionary function for setting up
** RX path gain.
*/
int <API key> (proslicChanType *pProslic, int32 gain, int impedance_preset, int audio_gain_preset);
/*
** Function: <API key>
**
** Description:
** Provisionary function for setting up
** TX path gain.
*/
int <API key> (proslicChanType *pProslic, int32 gain, int impedance_preset, int audio_gain_preset);
/*
** Function: PROSLIC_LineMonitor
**
** Description:
** Monitor line voltages and currents
*/
int Si3226x_LineMonitor(proslicChanType *pProslic, proslicMonitorType *monitor);
/*
** Function: PROSLIC_PSTNCheck
**
** Description:
** Continuous monitor of ilong to detect hot pstn line
*/
int Si3226x_PSTNCheck(proslicChanType *pProslic, <API key> *pstnCheckObj);
/*
** Function: <API key>
**
** Description:
** Detection of foreign PSTN
*/
int <API key> (proslicChanType *pProslic, <API key> *pPSTNCheck);
/*
** Function: <API key>
**
** Description:
** Enable or Disable powersave mode
*/
int <API key>(proslicChanType *pProslic, int pwrsave);
/*
** Function: <API key>
**
** Description:
** ReadMADC (or other sensed voltage/currents) and
** return scaled value in int32 format
*/
int32 <API key>(proslicChanType *pProslic, uInt16 addr, int32 scale);
#endif
|
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/smp.h>
#include <linux/sem.h>
#include <linux/msg.h>
#include <linux/shm.h>
#include <linux/stat.h>
#include <linux/syscalls.h>
#include <linux/mman.h>
#include <linux/file.h>
#include <linux/utsname.h>
#include <linux/personality.h>
#include <linux/unistd.h>
#include <linux/ipc.h>
#include <asm/uaccess.h>
#include "entry.h"
/*
* Perform the mmap() system call. Linux for S/390 isn't able to handle more
* than 5 system call parameters, so this system call uses a memory block
* for parameter passing.
*/
struct <API key> {
unsigned long addr;
unsigned long len;
unsigned long prot;
unsigned long flags;
unsigned long fd;
unsigned long offset;
};
SYSCALL_DEFINE1(mmap2, struct <API key> __user *, arg)
{
struct <API key> a;
int error = -EFAULT;
if (copy_from_user(&a, arg, sizeof(a)))
goto out;
error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
out:
return error;
}
/*
* sys_ipc() is the de-multiplexer for the SysV IPC calls.
*/
SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
unsigned long, third, void __user *, ptr)
{
if (call >> 16)
return -EINVAL;
/* The s390 sys_ipc variant has only five parameters instead of six
* like the generic variant. The only difference is the handling of
* the SEMTIMEDOP subcall where on s390 the third parameter is used
* as a pointer to a struct timespec where the generic variant uses
* the fifth parameter.
* Therefore we can call the generic variant by simply passing the
* third parameter also as fifth parameter.
*/
return sys_ipc(call, first, second, third, ptr, third);
}
#ifdef CONFIG_64BIT
SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
{
unsigned int ret;
if (current->personality == PER_LINUX32 && personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
if (ret == PER_LINUX32)
ret = PER_LINUX;
return ret;
}
#endif /* CONFIG_64BIT */
/*
* Wrapper function for sys_fadvise64/fadvise64_64
*/
#ifndef CONFIG_64BIT
SYSCALL_DEFINE5(s390_fadvise64, int, fd, u32, offset_high, u32, offset_low,
size_t, len, int, advice)
{
return sys_fadvise64(fd, (u64) offset_high << 32 | offset_low,
len, advice);
}
struct fadvise64_64_args {
int fd;
long long offset;
long long len;
int advice;
};
SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args)
{
struct fadvise64_64_args a;
if ( copy_from_user(&a, args, sizeof(a)) )
return -EFAULT;
return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
}
/*
* This is a wrapper to call sys_fallocate(). For 31 bit s390 the last
* 64 bit argument "len" is split into the upper and lower 32 bits. The
* system call wrapper in the user space loads the value to %r6/%r7.
* The code in entry.S keeps the values in %r2 - %r6 where they are and
* stores %r7 to 96(%r15). But the standard C linkage requires that
* the whole 64 bit value for len is stored on the stack and doesn't
* use %r6 at all. So s390_fallocate has to convert the arguments from
* %r2: fd, %r3: mode, %r4/%r5: offset, %r6/96(%r15)-99(%r15): len
* to
* %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len
*/
SYSCALL_DEFINE(s390_fallocate)(int fd, int mode, loff_t offset,
u32 len_high, u32 len_low)
{
return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low);
}
#ifdef <API key>
asmlinkage long SyS_s390_fallocate(long fd, long mode, loff_t offset,
long len_high, long len_low)
{
return SYSC_s390_fallocate((int) fd, (int) mode, offset,
(u32) len_high, (u32) len_low);
}
SYSCALL_ALIAS(sys_s390_fallocate, SyS_s390_fallocate);
#endif
#endif
|
# <API key>
- Engine : [Phaser](https://github.com/photonstorm/phaser). 2.4.4
- Develop enviorment: IntelliJ IDEA 2016
RS GUI
PhaserUI
Phaser-Debug
Phaser Debug
Phaser-Inspector
Phaser
Juicy
*
*
*
*
*
ColorHarmony
newgroundsio.min.js
NewGroundsAPI
|
# -*- coding: utf-8 -*-
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.api import CommonApiMixin
from common.permissions import IsValidUser, IsOrgAdmin
from tickets import serializers
from tickets.models import Ticket
from tickets.permissions.ticket import IsAssignee, <API key>, NotClosed
__all__ = ['TicketViewSet']
class TicketViewSet(CommonApiMixin, viewsets.ModelViewSet):
permission_classes = (IsValidUser,)
serializer_class = serializers.<API key>
serializer_classes = {
'open': serializers.<API key>,
'approve': serializers.<API key>,
}
filterset_fields = [
'id', 'title', 'type', 'action', 'status', 'applicant', 'applicant_display', 'processor',
'processor_display', 'assignees__id'
]
search_fields = [
'title', 'action', 'type', 'status', 'applicant_display', 'processor_display'
]
def create(self, request, *args, **kwargs):
raise MethodNotAllowed(self.action)
def update(self, request, *args, **kwargs):
raise MethodNotAllowed(self.action)
def destroy(self, request, *args, **kwargs):
raise MethodNotAllowed(self.action)
def get_queryset(self):
queryset = Ticket.<API key>(self.request.user)
return queryset
def perform_create(self, serializer):
instance = serializer.save()
instance.open(applicant=self.request.user)
@action(detail=False, methods=[POST], permission_classes=[IsValidUser, ])
def open(self, request, *args, **kwargs):
return super().create(request, *args, **kwargs)
@action(detail=True, methods=[PUT], permission_classes=[IsOrgAdmin, IsAssignee, NotClosed])
def approve(self, request, *args, **kwargs):
response = super().update(request, *args, **kwargs)
instance = self.get_object()
instance.approve(processor=self.request.user)
return response
@action(detail=True, methods=[PUT], permission_classes=[IsOrgAdmin, IsAssignee, NotClosed])
def reject(self, request, *args, **kwargs):
instance = self.get_object()
serializer = self.get_serializer(instance)
instance.reject(processor=request.user)
return Response(serializer.data)
@action(detail=True, methods=[PUT], permission_classes=[<API key>, NotClosed])
def close(self, request, *args, **kwargs):
instance = self.get_object()
serializer = self.get_serializer(instance)
instance.close(processor=request.user)
return Response(serializer.data)
|
#ifndef COCO_CcsXmlParser_H
#define COCO_CcsXmlParser_H
#ifndef COCO_ERRORPOOL_H
#include "c/ErrorPool.h"
#endif
#ifndef <API key>
#include "Scanner.h"
#endif
#ifndef COCO_GLOBALS_H
#include "Globals.h"
#endif
EXTC_BEGIN
#define <API key>
typedef struct CcsXmlParser_s CcsXmlParser_t;
struct CcsXmlParser_s {
CcsErrorPool_t errpool;
CcsXmlScanner_t scanner;
CcsToken_t * t;
CcsToken_t * la;
int maxT;
CcGlobals_t globals;
/* Shortcut pointers */
CcSymbolTable_t * symtab;
CcXmlSpecMap_t * xmlspecmap;
CcSyntax_t * syntax;
};
CcsXmlParser_t * CcsXmlParser(CcsXmlParser_t * self, FILE * infp, FILE * errfp);
CcsXmlParser_t *
CcsXmlParser_ByName(CcsXmlParser_t * self, const char * infn, FILE * errfp);
void <API key>(CcsXmlParser_t * self);
void CcsXmlParser_Parse(CcsXmlParser_t * self);
void CcsXmlParser_SemErr(CcsXmlParser_t * self, const CcsToken_t * token,
const char * format, ...);
void <API key>(CcsXmlParser_t * self, const char * format, ...);
EXTC_END
#endif /* COCO_PARSER_H */
|
import FWCore.ParameterSet.Config as cms
maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
readFiles = cms.untracked.vstring()
secFiles = cms.untracked.vstring()
source = cms.Source ("PoolSource",fileNames = readFiles, secondaryFileNames = secFiles)
readFiles.extend( [
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root',
'/store/mc/Spring14miniaod/<API key>/MINIAODSIM/<API key>/00000/<API key>.root' ] );
secFiles.extend( [
] )
|
#ifndef <API key>
#define <API key>
#include <bzs/db/engine/mysql/dbManager.h>
#include <bzs/db/protocol/ICommandExecuter.h>
#include <bzs/env/crosscompile.h>
namespace bzs
{
namespace db
{
namespace protocol
{
namespace hs
{
#define HS_OP_READ 'R'
#define HS_OP_OPEN 'P'
#define HS_OP_AUTH 'A'
#define HS_OP_INSERT '+'
#define HS_OP_DELETE 'D'
#define HS_OP_UPDATE 'U'
#define HS_OP_UPDATE_INC '+' + 0xff
#define HS_OP_UPDATE_DEC '-'
#define HS_OP_QUIT 'Q'
#define HS_LG_EQUAL '='
#define HS_LG_GREATER '>'
#define HS_LG_LESS '<'
#define HS_LG_NOTEQUAL '<' + 0xfe
#define <API key> '>' + 0xff
#define HS_LG_LESSOREQUAL '<' + 0xff
#define DEBNAME_SIZE 64
#define TABELNAME_SIZE 64
#define INDEXNAME_SIZE 64
#define HS_OP_RESULTBUFSIZE 64000
// result buffer
class resultBuffer
{
char* m_ptr;
char* m_cur;
public:
resultBuffer(char* ptr) : m_ptr(ptr), m_cur(m_ptr) {}
void append(const char* ptr, size_t size)
{
const char* p = ptr;
const char* end = ptr + size;
for (; p < end; ++p)
{
if ((*p >= 0x00) && (*p <= 0x10))
{
*m_cur = 0x01;
*(++m_cur) = *p + 0x40;
}
else
*m_cur = *p;
++m_cur;
}
}
void append(const char* ptr)
{
const char* p = ptr;
while (*p)
{
*m_cur = *p;
++p;
++m_cur;
}
}
void append(int v)
{
char tmp[50];
sprintf_s(tmp, 50, "%d", v);
append(tmp);
}
size_t size()
{
*m_ptr = 0x00;
return m_cur - m_ptr;
}
const char* c_str() { return m_ptr; }
};
// request
struct request
{
short op;
int handle;
struct result
{
result() : limit(1), offset(0), returnBeforeValue(0){};
int limit;
int offset;
bool returnBeforeValue;
} result;
struct db
{
char name[DEBNAME_SIZE];
} db;
struct table
{
table() : openMode(0) {}
char name[TABELNAME_SIZE];
short openMode;
struct key
{
key() : logical(0){};
char name[INDEXNAME_SIZE];
std::vector<std::string> values;
short logical;
} key;
std::string fields;
std::vector<std::string> values;
struct in
{
in() : keypart(0) {}
uint keypart;
std::vector<std::string> values;
} in;
struct filter
{
filter() : type(0), logical(0), col(0) {}
char type;
short logical;
short col;
std::string value;
};
typedef std::vector<filter> filters_type;
filters_type filters;
} table;
request() : op(HS_OP_READ), handle(0) {}
ha_rkey_function seekFlag();
bool naviForward();
bool naviSame();
};
// class dbExecuter
/** Current, no support auth command .
*/
typedef int (*changeFunc)(request& req, engine::mysql::table* tb, int type);
class dbExecuter : public engine::mysql::dbManager
{
void doRecordOperation(request& req, engine::mysql::table* tb,
resultBuffer& buf, changeFunc func);
inline int readAfter(request& req, engine::mysql::table* tb,
resultBuffer& buf, changeFunc func);
public:
dbExecuter(netsvc::server::IAppModule* mod);
int commandExec(std::vector<request>& requests,
netsvc::server::netWriter* nw);
int errorCode(int ha_error) { return 0; };
};
// class commandExecuter
class commandExecuter : public ICommandExecuter,
public engine::mysql::igetDatabases
{
boost::shared_ptr<dbExecuter> m_dbExec;
mutable std::vector<request> m_requests;
public:
commandExecuter(netsvc::server::IAppModule* mod);
~commandExecuter();
size_t perseRequestEnd(const char* p, size_t size, bool& comp) const;
size_t getAcceptMessage(char* message, size_t size) { return 0; };
bool parse(const char* p, size_t size);
int execute(netsvc::server::netWriter* nw)
{
return m_dbExec->commandExec(m_requests, nw);
}
void cleanup(){};
bool isShutDown() { return m_dbExec->isShutDown(); }
const engine::mysql::databases& dbs() const { return m_dbExec->dbs(); }
boost::mutex& mutex() { return m_dbExec->mutex(); }
};
} // namespace hs
} // namespace protocol
} // namespace db
} // namespace bzs
#endif // <API key>
|
#ifndef <API key>
#define <API key>
#include "common/scummsys.h"
#include "sci/engine/vm_types.h" // for reg_t
#include "sci/engine/vm.h"
namespace Sci {
/** Contains selector IDs for a few selected selectors */
struct SelectorCache {
SelectorCache() {
memset(this, 0, sizeof(*this));
}
// Statically defined selectors, (almost the) same in all SCI versions
Selector _info_; ///< Removed in SCI3
Selector y;
Selector x;
Selector view, loop, cel; ///< Description of a specific image
Selector underBits; ///< Used by the graphics subroutines to store backupped BG pic data
Selector nsTop, nsLeft, nsBottom, nsRight; ///< View boundaries ('now seen')
Selector lsTop, lsLeft, lsBottom, lsRight; ///< Used by Animate() subfunctions and scroll list controls
Selector signal; ///< Used by Animate() to control a view's behavior
Selector illegalBits; ///< Used by CanBeHere
Selector brTop, brLeft, brBottom, brRight; ///< Bounding Rectangle
// name, key, time
Selector text; ///< Used by controls
Selector elements; ///< Used by SetSynonyms()
// color, back
Selector mode; ///< Used by text controls (-> DrawControl())
// style
Selector state, font, type;///< Used by controls
// window
Selector cursor; ///< Used by EditControl
Selector max; ///< Used by EditControl, removed in SCI3
Selector mark; //< Used by list controls (script internal, is needed by us for the QfG import rooms)
Selector sort; //< Used by list controls (script internal, is needed by us for QfG3 import room)
// who
Selector message; ///< Used by GetEvent
// edit
Selector play; ///< Play function (first function to be called)
Selector number;
Selector handle; ///< Replaced by nodePtr in SCI1+
Selector nodePtr; ///< Replaces handle in SCI1+
Selector client; ///< The object that wants to be moved
Selector dx, dy; ///< Deltas
Selector b_movCnt, b_i1, b_i2, b_di, b_xAxis, b_incr; ///< Various Bresenham vars
Selector xStep, yStep; ///< BR adjustments
Selector xLast, yLast; ///< BR last position of client
Selector moveSpeed; ///< Used for DoBresen
Selector canBeHere; ///< Funcselector: Checks for movement validity in SCI0
Selector heading, mover; ///< Used in DoAvoider
Selector doit; ///< Called (!) by the Animate() system call
Selector isBlocked, looper; ///< Used in DoAvoider
Selector priority;
Selector modifiers; ///< Used by GetEvent
Selector replay; ///< Replay function
// setPri, at, next, done, width
Selector wordFail, syntaxFail; ///< Used by Parse()
// semanticFail, pragmaFail
// said
Selector claimed; ///< Used generally by the event mechanism
// value, save, restore, title, button, icon, draw
Selector delete_; ///< Called by Animate() to dispose a view object
Selector z;
// SCI1+ static selectors
Selector parseLang;
Selector printLang; ///< Used for i18n
Selector subtitleLang;
Selector size;
Selector points; ///< Used by AvoidPath()
Selector palette; ///< Used by the SCI0-SCI1.1 animate code, unused in SCI2-SCI2.1, removed in SCI3
Selector dataInc; ///< Used to sync music with animations, removed in SCI3
// handle (in SCI1)
Selector min; ///< SMPTE time format
Selector sec;
Selector frame;
Selector vol;
Selector pri;
// perform
Selector moveDone; ///< used for DoBresen
// SCI1 selectors which have been moved a bit in SCI1.1, but otherwise static
Selector cantBeHere; ///< Checks for movement avoidance in SCI1+. Replaces canBeHere
Selector topString; ///< SCI1 scroll lists use this instead of lsTop. Removed in SCI3
Selector flags;
// SCI1+ audio sync related selectors, not static. They're used for lip syncing in
// CD talkie games
Selector syncCue; ///< Used by DoSync()
Selector syncTime;
// SCI1.1 specific selectors
Selector scaleSignal; //< Used by kAnimate() for cel scaling (SCI1.1+)
Selector scaleX, scaleY; ///< SCI1.1 view scaling
Selector maxScale; ///< SCI1.1 view scaling, limit for cel, when using global scaling
Selector vanishingX; ///< SCI1.1 view scaling, used by global scaling
Selector vanishingY; ///< SCI1.1 view scaling, used by global scaling
// Used for auto detection purposes
Selector overlay; ///< Used to determine if a game is using old gfx functions or not
// SCI1.1 Mac icon bar selectors
Selector iconIndex; ///< Used to index icon bar objects
Selector select;
#ifdef ENABLE_SCI32
Selector data; // Used by Array()/String()
Selector picture; // Used to hold the picture ID for SCI32 pictures
Selector plane;
Selector top;
Selector left;
Selector bottom;
Selector right;
Selector resX;
Selector resY;
Selector fore;
Selector back;
Selector dimmed;
Selector fixPriority;
Selector mirrored;
Selector useInsetRect;
Selector inTop, inLeft, inBottom, inRight;
#endif
};
/**
* Map a selector name to a selector id. Shortcut for accessing the selector cache.
*/
#define SELECTOR(_slc_) (g_sci->getKernel()->_selectorCache._slc_)
/**
* Retrieves a selector from an object.
* @param segMan the segment mananger
* @param _obj_ the address of the object which the selector should be read from
* @param _slc_ the selector to refad
* @return the selector value as a reg_t
* This macro halts on error. 'selector' must be a selector name registered in vm.h's
* SelectorCache and mapped in script.cpp.
*/
reg_t readSelector(SegManager *segMan, reg_t object, Selector selectorId);
#define readSelectorValue(segMan, _obj_, _slc_) (readSelector(segMan, _obj_, _slc_).offset)
/**
* Writes a selector value to an object.
* @param segMan the segment mananger
* @param _obj_ the address of the object which the selector should be written to
* @param _slc_ the selector to read
* @param _val_ the value to write
* This macro halts on error. 'selector' must be a selector name registered in vm.h's
* SelectorCache and mapped in script.cpp.
*/
void writeSelector(SegManager *segMan, reg_t object, Selector selectorId, reg_t value);
#define writeSelectorValue(segMan, _obj_, _slc_, _val_) writeSelector(segMan, _obj_, _slc_, make_reg(0, _val_))
/**
* Invokes a selector from an object.
*/
void invokeSelector(EngineState *s, reg_t object, int selectorId,
int k_argc, StackPtr k_argp, int argc = 0, const reg_t *argv = 0);
} // End of namespace Sci
#endif // SCI_ENGINE_KERNEL_H
|
// This file is autogenerated by hidl-gen
// then manualy edited for retrocompatiblity
// Source: android.hardware.audio.common@4.0
// Root: android.hardware:hardware/interfaces
#ifndef <API key>
#define <API key>
#ifdef __cplusplus
extern "C" {
#endif
enum {
<API key> = 0,
<API key> = 0,
<API key> = 0,
<API key> = 0,
};
typedef enum {
<API key> = -1,
AUDIO_STREAM_MIN = 0,
<API key> = 0,
AUDIO_STREAM_SYSTEM = 1,
AUDIO_STREAM_RING = 2,
AUDIO_STREAM_MUSIC = 3,
AUDIO_STREAM_ALARM = 4,
<API key> = 5,
<API key> = 6,
<API key> = 7,
AUDIO_STREAM_DTMF = 8,
AUDIO_STREAM_TTS = 9,
<API key> = 10,
#ifndef <API key>
/** For dynamic policy output mixes. Only used by the audio policy */
<API key> = 11,
/** For audio flinger tracks volume. Only used by the audioflinger */
AUDIO_STREAM_PATCH = 12,
#endif // <API key>
} audio_stream_type_t;
typedef enum {
<API key> = 0,
AUDIO_SOURCE_MIC = 1,
<API key> = 2,
<API key> = 3,
<API key> = 4,
<API key> = 5,
<API key> = 6,
<API key> = 7,
<API key> = 8,
<API key> = 9,
<API key> = 1998,
#ifndef <API key>
/**
* A low-priority, preemptible audio source for for background software
* hotword detection. Same tuning as VOICE_RECOGNITION.
* Used only internally by the framework.
*/
<API key> = 1999,
#endif // <API key>
} audio_source_t;
typedef enum {
<API key> = -1,
<API key> = 0,
<API key> = 0,
AUDIO_SESSION_NONE = 0,
} audio_session_t;
typedef enum {
<API key> = 0xFFFFFFFFu,
<API key> = 0,
AUDIO_FORMAT_PCM = 0x00000000u,
AUDIO_FORMAT_MP3 = 0x01000000u,
AUDIO_FORMAT_AMR_NB = 0x02000000u,
AUDIO_FORMAT_AMR_WB = 0x03000000u,
AUDIO_FORMAT_AAC = 0x04000000u,
<API key> = 0x05000000u,
<API key> = 0x06000000u,
AUDIO_FORMAT_VORBIS = 0x07000000u,
AUDIO_FORMAT_OPUS = 0x08000000u,
AUDIO_FORMAT_AC3 = 0x09000000u,
AUDIO_FORMAT_E_AC3 = 0x0A000000u,
AUDIO_FORMAT_DTS = 0x0B000000u,
AUDIO_FORMAT_DTS_HD = 0x0C000000u,
<API key> = 0x0D000000u,
<API key> = 0x0E000000u,
AUDIO_FORMAT_EVRC = 0x10000000u,
AUDIO_FORMAT_EVRCB = 0x11000000u,
AUDIO_FORMAT_EVRCWB = 0x12000000u,
AUDIO_FORMAT_EVRCNW = 0x13000000u,
<API key> = 0x14000000u,
AUDIO_FORMAT_WMA = 0x15000000u,
<API key> = 0x16000000u,
<API key> = 0x17000000u,
AUDIO_FORMAT_MP2 = 0x18000000u,
AUDIO_FORMAT_QCELP = 0x19000000u,
AUDIO_FORMAT_DSD = 0x1A000000u,
AUDIO_FORMAT_FLAC = 0x1B000000u,
AUDIO_FORMAT_ALAC = 0x1C000000u,
AUDIO_FORMAT_APE = 0x1D000000u,
<API key> = 0x1E000000u,
AUDIO_FORMAT_SBC = 0x1F000000u,
AUDIO_FORMAT_APTX = 0x20000000u,
<API key> = 0x21000000u,
AUDIO_FORMAT_AC4 = 0x22000000u,
AUDIO_FORMAT_LDAC = 0x23000000u,
AUDIO_FORMAT_MAT = 0x24000000u,
<API key> = 0xFF000000u,
<API key> = 0x00FFFFFFu,
/* Subformats */
<API key> = 0x1u,
<API key> = 0x2u,
<API key> = 0x3u,
<API key> = 0x4u,
<API key> = 0x5u,
<API key> = 0x6u,
<API key> = 0x0u,
<API key> = 0x0u,
<API key> = 0x1u,
<API key> = 0x2u,
<API key> = 0x4u,
<API key> = 0x8u,
<API key> = 0x10u,
<API key> = 0x20u,
<API key> = 0x40u,
<API key> = 0x80u,
<API key> = 0x100u,
<API key> = 0x200u,
<API key> = 0x300u,
<API key> = 0x0u,
<API key> = 0x1u,
<API key> = 0x1u,
<API key> = 0x2u,
<API key> = 0x3u,
/* Aliases */
<API key> = 0x1u, // (PCM | PCM_SUB_16_BIT)
<API key> = 0x2u, // (PCM | PCM_SUB_8_BIT)
<API key> = 0x3u, // (PCM | PCM_SUB_32_BIT)
<API key> = 0x4u, // (PCM | PCM_SUB_8_24_BIT)
<API key> = 0x5u, // (PCM | PCM_SUB_FLOAT)
<API key> = 0x6u, // (PCM | <API key>)
<API key> = 0x4000001u, // (AAC | AAC_SUB_MAIN)
AUDIO_FORMAT_AAC_LC = 0x4000002u, // (AAC | AAC_SUB_LC)
<API key> = 0x4000004u, // (AAC | AAC_SUB_SSR)
<API key> = 0x4000008u, // (AAC | AAC_SUB_LTP)
<API key> = 0x4000010u, // (AAC | AAC_SUB_HE_V1)
<API key> = 0x4000020u, // (AAC | AAC_SUB_SCALABLE)
<API key> = 0x4000040u, // (AAC | AAC_SUB_ERLC)
AUDIO_FORMAT_AAC_LD = 0x4000080u, // (AAC | AAC_SUB_LD)
<API key> = 0x4000100u, // (AAC | AAC_SUB_HE_V2)
<API key> = 0x4000200u, // (AAC | AAC_SUB_ELD)
<API key> = 0x4000300u, // (AAC | AAC_SUB_XHE)
<API key> = 0x1e000001u, // (AAC_ADTS | AAC_SUB_MAIN)
<API key> = 0x1e000002u, // (AAC_ADTS | AAC_SUB_LC)
<API key> = 0x1e000004u, // (AAC_ADTS | AAC_SUB_SSR)
<API key> = 0x1e000008u, // (AAC_ADTS | AAC_SUB_LTP)
<API key> = 0x1e000010u, // (AAC_ADTS | AAC_SUB_HE_V1)
<API key> = 0x1e000020u, // (AAC_ADTS | AAC_SUB_SCALABLE)
<API key> = 0x1e000040u, // (AAC_ADTS | AAC_SUB_ERLC)
<API key> = 0x1e000080u, // (AAC_ADTS | AAC_SUB_LD)
<API key> = 0x1e000100u, // (AAC_ADTS | AAC_SUB_HE_V2)
<API key> = 0x1e000200u, // (AAC_ADTS | AAC_SUB_ELD)
<API key> = 0x1e000300u, // (AAC_ADTS | AAC_SUB_XHE)
<API key> = 0xA000001u, // (E_AC3 | E_AC3_SUB_JOC)
<API key> = 0x24000001u, // (MAT | MAT_SUB_1_0)
<API key> = 0x24000002u, // (MAT | MAT_SUB_2_0)
<API key> = 0x24000003u, // (MAT | MAT_SUB_2_1)
} audio_format_t;
enum {
FCC_2 = 2,
FCC_8 = 8,
};
enum {
<API key> = 0x0u,
<API key> = 0x2u,
AUDIO_CHANNEL_NONE = 0x0u,
<API key> = 0xC0000000u,
<API key> = 0x1u,
<API key> = 0x2u,
<API key> = 0x4u,
<API key> = 0x8u,
<API key> = 0x10u,
<API key> = 0x20u,
<API key> = 0x40u,
<API key> = 0x80u,
<API key> = 0x100u,
<API key> = 0x200u,
<API key> = 0x400u,
<API key> = 0x800u,
<API key> = 0x1000u,
<API key> = 0x2000u,
<API key> = 0x4000u,
<API key> = 0x8000u,
<API key> = 0x10000u,
<API key> = 0x20000u,
<API key> = 0x40000u,
<API key> = 0x80000u,
<API key> = 0x1u, // OUT_FRONT_LEFT
<API key> = 0x3u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT
<API key> = 0xBu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_LOW_FREQUENCY
<API key> = 0xC0003u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
<API key> = 0xC000Bu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT | OUT_LOW_FREQUENCY
<API key> = 0xC0007u, // OUT_FRONT_LEFT | OUT_FRONT_CENTER | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
<API key> = 0xC000Fu, // OUT_FRONT_LEFT | OUT_FRONT_CENTER | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT | OUT_LOW_FREQUENCY
<API key> = 0x33u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_BACK_LEFT | OUT_BACK_RIGHT
<API key> = 0x33u, // OUT_QUAD
<API key> = 0x603u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_SIDE_LEFT | OUT_SIDE_RIGHT
<API key> = 0x107u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_BACK_CENTER
<API key> = 0x37u, // OUT_QUAD | OUT_FRONT_CENTER
<API key> = 0x3Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT
<API key> = 0x3Fu, // OUT_5POINT1
<API key> = 0x60Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_SIDE_LEFT | OUT_SIDE_RIGHT
<API key> = 0xC003Fu, // OUT_5POINT1 | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
<API key> = 0x2D03Fu, // OUT_5POINT1 | OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT | OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT
<API key> = 0x13Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT | OUT_BACK_CENTER
<API key> = 0x63Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT | OUT_SIDE_LEFT | OUT_SIDE_RIGHT
<API key> = 0xC063Fu, // OUT_7POINT1 | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
<API key> = 0x2D63Fu, // OUT_7POINT1 | OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT | OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT
<API key> = 0x4u,
<API key> = 0x8u,
<API key> = 0x10u,
<API key> = 0x20u,
<API key> = 0x40u,
<API key> = 0x80u,
<API key> = 0x100u,
<API key> = 0x200u,
<API key> = 0x400u,
<API key> = 0x800u,
<API key> = 0x1000u,
<API key> = 0x2000u,
<API key> = 0x10000u,
<API key> = 0x20000u,
<API key> = 0x40000u,
<API key> = 0x100000u,
<API key> = 0x200000u,
<API key> = 0x400000u,
<API key> = 0x4000u,
<API key> = 0x8000u,
<API key> = 0x10u, // IN_FRONT
<API key> = 0xCu, // IN_LEFT | IN_RIGHT
<API key> = 0x30u, // IN_FRONT | IN_BACK
AUDIO_CHANNEL_IN_6 = 0xFCu, // IN_LEFT | IN_RIGHT | IN_FRONT | IN_BACK | IN_LEFT_PROCESSED | IN_RIGHT_PROCESSED
<API key> = 0x60000Cu, // IN_LEFT | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT
<API key> = 0x70000Cu, // IN_LEFT | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT | IN_LOW_FREQUENCY
<API key> = 0x64000Cu, // IN_LEFT | IN_CENTER | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT
<API key> = 0x74000Cu, // IN_LEFT | IN_CENTER | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT | IN_LOW_FREQUENCY
<API key> = 0x17000Cu, // IN_LEFT | IN_CENTER | IN_RIGHT | IN_BACK_LEFT | IN_BACK_RIGHT | IN_LOW_FREQUENCY
<API key> = 0x4010u, // IN_VOICE_UPLINK | IN_MONO
<API key> = 0x8010u, // IN_VOICE_DNLINK | IN_MONO
<API key> = 0xC010u, // <API key> | <API key>
<API key> = 30u,
<API key> = 0x80000000u, // <API key> << COUNT_MAX
<API key> = 0x80000001u, // INDEX_HDR | (1 << 1) - 1
<API key> = 0x80000003u, // INDEX_HDR | (1 << 2) - 1
<API key> = 0x80000007u, // INDEX_HDR | (1 << 3) - 1
<API key> = 0x8000000Fu, // INDEX_HDR | (1 << 4) - 1
<API key> = 0x8000001Fu, // INDEX_HDR | (1 << 5) - 1
<API key> = 0x8000003Fu, // INDEX_HDR | (1 << 6) - 1
<API key> = 0x8000007Fu, // INDEX_HDR | (1 << 7) - 1
<API key> = 0x800000FFu, // INDEX_HDR | (1 << 8) - 1
};
typedef enum {
#ifndef <API key>
AUDIO_MODE_INVALID = -2,
AUDIO_MODE_CURRENT = -1,
#endif // <API key>
AUDIO_MODE_NORMAL = 0,
AUDIO_MODE_RINGTONE = 1,
AUDIO_MODE_IN_CALL = 2,
<API key> = 3,
} audio_mode_t;
enum {
AUDIO_DEVICE_NONE = 0x0u,
AUDIO_DEVICE_BIT_IN = 0x80000000u,
<API key> = 0x40000000u,
<API key> = 0x1u,
<API key> = 0x2u,
<API key> = 0x4u,
<API key> = 0x8u,
<API key> = 0x10u,
<API key> = 0x20u,
<API key> = 0x40u,
<API key> = 0x80u,
<API key> = 0x100u,
<API key> = 0x200u,
<API key> = 0x400u,
<API key> = 0x400u, // OUT_AUX_DIGITAL
<API key> = 0x800u,
<API key> = 0x1000u,
<API key> = 0x2000u,
<API key> = 0x4000u,
<API key> = 0x8000u,
<API key> = 0x10000u,
<API key> = 0x20000u,
<API key> = 0x40000u,
<API key> = 0x80000u,
AUDIO_DEVICE_OUT_FM = 0x100000u,
<API key> = 0x200000u,
<API key> = 0x400000u,
AUDIO_DEVICE_OUT_IP = 0x800000u,
<API key> = 0x1000000u,
<API key> = 0x2000000u,
<API key> = 0x4000000u,
<API key> = 0x8000000u,
<API key> = 0x10000000u,
<API key> = 0x40000000u, // BIT_DEFAULT
<API key> = 0x80000001u, // BIT_IN | 0x1
<API key> = 0x80000002u, // BIT_IN | 0x2
<API key> = 0x80000004u, // BIT_IN | 0x4
<API key> = 0x80000008u, // BIT_IN | 0x8
<API key> = 0x80000010u, // BIT_IN | 0x10
<API key> = 0x80000020u, // BIT_IN | 0x20
<API key> = 0x80000020u, // IN_AUX_DIGITAL
<API key> = 0x80000040u, // BIT_IN | 0x40
<API key> = 0x80000040u, // IN_VOICE_CALL
<API key> = 0x80000080u, // BIT_IN | 0x80
<API key> = 0x80000100u, // BIT_IN | 0x100
<API key> = 0x80000200u, // BIT_IN | 0x200
<API key> = 0x80000400u, // BIT_IN | 0x400
<API key> = 0x80000800u, // BIT_IN | 0x800
<API key> = 0x80001000u, // BIT_IN | 0x1000
<API key> = 0x80002000u, // BIT_IN | 0x2000
<API key> = 0x80004000u, // BIT_IN | 0x4000
<API key> = 0x80008000u, // BIT_IN | 0x8000
<API key> = 0x80010000u, // BIT_IN | 0x10000
<API key> = 0x80020000u, // BIT_IN | 0x20000
<API key> = 0x80040000u, // BIT_IN | 0x40000
AUDIO_DEVICE_IN_IP = 0x80080000u, // BIT_IN | 0x80000
AUDIO_DEVICE_IN_BUS = 0x80100000u, // BIT_IN | 0x100000
<API key> = 0x81000000u, // BIT_IN | 0x1000000
<API key> = 0x82000000u, // BIT_IN | 0x2000000
<API key> = 0x84000000u, // BIT_IN | 0x4000000
<API key> = 0xC0000000u, // BIT_IN | BIT_DEFAULT
};
typedef enum {
<API key> = 0x0,
<API key> = 0x1,
<API key> = 0x2,
<API key> = 0x4,
<API key> = 0x8,
<API key> = 0x10,
<API key> = 0x20,
<API key> = 0x40,
<API key> = 0x80,
<API key> = 0x100,
<API key> = 0x200,
<API key> = 0x400,
<API key> = 0x2000,
<API key> = 0x4000,
<API key> = 0x8000,
<API key> = 0x10000,
} <API key>;
typedef enum {
<API key> = 0x0,
<API key> = 0x1,
<API key> = 0x2,
<API key> = 0x4,
<API key> = 0x8,
<API key> = 0x10,
<API key> = 0x20,
<API key> = 0x40,
} audio_input_flags_t;
typedef enum {
AUDIO_USAGE_UNKNOWN = 0,
AUDIO_USAGE_MEDIA = 1,
<API key> = 2,
<API key> = 3,
AUDIO_USAGE_ALARM = 4,
<API key> = 5,
<API key> = 6,
#ifndef <API key>
<API key> = 7,
<API key> = 8,
<API key> = 9,
<API key> = 10,
#endif // <API key>
<API key> = 11,
<API key> = 12,
<API key> = 13,
AUDIO_USAGE_GAME = 14,
<API key> = 15,
<API key> = 16,
} audio_usage_t;
typedef enum {
<API key> = 0u,
<API key> = 1u,
<API key> = 2u,
<API key> = 3u,
<API key> = 4u,
} <API key>;
enum {
<API key> = 0x1u,
<API key> = 0x2u,
<API key> = 0x4u,
};
typedef enum {
<API key> = 0,
<API key> = 1, // (::android::hardware::audio::common::V4_0::AudioPortRole.NONE implicitly + 1)
<API key> = 2, // (::android::hardware::audio::common::V4_0::AudioPortRole.SOURCE implicitly + 1)
} audio_port_role_t;
typedef enum {
<API key> = 0,
<API key> = 1, // (::android::hardware::audio::common::V4_0::AudioPortType.NONE implicitly + 1)
AUDIO_PORT_TYPE_MIX = 2, // (::android::hardware::audio::common::V4_0::AudioPortType.DEVICE implicitly + 1)
<API key> = 3, // (::android::hardware::audio::common::V4_0::AudioPortType.MIX implicitly + 1)
} audio_port_type_t;
enum {
<API key> = 0x1u,
<API key> = 0x2u,
<API key> = 0x4u,
<API key> = 0x8u,
};
typedef enum {
AUDIO_LATENCY_LOW = 0,
<API key> = 1, // (::android::hardware::audio::common::V4_0::<API key>.LOW implicitly + 1)
} <API key>;
#ifdef __cplusplus
}
#endif
#endif // <API key>
|
#ifndef _SPARC64_BITOPS_H
#define _SPARC64_BITOPS_H
#include <asm/byteorder.h>
extern long ___test_and_set_bit(unsigned long nr, volatile void *addr);
extern long <API key>(unsigned long nr, volatile void *addr);
extern long <API key>(unsigned long nr, volatile void *addr);
#define test_and_set_bit(nr,addr) ({___test_and_set_bit(nr,addr)!=0;})
#define test_and_clear_bit(nr,addr) ({<API key>(nr,addr)!=0;})
#define test_and_change_bit(nr,addr) ({<API key>(nr,addr)!=0;})
#define set_bit(nr,addr) ((void)___test_and_set_bit(nr,addr))
#define clear_bit(nr,addr) ((void)<API key>(nr,addr))
#define change_bit(nr,addr) ((void)<API key>(nr,addr))
/* "non-atomic" versions... */
#define __set_bit(X,Y) \
do { unsigned long __nr = (X); \
long *__m = ((long *) (Y)) + (__nr >> 6); \
*__m |= (1UL << (__nr & 63)); \
} while (0)
#define __clear_bit(X,Y) \
do { unsigned long __nr = (X); \
long *__m = ((long *) (Y)) + (__nr >> 6); \
*__m &= ~(1UL << (__nr & 63)); \
} while (0)
#define __change_bit(X,Y) \
do { unsigned long __nr = (X); \
long *__m = ((long *) (Y)) + (__nr >> 6); \
*__m ^= (1UL << (__nr & 63)); \
} while (0)
#define __test_and_set_bit(X,Y) \
({ unsigned long __nr = (X); \
long *__m = ((long *) (Y)) + (__nr >> 6); \
long __old = *__m; \
long __mask = (1UL << (__nr & 63)); \
*__m = (__old | __mask); \
((__old & __mask) != 0); \
})
#define <API key>(X,Y) \
({ unsigned long __nr = (X); \
long *__m = ((long *) (Y)) + (__nr >> 6); \
long __old = *__m; \
long __mask = (1UL << (__nr & 63)); \
*__m = (__old & ~__mask); \
((__old & __mask) != 0); \
})
#define <API key>(X,Y) \
({ unsigned long __nr = (X); \
long *__m = ((long *) (Y)) + (__nr >> 6); \
long __old = *__m; \
long __mask = (1UL << (__nr & 63)); \
*__m = (__old ^ __mask); \
((__old & __mask) != 0); \
})
#define <API key>() do { } while(0)
#define <API key>() do { } while(0)
extern __inline__ int test_bit(int nr, __const__ void *addr)
{
return (1UL & (((__const__ long *) addr)[nr >> 6] >> (nr & 63))) != 0UL;
}
/* The easy/cheese version for now. */
extern __inline__ unsigned long ffz(unsigned long word)
{
unsigned long result;
#ifdef <API key> /* Thanks for nothing Sun... */
__asm__ __volatile__(
" brz,pn %0, 1f\n"
" neg %0, %%g1\n"
" xnor %0, %%g1, %%g2\n"
" popc %%g2, %0\n"
"1: " : "=&r" (result)
: "0" (word)
: "g1", "g2");
#else
#if 1 /* def EASY_CHEESE_VERSION */
result = 0;
while(word & 1) {
result++;
word >>= 1;
}
#else
unsigned long tmp;
result = 0;
tmp = ~word & -~word;
if (!(unsigned)tmp) {
tmp >>= 32;
result = 32;
}
if (!(unsigned short)tmp) {
tmp >>= 16;
result += 16;
}
if (!(unsigned char)tmp) {
tmp >>= 8;
result += 8;
}
if (tmp & 0xf0) result += 4;
if (tmp & 0xcc) result += 2;
if (tmp & 0xaa) result ++;
#endif
#endif
return result;
}
#ifdef __KERNEL__
/*
* ffs: find first bit set. This is defined the same way as
* the libc and compiler builtin ffs routines, therefore
* differs in spirit from the above ffz (man ffs).
*/
#define ffs(x) generic_ffs(x)
/*
* hweightN: returns the hamming weight (i.e. the number
* of bits set) of a N-bit word
*/
#ifdef <API key>
extern __inline__ unsigned int hweight32(unsigned int w)
{
unsigned int res;
__asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffffffff));
return res;
}
extern __inline__ unsigned int hweight16(unsigned int w)
{
unsigned int res;
__asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffff));
return res;
}
extern __inline__ unsigned int hweight8(unsigned int w)
{
unsigned int res;
__asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xff));
return res;
}
#else
#define hweight32(x) generic_hweight32(x)
#define hweight16(x) generic_hweight16(x)
#define hweight8(x) generic_hweight8(x)
#endif
#endif /* __KERNEL__ */
/* find_next_zero_bit() finds the first zero bit in a bit string of length
* 'size' bits, starting the search at bit 'offset'. This is largely based
* on Linus's ALPHA routines, which are pretty portable BTW.
*/
extern __inline__ unsigned long find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
{
unsigned long *p = ((unsigned long *) addr) + (offset >> 6);
unsigned long result = offset & ~63UL;
unsigned long tmp;
if (offset >= size)
return size;
size -= result;
offset &= 63UL;
if (offset) {
tmp = *(p++);
tmp |= ~0UL >> (64-offset);
if (size < 64)
goto found_first;
if (~tmp)
goto found_middle;
size -= 64;
result += 64;
}
while (size & ~63UL) {
if (~(tmp = *(p++)))
goto found_middle;
result += 64;
size -= 64;
}
if (!size)
return result;
tmp = *p;
found_first:
tmp |= ~0UL << size;
if (tmp == ~0UL) /* Are any bits zero? */
return result + size; /* Nope. */
found_middle:
return result + ffz(tmp);
}
#define find_first_zero_bit(addr, size) \
find_next_zero_bit((addr), (size), 0)
extern long <API key>(int nr, volatile void *addr);
extern long <API key>(int nr, volatile void *addr);
#define test_and_set_le_bit(nr,addr) ({<API key>(nr,addr)!=0;})
#define <API key>(nr,addr) ({<API key>(nr,addr)!=0;})
#define set_le_bit(nr,addr) ((void)<API key>(nr,addr))
#define clear_le_bit(nr,addr) ((void)<API key>(nr,addr))
extern __inline__ int test_le_bit(int nr, __const__ void * addr)
{
int mask;
__const__ unsigned char *ADDR = (__const__ unsigned char *) addr;
ADDR += nr >> 3;
mask = 1 << (nr & 0x07);
return ((mask & *ADDR) != 0);
}
#define <API key>(addr, size) \
<API key>((addr), (size), 0)
extern __inline__ unsigned long <API key>(void *addr, unsigned long size, unsigned long offset)
{
unsigned long *p = ((unsigned long *) addr) + (offset >> 6);
unsigned long result = offset & ~63UL;
unsigned long tmp;
if (offset >= size)
return size;
size -= result;
offset &= 63UL;
if(offset) {
tmp = __swab64p(p++);
tmp |= (~0UL >> (64-offset));
if(size < 64)
goto found_first;
if(~tmp)
goto found_middle;
size -= 64;
result += 64;
}
while(size & ~63) {
if(~(tmp = __swab64p(p++)))
goto found_middle;
result += 64;
size -= 64;
}
if(!size)
return result;
tmp = __swab64p(p);
found_first:
tmp |= (~0UL << size);
if (tmp == ~0UL) /* Are any bits zero? */
return result + size; /* Nope. */
found_middle:
return result + ffz(tmp);
}
#ifdef __KERNEL__
#define ext2_set_bit test_and_set_le_bit
#define ext2_clear_bit <API key>
#define ext2_test_bit test_le_bit
#define <API key> <API key>
#define <API key> <API key>
/* Bitmap functions for the minix filesystem. */
#define <API key>(nr,addr) test_and_set_bit(nr,addr)
#define minix_set_bit(nr,addr) set_bit(nr,addr)
#define <API key>(nr,addr) test_and_clear_bit(nr,addr)
#define minix_test_bit(nr,addr) test_bit(nr,addr)
#define <API key>(addr,size) find_first_zero_bit(addr,size)
#endif /* __KERNEL__ */
#endif /* defined(_SPARC64_BITOPS_H) */
|
#ifndef <API key>
#define <API key>
/*
* consts
*/
/* The following rendering method is expected to engage in the renderer */
/** \brief available renderer type
*/
enum <API key> {
<API key>, /**< a memory block with undefined renderer */
RendererRasterizer, /**< rasterization renderer */
RendererPathTracer, /**< path tracing renderer */
<API key>, /**< photon tracing renderer */
RendererPhotonMap, /**< photon light map generation renderer */
RendererRadiosity, /**< radiosity light map generation renderer */
<API key>, /**< radiance cache generation renderer */
RendererPRT, /**< precomputed radiance transfer renderer */
RendererSelection, /**< object selection renderer */
c_NumRendererType
};
static const int LightModelDirect = 0X1;
static const int LightModelShadow = 0X2;
static const int LightModelLightMap = 0X4;
static const int LightModelSHProbe = 0X8;
static const int LightModelSVO = 0X10;
enum GeometryModelType {
<API key>,
GeometryModelSolid
};
/* Renderer should not handle threading from these constants itself,
* this are the states telling which situation
* the renderer is being created with */
static const int RenderThreadMutual = 0X0;
static const int <API key> = 0X1;
/* These are what renderer expected to behave internally */
static const int RenderThreadSingle = 0X2;
static const int <API key> = 0X4;
enum RenderSpecType {
RenderSpecSWBuiltin,
<API key>,
RenderSpecHWOpenGL,
RenderSpecHWDirectX
};
enum RenderEnvironment {
RenderEnvVoid,
RenderEnvSpec,
RenderEnvProbe,
RenderEnvRenderable,
RenderEnvRenderOut,
RenderEnvThread,
RenderEnvAntialias,
RenderEnvFiltering,
<API key>,
<API key>,
<API key>
};
#endif // <API key>
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
namespace VariablesManager
{
public partial class Form1 : Form
{
private string _selectedTm;
private string _selectedLrt;
public string SelectedTm
{
get => _selectedTm.Trim();
set => _selectedTm = value;
}
public string SelectedLrt
{
get => _selectedLrt.Trim();
set => _selectedLrt = value;
}
public Form1()
{
InitializeComponent();
}
private void btnBrowseTM_Click(object sender, EventArgs e)
{
openFileDialog.Filter = @"Translation memory (*.sdltm)|*.sdltm";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
SelectedTm = openFileDialog.FileName;
txtTM.Text = Path.GetFileName(openFileDialog.FileName);
}
}
private void btnBrowseLRT_Click(object sender, EventArgs e)
{
openFileDialog.Filter = @"Language Resource Template (*.resource)|*.resource";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
SelectedLrt = openFileDialog.FileName;
txtLRT.Text = Path.GetFileName(openFileDialog.FileName);
}
}
private void <API key>(object sender, EventArgs e)
{
openFileDialog.Filter = @"Text files (*.txt)|*.txt|All files (*.*)|*.*";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
try
{
using (var sr = new StreamReader(openFileDialog.FileName))
{
txtVariables.Text = sr.ReadToEnd();
}
}
catch
{
}
}
}
private void <API key>(object sender, EventArgs e)
{
saveFileDialog.Filter = @"Text files (*.txt)|*.txt|All files (*.*)|*.*";
saveFileDialog.DefaultExt = "txt";
saveFileDialog.AddExtension = true;
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
try
{
using (var sw = new StreamWriter(saveFileDialog.FileName, false))
{
sw.Write(txtVariables.Text);
}
}
catch
{
}
}
MessageBox.Show(@"The variables list was exported to the selected file.");
}
private void btnFetchList_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtTM.Text))
{
FetchFromTm();
}
if (!string.IsNullOrEmpty(txtLRT.Text))
{
FetchFromLrt();
}
}
private void FetchFromLrt()
{
if (string.IsNullOrEmpty(SelectedLrt))
return;
var vars = <API key>();
if (string.IsNullOrEmpty(vars))
return;
if (!string.IsNullOrEmpty(txtVariables.Text) &&
txtVariables.Text[txtVariables.Text.Length - 1] != '\n')
txtVariables.Text += "\r\n";
txtVariables.Text += vars;
}
private string <API key>()
{
try
{
var xFinalDoc = new XmlDocument();
xFinalDoc.Load(SelectedLrt);
XmlNodeList languageResources = xFinalDoc.DocumentElement.<API key>("LanguageResource");
if (languageResources.Count > 0)
{
foreach (XmlElement languageResource in languageResources)
{
if (languageResource.HasAttribute("Type") &&
languageResource.Attributes["Type"].Value == "Variables")
{
IEnumerable<XmlText> textElements = languageResource.ChildNodes.OfType<XmlText>();
if (textElements.Any())
{
var textElement = textElements.FirstOrDefault();
var base64Vars = textElement.Value;
return Encoding.UTF8.GetString(Convert.FromBase64String(base64Vars));
}
}
}
}
}
catch
{
}
return string.Empty;
}
private void FetchFromTm()
{
if (string.IsNullOrEmpty(txtTM.Text) || string.IsNullOrEmpty(SelectedTm))
return;
int count = 0;
var vars = <API key>(out count);
if (string.IsNullOrEmpty(vars))
return;
if (!string.IsNullOrEmpty(txtVariables.Text) && txtVariables.Text[txtVariables.Text.Length - 1] != '\n')
txtVariables.Text += "\r\n";
txtVariables.Text += vars;
}
private string <API key>(out int count)
{
count = 0;
try
{
<API key> sb = new <API key>();
sb.DataSource = SelectedTm;
sb.Version = 3;
sb.JournalMode = <API key>.Off;
using (var connection = new SQLiteConnection(sb.ConnectionString, true))
using (var command = new SQLiteCommand(connection))
{
connection.Open();
command.CommandText = "SELECT data FROM resources where type = 1";
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
count++;
var buffer = GetBytes(reader);
return Encoding.UTF8.GetString(buffer);
}
}
}
}
catch
{
}
return string.Empty;
}
static byte[] GetBytes(SQLiteDataReader reader)
{
const int CHUNK_SIZE = 2 * 1024;
var buffer = new byte[CHUNK_SIZE];
long bytesRead;
long fieldOffset = 0;
using (MemoryStream stream = new MemoryStream())
{
while ((bytesRead = reader.GetBytes(0, fieldOffset, buffer, 0, buffer.Length)) > 0)
{
stream.Write(buffer, 0, (int)bytesRead);
fieldOffset += bytesRead;
}
return stream.ToArray();
}
}
private void <API key>(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtTM.Text))
AddToTm();
if (!string.IsNullOrEmpty(txtLRT.Text))
AddToLrt();
}
private void AddToLrt()
{
if (string.IsNullOrEmpty(SelectedLrt) || string.IsNullOrEmpty(txtVariables.Text))
return;
var vars = <API key>() + txtVariables.Text;
if (!string.IsNullOrEmpty(vars) && vars[vars.Length - 1] != '\n')
vars += "\r\n";
var base64Vars = Convert.ToBase64String(Encoding.UTF8.GetBytes(vars));
SetVariablesInLrt(base64Vars);
MessageBox.Show(@"The variables list was add to the selected Language Resource Template.");
}
private void SetVariablesInLrt(string base64Vars)
{
try
{
var xFinalDoc = new XmlDocument();
xFinalDoc.Load(SelectedLrt);
XmlNodeList languageResources = xFinalDoc.DocumentElement.<API key>("LanguageResource");
if (languageResources.Count > 0)
{
foreach (XmlElement languageResource in languageResources)
{
if (languageResource.HasAttribute("Type") &&
languageResource.Attributes["Type"].Value == "Variables")
{
languageResource.InnerText = base64Vars;
}
}
}
using (var writer = new XmlTextWriter(SelectedLrt, null))
{
writer.Formatting = Formatting.None;
xFinalDoc.Save(writer);
}
}
catch
{
}
}
private void AddToTm()
{
if (string.IsNullOrEmpty(SelectedTm) || string.IsNullOrEmpty(txtVariables.Text))
return;
int count = 0;
var vars = <API key>(out count) + txtVariables.Text;
if (!string.IsNullOrEmpty(vars) && vars[vars.Length - 1] != '\n')
vars += "\r\n";
SetVariablesInTm(Encoding.UTF8.GetBytes(vars), count);
MessageBox.Show(@"The variables list was add to the selected Translation Memory.");
}
private void SetVariablesInTm(byte[] variablesAsBytes, int count)
{
try
{
var sb = new <API key>
{
DataSource = SelectedTm,
Version = 3,
JournalMode = <API key>.Off
};
int maxID = 0;
if (count == 0)
{
using (var connection = new SQLiteConnection(sb.ConnectionString, true))
{
using (var command = new SQLiteCommand(connection))
{
connection.Open();
command.CommandText = "Select max(id) from resources";
object oId = command.ExecuteScalar();
maxID = oId == DBNull.Value ? 1 : Convert.ToInt32(oId) + 1;
}
}
}
using (var connection = new SQLiteConnection(sb.ConnectionString, true))
{
using (var command = new SQLiteCommand(connection))
{
connection.Open();
if (count == 0)
{
command.CommandText =
string.Format(
"insert into resources (rowid, id, guid, type, language, data) values ({2}, {2}, '{0}', 1, '{1}', @data)",
Guid.NewGuid(), GetTmLanguage(), maxID);
}
else
{
command.CommandText = "update resources set data = @data where type = 1";
}
command.Parameters.Add("@data", DbType.Binary).Value = variablesAsBytes;
command.ExecuteNonQuery();
}
}
}
catch (Exception e)
{
}
}
private object GetTmLanguage()
{
try
{
var sb = new <API key>
{
DataSource = SelectedTm,
Version = 3,
JournalMode = <API key>.Off
};
using (var connection = new SQLiteConnection(sb.ConnectionString, true))
using (var command = new SQLiteCommand(connection))
{
connection.Open();
command.CommandText = "SELECT source_language FROM <API key>";
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
return reader.GetString(0);
}
}
}
}
catch
{
}
return string.Empty;
}
private void <API key>(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtTM.Text))
{
ReplaceToTm();
}
if (!string.IsNullOrEmpty(txtLRT.Text))
{
ReplaceToLrt();
}
}
private void ReplaceToLrt()
{
if (string.IsNullOrEmpty(SelectedLrt))
{
return;
}
var vars = txtVariables.Text;
if (!string.IsNullOrEmpty(vars) && vars[vars.Length - 1] != '\n')
{
vars += "\r\n";
}
var base64Vars = Convert.ToBase64String(Encoding.UTF8.GetBytes(vars));
SetVariablesInLrt(base64Vars);
MessageBox.Show(@"The variables list from the selected Language Resource Template was replaced with the new one.");
}
private void ReplaceToTm()
{
if (string.IsNullOrEmpty(SelectedTm))
return;
var vars = txtVariables.Text;
if (!string.IsNullOrEmpty(vars) && vars[vars.Length - 1] != '\n')
vars += "\r\n";
var count = 0;
<API key>(out count);
SetVariablesInTm(Encoding.UTF8.GetBytes(vars), count);
MessageBox.Show(@"The variables list from the selected Translation Memory was replaced with the new one.");
}
private void btnClear_Click(object sender, EventArgs e)
{
txtVariables.Clear();
}
}
}
|
/* IEEE754 floating point arithmetic
* single precision
*/
#include "ieee754sp.h"
/* close to ieeep754sp_logb
*/
ieee754sp ieee754sp_frexp(ieee754sp x, int *eptr)
{
COMPXSP;
CLEARCX;
EXPLODEXSP;
switch (xc) {
case IEEE754_CLASS_SNAN:
case IEEE754_CLASS_QNAN:
case IEEE754_CLASS_INF:
case IEEE754_CLASS_ZERO:
*eptr = 0;
return x;
case IEEE754_CLASS_DNORM:
SPDNORMX;
break;
case IEEE754_CLASS_NORM:
break;
}
*eptr = xe + 1;
return buildsp(xs, -1 + SP_EBIAS, xm & ~SP_HIDDEN_BIT);
}
|
<?php
include_once "./_common.php";
//pc . PC . /extend/g4m.config.php .
if($_GET['from'] == 'pc'){
set_session("frommoblie", "");
}
include_once './_head.php';
$sql = " select bo_table, bo_subject,bo_m_latest_skin from {$g4['board_table']} where bo_m_use='1' order by gr_id, bo_m_sort, bo_table ";
$result = sql_query($sql);
for ($i = 0; $row = sql_fetch_array($result); $i++) {
echo g4m_latest($row['bo_m_latest_skin'], $row['bo_table']);
}
include_once './_tail.php';
?>
|
#ifndef MATRIX_SPMATRIX_H
#define MATRIX_SPMATRIX_H
#include "dgeMatrix.h"
#include "R_ext/Lapack.h"
SEXP dspMatrix_validate(SEXP obj);
double get_norm_sp(SEXP obj, const char *typstr);
SEXP dspMatrix_norm(SEXP obj, SEXP type);
SEXP dspMatrix_rcond(SEXP obj, SEXP type);
SEXP dspMatrix_solve(SEXP a);
SEXP <API key>(SEXP a, SEXP b);
SEXP dspMatrix_getDiag(SEXP x);
SEXP lspMatrix_getDiag(SEXP x);
SEXP dspMatrix_setDiag(SEXP x, SEXP d);
SEXP lspMatrix_setDiag(SEXP x, SEXP d);
SEXP <API key>(SEXP from);
SEXP dspMatrix_matrix_mm(SEXP a, SEXP b);
SEXP dspMatrix_trf(SEXP x);
#endif
|
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>ToPS: tops::<API key> Class Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">ToPS
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="../../index.html"><span>Main Page</span></a></li>
<li class="current"><a href="../../annotated.html"><span>Classes</span></a></li>
<li><a href="../../files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="../../annotated.html"><span>Class List</span></a></li>
<li><a href="../../hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="../../functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>tops</b> </li>
<li class="navelem"><a class="el" href="<API key>.html"><API key></a> </li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="<API key>.html#pub-methods">Public Member Functions</a> </div>
<div class="headertitle">
<div class="title">tops::<API key> Class Reference</div> </div>
</div><!--header
<div class="contents">
<p>This is a class representing Hidden semi-Markov Models.
<a href="<API key>.html#details">More...</a></p>
<p><code>#include <<a class="el" href="../../d3/ddd/<API key>.html"><API key>.hpp</a>></code></p>
<div class="dynheader">
Inheritance diagram for tops::<API key>:</div>
<div class="dyncontent">
<div class="center">
<img src="<API key>.png" usemap="#tops::<API key>" alt=""/>
<map id="tops::<API key>" name="tops::<API key>">
<area href="../../d6/db0/<API key>.html" title="Interface defining probabilistic model with the viterbi, forward and backward algorithm." alt="tops::DecodableModel" shape="rect" coords="0,56,227,80"/>
<area href="../../d4/d17/<API key>.html" title="This is an abstract class representing a generative probabilistic model." alt="tops::ProbabilisticModel" shape="rect" coords="0,0,227,24"/>
</map>
</div></div>
<p><a href="../../d2/d61/<API key>.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a>
virtual double </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">forward</a> (const Sequence &s, Matrix &alpha) const </td></tr>
<tr class="memdesc:<API key>"><td class="mdescLeft"> </td><td class="mdescRight">Forward algorithm. <br/></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a>
virtual double </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">backward</a> (const Sequence &s, Matrix &beta) const </td></tr>
<tr class="memdesc:<API key>"><td class="mdescLeft"> </td><td class="mdescRight">Backward algorithm. <br/></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a>
virtual double </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">viterbi</a> (const Sequence &s, Sequence &path, Matrix &gamma) const </td></tr>
<tr class="memdesc:<API key>"><td class="mdescLeft"> </td><td class="mdescRight">Viterbi algorithm. <br/></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a>
virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">choosePath</a> (const Sequence &s, Sequence &path)</td></tr>
<tr class="memdesc:<API key>"><td class="mdescLeft"> </td><td class="mdescRight">Choose a path given a sequence_length. <br/></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a>
virtual double </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">_viterbi</a> (const Sequence &s, Sequence &path, Matrix &gamma) const </td></tr>
<tr class="memdesc:<API key>"><td class="mdescLeft"> </td><td class="mdescRight">Inefficient Viterbi algorithm. <br/></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a>
virtual Sequence & </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">chooseObservation</a> (Sequence &h, int i, int state) const </td></tr>
<tr class="memdesc:<API key>"><td class="mdescLeft"> </td><td class="mdescRight">Choose the observation given a state. <br/></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a>
virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">chooseState</a> (int state) const </td></tr>
<tr class="memdesc:<API key>"><td class="mdescLeft"> </td><td class="mdescRight">Choose a state. <br/></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a>
virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">chooseFirstState</a> () const </td></tr>
<tr class="memdesc:<API key>"><td class="mdescLeft"> </td><td class="mdescRight">Choose the initial state. <br/></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a>
virtual DiscreteIIDModelPtr </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>"><API key></a> () const </td></tr>
<tr class="memdesc:<API key>"><td class="mdescLeft"> </td><td class="mdescRight">Choose the initial state. <br/></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a>
virtual std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">getStateName</a> (int state) const </td></tr>
<tr class="memdesc:<API key>"><td class="mdescLeft"> </td><td class="mdescRight">Get state name. <br/></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a>
virtual AlphabetPtr </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">getStateNames</a> () const </td></tr>
<tr class="memdesc:<API key>"><td class="mdescLeft"> </td><td class="mdescRight">Get the state names. <br/></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a>
virtual std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">model_name</a> () const </td></tr>
<tr class="memdesc:<API key>"><td class="mdescLeft"> </td><td class="mdescRight">returns the model name <br/></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a>
virtual std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">str</a> () const </td></tr>
<tr class="memdesc:<API key>"><td class="mdescLeft"> </td><td class="mdescRight">returns the string representation of the model <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>This is a class representing Hidden semi-Markov Models. </p>
<p>Definition at line <a class="el" href="../../d3/ddd/<API key>.html#l00045">45</a> of file <a class="el" href="../../d3/ddd/<API key>.html"><API key>.hpp</a>.</p>
</div><hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="../../d3/ddd/<API key>.html"><API key>.hpp</a></li>
<li><a class="el" href="../../d1/da2/<API key>.html"><API key>.cpp</a></li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Jun 28 2012 14:40:27 for ToPS by &
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
|
package org.mo.game.editor.face.apl.logic.form;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.HeaderFooter;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
import java.awt.Color;
import java.io.<API key>;
import java.io.IOException;
import org.mo.com.lang.FFatalError;
import org.mo.com.lang.RString;
import org.mo.com.logging.ILogger;
import org.mo.com.logging.RLogger;
import org.mo.com.validator.RStringValidator;
import org.mo.com.xml.FXmlNode;
import org.mo.com.xml.IXmlObject;
import org.mo.core.aop.face.ALink;
import org.mo.eng.data.common.ISqlContext;
import org.mo.web.core.servlet.common.IWebServletResponse;
import org.mo.web.core.webform.FWebFormDatasetArgs;
import org.mo.web.core.webform.IWebFormConsole;
import org.mo.web.core.webform.<API key>;
import org.mo.web.protocol.context.IWebContext;
public class FWebFormPdfServlet
implements
IWebFormPdfServlet{
private static ILogger _logger = RLogger.find(FWebFormPdfServlet.class);
public static byte[] creatPdf(FXmlNode dsNode,
IXmlObject formNode){
// Document
Rectangle rectPageSize = new Rectangle(PageSize.A4);
rectPageSize = rectPageSize.rotate();
Document document = new Document(rectPageSize, 50, 30, 30, 30);
<API key> buffer = new <API key>();
try{
// HelloWorld.pdf
PdfWriter.getInstance(document, buffer);
BaseFont bfChinese;
try{
bfChinese = BaseFont.createFont("STSongStd-Light", "UniGB-UCS2-H", false);
}catch(IOException e){
throw new FFatalError(e);
}
Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.red);
document.open();
Paragraph par = new Paragraph(formNode.innerGet("label"), fontChinese);
document.add(par);
int tableColumns = formNode.children().count();
PdfPTable datatable = new PdfPTable(tableColumns);
// int headerwidths[] = { 9, 4, 8, 10, 8, 7 }; // percentage
// datatable.setWidths(headerwidths);
datatable.setWidthPercentage(100);
datatable.getDefaultCell().setPadding(2);
datatable.getDefaultCell().setBorderWidth(1);
datatable.getDefaultCell().setGrayFill(0.8f);
datatable.getDefaultCell().<API key>(Element.ALIGN_CENTER);
for(int i = 0; i < tableColumns; i++){
datatable.addCell(new Phrase(formNode.children().get(i).innerGet("label"), fontChinese));
}
datatable.setHeaderRows(1);
HeaderFooter footer = new HeaderFooter(new Phrase("", fontChinese), true);
footer.setBorder(Rectangle.NO_BORDER);
document.setFooter(footer);
int i = 1;
datatable.getDefaultCell().setBorderWidth(1);
for(FXmlNode row : dsNode.nodes()){
if(i % 2 == 1){
datatable.getDefaultCell().setGrayFill(1.0f);
}
for(int x = 0; x < tableColumns; x++){
String columnName = formNode.children().get(x).innerGet("data_name");
datatable.addCell(new Phrase(row.get(columnName), fontChinese));
}
if(i % 2 == 1){
datatable.getDefaultCell().setGrayFill(0.9f);
}
i++;
}
document.add(datatable);
}catch(DocumentException de){
de.printStackTrace();
System.err.println("document: " + de.getMessage());
}finally{
document.close();
}
return buffer.toByteArray();
}
@ALink
protected IWebFormConsole _webformConsole;
@ALink
<API key> _webFormDataConsole;
@Override
public void build(IWebContext context,
ISqlContext sqlContext,
IWebServletResponse response){
String formName = context.parameter("form_name");
RStringValidator.checkEmpty(formName, "form_name");
IXmlObject xform = findForm(formName);
FWebFormDatasetArgs args = new FWebFormDatasetArgs(context, sqlContext);
args.setPageSize(-1);
xform.children().get(0).innerGet("label");
args.setForm(xform);
FXmlNode dsNode = _webFormDataConsole.fetchNode(args);
// PDF
byte[] bytes = creatPdf(dsNode, xform);
_logger.debug(this, "build", "Make form pdf file. (form={0}, pdf size={1})", xform.name(), bytes.length);
response.write(bytes);
}
public IXmlObject findForm(String formName){
IXmlObject xform = null;
if(RString.isNotEmpty(formName)){
xform = _webformConsole.find(formName);
if(null == xform){
throw new FFatalError("Show form is null. (name={0})", formName);
}
}
return xform;
}
}
|
/*
Syntax error: File to import not found or unreadable: zen.
Load paths:
/Applications/MAMP/htdocs/kwealth/sites/all/themes/frodo/sass
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/frameworks/compass/stylesheets
Compass::SpriteImporter
on line 98 of /Applications/MAMP/htdocs/kwealth/sites/all/themes/frodo/sass/_base.scss
from line 12 of /Applications/MAMP/htdocs/kwealth/sites/all/themes/frodo/sass/layouts/responsive-sidebars.scss
from line 11 of /Applications/MAMP/htdocs/kwealth/sites/all/themes/frodo/sass/layouts/<API key>.scss
Backtrace:
/Applications/MAMP/htdocs/kwealth/sites/all/themes/frodo/sass/_base.scss:98
/Applications/MAMP/htdocs/kwealth/sites/all/themes/frodo/sass/layouts/responsive-sidebars.scss:12
/Applications/MAMP/htdocs/kwealth/sites/all/themes/frodo/sass/layouts/<API key>.scss:11
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/import_node.rb:67:in `import'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/import_node.rb:28:in `imported_file'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/import_node.rb:37:in `css_import?'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:217:in `visit_import'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/base.rb:37:in `send'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/base.rb:37:in `visit'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:100:in `visit'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:227:in `visit_import'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:227:in `map'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:227:in `visit_import'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/base.rb:37:in `send'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/base.rb:37:in `visit'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:100:in `visit'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:227:in `visit_import'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:227:in `map'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:227:in `visit_import'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/base.rb:37:in `send'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/base.rb:37:in `visit'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:100:in `visit'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/base.rb:53:in `visit_children'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/base.rb:53:in `map'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/base.rb:53:in `visit_children'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:109:in `visit_children'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:121:in `with_environment'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:108:in `visit_children'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/base.rb:37:in `visit'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:128:in `visit_root'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/base.rb:37:in `send'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/base.rb:37:in `visit'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:100:in `visit'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:7:in `send'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/visitors/perform.rb:7:in `visit'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/tree/root_node.rb:20:in `render'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/engine.rb:315:in `_render'
/Library/Ruby/Gems/1.8/gems/sass-3.2.9/lib/sass/../sass/engine.rb:262:in `render'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/compiler.rb:146:in `compile'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/compiler.rb:132:in `timed'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/compiler.rb:145:in `compile'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/logger.rb:46:in `red'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/compiler.rb:144:in `compile'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/compiler.rb:124:in `compile_if_required'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/compiler.rb:109:in `run'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/compiler.rb:107:in `each'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/compiler.rb:107:in `run'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/compiler.rb:132:in `timed'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/compiler.rb:106:in `run'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/commands/update_project.rb:45:in `perform'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/commands/base.rb:18:in `execute'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/commands/project_base.rb:19:in `execute'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/exec/sub_command_ui.rb:43:in `perform!'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/lib/compass/exec/sub_command_ui.rb:15:in `run!'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/bin/compass:30
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/bin/compass:44:in `call'
/Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/bin/compass:44
/usr/bin/compass:19:in `load'
/usr/bin/compass:19
*/
body:before {
white-space: pre;
font-family: monospace;
content: "Syntax error: File to import not found or unreadable: zen.\A Load paths:\A /Applications/MAMP/htdocs/kwealth/sites/all/themes/frodo/sass\A /Library/Ruby/Gems/1.8/gems/compass-0.13.alpha.4/frameworks/compass/stylesheets\A Compass::SpriteImporter\A on line 98 of /Applications/MAMP/htdocs/kwealth/sites/all/themes/frodo/sass/_base.scss\A from line 12 of /Applications/MAMP/htdocs/kwealth/sites/all/themes/frodo/sass/layouts/responsive-sidebars.scss\A from line 11 of /Applications/MAMP/htdocs/kwealth/sites/all/themes/frodo/sass/layouts/<API key>.scss"; }
|
<?php
# Lifter007: TODO
# Lifter003: TODO
# Lifter010: TODO
require_once 'studip_controller.php';
abstract class <API key> extends StudipController {
/**
* Callback function being called before an action is executed. If this
* function does not return FALSE, the action will be called, otherwise
* an error will be generated and processing will be aborted. If this function
* already #rendered or #redirected, further processing of the action is
* withheld.
*
* @param string Name of the action to perform.
* @param array An array of arguments to the action.
*
* @return bool
*/
function before_filter(&$action, &$args) {
parent::before_filter($action, $args);
# open session
page_open(array('sess' => 'Seminar_Session',
'auth' => 'Seminar_Auth',
'perm' => 'Seminar_Perm',
'user' => 'Seminar_User'));
// show login-screen, if authentication is "nobody"
$GLOBALS['auth']->login_if($GLOBALS['auth']->auth['uid'] == 'nobody');
$this->flash = Trails_Flash::instance();
// set up user session
include 'lib/seminar_open.php';
# Set base layout
# If your controller needs another layout, overwrite your controller's
# before filter:
# class YourController extends <API key> {
# function before_filter(&$action, &$args) {
# parent::before_filter($action, $args);
# $this->set_layout("your_layout");
# or unset layout by sending:
# $this->set_layout(NULL)
$this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
}
/**
* Callback function being called after an action is executed.
*
* @param string Name of the action to perform.
* @param array An array of arguments to the action.
*
* @return void
*/
function after_filter($action, $args) {
page_close();
}
}
|
package com.freedomotic.api;
import com.google.inject.AbstractModule;
import com.google.inject.Singleton;
/**
*
* @author Enrico Nicoletti
*/
public class InjectorApi extends AbstractModule {
@Override
protected void configure() {
bind(API.class).to(APIStandardImpl.class).in(Singleton.class);
}
}
|
<?php
/*
* Adapted from <API key> class by Stephen Clay <steve@mrclay.org>
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
class ZenUriRewriter
{
/**
* Defines which class to call as part of callbacks, change this
* if you extend <API key>
* @var string
*/
protected static $className = 'ZenUriRewriter';
/**
* rewrite() and rewriteRelative() append debugging information here
* @var string
*/
public static $debugText = '';
/**
* Rewrite file relative URIs as root relative in CSS files
*
* @param string $css
*
* @param string $currentDir The directory of the current CSS file.
*
* @param string $docRoot The document root of the web site in which
* the CSS file resides (default = $_SERVER['DOCUMENT_ROOT']).
*
* @param array $symlinks (default = array()) If the CSS file is stored in
* a symlink-ed directory, provide an array of link paths to
* target paths, where the link paths are within the document root. Because
* paths need to be normalized for this to work, use "//" to substitute
* the doc root in the link paths (the array keys). E.g.:
* <code>
* array('//symlink' => '/real/target/path') // unix
* array('//static' => 'D:\\staticStorage') // Windows
* </code>
*
* @return string
*/
public static function rewrite($css, $currentDir, $docRoot = null, $symlinks = array())
{
self::$_docRoot = self::_realpath(
$docRoot ? $docRoot : $_SERVER['DOCUMENT_ROOT']
);
self::$_currentDir = self::_realpath($currentDir);
self::$_symlinks = array();
// normalize symlinks
foreach ($symlinks as $link => $target) {
$link = ($link === '
? self::$_docRoot
: str_replace('//', self::$_docRoot . '/', $link);
$link = strtr($link, '/', DIRECTORY_SEPARATOR);
self::$_symlinks[$link] = self::_realpath($target);
}
self::$debugText .= "docRoot : " . self::$_docRoot . "\n"
. "currentDir : " . self::$_currentDir . "\n";
if (self::$_symlinks) {
self::$debugText .= "symlinks : " . var_export(self::$_symlinks, 1) . "\n";
}
self::$debugText .= "\n";
$css = self::_trimUrls($css);
// rewrite
$css = <API key>('/@import\\s+([\'"])(.*?)[\'"]/'
, array(self::$className, '_processUriCB'), $css);
$css = <API key>('/url\\(\\s*([^\\)\\s]+)\\s*\\)/'
, array(self::$className, '_processUriCB'), $css);
return $css;
}
/**
* Prepend a path to relative URIs in CSS files
*
* @param string $css
*
* @param string $path The path to prepend.
*
* @return string
*/
public static function prepend($css, $path)
{
self::$_prependPath = $path;
$css = self::_trimUrls($css);
// append
$css = <API key>('/@import\\s+([\'"])(.*?)[\'"]/'
, array(self::$className, '_processUriCB'), $css);
$css = <API key>('/url\\(\\s*([^\\)\\s]+)\\s*\\)/'
, array(self::$className, '_processUriCB'), $css);
self::$_prependPath = null;
return $css;
}
/**
* @var string directory of this stylesheet
*/
private static $_currentDir = '';
/**
* @var string DOC_ROOT
*/
private static $_docRoot = '';
/**
* @var array directory replacements to map symlink targets back to their
* source (within the document root) E.g. '/var/www/symlink' => '/var/realpath'
*/
private static $_symlinks = array();
/**
* @var string path to prepend
*/
private static $_prependPath = null;
private static function _trimUrls($css)
{
return preg_replace('/
url\\( # url(
\\s*
([^\\)]+?) # 1 = URI (assuming does not contain ")")
\\s*
\\)
/x', 'url($1)', $css);
}
private static function _processUriCB($m)
{
// $m matched either '/@import\\s+([\'"])(.*?)[\'"]/' or '/url\\(\\s*([^\\)\\s]+)\\s*\\)/'
$isImport = ($m[0][0] === '@');
// determine URI and the quote character (if any)
if ($isImport) {
$quoteChar = $m[1];
$uri = $m[2];
} else {
// $m[1] is either quoted or not
$quoteChar = ($m[1][0] === "'" || $m[1][0] === '"')
? $m[1][0]
: '';
$uri = ($quoteChar === '')
? $m[1]
: substr($m[1], 1, strlen($m[1]) - 2);
}
// analyze URI
if ('/' !== $uri[0] // root-relative
&& false === strpos($uri, '//') // protocol (non-data)
&& 0 !== strpos($uri, 'data:') // data protocol
) {
// URI is file-relative: rewrite depending on options
$uri = (self::$_prependPath !== null)
? (self::$_prependPath . $uri)
: self::rewriteRelative($uri, self::$_currentDir, self::$_docRoot, self::$_symlinks);
}
return $isImport
? "@import {$quoteChar}{$uri}{$quoteChar}"
: "url({$quoteChar}{$uri}{$quoteChar})";
}
/**
* Rewrite a file relative URI as root relative
*
* <code>
* <API key>::rewriteRelative(
* '../img/hello.gif'
* , '/home/user/www/css' // path of CSS file
* , '/home/user/www' // doc root
*);
* // returns '/img/hello.gif'
*
* // example where static files are stored in a symlinked directory
* <API key>::rewriteRelative(
* 'hello.gif'
* , '/var/staticFiles/theme'
* , '/home/user/www'
* , array('/home/user/www/static' => '/var/staticFiles')
*);
* // returns '/static/theme/hello.gif'
* </code>
*
* @param string $uri file relative URI
*
* @param string $realCurrentDir realpath of the current file's directory.
*
* @param string $realDocRoot realpath of the site document root.
*
* @param array $symlinks (default = array()) If the file is stored in
* a symlink-ed directory, provide an array of link paths to
* real target paths, where the link paths "appear" to be within the document
* root. E.g.:
* <code>
* array('/home/foo/www/not/real/path' => '/real/target/path') // unix
* array('C:\\htdocs\\not\\real' => 'D:\\real\\target\\path') // Windows
* </code>
*
* @return string
*/
public static function rewriteRelative($uri, $realCurrentDir, $realDocRoot, $symlinks = array())
{
// prepend path with current dir separator (OS-independent)
$path = strtr($realCurrentDir, '/', DIRECTORY_SEPARATOR)
. DIRECTORY_SEPARATOR . strtr($uri, '/', DIRECTORY_SEPARATOR);
self::$debugText .= "file-relative URI : {$uri}\n"
. "path prepended : {$path}\n";
// "unresolve" a symlink back to doc root
foreach ($symlinks as $link => $target) {
if (0 === strpos($path, $target)) {
// replace $target with $link
$path = $link . substr($path, strlen($target));
self::$debugText .= "symlink unresolved : {$path}\n";
break;
}
}
// strip doc root
$path = substr($path, strlen($realDocRoot));
self::$debugText .= "docroot stripped : {$path}\n";
// fix to root-relative URI
$uri = strtr($path, '/\\', '
// remove /./ and /../ where possible
$uri = str_replace('/./', '/', $uri);
// inspired by patch from Oleg Cherniy
do {
$uri = preg_replace('@/[^/]+/\\.\\./@', '/', $uri, 1, $changed);
} while ($changed);
self::$debugText .= "traversals removed : {$uri}\n\n";
return $uri;
}
/**
* Get realpath with any trailing slash removed. If realpath() fails,
* just remove the trailing slash.
*
* @param string $path
*
* @return mixed path with no trailing slash
*/
protected static function _realpath($path)
{
$realPath = realpath($path);
if ($realPath !== false) {
$path = $realPath;
}
return rtrim($path, '/\\');
}
}
|
@media only screen and (max-width: 1000px){
.subtitle{
font-size: 19.2px;
}
}
@media only screen and (min-width: 600px) and (max-width: 768px){
.title h1{
font-size:47.6px;
}
.title h1{
font-size:46.2px;
}
.content h2{
font-size:32.2px;
}
.subtitle{
font-size: 19.2px;
}
}
@media only screen and (min-width: 480px) and (max-width: 768px){
section.<API key>{
height: auto !important;
min-height: 400px !important;
}
}
@media only screen and (max-width: 600px){
.title h1{
font-size:34px;
}
.title h1{
font-size:33px;
}
.content h2{
font-size:23px;
}
}
@media only screen and (max-width: 480px){
section.<API key>{
height: auto !important;
min-height: 400px !important;
}
}
|
package com.lonebytesoft.thetaleclient.api.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.lonebytesoft.thetaleclient.api.dictionary.CompanionSpecies;
import com.lonebytesoft.thetaleclient.util.ObjectUtils;
import org.json.JSONException;
import org.json.JSONObject;
/**
* @author Hamster
* @since 17.02.2015
*/
public class CompanionInfo implements Parcelable {
public final CompanionSpecies species;
public final String name;
public final int healthCurrent;
public final int healthMax;
public final int coherence;
public final int experienceCurrent;
public final int <API key>;
public CompanionInfo(final JSONObject json) throws JSONException {
species = ObjectUtils.getEnumForCode(CompanionSpecies.class, json.getInt("type"));
name = json.getString("name");
healthCurrent = json.getInt("health");
healthMax = json.getInt("max_health");
coherence = json.getInt("coherence");
experienceCurrent = json.getInt("experience");
<API key> = json.getInt("experience_to_level");
}
// parcelable stuff
private CompanionInfo(final Parcel in) {
final int index = in.readInt();
species = index == -1 ? null : CompanionSpecies.values()[index];
name = in.readString();
healthCurrent = in.readInt();
healthMax = in.readInt();
coherence = in.readInt();
experienceCurrent = in.readInt();
<API key> = in.readInt();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeInt(species == null ? -1 : species.ordinal());
out.writeString(name);
out.writeInt(healthCurrent);
out.writeInt(healthMax);
out.writeInt(coherence);
out.writeInt(experienceCurrent);
out.writeInt(<API key>);
}
public static final Parcelable.Creator<CompanionInfo> CREATOR = new Parcelable.Creator<CompanionInfo>() {
@Override
public CompanionInfo createFromParcel(Parcel source) {
return new CompanionInfo(source);
}
@Override
public CompanionInfo[] newArray(int size) {
return new CompanionInfo[size];
}
};
}
|
<?php
class TestArcadiaCommon extends <API key> {
/**
* @covers ArcadiaCommon::__construct
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertTrue( isset( $component->game_nonce_life ) );
}
/**
* @covers ArcadiaCommon::__construct
*/
public function <API key>() {
global $ag;
$component = new ArcadiaCommon( $ag_obj = $ag, $nonce_life = 30 );
$this->assertEquals( 30, $component->game_nonce_life );
}
/**
* @covers ArcadiaCommon::get_array_if_set
*/
public function <API key>() {
$component = new ArcadiaCommon();
$array = array();
$ret_val = $component->get_array_if_set( $array, 'test', -1 );
$this->assertEquals( $ret_val, -1 );
}
/**
* @covers ArcadiaCommon::get_array_if_set
*/
public function <API key>() {
$component = new ArcadiaCommon();
$array = FALSE;
$ret_val = $component->get_array_if_set( $array, 'test', -1 );
$this->assertEquals( $ret_val, -1 );
}
/**
* @covers ArcadiaCommon::get_array_if_set
*/
public function <API key>() {
$component = new ArcadiaCommon();
$k = 'test';
$v = -1;
$array = array( $k => $v );
$ret_val = $component->get_array_if_set( $array, $k, $v );
$this->assertEquals( $ret_val, $v );
}
/**
* @covers ArcadiaCommon::get_bit
*/
public function test_get_bit_zero() {
$component = new ArcadiaCommon();
$val = 0;
$this->assertEquals( FALSE, $component->get_bit( $val, 0 ) );
}
/**
* @covers ArcadiaCommon::get_bit
*/
public function test_get_bit_one() {
$component = new ArcadiaCommon();
$val = 1;
$this->assertEquals( TRUE, $component->get_bit( $val, 0 ) );
}
/**
* @covers ArcadiaCommon::set_bit
*/
public function test_set_bit_zero() {
$component = new ArcadiaCommon();
$this->assertEquals( 1, $component->set_bit( 0, 0 ) );
}
/**
* @covers ArcadiaCommon::set_bit
*/
public function test_set_bit_one() {
$component = new ArcadiaCommon();
$this->assertEquals( 2, $component->set_bit( 0, 1 ) );
}
/**
* @covers ArcadiaCommon::set_bit
*/
public function test_set_bit_two() {
$component = new ArcadiaCommon();
$this->assertEquals( 4, $component->set_bit( 0, 2 ) );
}
/**
* @covers ArcadiaCommon::set_bit
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( 0, $component->set_bit( 0, -1 ) );
}
/**
* @covers ArcadiaCommon::bit_count
*/
public function test_bit_count_zero() {
$component = new ArcadiaCommon();
$this->assertEquals( 0, $component->bit_count( 0 ) );
}
/**
* @covers ArcadiaCommon::bit_count
*/
public function test_bit_count_one() {
$component = new ArcadiaCommon();
$this->assertEquals( 1, $component->bit_count( 1 ) );
}
/**
* @covers ArcadiaCommon::bit_count
*/
public function test_bit_count_ten() {
$component = new ArcadiaCommon();
$this->assertEquals( 10, $component->bit_count( 1023 ) );
}
/**
* @covers ArcadiaCommon::random_string
*/
public function <API key>() {
$component = new ArcadiaCommon();
$n = 0;
$st = $component->random_string( $n );
$this->assertEquals( $n, strlen( $st ) );
}
/**
* @covers ArcadiaCommon::random_string
*/
public function <API key>() {
$component = new ArcadiaCommon();
$n = 10;
$st = $component->random_string( $n );
$this->assertEquals( $n, strlen( $st ) );
}
/**
* @covers ArcadiaCommon::nonce_tick
*/
public function <API key>() {
$component = new ArcadiaCommon();
$nonce_tick = $component->nonce_tick();
$this->assertGreaterThan( 0, $nonce_tick );
}
/**
* @covers ArcadiaCommon::nonce_verify
*/
public function <API key>() {
$component = new ArcadiaCommon();
$result = $component->nonce_verify( '' );
$this->assertFalse( $result );
}
/**
* @covers ArcadiaCommon::nonce_verify
*/
public function <API key>() {
global $ag;
$ag->char = array( 'id' => 1 );
$component = new ArcadiaCommon();
$result = $component->nonce_verify( '' );
$ag->char = FALSE;
$this->assertFalse( $result );
}
/**
* @covers ArcadiaCommon::nonce_verify
*/
public function <API key>() {
global $ag;
$ag->char = array( 'id' => 1 );
$component = new ArcadiaCommon();
$nonce = $component->nonce_create();
$result = $component->nonce_verify( $nonce );
$ag->char = FALSE;
$this->assertTrue( $result );
}
/**
* @covers ArcadiaCommon::nonce_verify
*/
public function <API key>() {
global $ag;
$ag->char = array( 'id' => 1 );
$component = new ArcadiaCommon();
$nonce = $component->nonce_create( $state = -1,
$time = time() - $component->game_nonce_life / 2 );
$result = $component->nonce_verify( $nonce );
$ag->char = FALSE;
$this->assertTrue( $result );
}
/**
* @covers ArcadiaCommon::nonce_create
*/
public function <API key>() {
$component = new ArcadiaCommon();
$nonce = $component->nonce_create();
$this->assertFalse( $nonce );
}
/**
* @covers ArcadiaCommon::nonce_create
*/
public function <API key>() {
global $ag;
$ag->char = array( 'id' => 1 );
$component = new ArcadiaCommon();
$nonce = $component->nonce_create();
$ag->char = FALSE;
$this->assertNotFalse( $nonce );
}
/**
* @covers ArcadiaCommon::number_with_suffix
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( '0th', $component->number_with_suffix( 0 ) );
}
/**
* @covers ArcadiaCommon::number_with_suffix
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( '1st', $component->number_with_suffix( 1 ) );
}
/**
* @covers ArcadiaCommon::number_with_suffix
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( '2nd', $component->number_with_suffix( 2 ) );
}
/**
* @covers ArcadiaCommon::number_with_suffix
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( '3rd', $component->number_with_suffix( 3 ) );
}
/**
* @covers ArcadiaCommon::number_with_suffix
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( '11th', $component->number_with_suffix( 11 ) );
}
/**
* @covers ArcadiaCommon::get_if_plural
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( 'word', $component->get_if_plural( 1, 'word' ) );
}
/**
* @covers ArcadiaCommon::get_if_plural
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( 'words', $component->get_if_plural( 2, 'word' ) );
}
/**
* @covers ArcadiaCommon::time_round
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( '', $component->time_round( -1 ) );
}
/**
* @covers ArcadiaCommon::time_round
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( '0 seconds', $component->time_round( 0 ) );
}
/**
* @covers ArcadiaCommon::time_round
*/
public function test_time_round_one() {
$component = new ArcadiaCommon();
$this->assertEquals( '1 second', $component->time_round( 1 ) );
}
/**
* @covers ArcadiaCommon::time_round
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( '1 minute', $component->time_round( 60 ) );
}
/**
* @covers ArcadiaCommon::time_round
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( '1 hour', $component->time_round( 60 * 60 ) );
}
/**
* @covers ArcadiaCommon::time_round
*/
public function test_time_round_day() {
$component = new ArcadiaCommon();
$this->assertEquals( '1 day', $component->time_round( 60 * 60 * 24 ) );
}
/**
* @covers ArcadiaCommon::time_expand
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( $component->time_expand( 0 ), '' );
}
/**
* @covers ArcadiaCommon::time_expand
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( $component->time_expand( 1209599 ),
'1 week, 6 days, 23 hours, 59 minutes, 59 seconds' );
}
/**
* @covers ArcadiaCommon::time_expand
*/
public function <API key>() {
$component = new ArcadiaCommon();
$this->assertEquals( $component->time_expand( -1 ), '' );
}
/**
* @covers ArcadiaCommon::rand_float
*/
public function <API key>() {
$component = new ArcadiaCommon();
$rand_min = 0;
$rand_max = 100;
$result = $component->rand_float( $rand_min, $rand_max );
$this-><API key>( $rand_min, $result );
$this-><API key>( $rand_max, $result );
}
}
|
{% extends 'base.html' %}
{% block head %}
<link href="../static/css/sign_up.css" rel="stylesheet" >
{% endblock %}
{% block title %} Sign up! {% endblock %}
{% block content %}
<div class="container">
{% if user_errors %}
<div class="alert alert-danger">
{{ user_errors }}
</div>
{% elif profile_errors %}
<div class="alert alert-danger">
{{ profile_errors }}
</div>
{% endif %}
<div class="well">
<form id="signup" class="form-horizontal" method="post" action="/sign_up">
{% csrf_token %}
<legend>Sign Up</legend>
<div class="control-group">
<label class="control-label" for="id_{{ user_form.username.name }}">Username</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-user"></i></span>
<input type="text" class="input-xlarge" id="id_{{ user_form.username.name }}" name="{{ user_form.username.name }}" placeholder="Username">
</div>
</div>
</div>
<div class="control-group" for="id_{{ profile_form.display_name.name }}">
<label class="control-label" for="id_{{ profile_form.display_name.name }}">Display Name</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-user"></i></span>
<input type="text" class="input-xlarge" id="id_{{ profile_form.display_name.name }}" name="{{ profile_form.display_name.name }}" placeholder="Display Name">
</div>
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_{{ user_form.email.name }}">Email</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-envelope"></i></span>
<input type="text" class="input-xlarge" id="id_{{ user_form.email.name }}" name="{{ user_form.email.name }}" placeholder="Email">
</div>
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_{{ user_form.password.name }}">Password</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-lock"></i></span>
<input type="Password" id="id_{{ user_form.password.name }}" class="input-xlarge" name="{{ user_form.password.name }}"
placeholder="Password">
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Confirm Password</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-lock"></i></span>
<input type="Password" id="conpasswd" class="input-xlarge" name="conpasswd" placeholder="Re-enter Password">
</div>
</div>
</div>
<div class="control-group">
<label class="control-label"></label>
<div class="controls">
<button type="submit" class="btn btn-success" >Create My Account</button>
</div>
</div>
</form>
<script type="text/javascript">
$(document).ready(function(){
$("#signup").validate({
rules:{
{{ user_form.username.name }}:"required",
{{ profile_form.display_name.name }}:"required",
{{ user_form.email.name }}:{
required:true,
email: true
},
{{ user_form.password.name }}:{
required:true,
minlength: 8
},
conpasswd:{
required:true,
equalTo: "#{{ user_form.password.name }}"
},
errorClass: "help-inline"
});
});
</script>
{% endblock %}
|
#!/bin/bash
if [ $# -ne 2 ];then
echo "Usage: $0 <src_1> <src_2>"
exit 1
fi
mv $1 tmp
mv $2 $1
mv tmp $2
exit 0
|
package tasslegro.base;
import java.io.IOException;
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.ParseException;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.client.<API key>;
import org.apache.http.client.methods.<API key>;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
public class Http_Delete {
@NotThreadSafe
class HttpDeleteWithBody extends <API key> {
public static final String METHOD_NAME = "DELETE";
public String getMethod() {
return METHOD_NAME;
}
public HttpDeleteWithBody(final String uri) {
super();
setURI(URI.create(uri));
}
public HttpDeleteWithBody(final URI uri) {
super();
setURI(uri);
}
public HttpDeleteWithBody() {
super();
}
}
CloseableHttpClient httpClient = new DefaultHttpClient();
HttpDeleteWithBody delete = null;
HttpResponse response = null;
public Http_Delete(String url, String entity) throws <API key>, IOException {
this.delete = new HttpDeleteWithBody(url);
this.delete.setHeader("Content-type", "application/json");
StringEntity stringEntity = new StringEntity(entity.toString(), "UTF-8");
this.delete.setEntity(stringEntity);
this.response = this.httpClient.execute(this.delete);
}
public Http_Delete() {
}
public void setURL(String url, String entity) throws <API key>, IOException {
this.delete = new HttpDeleteWithBody(url);
this.delete.setHeader("Content-type", "application/json");
StringEntity stringEntity = new StringEntity(entity.toString(), "UTF-8");
this.delete.setEntity(stringEntity);
this.response = this.httpClient.execute(this.delete);
}
public int getStatusCode() {
if (response == null) {
return 0;
}
return this.response.getStatusLine().getStatusCode();
}
public String getStrinResponse() throws ParseException, IOException {
if (response == null) {
return null;
}
HttpEntity entity = this.response.getEntity();
return EntityUtils.toString(entity, "UTF-8");
}
}
|
<div class="header-title">
<?php if(is_home()){ ?>
<?php $blog_text = of_get_option('blog_text'); ?>
<?php if($blog_text){?>
<h1><?php echo of_get_option('blog_text'); ?></h1>
<?php } else { ?>
<h1><?php _e('Blog','theme1599');?></h1>
<?php } ?>
<?php } else { ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $pagetitle = <API key>("page-title");?>
<?php $pagedesc = <API key>("page-desc");?>
<?php if($pagetitle == ""){ ?>
<h1><?php the_title(); ?></h1>
<?php } else { ?>
<h1><?php echo $pagetitle[0]; ?></h1>
<?php } ?>
<?php if($pagedesc != ""){ ?>
<span class="page-desc"><?php echo $pagedesc[0];?></span>
<?php } ?>
<?php endwhile; endif; ?>
<?php wp_reset_query();?>
<?php } ?>
</div>
|
package com.fjaviermo.dropdroid;
import java.io.<API key>;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
public final class <API key> extends DialogFragment {
private Bitmap mImage;
private static final String IMAGE="image";
/**
* Create a new instance of <API key>, providing "image"
* as an argument.
*/
static <API key> newInstance(Bitmap image) {
<API key> coverImageDialog = new <API key>();
Bundle args = new Bundle();
<API key> stream = new <API key>();
image.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
args.putByteArray(IMAGE, byteArray);
coverImageDialog.setArguments(args);
coverImageDialog.setStyle(DialogFragment.STYLE_NO_TITLE, 0);
return coverImageDialog;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
byte[] byteArray = getArguments().getByteArray(IMAGE);
mImage = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.image_dialog, container, false);
ImageView imgView=(ImageView)view.findViewById(R.id.thumbnail_epub);
imgView.setImageBitmap(mImage);
return view;
}
}
|
(function() {
var preview = true;
var themeShortcuts = {
insert: function(where) {
switch(where) {
case 'st_button_more':
var href = jQuery("#btn_more_src").val();
var what = '[st_button_more href="'+href+'"]';
break;
case 'st_button':
var text = jQuery("#text").val();
var text_color = jQuery("#color").val();
var link = jQuery("#link").val();
var bg = jQuery("#bg").val();
var size = jQuery("#size").val();
var icon = jQuery("#name").val();
var target = jQuery("#target").val();
var border_radius = jQuery("#border_radius").val();
var what = '[st_button text_color="'+text_color+'" link="'+link+'" background="'+bg+'" size="'+size+'" target="'+target+'" icon="'+icon+'" border_radius="'+border_radius+'"]'+text+'[/st_button]';
break;
case '<API key>':
var text = jQuery("#text").val();
var text_color = jQuery("#color").val();
var link = jQuery("#link").val();
var bg = jQuery("#bg").val();
var hover_bg = jQuery("#hover_bg").val();
var size = jQuery("#size").val();
var icon = jQuery("#name").val();
var target = jQuery("#target").val();
var hover_direction = jQuery("#hover_direction").val();
var border_radius = jQuery("#border_radius").val();
var what = '[<API key> text_color="'+text_color+'" link="'+link+'" background="'+bg+'" hover_background="'+hover_bg+'" size="'+size+'" target="'+target+'" icon="'+icon+'" border_radius="'+border_radius+'" hover_direction="'+hover_direction+'"]'+text+'[/<API key>]';
break;
case '<API key>':
var text = jQuery("#text").val();
var text_color = jQuery("#color").val();
var link = jQuery("#link").val();
var bg = jQuery("#bg").val();
var size = jQuery("#size").val();
var icon = jQuery("#name").val();
var icon_color = jQuery("#icon_color").val();
var icon_bg = jQuery("#icon_bg").val();
var target = jQuery("#target").val();
var icon_position = jQuery("#icon_pos").val();
var icon_separator = jQuery("#icon_sep").val();
var border_radius = jQuery("#border_radius").val();
var what = '[<API key> text_color="'+text_color+'" link="'+link+'" background="'+bg+'" size="'+size+'" target="'+target+'" icon="'+icon+'" icon_color="'+icon_color+'" icon_background="'+icon_bg+'" icon_position="'+icon_position+'" icon_separator="'+icon_separator+'" border_radius="'+border_radius+'"]'+text+'[/<API key>]';
break;
case '<API key>':
var text = jQuery("#text").val();
var text_color = jQuery("#color").val();
var link = jQuery("#link").val();
var bg = jQuery("#bg").val();
var size = jQuery("#size").val();
var icon = jQuery("#name").val();
var target = jQuery("#target").val();
var border_radius = jQuery("#border_radius").val();
var arrow_direction = jQuery("#arrow_direction").val();
var what = '[<API key> text_color="'+text_color+'" link="'+link+'" background="'+bg+'" size="'+size+'" target="'+target+'" icon="'+icon+'" border_radius="'+border_radius+'" arrow_direction="'+arrow_direction+'"]'+text+'[/<API key>]';
break;
case '<API key>':
var text = jQuery("#text").val();
var text_color = jQuery("#color").val();
var link = jQuery("#link").val();
var bg = jQuery("#bg").val();
var size = jQuery("#size").val();
var icon = jQuery("#name").val();
var target = jQuery("#target").val();
var border_radius = jQuery("#border_radius").val();
var icon_direction = jQuery("#icon_direction").val();
var what = '[<API key> text_color="'+text_color+'" link="'+link+'" background="'+bg+'" size="'+size+'" target="'+target+'" icon="'+icon+'" icon_direction="'+icon_direction+'" border_radius="'+border_radius+'"]'+text+'[/<API key>]';
break;
case '<API key>':
var text = jQuery("#text").val();
var text_color = jQuery("#color").val();
var link = jQuery("#link").val();
var bg = jQuery("#bg").val();
var size = jQuery("#size").val();
var icon = jQuery("#name").val();
var target = jQuery("#target").val();
var border_type = jQuery("#border_type").val();
var border_radius = jQuery("#border_radius").val();
var what = '[<API key> text_color="'+text_color+'" link="'+link+'" background="'+bg+'" size="'+size+'" target="'+target+'" icon="'+icon+'" border_radius="'+border_radius+'" border_type="'+border_type+'"]'+text+'[/<API key>]';
break;
case 'st_unordered':
var list = '<li>First list item</li>';
var listicon = jQuery("#listicon").val();
var what = '[st_unordered listicon="'+listicon+'"]'+list+'[/st_unordered]';
break;
case 'st_box':
var title = jQuery("#box_title").val();
var text = jQuery("#text").val();
var type = jQuery("#box_type").val();
var what = '[st_box title="'+title+'" type="'+type+'"]'+text+'[/st_box]';
break;
case 'st_callout':
var title = jQuery("#callout_title").val();
var text = jQuery("#text").val();
var btn_text = jQuery("#btn_text").val();
var btn_link = jQuery("#btn_link").val();
var text_color = jQuery("#color").val();
var bg = jQuery("#bg").val();
var what = '[st_callout title="'+title+'" button_text="'+btn_text+'" link="'+btn_link+'" text_color="'+text_color+'" background="'+bg+'"]'+text+'[/st_callout]';
break;
case 'st_tooltip':
var text = jQuery("#text").val();
var tooltip_text = jQuery("#tooltip_text").val();
var type = jQuery("#tooltip_type").val();
var what = '[st_tooltip type="'+type+'" tooltip_text="'+tooltip_text+'"]'+text+'[/st_tooltip]';
break;
case 'st_popover':
var content = 'Your text here';
var title = jQuery("#popover_title").val();
var text = jQuery("#popover_text").val();
var type = jQuery("#popover_type").val();
var what = '[st_popover type="'+type+'" popover_title="'+title+'" text="'+text+'"]'+content+'[/st_popover]';
break;
case 'st_modal':
var title = jQuery("#modal_title").val();
var content = jQuery("#modal_text").val();
var modal_link = jQuery("#modal_link").val();
var primary_text = jQuery("#primary").val();
var primary_link = jQuery("#primary_link").val();
var what = '[st_modal modal_link="'+modal_link+'" primary_text="'+primary_text+'" primary_link="'+primary_link+'" modal_title="'+title+'"]'+content+'[/st_modal]';
break;
case 'st_tables':
var colsEl = jQuery("#cols");
var rowsEl = jQuery("#rows");
var cols = new Array();
var rows = new Array();
for(var i=0; i<jQuery(rowsEl).val(); i++) {
for(var j=0; j<jQuery(colsEl).val(); j++) {
if(i == 0) {
cols.push(jQuery('#input_'+i+''+j).val());
} else if (i == 1) {
rows.push(jQuery('#input_'+i+''+j).val());
j = jQuery(colsEl).val();
} else {
rows.push(jQuery('#input_'+i+''+j).val());
}
}
}
var what = '[st_table cols="'+cols.join('||')+'" data="'+rows.join('||')+'"]';
break;
case 'st_tabs':
var tabs = '';
var boxes = jQuery(".box");
boxes.splice(0,1);
jQuery(boxes).each(function() {
var title = jQuery(this).find('input').val();
var text = jQuery(this).find('textarea').val();
tabs += '[st_tab title="'+title+'"]'+text+'[/st_tab]';
});
var what = '[st_tabs]'+tabs+'[/st_tabs]';
break;
case 'st_toggle':
var accs = '';
var boxes = jQuery(".box");
jQuery(boxes).each(function() {
var title = jQuery(this).find('input').val();
var text = jQuery(this).find('textarea').val();
var state = jQuery(this).find('select').val();
accs += '[st_panel title="'+title+'" state="'+state+'"]'+text+'[/st_panel]<br />';
});
var what = '[st_toggle]<br />'+accs+'[/st_toggle]';
break;
case 'st_accordion':
var accs = '';
var boxes = jQuery(".box");
jQuery(boxes).each(function() {
var title = jQuery(this).find('input').val();
var text = jQuery(this).find('textarea').val();
var state = jQuery(this).find('select').val();
accs += '[st_acc_panel title="'+title+'" state="'+state+'"]'+text+'[/st_acc_panel]<br />';
});
var what = '[st_accordion]<br />'+accs+'[/st_accordion]';
break;
case 'st_progress_bar':
var width = jQuery("#width").val();
var style = jQuery("#style").val();
var striped = jQuery("#striped").val();
var active = jQuery("#active").val();
var what = '[st_progress_bar width="'+width+'" style="'+style+'" striped="'+striped+'" active="'+active+'"]';
break;
case 'st_related_posts':
var limit = jQuery("#limit").val();
var what = '[st_related_posts limit="'+limit+'"]';
break;
case 'st_highlight':
var background_color = jQuery("#background_color").val();
var text_color = jQuery("#text_color").val();
var what = '[st_highlight background_color="'+background_color+'" text_color="'+text_color+'"]Highlighted text[/st_highlight]';
break;
case 'st_loginout':
var text_col = jQuery("#color").val();
var bg = jQuery("#bg").val();
var size = jQuery("#size").val();
var type = jQuery("#login_type").val();
var target = jQuery("#target").val();
var login_msg = jQuery("#login_msg").val();
var logout_msg = jQuery("#logout_msg").val();
var what = '[st_loginout text_col="'+text_col+'" background="'+bg+'" size="'+size+'" login_msg="'+login_msg+'" logout_msg="'+logout_msg+'"]';
break;
case 'st_quote':
var author = jQuery("#author-name").val();
var content = jQuery("#text").val();
var what = '[st_quote author="'+author+'"]' +content+ '[/st_quote]';
break;
case 'st_abbreviation':
var text = jQuery("#text").val();
var abbreviation = jQuery("#abbreviation").val();
var what = '[st_abbr title="'+abbreviation+'"]' + text + '[/st_abbr]';
break;
case 'st_twitter':
var style = jQuery("#style").val();
var url = jQuery("#url").val();
var sourceVal = jQuery("#source").val();
var related = jQuery("#related").val();
var text = jQuery("#text").val();
var lang = jQuery("#lang").val();
var what = '[st_twitter style="'+style+'" url="'+url+'" source="'+sourceVal+'" related="'+related+'" text="'+text+'" lang="'+lang+'"]';
break;
case 'st_digg':
var style = jQuery("#style").val();
var link = jQuery("#link").val();
var title = jQuery("#digg_title").val();
var what = '[st_digg style="'+style+'" title="'+title+'" link="'+link+'"]';
break;
case 'st_fblike':
var style = jQuery("#style").val();
var url = jQuery("#url").val();
var show_faces = jQuery("#show_faces").val();
var width = jQuery("#width").val();
var verb = jQuery("#verb_to_display").val();
var font = jQuery("#font").val();
var what = '[st_fblike url="'+url+'" style="'+style+'" showfaces="'+show_faces+'" width="'+width+'" verb="'+verb+'" font="'+font+'"]';
break;
case 'st_fbshare':
var url = jQuery("#link").val();
var what = '[st_fbshare url="'+url+'"]';
break;
case 'st_lishare':
var style = jQuery("#style").val();
var url = jQuery("#link").val();
var sourceVal = jQuery("#source").val();
var related = jQuery("#related").val();
var text = jQuery("#text").val();
var lang = jQuery("#lang").val();
var what = '[st_linkedin_share url="'+url+'" style="'+style+'"]';
break;
case 'st_gplus':
var style = jQuery("#style").val();
var size = jQuery("#size").val();
var what = '[st_gplus style="'+style+'" size="'+size+'"]';
break;
case 'st_pinterest_pin':
var style = jQuery("#style").val();
var what = '[st_pinterest_pin style="'+style+'"]';
break;
case 'st_tumblr':
var style = jQuery("#style").val();
var what = '[st_tumblr style="'+style+'"]';
break;
case 'st_pricingTable':
var content = '';
var columns = jQuery("#columns").val();
var highlighted = jQuery("#highlighted").val();
for(x=0;x<columns;x++) {
var highlight = ((x+1) == highlighted) ? " highlight='true'" : '';
content += "\n[st_pricing_column title='Column " + (x+1) + "'" + highlight + "]\n[st_price_info cost='$14.99/month'][/st_price_info]<ul><li>Item description and details...</li>\n<li>Item description and details...</li>\n<li>Some more info...</li>\n<li>[st_button text_color='#444444' link='#' background='#E6E6E6' size='small']Button text[/st_button]</li></ul>\n[/st_pricing_column]\n";
}
var what = "[st_pricing_table columns='"+columns+"']\n" + content + "\n[/st_pricing_table]";
break;
case 'st_gmap':
var additional = '';
additional = (jQuery("#latitude").val() != '') ? additional + ' latitude="'+ jQuery("#latitude").val() +'"' : additional;
additional = (jQuery("#longitute").val() != '') ? additional + ' longitute="'+ jQuery("#longitute").val() +'"' : additional;
additional = (jQuery("#html").val() != '') ? additional + ' html="'+ jQuery("#html").val() +'"' : additional;
additional = (jQuery("#zoom").val() != '') ? additional + ' zoom="'+ jQuery("#zoom").val() +'"' : additional;
additional = (jQuery("#gheight").val() != '') ? additional + ' height="'+ jQuery("#gheight").val() +'"' : additional;
additional = (jQuery("#gwidth").val() != '') ? additional + ' width="'+ jQuery("#gwidth").val() +'"' : additional;
additional = (jQuery("#maptype").val() != '') ? additional + ' maptype="'+ jQuery("#maptype").val() +'"' : additional;
additional = (jQuery("#color").val() != '') ? additional + ' color="'+ jQuery("#color").val() +'"' : additional;
var what = '[st_gmap '+additional+']';
break;
case 'st_trends':
var width = jQuery("#width").val();
var height = jQuery("#height").val();
var query = jQuery("#query").val();
var geo = jQuery("#geo").val();
var what = '[st_trends width="'+width+'" height="'+height+'" query="'+query+'" geo="'+geo+'"]';
break;
case 'st_gchart':
var data = jQuery("#data").val();
var title = jQuery("#g_title").val();
var width = jQuery("#width").val();
var height = jQuery("#height").val();
var series_type = jQuery("#series_type").val();
var vAxis = jQuery("#vAxis").val();
var hAxis = jQuery("#hAxis").val();
var type = jQuery("#gchart_type").val();
var red_from = jQuery("#red_from").val();
var red_to = jQuery("#red_to").val();
var yellow_from = jQuery("#yellow_from").val();
var yellow_to = jQuery("#yellow_to").val();
var gauge_minor_ticks = jQuery("#gauge_minor_ticks").val();
var what = '[st_chart title="'+title+'" data="'+data+'" width="'+width+'" height="'+height+'" type="'+type+'" series_type="'+series_type+'" vAxis="'+vAxis+'" hAxis="'+hAxis+'" red_from="'+red_from+'" red_to="'+red_to+'" yellow_from="'+yellow_from+'" yellow_to="'+yellow_to+'" gauge_minor_ticks="'+gauge_minor_ticks+'"]';
break;
case 'st_chart_pie':
var data = jQuery("#data").val();
var title = jQuery("#pie_title").val();
var what = '[st_chart_pie title="'+title+'" data="'+data+'"]';
break;
case 'st_chart_bar':
var data = jQuery("#data").val();
var title = jQuery("#bar_title").val();
var vaxis = jQuery("#vaxis_title").val();
var haxis = jQuery("#haxis_title").val();
var what = '[st_chart_bar title="'+title+'" data="'+data+'" vaxis="'+vaxis+'" haxis="'+haxis+'"]';
break;
case 'st_chart_area':
var data = jQuery("#data").val();
var title = jQuery("#area_title").val();
var vaxis = jQuery("#vaxis_title").val();
var haxis = jQuery("#haxis_title").val();
var what = '[st_chart_area title="'+title+'" data="'+data+'" vaxis="'+vaxis+'" haxis="'+haxis+'"]';
break;
case 'st_chart_geo':
var data = jQuery("#data").val();
var title = jQuery("#geo_title").val();
var primary = jQuery("#primary").val();
var secondary = jQuery("#secondary").val();
var what = '[st_chart_geo title="'+title+'" data="'+data+'" primary="'+primary+'" secondary="'+secondary+'"]';
break;
case 'st_chart_combo':
var data = jQuery("#data").val();
var title = jQuery("#combo_title").val();
var vaxis = jQuery("#vaxis_title").val();
var haxis = jQuery("#haxis_title").val();
var series = jQuery("#series").val();
var what = '[st_chart_combo title="'+title+'" data="'+data+'" vaxis="'+vaxis+'" haxis="'+haxis+'" series="'+series+'"]';
break;
case 'st_chart_org':
var data = jQuery("#data").val();
var what = '[st_chart_org data="'+data+'"]';
break;
case 'st_chart_bubble':
var data = jQuery("#data").val();
var title = jQuery("#bubble_title").val();
var primary = jQuery("#primary").val();
var secondary = jQuery("#secondary").val();
var what = '[st_chart_bubble title="'+title+'" data="'+data+'" primary="'+primary+'" secondary="'+secondary+'"]';
break;
case 'st_gdocs':
var url = jQuery("#url").val();
var width = jQuery("#width").val();
var height = jQuery("#height").val();
var what = "[st_gdocs width='"+width+"' height='"+height+"' url='"+ url +"']";
break;
case 'st_children':
var parent = jQuery("#page").val();
var what = "[st_children of='"+ parent +"']";
break;
case '<API key>':
var email_d = jQuery("#email_d").val();
var what = "[<API key> email='"+ email_d +"']";
break;
case '<API key>':
var email_l = jQuery("#email_l").val();
var what = "[<API key> email='"+ email_l +"']";
break;
case 'st_fancyboxImages':
var href = jQuery("#href").val();
var thumb = jQuery("#thumb").val();
var thumb_width = jQuery("#thumb_width").val();
var group = jQuery("#group").val();
var title = jQuery("#title_lb").val();
var what = "[st_fancyboxImages href='"+ href +"' thumb='"+thumb+"' thumb_width='"+thumb_width+"' group='"+group+"' title='"+title+"']";
break;
case 'st_fancyboxInline':
var title = jQuery("#in_title").val();
var content_title = jQuery("#content_title").val();
var content = jQuery("#in_content").val();
var what = "[st_fancyboxInline title='"+title+"' content_title='"+content_title+"' content='"+content+"']";
break;
case 'st_fancyboxIframe':
var title = jQuery("#iframe_title").val();
var href = jQuery("#iframe_href").val();
var what = "[st_fancyboxIframe title='"+title+"' href='"+ href +"']";
break;
case 'st_fancyboxPage':
var title = jQuery("#ipage_title").val();
var href = jQuery("#ipage").val();
var what = "[st_fancyboxPage title='"+title+"' href='"+ href +"']";
break;
case 'st_fancyboxSwf':
var title = jQuery("#swf_title").val();
var href = jQuery("#swf").val();
var what = "[st_fancyboxSwf title='"+title+"' href='"+href+"']";
break;
case 'st_video':
var title = jQuery("#video_title").val();
var display = jQuery("#display").val();
var width = jQuery("#width").val();
var height = jQuery("#height").val();
var type = jQuery("#video_type").val();
if (type == 'flash') {
var src = jQuery("#src").val();
var what = "[st_video title='"+title+"' type='"+ type +"' width='"+width+"' height='"+height+"' src='"+src+"']";
} else if (type == 'html5') {
var poster = jQuery("#poster").val();
var mp4 = jQuery("#mp4").val();
var webm = jQuery("#webm").val();
var ogg = jQuery("#ogg").val();
var what = "[st_video title='"+title+"' type='"+ type +"' width='"+width+"' height='"+height+"' poster='"+poster+"' mp4='"+mp4+"' webm='"+webm+"' ogg='"+ogg+"']";
} else {
var src = jQuery("#clip_id").val();
var what = "[st_video title='"+title+"' type='"+ type +"' width='"+width+"' height='"+height+"' src='"+src+"']";
}
var group = jQuery("#group").val();
var title = jQuery("#title_lb").val();
break;
case 'st_audio':
var title = jQuery("#audio_title").val();
var src = jQuery("#audio_src").val();
var what = "[st_audio title='"+title+"' src='"+src+"']";
break;
case 'st_soundcloud':
var src = jQuery("#sound_src").val();
var color = jQuery("#sound_color").val();
var what = "[st_soundcloud color='"+color+"' src='"+src+"']";
break;
case 'st_mixcloud':
var src = jQuery("#mix_src").val();
var width = jQuery("#mix_width").val();
var height = jQuery("#mix_height").val();
var what = "[st_mixcloud width='"+width+"' height='"+height+"' src='"+src+"']";
break;
case 'st_section_image':
var image_id = jQuery("#imageid").val();
var bg_color = jQuery("#bg_color").val();
var type = jQuery("#section_image_type").val();
var bg_position = jQuery("#bg_position").val();
var bg_size = jQuery("#bg_size").val();
var repeat = jQuery("#repeat").val();
var padding = jQuery("#img_padding").val();
var what = "[st_section_image image_id='"+image_id+"' bg_color='"+bg_color+"' type='"+type+"' position='"+bg_position+"' bg_size='"+bg_size+"' repeat='"+repeat+"' padding='"+padding+"']Section content goes here[/st_section_image]";
break;
case 'st_section_color':
var color = jQuery("#color").val();
var padding = jQuery("#col_padding").val();
var what = "[st_section_color color='"+color+"' padding='"+padding+"']Section content goes here[/st_section_color]";
break;
case 'st_text_color':
var color = jQuery("#color").val();
var what = "[st_text_color color='"+color+"']Text goes here[/st_text_color]";
break;
case 'st_posts_carousel':
var posts = jQuery("#posts").val();
var number = jQuery("#number").val();
var cat = jQuery("#cat").val();
var display_title = jQuery("#display_title").val();
var what = "[st_posts_carousel posts='"+posts+"' number='"+number+"' cat='"+cat+"' display_title='"+display_title+"']";
break;
case 'st_swiper':
var posts = jQuery("#swiper_posts").val();
var number = jQuery("#swiper_number").val();
var category = jQuery("#category").val();
var display_title = jQuery("#display_title").val();
var what = "[st_swiper posts='"+posts+"' number='"+number+"' category='"+category+"' display_title='"+display_title+"']";
break;
case 'st_animated':
var type = jQuery("#animated_type").val();
var trigger = jQuery("#trigger").val();
var precent = jQuery("#precent").val();
var what = "[st_animated type='"+type+"' trigger='"+trigger+"' precent='"+precent+"']Animated element goes here[/st_animated]";
break;
case 'st_svg_drawing':
var type = jQuery("#drawing_type").val();
var image_id = jQuery("#image_id").val();
var color = jQuery("#drawing_color").val();
var what = "[st_svg_drawing type='"+type+"' image_id='"+image_id+"' color='"+color+"']";
break;
case 'st_animated_boxes':
var posts = jQuery("#posts").val();
var what = "[st_animated_boxes posts='"+posts+"']";
break;
case 'st_icon':
var name = jQuery("#name").val();
var size = jQuery("#size").val();
var type = jQuery("#icon_type").val();
var color = jQuery("#icon_color").val();
var bg_color = jQuery("#icon_bg_color").val();
var border_color = jQuery("#icon_border_color").val();
var align = jQuery("#align").val();
var what = "[st_icon name='"+name+"' size='"+size+"' color='"+color+"' type='"+type+"' background='"+bg_color+"' border_color='"+border_color+"' align='"+align+"']";
break;
case 'st_icon_melon':
var name = jQuery("#name").val();
var size = jQuery("#size").val();
var type = jQuery("#icon_type").val();
var color = jQuery("#icon_color").val();
var bg_color = jQuery("#icon_bg_color").val();
var border_color = jQuery("#icon_border_color").val();
var align = jQuery("#align").val();
var what = "[st_icon_melon name='"+name+"' size='"+size+"' color='"+color+"' type='"+type+"' background='"+bg_color+"' border_color='"+border_color+"' align='"+align+"']";
break;
case 'st_social_icon':
var name = jQuery("#name").val();
var href = jQuery("#href").val();
var target = jQuery("#target").val();
var align = jQuery("#align").val();
var what = "[st_social_icon name='"+name+"' href='"+href+"' target='"+target+"' align='"+align+"']";
break;
case 'st_divider_text':
var type = jQuery("#divider_type").val();
var text = jQuery("#text").val();
var what = "[st_divider_text position='"+type+"' text='"+text+"']";
break;
case 'st_countdown':
var id = jQuery("#event_id").val();
var align = jQuery("#countdown_align").val();
var what = "[st_countdown id='"+id+"' align='"+align+"']";
break;
case 'st_testimonials':
var color = jQuery("#color").val();
var number = jQuery("#number").val();
var what = "[st_testimonials color='"+color+"' number='"+number+"']";
break;
}
if(this.validate()) {
if(preview === true) {
var values = {
'data': what
};
jQuery.ajax({
url: stPluginUrl + '/ajaxPlugin.php?act=preview',
type: 'POST',
data: values,
loading: function() {
jQuery("#previewDiv").empty().html('<div class="loading"> </div>')
},
success: function(response) {
jQuery("#previewDiv").empty().html(response);
}
});
} else {
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, what);
}
}
},
validate: function() {
ret = true;
jQuery('.req').each(function() {
if(jQuery(this).find('input').val() == '') {
ret = false;
jQuery(this).find('input').addClass('errorInput');
} else {
jQuery(this).find('input').removeClass('errorInput');
}
if(jQuery(this).find('textarea').val() == '') {
ret = false;
jQuery(this).find('textarea').addClass('errorInput');
} else {
jQuery(this).find('textarea').removeClass('errorInput');
}
});
return ret;
},
readMore: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=readMore&preview');
what = 'st_button_more';
},
breakLine: function() {
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_break_line]");
},
horizontalLine: function() {
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_horizontal_line]");
},
divClear: function() {
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_clear]");
},
createDividerDotted: function() {
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_divider_dotted]");
},
createDividerDashed: function() {
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_divider_dashed]");
},
createDividerTop: function() {
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_divider_top]");
},
createDividerShadow: function() {
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_divider_shadow]");
},
insertButton: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=insertButton&preview');
what = 'st_button';
},
<API key>: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=<API key>&preview');
what = '<API key>';
},
<API key>: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=<API key>&preview');
what = '<API key>';
},
<API key>: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=<API key>&preview');
what = '<API key>';
},
<API key>: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=<API key>&preview');
what = '<API key>';
},
<API key>: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=<API key>&preview');
what = '<API key>';
},
insertBox: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=insertBox&preview');
what = 'st_box';
},
dividerText: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=dividerText&preview');
what = 'st_divider_text';
},
eventCountdown: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=eventCountdown');
what = 'st_countdown';
},
createTestimonials: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=testimonials');
what = 'st_testimonials';
},
insertCallout: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=insertCallout&preview');
what = 'st_callout';
},
insertTooltip: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=insertTooltip&preview=remove');
what = 'st_tooltip';
},
insertPopover: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=insertPopover&preview=remove');
what = 'st_popover';
},
insertModal: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=insertModal&preview=remove');
what = 'st_modal';
},
createTabs: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=createTabs&preview=remove');
what = 'st_tabs';
},
createUnorderedList: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=createUnorderedList&preview');
what = 'st_unordered';
},
createOrderedList: function() {
var content = (tinyMCE.activeEditor.selection.getContent() != '') ? tinyMCE.activeEditor.selection.getContent() : '<ol><li>First list item</li></ol>';
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_ordered]"+ content +"[/st_ordered]");
},
createToggle: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=toggle&preview');
what = 'st_toggle';
},
createAccordion: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=createAccordion&preview');
what = 'st_accordion';
},
createProgressBar: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=progress_bar&preview');
what = 'st_progress_bar';
},
createTables: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=createTable&preview');
what = 'st_tables';
},
relatedPosts: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=related&preview=remove');
what = 'st_related_posts';
},
logInOut: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=logInOut&preview');
what = 'st_loginout';
},
dropCap: function(type) {
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_dropcap type='"+type+"']"+ tinyMCE.activeEditor.selection.getContent() +"[/st_dropcap]");
},
highlight: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=highlight&preview');
what = 'st_highlight';
},
labels: function(type) {
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_label type='"+type+"']"+ tinyMCE.activeEditor.selection.getContent() +"[/st_label]");
},
quote: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=quote&preview');
what = 'st_quote';
},
abbreviation: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=abbreviation&preview');
what = 'st_abbreviation';
},
createTwitterButton: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=twitter&preview');
what = 'st_twitter';
},
createDiggButton: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=digg&preview');
what = 'st_digg';
},
createFBlikeButton: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=fblike&preview');
what = 'st_fblike';
},
createFBShareButton: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=fbshare&preview');
what = 'st_fbshare';
},
createLIShareButton: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=lishare&preview');
what = 'st_lishare';
},
createGplusButton: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=gplus&preview');
what = 'st_gplus';
},
createPinButton: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=pinterest_pin&preview');
what = 'st_pinterest_pin';
},
createTumblrButton: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=tumblr&preview');
what = 'st_tumblr';
},
createSocialIcon: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=social_icon&preview');
what = 'st_social_icon';
},
createPricingTables: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=pricingTable&preview');
what = 'st_pricingTable';
},
<API key>: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=fancyboxImages&preview=remove');
what = 'st_fancyboxImages';
},
<API key>: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=fancyboxInline&preview=remove');
what = 'st_fancyboxInline';
},
<API key>: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=fancyboxIframe&preview=remove');
what = 'st_fancyboxIframe';
},
createFancyboxPage: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=fancyboxPage&preview=remove');
what = 'st_fancyboxPage';
},
createFancyboxSwf: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=fancyboxSwf&preview=remove');
what = 'st_fancyboxSwf';
},
createVideo: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=video&preview');
what = 'st_video';
},
createAudio: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=audio&preview');
what = 'st_audio';
},
createSoundcloud: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=soundcloud&preview');
what = 'st_soundcloud';
},
createMixcloud: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=mixcloud&preview');
what = 'st_mixcloud';
},
createSectionImage: function(){
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=section_image&preview=remove');
what = 'st_section_image';
},
createSectionColor: function(){
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=section_color&preview=remove');
what = 'st_section_color';
},
createContainer: function(){
var currentVal = 'Put your content here';
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_container]"+ currentVal +"[/st_container]");
},
createTextColor: function(){
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=text_color&preview=remove');
what = 'st_text_color';
},
createRow: function(){
var currentVal = 'Put your columns here';
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_row]"+ currentVal +"[/st_row]");
},
createColumnLayout: function(n) {
var col = '';
var values = {
'st_column1': 'st_column1',
'st_column2': 'st_column2',
'st_column3': 'st_column3',
'st_column4': 'st_column4',
'st_column5': 'st_column5',
'st_column6': 'st_column6',
'st_column7': 'st_column7',
'st_column8': 'st_column8',
'st_column9': 'st_column9',
'st_column10': 'st_column10',
'st_column11': 'st_column11',
'st_column12': 'st_column12',
}
col = values[n];
var currentVal = 'Your content goes here';
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "["+col+"]"+ currentVal +"[/"+col+"]");
},
createGoogleMaps: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=gmap&preview=remove');
what = 'st_gmap';
},
createGoogleTrends: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=trends&preview=remove');
what = 'st_trends';
},
createChartPie: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=chart_pie&preview=remove');
what = 'st_chart_pie';
},
createChartBar: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=chart_bar&preview=remove');
what = 'st_chart_bar';
},
createChartArea: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=chart_area&preview=remove');
what = 'st_chart_area';
},
createChartGeo: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=chart_geo&preview=remove');
what = 'st_chart_geo';
},
createChartCombo: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=chart_combo&preview=remove');
what = 'st_chart_combo';
},
createChartOrg: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=chart_org&preview=remove');
what = 'st_chart_org';
},
createChartBubble: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=chart_bubble&preview=remove');
what = 'st_chart_bubble';
},
createGoogleDocs: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=gdocs&preview=remove');
what = 'st_gdocs';
},
pageSiblings: function() {
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_siblings]");
},
children: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=children&preview');
what = 'st_children';
},
contactFormDark: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=contact_form_dark&preview');
what = '<API key>';
},
contactFormLight: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=contact_form_light&preview');
what = '<API key>';
},
createCarousel: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=posts_carousel&preview=remove');
what = 'st_posts_carousel';
},
createSwiper: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=swiper&preview=remove');
what = 'st_swiper';
},
insertAnimated: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=animated&preview=remove');
what = 'st_animated';
},
insertDrawing: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=svg_drawing&preview=remove');
what = 'st_svg_drawing';
},
createIcon: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=icon&preview');
what = 'st_icon';
},
createIconMelon: function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=melonIcon&preview');
what = 'st_icon_melon';
},
createCode: function() {
var currentVal = 'Put your code here';
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, "[st_code]"+ currentVal +"[/st_code]");
}
};
var what = '';
jQuery('#insert').live('click', function(e) {
preview = false;
e.preventDefault();
themeShortcuts.insert(what);
tb_remove();
return false;
});
jQuery('#preview').live('click', function(e) {
preview = true;
e.preventDefault();
themeShortcuts.insert(what);
return false;
});
jQuery('#<API key> input').live('blur', function() {
preview = true;
setTimeout(function() {
themeShortcuts.insert(what);
}, 300);
});
jQuery('#<API key> select').live('change', function() {
preview = true;
setTimeout(function() {
themeShortcuts.insert(what);
}, 300);
});
jQuery('#cancel').live('click', function(e) {
tb_remove();
return false;
});
// CHECK THE VERSION OF TINYMCE !!
if (tinymce.majorVersion < 4) {
// IF IS TINYMCE VERSION 3
tinymce.create('tinymce.plugins.themeShortcuts', {
init: function(ed, url) {
},
createControl: function(n, cm) {
switch (n) {
case 'themeShortcuts':
var c = cm.createSplitButton('themeShortcuts', {
title : 'Theme shortcuts',
image : stPluginUrl + '/images/<API key>.png',
onclick : function() {
c.showMenu();
}
});
c.onRenderMenu.add(function(c,m) {
e = m.addMenu({title : 'Lines'});
e.add({title : 'Break Line', onclick : themeShortcuts.breakLine});
e.add({title : 'Horizontal Line', onclick : themeShortcuts.horizontalLine});
e.add({title : 'Clear', onclick : themeShortcuts.divClear});
var ea = e.addMenu({title : 'Dividers'});
ea.add({title : 'Dotted', onclick : themeShortcuts.createDividerDotted});
ea.add({title : 'Dashed', onclick : themeShortcuts.createDividerDashed});
ea.add({title : 'To Top', onclick : themeShortcuts.createDividerTop});
ea.add({title : 'Shadow', onclick : themeShortcuts.createDividerShadow});
ea.add({title : 'Text', onclick : themeShortcuts.dividerText});
b = m.addMenu({title : 'Buttons'});
b.add({title : 'Button', onclick : function() { themeShortcuts.insertButton() }});
var ba = b.addMenu({title : 'Hover Buttons'});
ba.add({title: 'Fill In', onclick : themeShortcuts.<API key>});
ba.add({title: 'Fancy Icon', onclick : themeShortcuts.<API key>});
ba.add({title: 'Arrows', onclick : themeShortcuts.<API key>});
ba.add({title: 'Icon on hover', onclick : themeShortcuts.<API key>});
ba.add({title: 'Bordered', onclick : themeShortcuts.<API key>});
b.add({title : 'Read More', onclick : themeShortcuts.readMore});
var be = b.addMenu({title : 'Share Buttons'});
be.add({title: 'Twitter', onclick : themeShortcuts.createTwitterButton});
be.add({title: 'Digg', onclick : themeShortcuts.createDiggButton});
be.add({title: 'Facebook Like', onclick : themeShortcuts.createFBlikeButton});
be.add({title: 'Facebook Share', onclick : themeShortcuts.createFBShareButton});
be.add({title: 'LinkedIn', onclick : themeShortcuts.createLIShareButton});
be.add({title: 'Google+', onclick : themeShortcuts.createGplusButton});
be.add({title: 'Pinterest', onclick : themeShortcuts.createPinButton});
be.add({title: 'Tumbler', onclick : themeShortcuts.createTumblrButton});
b.add({title : 'Log in / out button', onclick : themeShortcuts.logInOut});
i = m.addMenu({title : 'Boxes'});
i.add({title : 'Box', onclick : themeShortcuts.insertBox});
i.add({title : 'Callout', onclick : themeShortcuts.insertCallout});
p = m.addMenu({title : 'Icons'});
p.add({title : 'Font Awesome', onclick : themeShortcuts.createIcon});
p.add({title : 'Icon Melon', onclick : themeShortcuts.createIconMelon});
p.add({title : 'Social Icons', onclick : themeShortcuts.createSocialIcon});
m.add({title : 'Animated', onclick : themeShortcuts.insertAnimated});
m.add({title : 'SVG Drawing', onclick : themeShortcuts.insertDrawing});
s = m.addMenu({title : 'Elements'});
s.add({title : 'Tooltip', onclick : themeShortcuts.insertTooltip});
s.add({title : 'Popover', onclick : themeShortcuts.insertPopover});
s.add({title : 'Modal', onclick : themeShortcuts.insertModal});
s.add({title : 'Tabs', onclick : themeShortcuts.createTabs});
s.add({title : 'Toggle', onclick : themeShortcuts.createToggle});
s.add({title : 'Accordion', onclick : themeShortcuts.createAccordion});
s.add({title : 'Progress Bar', onclick : themeShortcuts.createProgressBar});
r = m.addMenu({title : 'Section'});
r.add({title : 'Image', onclick : themeShortcuts.createSectionImage});
r.add({title : 'Color', onclick : themeShortcuts.createSectionColor});
m.add({title : 'Container', onclick : themeShortcuts.createContainer});
h = m.addMenu({title : 'Responsive'});
h.add({title : 'Row', onclick : themeShortcuts.createRow});
h.add({title: '1 column', onclick : function() { themeShortcuts.createColumnLayout('st_column1') }});
h.add({title: '2 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column2') }});
h.add({title: '3 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column3') }});
h.add({title: '4 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column4') }});
h.add({title: '5 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column5') }});
h.add({title: '6 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column6') }});
h.add({title: '7 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column7') }});
h.add({title: '8 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column8') }});
h.add({title: '9 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column9') }});
h.add({title: '10 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column10') }});
h.add({title: '11 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column11') }});
h.add({title: '12 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column12') }});
d = m.addMenu({title : 'Google'});
d.add({title : 'Google Maps', onclick : themeShortcuts.createGoogleMaps});
d.add({title : 'Google Trends', onclick : themeShortcuts.createGoogleTrends});
d.add({title : 'Google Docs', onclick : themeShortcuts.createGoogleDocs});
var da = d.addMenu({title : 'Google Charts'});
da.add({title : 'Pie', onclick : themeShortcuts.createChartPie});
da.add({title : 'Bar', onclick : themeShortcuts.createChartBar});
da.add({title : 'Area', onclick : themeShortcuts.createChartArea});
da.add({title : 'Geo', onclick : themeShortcuts.createChartGeo});
da.add({title : 'Combo', onclick : themeShortcuts.createChartCombo});
da.add({title : 'Org', onclick : themeShortcuts.createChartOrg});
da.add({title : 'Bubble', onclick : themeShortcuts.createChartBubble});
f = m.addMenu({title: 'Lists'});
f.add({title : 'Unordered list', onclick : themeShortcuts.createUnorderedList});
f.add({title : 'Ordered list', onclick : themeShortcuts.createOrderedList});
o = m.addMenu({title: 'Tables'});
o.add({title : 'Styled table', onclick : themeShortcuts.createTables});
o.add({title : 'Pricing table', onclick : themeShortcuts.createPricingTables});
l = m.addMenu({title : 'Media'});
l.add({title : 'Video', onclick : themeShortcuts.createVideo});
var la = l.addMenu({title : 'Audio'});
la.add({title : 'Soundcloud', onclick : themeShortcuts.createSoundcloud});
la.add({title : 'Mixcloud', onclick : themeShortcuts.createMixcloud});
la.add({title : 'Other', onclick : themeShortcuts.createAudio});
d = m.addMenu({title: 'Typography'});
var dc = d.addMenu({title : 'Dropcap'});
dc.add({title : 'Light', onclick : function() { themeShortcuts.dropCap('light') }});
dc.add({title : 'Light Circled', onclick : function() {themeShortcuts.dropCap('light_circled')}});
dc.add({title : 'Dark', onclick : function() {themeShortcuts.dropCap('dark')}});
dc.add({title : 'Dark Circled', onclick : function() {themeShortcuts.dropCap('dark_circled')}});
d.add({title : 'Quote', onclick : themeShortcuts.quote});
d.add({title : 'Highlight', onclick : themeShortcuts.highlight});
var df = d.addMenu({title: 'Label'});
df.add({title : 'Default', onclick : function() { themeShortcuts.labels('default') }});
df.add({title : 'New', onclick : function() {themeShortcuts.labels('success')}});
df.add({title : 'Warning', onclick : function() {themeShortcuts.labels('warning')}});
df.add({title : 'Important', onclick : function() {themeShortcuts.labels('important')}});
df.add({title : 'Notice', onclick : function() {themeShortcuts.labels('notice')}});
d.add({title : 'Colored Text', onclick : themeShortcuts.createTextColor});
d.add({title : 'Abbreviation', onclick : themeShortcuts.abbreviation});
p = m.addMenu({title : 'Related'});
p.add({title : 'Related posts', onclick : themeShortcuts.relatedPosts});
p.add({title : 'Siblings', onclick : themeShortcuts.pageSiblings});
p.add({title : 'Children', onclick : themeShortcuts.children});
k = m.addMenu({title : 'Fancybox'});
k.add({title : 'Images', onclick : themeShortcuts.<API key>});
k.add({title : 'Inline', onclick : themeShortcuts.<API key>});
k.add({title : 'iFrame', onclick : themeShortcuts.<API key>});
k.add({title : 'Page', onclick : themeShortcuts.createFancyboxPage});
k.add({title : 'Swf', onclick : themeShortcuts.createFancyboxSwf});
j = m.addMenu({title : 'Contact form'});
j.add({title : 'Light', onclick : themeShortcuts.contactFormLight});
j.add({title : 'Dark', onclick : themeShortcuts.contactFormDark});
t = m.addMenu({title : 'Carousel'});
t.add({title : 'Post Carousel', onclick : themeShortcuts.createCarousel});
t.add({title : 'Swiper', onclick : themeShortcuts.createSwiper});
//t.add({title : 'Testimonial', onclick : themeShortcuts.createTestimonials});
//m.add({title : 'Countdown', onclick : themeShortcuts.eventCountdown});
m.add({title : 'Code', onclick : themeShortcuts.createCode});
});
return c;
}
return null;
},
});
}else{
// IF IS TINYMCE VERSION 4+
tinymce.create('tinymce.plugins.themeShortcuts', {
init : function(ed, url) {
ed.addButton( 'themeShortcuts', {
type: 'listbox',
text: 'Supreme',
icon: 'supreme',
classes: 'mce-btn supreme-class',
tooltip: 'Supreme Shortcodes',
onselect: function(e) {
},
values: [
{
type: 'listbox',
text: 'Lines',
icon: false,
classes: 'has-dropdown',
values: [
{ text: 'Break Line', onclick : themeShortcuts.breakLine},
{ text: 'Horizontal Line', onclick : themeShortcuts.horizontalLine},
{ text: 'Clear', onclick : themeShortcuts.divClear},
{
type: 'listbox',
text: 'Dividers',
icon: false,
classes: 'has-dropdown',
values: [
{ text: 'Dotted', onclick : function() {
tinymce.execCommand('mceInsertContent', false, '[st_divider_dotted]');
}},
{ text: 'Dashed', onclick : function() {
tinymce.execCommand('mceInsertContent', false, '[st_divider_dashed]');
}},
{ text: 'To Top', onclick : function() {
tinymce.execCommand('mceInsertContent', false, '[st_divider_top]');
}},
{ text: 'Shadow', onclick : function() {
tinymce.execCommand('mceInsertContent', false, '[st_divider_shadow]');
}},
{text: 'Text', onclick : function() {
tb_show('', stPluginUrl + '/ajaxPlugin.php?act=dividerText&preview');
what = 'st_divider_text';
}},
]
},
]
},
{
type: 'listbox',
text: 'Buttons',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Button', onclick : function() { themeShortcuts.insertButton() }},
{
type: 'listbox',
text: 'Hover Button',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Fill In', onclick : function() { themeShortcuts.<API key>() }},
{text: 'Fancy Icon', onclick : function() { themeShortcuts.<API key>() }},
{text: 'Arrows', onclick : function() { themeShortcuts.<API key>() }},
{text: 'Icon on hover', onclick : function() { themeShortcuts.<API key>() }},
{text: 'Bordered', onclick : function() { themeShortcuts.<API key>() }},
]
},
{text: 'Read more', onclick : themeShortcuts.readMore},
{
type: 'listbox',
text: 'Share buttons',
icon: false,
classes: 'has-dropdown',
values: [
{ text: 'Twitter', onclick : themeShortcuts.createTwitterButton},
{ text: 'Digg', onclick : themeShortcuts.createDiggButton},
{ text: 'Facebook Like', onclick : themeShortcuts.createFBlikeButton},
{ text: 'Facebook Share', onclick : themeShortcuts.createFBShareButton},
{ text: 'LinkedIn', onclick : themeShortcuts.createLIShareButton},
{ text: 'Google+', onclick : themeShortcuts.createGplusButton},
{ text: 'Pinterest', onclick : themeShortcuts.createPinButton},
{ text: 'Tumbler', onclick : themeShortcuts.createTumblrButton},
]
},
{text: 'Log in / out button', onclick : themeShortcuts.logInOut},
]
},
{
type: 'listbox',
text: 'Boxes',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Info Box', onclick : themeShortcuts.insertBox},
{text: 'Callout', onclick : themeShortcuts.insertCallout},
]
},
{
type: 'listbox',
text: 'Icons',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Font Awesome', onclick : themeShortcuts.createIcon},
{text: 'Icon Melon', onclick : themeShortcuts.createIconMelon},
{text: 'Social Icons', onclick : themeShortcuts.createSocialIcon},
]
},
{classes: 'no-dropdown', text: 'Animated', onclick : themeShortcuts.insertAnimated},
{classes: 'no-dropdown', text: 'SVG Drawing', onclick : themeShortcuts.insertDrawing},
{
type: 'listbox',
text: 'Elements',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Tooltip', onclick : themeShortcuts.insertTooltip},
{text: 'Popover', onclick : themeShortcuts.insertPopover},
{text: 'Modal', onclick : themeShortcuts.insertModal},
{text: 'Tabs', onclick : themeShortcuts.createTabs},
{text: 'Toggle', onclick : themeShortcuts.createToggle},
{text: 'Accordion', onclick : themeShortcuts.createAccordion},
{text: 'Progress Bar', onclick : themeShortcuts.createProgressBar},
]
},
{
type: 'listbox',
text: 'Section',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Image', onclick : themeShortcuts.createSectionImage},
{text: 'Color', onclick : themeShortcuts.createSectionColor},
]
},
{classes: 'no-dropdown', text: 'Container', onclick : themeShortcuts.createContainer},
{
type: 'listbox',
text: 'Responsive',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Row', onclick : themeShortcuts.createRow},
{text: '1 column', onclick : function() { themeShortcuts.createColumnLayout('st_column1') }},
{text: '2 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column2') }},
{text: '3 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column3') }},
{text: '4 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column4') }},
{text: '5 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column5') }},
{text: '6 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column6') }},
{text: '7 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column7') }},
{text: '8 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column8') }},
{text: '9 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column9') }},
{text: '10 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column10') }},
{text: '11 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column11') }},
{text: '12 columns', onclick : function() { themeShortcuts.createColumnLayout('st_column12') }},
]
},
{
type: 'listbox',
text: 'Google',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Google Maps', onclick : themeShortcuts.createGoogleMaps},
{text: 'Google Trends', onclick : themeShortcuts.createGoogleTrends},
{text: 'Google Docs', onclick : themeShortcuts.createGoogleDocs},
{
type: 'listbox',
text: 'Google Charts',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Pie', onclick : themeShortcuts.createChartPie},
{text: 'Bar', onclick : themeShortcuts.createChartBar},
{text: 'Area', onclick : themeShortcuts.createChartArea},
{text: 'Geo', onclick : themeShortcuts.createChartGeo},
{text: 'Combo', onclick : themeShortcuts.createChartCombo},
{text: 'Org', onclick : themeShortcuts.createChartOrg},
{text: 'Bubble', onclick : themeShortcuts.createChartBubble},
]
},
]
},
{
type: 'listbox',
text: 'Lists',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Unordered list', onclick : themeShortcuts.createUnorderedList},
{text: 'Ordered list', onclick : themeShortcuts.createOrderedList},
]
},
{
type: 'listbox',
text: 'Tables',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Styled table', onclick : themeShortcuts.createTables},
{text: 'Pricing table', onclick : themeShortcuts.createPricingTables},
]
},
{
type: 'listbox',
text: 'Media',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Video', onclick : themeShortcuts.createVideo},
{
type: 'listbox',
text: 'Audio',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Soundcloud', onclick : themeShortcuts.createSoundcloud},
{text: 'Mixcloud', onclick : themeShortcuts.createMixcloud},
{text: 'Other', onclick : themeShortcuts.createAudio},
]
},
]
},
{
type: 'listbox',
text: 'Typography',
icon: false,
classes: 'has-dropdown',
values: [
{
type: 'listbox',
text: 'Dropcap',
icon: false,
values: [
{text: 'Light', onclick : function() {themeShortcuts.dropCap('light')}},
{text: 'Light Circled', onclick : function() {themeShortcuts.dropCap('light_circled')}},
{text: 'Dark', onclick : function() {themeShortcuts.dropCap('dark')}},
{text: 'Dark Circled', onclick : function() {themeShortcuts.dropCap('dark_circled')}},
]
},
{text: 'Quote', onclick : themeShortcuts.quote},
{text: 'Highlight', onclick : themeShortcuts.highlight},
{
type: 'listbox',
text: 'Label',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Default', onclick : function() { themeShortcuts.labels('default') }},
{text: 'New', onclick : function() { themeShortcuts.labels('success') }},
{text: 'Warning', onclick : function() { themeShortcuts.labels('warning') }},
{text: 'Important', onclick : function() { themeShortcuts.labels('important') }},
{text: 'Notice', onclick : function() { themeShortcuts.labels('notice') }},
]
},
{text: 'Colored Text', onclick : themeShortcuts.createTextColor},
{text: 'Abbreviation', onclick : themeShortcuts.abbreviation},
]
},
{
type: 'listbox',
text: 'Related',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Related posts', onclick : themeShortcuts.relatedPosts},
{text: 'Siblings', onclick : themeShortcuts.pageSiblings},
{text: 'Children', onclick : themeShortcuts.children},
]
},
{
type: 'listbox',
text: 'Fancybox',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Images', onclick : themeShortcuts.<API key>},
{text: 'Inline', onclick : themeShortcuts.<API key>},
{text: 'iFrame', onclick : themeShortcuts.<API key>},
{text: 'Page', onclick : themeShortcuts.createFancyboxPage},
{text: 'Swf', onclick : themeShortcuts.createFancyboxSwf},
]
},
{
type: 'listbox',
text: 'Contact form',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Light', onclick : themeShortcuts.contactFormLight},
{text: 'Dark', onclick : themeShortcuts.contactFormDark},
]
},
{
type: 'listbox',
text: 'Carousel',
icon: false,
classes: 'has-dropdown',
values: [
{text: 'Post Carousel', onclick : themeShortcuts.createCarousel},
{text: 'Swiper', onclick : themeShortcuts.createSwiper},
//{text: 'Testimonial', onclick : themeShortcuts.createTestimonials},
]
},
//{classes: 'no-dropdown', text: 'Countdown', onclick : themeShortcuts.eventCountdown},
{classes: 'no-dropdown', text: 'Code', onclick : themeShortcuts.createCode},
]
});
},
});
};//end else
tinymce.PluginManager.add('themeShortcuts', tinymce.plugins.themeShortcuts);
})()
|
title: RubyBlock/Proc/lambda
date: 2016-03-14 12:38:56
tags: ["Ruby"]
categories: [""]
RubyBlock Proc Proc lambda Proc
Block Proc.new
Block Proc Block Proc Lambda
Block do~end {} yield
def method_block
yield
end
method_block { p "block" }
#=> "block"
Block Proc.new
Proc call
def method_block(&block)
block.call
end
method_block { p "block" }
#=> "block"
Proc.new
proc = Proc.new{ |a| p a * 2 }
proc.call(2)
<!-- more -->
Proc.new lambda
lambda Proc Proc.new call
def method_lambda
lambda1 = lambda{ p "lambda" }
lambda1.call
end
method_lambda
#=> "lambda"
Proc.new
lambda lambda Proc.new
Proc.new
proc = Proc.new{ |a,b,c| p "#{a},#{b},#{c}" }
proc.call(2, 4)
#=> 2,4,nil
lambda
lambda1 = lambda{ |a,b,c| p "#{a},#{b},#{c}" }
lambda1.call(2, 4)
#=> wrong number of arguments (2 for 3) (ArgumentError)
# return break
Proc.new
def method_proc
proc = Proc.new { return p "proc" }
proc.call
p "method_proc"
end
#=>"proc"
lambda
def method_lambda
lambda1 = lambda{ return p "lambda" }
lambda1.call
p "method_lambda"
end
method_lambda
#=>"lambda"
# "method_lambda"
`Proc.new` `return` method_proc `lambda` `method_lambda`
|
do
-- Check Member
local function <API key>(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
group_type = 'Realm',
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_name = 'yes',
lock_photo = 'no',
lock_member = 'no',
flood = 'yes'
}
}
save_data(_config.moderation.data, data)
local realms = 'realms'
if not data[tostring(realms)] then
data[tostring(realms)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(realms)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Welcome to your new realm !')
end
end
end
local function <API key>(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
group_type = 'Realm',
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_name = 'yes',
lock_photo = 'no',
lock_member = 'no',
flood = 'yes'
}
}
save_data(_config.moderation.data, data)
local realms = 'realms'
if not data[tostring(realms)] then
data[tostring(realms)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(realms)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Realm has been added!')
end
end
end
function check_member_group(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
group_type = 'Group',
moderators = {},
set_owner = member_id ,
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_name = 'yes',
lock_photo = 'no',
lock_member = 'no',
flood = 'yes',
}
}
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'You have been promoted as the owner.')
end
end
end
local function check_member_modadd(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
group_type = 'Group',
moderators = {},
set_owner = member_id ,
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_name = 'yes',
lock_photo = 'no',
lock_member = 'no',
flood = 'yes',
}
}
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Group is added and you have been promoted as the owner ')
end
end
end
local function automodadd(msg)
local data = load_data(_config.moderation.data)
if msg.action.type == 'chat_created' then
receiver = get_receiver(msg)
chat_info(receiver, check_member_group,{receiver=receiver, data=data, msg = msg})
end
end
local function autorealmadd(msg)
local data = load_data(_config.moderation.data)
if msg.action.type == 'chat_created' then
receiver = get_receiver(msg)
chat_info(receiver, <API key>,{receiver=receiver, data=data, msg = msg})
end
end
local function <API key>(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Realm configuration removal
data[tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local realms = 'realms'
if not data[tostring(realms)] then
data[tostring(realms)] = nil
save_data(_config.moderation.data, data)
end
data[tostring(realms)][tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Realm has been removed!')
end
end
end
local function check_member_modrem(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration removal
data[tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = nil
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Group has been removed')
end
end
end
--End Check Member
local function <API key>(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local data = load_data(_config.moderation.data)
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['settings']['flood_msg_max'] then
NUM_MSG_MAX = tonumber(data[tostring(msg.to.id)]['settings']['flood_msg_max'])
print('custom'..NUM_MSG_MAX)
else
NUM_MSG_MAX = 5
end
end
local bots_protection = "Yes"
if data[tostring(msg.to.id)]['settings']['lock_bots'] then
bots_protection = data[tostring(msg.to.id)]['settings']['lock_bots']
end
local leave_ban = "no"
if data[tostring(msg.to.id)]['settings']['leave_ban'] then
leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban']
end
local settings = data[tostring(target)]['settings']
local text = "Group settings:\nLock group name : "..settings.lock_name.."\nLock group photo : "..settings.lock_photo.."\nLock group member : "..settings.lock_member.."\nLock group leave : "..leave_ban.."\nflood sensitivity : "..NUM_MSG_MAX.."\nBot protection : "..bots_protection--"\nPublic: "..public
return text
end
local function set_descriptionmod(msg, data, target, about)
if not is_momod(msg) then
return "For moderators only!"
end
local data_cat = 'description'
data[tostring(target)][data_cat] = about
save_data(_config.moderation.data, data)
return 'Set group description to:\n'..about
end
local function get_description(msg, data)
local data_cat = 'description'
if not data[tostring(msg.to.id)][data_cat] then
return 'No description available.'
end
local about = data[tostring(msg.to.id)][data_cat]
local about = string.gsub(msg.to.print_name, "_", " ")..':\n\n'..about
return 'About '..about
end
local function lock_group_arabic(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'yes' then
return 'Arabic is already locked'
else
data[tostring(target)]['settings']['lock_arabic'] = 'yes'
save_data(_config.moderation.data, data)
return 'Arabic has been locked'
end
end
local function unlock_group_arabic(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'no' then
return 'Arabic is already unlocked'
else
data[tostring(target)]['settings']['lock_arabic'] = 'no'
save_data(_config.moderation.data, data)
return 'Arabic has been unlocked'
end
end
local function lock_group_bots(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_bots_lock = data[tostring(target)]['settings']['lock_bots']
if group_bots_lock == 'yes' then
return 'Bots protection is already enabled'
else
data[tostring(target)]['settings']['lock_bots'] = 'yes'
save_data(_config.moderation.data, data)
return 'Bots protection has been enabled'
end
end
local function unlock_group_bots(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_bots_lock = data[tostring(target)]['settings']['lock_bots']
if group_bots_lock == 'no' then
return 'Bots protection is already disabled'
else
data[tostring(target)]['settings']['lock_bots'] = 'no'
save_data(_config.moderation.data, data)
return 'Bots protection has been disabled'
end
end
local function lock_group_namemod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'yes' then
return 'Group name is already locked'
else
data[tostring(target)]['settings']['lock_name'] = 'yes'
save_data(_config.moderation.data, data)
rename_chat('chat#id'..target, group_name_set, ok_cb, false)
return 'Group name has been locked'
end
end
local function <API key>(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'no' then
return 'Group name is already unlocked'
else
data[tostring(target)]['settings']['lock_name'] = 'no'
save_data(_config.moderation.data, data)
return 'Group name has been unlocked'
end
end
local function lock_group_floodmod(msg, data, target)
if not is_owner(msg) then
return "Only admins can do it for now"
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'yes' then
return 'Group flood is locked'
else
data[tostring(target)]['settings']['flood'] = 'yes'
save_data(_config.moderation.data, data)
return 'Group flood has been locked'
end
end
local function <API key>(msg, data, target)
if not is_owner(msg) then
return "Only admins can do it for now"
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'no' then
return 'Group flood is not locked'
else
data[tostring(target)]['settings']['flood'] = 'no'
save_data(_config.moderation.data, data)
return 'Group flood has been unlocked'
end
end
local function <API key>(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'yes' then
return 'Group members are already locked'
else
data[tostring(target)]['settings']['lock_member'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'Group members has been locked'
end
local function <API key>(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'no' then
return 'Group members are not locked'
else
data[tostring(target)]['settings']['lock_member'] = 'no'
save_data(_config.moderation.data, data)
return 'Group members has been unlocked'
end
end
local function <API key>(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_member_lock = data[tostring(target)]['settings']['public']
if group_member_lock == 'yes' then
return 'Group is already public'
else
data[tostring(target)]['settings']['public'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'Group is now: public'
end
local function <API key>(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_member_lock = data[tostring(target)]['settings']['public']
if group_member_lock == 'no' then
return 'Group is not public'
else
data[tostring(target)]['settings']['public'] = 'no'
save_data(_config.moderation.data, data)
return 'Group is now: not public'
end
end
local function lock_group_leave(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban']
if leave_ban == 'yes' then
return 'Leaving users will be banned'
else
data[tostring(msg.to.id)]['settings']['leave_ban'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'Leaving users will be banned'
end
local function unlock_group_leave(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban']
if leave_ban == 'no' then
return 'Leaving users will not be banned'
else
data[tostring(msg.to.id)]['settings']['leave_ban'] = 'no'
save_data(_config.moderation.data, data)
return 'Leaving users will not be banned'
end
end
local function <API key>(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_photo_lock = data[tostring(target)]['settings']['lock_photo']
if group_photo_lock == 'no' then
return 'Group photo is not locked'
else
data[tostring(target)]['settings']['lock_photo'] = 'no'
save_data(_config.moderation.data, data)
return 'Group photo has been unlocked'
end
end
local function set_rulesmod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local data_cat = 'rules'
data[tostring(target)][data_cat] = rules
save_data(_config.moderation.data, data)
return 'Set group rules to:\n'..rules
end
local function modadd(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "You're not admin"
end
local data = load_data(_config.moderation.data)
if is_group(msg) then
return 'Group is already added.'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_modadd,{receiver=receiver, data=data, msg = msg})
end
local function realmadd(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "You're not admin"
end
local data = load_data(_config.moderation.data)
if is_realm(msg) then
return 'Realm is already added.'
end
receiver = get_receiver(msg)
chat_info(receiver, <API key>,{receiver=receiver, data=data, msg = msg})
end
-- Global functions
function modrem(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "You're not admin"
end
local data = load_data(_config.moderation.data)
if not is_group(msg) then
return 'Group is not added.'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_modrem,{receiver=receiver, data=data, msg = msg})
end
function realmrem(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "You're not admin"
end
local data = load_data(_config.moderation.data)
if not is_realm(msg) then
return 'Realm is not added.'
end
receiver = get_receiver(msg)
chat_info(receiver, <API key>,{receiver=receiver, data=data, msg = msg})
end
local function get_rules(msg, data)
local data_cat = 'rules'
if not data[tostring(msg.to.id)][data_cat] then
return 'No rules available.'
end
local rules = data[tostring(msg.to.id)][data_cat]
local rules = 'Chat rules:\n'..rules
return rules
end
local function set_group_photo(msg, success, result)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
if success then
local file = 'data/photos/chat_photo_'..msg.to.id..'.jpg'
print('File downloaded to:', result)
os.rename(result, file)
print('File moved to:', file)
chat_set_photo (receiver, file, ok_cb, false)
data[tostring(msg.to.id)]['settings']['set_photo'] = file
save_data(_config.moderation.data, data)
data[tostring(msg.to.id)]['settings']['lock_photo'] = 'yes'
save_data(_config.moderation.data, data)
send_large_msg(receiver, 'Photo saved!', ok_cb, false)
else
print('Error downloading: '..msg.id)
send_large_msg(receiver, 'Failed, please try again!', ok_cb, false)
end
end
local function promote(receiver, member_username, member_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'chat
if not data[group] then
return send_large_msg(receiver, 'Group is not added.')
end
if data[group]['moderators'][tostring(member_id)] then
return send_large_msg(receiver, member_username..' is already a moderator.')
end
data[group]['moderators'][tostring(member_id)] = member_username
save_data(_config.moderation.data, data)
return send_large_msg(receiver, member_username..' has been promoted.')
end
local function promote_by_reply(extra, success, result)
local msg = result
local full_name = (msg.from.first_name or '')..' '..(msg.from.last_name or '')
if msg.from.username then
member_username = '@'.. msg.from.username
else
member_username = full_name
end
local member_id = msg.from.id
if msg.to.type == 'chat' then
return promote(get_receiver(msg), member_username, member_id)
end
end
local function demote(receiver, member_username, member_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'chat
if not data[group] then
return send_large_msg(receiver, 'Group is not added.')
end
if not data[group]['moderators'][tostring(member_id)] then
return send_large_msg(receiver, member_username..' is not a moderator.')
end
data[group]['moderators'][tostring(member_id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, member_username..' has been demoted.')
end
local function demote_by_reply(extra, success, result)
local msg = result
local full_name = (msg.from.first_name or '')..' '..(msg.from.last_name or '')
if msg.from.username then
member_username = '@'..msg.from.username
else
member_username = full_name
end
local member_id = msg.from.id
if msg.to.type == 'chat' then
return demote(get_receiver(msg), member_username, member_id)
end
end
local function setowner_by_reply(extra, success, result)
local msg = result
local receiver = get_receiver(msg)
local data = load_data(_config.moderation.data)
local name_log = msg.from.print_name:gsub("_", " ")
data[tostring(msg.to.id)]['set_owner'] = tostring(msg.from.id)
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] setted ["..msg.from.id.."] as owner")
local text = msg.from.print_name:gsub("_", " ").." is the owner now"
return send_large_msg(receiver, text)
end
local function promote_demote_res(extra, success, result)
--vardump(result)
--vardump(extra)
local member_id = result.id
local member_username = "@"..result.username
local chat_id = extra.chat_id
local mod_cmd = extra.mod_cmd
local receiver = "chat#id"..chat_id
if mod_cmd == 'promote' then
return promote(receiver, member_username, member_id)
elseif mod_cmd == 'demote' then
return demote(receiver, member_username, member_id)
end
end
local function modlist(msg)
local data = load_data(_config.moderation.data)
local groups = "groups"
if not data[tostring(groups)][tostring(msg.to.id)] then
return 'Group is not added.'
end
-- determine if table is empty
if next(data[tostring(msg.to.id)]['moderators']) == nil then --fix way
return 'No moderator in this group.'
end
local i = 1
local message = '\nList of moderators for ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n'
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
message = message ..i..' - '..v..' [' ..k.. '] \n'
i = i + 1
end
return message
end
local function callbackres(extra, success, result)
--vardump(result)
local user = result.id
local name = string.gsub(result.print_name, "_", " ")
local chat = 'chat#id'..extra.chatid
send_large_msg(chat, user..'\n'..name)
return user
end
local function help()
local help_text = tostring(_config.help_text)
return help_text
end
local function cleanmember(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
for k,v in pairs(result.members) do
kick_user(v.id, result.id)
end
end
local function killchat(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
for k,v in pairs(result.members) do
kick_user_any(v.id, result.id)
end
end
local function killrealm(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
for k,v in pairs(result.members) do
kick_user_any(v.id, result.id)
end
end
local function user_msgs(user_id, chat_id)
local user_info
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info = tonumber(redis:get(um_hash) or 0)
return user_info
end
local function kick_zero(cb_extra, success, result)
local chat_id = cb_extra.chat_id
local chat = "chat#id"..chat_id
local ci_user
local re_user
for k,v in pairs(result.members) do
local si = false
ci_user = v.id
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
for i = 1, #users do
re_user = users[i]
if tonumber(ci_user) == tonumber(re_user) then
si = true
end
end
if not si then
if ci_user ~= our_id then
if not is_momod2(ci_user, chat_id) then
chat_del_user(chat, 'user#id'..ci_user, ok_cb, true)
end
end
end
end
end
local function kick_inactive(chat_id, num, receiver)
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = user_msgs(user_id, chat_id)
local nmsg = user_info
if tonumber(nmsg) < tonumber(num) then
if not is_momod2(user_id, chat_id) then
chat_del_user('chat#id'..chat_id, 'user#id'..user_id, ok_cb, true)
end
end
end
return chat_info(receiver, kick_zero, {chat_id = chat_id})
end
local function run(msg, matches)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
local name_log = user_print_name(msg.from)
local group = msg.to.id
if msg.media then
if msg.media.type == 'photo' and data[tostring(msg.to.id)]['settings']['set_photo'] == 'waiting' and is_chat_msg(msg) and is_momod(msg) then
load_photo(msg.id, set_group_photo, msg)
end
end
if matches[1] == 'add' and not matches[2] then
if is_realm(msg) then
return 'Error: Already a realm.'
end
print("group "..msg.to.print_name.."("..msg.to.id..") added")
return modadd(msg)
end
if matches[1] == 'add' and matches[2] == 'realm' then
if is_group(msg) then
return 'Error: Already a group.'
end
print("group "..msg.to.print_name.."("..msg.to.id..") added as a realm")
return realmadd(msg)
end
if matches[1] == 'rem' and not matches[2] then
print("group "..msg.to.print_name.."("..msg.to.id..") removed")
return modrem(msg)
end
if matches[1] == 'rem' and matches[2] == 'realm' then
print("group "..msg.to.print_name.."("..msg.to.id..") removed as a realm")
return realmrem(msg)
end
if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "group" then
return automodadd(msg)
end
if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "realm" then
return autorealmadd(msg)
end
if msg.to.id and data[tostring(msg.to.id)] then
local settings = data[tostring(msg.to.id)]['settings']
if matches[1] == 'chat_add_user' then
if not msg.service then
return "Are you trying to troll me?"
end
local group_member_lock = settings.lock_member
local user = 'user#id'..msg.action.user.id
local chat = 'chat#id'..msg.to.id
if group_member_lock == 'yes' and not is_owner2(msg.action.user.id, msg.to.id) then
chat_del_user(chat, user, ok_cb, true)
elseif group_member_lock == 'yes' and tonumber(msg.from.id) == tonumber(our_id) then
return nil
elseif group_member_lock == 'no' then
return nil
end
end
if matches[1] == 'chat_del_user' then
if not msg.service then
-- return "Are you trying to troll me?"
end
local user = 'user#id'..msg.action.user.id
local chat = 'chat#id'..msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] deleted user "..user)
end
if matches[1] == 'chat_delete_photo' then
if not msg.service then
return "Are you trying to troll me?"
end
local group_photo_lock = settings.lock_photo
if group_photo_lock == 'yes' then
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:incr(picturehash)
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
local picprotectionredis = redis:get(picturehash)
if picprotectionredis then
if tonumber(picprotectionredis) == 4 and not is_owner(msg) then
kick_user(msg.from.id, msg.to.id)
end
if tonumber(picprotectionredis) == 8 and not is_owner(msg) then
ban_user(msg.from.id, msg.to.id)
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:set(picturehash, 0)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to deleted picture but failed ")
chat_set_photo(receiver, settings.set_photo, ok_cb, false)
elseif group_photo_lock == 'no' then
return nil
end
end
if matches[1] == 'chat_change_photo' and msg.from.id ~= 0 then
if not msg.service then
return "Are you trying to troll me?"
end
local group_photo_lock = settings.lock_photo
if group_photo_lock == 'yes' then
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:incr(picturehash)
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
local picprotectionredis = redis:get(picturehash)
if picprotectionredis then
if tonumber(picprotectionredis) == 4 and not is_owner(msg) then
kick_user(msg.from.id, msg.to.id)
end
if tonumber(picprotectionredis) == 8 and not is_owner(msg) then
ban_user(msg.from.id, msg.to.id)
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:set(picturehash, 0)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to change picture but failed ")
chat_set_photo(receiver, settings.set_photo, ok_cb, false)
elseif group_photo_lock == 'no' then
return nil
end
end
if matches[1] == 'chat_rename' then
if not msg.service then
return "Are you trying to troll me?"
end
local group_name_set = settings.set_name
local group_name_lock = settings.lock_name
local to_rename = 'chat#id'..msg.to.id
if group_name_lock == 'yes' then
if group_name_set ~= tostring(msg.to.print_name) then
local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id
redis:incr(namehash)
local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id
local nameprotectionredis = redis:get(namehash)
if nameprotectionredis then
if tonumber(nameprotectionredis) == 4 and not is_owner(msg) then
kick_user(msg.from.id, msg.to.id)
end
if tonumber(nameprotectionredis) == 8 and not is_owner(msg) then
ban_user(msg.from.id, msg.to.id)
local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id
redis:set(namehash, 0)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to change name but failed ")
rename_chat(to_rename, group_name_set, ok_cb, false)
end
elseif group_name_lock == 'no' then
return nil
end
end
if matches[1] == 'setname' and is_momod(msg) then
local new_name = string.gsub(matches[2], '_', ' ')
data[tostring(msg.to.id)]['settings']['set_name'] = new_name
save_data(_config.moderation.data, data)
local group_name_set = data[tostring(msg.to.id)]['settings']['set_name']
local to_rename = 'chat#id'..msg.to.id
rename_chat(to_rename, group_name_set, ok_cb, false)
savelog(msg.to.id, "Group { "..msg.to.print_name.." } name changed to [ "..new_name.." ] by "..name_log.." ["..msg.from.id.."]")
end
if matches[1] == 'setphoto' and is_momod(msg) then
data[tostring(msg.to.id)]['settings']['set_photo'] = 'waiting'
save_data(_config.moderation.data, data)
return 'Please send me new group photo now'
end
if matches[1] == 'promote' and not matches[2] then
if not is_owner(msg) then
return "Only the owner can prmote new moderators"
end
if type(msg.reply_id)~="nil" then
msgr = get_message(msg.reply_id, promote_by_reply, false)
end
end
if matches[1] == 'promote' and matches[2] then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "Only owner can promote"
end
local member = matches[2]
savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted @".. member)
local cbres_extra = {
chat_id = msg.to.id,
mod_cmd = 'promote',
from_id = msg.from.id
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
return res_user(username, promote_demote_res, cbres_extra)
end
if matches[1] == 'demote' and not matches[2] then
if not is_owner(msg) then
return "Only the owner can demote moderators"
end
if type(msg.reply_id)~="nil" then
msgr = get_message(msg.reply_id, demote_by_reply, false)
end
end
if matches[1] == 'demote' and matches[2] then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "Only owner can demote"
end
if string.gsub(matches[2], "@", "") == msg.from.username and not is_owner(msg) then
return "You can't demote yourself"
end
local member = matches[2]
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted @".. member)
local cbres_extra = {
chat_id = msg.to.id,
mod_cmd = 'demote',
from_id = msg.from.id
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
return res_user(username, promote_demote_res, cbres_extra)
end
if matches[1] == 'modlist' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group modlist")
return modlist(msg)
end
if matches[1] == 'about' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group description")
return get_description(msg, data)
end
if matches[1] == 'rules' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group rules")
return get_rules(msg, data)
end
if matches[1] == 'set' then
if matches[2] == 'rules' then
rules = matches[3]
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] has changed group rules to ["..matches[3].."]")
return set_rulesmod(msg, data, target)
end
if matches[2] == 'about' then
local data = load_data(_config.moderation.data)
local target = msg.to.id
local about = matches[3]
savelog(msg.to.id, name_log.." ["..msg.from.id.."] has changed group description to ["..matches[3].."]")
return set_descriptionmod(msg, data, target, about)
end
end
if matches[1] == 'lock' then
local target = msg.to.id
if matches[2] == 'name' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked name ")
return lock_group_namemod(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked member ")
return <API key>(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked flood ")
return lock_group_floodmod(msg, data, target)
end
if matches[2] == 'arabic' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked arabic ")
return lock_group_arabic(msg, data, target)
end
if matches[2] == 'bots' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked bots ")
return lock_group_bots(msg, data, target)
end
if matches[2] == 'leave' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked leaving ")
return lock_group_leave(msg, data, target)
end
end
if matches[1] == 'unlock' then
local target = msg.to.id
if matches[2] == 'name' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked name ")
return <API key>(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked member ")
return <API key>(msg, data, target)
end
if matches[2] == 'photo' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked photo ")
return <API key>(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked flood ")
return <API key>(msg, data, target)
end
if matches[2] == 'arabic' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked arabic ")
return unlock_group_arabic(msg, data, target)
end
if matches[2] == 'bots' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked bots ")
return unlock_group_bots(msg, data, target)
end
if matches[2] == 'leave' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked leaving ")
return unlock_group_leave(msg, data, target)
end
end
if matches[1] == 'settings' then
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group settings ")
return <API key>(msg, data, target)
end
--[[if matches[1] == 'public' then
local target = msg.to.id
if matches[2] == 'yes' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: public")
return <API key>(msg, data, target)
end
if matches[2] == 'no' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: not public")
return <API key>(msg, data, target)
end
end]]
if matches[1] == 'newlink' and not is_realm(msg) then
if not is_momod(msg) then
return "For moderators only!"
end
local function callback (extra , success, result)
local receiver = 'chat#'..msg.to.id
if success == 0 then
return send_large_msg(receiver, '*Error: Invite link failed* \nReason: Not creator.')
end
send_large_msg(receiver, "Created a new link")
data[tostring(msg.to.id)]['settings']['set_link'] = result
save_data(_config.moderation.data, data)
end
local receiver = 'chat#'..msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] revoked group link ")
return export_chat_link(receiver, callback, true)
end
if matches[1] == 'link' then
if not is_momod(msg) then
return "For moderators only!"
end
local group_link = data[tostring(msg.to.id)]['settings']['set_link']
if not group_link then
return "Create a link using /newlink first !"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group link ["..group_link.."]")
return "Group link:\n"..group_link
end
if matches[1] == 'setowner' and matches[2] then
if not is_owner(msg) then
return "For owner only!"
end
data[tostring(msg.to.id)]['set_owner'] = matches[2]
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set ["..matches[2].."] as owner")
local text = matches[2].." added as owner"
return text
end
if matches[1] == 'setowner' and not matches[2] then
if not is_owner(msg) then
return "only for the owner!"
end
if type(msg.reply_id)~="nil" then
msgr = get_message(msg.reply_id, setowner_by_reply, false)
end
end
if matches[1] == 'owner' then
local group_owner = data[tostring(msg.to.id)]['set_owner']
local user_info = redis:hgetall('user:'..group_owner)
if not group_owner then
return "no owner,ask admins in support groups to set owner for your group"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] used /owner")
if user_info.username then
return "Group onwer is @"..user_info.username.." ["..group_owner.."]"
else
return "Group owner is ["..group_owner..']'
end
end
if matches[1] == 'setgpowner' then
local receiver = "chat#id"..matches[2]
if not is_admin(msg) then
return "For admins only!"
end
data[tostring(matches[2])]['set_owner'] = matches[3]
save_data(_config.moderation.data, data)
local text = matches[3].." added as owner"
send_large_msg(receiver, text)
return
end
if matches[1] == 'setflood' then
if not is_momod(msg) then
return "For moderators only!"
end
if tonumber(matches[2]) < 5 or tonumber(matches[2]) > 20 then
return "Wrong number,range is [5-20]"
end
local flood_max = matches[2]
data[tostring(msg.to.id)]['settings']['flood_msg_max'] = flood_max
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set flood to ["..matches[2].."]")
return 'Group flood has been set to '..matches[2]
end
if matches[1] == 'clean' then
if not is_owner(msg) then
return "Only owner can clean"
end
if matches[2] == 'member' then
if not is_owner(msg) then
return "Only admins can clean members"
end
local receiver = get_receiver(msg)
chat_info(receiver, cleanmember, {receiver=receiver})
end
if matches[2] == 'modlist' then
if next(data[tostring(msg.to.id)]['moderators']) == nil then --fix way
return 'No moderator in this group.'
end
local message = '\nList of moderators for ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n'
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
data[tostring(msg.to.id)]['moderators'][tostring(k)] = nil
save_data(_config.moderation.data, data)
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned modlist")
end
if matches[2] == 'rules' then
local data_cat = 'rules'
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned rules")
end
if matches[2] == 'about' then
local data_cat = 'description'
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned about")
end
end
if matches[1] == 'kill' and matches[2] == 'chat' then
if not is_admin(msg) then
return nil
end
if not is_realm(msg) then
local receiver = get_receiver(msg)
return modrem(msg),
print("Closing Group..."),
chat_info(receiver, killchat, {receiver=receiver})
else
return 'This is a realm'
end
end
if matches[1] == 'kill' and matches[2] == 'realm' then
if not is_admin(msg) then
return nil
end
if not is_group(msg) then
local receiver = get_receiver(msg)
return realmrem(msg),
print("Closing Realm..."),
chat_info(receiver, killrealm, {receiver=receiver})
else
return 'This is a group'
end
end
if matches[1] == 'help' then
if not is_momod(msg) or is_realm(msg) then
return
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /help")
return help()
end
if matches[1] == 'res' and is_momod(msg) then
local cbres_extra = {
chatid = msg.to.id
}
local username = matches[2]
local username = username:gsub("@","")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /res "..username)
return res_user(username, callbackres, cbres_extra)
end
if matches[1] == 'kickinactive' then
--send_large_msg('chat#id'..msg.to.id, 'I\'m in matches[1]')
if not is_momod(msg) then
return 'Only a moderator can kick inactive users'
end
local num = 1
if matches[2] then
num = matches[2]
end
local chat_id = msg.to.id
local receiver = get_receiver(msg)
return kick_inactive(chat_id, num, receiver)
end
end
end
return {
patterns = {
"^[!/](add)$",
"^[!/](add) (realm)$",
"^[!/](rem)$",
"^[!/](rem) (realm)$",
"^[!/](rules)$",
"^[!/](about)$",
"^[!/](setname) (.*)$",
"^[!/](setphoto)$",
"^[!/](promote) (.*)$",
"^[!/](promote)",
"^[!/](help)$",
"^[!/](clean) (.*)$",
"^[!/](kill) (chat)$",
"^[!/](kill) (realm)$",
"^[!/](demote) (.*)$",
"^[!/](demote)",
"^[!/](set) ([^%s]+) (.*)$",
"^[!/](lock) (.*)$",
"^[!/](setowner) (%d+)$",
"^[!/](setowner)",
"^[!/](owner)$",
"^[!/](res) (.*)$",
"^[!/](setgpowner) (%d+) (%d+)$",-- (group id) (owner id)
"^[!/](unlock) (.*)$",
"^[!/](setflood) (%d+)$",
"^[!/](settings)$",
-- "^[!/](public) (.*)$",
"^[!/](modlist)$",
"^[!/](newlink)$",
"^[!/](link)$",
"^[!/](kickinactive)$",
"^[!/](kickinactive) (%d+)$",
"%[(photo)%]",
"^!!tgservice (.+)$",
},
run = run
}
end
|
require 'rails_helper'
BitcoinConf = Rails.configuration.payment
def give_bitcoins(amount, address, confirm=false)
http = Net::HTTP.start(BitcoinConf['host'], BitcoinConf['port'])
req = Net::HTTP::Post.new("/debug/give/#{amount}/#{address}")
req.basic_auth BitcoinConf['user'], BitcoinConf['password']
http.request(req)
if confirm
gen_blocks 3
end
end
def gen_blocks(number)
http = Net::HTTP.start(BitcoinConf['host'], BitcoinConf['port'])
req = Net::HTTP::Post.new("/debug/gen/#{number}")
req.basic_auth BitcoinConf['user'], BitcoinConf['password']
http.request(req)
end
def sync
http = Net::HTTP.start(BitcoinConf['host'], BitcoinConf['port'])
req = Net::HTTP::Post.new('/sync')
req.basic_auth BitcoinConf['user'], BitcoinConf['password']
http.request(req)
end
RSpec.describe BitcoinHelper, type: :helper do
describe 'with bitcoin adapter running' do
it 'should not throw error on new_address' do
expect do
new_address
end.not_to raise_error
end
it 'should not throw error on address_info' do
expect do
address_info 'none'
end.not_to raise_error
end
end
describe '#new_address' do
it 'should return the address of any user' do
address = new_address
expect(address).to be_a String
expect(address.length).to be >= 24
expect(address.length).to be <= 34
end
it 'should never return the same address' do
addresses = 10.times.map do |i| new_address end
expect(addresses).to eq addresses.uniq
end
end
describe '#address_info' do
before do gen_blocks 101 end # ensure we have enough (fake) bitcoins
it 'should return a hash' do
address = new_address
expect(address_info address).to be_a Hash
end
it 'should start address with no balance' do
address = new_address
expect(address_info(address)[:balance].to_s).to eq '0.0'
end
it 'should have balance when given bitcoins' do
address = new_address
expect(address_info(address)[:balance].to_s).to eq '0.0'
give_bitcoins '1.2345678', address, true
sync
expect(address_info(address)[:balance].to_s).to eq '1.2345678'
end
it 'should keep bitcoin amount accurately' do
address = new_address
expect(address).to be_a String
expect(address.length).to be >= 24
expect(address.length).to be <= 34
expect(address_info(address)[:balance].to_s).to eq '0.0'
12.times do
give_bitcoins('0.00001', address)
end
gen_blocks 101
sync
expect(address_info(address)[:transactions].length).to eq 12
expect(address_info(address)[:balance].to_s).to eq '0.00012'
end
it 'should require three confirmations' do
address = new_address
expect(address_info(address)[:balance].to_s).to eq '0.0'
give_bitcoins '0.00001', address
sync
expect(address_info(address)[:balance].to_s).to eq '0.0'
gen_blocks 1
sync
expect(address_info(address)[:balance].to_s).to eq '0.0'
gen_blocks 1
sync
expect(address_info(address)[:balance].to_s).to eq '0.0'
gen_blocks 1
sync
expect(address_info(address)[:balance].to_s).to eq '0.00001'
end
it 'should return an array for transactions' do
expect(address_info(new_address)[:transactions]).to be_a Array
end
it 'user should start with no transactions' do
address = new_address
expect(address_info(new_address)[:transactions].length).to eq 0
end
it 'should show new transactions' do
address = new_address
expect(address_info(address)[:transactions].length).to eq 0
give_bitcoins '0.00001', address
sync
expect(address_info(address)[:transactions].length).to eq 1
expect(address_info(address)[:transactions][0][:amount].to_s).to eq '0.00001'
expect(address_info(address)[:transactions][0][:confirmations]).to eq 0
gen_blocks 1
give_bitcoins '0.00002', address
sync
expect(address_info(address)[:transactions].length).to eq 2
expect(address_info(address)[:transactions][0][:amount].to_s).to eq '0.00001'
expect(address_info(address)[:transactions][0][:confirmations]).to eq 1
expect(address_info(address)[:transactions][1][:amount].to_s).to eq '0.00002'
expect(address_info(address)[:transactions][1][:confirmations]).to eq 0
end
end
end
|
<?php
// ** MySQL - ** //
/** WordPress */
define('DB_NAME', 'wordpress-example');
/** MySQL */
define('DB_USER', 'root');
/** MySQL */
define('DB_PASSWORD', 'usbw');
/** MySQL */
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8mb4');
define('DB_COLLATE', '');
define('AUTH_KEY', '#aW$yz|7k+TH=QYh_@JdBYoTneUk fPE;TQ6Y~>jiJC5Iq5${w^@ll9=IE$b%Bw$');
define('SECURE_AUTH_KEY', 'wm0Kp-9BQOdKzfn+rXFLIcaEFW=2[ETFBr!VMN9rRo@u++K+-WmOv|?JR0K<v*o~');
define('LOGGED_IN_KEY', 'qHC8~]W&#gTOdq{J+X|m4!78Ay$E0pu#@mG=#V|Y.t<HgKN|yFQ0MNME_rJ}wG#B');
define('NONCE_KEY', 'uRZ[j T5V+W3Mjz[|BZ(4MH^4X.z$H?TaQb 1L3-xT-H&.@JBW 1TSb$LY+|N2d;');
define('AUTH_SALT', 'V3RuF2}ICN7h|D-a5%cGVo{i!EE]D ;6K+MY~TiZNOG(hVEimE`jVLjYV16r{rc+');
define('SECURE_AUTH_SALT', 'G-+=4IOrajJ.J]r!6>_w(<,Oxb9oxd-||,y,2p%H?r,9yC6J<&59$73b4R!30u`t');
define('LOGGED_IN_SALT', 'c_i}*snL:aL^C`Vc780;^&SVrR_khGCKjhSi01]|+$+|t;8ZmWyo29R?X` O1C_!');
define('NONCE_SALT', '~yOsagc$nT|)z m|4ykEO{hYdd[]/f)<7L5[$3n.WjH$edY+PV7vmy3nnt@_5XAm');
/**
* WordPress
*
* WordPressWordPress
*
*/
$table_prefix = 'wp_';
/**
* WordPress
*
* trueWordPress
* WP_DEBUG
*/
define('WP_DEBUG', false);
define('WP_ZH_CN_ICP_NUM', true);
/** WordPress */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** WordPress */
require_once(ABSPATH . 'wp-settings.php');
|
namespace YAF.Controls
{
#region Using
using System;
using System.Data;
using System.Text;
using YAF.Classes;
using YAF.Classes.Data;
using YAF.Core;
using YAF.Core.Model;
using YAF.Types;
using YAF.Types.Extensions;
using YAF.Types.Interfaces;
using YAF.Types.Models;
using YAF.Utilities;
using YAF.Utils;
#endregion
<summary>
Summary description for smileys.
</summary>
public partial class smileys : BaseUserControl
{
#region Constants and Fields
<summary>
The _dt smileys.
</summary>
protected DataTable _dtSmileys;
<summary>
The _onclick.
</summary>
private string _onclick;
<summary>
The _perrow.
</summary>
private int _perrow = 6;
#endregion
#region Properties
<summary>
Sets OnClick.
</summary>
public string OnClick
{
set
{
this._onclick = value;
}
}
#endregion
#region Methods
<summary>
The On PreRender event.
</summary>
<param name="e">
the Event Arguments
</param>
protected override void OnPreRender([NotNull] EventArgs e)
{
LoadingImage.ImageUrl = YafForumInfo.GetURLToResource("images/loader.gif");
LoadingImage.AlternateText = this.Get<ILocalization>().GetText("COMMON", "LOADING");
LoadingImage.ToolTip = this.Get<ILocalization>().GetText("COMMON", "LOADING");
LoadingText.Text = this.Get<ILocalization>().GetText("COMMON", "LOADING");
// Setup Pagination js
YafContext.Current.PageElements.<API key>("paginationjs", "js/jquery.pagination.js");
YafContext.Current.PageElements.RegisterJsBlock("paginationloadjs", JavaScriptBlocks.PaginationLoadJs);
base.OnPreRender(e);
}
<summary>
The page_ load.
</summary>
<param name="sender">
The sender.
</param>
<param name="e">
The e.
</param>
protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
{
this._dtSmileys = this.GetRepository<Smiley>().ListUnique(this.PageContext.PageBoardID);
if (this._dtSmileys.Rows.Count == 0)
{
this.SmiliesPlaceholder.Visible = false;
}
else
{
this.CreateSmileys();
}
}
<summary>
The create smileys.
</summary>
private void CreateSmileys()
{
var html = new StringBuilder();
html.Append("<div class=\"result\">");
html.AppendFormat("<ul class=\"SmilieList\">");
int rowPanel = 0;
for (int i = 0; i < this._dtSmileys.Rows.Count; i++)
{
DataRow row = this._dtSmileys.Rows[i];
if (i % this._perrow == 0 && i > 0 && i < this._dtSmileys.Rows.Count)
{
rowPanel++;
if (rowPanel == 3)
{
html.Append("</ul></div>");
html.Append("<div class=\"result\">");
html.Append("<ul class=\"SmilieList\">\n");
rowPanel = 0;
}
}
string evt = string.Empty;
if (this._onclick.Length > 0)
{
string strCode = Convert.ToString(row["Code"]).ToLower();
strCode = strCode.Replace("&", "&");
strCode = strCode.Replace(">", ">");
strCode = strCode.Replace("<", "<");
strCode = strCode.Replace("\"", """);
strCode = strCode.Replace("\\", "\\\\");
strCode = strCode.Replace("'", "\\'");
evt = "javascript:{0}('{1} ','{3}{4}/{2}')".FormatWith(
this._onclick,
strCode,
row["Icon"],
YafForumInfo.ForumClientFileRoot,
YafBoardFolders.Current.Emoticons);
}
else
{
evt = "javascript:void()";
}
html.AppendFormat(
"<li><a tabindex=\"999\" href=\"{2}\"><img src=\"{0}\" alt=\"{1}\" title=\"{1}\" /></a></li>\n",
YafBuildLink.Smiley((string)row["Icon"]),
row["Emoticon"],
evt);
}
html.Append("</ul>");
html.Append("</div>");
this.SmileyResults.Text = html.ToString();
}
#endregion
}
}
|
#include "dosbox.h"
#include "dos_system.h"
#include "drives.h"
#include "setup.h"
#include "mapper.h"
#include "support.h"
#include "../save_state.h"
bool WildFileCmp(const char * file, const char * wild)
{
char file_name[9];
char file_ext[4];
char wild_name[9];
char wild_ext[4];
const char * find_ext;
Bitu r;
strcpy(file_name," ");
strcpy(file_ext," ");
strcpy(wild_name," ");
strcpy(wild_ext," ");
find_ext=strrchr(file,'.');
if (find_ext) {
Bitu size=(Bitu)(find_ext-file);
if (size>8) size=8;
memcpy(file_name,file,size);
find_ext++;
memcpy(file_ext,find_ext,(strlen(find_ext)>3) ? 3 : strlen(find_ext));
} else {
memcpy(file_name,file,(strlen(file) > 8) ? 8 : strlen(file));
}
upcase(file_name);upcase(file_ext);
find_ext=strrchr(wild,'.');
if (find_ext) {
Bitu size=(Bitu)(find_ext-wild);
if (size>8) size=8;
memcpy(wild_name,wild,size);
find_ext++;
memcpy(wild_ext,find_ext,(strlen(find_ext)>3) ? 3 : strlen(find_ext));
} else {
memcpy(wild_name,wild,(strlen(wild) > 8) ? 8 : strlen(wild));
}
upcase(wild_name);upcase(wild_ext);
/* Names are right do some checking */
r=0;
while (r<8) {
if (wild_name[r]=='*') goto checkext;
if (wild_name[r]!='?' && wild_name[r]!=file_name[r]) return false;
r++;
}
checkext:
r=0;
while (r<3) {
if (wild_ext[r]=='*') return true;
if (wild_ext[r]!='?' && wild_ext[r]!=file_ext[r]) return false;
r++;
}
return true;
}
void Set_Label(char const * const input, char * const output, bool cdrom) {
Bitu togo = 8;
Bitu vnamePos = 0;
Bitu labelPos = 0;
bool point = false;
//spacepadding the filenamepart to include spaces after the terminating zero is more closely to the specs. (not doing this now)
// HELLO\0' '' '
while (togo > 0) {
if (input[vnamePos]==0) break;
if (!point && (input[vnamePos]=='.')) { togo=4; point=true; }
//another mscdex quirk. Label is not always uppercase. (Daggerfall)
output[labelPos] = (cdrom?input[vnamePos]:toupper(input[vnamePos]));
labelPos++; vnamePos++;
togo
if ((togo==0) && !point) {
if (input[vnamePos]=='.') vnamePos++;
output[labelPos]='.'; labelPos++; point=true; togo=3;
}
};
output[labelPos]=0;
//Remove trailing dot. except when on cdrom and filename is exactly 8 (9 including the dot) letters. MSCDEX feature/bug (fifa96 cdrom detection)
if((labelPos > 0) && (output[labelPos-1] == '.') && !(cdrom && labelPos ==9))
output[labelPos-1] = 0;
}
DOS_Drive::DOS_Drive() {
curdir[0]=0;
info[0]=0;
}
const char * DOS_Drive::GetInfo(void) {
return info;
}
// static members variables
int DriveManager::currentDrive;
DriveManager::DriveInfo DriveManager::driveInfos[26];
void DriveManager::AppendDisk(int drive, DOS_Drive* disk) {
driveInfos[drive].disks.push_back(disk);
}
void DriveManager::InitializeDrive(int drive) {
currentDrive = drive;
DriveInfo& driveInfo = driveInfos[currentDrive];
if (driveInfo.disks.size() > 0) {
driveInfo.currentDisk = 0;
DOS_Drive* disk = driveInfo.disks[driveInfo.currentDisk];
Drives[currentDrive] = disk;
disk->Activate();
}
}
/*
void DriveManager::CycleDrive(bool pressed) {
if (!pressed) return;
// do one round through all drives or stop at the next drive with multiple disks
int oldDrive = currentDrive;
do {
currentDrive = (currentDrive + 1) % DOS_DRIVES;
int numDisks = driveInfos[currentDrive].disks.size();
if (numDisks > 1) break;
} while (currentDrive != oldDrive);
}
void DriveManager::CycleDisk(bool pressed) {
if (!pressed) return;
int numDisks = driveInfos[currentDrive].disks.size();
if (numDisks > 1) {
// cycle disk
int currentDisk = driveInfos[currentDrive].currentDisk;
DOS_Drive* oldDisk = driveInfos[currentDrive].disks[currentDisk];
currentDisk = (currentDisk + 1) % numDisks;
DOS_Drive* newDisk = driveInfos[currentDrive].disks[currentDisk];
driveInfos[currentDrive].currentDisk = currentDisk;
// copy working directory, acquire system resources and finally switch to next drive
strcpy(newDisk->curdir, oldDisk->curdir);
newDisk->Activate();
Drives[currentDrive] = newDisk;
}
}
*/
void DriveManager::CycleAllDisks(void) {
for (int idrive=0; idrive<2; idrive++) { /* Cycle all DISKS meaning A: and B: */
int numDisks = (int)driveInfos[idrive].disks.size();
if (numDisks > 1) {
// cycle disk
int currentDisk = driveInfos[idrive].currentDisk;
DOS_Drive* oldDisk = driveInfos[idrive].disks[currentDisk];
currentDisk = (currentDisk + 1) % numDisks;
DOS_Drive* newDisk = driveInfos[idrive].disks[currentDisk];
driveInfos[idrive].currentDisk = currentDisk;
// copy working directory, acquire system resources and finally switch to next drive
strcpy(newDisk->curdir, oldDisk->curdir);
newDisk->Activate();
Drives[idrive] = newDisk;
LOG_MSG("Drive %c: disk %d of %d now active", 'A'+idrive, currentDisk+1, numDisks);
}
}
}
void DriveManager::CycleAllCDs(void) {
for (int idrive=2; idrive<DOS_DRIVES; idrive++) { /* Cycle all CDs in C: D: ... Z: */
int numDisks = (int)driveInfos[idrive].disks.size();
if (numDisks > 1) {
// cycle disk
int currentDisk = driveInfos[idrive].currentDisk;
DOS_Drive* oldDisk = driveInfos[idrive].disks[currentDisk];
currentDisk = (currentDisk + 1) % numDisks;
DOS_Drive* newDisk = driveInfos[idrive].disks[currentDisk];
driveInfos[idrive].currentDisk = currentDisk;
// copy working directory, acquire system resources and finally switch to next drive
strcpy(newDisk->curdir, oldDisk->curdir);
newDisk->Activate();
Drives[idrive] = newDisk;
LOG_MSG("Drive %c: disk %d of %d now active", 'A'+idrive, currentDisk+1, numDisks);
}
}
}
int DriveManager::UnmountDrive(int drive) {
int result = 0;
// unmanaged drive
if (driveInfos[drive].disks.size() == 0) {
result = Drives[drive]->UnMount();
} else {
// managed drive
int currentDisk = driveInfos[drive].currentDisk;
result = driveInfos[drive].disks[currentDisk]->UnMount();
// only delete on success, current disk set to NULL because of UnMount
if (result == 0) {
driveInfos[drive].disks[currentDisk] = NULL;
for (int i = 0; i < (int)driveInfos[drive].disks.size(); i++) {
delete driveInfos[drive].disks[i];
}
driveInfos[drive].disks.clear();
}
}
return result;
}
bool <API key> = true;
void DriveManager::Init(Section* s) {
Section_prop * section=static_cast<Section_prop *>(s);
<API key> = section->Get_bool("int 13 extensions");
// setup driveInfos structure
currentDrive = 0;
for(int i = 0; i < DOS_DRIVES; i++) {
driveInfos[i].currentDisk = 0;
}
// MAPPER_AddHandler(&CycleDisk, MK_f3, MMOD1, "cycledisk", "Cycle Disk");
// MAPPER_AddHandler(&CycleDrive, MK_f3, MMOD2, "cycledrive", "Cycle Drv");
}
void DRIVES_Init(Section* sec) {
DriveManager::Init(sec);
}
char * DOS_Drive::GetBaseDir(void) {
return info + 16;
}
// save state support
void DOS_Drive::SaveState( std::ostream& stream )
{
// - pure data
WRITE_POD( &curdir, curdir );
WRITE_POD( &info, info );
}
void DOS_Drive::LoadState( std::istream& stream )
{
// - pure data
READ_POD( &curdir, curdir );
READ_POD( &info, info );
}
void DriveManager::SaveState( std::ostream& stream )
{
// - pure data
WRITE_POD( ¤tDrive, currentDrive );
}
void DriveManager::LoadState( std::istream& stream )
{
// - pure data
READ_POD( ¤tDrive, currentDrive );
}
void <API key>( std::ostream& stream )
{
DriveManager::SaveState(stream);
}
void <API key>( std::istream& stream )
{
DriveManager::LoadState(stream);
}
/*
ykhwong svn-daum 2012-05-21
class DriveManager
// - pure data
int currentDrive;
// - system data
static struct DriveInfo {
std::vector<DOS_Drive*> disks;
Bit32u currentDisk;
} driveInfos[DOS_DRIVES];
class DOS_Drive
// - pure data
char curdir[DOS_PATHLENGTH];
char info[256];
*/
|
// This file is part of Ymer.
// Ymer is free software; you can redistribute it and/or modify it
// (at your option) any later version.
// Ymer is distributed in the hope that it will be useful, but WITHOUT
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// along with Ymer; if not, write to the Free Software Foundation,
// Inc., #59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Internal state of parser.
#ifndef PARSER_STATE_H_
#define PARSER_STATE_H_
#include <optional>
#include <string>
#include <vector>
#include "model.h"
#include "strutil.h"
class ParserState {
public:
ParserState(const std::optional<std::string>& filename,
std::vector<std::string>* errors)
: filename_(filename), errors_(errors), success_(true) {}
Model* mutable_model() {
if (!model_.has_value()) {
model_ = Model();
}
return &model_.value();
}
void add_property(std::unique_ptr<const Expression>&& property) {
properties_.push_back(std::move(property));
}
void add_error(const std::string& error) {
if (!filename_.has_value() || filename_.value() == "-") {
errors_->push_back(error);
} else {
errors_->push_back(StrCat(filename_.value(), ":", error));
}
success_ = false;
}
bool has_model() const { return model_.has_value(); }
Model release_model() { return std::move(model_.value()); }
UniquePtrVector<const Expression> release_properties() {
return std::move(properties_);
}
bool success() const { return success_; }
private:
const std::optional<std::string> filename_;
std::vector<std::string>* const errors_;
std::optional<Model> model_;
UniquePtrVector<const Expression> properties_;
bool success_;
};
#endif // PARSER_STATE_H_
|
package com.baidu.disconf.web.service.zookeeper.service;
import java.util.Map;
import com.baidu.disconf.core.common.constants.DisConfigTypeEnum;
import com.baidu.disconf.web.service.zookeeper.dto.ZkDisconfData;
/**
*
*
* @author liaoqiqi
* @version 2014-9-11
*/
public interface ZkDeployMgr {
/**
*
* @param appId
* @param envId
* @param version
* @return
*/
String getDeployInfo(String app, String env, String version);
/**
*
* @param app
* @param env
* @param version
* @return
*/
Map<String, ZkDisconfData> getZkDisconfDataMap(String app, String env, String version);
/**
*
*
* @param app
* @param env
* @param version
* @return
*/
ZkDisconfData getZkDisconfData(String app, String env, String version, DisConfigTypeEnum disConfigTypeEnum,
String keyName);
}
|
class UsersController < <API key>
before_filter :init
before_action :require_login
def index
@users = User.all.where.not(email: current_user.email).order('created_at DESC')
end
def create
@user = User.new(user_params)
if @user.save
@activity = Activity.new({'user_id' => current_user.id, 'activity' => 'Created new user'})
@activity.save
redirect_to :back, notice: "Account Created"
else
redirect_to :back, notice: "Failed to create account"
end
end
def update
@user = User.find(params[:id])
password_salt = current_user.password_salt
pwd = user_params[:current].present? ? BCrypt::Engine.hash_secret(user_params[:current], password_salt) : current_user.password_hash
confirmed = true if pwd == current_user.password_hash
if user_params[:current].present? && !confirmed
redirect_to :back, alert: "Current Password is not valid"
else
name = "#{user_params[:firstname]} #{user_params[:lastname]}"
if @user.update(user_params.except(:firstname, :lastname).merge(name: name))
Activity.new({'user_id' => current_user.id, 'activity' => "Updated a user" }).save
redirect_to :back, alert: "Account Updated"
else
redirect_to :back, alert: @user.errors.full_messages
end
end
end
def destroy
user = User.find(params[:id])
if user.destroy
Activity.new({'user_id' => current_user.id, 'activity' => "Deleted a user" }).save
redirect_to :back
end
end
private
def user_params
params.require(:user).permit(:email, :role, :password, :avatar, :firstname, :lastname, :current)
end
def init
@preferences = Preference.find(1)
end
def require_login
unless session[:user_id].present?
redirect_to root_url
end
end
end
|
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="ru">
<head>
<title>FormulaEvaluator (POI API Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="FormulaEvaluator (POI API Documentation)";
}
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar_top">
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/FormulaEvaluator.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/poi/ss/usermodel/FormulaError.html" title="enum in org.apache.poi.ss.usermodel"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/poi/ss/usermodel/FractionFormat.html" title="class in org.apache.poi.ss.usermodel"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/poi/ss/usermodel/FormulaEvaluator.html" target="_top">Frames</a></li>
<li><a href="FormulaEvaluator.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
</a></div>
<div class="header">
<div class="subTitle">org.apache.poi.ss.usermodel</div>
<h2 title="Interface FormulaEvaluator" class="title">Interface FormulaEvaluator</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../../org/apache/poi/hssf/usermodel/<API key>.html" title="class in org.apache.poi.hssf.usermodel"><API key></a>, <a href="../../../../../org/apache/poi/xssf/usermodel/<API key>.html" title="class in org.apache.poi.xssf.usermodel"><API key></a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="strong">FormulaEvaluator</span></pre>
<div class="block">Evaluates formula cells.<p/>
For performance reasons, this class keeps a cache of all previously calculated intermediate
cell values. Be sure to call <a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#<API key>()"><code><API key>()</code></a> if any workbook cells are changed between
calls to evaluate~ methods on this class.</div>
<dl><dt><span class="strong">Author:</span></dt>
<dd>Amol S. Deshmukh < amolweb at ya hoo dot com >, Josh Micich</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="method_summary">
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#<API key>()"><API key></a></strong>()</code>
<div class="block">Should be called whenever there are changes to input cells in the evaluated workbook.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/poi/ss/usermodel/CellValue.html" title="class in org.apache.poi.ss.usermodel">CellValue</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#evaluate(org.apache.poi.ss.usermodel.Cell)">evaluate</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a> cell)</code>
<div class="block">If cell contains a formula, the formula is evaluated and returned,
else the CellValue simply copies the appropriate cell value from
the cell and also its cell type.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#evaluateAll()">evaluateAll</a></strong>()</code>
<div class="block">Loops over all cells in all sheets of the associated workbook.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#evaluateFormulaCell(org.apache.poi.ss.usermodel.Cell)">evaluateFormulaCell</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a> cell)</code>
<div class="block">If cell contains formula, it evaluates the formula,
and saves the result of the formula.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#evaluateInCell(org.apache.poi.ss.usermodel.Cell)">evaluateInCell</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a> cell)</code>
<div class="block">If cell contains formula, it evaluates the formula, and
puts the formula result back into the cell, in place
of the old formula.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#notifyDeleteCell(org.apache.poi.ss.usermodel.Cell)">notifyDeleteCell</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a> cell)</code>
<div class="block">Should be called to tell the cell value cache that the specified cell has just become a
formula cell, or the formula text has changed</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#notifySetFormula(org.apache.poi.ss.usermodel.Cell)">notifySetFormula</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a> cell)</code>
<div class="block">Should be called to tell the cell value cache that the specified (value or formula) cell
has changed.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#notifyUpdateCell(org.apache.poi.ss.usermodel.Cell)">notifyUpdateCell</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a> cell)</code>
<div class="block">Should be called to tell the cell value cache that the specified (value or formula) cell
has changed.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#<API key>(boolean)"><API key></a></strong>(boolean value)</code>
<div class="block">Perform detailed output of formula evaluation for next evaluation only?</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="method_detail">
</a>
<h3>Method Detail</h3>
<a name="<API key>()">
</a>
<ul class="blockList">
<li class="blockList">
<h4><API key></h4>
<pre>void <API key>()</pre>
<div class="block">Should be called whenever there are changes to input cells in the evaluated workbook.
Failure to call this method after changing cell values will cause incorrect behaviour
of the evaluate~ methods of this class</div>
</li>
</ul>
<a name="notifySetFormula(org.apache.poi.ss.usermodel.Cell)">
</a>
<ul class="blockList">
<li class="blockList">
<h4>notifySetFormula</h4>
<pre>void notifySetFormula(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a> cell)</pre>
<div class="block">Should be called to tell the cell value cache that the specified (value or formula) cell
has changed.
Failure to call this method after changing cell values will cause incorrect behaviour
of the evaluate~ methods of this class</div>
</li>
</ul>
<a name="notifyDeleteCell(org.apache.poi.ss.usermodel.Cell)">
</a>
<ul class="blockList">
<li class="blockList">
<h4>notifyDeleteCell</h4>
<pre>void notifyDeleteCell(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a> cell)</pre>
<div class="block">Should be called to tell the cell value cache that the specified cell has just become a
formula cell, or the formula text has changed</div>
</li>
</ul>
<a name="notifyUpdateCell(org.apache.poi.ss.usermodel.Cell)">
</a>
<ul class="blockList">
<li class="blockList">
<h4>notifyUpdateCell</h4>
<pre>void notifyUpdateCell(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a> cell)</pre>
<div class="block">Should be called to tell the cell value cache that the specified (value or formula) cell
has changed.
Failure to call this method after changing cell values will cause incorrect behaviour
of the evaluate~ methods of this class</div>
</li>
</ul>
<a name="evaluateAll()">
</a>
<ul class="blockList">
<li class="blockList">
<h4>evaluateAll</h4>
<pre>void evaluateAll()</pre>
<div class="block">Loops over all cells in all sheets of the associated workbook.
For cells that contain formulas, their formulas are evaluated,
and the results are saved. These cells remain as formula cells.
For cells that do not contain formulas, no changes are made.
This is a helpful wrapper around looping over all cells, and
calling evaluateFormulaCell on each one.</div>
</li>
</ul>
<a name="evaluate(org.apache.poi.ss.usermodel.Cell)">
</a>
<ul class="blockList">
<li class="blockList">
<h4>evaluate</h4>
<pre><a href="../../../../../org/apache/poi/ss/usermodel/CellValue.html" title="class in org.apache.poi.ss.usermodel">CellValue</a> evaluate(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a> cell)</pre>
<div class="block">If cell contains a formula, the formula is evaluated and returned,
else the CellValue simply copies the appropriate cell value from
the cell and also its cell type. This method should be preferred over
evaluateInCell() when the call should not modify the contents of the
original cell.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cell</code> - </dd></dl>
</li>
</ul>
<a name="evaluateFormulaCell(org.apache.poi.ss.usermodel.Cell)">
</a>
<ul class="blockList">
<li class="blockList">
<h4>evaluateFormulaCell</h4>
<pre>int evaluateFormulaCell(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a> cell)</pre>
<div class="block">If cell contains formula, it evaluates the formula,
and saves the result of the formula. The cell
remains as a formula cell.
Else if cell does not contain formula, this method leaves
the cell unchanged.
Note that the type of the formula result is returned,
so you know what kind of value is also stored with
the formula.
<pre>
int evaluatedCellType = evaluator.evaluateFormulaCell(cell);
</pre>
Be aware that your cell will hold both the formula,
and the result. If you want the cell replaced with
the result of the formula, use <a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#evaluateInCell(org.apache.poi.ss.usermodel.Cell)"><code>evaluateInCell(Cell)</code></a></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cell</code> - The cell to evaluate</dd>
<dt><span class="strong">Returns:</span></dt><dd>The type of the formula result (the cell's type remains as Cell.CELL_TYPE_FORMULA however)</dd></dl>
</li>
</ul>
<a name="evaluateInCell(org.apache.poi.ss.usermodel.Cell)">
</a>
<ul class="blockList">
<li class="blockList">
<h4>evaluateInCell</h4>
<pre><a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a> evaluateInCell(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a> cell)</pre>
<div class="block">If cell contains formula, it evaluates the formula, and
puts the formula result back into the cell, in place
of the old formula.
Else if cell does not contain formula, this method leaves
the cell unchanged.
Note that the same instance of Cell is returned to
allow chained calls like:
<pre>
int evaluatedCellType = evaluator.evaluateInCell(cell).getCellType();
</pre>
Be aware that your cell value will be changed to hold the
result of the formula. If you simply want the formula
value computed for you, use <a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#evaluateFormulaCell(org.apache.poi.ss.usermodel.Cell)"><code>evaluateFormulaCell(Cell)</code></a></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cell</code> - </dd></dl>
</li>
</ul>
<a name="<API key>(boolean)">
</a>
<ul class="blockListLast">
<li class="blockList">
<h4><API key></h4>
<pre>void <API key>(boolean value)</pre>
<div class="block">Perform detailed output of formula evaluation for next evaluation only?
Is for developer use only (also developers using POI for their XLS files).
Log-Level WARN is for basic info, INFO for detailed information. These quite
high levels are used because you have to explicitly enable this specific logging.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>value</code> - whether to perform detailed output</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="bottomNav"><a name="navbar_bottom">
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/FormulaEvaluator.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/poi/ss/usermodel/FormulaError.html" title="enum in org.apache.poi.ss.usermodel"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/poi/ss/usermodel/FractionFormat.html" title="class in org.apache.poi.ss.usermodel"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/poi/ss/usermodel/FormulaEvaluator.html" target="_top">Frames</a></li>
<li><a href="FormulaEvaluator.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
</a></div>
<p class="legalCopy"><small>
<i>Copyright 2014 The Apache Software Foundation or
its licensors, as applicable.</i>
</small></p>
</body>
</html>
|
include(FindPkgConfig)
pkg_check_modules(LibAvCodec REQUIRED libavcodec)
|
package MultiplyStrings;
public class Solution {
public static void main(String[] args) {
System.out.println(multiply("123", "20"));
}
public static String multiply(String num1, String num2) {
String n1 = new StringBuilder(num1).reverse().toString();
String n2 = new StringBuilder(num2).reverse().toString();
int[] tmp = new int[n1.length() + n2.length()];
for (int i = 0; i < n1.length(); i++) {
int a = n1.charAt(i) - '0';
for (int j = 0; j < n2.length(); j++) {
int b = n2.charAt(j) - '0';
tmp[i + j] += b * a;
}
}
StringBuilder sb = new StringBuilder();
for (int k = 0; k < tmp.length; k++) {
int d = tmp[k] % 10;
int carry = tmp[k] / 10;
// will insert digit from left most
sb.insert(0, d);
if (k < tmp.length - 1) {
tmp[k + 1] += carry;
}
}
while(sb.length()>0 && sb.charAt(0)=='0'){
sb.deleteCharAt(0);
}
return sb.length()==0? "0" : sb.toString();
}
}
|
<HTML>
<HEAD></HEAD>
<FONT FACE="Verdana, Arial, Helvetica" SIZE=2>
<!DOCTYPE html><br><html><br><body><br><FONT COLOR=#ff0000><%<br>Set fs=Server.CreateObject("Scripting.FileSystemObject")<br><br>if fs.driveexists("c:") = true then<br> Response.Write("Drive c: exists.")<br>Else<br> Response.Write("Drive c: does not exist.")<br>End If<br><br>Response.write("<br>")<br><br>if fs.driveexists("g:") = true then<br> Response.Write("Drive g: exists.")<br>Else<br> Response.Write("Drive g: does not exist.")<br>End If<br><br>set fs=nothing<br>%></FONT><br><br></body><br></html><br>
</HTML>
|
#pragma once
#if defined (__cplusplus)
extern "C" {
#endif
/*
LZ4_compressHC :
return : the number of bytes in compressed buffer dest
note : destination buffer must be already allocated.
To avoid any problem, size it to handle worst cases situations (input data not compressible)
Worst case size evaluation is provided by function LZ4_compressBound() (see "lz4.h")
*/
#if defined (__cplusplus)
}
#endif
|
# bootloader_advanced.py: gui advanced bootloader configuration dialog
# Jeremy Katz <katzj@redhat.com>
# This software may be freely redistributed under the terms of the GNU
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import gtk
import gobject
import iutil
import partedUtils
import gui
from iw_gui import *
from rhpl.translate import _, N_
from bootlocwidget import <API key>
class <API key>(InstallWindow):
windowTitle = N_("Advanced Boot Loader Configuration")
def __init__(self, ics):
InstallWindow.__init__(self, ics)
self.parent = ics.getICW().window
def getPrev(self):
pass
def getNext(self):
# forcing lba32 can be a bad idea.. make sure they really want to
if (self.forceLBA.get_active() and not self.bl.forceLBA32):
rc = self.intf.messageWindow(_("Warning"),
_("Forcing the use of LBA32 for your bootloader when "
"not supported by the BIOS can cause your machine "
"to be unable to boot.\n\n"
"Would you like to continue and force LBA32 mode?"),
type = "custom",
custom_buttons = [_("Cancel"),
_("Force LBA32")])
if rc != 1:
raise gui.StayOnScreen
# set forcelba
self.bl.setForceLBA(self.forceLBA.get_active())
# set kernel args
self.bl.args.set(self.appendEntry.get_text())
# set the boot device
self.bl.setDevice(self.blloc.getBootDevice())
# set the drive order
self.bl.drivelist = self.blloc.getDriveOrder()
# set up the vbox with force lba32 and kernel append
def setupOptionsVbox(self):
self.options_vbox = gtk.VBox(False, 5)
self.options_vbox.set_border_width(5)
self.forceLBA = gtk.CheckButton(_("_Force LBA32 (not normally required)"))
self.options_vbox.pack_start(self.forceLBA, False)
self.forceLBA.set_active(self.bl.forceLBA32)
label = gui.WrappingLabel(_("If you wish to add default options to the "
"boot command, enter them into "
"the 'General kernel parameters' field."))
label.set_alignment(0.0, 0.0)
self.options_vbox.pack_start(label, False)
label = gui.MnemonicLabel(_("_General kernel parameters"))
self.appendEntry = gtk.Entry()
label.set_mnemonic_widget(self.appendEntry)
args = self.bl.args.get()
if args:
self.appendEntry.set_text(args)
box = gtk.HBox(False, 0)
box.pack_start(label)
box.pack_start(self.appendEntry)
al = gtk.Alignment(0.0, 0.0)
al.add(box)
self.options_vbox.pack_start(al, False)
def getScreen(self, anaconda):
self.dispatch = anaconda.dispatch
self.bl = anaconda.id.bootloader
self.intf = anaconda.intf
thebox = gtk.VBox (False, 10)
# boot loader location bits (mbr vs boot, drive order)
self.blloc = <API key>(anaconda, self.parent)
thebox.pack_start(self.blloc.getWidget(), False)
thebox.pack_start (gtk.HSeparator(), False)
# some optional things
self.setupOptionsVbox()
thebox.pack_start(self.options_vbox, False)
return thebox
|
import Backbone from 'backbone';
export default class Router extends Backbone.Router {
get routes() {
return {
'(/)': 'home',
'login': 'login',
'access_token=*token': 'token',
'activity': 'activity',
'swim': 'swim',
'sleep': 'sleep',
'about': 'about',
'privacy': 'privacy'
};
}
}
|
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using TournamentMaker.BO;
using TournamentMaker.DAL.Interfaces;
namespace TournamentMaker.BP.Tests
{
[TestClass]
public class MatchBPTests
{
private readonly Mock<IMatchStore> _matchStoreMock;
private readonly Mock<IPlayerStore> _playerStoreMock;
private readonly Mock<ITeamStore> _teamStoreMock;
private readonly Mock<ISportStore> _sportStoreMock;
public MatchBPTests()
{
_matchStoreMock = new Mock<IMatchStore>(MockBehavior.Strict);
_playerStoreMock = new Mock<IPlayerStore>(MockBehavior.Strict);
_teamStoreMock = new Mock<ITeamStore>(MockBehavior.Strict);
_sportStoreMock = new Mock<ISportStore>(MockBehavior.Strict);
}
[TestMethod]
public async Task Close2PlayersTest()
{
var matchBP = new MatchBP(_matchStoreMock.Object, _playerStoreMock.Object, _teamStoreMock.Object, _sportStoreMock.Object);
var rank1 = new Rank { Level = 1000, SportKey = "sport" };
var rank2 = new Rank { Level = 1000, SportKey = "sport" };
var match = new BO.Match
{
Id = 1,
CreatorId = "creator",
SportKey = "sport",
Scores = "1-2;3-1;3-2",
Teams = new List<Team>
{
new Team {Players = new List<Player> {new Player {Matricule = "S123456", Ranks = new Collection<Rank> {rank1}}}, Id = 1},
new Team {Players = new List<Player> {new Player {Matricule = "S123457", Ranks = new Collection<Rank> {rank2}}}, Id = 2}
}
};
_matchStoreMock.Setup(m => m.<API key>(1)).ReturnsAsync(match);
_matchStoreMock.Setup(m => m.SaveChangesAsync()).Returns(() => Task.FromResult(default(Task)));
var result = await matchBP.Close(match, "creator");
_matchStoreMock.VerifyAll();
Assert.AreEqual(match, result);
Assert.AreEqual(rank1.Level, 1007);
Assert.AreEqual(rank2.Level, 993);
}
[TestMethod]
public async Task <API key>()
{
var matchBP = new MatchBP(_matchStoreMock.Object, _playerStoreMock.Object, _teamStoreMock.Object, _sportStoreMock.Object);
var rank1 = new Rank {Level = 1000, SportKey = "sport"};
var rank2 = new Rank {Level = 1000, SportKey = "sport"};
var match = new BO.Match
{
Id = 1,
CreatorId = "creator",
SportKey = "sport",
Scores = "1-2;1-1;2-1",
Teams = new List<Team>
{
new Team {Players = new List<Player> {new Player {Matricule = "S123456", Ranks = new Collection<Rank> {rank1}}}, Id = 1},
new Team {Players = new List<Player> {new Player {Matricule = "S123457", Ranks = new Collection<Rank> {rank2}}}, Id = 2}
}
};
_matchStoreMock.Setup(m => m.<API key>(1)).ReturnsAsync(match);
_matchStoreMock.Setup(m => m.SaveChangesAsync()).Returns(() => Task.FromResult(default(Task)));
var result = await matchBP.Close(match,"creator");
_matchStoreMock.VerifyAll();
Assert.AreEqual(match, result);
Assert.AreEqual(rank1.Level, 1000);
Assert.AreEqual(rank2.Level, 1000);
}
[TestMethod]
public async Task <API key>()
{
var matchBP = new MatchBP(_matchStoreMock.Object, _playerStoreMock.Object, _teamStoreMock.Object, _sportStoreMock.Object);
var rank1 = new Rank { Level = 1800, SportKey = "sport", };
var rank2 = new Rank { Level = 2005, SportKey = "sport" };
var match = new BO.Match
{
Id = 1,
CreatorId = "creator",
SportKey = "sport",
Scores = "1-2;1-1;2-1",
Teams = new List<Team>
{
new Team {Players = new List<Player> {new Player {Parties = 31, Matricule = "S123456", Ranks = new Collection<Rank> {rank1}}}, Id = 1},
new Team {Players = new List<Player> {new Player {Parties = 31, Matricule = "S123457", Ranks = new Collection<Rank> {rank2}}}, Id = 2}
}
};
_matchStoreMock.Setup(m => m.<API key>(1)).ReturnsAsync(match);
_matchStoreMock.Setup(m => m.SaveChangesAsync()).Returns(() => Task.FromResult(default(Task)));
var result = await matchBP.Close(match,"creator");
_matchStoreMock.VerifyAll();
Assert.AreEqual(match, result);
Assert.AreEqual(1804, rank1.Level);
Assert.AreEqual(2001, rank2.Level);
}
}
}
|
// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <config.h>
#include "response.h"
mystring response::codestr() const
{
static const mystring errstr = "ERROR";
static const mystring econnstr = "ECONN";
static const mystring badstr = "BAD";
static const mystring okstr = "OK";
static const mystring unknownstr = "???";
switch(code) {
case err: return errstr;
case econn: return econnstr;
case bad: return badstr;
case ok: return okstr;
default: return unknownstr;
}
}
mystring response::message() const
{
return codestr() + ": " + msg;
}
|
<?php
require_once 'unirest/Unirest.php';
/**
* Get content from url via unirest.io
*
* @param $url
*
* @return mixed
*/
function <API key>( $url ) {
$obj_unirest = Unirest\Request::get( $url, null, null );
$content = $obj_unirest->raw_body;
return $content;
}
|
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http:
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php wp_title('', true, 'right'); ?> <?php bloginfo('name'); ?></title>
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<?php wp_head(); ?>
<!--[if lte IE 9]><link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('template_directory');?>/css/ie.css" /><![endif]-->
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery.fn.cleardefault = function() {
return this.focus(function() {
if( this.value == this.defaultValue ) {
this.value = "";
}
}).blur(function() {
if( !this.value.length ) {
this.value = this.defaultValue;
}
});
};
jQuery(".clearit input, .clearit textarea").cleardefault();
});
</script>
</head>
<body<?php if(is_front_page()) {echo ' class="inner-page"';} ?>>
<div class="wrapper">
<header>
<div class="holder">
<strong class="ipad-icon"><a href="http://angel.co/wtf">Coming soon to iPad and iPhone</a></strong>
<strong class="logo"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></strong>
</div>
</header><!-- / header -->
<div id="main">
|
@import url(http://fonts.googleapis.com/css?family=Lato:100,300,400,700,300italic,400italic,700italic|Merriweather:400,300,300italic,400italic,700,700italic);
body {
font-family: "Merriweather", Georgia, serif;
font-weight: 300;
line-height: 27px;
font-size: 14px;
padding-top: 0px;
padding-bottom: 0px;
background-color: #FAFAFA;
}
a {
color: #007998;
-webkit-transition: color 0.25s ease-in-out;
-moz-transition: color 0.25s ease-in-out;
-o-transition: color 0.25s ease-in-out;
-ms-transition: color 0.25s ease-in-out;
transition: color 0.25s ease-in-out;
text-decoration: none;
}
a:hover,
a:focus,
a:active {
color: rgba(0, 121, 152, 0.5);
}
p {
margin: 0 0 27px;
}
.shrink {
padding-left: 50px;
padding-right: 50px;
}
/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
clear: both;
font-family: "Lato", Helvetica, Arial, sans-serif;
font-weight: 700;
}
h1 {
line-height: 71px;
font-size: 48px;
font-size: 4.8rem;
}
h2 {
line-height: 50px;
font-size: 34px;
font-size: 3.4rem;
}
h3 {
line-height: 41px;
font-size: 28px;
font-size: 2.8rem;
}
h4 {
line-height: 26px;
font-size: 18px;
font-size: 1.8rem;
}
hr {
background-color: #ccc;
border: 0;
height: 1px;
margin-bottom: 1.5em;
}
.lato {
font-family: "Lato", Helvetica, Arial, sans-serif;
font-weight: 400;
}
.lato-small {
font-family: "Lato", Helvetica, Arial, sans-serif;
font-weight: 400;
font-size: 14px;
}
.logo {
content: url(http://localhost:8888/portfolio-dev/wp-content/uploads/2015/06/logoidea2.png);
margin-right: 10px;
width: 50px;
float: left;
}
.navbar {
font-family: "Lato", Helvetica, Arial, sans-serif;
}
.navbar-default {
background-color: #A7C5BD;
border-color: transparent;
padding-top: 20px;
padding-bottom: 20px;
}
.navbar-default .navbar-brand {
text-transform: none;
font-family: "Merriweather";
font-weight: 300;
font-size: 30px;
text-align: left;
color: #fff;
vertical-align: top;
height: auto;
}
.navbar-default .navbar-brand:hover, .navbar-default .navbar-brand:focus {
color: #fff;
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
-ms-transition: none;
transition: none;
}
.navbar-nav {
float: right;
}
.navbar-default .navbar-nav > li > a {
padding: 0px;
margin-left: 15px;
margin-right: 15px;
top: 20px;
font-size: 14px;
font-weight: 500;
text-transform: uppercase;
color: #FFFFFF;
-webkit-transition: color 0.25s ease-in-out;
-moz-transition: color 0.25s ease-in-out;
-o-transition: color 0.25s ease-in-out;
-ms-transition: color 0.25s ease-in-out;
transition: color 0.25s ease-in-out;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
/*border-bottom: 2px solid rgba(100, 100, 100, 0.5);*/
background-color: transparent;
color: rgba(82, 70, 86, .8); /* before, 100, 100, 100 */
}
.navbar-default .navbar-nav .current_page_item > a, .navbar-default .navbar-nav .current-menu-parent > a {
background: transparent;
color: rgba(82, 70, 86, .7);
border-bottom: 2px solid rgba(82, 70, 86, .8);
}
.page-header {
padding-bottom: 9px;
margin: 40px 0 20px;
text-align: center;
text-transform: uppercase;
border-bottom: none;
letter-spacing: .3em;
}
.bottom {
background-color: #524656;
}
.colorblock {
width: 100%;
background-color: #524656;
padding-top: 40px;
margin-top: 40px;
}
footer {
font-family: "Lato", Helvetica, Arial, sans-serif;
font-weight: 400;
color: #fff;
}
.colorblock a,
.colorblock a:visited,
.colorblock a:active,
.colorblock a:focus {
color: #fff;
text-decoration: none;
}
.fa {
padding-left: 10px;
}
#blog-column {
padding-left: 40px;
padding-right: 40px;
}
.authorpic {
text-align: center;
width: 225px;
}
.notheader {
font-weight: 300;
}
#notheader1 {
margin-top: 0px;
}
.piece-details {
border-right: 1px solid gray;
margin-top: 10px;
}
.piece-description {
padding-left: 25px;
}
.piece-title {
font-family: "Merriweather", Georgia, sans-serif;
font-weight: 200;
font-size: 24px;
padding-top: 10px;
padding-bottom: 20px;
text-transform: none;
}
.piece-singleimage {
margin: 0 0 60px;
margin-top: 20px;
}
.portfolio-piece {
margin-bottom: 30px;
}
.portfolio-piece p {
margin-bottom: 0;
}
.portfolio-piece h4 {
margin-bottom: 0;
font-weight: 400;
}
.portfolio-piece h6 {
margin-bottom: 3px;
margin-top: 0px;
font-weight: 400;
}
.fade {
opacity: 1;
transition: opacity .25s ease-in-out;
-moz-transition: opacity .25s ease-in-out;
-webkit-transition: opacity .25s ease-in-out;
}
.fade:hover {
opacity: 0.9;
}
.portfolio h5 {
text-transform: none;
letter-spacing: 0em;
font-family: "Merriweather", Georgia, serif;
font-weight: 300;
line-height: 21px;
font-size: 14px;
font-style: italic;
margin-top: 0px;
margin-bottom: 0px;
}
.recentwork {
text-transform: uppercase;
letter-spacing: .2em;
margin-bottom: 20px;
}
.arrow-prev {
margin-left: 5px;
}
.arrow-next {
margin-right: 5px;
}
.arrow-center {
margin-left: 20px;
margin-right: 20px;
}
.prev-next {
font-size: 14px;
margin-top: 30px;
text-align: center;
}
.sidebar {
margin-top: 10px;
color: #333;
font-family: "Lato", Helvetica, Arial, sans-serif;
line-height: 21px;
}
.sidebar h3 {
color: #333;
font-weight: 400;
font-size: 16px;
text-align: center;
text-transform: uppercase;
}
.widget {
margin: 10px 0 30px;
}
.widget ul {
padding-left: 0px;
}
.cat-item {
list-style-type: none;
font-weight: 400;
font-size: 14px;
text-transform: uppercase;
border-bottom: 1px solid rgb(238, 238, 238);
margin-bottom: 10px;
}
.widget h3 {
position: relative;
z-index: 1;
overflow: hidden;
text-align: center;
}
.widget > h3:before, .widget > h3:after {
position: absolute;
top: 51%;
overflow: hidden;
width: 48%;
height: 2px;
content: '\a0';
background-color: #888;
margin-left: 5px;
}
.widget > h3:before {
margin-left: -50%;
text-align: right;
}
.screen-reader-text {
display: none;
}
.searchform {
text-align: center;
}
#searchsubmit {
display: inline-block;
padding: 4px 10px 4px;
font-size: 13px;
line-height: 18px;
color: #333333;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
background-color: #fafafa;
/*background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#e6e6e6));
background-image: -<API key>(#ffffff, #ffffff 25%, #e6e6e6);
background-image: -moz-linear-gradient(top, #ffffff, #ffffff 25%, #e6e6e6);
background-image: -ms-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
background-image: -o-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
background-image: linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
background-repeat: no-repeat;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);*/
border: 1px solid #ccc;
border-bottom-color: #bbb;
-<API key>: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
cursor: pointer;
*margin-left: .3em;
}
#searchsubmit:hover {
color: #333333;
text-decoration: none;
background-color: #e6e6e6;
background-position: 0 -15px;
-webkit-transition: background-position 0.1s linear;
-moz-transition: background-position 0.1s linear;
-ms-transition: background-position 0.1s linear;
-o-transition: background-position 0.1s linear;
transition: background-position 0.1s linear;
}
#searchsubmit:focus {
outline: thin dotted;
outline: 5px auto -<API key>;
outline-offset: -2px;
}
#searchsubmit.active, #searchsubmit:active {
background-image: none;
-webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
background-color: #e6e6e6;
background-color: #d9d9d9 \9;
color: rgba(0, 0, 0, 0.5);
outline: 0;
}
.flexslider {
margin: 0 0 60px;
margin-top: 20px;
background: #ffffff;
border: 0;
position: relative;
zoom: 1;
-<API key>: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-box-shadow: '' 0 0 0 rgba(0, 0, 0, 0);
-moz-box-shadow: '' 0 0 0 rgba(0, 0, 0, 0.0);
-o-box-shadow: '' 0 0 0 rgba(0, 0, 0, 0.0);
box-shadow: '' 0 0 0 rgba(0, 0, 0, 0.0);
}
.flex-caption {
position: absolute;
width: 100%;
padding: 2%;
left: 0;
bottom: 0;
background: rgba(0 , 0 , 0 , .5);
color: #fff;
text-shadow: 0 -1px 0 rgba(0,0,0,.3);
font-size: 14px;
line-height: 18px;
margin-bottom: 0px;
}
.flex-direction-nav .flex-prev {
left: -50px;
opacity: 1;
background-color: none;
}
.flex-direction-nav .flex-next {
right: -50px;
text-align: right;
opacity: 1;
background-color: none;
}
.flexslider:hover .flex-direction-nav .flex-prev {
opacity: 1;
left: -50px;
}
.flexslider:hover .flex-direction-nav .flex-prev:hover {
opacity: 1;
}
.flexslider:hover .flex-direction-nav .flex-next {
opacity: 1;
right: -50px;
}
.flex-direction-nav a:before {
content: " ";
display: block;
background: url('http://localhost:8888/portfolio-dev/wp-content/themes/bootstrap-wp-child/css/fonts/angle-left.png') no-repeat;
width: 40px;
height: 40px;
}
.flex-direction-nav a.flex-next:before {
content: " ";
display: block;
background: url('http://localhost:8888/portfolio-dev/wp-content/themes/bootstrap-wp-child/css/fonts/angle-right.png') no-repeat;
width: 40px;
height: 40px;
}
.about-sidebar {
color: #333;
font-family: "Lato", Helvetica, Arial, sans-serif;
line-height: 21px;
}
/*.site-title a{
text-transform: uppercase;
font-weight: 300;
font-size: 36px;
text-align: left;
color: #565656;
}
.site-title a:hover{
}
.site-description{
font-style: italic;
}
header {
padding: 20px 0;
background: transparent;
margin: 20px auto;
}
header .gravatar {
overflow: hidden;
width: 100px;
height: 100px;
-moz-border-radius: 50%;
-<API key>: 50%;
border-radius: 50%;
margin: 0;
float: right;
}
header #brand {
margin:1em 0;
}
header #brand h1 {
font-weight: 300;
color: #565656;
font-size: 16px;
font-size: 1.6rem;
margin: 0;
padding: 0;
text-transform: uppercase;
letter-spacing: 0em;
}
header #brand h1 a {
color: #565656;
text-decoration: none;
}
header #brand h1 span {
font-weight: 300;
color: #888888;
text-transform: lowercase;
}
header nav {
float: right;
}
.<API key>, .menu-main-container {
float: right;
}
.<API key> {
float: right;
}
header nav ul li {
float: left;
margin: 2px 20px 0 0;
}
header nav ul li a {
font-family: "Lato", Helvetica, Arial, sans-serif;
font-size: 14px;
font-weight: 300;
text-transform: uppercase;
}
*/
|
\section{Problem (6)}
In the \cref{fig:hw9_problem6}, block $A$ (mass $1.5 \ sl$) slides into block $B$ (mass $2.5 \ sl$), along a frictionless surface. The directions of velocities before and after the collision are indicated; the corresponding speeds are $v_{Ai} = \ 4.0 \ ft/s$, $v_{Bi} = \ 2.4 \ ft/s$, and $v_{Bf} = \ 3.2 \ ft/s$. What is velocity $v_{Af}$ (including sign, where positive denotes motion to the right)?
\begin{figure}[H]
\begin{center}
\includegraphics[scale=1]{hw9_problem6}
\caption{Illustration of Problem 6}
\label{fig:hw9_problem6}
\end{center}
\end{figure}
\textbf{R:}
\begin{align}
\Delta p = \ &0& \notag \\
p_{i} = \ &p_{f}& \notag \\
m_{A}\vec{v}_{Ai} + m_{B}\vec{v}_{Bi} = \ &m_{A}\vec{v}_{Af} + m_{B}\vec{v}_{Bf}& \notag \\
\vec{v}_{Af} = \ &\frac{m_{A}\vec{v}_{Ai} + m_{B}\vec{v}_{Bi} - m_{B}\vec{v}_{Bf}}{m_{A}}& \notag \\
= \ &\vec{v}_{Ai} + \frac{m_{B}(\vec{v}_{Bi} - \vec{v}_{Bf})}{m_{A}}& \notag \\
= \ &(4.0 \ ft/s) + \frac{(2.5 \ sl)[(2.4 \ ft/s) - (3.2 \ ft/s)]}{1.5 \ sl}& \notag \\
= \ &(4.0 \ ft/s) + (1.\bar{6})(-0.8 \ ft/s)& \notag \\
= \ &(4.0 \ ft/s) - (1.\bar{3} \ ft/s)& \notag \\
= \ &+ 2.\bar{6} \ ft/s&
\end{align}
|
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt_private.h"
/**
@file rsa_import.c
Import a PKCS RSA key, Tom St Denis
*/
#ifdef LTC_MRSA
/**
Import an RSAPublicKey or RSAPrivateKey [two-prime only, only support >= 1024-bit keys, defined in PKCS #1 v2.1]
@param in The packet to import from
@param inlen It's length (octets)
@param key [out] Destination for newly imported key
@return CRYPT_OK if successful, upon error allocated memory is freed
*/
int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key)
{
int err;
void *zero;
unsigned char *tmpbuf=NULL;
unsigned long tmpbuf_len, len;
LTC_ARGCHK(in != NULL);
LTC_ARGCHK(key != NULL);
LTC_ARGCHK(ltc_mp.name != NULL);
/* init key */
if ((err = mp_init_multi(&key->e, &key->d, &key->N, &key->dQ,
&key->dP, &key->qP, &key->p, &key->q, NULL)) != CRYPT_OK) {
return err;
}
/* see if the OpenSSL DER format RSA public key will work */
tmpbuf_len = inlen;
tmpbuf = XCALLOC(1, tmpbuf_len);
if (tmpbuf == NULL) {
err = CRYPT_MEM;
goto LBL_ERR;
}
len = 0;
err = <API key>(in, inlen,
PKA_RSA, tmpbuf, &tmpbuf_len,
LTC_ASN1_NULL, NULL, &len);
if (err == CRYPT_OK) { /* <API key> format */
/* now it should be SEQUENCE { INTEGER, INTEGER } */
if ((err = <API key>(tmpbuf, tmpbuf_len,
LTC_ASN1_INTEGER, 1UL, key->N,
LTC_ASN1_INTEGER, 1UL, key->e,
LTC_ASN1_EOL, 0UL, NULL)) != CRYPT_OK) {
goto LBL_ERR;
}
key->type = PK_PUBLIC;
err = CRYPT_OK;
goto LBL_FREE;
}
/* not SSL public key, try to match against PKCS #1 standards */
err = <API key>(in, inlen, LTC_ASN1_INTEGER, 1UL, key->N,
LTC_ASN1_EOL, 0UL, NULL);
if (err != CRYPT_OK && err != <API key>) {
goto LBL_ERR;
}
if (mp_cmp_d(key->N, 0) == LTC_MP_EQ) {
if ((err = mp_init(&zero)) != CRYPT_OK) {
goto LBL_ERR;
}
/* it's a private key */
if ((err = <API key>(in, inlen,
LTC_ASN1_INTEGER, 1UL, zero,
LTC_ASN1_INTEGER, 1UL, key->N,
LTC_ASN1_INTEGER, 1UL, key->e,
LTC_ASN1_INTEGER, 1UL, key->d,
LTC_ASN1_INTEGER, 1UL, key->p,
LTC_ASN1_INTEGER, 1UL, key->q,
LTC_ASN1_INTEGER, 1UL, key->dP,
LTC_ASN1_INTEGER, 1UL, key->dQ,
LTC_ASN1_INTEGER, 1UL, key->qP,
LTC_ASN1_EOL, 0UL, NULL)) != CRYPT_OK) {
mp_clear(zero);
goto LBL_ERR;
}
mp_clear(zero);
key->type = PK_PRIVATE;
} else if (mp_cmp_d(key->N, 1) == LTC_MP_EQ) {
/* we don't support multi-prime RSA */
err = <API key>;
goto LBL_ERR;
} else {
/* it's a public key and we lack e */
if ((err = <API key>(in, inlen,
LTC_ASN1_INTEGER, 1UL, key->N,
LTC_ASN1_INTEGER, 1UL, key->e,
LTC_ASN1_EOL, 0UL, NULL)) != CRYPT_OK) {
goto LBL_ERR;
}
key->type = PK_PUBLIC;
}
err = CRYPT_OK;
goto LBL_FREE;
LBL_ERR:
mp_clear_multi(key->d, key->e, key->N, key->dQ, key->dP, key->qP, key->p, key->q, NULL);
LBL_FREE:
if (tmpbuf != NULL) {
XFREE(tmpbuf);
}
return err;
}
#endif /* LTC_MRSA */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
|
package com.oracle.graal.nodes.calc;
import java.nio.*;
import com.oracle.graal.api.meta.*;
import com.oracle.graal.compiler.common.type.*;
import com.oracle.graal.graph.*;
import com.oracle.graal.graph.spi.*;
import com.oracle.graal.lir.gen.*;
import com.oracle.graal.nodeinfo.*;
import com.oracle.graal.nodes.*;
import com.oracle.graal.nodes.spi.*;
/**
* The {@code ReinterpretNode} class represents a reinterpreting conversion that changes the stamp
* of a primitive value to some other incompatible stamp. The new stamp must have the same width as
* the old stamp.
*/
@NodeInfo
public final class ReinterpretNode extends UnaryNode implements <API key> {
public static final NodeClass<ReinterpretNode> TYPE = NodeClass.create(ReinterpretNode.class);
public ReinterpretNode(Kind to, ValueNode value) {
this(StampFactory.forKind(to), value);
}
public ReinterpretNode(Stamp to, ValueNode value) {
super(TYPE, to, value);
assert to instanceof ArithmeticStamp;
}
private <API key> evalConst(<API key> c) {
/*
* We don't care about byte order here. Either would produce the correct result.
*/
ByteBuffer buffer = ByteBuffer.wrap(new byte[c.getSerializedSize()]).order(ByteOrder.nativeOrder());
c.serialize(buffer);
buffer.rewind();
<API key> ret = ((ArithmeticStamp) stamp()).deserialize(buffer);
assert !buffer.hasRemaining();
return ret;
}
@Override
public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) {
if (forValue.isConstant()) {
return ConstantNode.forConstant(stamp(), evalConst((<API key>) forValue.asConstant()), null);
}
if (stamp().isCompatible(forValue.stamp())) {
return forValue;
}
if (forValue instanceof ReinterpretNode) {
ReinterpretNode reinterpret = (ReinterpretNode) forValue;
return new ReinterpretNode(stamp(), reinterpret.getValue());
}
return this;
}
@Override
public void generate(<API key> builder, <API key> gen) {
LIRKind kind = gen.getLIRKind(stamp());
builder.setResult(this, gen.emitReinterpret(kind, builder.operand(getValue())));
}
public static ValueNode reinterpret(Kind toKind, ValueNode value) {
return value.graph().unique(new ReinterpretNode(toKind, value));
}
@NodeIntrinsic
public static native float reinterpret(@<API key> Kind kind, int value);
@NodeIntrinsic
public static native int reinterpret(@<API key> Kind kind, float value);
@NodeIntrinsic
public static native double reinterpret(@<API key> Kind kind, long value);
@NodeIntrinsic
public static native long reinterpret(@<API key> Kind kind, double value);
}
|
<?php
namespace Magento\ProductVideo\Test\Constraint;
use Magento\Cms\Test\Page\CmsIndex;
use Magento\Mtf\Fixture\InjectableFixture;
use Magento\Mtf\Constraint\AbstractConstraint;
use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
/**
* Assert that video is displayed on category page.
*/
class <API key> extends AbstractConstraint
{
/**
* Assert that video is displayed on category page on Store front.
*
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param InjectableFixture $product
* @return void
*/
public function processAssert(
CmsIndex $cmsIndex,
CatalogCategoryView $catalogCategoryView,
InjectableFixture $product
) {
$cmsIndex->open();
$cmsIndex->getTopmenu()-><API key>($product->getCategoryIds()[0]);
$src = $catalogCategoryView->getListProductBlock()->getProductItem($product)->getBaseImageSource();
\PHPUnit\Framework\Assert::assertFalse(
strpos($src, '/placeholder/') !== false,
'Video preview image is not displayed on category view when it should.'
);
}
/**
* Returns a string representation of the object.
*
* @return string
*/
public function toString()
{
return 'Video preview images is displayed on category view.';
}
}
|
#!/usr/bin/env python
import os, sys
path = [ ".", "..", "../..", "../../..", "../../../.." ]
head = os.path.dirname(sys.argv[0])
if len(head) > 0:
path = [os.path.join(head, p) for p in path]
path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
if len(path) == 0:
raise "can't find toplevel directory!"
sys.path.append(os.path.join(path[0]))
from scripts import *
dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)
client = os.path.join(os.getcwd(), "client")
if TestUtil.appverifier:
TestUtil.<API key>([client])
clientProc = TestUtil.startClient(client, ' --Freeze.Warn.Rollback=0 "%s"' % os.getcwd())
clientProc.waitTestSuccess()
if TestUtil.appverifier:
TestUtil.<API key>([client])
|
<?php
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();
/**
* HTML Helper
*
* @package VirtueMart
* @subpackage Helpers
* @author RickG
*/
class VmHTML{
/**
* Converts all special chars to html entities
*
* @param string $string
* @param string $quote_style
* @param boolean $only_special_chars Only Convert Some Special Chars ? ( <, >, &, ... )
* @return string
*/
function shopMakeHtmlSafe( $string, $quote_style='ENT_QUOTES', $use_entities=false ) {
if( defined( $quote_style )) {
$quote_style = constant($quote_style);
}
if( $use_entities ) {
$string = @htmlentities( $string, constant($quote_style), self::vmGetCharset() );
} else {
$string = @htmlspecialchars( $string, $quote_style, self::vmGetCharset() );
}
return $string;
}
/**
* Returns the charset string from the global _ISO constant
*
* @return string UTF-8 by default
* @since 1.0.5
*/
function vmGetCharset() {
$iso = explode( '=', @constant('_ISO') );
if( !empty( $iso[1] )) {
return $iso[1];
}
else {
return 'UTF-8';
}
}
/**
* Generate HTML code for a row using VmHTML function
*
* @func string : function to call
* @label string : Text Label
* @args array : arguments
* @return string: HTML code for row table
*/
function row($func,$label){
$VmHTML="VmHTML";
$passedArgs = func_get_args();
array_shift( $passedArgs );//remove function
array_shift( $passedArgs );//remove label
$args = array();
foreach ($passedArgs as $k => $v) {
$args[] = &$passedArgs[$k];
}
$lang =& JFactory::getLanguage();
$label = $lang->hasKey($label.'_TIP') ? '<span class="hasTip" title="'.JText::_($label.'_TIP').'">'.JText::_($label).'</span>' : JText::_($label) ;
$html = '
<tr>
<td class="key">
'.$label.'
</td>
<td>
'.<API key>(array($VmHTML, $func), $args).'
</td>
</tr>';
return $html ;
}
/* simple value display */
function value( $value ){
$lang =& JFactory::getLanguage();
return $lang->hasKey($value) ? JText::_($value) : $value;
}
/* simple raw render */
function raw( $value ){
return $value;
}
/**
* Generate HTML code for a checkbox
*
* @param string Name for the chekcbox
* @param mixed Current value of the checkbox
* @param mixed Value to assign when checkbox is checked
* @param mixed Value to assign when checkbox is not checked
* @return string HTML code for checkbox
*/
function checkbox($name, $value, $checkedValue=1, $uncheckedValue=0, $extraAttribs = '') {
if ($value == $checkedValue) {
$checked = 'checked="checked"';
}
else {
$checked = '';
}
$htmlcode = '<input type="hidden" name="' . $name . '" value="' . $uncheckedValue . '">';
$htmlcode .= '<input '.$extraAttribs.' id="' . $name . '" type="checkbox" name="' . $name . '" value="' . $checkedValue . '" ' . $checked . ' />';
return $htmlcode;
}
/**
* Prints an HTML dropdown box named $name using $arr to
* load the drop down. If $value is in $arr, then $value
* will be the selected option in the dropdown.
* @author gday
* @author soeren
*
* @param string $name The name of the select element
* @param string $value The pre-selected value
* @param array $arr The array containting $key and $val
* @param int $size The size of the select element
* @param string $multiple use "multiple=\"multiple\" to have a multiple choice select list
* @param string $extra More attributes when needed
* @return string HTML drop-down list
*/
function selectList($name, $value, $arrIn, $size=1, $multiple="", $extra="") {
$html = '';
if( empty( $arrIn ) ) {
$arr = array();
} else {
if(!is_array($arrIn)){
$arr=array($arrIn);
} else {
$arr=$arrIn;
}
}
$html = '<select class="inputbox" id="'.$name.'" name="'.$name.'" size="'.$size.'" '.$multiple.' '.$extra.'>';
while (list($key, $val) = each($arr)) {
// foreach ($arr as $key=>$val){
$selected = "";
if( is_array( $value )) {
if( in_array( $key, $value )) {
$selected = 'selected="selected"';
}
}
else {
if(strtolower($value) == strtolower($key) ) {
$selected = 'selected="selected"';
}
}
$html .= '<option value="'.$key.'" '.$selected.'>'.self::shopMakeHtmlSafe($val);
$html .= '</option>';
}
$html .= '</select>';
return $html;
}
// function <API key>( $arrIn, $tag_name, $tag_attribs, $key, $text, $selected, $required=0 ) {
/ function <API key>($tag_name ,$tag_attribs ,$arrIn , $key, $text, $selected, $required=0 ) {
// echo '<br />$tag_name '.$tag_name;
// echo '<br />$tag_attribs '.$tag_attribs;
// echo '<br />$key '.$key;
// echo '<br />$text '.$text;
// echo '<br />$selected '.$selected;
// if(empty($arrIn)){
// return 'Error <API key> no first argument given';
// if(!is_array($arrIn)){
// $arr=array($arrIn);
// } else {
// $arr=$arrIn;
// reset( $arr );
// $html = "\n<select name=\"$tag_name\" id=\"".str_replace('[]', '', $tag_name)."\" $tag_attribs>";
// if(!$required) $html .= "\n\t<option value=\"\">".JText::_('<API key>')."</option>";
// $n=count( $arr );
// for ($i=0; $i < $n; $i++ ) {
// $k = stripslashes($arr[$i]->$key);
// $t = stripslashes($arr[$i]->$text);
// $id = isset($arr[$i]->id) ? $arr[$i]->id : null;
// $extra = '';
// $extra .= $id ? " id=\"" . $arr[$i]->id . "\"" : '';
// if (is_array( $selected )) {
// foreach ($selected as $obj) {
// $k2 = stripslashes($obj->$key);
// if ($k == $k2) {
// $extra .= " selected=\"selected\"";
// break;
// } else {
// $extra .= ($k == stripslashes($selected) ? " selected=\"selected\"" : '');
// $html .= "\n\t<option value=\"".$k."\"$extra>";
// if( $t[0] == '_' ) $t = substr( $t, 1 );
// $html .= JText::_($t);
// $html .= "</option>";
// $html .= "\n</select>\n";
// return $html;
/**
* Creates a Radio Input List
*
* @param string $name
* @param string $value default value
* @param string $arr
* @param string $extra
* @return string
*/
function radioList($name, $value, &$arr, $extra="") {
$html = '';
if( empty( $arr ) ) {
$arr = array();
}
$html = '';
$i = 0;
foreach($arr as $key => $val) {
$checked = '';
if( is_array( $value )) {
if( in_array( $key, $value )) {
$checked = 'checked="checked"';
}
}
else {
if(strtolower($value) == strtolower($key) ) {
$checked = 'checked="checked"';
}
}
$html .= '<input type="radio" name="'.$name.'" id="'.$name.$i.'" value="'.htmlspecialchars($key, ENT_QUOTES).'" '.$checked.' '.$extra." />\n";
$html .= '<label for="'.$name.$i++.'">'.$val."</label><br />\n";
}
return $html;
}
/**
* Creates radio List
* @param array $radios
* @param string $name
* @param string $default
* @return string
*/
function radio( $name, $radios, $default,$key='value',$text='text') {
return '<fieldset class="radio">'.JHTML::_('select.radiolist', $radios, $name, '', $key, $text, $default).'</fieldset>';
}
/**
* Creating rows with boolean list
*
* @author Patrick Kohl
* @param string $label
* @param string $name
* @param string $value
*
*/
public function booleanlist ( $name, $value,$class='class="inputbox"'){
return '<fieldset class="radio">'.JHTML::_( 'select.booleanlist', $name , $class , $value).'</fieldset>' ;
}
/**
* Creating rows with input fields
*
* @author Patrick Kohl
* @param string $text
* @param string $name
* @param string $value
*/
public function input($name,$value,$class='class="inputbox"',$readonly='',$size='37',$maxlength='255',$more=''){
return '<input type="text" '.$readonly.' '.$class.' id="'.$name.'" name="'.$name.'" size="'.$size.'" maxlength="'.$maxlength.'" value="'.$value.'" />'.$more.'</td>';
}
/**
* Creating rows with input fields
*
* @author Patrick Kohl
* @param string $text
* @param string $name
* @param string $value
*/
public function textarea($name,$value,$class='class="inputbox"',$cols='70',$rows="10"){
return '<textarea '.$class.' id="'.$name.'" name="'.$name.'" cols="'.$cols.'" rows="'.$rows.'"/>'.$value.'</textarea ></td>';
}
/**
* render editor code
*
* @author Patrick Kohl
* @param string $text
* @param string $name
* @param string $value
*/
public function editor($name,$value,$size='100%',$height='300',$hide = array('pagebreak', 'readmore')){
$editor =& JFactory::getEditor();
return $editor->display($name, $value, $size, $height, null, null ,$hide ) ;
}
/**
*
* @author Patrick Kohl
* @param array $options( value & text)
* @param string $name option name
* @param string $defaut defaut value
* @param string $key option value
* @param string $text option text
* @param boolean $zero add a '0' value in the option
* return a select list
*/
public function select($name, $options, $default = '0',$attrib = "onchange='submit();'",$key ='value' ,$text ='text', $zero=true){
if ($zero==true) {
$option = array($key =>"0", $text => JText::_('<API key>'));
$options = array_merge(array($option), $options);
}
return JHTML::_('select.genericlist', $options,$name,$attrib,$key,$text,$default,false,true);
}
/**
* renders the hidden input
* @author Max Milbers
*/
public function inputHidden($values){
$html='';
foreach($values as $k=>$v){
$html .= '<input type="hidden" name="'.$k.'" value="'.$v.'" />';
}
return $html;
} /**
* renders the Edit Form hidden default input
* @author Patrick Kohl
*/
public function HiddenEdit($controller=0, $task=''){
if (!$controller) $controller = JRequest::getCmd('view');
return '
<input type="hidden" name="task" value="'.$task.'" />
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="controller" value="'.$controller.'" />
'. JHTML::_( 'form.token' ) ;
}
/**
* @author Patrick Kohl
* @var $type type of regular Expression to validate
* $type can be I integer, F Float, A date, M, time, T text, L link, U url, P phone
*@bool $required field is required
*@Int $min minimum of char
*@Int $max max of char
*@var $match original ID field to compare with this such as Email, passsword
*@ Return $html class for validate javascript
**/
public function validate($type='',$required=true, $min=null,$max=null,$match=null) {
if ($required) $validTxt = 'required';
else $validTxt = 'optional';
if (isset($min)) $validTxt .= ',minSize['.$min.']';
if (isset($max)) $validTxt .= ',maxSize['.$max.']';
static $validateID=0 ;
$validateID++;
if ($type=='S' ) return 'id="validate'.$validateID.'" class="validate[required,minSize[2],maxSize[255]]"';
$validate = array ( 'I'=>'onlyNumberSp', 'F'=>'number','D'=>'dateTime','A'=>'date','M'=>'time','T'=>'Text','L'=>'link','U'=>'url','P'=>'phone');
if (isset ($validate[$type])) $validTxt .= ',custom['.$validate[$type].']';
$html ='id="validate'.$validateID.'" class="validate['.$validTxt.']"';
return $html ;
}
}
|
#!/usr/bin/python
import os
import sys
import re
# file name unified by the following rule:
# 1. always save the osm under ../osmFiles directory
# 2. the result automatically generate to ../trajectorySets
# 3.1. change variable "osmName", or
# 3.2. use command argument to specify osm file name
# 4. this script generates a set of paths, each includes a series of of points,
# and save in originOfLife folder for further parsing.
# also, please scroll down the very bottom to see what's the next step
osmName = 'San_Jose_20x20.osm' # sample: 'ucla.osm'
#osmName = 'Los_Angeles_20x20.osm' # sample: 'ucla.osm'
#osmName = 'ucla_5x5.osm' # sample: 'ucla.osm'
optionAllowLoop = False # most of the cases are building bounding boxes
# support system parameters
if len(sys.argv) >= 2:
osmName = sys.argv[1]
if len(sys.argv) >= 3:
optionAllowLoop = (sys.argv[2] == '1')
inFile = '../../../Data/osmFiles/' + osmName
if len(osmName.split('.')) == 1:
osmNameWoExt = osmName
else:
osmNameWoExt = osmName[:-(1+len(osmName.split('.')[-1]))]
outRootDir = '../../../Data/trajectorySets/'
outFile = outRootDir + osmNameWoExt + '.tfix'
print('input file = ' + inFile)
print('output file = ' + outFile)
print('')
f = open('/tmp/in', 'w')
f.write('<in>' + inFile + '</in>');
f.close()
# the following command can be slow. a 3x3 mile^2 area takes 53 seconds to generate the result.
xmlWayDetail = outRootDir + 'originOfLife/' + osmNameWoExt + '.xml'
cmd = 'basex findWayTrajectory.xq > ' + xmlWayDetail
print('CMD: ' + cmd)
if os.path.isfile(xmlWayDetail):
print('File existed. Skip.')
else:
os.system(cmd)
# the next step should be executing the python3 ../makeElevSegMap.py with the input
# parameter outFile, but because of the relative folder path issue, integrating
# makeElevSegMap.py into this code needs to make big changes. So at this stage,
# we still stay on manually executing that script.
|
#google-map
{
height: 300px;
}
|
package com.cf.tradeprocessor.web.rest.response;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
public class JsonResponse {
private Boolean success;
@JsonInclude(Include.NON_NULL)
private Object result;
public JsonResponse() {
}
private JsonResponse(Boolean success, Object result) {
this.success = success;
this.result = result;
}
public static JsonResponse success(Object result) {
return new JsonResponse(true, result);
}
public static JsonResponse success() {
return success(null);
}
public static JsonResponse error(String message) {
return new JsonResponse(false, message);
}
public static JsonResponse error() {
return error(null);
}
public Boolean getSuccess() {
return success;
}
public Object getResult() {
return result;
}
}
|
/*jslint browser: true */ /*global jQuery: true */
// TODO JsDoc
/**
* Create a cookie with the given key and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String key The key of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given key.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String key The key of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function (key, value, options) {
// key and value given, set cookie...
if (arguments.length > 1 && (value === null || typeof value !== "object")) {
options = jQuery.extend({}, options);
if (value === null) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
return (document.cookie = [
encodeURIComponent(key), '=',
options.raw ? String(value) : encodeURIComponent(String(value)),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// key and possibly options given, get cookie...
options = value || {};
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};
;
(function ($) {
/**
* This script transforms a set of fieldsets into a stack of vertical
* tabs. Another tab pane can be selected by clicking on the respective
* tab.
*
* Each tab may have a summary which can be updated by another
* script. For that to work, each fieldset has an associated
* 'verticalTabCallback' (with jQuery.data() attached to the fieldset),
* which is called every time the user performs an update to a form
* element inside the tab pane.
*/
Drupal.behaviors.verticalTabs = {
attach: function (context) {
$('.vertical-tabs-panes', context).once('vertical-tabs', function () {
var focusID = $(':hidden.<API key>', this).val();
var tab_focus;
// Check if there are some fieldsets that can be converted to vertical-tabs
var $fieldsets = $('> fieldset', this);
if ($fieldsets.length == 0) {
return;
}
// Create the tab column.
var tab_list = $('<ul class="vertical-tabs-list"></ul>');
$(this).wrap('<div class="vertical-tabs clearfix"></div>').before(tab_list);
// Transform each fieldset into a tab.
$fieldsets.each(function () {
var vertical_tab = new Drupal.verticalTab({
title: $('> legend', this).text(),
fieldset: $(this)
});
tab_list.append(vertical_tab.item);
$(this)
.removeClass('collapsible collapsed')
.addClass('vertical-tabs-pane')
.data('verticalTab', vertical_tab);
if (this.id == focusID) {
tab_focus = $(this);
}
});
$('> li:first', tab_list).addClass('first');
$('> li:last', tab_list).addClass('last');
if (!tab_focus) {
// If the current URL has a fragment and one of the tabs contains an
// element that matches the URL fragment, activate that tab.
if (window.location.hash && $(this).find(window.location.hash).length) {
tab_focus = $(this).find(window.location.hash).closest('.vertical-tabs-pane');
}
else {
tab_focus = $('> .vertical-tabs-pane:first', this);
}
}
if (tab_focus.length) {
tab_focus.data('verticalTab').focus();
}
});
}
};
/**
* The vertical tab object represents a single tab within a tab group.
*
* @param settings
* An object with the following keys:
* - title: The name of the tab.
* - fieldset: The jQuery object of the fieldset that is the tab pane.
*/
Drupal.verticalTab = function (settings) {
var self = this;
$.extend(this, settings, Drupal.theme('verticalTab', settings));
this.link.click(function () {
self.focus();
return false;
});
// Keyboard events added:
// Pressing the Enter key will open the tab pane.
this.link.keydown(function(event) {
if (event.keyCode == 13) {
self.focus();
// Set focus on the first input field of the visible fieldset/tab pane.
$("fieldset.vertical-tabs-pane :input:visible:enabled:first").focus();
return false;
}
});
this.fieldset
.bind('summaryUpdated', function () {
self.updateSummary();
})
.trigger('summaryUpdated');
};
Drupal.verticalTab.prototype = {
/**
* Displays the tab's content pane.
*/
focus: function () {
this.fieldset
.siblings('fieldset.vertical-tabs-pane')
.each(function () {
var tab = $(this).data('verticalTab');
tab.fieldset.hide();
tab.item.removeClass('selected');
})
.end()
.show()
.siblings(':hidden.<API key>')
.val(this.fieldset.attr('id'));
this.item.addClass('selected');
// Mark the active tab for screen readers.
$('#active-vertical-tab').remove();
this.link.append('<span id="active-vertical-tab" class="element-invisible">' + Drupal.t('(active tab)') + '</span>');
},
/**
* Updates the tab's summary.
*/
updateSummary: function () {
this.summary.html(this.fieldset.drupalGetSummary());
},
/**
* Shows a vertical tab pane.
*/
tabShow: function () {
// Display the tab.
this.item.show();
// Update .first marker for items. We need recurse from parent to retain the
// actual DOM element order as jQuery implements sortOrder, but not as public
// method.
this.item.parent().children('.vertical-tab-button').removeClass('first')
.filter(':visible:first').addClass('first');
// Display the fieldset.
this.fieldset.removeClass('vertical-tab-hidden').show();
// Focus this tab.
this.focus();
return this;
},
/**
* Hides a vertical tab pane.
*/
tabHide: function () {
// Hide this tab.
this.item.hide();
// Update .first marker for items. We need recurse from parent to retain the
// actual DOM element order as jQuery implements sortOrder, but not as public
// method.
this.item.parent().children('.vertical-tab-button').removeClass('first')
.filter(':visible:first').addClass('first');
// Hide the fieldset.
this.fieldset.addClass('vertical-tab-hidden').hide();
// Focus the first visible tab (if there is one).
var $firstTab = this.fieldset.siblings('.vertical-tabs-pane:not(.vertical-tab-hidden):first');
if ($firstTab.length) {
$firstTab.data('verticalTab').focus();
}
return this;
}
};
/**
* Theme function for a vertical tab.
*
* @param settings
* An object with the following keys:
* - title: The name of the tab.
* @return
* This function has to return an object with at least these keys:
* - item: The root tab jQuery element
* - link: The anchor tag that acts as the clickable area of the tab
* (jQuery version)
* - summary: The jQuery element that contains the tab summary
*/
Drupal.theme.prototype.verticalTab = function (settings) {
var tab = {};
tab.item = $('<li class="vertical-tab-button" tabindex="-1"></li>')
.append(tab.link = $('<a href="
.append(tab.title = $('<strong></strong>').text(settings.title))
.append(tab.summary = $('<span class="summary"></span>')
)
);
return tab;
};
})(jQuery);
;
(function ($) {
/**
* The base States namespace.
*
* Having the local states variable allows us to use the States namespace
* without having to always declare "Drupal.states".
*/
var states = Drupal.states = {
// An array of functions that should be postponed.
postponed: []
};
/**
* Attaches the states.
*/
Drupal.behaviors.states = {
attach: function (context, settings) {
var $context = $(context);
for (var selector in settings.states) {
for (var state in settings.states[selector]) {
new states.Dependent({
element: $context.find(selector),
state: states.State.sanitize(state),
constraints: settings.states[selector][state]
});
}
}
// Execute all postponed functions now.
while (states.postponed.length) {
(states.postponed.shift())();
}
}
};
/**
* Object representing an element that depends on other elements.
*
* @param args
* Object with the following keys (all of which are required):
* - element: A jQuery object of the dependent element
* - state: A State object describing the state that is dependent
* - constraints: An object with dependency specifications. Lists all elements
* that this element depends on. It can be nested and can contain arbitrary
* AND and OR clauses.
*/
states.Dependent = function (args) {
$.extend(this, { values: {}, oldValue: null }, args);
this.dependees = this.getDependees();
for (var selector in this.dependees) {
this.initializeDependee(selector, this.dependees[selector]);
}
};
states.Dependent.comparisons = {
'RegExp': function (reference, value) {
return reference.test(value);
},
'Function': function (reference, value) {
// The "reference" variable is a comparison function.
return reference(value);
},
'Number': function (reference, value) {
// If "reference" is a number and "value" is a string, then cast reference
// as a string before applying the strict comparison in compare(). Otherwise
// numeric keys in the form's #states array fail to match string values
// returned from jQuery's val().
return (typeof value === 'string') ? compare(reference.toString(), value) : compare(reference, value);
}
};
states.Dependent.prototype = {
/**
* Initializes one of the elements this dependent depends on.
*
* @param selector
* The CSS selector describing the dependee.
* @param dependeeStates
* The list of states that have to be monitored for tracking the
* dependee's compliance status.
*/
initializeDependee: function (selector, dependeeStates) {
var state;
// Cache for the states of this dependee.
this.values[selector] = {};
for (var i in dependeeStates) {
if (dependeeStates.hasOwnProperty(i)) {
state = dependeeStates[i];
// Make sure we're not initializing this selector/state combination twice.
if ($.inArray(state, dependeeStates) === -1) {
continue;
}
state = states.State.sanitize(state);
// Initialize the value of this state.
this.values[selector][state.name] = null;
// Monitor state changes of the specified state for this dependee.
$(selector).bind('state:' + state, $.proxy(function (e) {
this.update(selector, state, e.value);
}, this));
// Make sure the event we just bound ourselves to is actually fired.
new states.Trigger({ selector: selector, state: state });
}
}
},
/**
* Compares a value with a reference value.
*
* @param reference
* The value used for reference.
* @param selector
* CSS selector describing the dependee.
* @param state
* A State object describing the dependee's updated state.
*
* @return
* true or false.
*/
compare: function (reference, selector, state) {
var value = this.values[selector][state.name];
if (reference.constructor.name in states.Dependent.comparisons) {
// Use a custom compare function for certain reference value types.
return states.Dependent.comparisons[reference.constructor.name](reference, value);
}
else {
// Do a plain comparison otherwise.
return compare(reference, value);
}
},
/**
* Update the value of a dependee's state.
*
* @param selector
* CSS selector describing the dependee.
* @param state
* A State object describing the dependee's updated state.
* @param value
* The new value for the dependee's updated state.
*/
update: function (selector, state, value) {
// Only act when the 'new' value is actually new.
if (value !== this.values[selector][state.name]) {
this.values[selector][state.name] = value;
this.reevaluate();
}
},
/**
* Triggers change events in case a state changed.
*/
reevaluate: function () {
// Check whether any constraint for this dependent state is satisifed.
var value = this.verifyConstraints(this.constraints);
// Only invoke a state change event when the value actually changed.
if (value !== this.oldValue) {
// Store the new value so that we can compare later whether the value
// actually changed.
this.oldValue = value;
// Normalize the value to match the normalized state name.
value = invert(value, this.state.invert);
// By adding "trigger: true", we ensure that state changes don't go into
// infinite loops.
this.element.trigger({ type: 'state:' + this.state, value: value, trigger: true });
}
},
/**
* Evaluates child constraints to determine if a constraint is satisfied.
*
* @param constraints
* A constraint object or an array of constraints.
* @param selector
* The selector for these constraints. If undefined, there isn't yet a
* selector that these constraints apply to. In that case, the keys of the
* object are interpreted as the selector if encountered.
*
* @return
* true or false, depending on whether these constraints are satisfied.
*/
verifyConstraints: function(constraints, selector) {
var result;
if ($.isArray(constraints)) {
// This constraint is an array (OR or XOR).
var hasXor = $.inArray('xor', constraints) === -1;
for (var i = 0, len = constraints.length; i < len; i++) {
if (constraints[i] != 'xor') {
var constraint = this.checkConstraints(constraints[i], selector, i);
// Return if this is OR and we have a satisfied constraint or if this
// is XOR and we have a second satisfied constraint.
if (constraint && (hasXor || result)) {
return hasXor;
}
result = result || constraint;
}
}
}
// Make sure we don't try to iterate over things other than objects. This
// shouldn't normally occur, but in case the condition definition is bogus,
// we don't want to end up with an infinite loop.
else if ($.isPlainObject(constraints)) {
// This constraint is an object (AND).
for (var n in constraints) {
if (constraints.hasOwnProperty(n)) {
result = ternary(result, this.checkConstraints(constraints[n], selector, n));
// False and anything else will evaluate to false, so return when any
// false condition is found.
if (result === false) { return false; }
}
}
}
return result;
},
/**
* Checks whether the value matches the requirements for this constraint.
*
* @param value
* Either the value of a state or an array/object of constraints. In the
* latter case, resolving the constraint continues.
* @param selector
* The selector for this constraint. If undefined, there isn't yet a
* selector that this constraint applies to. In that case, the state key is
* propagates to a selector and resolving continues.
* @param state
* The state to check for this constraint. If undefined, resolving
* continues.
* If both selector and state aren't undefined and valid non-numeric
* strings, a lookup for the actual value of that selector's state is
* performed. This parameter is not a State object but a pristine state
* string.
*
* @return
* true or false, depending on whether this constraint is satisfied.
*/
checkConstraints: function(value, selector, state) {
// Normalize the last parameter. If it's non-numeric, we treat it either as
// a selector (in case there isn't one yet) or as a trigger/state.
if (typeof state !== 'string' || (/[0-9]/).test(state[0])) {
state = null;
}
else if (typeof selector === 'undefined') {
// Propagate the state to the selector when there isn't one yet.
selector = state;
state = null;
}
if (state !== null) {
// constraints is the actual constraints of an element to check for.
state = states.State.sanitize(state);
return invert(this.compare(value, selector, state), state.invert);
}
else {
// Resolve this constraint as an AND/OR operator.
return this.verifyConstraints(value, selector);
}
},
/**
* Gathers information about all required triggers.
*/
getDependees: function() {
var cache = {};
// Swivel the lookup function so that we can record all available selector-
// state combinations for initialization.
var _compare = this.compare;
this.compare = function(reference, selector, state) {
(cache[selector] || (cache[selector] = [])).push(state.name);
// broken.
};
// This call doesn't actually verify anything but uses the resolving
// mechanism to go through the constraints array, trying to look up each
// value. Since we swivelled the compare function, this comparison returns
// undefined and lookup continues until the very end. Instead of lookup up
// the value, we record that combination of selector and state so that we
// can initialize all triggers.
this.verifyConstraints(this.constraints);
// Restore the original function.
this.compare = _compare;
return cache;
}
};
states.Trigger = function (args) {
$.extend(this, args);
if (this.state in states.Trigger.states) {
this.element = $(this.selector);
// Only call the trigger initializer when it wasn't yet attached to this
// element. Otherwise we'd end up with duplicate events.
if (!this.element.data('trigger:' + this.state)) {
this.initialize();
}
}
};
states.Trigger.prototype = {
initialize: function () {
var trigger = states.Trigger.states[this.state];
if (typeof trigger == 'function') {
// We have a custom trigger initialization function.
trigger.call(window, this.element);
}
else {
for (var event in trigger) {
if (trigger.hasOwnProperty(event)) {
this.defaultTrigger(event, trigger[event]);
}
}
}
// Mark this trigger as initialized for this element.
this.element.data('trigger:' + this.state, true);
},
defaultTrigger: function (event, valueFn) {
var oldValue = valueFn.call(this.element);
// Attach the event callback.
this.element.bind(event, $.proxy(function (e) {
var value = valueFn.call(this.element, e);
// Only trigger the event if the value has actually changed.
if (oldValue !== value) {
this.element.trigger({ type: 'state:' + this.state, value: value, oldValue: oldValue });
oldValue = value;
}
}, this));
states.postponed.push($.proxy(function () {
// Trigger the event once for initialization purposes.
this.element.trigger({ type: 'state:' + this.state, value: oldValue, oldValue: null });
}, this));
}
};
/**
* This list of states contains functions that are used to monitor the state
* of an element. Whenever an element depends on the state of another element,
* one of these trigger functions is added to the dependee so that the
* dependent element can be updated.
*/
states.Trigger.states = {
// 'empty' describes the state to be monitored
empty: {
// 'keyup' is the (native DOM) event that we watch for.
'keyup': function () {
// The function associated to that trigger returns the new value for the
// state.
return this.val() == '';
}
},
checked: {
'change': function () {
return this.attr('checked');
}
},
// For radio buttons, only return the value if the radio button is selected.
value: {
'keyup': function () {
// Radio buttons share the same :input[name="key"] selector.
if (this.length > 1) {
// Initial checked value of radios is undefined, so we return false.
return this.filter(':checked').val() || false;
}
return this.val();
},
'change': function () {
// Radio buttons share the same :input[name="key"] selector.
if (this.length > 1) {
// Initial checked value of radios is undefined, so we return false.
return this.filter(':checked').val() || false;
}
return this.val();
}
},
collapsed: {
'collapsed': function(e) {
return (typeof e !== 'undefined' && 'value' in e) ? e.value : this.is('.collapsed');
}
}
};
/**
* A state object is used for describing the state and performing aliasing.
*/
states.State = function(state) {
// We may need the original unresolved name later.
this.pristine = this.name = state;
// Normalize the state name.
while (true) {
// Iteratively remove exclamation marks and invert the value.
while (this.name.charAt(0) == '!') {
this.name = this.name.substring(1);
this.invert = !this.invert;
}
// Replace the state with its normalized name.
if (this.name in states.State.aliases) {
this.name = states.State.aliases[this.name];
}
else {
break;
}
}
};
/**
* Creates a new State object by sanitizing the passed value.
*/
states.State.sanitize = function (state) {
if (state instanceof states.State) {
return state;
}
else {
return new states.State(state);
}
};
/**
* This list of aliases is used to normalize states and associates negated names
* with their respective inverse state.
*/
states.State.aliases = {
'enabled': '!disabled',
'invisible': '!visible',
'invalid': '!valid',
'untouched': '!touched',
'optional': '!required',
'filled': '!empty',
'unchecked': '!checked',
'irrelevant': '!relevant',
'expanded': '!collapsed',
'readwrite': '!readonly'
};
states.State.prototype = {
invert: false,
/**
* Ensures that just using the state object returns the name.
*/
toString: function() {
return this.name;
}
};
/**
* Global state change handlers. These are bound to "document" to cover all
* elements whose state changes. Events sent to elements within the page
* bubble up to these handlers. We use this system so that themes and modules
* can override these state change handlers for particular parts of a page.
*/
$(document).bind('state:disabled', function(e) {
// Only act when this change was triggered by a dependency and not by the
// element monitoring itself.
if (e.trigger) {
$(e.target)
.attr('disabled', e.value)
.closest('.form-item, .form-submit, .form-wrapper').toggleClass('form-disabled', e.value)
.find('select, input, textarea').attr('disabled', e.value);
// Note: WebKit nightlies don't reflect that change correctly.
}
});
$(document).bind('state:required', function(e) {
if (e.trigger) {
if (e.value) {
$(e.target).closest('.form-item, .form-wrapper').find('label').append('<span class="form-required">*</span>');
}
else {
$(e.target).closest('.form-item, .form-wrapper').find('label .form-required').remove();
}
}
});
$(document).bind('state:visible', function(e) {
if (e.trigger) {
$(e.target).closest('.form-item, .form-submit, .form-wrapper').toggle(e.value);
}
});
$(document).bind('state:checked', function(e) {
if (e.trigger) {
$(e.target).attr('checked', e.value);
}
});
$(document).bind('state:collapsed', function(e) {
if (e.trigger) {
if ($(e.target).is('.collapsed') !== e.value) {
$('> legend a', e.target).click();
}
}
});
/**
* These are helper functions implementing addition "operators" and don't
* implement any logic that is particular to states.
*/
// Bitwise AND with a third undefined state.
function ternary (a, b) {
return typeof a === 'undefined' ? b : (typeof b === 'undefined' ? a : a && b);
}
// Inverts a (if it's not undefined) when invert is true.
function invert (a, invert) {
return (invert && typeof a !== 'undefined') ? !a : a;
}
// Compares two values while ignoring undefined values.
function compare (a, b) {
return (a === b) ? (typeof a === 'undefined' ? a : true) : (typeof a === 'undefined' || typeof b === 'undefined');
}
})(jQuery);
;
(function ($) {
/**
* Retrieves the summary for the first element.
*/
$.fn.drupalGetSummary = function () {
var callback = this.data('summaryCallback');
return (this[0] && callback) ? $.trim(callback(this[0])) : '';
};
/**
* Sets the summary for all matched elements.
*
* @param callback
* Either a function that will be called each time the summary is
* retrieved or a string (which is returned each time).
*/
$.fn.drupalSetSummary = function (callback) {
var self = this;
// To facilitate things, the callback should always be a function. If it's
// not, we wrap it into an anonymous function which just returns the value.
if (typeof callback != 'function') {
var val = callback;
callback = function () { return val; };
}
return this
.data('summaryCallback', callback)
// To prevent duplicate events, the handlers are first removed and then
// (re-)added.
.unbind('formUpdated.summary')
.bind('formUpdated.summary', function () {
self.trigger('summaryUpdated');
})
// The actual summaryUpdated handler doesn't fire when the callback is
// changed, so we have to do this manually.
.trigger('summaryUpdated');
};
/**
* Sends a 'formUpdated' event each time a form element is modified.
*/
Drupal.behaviors.formUpdated = {
attach: function (context) {
// These events are namespaced so that we can remove them later.
var events = 'change.formUpdated click.formUpdated blur.formUpdated keyup.formUpdated';
$(context)
// Since context could be an input element itself, it's added back to
// the jQuery object and filtered again.
.find(':input').andSelf().filter(':input')
// To prevent duplicate events, the handlers are first removed and then
// (re-)added.
.unbind(events).bind(events, function () {
$(this).trigger('formUpdated');
});
}
};
/**
* Prepopulate form fields with information from the visitor cookie.
*/
Drupal.behaviors.<API key> = {
attach: function (context, settings) {
$('form.<API key>').once('<API key>', function () {
var formContext = this;
$.each(['name', 'mail', 'homepage'], function () {
var $element = $('[name=' + this + ']', formContext);
var cookie = $.cookie('Drupal.visitor.' + this);
if ($element.length && cookie) {
$element.val(cookie);
}
});
});
}
};
})(jQuery);
;
|
#ifndef <API key>
#define <API key>
#include <stdlib.h>
#include "Platform/Define.h"
namespace MaNGOS
{
template<class T>
/**
* @brief OperatorNew policy creates an object on the heap using new.
*
*/
class MANGOS_DLL_DECL OperatorNew
{
public:
/**
* @brief
*
* @return T
*/
static T* Create()
{
return (new T);
}
/**
* @brief
*
* @param obj
*/
static void Destroy(T* obj)
{
delete obj;
}
};
template<class T>
/**
* @brief LocalStaticCreation policy creates an object on the stack the first time call Create.
*
*/
class MANGOS_DLL_DECL LocalStaticCreation
{
/**
* @brief
*
*/
union MaxAlign
{
char t_[sizeof(T)]; /**< TODO */
short int shortInt_; /**< TODO */
int int_; /**< TODO */
long int longInt_; /**< TODO */
float float_; /**< TODO */
double double_; /**< TODO */
long double longDouble_; /**< TODO */
struct Test;
int Test::* pMember_; /**< TODO */
/**
* @brief
*
* @param Test::pMemberFn_)(int
* @return int
*/
int (Test::*pMemberFn_)(int);
};
public:
/**
* @brief
*
* @return T
*/
static T* Create()
{
static MaxAlign si_localStatic;
return new(&si_localStatic) T;
}
/**
* @brief
*
* @param obj
*/
static void Destroy(T* obj)
{
obj->~T();
}
};
/**
* CreateUsingMalloc by pass the memory manger.
*/
template<class T>
/**
* @brief
*
*/
class MANGOS_DLL_DECL CreateUsingMalloc
{
public:
/**
* @brief
*
* @return T
*/
static T* Create()
{
void* p = malloc(sizeof(T));
if (!p)
{ return NULL; }
return new(p) T;
}
/**
* @brief
*
* @param p
*/
static void Destroy(T* p)
{
p->~T();
free(p);
}
};
template<class T, class CALL_BACK>
/**
* @brief CreateOnCallBack creates the object base on the call back.
*
*/
class MANGOS_DLL_DECL CreateOnCallBack
{
public:
/**
* @brief
*
* @return T
*/
static T* Create()
{
return CALL_BACK::createCallBack();
}
/**
* @brief
*
* @param p
*/
static void Destroy(T* p)
{
CALL_BACK::destroyCallBack(p);
}
};
}
#endif
|
<?php
/**
* Execution trace
* @todo document methods (?)
* @ingroup Profiler
*/
class ProfilerSimpleTrace extends ProfilerSimple {
var $trace = "Beginning trace: \n";
var $memory = 0;
function profileIn( $functionname ) {
parent::profileIn( $functionname );
$this->trace .= " " . sprintf("%6.1f",$this->memoryDiff()) .
str_repeat( " ", count($this->mWorkStack)) . " > " . $functionname . "\n";
}
function profileOut($functionname) {
global $<API key>;
if ( $<API key> ) {
$this->debug(str_repeat(' ', count($this->mWorkStack) - 1).'Exiting '.$functionname."\n");
}
list( $ofname, /* $ocount */ , $ortime ) = array_pop( $this->mWorkStack );
if ( !$ofname ) {
$this->trace .= "Profiling error: $functionname\n";
} else {
if ( $functionname == 'close' ) {
$message = "Profile section ended by close(): {$ofname}";
$functionname = $ofname;
$this->trace .= $message . "\n";
}
elseif ( $ofname != $functionname ) {
$this->trace .= "Profiling error: in({$ofname}), out($functionname)";
}
$elapsedreal = $this->getTime() - $ortime;
$this->trace .= sprintf( "%03.6f %6.1f", $elapsedreal, $this->memoryDiff() ) .
str_repeat(" ", count( $this->mWorkStack ) + 1 ) . " < " . $functionname . "\n";
}
}
function memoryDiff() {
$diff = memory_get_usage() - $this->memory;
$this->memory = memory_get_usage();
return $diff / 1024;
}
function logData() {
if ( php_sapi_name() === 'cli' ) {
print "<!-- \n {$this->trace} \n -->";
} elseif ( $this->getContentType() === 'text/html' ) {
print "<!-- \n {$this->trace} \n -->";
} elseif ( $this->getContentType() === 'text/javascript' ) {
print "\n/*\n {$this->trace}\n*/";
} elseif ( $this->getContentType() === 'text/css' ) {
print "\n/*\n {$this->trace}\n*/";
}
}
}
|
#ifndef _HXSTATLOG_
#define _HXSTATLOG_
#ifdef _MACINTOSH
#include <stdlib.h>
#endif
#ifdef _WINDOWS
#include <stdio.h>
#endif
#include "hlxclib/stdarg.h"
#include "hxresult.h"
#include "hxtypes.h"
#include "../fileio/pub/chxdataf.h"
#ifdef <API key>
# include "globals/hxglobals.h"
#endif
class HXStatLog
{
public:
HXStatLog();
~HXStatLog();
HX_RESULT Open_Read (const char * filename);
HX_RESULT Open_Write (const char * filename);
HX_RESULT Open_WriteNoAppend (const char * filename);
HX_RESULT Close (void);
LONG32 Read (char *buf, ULONG32 max_buf_length);
LONG32 Write (char *buf, ULONG32 buf_length);
HX_RESULT StatPrintf (const char* fmt, ...);
HX_RESULT ReadLine (char *buf, ULONG32 buf_length);
HX_RESULT Seek (ULONG32 offset, UINT16 fromWhere);
ULONG32 Tell (void);
private:
CHXDataFile* mStatFile;
char* mStatBuffer;
char* <API key>;
INT16 mStatBufferLength;
INT16 mStatBytesLeft;
};
// This is static implementation of the above class so that
// the log info can be written from anywahere in the player to the same
// log file...(opened once for each session)
class HXStaticStatLog
{
public:
static HX_RESULT Open_Read(const char* filename)
{
if (LogFileInstance()) return HXR_ALREADY_OPEN;
HX_RESULT theErr = HXR_OK;
LogFileInstance() = new HXStatLog;
if (!LogFileInstance())
theErr = HXR_OUTOFMEMORY;
if (!theErr)
{
theErr = LogFileInstance()->Open_Read(filename);
}
// error in opening file?
if (theErr && LogFileInstance())
{
delete LogFileInstance();
LogFileInstance() = NULL;
}
return theErr;
}
static HX_RESULT Open_Write(const char* filename)
{
if (LogFileInstance()) return HXR_ALREADY_OPEN;
HX_RESULT theErr = HXR_OK;
LogFileInstance() = new HXStatLog;
if (!LogFileInstance())
theErr = HXR_OUTOFMEMORY;
if (!theErr)
{
theErr = LogFileInstance()->Open_Write(filename);
}
// error in opening file?
if (theErr && LogFileInstance())
{
delete LogFileInstance();
LogFileInstance() = NULL;
}
return theErr;
}
static HX_RESULT Close(void)
{
if (!LogFileInstance()) return HXR_INVALID_FILE;
HX_RESULT theErr = HXR_OK;
theErr = LogFileInstance()->Close();
delete LogFileInstance();
LogFileInstance() = NULL;
return theErr;
}
static LONG32 Read(char* buf, ULONG32 max_buf_length)
{
if (!LogFileInstance()) return -1;
return LogFileInstance()->Read(buf, max_buf_length);
}
static LONG32 Write(char* buf, ULONG32 buf_length)
{
if (!LogFileInstance()) return -1;
return LogFileInstance()->Write(buf, buf_length);
}
static HX_RESULT StatPrintf(const char* fmt, ...)
{
if (!LogFileInstance()) return HXR_INVALID_FILE;
HX_RESULT theErr = HXR_OK;
#ifndef _MACINTOSH
char buf[8096]; /* Flawfinder: ignore */
LONG32 bytes_written = 0;
LONG32 bytes_towrite = 0;
va_list args;
va_start(args, fmt);
bytes_towrite = vsnprintf(buf, sizeof(buf), fmt, args); // scanf
va_end(args);
if (bytes_towrite < 0)
theErr = HXR_INVALID_PATH;
if (!theErr)
{
bytes_written = LogFileInstance()->Write(buf, (ULONG32) bytes_towrite);
if (bytes_written != bytes_towrite)
theErr = HXR_INVALID_PATH;
}
#endif
return theErr;
}
static HX_RESULT ReadLine (char *buf, ULONG32 buf_length)
{
if (!LogFileInstance()) return HXR_INVALID_FILE;
return LogFileInstance()->ReadLine(buf, buf_length);
}
static HX_RESULT Seek (ULONG32 offset, UINT16 fromWhere)
{
if (!LogFileInstance()) return HXR_INVALID_FILE;
return LogFileInstance()->Seek(offset, fromWhere);
}
static ULONG32 Tell (void)
{
if (!LogFileInstance()) return (ULONG32) -1;
return LogFileInstance()->Tell();
}
static inline HXStatLog*& LogFileInstance()
{
#if defined(<API key>)
static const HXStatLog* const pmLogFile = NULL;
return (HXStatLog*&)HXGlobalPtr::Get(&pmLogFile, NULL );
#else
static HXStatLog* pmLogFile = NULL;
return pmLogFile;
#endif
}
};
#endif //_HXSTATLOG_
|
# OpenSSL is more stable then ssl
# but OpenSSL is different then ssl, so need a wrapper
import sys
import os
import OpenSSL
SSLError = OpenSSL.SSL.WantReadError
import select
import time
import socket
import logging
ssl_version = ''
class SSLConnection(object):
"""OpenSSL Connection Wrapper"""
def __init__(self, context, sock):
self._context = context
self._sock = sock
self._connection = OpenSSL.SSL.Connection(context, sock)
self._makefile_refs = 0
def __getattr__(self, attr):
if attr not in ('_context', '_sock', '_connection', '_makefile_refs'):
return getattr(self._connection, attr)
def __iowait(self, io_func, *args, **kwargs):
timeout = self._sock.gettimeout() or 0.1
fd = self._sock.fileno()
time_start = time.time()
while True:
try:
return io_func(*args, **kwargs)
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantX509LookupError):
sys.exc_clear()
_, _, errors = select.select([fd], [], [fd], timeout)
if errors:
break
time_now = time.time()
if time_now - time_start > timeout:
break
except OpenSSL.SSL.WantWriteError:
sys.exc_clear()
_, _, errors = select.select([], [fd], [fd], timeout)
if errors:
break
time_now = time.time()
if time_now - time_start > timeout:
break
def accept(self):
sock, addr = self._sock.accept()
client = OpenSSL.SSL.Connection(sock._context, sock)
return client, addr
def do_handshake(self):
self.__iowait(self._connection.do_handshake)
def connect(self, *args, **kwargs):
return self.__iowait(self._connection.connect, *args, **kwargs)
def __send(self, data, flags=0):
try:
return self.__iowait(self._connection.send, data, flags)
except OpenSSL.SSL.SysCallError as e:
if e[0] == -1 and not data:
# errors when writing empty strings are expected and can be ignored
return 0
raise
def __send_memoryview(self, data, flags=0):
if hasattr(data, 'tobytes'):
data = data.tobytes()
return self.__send(data, flags)
send = __send if sys.version_info >= (2, 7, 5) else __send_memoryview
def recv(self, bufsiz, flags=0):
pending = self._connection.pending()
if pending:
return self._connection.recv(min(pending, bufsiz))
try:
return self.__iowait(self._connection.recv, bufsiz, flags)
except OpenSSL.SSL.ZeroReturnError:
return ''
except OpenSSL.SSL.SysCallError as e:
if e[0] == -1 and 'Unexpected EOF' in e[1]:
# errors when reading empty strings are expected and can be ignored
return ''
raise
def read(self, bufsiz, flags=0):
return self.recv(bufsiz, flags)
def write(self, buf, flags=0):
return self.sendall(buf, flags)
def close(self):
if self._makefile_refs < 1:
self._connection = None
if self._sock:
socket.socket.close(self._sock)
else:
self._makefile_refs -= 1
def makefile(self, mode='r', bufsize=-1):
self._makefile_refs += 1
return socket._fileobject(self, mode, bufsize, close=True)
@staticmethod
def context_builder(ca_certs=None, cipher_suites=('ALL:!RC4-SHA:!ECDHE-RSA-RC4-SHA:!<API key>:!AES128-GCM-SHA256',)):
# 'ALL', '!aNULL', '!eNULL'
global ssl_version
if not ssl_version:
if hasattr(OpenSSL.SSL, "TLSv1_2_METHOD"):
ssl_version = "TLSv1_2"
elif hasattr(OpenSSL.SSL, "TLSv1_1_METHOD"):
ssl_version = "TLSv1_1"
elif hasattr(OpenSSL.SSL, "TLSv1_METHOD"):
ssl_version = "TLSv1"
else:
ssl_version = "SSLv23"
if sys.platform == "darwin":
ssl_version = "TLSv1"
logging.info("SSL use version:%s", ssl_version)
protocol_version = getattr(OpenSSL.SSL, '%s_METHOD' % ssl_version)
ssl_context = OpenSSL.SSL.Context(protocol_version)
if ca_certs:
ssl_context.<API key>(os.path.abspath(ca_certs))
ssl_context.set_verify(OpenSSL.SSL.VERIFY_PEER, lambda c, x, e, d, ok: ok)
else:
ssl_context.set_verify(OpenSSL.SSL.VERIFY_NONE, lambda c, x, e, d, ok: ok)
ssl_context.set_cipher_list(':'.join(cipher_suites))
return ssl_context
|
#include "widget.h"
#include <assert.h>
void <API key>(struct widget * widget, struct widget * right)
{
assert(widget != NULL);
assert(right != NULL);
assert(widget != right);
assert(widget->navigation_right_ == NULL);
widget->navigation_right_ = right;
stack_push(widget-><API key>, right);
stack_push(right-><API key>, widget);
}
|
<html>
<head>
<title>LitKicks: Mexico</title>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<meta name="description" content="The beat legacy of Mexico">
<meta name="keywords" content="Mexico,Beat,Kerouac,Road,Kicks,Marijuana,Burroughs,Mexico City,Border">
<BASE HREF="http:
</head>
<BODY BACKGROUND="" BGCOLOR="#FFFFFF" TEXT="#000000"
LINK="#006F9F" ALINK="#0000FF" VLINK="#009F6F">
<FONT FACE="helvetica, arial">
<H2>Literary Kicks</H2>
<TABLE WIDTH="375" BORDER="0" CELLPADDING="5">
<TR>
<TD WIDTH="75"> </TD>
<TD BGCOLOR="#FFFF2F" WIDTH="180">
<FONT SIZE="-1">
Visit the
<A HREF="http:
or view
<A HREF="http:
<BR>
</FONT>
</TD>
</TR>
</TABLE>
<BR>
<CENTER>
<TABLE WIDTH="580" CELLPADDING="6">
<TR><TD BGCOLOR="#FFEECC">
<CENTER>
<FONT COLOR="#002F6F">
<H1>Mexico</H1>
</CENTER>
<FONT FACE="Verdana">
In the autumn of 1947, 25-year-old <A HREF="page.jsp?what=JackKerouac">Jack Kerouac</A> left <A HREF="page.jsp?what=SanFrancisco">San Francisco</A> and headed for Southern California in search of unforeseen adventures. He met a Mexican girl named Bea Franco on a bus and ended up following her to an encampment of Mexican grape- and cotton-pickers, where they briefly contemplated a life together before Kerouac returned home. Kerouac's telling of this poignant episode would become part of the first trip in '<A HREF="page.jsp?what=OnTheRoad">On The Road</A>,' and was published as an excerpt ('The Mexican Girl') in The Paris Review. Kerouac hadn't even reached Mexico yet (he would soon), but the Beat fascination for Mexican culture was already clear.<P>
The Beats didn't have much money, but they craved alternative cultures, and going to Mexico was the cheapest and easiest way to delve into what we now call the Third World. <A HREF="page.jsp?what=WilliamSBurroughs">William S. Burroughs</A> lived in Mexico City for a time, and it was here that he caused the death of his wife while playing with guns. He had to flee Mexico, but later explored South American jungles in search of a drug called Yage, and the letters he wrote to <A HREF="page.jsp?what=AllenGinsberg">Allen Ginsberg</A> during this time have been published as 'The Yage Letters.'<P>
Ginsberg had his own Mexican adventures. The year before he became famous for '<A HREF="page.jsp?what=Howl">Howl</A>,' he went on an archeological expedition to the Mayan ruins of the Yucatan Peninsula, and ended up leading a spontaneous expedition of over fifty villagers to explore a volcano during an earthquake. This episode is typical of Ginsberg's career -- he didn't know exactly what he was doing, but he had the courage to do it, and when people sensed this they named him their leader. <P>
There are more Beat connections to Mexico than I can possibly capture here. Kerouac's novel 'Tristessa' takes place there. <A HREF="page.jsp?what=<API key>">Lawrence Ferlinghetti</A> published a travel journal called 'The Mexican Night' in 1962. Timothy Leary's experiments with mind-altering drugs began with his discovery of natural Mexican psychedelics, although Leary soon adopted the use of synthetic psychedelics. Natural Mexican drugs like peyote and mescaline have always been popular, though, and Carlos Casteneda's 'Don Juan' books helped to spread this mystique. <A HREF="page.jsp?what=KenKesey">Ken Kesey</A>, another one who liked to use synthetic psychedelics, was a fugitive from American justice in Mexico during the mid-Sixties. <A HREF="page.jsp?what=NealCassady">Neal Cassady</A> died while trying to walk the railroad tracks between two Mexican villages on a cold night.<P>
The European conquest of Mexico began in 1519, a few decades after Columbus' discovery of the Americas. Several advanced Native American populations such as the Aztecs and Mayans were decimated by Europeans (Cortez's murderous confrontation with Montezuma's grand empire is the subject of Neil Young's excellent song 'Cortez the Killer'). The area was known as New Spain, but the Native American population survived better than in North America, and the current population of Mexico is largely Native American in origin. The nation of Mexico was created in 1821, during the wave of independent uprisings that followed Napoleon's disruption of the European order and his conquest of Spain.<P>
I've been to the Yucatan, and the Mayan ruins there are an amazing experience. I also just can't say enough good things about Mexican food, although I doubt any true Mexican would be very impressed by the California concoctions we Americans refer to as burritos and tacos. <P>
<CENTER><I>-- <A HREF="profile.jsp?who=brooklyn">brooklyn</A> --</I></CENTER>
</FONT>
</TD></TR>
</TABLE>
</CENTER>
<BR>
<CENTER>
<TABLE WIDTH="580" CELLPADDING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD WIDTH="270"> </TD>
<TD WIDTH="230" BGCOLOR="#5F0F3F" ALIGN="CENTER" VALIGN="MIDDLE">
<BR>
<FONT FACE="Verdana" COLOR="#FFFFFF">
Go to <A HREF="page.jsp?what=Beatitude">Beatitude Board</A>
to post responses, corrections, questions or further thoughts
<BR>
</FONT><BR>
</TD>
<TD WIDTH="80"> </TD>
</TR>
</TABLE>
</CENTER>
<BR>
<BR>
<a href="http:
</font>
</body>
</html>
|
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_66) on Tue Dec 08 01:24:03 CST 2015 -->
<title>Uses of Class com.online.lakeshoremarket.representation.order.OrderRequest</title>
<meta name="date" content="2015-12-08">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class com.online.lakeshoremarket.representation.order.OrderRequest";
}
}
catch(err) {
}
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar.top">
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../com/online/lakeshoremarket/representation/order/OrderRequest.html" title="class in com.online.lakeshoremarket.representation.order">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/online/lakeshoremarket/representation/order/class-use/OrderRequest.html" target="_top">Frames</a></li>
<li><a href="OrderRequest.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip.navbar.top">
</a></div>
<div class="header">
<h2 title="Uses of Class com.online.lakeshoremarket.representation.order.OrderRequest" class="title">Uses of Class<br>com.online.lakeshoremarket.representation.order.OrderRequest</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../com/online/lakeshoremarket/representation/order/OrderRequest.html" title="class in com.online.lakeshoremarket.representation.order">OrderRequest</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#com.online.lakeshoremarket.activity">com.online.lakeshoremarket.activity</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="#com.online.lakeshoremarket.resource">com.online.lakeshoremarket.resource</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="com.online.lakeshoremarket.activity">
</a>
<h3>Uses of <a href="../../../../../../com/online/lakeshoremarket/representation/order/OrderRequest.html" title="class in com.online.lakeshoremarket.representation.order">OrderRequest</a> in <a href="../../../../../../com/online/lakeshoremarket/activity/package-summary.html">com.online.lakeshoremarket.activity</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../com/online/lakeshoremarket/activity/package-summary.html">com.online.lakeshoremarket.activity</a> with parameters of type <a href="../../../../../../com/online/lakeshoremarket/representation/order/OrderRequest.html" title="class in com.online.lakeshoremarket.representation.order">OrderRequest</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><span class="typeNameLabel">PaymentActivity.</span><code><span class="memberNameLink"><a href="../../../../../../com/online/lakeshoremarket/activity/PaymentActivity.html#buyProduct-com.online.lakeshoremarket.representation.order.OrderRequest-">buyProduct</a></span>(<a href="../../../../../../com/online/lakeshoremarket/representation/order/OrderRequest.html" title="class in com.online.lakeshoremarket.representation.order">OrderRequest</a> orderRequest)</code>
<div class="block">creates a new payment domain for an order representation</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="com.online.lakeshoremarket.resource">
</a>
<h3>Uses of <a href="../../../../../../com/online/lakeshoremarket/representation/order/OrderRequest.html" title="class in com.online.lakeshoremarket.representation.order">OrderRequest</a> in <a href="../../../../../../com/online/lakeshoremarket/resource/package-summary.html">com.online.lakeshoremarket.resource</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../com/online/lakeshoremarket/resource/package-summary.html">com.online.lakeshoremarket.resource</a> with parameters of type <a href="../../../../../../com/online/lakeshoremarket/representation/order/OrderRequest.html" title="class in com.online.lakeshoremarket.representation.order">OrderRequest</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../com/online/lakeshoremarket/representation/generic/GenericResponse.html" title="class in com.online.lakeshoremarket.representation.generic">GenericResponse</a></code></td>
<td class="colLast"><span class="typeNameLabel">PaymentResource.</span><code><span class="memberNameLink"><a href="../../../../../../com/online/lakeshoremarket/resource/PaymentResource.html#buyProduct-com.online.lakeshoremarket.representation.order.OrderRequest-java.lang.String-java.lang.String-">buyProduct</a></span>(<a href="../../../../../../com/online/lakeshoremarket/representation/order/OrderRequest.html" title="class in com.online.lakeshoremarket.representation.order">OrderRequest</a> orderRequest,
java.lang.String email,
java.lang.String password)</code>
<div class="block">PUT method request for placing an order</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="bottomNav"><a name="navbar.bottom">
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../com/online/lakeshoremarket/representation/order/OrderRequest.html" title="class in com.online.lakeshoremarket.representation.order">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/online/lakeshoremarket/representation/order/class-use/OrderRequest.html" target="_top">Frames</a></li>
<li><a href="OrderRequest.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip.navbar.bottom">
</a></div>
</body>
</html>
|
<?php
namespace Guzzle\Common\Filter;
/**
* Check if the supplied variable is a string
*
* @author Michael Dowling <michael@guzzlephp.org>
*/
class StringFilter extends AbstractFilter
{
/**
* {@inheritdoc}
*/
protected function filterCommand($command)
{
if (!is_string($command)) {
return 'The supplied value is not a string: ' . gettype($command)
. ' supplied';
}
return true;
}
}
|
<?php
return array(
'id' => '<API key>',
'types' => array('page'),
'title' => 'Jkreativ Fullscreen Single video',
'priority' => 'high',
'template' => array(
array(
'name' => 'video_type',
'type' => 'select',
'label' => 'Video Type',
'default' => 'youtube',
'items' => array(
array(
'value' => 'youtube',
'label' => 'Youtube',
),
array(
'value' => 'vimeo',
'label' => 'Vimeo',
)
)
),
array(
'type' => 'textbox',
'name' => 'youtube_video',
'label' => 'Youtube Video',
'description' => 'url of your youtube url, ex : http:
'dependency' => array(
'field' => 'video_type',
'function' => '<API key>',
),
),
array(
'type' => 'textbox',
'name' => 'vimeo_video',
'label' => 'Vimeo Video',
'description' => 'url of your vimeo url, ex : http://vimeo.com/71536276',
'dependency' => array(
'field' => 'video_type',
'function' => '<API key>',
),
),
array(
'type' => 'toggle',
'name' => 'enable_autoplay',
'label' => 'Enable Video Autoplay'
),
),
);
|
#include "libvex_basictypes.h"
#include "libvex_ir.h"
#include "libvex.h"
#include "ir_match.h"
#include "main_util.h"
#include "main_globals.h"
#include "host_generic_regs.h"
#include "host_generic_simd64.h"
#include "host_ppc_defs.h"
#define HRcGPR(__mode64) (__mode64 ? HRcInt64 : HRcInt32)
static IRExpr* unop ( IROp op, IRExpr* a )
{
return IRExpr_Unop(op, a);
}
static IRExpr* mkU32 ( UInt i )
{
return IRExpr_Const(IRConst_U32(i));
}
static IRExpr* bind ( Int binder )
{
return IRExpr_Binder(binder);
}
typedef
struct {
IRTypeEnv* type_env;
HReg* vregmapLo;
HReg* vregmapMedLo;
HReg* vregmapMedHi;
HReg* vregmapHi;
Int n_vregmap;
UInt hwcaps;
Bool mode64;
VexAbiInfo* vbi;
Bool chainingAllowed;
Addr64 max_ga;
HInstrArray* code;
Int vreg_ctr;
IRExpr* previous_rm;
}
ISelEnv;
static HReg lookupIRTemp ( ISelEnv* env, IRTemp tmp )
{
vassert(tmp >= 0);
vassert(tmp < env->n_vregmap);
return env->vregmapLo[tmp];
}
static void lookupIRTempPair ( HReg* vrHI, HReg* vrLO,
ISelEnv* env, IRTemp tmp )
{
vassert(tmp >= 0);
vassert(tmp < env->n_vregmap);
vassert(env->vregmapMedLo[tmp] != INVALID_HREG);
*vrLO = env->vregmapLo[tmp];
*vrHI = env->vregmapMedLo[tmp];
}
static void lookupIRTempQuad ( HReg* vrHi, HReg* vrMedHi, HReg* vrMedLo,
HReg* vrLo, ISelEnv* env, IRTemp tmp )
{
vassert(!env->mode64);
vassert(tmp >= 0);
vassert(tmp < env->n_vregmap);
vassert(env->vregmapMedLo[tmp] != INVALID_HREG);
*vrHi = env->vregmapHi[tmp];
*vrMedHi = env->vregmapMedHi[tmp];
*vrMedLo = env->vregmapMedLo[tmp];
*vrLo = env->vregmapLo[tmp];
}
static void addInstr ( ISelEnv* env, PPCInstr* instr )
{
addHInstr(env->code, instr);
if (vex_traceflags & VEX_TRACE_VCODE) {
ppPPCInstr(instr, env->mode64);
vex_printf("\n");
}
}
static HReg newVRegI ( ISelEnv* env )
{
HReg reg = mkHReg(env->vreg_ctr, HRcGPR(env->mode64),
True);
env->vreg_ctr++;
return reg;
}
static HReg newVRegF ( ISelEnv* env )
{
HReg reg = mkHReg(env->vreg_ctr, HRcFlt64, True);
env->vreg_ctr++;
return reg;
}
static HReg newVRegV ( ISelEnv* env )
{
HReg reg = mkHReg(env->vreg_ctr, HRcVec128, True);
env->vreg_ctr++;
return reg;
}
static HReg iselWordExpr_R_wrk ( ISelEnv* env, IRExpr* e );
static HReg iselWordExpr_R ( ISelEnv* env, IRExpr* e );
static PPCRH* iselWordExpr_RH_wrk ( ISelEnv* env,
Bool syned, IRExpr* e );
static PPCRH* iselWordExpr_RH ( ISelEnv* env,
Bool syned, IRExpr* e );
static PPCRI* iselWordExpr_RI_wrk ( ISelEnv* env, IRExpr* e );
static PPCRI* iselWordExpr_RI ( ISelEnv* env, IRExpr* e );
static PPCRH* <API key> ( ISelEnv* env, IRExpr* e );
static PPCRH* iselWordExpr_RH5u ( ISelEnv* env, IRExpr* e );
static PPCRH* <API key> ( ISelEnv* env, IRExpr* e );
static PPCRH* iselWordExpr_RH6u ( ISelEnv* env, IRExpr* e );
static PPCAMode* <API key> ( ISelEnv* env, IRExpr* e, IRType xferTy );
static PPCAMode* iselWordExpr_AMode ( ISelEnv* env, IRExpr* e, IRType xferTy );
static void <API key> ( HReg* rHi, HReg* rMedHi,
HReg* rMedLo, HReg* rLo,
ISelEnv* env, IRExpr* e );
static void <API key> ( HReg* rHi, HReg* rMedHi,
HReg* rMedLo, HReg* rLo,
ISelEnv* env, IRExpr* e );
static void iselInt64Expr_wrk ( HReg* rHi, HReg* rLo,
ISelEnv* env, IRExpr* e );
static void iselInt64Expr ( HReg* rHi, HReg* rLo,
ISelEnv* env, IRExpr* e );
static void iselInt128Expr_wrk ( HReg* rHi, HReg* rLo,
ISelEnv* env, IRExpr* e );
static void iselInt128Expr ( HReg* rHi, HReg* rLo,
ISelEnv* env, IRExpr* e );
static PPCCondCode iselCondCode_wrk ( ISelEnv* env, IRExpr* e );
static PPCCondCode iselCondCode ( ISelEnv* env, IRExpr* e );
static HReg iselDblExpr_wrk ( ISelEnv* env, IRExpr* e );
static HReg iselDblExpr ( ISelEnv* env, IRExpr* e );
static HReg iselFltExpr_wrk ( ISelEnv* env, IRExpr* e );
static HReg iselFltExpr ( ISelEnv* env, IRExpr* e );
static HReg iselVecExpr_wrk ( ISelEnv* env, IRExpr* e );
static HReg iselVecExpr ( ISelEnv* env, IRExpr* e );
static HReg iselDfp64Expr_wrk ( ISelEnv* env, IRExpr* e );
static HReg iselDfp64Expr ( ISelEnv* env, IRExpr* e );
static void iselDfp128Expr_wrk ( HReg* rHi, HReg* rLo, ISelEnv* env,
IRExpr* e );
static void iselDfp128Expr ( HReg* rHi, HReg* rLo, ISelEnv* env,
IRExpr* e );
static PPCInstr* mk_iMOVds_RR ( HReg r_dst, HReg r_src )
{
vassert(hregClass(r_dst) == hregClass(r_src));
vassert(hregClass(r_src) == HRcInt32 ||
hregClass(r_src) == HRcInt64);
return PPCInstr_Alu(Palu_OR, r_dst, r_src, PPCRH_Reg(r_src));
}
static void add_to_sp ( ISelEnv* env, UInt n )
{
HReg sp = StackFramePtr(env->mode64);
vassert(n < 256 && (n%16) == 0);
addInstr(env, PPCInstr_Alu( Palu_ADD, sp, sp,
PPCRH_Imm(True,toUShort(n)) ));
}
static void sub_from_sp ( ISelEnv* env, UInt n )
{
HReg sp = StackFramePtr(env->mode64);
vassert(n < 256 && (n%16) == 0);
addInstr(env, PPCInstr_Alu( Palu_SUB, sp, sp,
PPCRH_Imm(True,toUShort(n)) ));
}
static HReg get_sp_aligned16 ( ISelEnv* env )
{
HReg r = newVRegI(env);
HReg align16 = newVRegI(env);
addInstr(env, mk_iMOVds_RR(r, StackFramePtr(env->mode64)));
addInstr(env, PPCInstr_Alu( Palu_ADD, r, r,
PPCRH_Imm(True,toUShort(16)) ));
addInstr(env,
PPCInstr_LI(align16, <API key>, env->mode64));
addInstr(env, PPCInstr_Alu(Palu_AND, r,r, PPCRH_Reg(align16)));
return r;
}
static HReg mk_LoadRR32toFPR ( ISelEnv* env,
HReg r_srcHi, HReg r_srcLo )
{
HReg fr_dst = newVRegF(env);
PPCAMode *am_addr0, *am_addr1;
vassert(!env->mode64);
vassert(hregClass(r_srcHi) == HRcInt32);
vassert(hregClass(r_srcLo) == HRcInt32);
sub_from_sp( env, 16 );
am_addr0 = PPCAMode_IR( 0, StackFramePtr(env->mode64) );
am_addr1 = PPCAMode_IR( 4, StackFramePtr(env->mode64) );
addInstr(env, PPCInstr_Store( 4, am_addr0, r_srcHi, env->mode64 ));
addInstr(env, PPCInstr_Store( 4, am_addr1, r_srcLo, env->mode64 ));
addInstr(env, PPCInstr_FpLdSt(True, 8, fr_dst, am_addr0));
add_to_sp( env, 16 );
return fr_dst;
}
static HReg mk_LoadR64toFPR ( ISelEnv* env, HReg r_src )
{
HReg fr_dst = newVRegF(env);
PPCAMode *am_addr0;
vassert(env->mode64);
vassert(hregClass(r_src) == HRcInt64);
sub_from_sp( env, 16 );
am_addr0 = PPCAMode_IR( 0, StackFramePtr(env->mode64) );
addInstr(env, PPCInstr_Store( 8, am_addr0, r_src, env->mode64 ));
addInstr(env, PPCInstr_FpLdSt(True, 8, fr_dst, am_addr0));
add_to_sp( env, 16 );
return fr_dst;
}
static PPCAMode* advance4 ( ISelEnv* env, PPCAMode* am )
{
PPCAMode* am4 = dopyPPCAMode( am );
if (am4->tag == Pam_IR
&& am4->Pam.IR.index + 4 <= 32767) {
am4->Pam.IR.index += 4;
} else {
vpanic("advance4(ppc,host)");
}
return am4;
}
static
PPCAMode* genGuestArrayOffset ( ISelEnv* env, IRRegArray* descr,
IRExpr* off, Int bias )
{
HReg rtmp, roff;
Int elemSz = sizeofIRType(descr->elemTy);
Int nElems = descr->nElems;
Int shift = 0;
if (nElems != 16 && nElems != 32)
vpanic("genGuestArrayOffset(ppc host)(1)");
switch (elemSz) {
case 4: shift = 2; break;
case 8: shift = 3; break;
default: vpanic("genGuestArrayOffset(ppc host)(2)");
}
if (bias < -100 || bias > 100)
vpanic("genGuestArrayOffset(ppc host)(3)");
if (descr->base < 0 || descr->base > 5000)
vpanic("genGuestArrayOffset(ppc host)(4)");
roff = iselWordExpr_R(env, off);
rtmp = newVRegI(env);
addInstr(env, PPCInstr_Alu(
Palu_ADD,
rtmp, roff,
PPCRH_Imm(True, toUShort(bias))));
addInstr(env, PPCInstr_Alu(
Palu_AND,
rtmp, rtmp,
PPCRH_Imm(False, toUShort(nElems-1))));
addInstr(env, PPCInstr_Shft(
Pshft_SHL,
env->mode64 ? False : True,
rtmp, rtmp,
PPCRH_Imm(False, toUShort(shift))));
addInstr(env, PPCInstr_Alu(
Palu_ADD,
rtmp, rtmp,
PPCRH_Imm(True, toUShort(descr->base))));
return
PPCAMode_RR( GuestStatePtr(env->mode64), rtmp );
}
static
Bool <API key> ( IRExpr* e )
{
switch (e->tag) {
case Iex_RdTmp: case Iex_Const: case Iex_Get:
return False;
default:
return True;
}
}
static
void doHelperCall ( ISelEnv* env,
Bool passBBP,
IRExpr* guard, IRCallee* cee, IRExpr** args )
{
PPCCondCode cc;
HReg argregs[PPC_N_REGPARMS];
HReg tmpregs[PPC_N_REGPARMS];
Bool go_fast;
Int n_args, i, argreg;
UInt argiregs;
ULong target;
Bool mode64 = env->mode64;
Bool regalign_int64s
= (!mode64) && env->vbi-><API key>;
n_args = 0;
for (i = 0; args[i]; i++)
n_args++;
if (PPC_N_REGPARMS < n_args + (passBBP ? 1 : 0)) {
vpanic("doHelperCall(PPC): cannot currently handle > 8 args");
}
argregs[0] = hregPPC_GPR3(mode64);
argregs[1] = hregPPC_GPR4(mode64);
argregs[2] = hregPPC_GPR5(mode64);
argregs[3] = hregPPC_GPR6(mode64);
argregs[4] = hregPPC_GPR7(mode64);
argregs[5] = hregPPC_GPR8(mode64);
argregs[6] = hregPPC_GPR9(mode64);
argregs[7] = hregPPC_GPR10(mode64);
argiregs = 0;
tmpregs[0] = tmpregs[1] = tmpregs[2] =
tmpregs[3] = tmpregs[4] = tmpregs[5] =
tmpregs[6] = tmpregs[7] = INVALID_HREG;
go_fast = True;
if (guard) {
if (guard->tag == Iex_Const
&& guard->Iex.Const.con->tag == Ico_U1
&& guard->Iex.Const.con->Ico.U1 == True) {
} else {
go_fast = False;
}
}
if (go_fast) {
for (i = 0; i < n_args; i++) {
if (<API key>(args[i])) {
go_fast = False;
break;
}
}
}
if (go_fast) {
argreg = 0;
if (passBBP) {
argiregs |= (1 << (argreg+3));
addInstr(env, mk_iMOVds_RR( argregs[argreg],
GuestStatePtr(mode64) ));
argreg++;
}
for (i = 0; i < n_args; i++) {
vassert(argreg < PPC_N_REGPARMS);
vassert(typeOfIRExpr(env->type_env, args[i]) == Ity_I32 ||
typeOfIRExpr(env->type_env, args[i]) == Ity_I64);
if (!mode64) {
if (typeOfIRExpr(env->type_env, args[i]) == Ity_I32) {
argiregs |= (1 << (argreg+3));
addInstr(env,
mk_iMOVds_RR( argregs[argreg],
iselWordExpr_R(env, args[i]) ));
} else {
HReg rHi, rLo;
if (regalign_int64s && (argreg%2) == 1)
argreg++;
vassert(argreg < PPC_N_REGPARMS-1);
iselInt64Expr(&rHi,&rLo, env, args[i]);
argiregs |= (1 << (argreg+3));
addInstr(env, mk_iMOVds_RR( argregs[argreg++], rHi ));
argiregs |= (1 << (argreg+3));
addInstr(env, mk_iMOVds_RR( argregs[argreg], rLo));
}
} else {
argiregs |= (1 << (argreg+3));
addInstr(env, mk_iMOVds_RR( argregs[argreg],
iselWordExpr_R(env, args[i]) ));
}
argreg++;
}
cc = mk_PPCCondCode( Pct_ALWAYS, Pcf_NONE );
} else {
argreg = 0;
if (passBBP) {
tmpregs[argreg] = newVRegI(env);
addInstr(env, mk_iMOVds_RR( tmpregs[argreg],
GuestStatePtr(mode64) ));
argreg++;
}
for (i = 0; i < n_args; i++) {
vassert(argreg < PPC_N_REGPARMS);
vassert(typeOfIRExpr(env->type_env, args[i]) == Ity_I32 ||
typeOfIRExpr(env->type_env, args[i]) == Ity_I64);
if (!mode64) {
if (typeOfIRExpr(env->type_env, args[i]) == Ity_I32) {
tmpregs[argreg] = iselWordExpr_R(env, args[i]);
} else {
HReg rHi, rLo;
if (regalign_int64s && (argreg%2) == 1)
argreg++;
vassert(argreg < PPC_N_REGPARMS-1);
iselInt64Expr(&rHi,&rLo, env, args[i]);
tmpregs[argreg++] = rHi;
tmpregs[argreg] = rLo;
}
} else {
tmpregs[argreg] = iselWordExpr_R(env, args[i]);
}
argreg++;
}
cc = mk_PPCCondCode( Pct_ALWAYS, Pcf_NONE );
if (guard) {
if (guard->tag == Iex_Const
&& guard->Iex.Const.con->tag == Ico_U1
&& guard->Iex.Const.con->Ico.U1 == True) {
} else {
cc = iselCondCode( env, guard );
}
}
for (i = 0; i < argreg; i++) {
if (tmpregs[i] == INVALID_HREG)
continue;
argiregs |= (1 << (i+3));
addInstr( env, mk_iMOVds_RR( argregs[i], tmpregs[i] ) );
}
}
target = mode64 ? Ptr_to_ULong(cee->addr) :
toUInt(Ptr_to_ULong(cee->addr));
addInstr(env, PPCInstr_Call( cc, (Addr64)target, argiregs ));
}
static HReg roundModeIRtoPPC ( ISelEnv* env, HReg r_rmIR )
{
HReg r_rmPPC = newVRegI(env);
HReg r_tmp1 = newVRegI(env);
HReg r_tmp2 = newVRegI(env);
vassert(hregClass(r_rmIR) == HRcGPR(env->mode64));
addInstr(env, PPCInstr_Shft(Pshft_SHL, True,
r_tmp1, r_rmIR, PPCRH_Imm(False,1)));
addInstr( env, PPCInstr_Alu( Palu_AND,
r_tmp2, r_tmp1, PPCRH_Imm( False, 3 ) ) );
addInstr( env, PPCInstr_Alu( Palu_XOR,
r_rmPPC, r_rmIR, PPCRH_Reg( r_tmp2 ) ) );
return r_rmPPC;
}
static
void <API key> ( ISelEnv* env, IRExpr* mode, Bool dfp_rm )
{
HReg fr_src = newVRegF(env);
HReg r_src;
vassert(typeOfIRExpr(env->type_env,mode) == Ity_I32);
if (env->previous_rm
&& env->previous_rm->tag == Iex_RdTmp
&& mode->tag == Iex_RdTmp
&& env->previous_rm->Iex.RdTmp.tmp == mode->Iex.RdTmp.tmp) {
vassert(typeOfIRExpr(env->type_env, env->previous_rm) == Ity_I32);
return;
}
env->previous_rm = mode;
r_src = roundModeIRtoPPC( env, iselWordExpr_R(env, mode) );
if (env->mode64) {
if (dfp_rm) {
HReg r_tmp1 = newVRegI( env );
addInstr( env,
PPCInstr_Shft( Pshft_SHL, False,
r_tmp1, r_src, PPCRH_Imm( False, 32 ) ) );
fr_src = mk_LoadR64toFPR( env, r_tmp1 );
} else {
fr_src = mk_LoadR64toFPR( env, r_src );
}
} else {
if (dfp_rm) {
HReg r_zero = newVRegI( env );
addInstr( env, PPCInstr_LI( r_zero, 0, env->mode64 ) );
fr_src = mk_LoadRR32toFPR( env, r_src, r_zero );
} else {
fr_src = mk_LoadRR32toFPR( env, r_src, r_src );
}
}
addInstr(env, PPCInstr_FpLdFPSCR( fr_src, dfp_rm ));
}
static void <API key> ( ISelEnv* env, IRExpr* mode )
{
<API key>(env, mode, False);
}
static void <API key> ( ISelEnv* env, IRExpr* mode )
{
<API key>(env, mode, True);
}
static HReg <API key> ( ISelEnv* env )
{
HReg dst = newVRegV(env);
addInstr(env, PPCInstr_AvBinary(Pav_XOR, dst, dst, dst));
return dst;
}
static HReg generate_ones_V128 ( ISelEnv* env )
{
HReg dst = newVRegV(env);
PPCVI5s * src = PPCVI5s_Imm(-1);
addInstr(env, PPCInstr_AvSplat(8, dst, src));
return dst;
}
static HReg mk_AvDuplicateRI( ISelEnv* env, IRExpr* e )
{
HReg r_src;
HReg dst = newVRegV(env);
PPCRI* ri = iselWordExpr_RI(env, e);
IRType ty = typeOfIRExpr(env->type_env,e);
UInt sz = (ty == Ity_I8) ? 8 : (ty == Ity_I16) ? 16 : 32;
vassert(ty == Ity_I8 || ty == Ity_I16 || ty == Ity_I32);
if (ri->tag == Pri_Imm) {
Int simm32 = (Int)ri->Pri.Imm;
if (simm32 >= -32 && simm32 <= 31) {
Char simm6 = (Char)simm32;
if (simm6 > 15) {
HReg v1 = newVRegV(env);
HReg v2 = newVRegV(env);
addInstr(env, PPCInstr_AvSplat(sz, v1, PPCVI5s_Imm(-16)));
addInstr(env, PPCInstr_AvSplat(sz, v2, PPCVI5s_Imm(simm6-16)));
addInstr(env,
(sz== 8) ? PPCInstr_AvBin8x16(Pav_SUBU, dst, v2, v1) :
(sz==16) ? PPCInstr_AvBin16x8(Pav_SUBU, dst, v2, v1)
: PPCInstr_AvBin32x4(Pav_SUBU, dst, v2, v1) );
return dst;
}
if (simm6 < -16) {
HReg v1 = newVRegV(env);
HReg v2 = newVRegV(env);
addInstr(env, PPCInstr_AvSplat(sz, v1, PPCVI5s_Imm(-16)));
addInstr(env, PPCInstr_AvSplat(sz, v2, PPCVI5s_Imm(simm6+16)));
addInstr(env,
(sz== 8) ? PPCInstr_AvBin8x16(Pav_ADDU, dst, v2, v1) :
(sz==16) ? PPCInstr_AvBin16x8(Pav_ADDU, dst, v2, v1)
: PPCInstr_AvBin32x4(Pav_ADDU, dst, v2, v1) );
return dst;
}
addInstr(env, PPCInstr_AvSplat(sz, dst, PPCVI5s_Imm(simm6)));
return dst;
}
r_src = newVRegI(env);
addInstr(env, PPCInstr_LI(r_src, (Long)simm32, env->mode64));
}
else {
r_src = ri->Pri.Reg;
}
{
HReg r_aligned16;
HReg v_src = newVRegV(env);
PPCAMode *am_off12;
sub_from_sp( env, 32 );
r_aligned16 = get_sp_aligned16( env );
am_off12 = PPCAMode_IR( 12, r_aligned16 );
addInstr(env, PPCInstr_Store( 4, am_off12, r_src, env->mode64 ));
addInstr(env, PPCInstr_AvLdSt( True, 4, v_src, am_off12 ) );
add_to_sp( env, 32 );
addInstr(env, PPCInstr_AvSplat(sz, dst, PPCVI5s_Reg(v_src)));
return dst;
}
}
static HReg isNan ( ISelEnv* env, HReg vSrc )
{
HReg zeros, msk_exp, msk_mnt, expt, mnts, vIsNan;
vassert(hregClass(vSrc) == HRcVec128);
zeros = mk_AvDuplicateRI(env, mkU32(0));
msk_exp = mk_AvDuplicateRI(env, mkU32(0x7F800000));
msk_mnt = mk_AvDuplicateRI(env, mkU32(0x7FFFFF));
expt = newVRegV(env);
mnts = newVRegV(env);
vIsNan = newVRegV(env);
addInstr(env, PPCInstr_AvBinary(Pav_AND, expt, vSrc, msk_exp));
addInstr(env, PPCInstr_AvBin32x4(Pav_CMPEQU, expt, expt, msk_exp));
addInstr(env, PPCInstr_AvBinary(Pav_AND, mnts, vSrc, msk_mnt));
addInstr(env, PPCInstr_AvBin32x4(Pav_CMPGTU, mnts, mnts, zeros));
addInstr(env, PPCInstr_AvBinary(Pav_AND, vIsNan, expt, mnts));
return vIsNan;
}
static HReg iselWordExpr_R ( ISelEnv* env, IRExpr* e )
{
HReg r = iselWordExpr_R_wrk(env, e);
# if 0
vex_printf("\n"); ppIRExpr(e); vex_printf("\n");
# endif
vassert(hregClass(r) == HRcGPR(env->mode64));
vassert(hregIsVirtual(r));
return r;
}
static HReg iselWordExpr_R_wrk ( ISelEnv* env, IRExpr* e )
{
Bool mode64 = env->mode64;
MatchInfo mi;
DECLARE_PATTERN(p_32to1_then_1Uto8);
IRType ty = typeOfIRExpr(env->type_env,e);
vassert(ty == Ity_I8 || ty == Ity_I16 ||
ty == Ity_I32 || ((ty == Ity_I64) && mode64));
switch (e->tag) {
case Iex_RdTmp:
return lookupIRTemp(env, e->Iex.RdTmp.tmp);
case Iex_Load: {
HReg r_dst;
PPCAMode* am_addr;
if (e->Iex.Load.end != Iend_BE)
goto irreducible;
r_dst = newVRegI(env);
am_addr = iselWordExpr_AMode( env, e->Iex.Load.addr, ty );
addInstr(env, PPCInstr_Load( toUChar(sizeofIRType(ty)),
r_dst, am_addr, mode64 ));
return r_dst;
}
case Iex_Binop: {
PPCAluOp aluOp;
PPCShftOp shftOp;
switch (e->Iex.Binop.op) {
case Iop_Add8: case Iop_Add16: case Iop_Add32: case Iop_Add64:
aluOp = Palu_ADD; break;
case Iop_Sub8: case Iop_Sub16: case Iop_Sub32: case Iop_Sub64:
aluOp = Palu_SUB; break;
case Iop_And8: case Iop_And16: case Iop_And32: case Iop_And64:
aluOp = Palu_AND; break;
case Iop_Or8: case Iop_Or16: case Iop_Or32: case Iop_Or64:
aluOp = Palu_OR; break;
case Iop_Xor8: case Iop_Xor16: case Iop_Xor32: case Iop_Xor64:
aluOp = Palu_XOR; break;
default:
aluOp = Palu_INVALID; break;
}
if (aluOp != Palu_INVALID) {
HReg r_dst = newVRegI(env);
HReg r_srcL = iselWordExpr_R(env, e->Iex.Binop.arg1);
PPCRH* ri_srcR = NULL;
switch (aluOp) {
case Palu_ADD: case Palu_SUB:
ri_srcR = iselWordExpr_RH(env, True,
e->Iex.Binop.arg2);
break;
case Palu_AND: case Palu_OR: case Palu_XOR:
ri_srcR = iselWordExpr_RH(env, False,
e->Iex.Binop.arg2);
break;
default:
vpanic("<API key>");
}
addInstr(env, PPCInstr_Alu(aluOp, r_dst, r_srcL, ri_srcR));
return r_dst;
}
switch (e->Iex.Binop.op) {
case Iop_Shl8: case Iop_Shl16: case Iop_Shl32: case Iop_Shl64:
shftOp = Pshft_SHL; break;
case Iop_Shr8: case Iop_Shr16: case Iop_Shr32: case Iop_Shr64:
shftOp = Pshft_SHR; break;
case Iop_Sar8: case Iop_Sar16: case Iop_Sar32: case Iop_Sar64:
shftOp = Pshft_SAR; break;
default:
shftOp = Pshft_INVALID; break;
}
if (shftOp != Pshft_INVALID) {
HReg r_dst = newVRegI(env);
HReg r_srcL = iselWordExpr_R(env, e->Iex.Binop.arg1);
PPCRH* ri_srcR = NULL;
switch (shftOp) {
case Pshft_SHL: case Pshft_SHR: case Pshft_SAR:
if (!mode64)
ri_srcR = iselWordExpr_RH5u(env, e->Iex.Binop.arg2);
else
ri_srcR = iselWordExpr_RH6u(env, e->Iex.Binop.arg2);
break;
default:
vpanic("<API key>");
}
if (shftOp == Pshft_SHR || shftOp == Pshft_SAR) {
if (ty == Ity_I8 || ty == Ity_I16) {
PPCRH* amt = PPCRH_Imm(False,
toUShort(ty == Ity_I8 ? 24 : 16));
HReg tmp = newVRegI(env);
addInstr(env, PPCInstr_Shft(Pshft_SHL,
True,
tmp, r_srcL, amt));
addInstr(env, PPCInstr_Shft(shftOp,
True,
tmp, tmp, amt));
r_srcL = tmp;
vassert(0);
}
}
if (ty == Ity_I64) {
vassert(mode64);
addInstr(env, PPCInstr_Shft(shftOp, False,
r_dst, r_srcL, ri_srcR));
} else {
addInstr(env, PPCInstr_Shft(shftOp, True,
r_dst, r_srcL, ri_srcR));
}
return r_dst;
}
if (e->Iex.Binop.op == Iop_DivS32 ||
e->Iex.Binop.op == Iop_DivU32 ||
e->Iex.Binop.op == Iop_DivS32E ||
e->Iex.Binop.op == Iop_DivU32E) {
Bool syned = toBool((e->Iex.Binop.op == Iop_DivS32) || (e->Iex.Binop.op == Iop_DivS32E));
HReg r_dst = newVRegI(env);
HReg r_srcL = iselWordExpr_R(env, e->Iex.Binop.arg1);
HReg r_srcR = iselWordExpr_R(env, e->Iex.Binop.arg2);
addInstr( env,
PPCInstr_Div( ( ( e->Iex.Binop.op == Iop_DivU32E )
|| ( e->Iex.Binop.op == Iop_DivS32E ) ) ? True
: False,
syned,
True,
r_dst,
r_srcL,
r_srcR ) );
return r_dst;
}
if (e->Iex.Binop.op == Iop_DivS64 ||
e->Iex.Binop.op == Iop_DivU64 || e->Iex.Binop.op == Iop_DivS64E
|| e->Iex.Binop.op == Iop_DivU64E ) {
Bool syned = toBool((e->Iex.Binop.op == Iop_DivS64) ||(e->Iex.Binop.op == Iop_DivS64E));
HReg r_dst = newVRegI(env);
HReg r_srcL = iselWordExpr_R(env, e->Iex.Binop.arg1);
HReg r_srcR = iselWordExpr_R(env, e->Iex.Binop.arg2);
vassert(mode64);
addInstr( env,
PPCInstr_Div( ( ( e->Iex.Binop.op == Iop_DivS64E )
|| ( e->Iex.Binop.op
== Iop_DivU64E ) ) ? True
: False,
syned,
False,
r_dst,
r_srcL,
r_srcR ) );
return r_dst;
}
if (e->Iex.Binop.op == Iop_Mul32
|| e->Iex.Binop.op == Iop_Mul64) {
Bool syned = False;
Bool sz32 = (e->Iex.Binop.op != Iop_Mul64);
HReg r_dst = newVRegI(env);
HReg r_srcL = iselWordExpr_R(env, e->Iex.Binop.arg1);
HReg r_srcR = iselWordExpr_R(env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_MulL(syned, False, sz32,
r_dst, r_srcL, r_srcR));
return r_dst;
}
if (mode64
&& (e->Iex.Binop.op == Iop_MullU32
|| e->Iex.Binop.op == Iop_MullS32)) {
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
HReg r_dst = newVRegI(env);
Bool syned = toBool(e->Iex.Binop.op == Iop_MullS32);
HReg r_srcL = iselWordExpr_R(env, e->Iex.Binop.arg1);
HReg r_srcR = iselWordExpr_R(env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_MulL(False,
False, True,
tLo, r_srcL, r_srcR));
addInstr(env, PPCInstr_MulL(syned,
True, True,
tHi, r_srcL, r_srcR));
addInstr(env, PPCInstr_Shft(Pshft_SHL, False,
r_dst, tHi, PPCRH_Imm(False,32)));
addInstr(env, PPCInstr_Alu(Palu_OR,
r_dst, r_dst, PPCRH_Reg(tLo)));
return r_dst;
}
if (e->Iex.Binop.op == Iop_CmpORD32S
|| e->Iex.Binop.op == Iop_CmpORD32U) {
Bool syned = toBool(e->Iex.Binop.op == Iop_CmpORD32S);
HReg dst = newVRegI(env);
HReg srcL = iselWordExpr_R(env, e->Iex.Binop.arg1);
PPCRH* srcR = iselWordExpr_RH(env, syned, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_Cmp(syned, True,
7, srcL, srcR));
addInstr(env, PPCInstr_MfCR(dst));
addInstr(env, PPCInstr_Alu(Palu_AND, dst, dst,
PPCRH_Imm(False,7<<1)));
return dst;
}
if (e->Iex.Binop.op == Iop_CmpORD64S
|| e->Iex.Binop.op == Iop_CmpORD64U) {
Bool syned = toBool(e->Iex.Binop.op == Iop_CmpORD64S);
HReg dst = newVRegI(env);
HReg srcL = iselWordExpr_R(env, e->Iex.Binop.arg1);
PPCRH* srcR = iselWordExpr_RH(env, syned, e->Iex.Binop.arg2);
vassert(mode64);
addInstr(env, PPCInstr_Cmp(syned, False,
7, srcL, srcR));
addInstr(env, PPCInstr_MfCR(dst));
addInstr(env, PPCInstr_Alu(Palu_AND, dst, dst,
PPCRH_Imm(False,7<<1)));
return dst;
}
if (e->Iex.Binop.op == Iop_Max32U) {
HReg r1 = iselWordExpr_R(env, e->Iex.Binop.arg1);
HReg r2 = iselWordExpr_R(env, e->Iex.Binop.arg2);
HReg rdst = newVRegI(env);
PPCCondCode cc = mk_PPCCondCode( Pct_TRUE, Pcf_7LT );
addInstr(env, mk_iMOVds_RR(rdst, r1));
addInstr(env, PPCInstr_Cmp(False, True,
7, rdst, PPCRH_Reg(r2)));
addInstr(env, PPCInstr_CMov(cc, rdst, PPCRI_Reg(r2)));
return rdst;
}
if (e->Iex.Binop.op == Iop_32HLto64) {
HReg r_Hi = iselWordExpr_R(env, e->Iex.Binop.arg1);
HReg r_Lo = iselWordExpr_R(env, e->Iex.Binop.arg2);
HReg r_dst = newVRegI(env);
HReg msk = newVRegI(env);
vassert(mode64);
addInstr(env, PPCInstr_Shft(Pshft_SHL, False,
r_dst, r_Hi, PPCRH_Imm(False,32)));
addInstr(env, PPCInstr_LI(msk, 0xFFFFFFFF, mode64));
addInstr(env, PPCInstr_Alu( Palu_AND, r_Lo, r_Lo,
PPCRH_Reg(msk) ));
addInstr(env, PPCInstr_Alu( Palu_OR, r_dst, r_dst,
PPCRH_Reg(r_Lo) ));
return r_dst;
}
if ((e->Iex.Binop.op == Iop_CmpF64) ||
(e->Iex.Binop.op == Iop_CmpD64) ||
(e->Iex.Binop.op == Iop_CmpD128)) {
HReg fr_srcL;
HReg fr_srcL_lo;
HReg fr_srcR;
HReg fr_srcR_lo;
HReg r_ccPPC = newVRegI(env);
HReg r_ccIR = newVRegI(env);
HReg r_ccIR_b0 = newVRegI(env);
HReg r_ccIR_b2 = newVRegI(env);
HReg r_ccIR_b6 = newVRegI(env);
if (e->Iex.Binop.op == Iop_CmpF64) {
fr_srcL = iselDblExpr(env, e->Iex.Binop.arg1);
fr_srcR = iselDblExpr(env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_FpCmp(r_ccPPC, fr_srcL, fr_srcR));
} else if (e->Iex.Binop.op == Iop_CmpD64) {
fr_srcL = iselDfp64Expr(env, e->Iex.Binop.arg1);
fr_srcR = iselDfp64Expr(env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_Dfp64Cmp(r_ccPPC, fr_srcL, fr_srcR));
} else {
iselDfp128Expr(&fr_srcL, &fr_srcL_lo, env, e->Iex.Binop.arg1);
iselDfp128Expr(&fr_srcR, &fr_srcR_lo, env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_Dfp128Cmp(r_ccPPC, fr_srcL, fr_srcL_lo,
fr_srcR, fr_srcR_lo));
}
addInstr(env, PPCInstr_Shft(Pshft_SHR, True,
r_ccIR_b0, r_ccPPC,
PPCRH_Imm(False,0x3)));
addInstr(env, PPCInstr_Alu(Palu_OR, r_ccIR_b0,
r_ccPPC, PPCRH_Reg(r_ccIR_b0)));
addInstr(env, PPCInstr_Alu(Palu_AND, r_ccIR_b0,
r_ccIR_b0, PPCRH_Imm(False,0x1)));
addInstr(env, PPCInstr_Shft(Pshft_SHL, True,
r_ccIR_b2, r_ccPPC,
PPCRH_Imm(False,0x2)));
addInstr(env, PPCInstr_Alu(Palu_AND, r_ccIR_b2,
r_ccIR_b2, PPCRH_Imm(False,0x4)));
addInstr(env, PPCInstr_Shft(Pshft_SHR, True,
r_ccIR_b6, r_ccPPC,
PPCRH_Imm(False,0x1)));
addInstr(env, PPCInstr_Alu(Palu_OR, r_ccIR_b6,
r_ccPPC, PPCRH_Reg(r_ccIR_b6)));
addInstr(env, PPCInstr_Shft(Pshft_SHL, True,
r_ccIR_b6, r_ccIR_b6,
PPCRH_Imm(False,0x6)));
addInstr(env, PPCInstr_Alu(Palu_AND, r_ccIR_b6,
r_ccIR_b6, PPCRH_Imm(False,0x40)));
addInstr(env, PPCInstr_Alu(Palu_OR, r_ccIR,
r_ccIR_b0, PPCRH_Reg(r_ccIR_b2)));
addInstr(env, PPCInstr_Alu(Palu_OR, r_ccIR,
r_ccIR, PPCRH_Reg(r_ccIR_b6)));
return r_ccIR;
}
if ( e->Iex.Binop.op == Iop_F64toI32S ||
e->Iex.Binop.op == Iop_F64toI32U ) {
HReg r1 = StackFramePtr(env->mode64);
PPCAMode* zero_r1 = PPCAMode_IR( 0, r1 );
HReg fsrc = iselDblExpr(env, e->Iex.Binop.arg2);
HReg ftmp = newVRegF(env);
HReg idst = newVRegI(env);
<API key>( env, e->Iex.Binop.arg1 );
sub_from_sp( env, 16 );
addInstr(env, PPCInstr_FpCftI(False, True,
e->Iex.Binop.op == Iop_F64toI32S ? True
: False,
True,
ftmp, fsrc));
addInstr(env, PPCInstr_FpSTFIW(r1, ftmp));
addInstr(env, PPCInstr_Load(4, idst, zero_r1, mode64));
if (mode64)
addInstr(env, PPCInstr_Unary(Pun_EXTSW, idst, idst));
add_to_sp( env, 16 );
return idst;
}
if (e->Iex.Binop.op == Iop_F64toI64S || e->Iex.Binop.op == Iop_F64toI64U ) {
if (mode64) {
HReg r1 = StackFramePtr(env->mode64);
PPCAMode* zero_r1 = PPCAMode_IR( 0, r1 );
HReg fsrc = iselDblExpr(env, e->Iex.Binop.arg2);
HReg idst = newVRegI(env);
HReg ftmp = newVRegF(env);
<API key>( env, e->Iex.Binop.arg1 );
sub_from_sp( env, 16 );
addInstr(env, PPCInstr_FpCftI(False, False,
( e->Iex.Binop.op == Iop_F64toI64S ) ? True
: False,
True, ftmp, fsrc));
addInstr(env, PPCInstr_FpLdSt(False, 8, ftmp, zero_r1));
addInstr(env, PPCInstr_Load(8, idst, zero_r1, True));
add_to_sp( env, 16 );
return idst;
}
}
break;
}
case Iex_Unop: {
IROp op_unop = e->Iex.Unop.op;
DEFINE_PATTERN(p_32to1_then_1Uto8,
unop(Iop_1Uto8,unop(Iop_32to1,bind(0))));
if (matchIRExpr(&mi,p_32to1_then_1Uto8,e)) {
IRExpr* expr32 = mi.bindee[0];
HReg r_dst = newVRegI(env);
HReg r_src = iselWordExpr_R(env, expr32);
addInstr(env, PPCInstr_Alu(Palu_AND, r_dst,
r_src, PPCRH_Imm(False,1)));
return r_dst;
}
{
DECLARE_PATTERN(<API key>);
DEFINE_PATTERN(<API key>,
unop(Iop_16Uto32,
IRExpr_Load(Iend_BE,Ity_I16,bind(0))) );
if (matchIRExpr(&mi,<API key>,e)) {
HReg r_dst = newVRegI(env);
PPCAMode* amode
= iselWordExpr_AMode( env, mi.bindee[0], Ity_I16 );
addInstr(env, PPCInstr_Load(2,r_dst,amode, mode64));
return r_dst;
}
}
switch (op_unop) {
case Iop_8Uto16:
case Iop_8Uto32:
case Iop_8Uto64:
case Iop_16Uto32:
case Iop_16Uto64: {
HReg r_dst = newVRegI(env);
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
UShort mask = toUShort(op_unop==Iop_16Uto64 ? 0xFFFF :
op_unop==Iop_16Uto32 ? 0xFFFF : 0xFF);
addInstr(env, PPCInstr_Alu(Palu_AND,r_dst,r_src,
PPCRH_Imm(False,mask)));
return r_dst;
}
case Iop_32Uto64: {
HReg r_dst = newVRegI(env);
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
vassert(mode64);
addInstr(env,
PPCInstr_Shft(Pshft_SHL, False,
r_dst, r_src, PPCRH_Imm(False,32)));
addInstr(env,
PPCInstr_Shft(Pshft_SHR, False,
r_dst, r_dst, PPCRH_Imm(False,32)));
return r_dst;
}
case Iop_8Sto16:
case Iop_8Sto32:
case Iop_16Sto32: {
HReg r_dst = newVRegI(env);
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
UShort amt = toUShort(op_unop==Iop_16Sto32 ? 16 : 24);
addInstr(env,
PPCInstr_Shft(Pshft_SHL, True,
r_dst, r_src, PPCRH_Imm(False,amt)));
addInstr(env,
PPCInstr_Shft(Pshft_SAR, True,
r_dst, r_dst, PPCRH_Imm(False,amt)));
return r_dst;
}
case Iop_8Sto64:
case Iop_16Sto64: {
HReg r_dst = newVRegI(env);
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
UShort amt = toUShort(op_unop==Iop_8Sto64 ? 56 : 48);
vassert(mode64);
addInstr(env,
PPCInstr_Shft(Pshft_SHL, False,
r_dst, r_src, PPCRH_Imm(False,amt)));
addInstr(env,
PPCInstr_Shft(Pshft_SAR, False,
r_dst, r_dst, PPCRH_Imm(False,amt)));
return r_dst;
}
case Iop_32Sto64: {
HReg r_dst = newVRegI(env);
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
vassert(mode64);
addInstr(env,
PPCInstr_Shft(Pshft_SAR, True,
r_dst, r_src, PPCRH_Imm(False,0)));
return r_dst;
}
case Iop_Not8:
case Iop_Not16:
case Iop_Not32:
case Iop_Not64: {
if (op_unop == Iop_Not64) vassert(mode64);
HReg r_dst = newVRegI(env);
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Unary(Pun_NOT,r_dst,r_src));
return r_dst;
}
case Iop_64HIto32: {
if (!mode64) {
HReg rHi, rLo;
iselInt64Expr(&rHi,&rLo, env, e->Iex.Unop.arg);
return rHi;
} else {
HReg r_dst = newVRegI(env);
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
addInstr(env,
PPCInstr_Shft(Pshft_SHR, False,
r_dst, r_src, PPCRH_Imm(False,32)));
return r_dst;
}
}
case Iop_64to32: {
if (!mode64) {
HReg rHi, rLo;
iselInt64Expr(&rHi,&rLo, env, e->Iex.Unop.arg);
return rLo;
} else {
return iselWordExpr_R(env, e->Iex.Unop.arg);
}
}
case Iop_64to16: {
if (mode64) {
return iselWordExpr_R(env, e->Iex.Unop.arg);
}
break;
}
case Iop_16HIto8:
case Iop_32HIto16: {
HReg r_dst = newVRegI(env);
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
UShort shift = toUShort(op_unop == Iop_16HIto8 ? 8 : 16);
addInstr(env,
PPCInstr_Shft(Pshft_SHR, True,
r_dst, r_src, PPCRH_Imm(False,shift)));
return r_dst;
}
case Iop_128HIto64:
if (mode64) {
HReg rHi, rLo;
iselInt128Expr(&rHi,&rLo, env, e->Iex.Unop.arg);
return rHi;
}
break;
case Iop_128to64:
if (mode64) {
HReg rHi, rLo;
iselInt128Expr(&rHi,&rLo, env, e->Iex.Unop.arg);
return rLo;
}
break;
case Iop_1Uto64:
case Iop_1Uto32:
case Iop_1Uto8:
if ((op_unop != Iop_1Uto64) || mode64) {
HReg r_dst = newVRegI(env);
PPCCondCode cond = iselCondCode(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Set(cond,r_dst));
return r_dst;
}
break;
case Iop_1Sto8:
case Iop_1Sto16:
case Iop_1Sto32: {
HReg r_dst = newVRegI(env);
PPCCondCode cond = iselCondCode(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Set(cond,r_dst));
addInstr(env,
PPCInstr_Shft(Pshft_SHL, True,
r_dst, r_dst, PPCRH_Imm(False,31)));
addInstr(env,
PPCInstr_Shft(Pshft_SAR, True,
r_dst, r_dst, PPCRH_Imm(False,31)));
return r_dst;
}
case Iop_1Sto64:
if (mode64) {
HReg r_dst = newVRegI(env);
PPCCondCode cond = iselCondCode(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Set(cond,r_dst));
addInstr(env, PPCInstr_Shft(Pshft_SHL, False,
r_dst, r_dst, PPCRH_Imm(False,63)));
addInstr(env, PPCInstr_Shft(Pshft_SAR, False,
r_dst, r_dst, PPCRH_Imm(False,63)));
return r_dst;
}
break;
case Iop_Clz32:
case Iop_Clz64: {
HReg r_src, r_dst;
PPCUnaryOp op_clz = (op_unop == Iop_Clz32) ? Pun_CLZ32 :
Pun_CLZ64;
if (op_unop == Iop_Clz64 && !mode64)
goto irreducible;
r_dst = newVRegI(env);
r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Unary(op_clz,r_dst,r_src));
return r_dst;
}
case Iop_Left8:
case Iop_Left32:
case Iop_Left64: {
HReg r_src, r_dst;
if (op_unop == Iop_Left64 && !mode64)
goto irreducible;
r_dst = newVRegI(env);
r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Unary(Pun_NEG,r_dst,r_src));
addInstr(env, PPCInstr_Alu(Palu_OR, r_dst, r_dst, PPCRH_Reg(r_src)));
return r_dst;
}
case Iop_CmpwNEZ32: {
HReg r_dst = newVRegI(env);
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Unary(Pun_NEG,r_dst,r_src));
addInstr(env, PPCInstr_Alu(Palu_OR, r_dst, r_dst, PPCRH_Reg(r_src)));
addInstr(env, PPCInstr_Shft(Pshft_SAR, True,
r_dst, r_dst, PPCRH_Imm(False, 31)));
return r_dst;
}
case Iop_CmpwNEZ64: {
HReg r_dst = newVRegI(env);
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
if (!mode64) goto irreducible;
addInstr(env, PPCInstr_Unary(Pun_NEG,r_dst,r_src));
addInstr(env, PPCInstr_Alu(Palu_OR, r_dst, r_dst, PPCRH_Reg(r_src)));
addInstr(env, PPCInstr_Shft(Pshft_SAR, False,
r_dst, r_dst, PPCRH_Imm(False, 63)));
return r_dst;
}
case Iop_V128to32: {
HReg r_aligned16;
HReg dst = newVRegI(env);
HReg vec = iselVecExpr(env, e->Iex.Unop.arg);
PPCAMode *am_off0, *am_off12;
sub_from_sp( env, 32 );
r_aligned16 = get_sp_aligned16( env );
am_off0 = PPCAMode_IR( 0, r_aligned16 );
am_off12 = PPCAMode_IR( 12,r_aligned16 );
addInstr(env,
PPCInstr_AvLdSt( False, 16, vec, am_off0 ));
addInstr(env,
PPCInstr_Load( 4, dst, am_off12, mode64 ));
add_to_sp( env, 32 );
return dst;
}
case Iop_V128to64:
case Iop_V128HIto64:
if (mode64) {
HReg r_aligned16;
HReg dst = newVRegI(env);
HReg vec = iselVecExpr(env, e->Iex.Unop.arg);
PPCAMode *am_off0, *am_off8;
sub_from_sp( env, 32 );
r_aligned16 = get_sp_aligned16( env );
am_off0 = PPCAMode_IR( 0, r_aligned16 );
am_off8 = PPCAMode_IR( 8 ,r_aligned16 );
addInstr(env,
PPCInstr_AvLdSt( False, 16, vec, am_off0 ));
addInstr(env,
PPCInstr_Load(
8, dst,
op_unop == Iop_V128HIto64 ? am_off0 : am_off8,
mode64 ));
add_to_sp( env, 32 );
return dst;
}
break;
case Iop_16to8:
case Iop_32to8:
case Iop_32to16:
case Iop_64to8:
return iselWordExpr_R(env, e->Iex.Unop.arg);
case <API key>:
if (mode64) {
PPCAMode *am_addr;
HReg fr_src = iselDblExpr(env, e->Iex.Unop.arg);
HReg r_dst = newVRegI(env);
sub_from_sp( env, 16 );
am_addr = PPCAMode_IR( 0, StackFramePtr(mode64) );
addInstr(env, PPCInstr_FpLdSt( False, 8,
fr_src, am_addr ));
addInstr(env, PPCInstr_Load( 8, r_dst, am_addr, mode64 ));
add_to_sp( env, 16 );
return r_dst;
}
break;
case <API key>: {
PPCAMode *am_addr;
HReg fr_src = iselFltExpr(env, e->Iex.Unop.arg);
HReg r_dst = newVRegI(env);
sub_from_sp( env, 16 );
am_addr = PPCAMode_IR( 0, StackFramePtr(mode64) );
addInstr(env, PPCInstr_FpLdSt( False, 4,
fr_src, am_addr ));
addInstr(env, PPCInstr_Load( 4, r_dst, am_addr, mode64 ));
add_to_sp( env, 16 );
return r_dst;
}
break;
case <API key>:
if (mode64) {
PPCAMode *am_addr;
HReg fr_src = iselDfp64Expr(env, e->Iex.Unop.arg);
HReg r_dst = newVRegI(env);
sub_from_sp( env, 16 );
am_addr = PPCAMode_IR( 0, StackFramePtr(mode64) );
addInstr(env, PPCInstr_FpLdSt( False, 8,
fr_src, am_addr ));
addInstr(env, PPCInstr_Load( 8, r_dst, am_addr, mode64 ));
add_to_sp( env, 16 );
return r_dst;
}
break;
case Iop_BCDtoDPB: {
PPCCondCode cc;
UInt argiregs;
HReg argregs[1];
HReg r_dst = newVRegI(env);
Int argreg;
HWord* fdescr;
argiregs = 0;
argreg = 0;
argregs[0] = hregPPC_GPR3(mode64);
argiregs |= (1 << (argreg+3));
addInstr(env, mk_iMOVds_RR( argregs[argreg++],
iselWordExpr_R(env, e->Iex.Unop.arg) ) );
cc = mk_PPCCondCode( Pct_ALWAYS, Pcf_NONE );
fdescr = (HWord*)h_BCDtoDPB;
addInstr(env, PPCInstr_Call( cc, (Addr64)(fdescr[0]), argiregs ) );
addInstr(env, mk_iMOVds_RR(r_dst, argregs[0]));
return r_dst;
}
case Iop_DPBtoBCD: {
PPCCondCode cc;
UInt argiregs;
HReg argregs[1];
HReg r_dst = newVRegI(env);
Int argreg;
HWord* fdescr;
argiregs = 0;
argreg = 0;
argregs[0] = hregPPC_GPR3(mode64);
argiregs |= (1 << (argreg+3));
addInstr(env, mk_iMOVds_RR( argregs[argreg++],
iselWordExpr_R(env, e->Iex.Unop.arg) ) );
cc = mk_PPCCondCode( Pct_ALWAYS, Pcf_NONE );
fdescr = (HWord*)h_DPBtoBCD;
addInstr(env, PPCInstr_Call( cc, (Addr64)(fdescr[0]), argiregs ) );
addInstr(env, mk_iMOVds_RR(r_dst, argregs[0]));
return r_dst;
}
default:
break;
}
break;
}
case Iex_Get: {
if (ty == Ity_I8 || ty == Ity_I16 ||
ty == Ity_I32 || ((ty == Ity_I64) && mode64)) {
HReg r_dst = newVRegI(env);
PPCAMode* am_addr = PPCAMode_IR( e->Iex.Get.offset,
GuestStatePtr(mode64) );
addInstr(env, PPCInstr_Load( toUChar(sizeofIRType(ty)),
r_dst, am_addr, mode64 ));
return r_dst;
}
break;
}
case Iex_GetI: {
PPCAMode* src_am
= genGuestArrayOffset( env, e->Iex.GetI.descr,
e->Iex.GetI.ix, e->Iex.GetI.bias );
HReg r_dst = newVRegI(env);
if (mode64 && ty == Ity_I64) {
addInstr(env, PPCInstr_Load( toUChar(8),
r_dst, src_am, mode64 ));
return r_dst;
}
if ((!mode64) && ty == Ity_I32) {
addInstr(env, PPCInstr_Load( toUChar(4),
r_dst, src_am, mode64 ));
return r_dst;
}
break;
}
case Iex_CCall: {
HReg r_dst = newVRegI(env);
vassert(ty == Ity_I32);
if (e->Iex.CCall.retty != Ity_I32)
goto irreducible;
doHelperCall( env, False, NULL,
e->Iex.CCall.cee, e->Iex.CCall.args );
addInstr(env, mk_iMOVds_RR(r_dst, hregPPC_GPR3(mode64)));
return r_dst;
}
case Iex_Const: {
Long l;
HReg r_dst = newVRegI(env);
IRConst* con = e->Iex.Const.con;
switch (con->tag) {
case Ico_U64: if (!mode64) goto irreducible;
l = (Long) con->Ico.U64; break;
case Ico_U32: l = (Long)(Int) con->Ico.U32; break;
case Ico_U16: l = (Long)(Int)(Short)con->Ico.U16; break;
case Ico_U8: l = (Long)(Int)(Char )con->Ico.U8; break;
default: vpanic("iselIntExpr_R.const(ppc)");
}
addInstr(env, PPCInstr_LI(r_dst, (ULong)l, mode64));
return r_dst;
}
case Iex_Mux0X: {
if ((ty == Ity_I8 || ty == Ity_I16 ||
ty == Ity_I32 || ((ty == Ity_I64) && mode64)) &&
typeOfIRExpr(env->type_env,e->Iex.Mux0X.cond) == Ity_I8) {
PPCCondCode cc = mk_PPCCondCode( Pct_TRUE, Pcf_7EQ );
HReg r_cond = iselWordExpr_R(env, e->Iex.Mux0X.cond);
HReg rX = iselWordExpr_R(env, e->Iex.Mux0X.exprX);
PPCRI* r0 = iselWordExpr_RI(env, e->Iex.Mux0X.expr0);
HReg r_dst = newVRegI(env);
HReg r_tmp = newVRegI(env);
addInstr(env, mk_iMOVds_RR(r_dst,rX));
addInstr(env, PPCInstr_Alu(Palu_AND, r_tmp,
r_cond, PPCRH_Imm(False,0xFF)));
addInstr(env, PPCInstr_Cmp(False, True,
7, r_tmp, PPCRH_Imm(False,0)));
addInstr(env, PPCInstr_CMov(cc,r_dst,r0));
return r_dst;
}
break;
}
default:
break;
}
irreducible:
ppIRExpr(e);
vpanic("iselIntExpr_R(ppc): cannot reduce tree");
}
static Bool <API key> ( UInt u )
{
Int i = u & 0xFFFF;
i <<= 16;
i >>= 16;
return toBool(u == (UInt)i);
}
static Bool <API key> ( ULong u )
{
Long i = u & 0xFFFFULL;
i <<= 48;
i >>= 48;
return toBool(u == (ULong)i);
}
static Bool uLong_is_4_aligned ( ULong u )
{
return toBool((u & 3ULL) == 0);
}
static Bool sane_AMode ( ISelEnv* env, PPCAMode* am )
{
Bool mode64 = env->mode64;
switch (am->tag) {
case Pam_IR:
return toBool( hregClass(am->Pam.IR.base) == HRcGPR(mode64) &&
hregIsVirtual(am->Pam.IR.base) &&
<API key>(am->Pam.IR.index) );
case Pam_RR:
return toBool( hregClass(am->Pam.RR.base) == HRcGPR(mode64) &&
hregIsVirtual(am->Pam.RR.base) &&
hregClass(am->Pam.RR.index) == HRcGPR(mode64) &&
hregIsVirtual(am->Pam.IR.index) );
default:
vpanic("sane_AMode: unknown ppc amode tag");
}
}
static
PPCAMode* iselWordExpr_AMode ( ISelEnv* env, IRExpr* e, IRType xferTy )
{
PPCAMode* am = <API key>(env, e, xferTy);
vassert(sane_AMode(env, am));
return am;
}
static PPCAMode* <API key> ( ISelEnv* env, IRExpr* e, IRType xferTy )
{
IRType ty = typeOfIRExpr(env->type_env,e);
if (env->mode64) {
Bool aligned4imm = toBool(xferTy == Ity_I32 || xferTy == Ity_I64);
vassert(ty == Ity_I64);
if (e->tag == Iex_Binop
&& e->Iex.Binop.op == Iop_Add64
&& e->Iex.Binop.arg2->tag == Iex_Const
&& e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U64
&& (aligned4imm ? uLong_is_4_aligned(e->Iex.Binop.arg2
->Iex.Const.con->Ico.U64)
: True)
&& <API key>(e->Iex.Binop.arg2
->Iex.Const.con->Ico.U64)) {
return PPCAMode_IR( (Int)e->Iex.Binop.arg2->Iex.Const.con->Ico.U64,
iselWordExpr_R(env, e->Iex.Binop.arg1) );
}
if (e->tag == Iex_Binop
&& e->Iex.Binop.op == Iop_Add64) {
HReg r_base = iselWordExpr_R(env, e->Iex.Binop.arg1);
HReg r_idx = iselWordExpr_R(env, e->Iex.Binop.arg2);
return PPCAMode_RR( r_idx, r_base );
}
} else {
vassert(ty == Ity_I32);
if (e->tag == Iex_Binop
&& e->Iex.Binop.op == Iop_Add32
&& e->Iex.Binop.arg2->tag == Iex_Const
&& e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U32
&& <API key>(e->Iex.Binop.arg2
->Iex.Const.con->Ico.U32)) {
return PPCAMode_IR( (Int)e->Iex.Binop.arg2->Iex.Const.con->Ico.U32,
iselWordExpr_R(env, e->Iex.Binop.arg1) );
}
if (e->tag == Iex_Binop
&& e->Iex.Binop.op == Iop_Add32) {
HReg r_base = iselWordExpr_R(env, e->Iex.Binop.arg1);
HReg r_idx = iselWordExpr_R(env, e->Iex.Binop.arg2);
return PPCAMode_RR( r_idx, r_base );
}
}
return PPCAMode_IR( 0, iselWordExpr_R(env,e) );
}
static PPCRH* iselWordExpr_RH ( ISelEnv* env, Bool syned, IRExpr* e )
{
PPCRH* ri = iselWordExpr_RH_wrk(env, syned, e);
switch (ri->tag) {
case Prh_Imm:
vassert(ri->Prh.Imm.syned == syned);
if (syned)
vassert(ri->Prh.Imm.imm16 != 0x8000);
return ri;
case Prh_Reg:
vassert(hregClass(ri->Prh.Reg.reg) == HRcGPR(env->mode64));
vassert(hregIsVirtual(ri->Prh.Reg.reg));
return ri;
default:
vpanic("iselIntExpr_RH: unknown ppc RH tag");
}
}
static PPCRH* iselWordExpr_RH_wrk ( ISelEnv* env, Bool syned, IRExpr* e )
{
ULong u;
Long l;
IRType ty = typeOfIRExpr(env->type_env,e);
vassert(ty == Ity_I8 || ty == Ity_I16 ||
ty == Ity_I32 || ((ty == Ity_I64) && env->mode64));
if (e->tag == Iex_Const) {
IRConst* con = e->Iex.Const.con;
switch (con->tag) {
case Ico_U64: vassert(env->mode64);
u = con->Ico.U64; break;
case Ico_U32: u = 0xFFFFFFFF & con->Ico.U32; break;
case Ico_U16: u = 0x0000FFFF & con->Ico.U16; break;
case Ico_U8: u = 0x000000FF & con->Ico.U8; break;
default: vpanic("iselIntExpr_RH.Iex_Const(ppch)");
}
l = (Long)u;
if (!syned && u <= 65535) {
return PPCRH_Imm(False, toUShort(u & 0xFFFF));
}
if (syned && l >= -32767 && l <= 32767) {
return PPCRH_Imm(True, toUShort(u & 0xFFFF));
}
}
return PPCRH_Reg( iselWordExpr_R ( env, e ) );
}
static PPCRI* iselWordExpr_RI ( ISelEnv* env, IRExpr* e )
{
PPCRI* ri = iselWordExpr_RI_wrk(env, e);
switch (ri->tag) {
case Pri_Imm:
return ri;
case Pri_Reg:
vassert(hregClass(ri->Pri.Reg) == HRcGPR(env->mode64));
vassert(hregIsVirtual(ri->Pri.Reg));
return ri;
default:
vpanic("iselIntExpr_RI: unknown ppc RI tag");
}
}
static PPCRI* iselWordExpr_RI_wrk ( ISelEnv* env, IRExpr* e )
{
Long l;
IRType ty = typeOfIRExpr(env->type_env,e);
vassert(ty == Ity_I8 || ty == Ity_I16 ||
ty == Ity_I32 || ((ty == Ity_I64) && env->mode64));
if (e->tag == Iex_Const) {
IRConst* con = e->Iex.Const.con;
switch (con->tag) {
case Ico_U64: vassert(env->mode64);
l = (Long) con->Ico.U64; break;
case Ico_U32: l = (Long)(Int) con->Ico.U32; break;
case Ico_U16: l = (Long)(Int)(Short)con->Ico.U16; break;
case Ico_U8: l = (Long)(Int)(Char )con->Ico.U8; break;
default: vpanic("iselIntExpr_RI.Iex_Const(ppch)");
}
return PPCRI_Imm((ULong)l);
}
return PPCRI_Reg( iselWordExpr_R ( env, e ) );
}
static PPCRH* iselWordExpr_RH5u ( ISelEnv* env, IRExpr* e )
{
PPCRH* ri;
vassert(!env->mode64);
ri = <API key>(env, e);
switch (ri->tag) {
case Prh_Imm:
vassert(ri->Prh.Imm.imm16 >= 1 && ri->Prh.Imm.imm16 <= 31);
vassert(!ri->Prh.Imm.syned);
return ri;
case Prh_Reg:
vassert(hregClass(ri->Prh.Reg.reg) == HRcGPR(env->mode64));
vassert(hregIsVirtual(ri->Prh.Reg.reg));
return ri;
default:
vpanic("iselIntExpr_RH5u: unknown ppc RI tag");
}
}
static PPCRH* <API key> ( ISelEnv* env, IRExpr* e )
{
IRType ty = typeOfIRExpr(env->type_env,e);
vassert(ty == Ity_I8);
if (e->tag == Iex_Const
&& e->Iex.Const.con->tag == Ico_U8
&& e->Iex.Const.con->Ico.U8 >= 1
&& e->Iex.Const.con->Ico.U8 <= 31) {
return PPCRH_Imm(False, e->Iex.Const.con->Ico.U8);
}
return PPCRH_Reg( iselWordExpr_R ( env, e ) );
}
static PPCRH* iselWordExpr_RH6u ( ISelEnv* env, IRExpr* e )
{
PPCRH* ri;
vassert(env->mode64);
ri = <API key>(env, e);
switch (ri->tag) {
case Prh_Imm:
vassert(ri->Prh.Imm.imm16 >= 1 && ri->Prh.Imm.imm16 <= 63);
vassert(!ri->Prh.Imm.syned);
return ri;
case Prh_Reg:
vassert(hregClass(ri->Prh.Reg.reg) == HRcGPR(env->mode64));
vassert(hregIsVirtual(ri->Prh.Reg.reg));
return ri;
default:
vpanic("iselIntExpr_RH6u: unknown ppc64 RI tag");
}
}
static PPCRH* <API key> ( ISelEnv* env, IRExpr* e )
{
IRType ty = typeOfIRExpr(env->type_env,e);
vassert(ty == Ity_I8);
if (e->tag == Iex_Const
&& e->Iex.Const.con->tag == Ico_U8
&& e->Iex.Const.con->Ico.U8 >= 1
&& e->Iex.Const.con->Ico.U8 <= 63) {
return PPCRH_Imm(False, e->Iex.Const.con->Ico.U8);
}
return PPCRH_Reg( iselWordExpr_R ( env, e ) );
}
static PPCCondCode iselCondCode ( ISelEnv* env, IRExpr* e )
{
return iselCondCode_wrk(env,e);
}
static PPCCondCode iselCondCode_wrk ( ISelEnv* env, IRExpr* e )
{
vassert(e);
vassert(typeOfIRExpr(env->type_env,e) == Ity_I1);
if (e->tag == Iex_Const && e->Iex.Const.con->Ico.U1 == True) {
HReg r_zero = newVRegI(env);
addInstr(env, PPCInstr_LI(r_zero, 0, env->mode64));
addInstr(env, PPCInstr_Cmp(False, True,
7, r_zero, PPCRH_Reg(r_zero)));
return mk_PPCCondCode( Pct_TRUE, Pcf_7EQ );
}
if (e->tag == Iex_Unop && e->Iex.Unop.op == Iop_Not1) {
PPCCondCode cond = iselCondCode(env, e->Iex.Unop.arg);
cond.test = invertCondTest(cond.test);
return cond;
}
if (e->tag == Iex_Unop &&
(e->Iex.Unop.op == Iop_32to1 || e->Iex.Unop.op == Iop_64to1)) {
HReg src = iselWordExpr_R(env, e->Iex.Unop.arg);
HReg tmp = newVRegI(env);
addInstr(env, PPCInstr_Alu(Palu_AND, tmp,
src, PPCRH_Imm(False,1)));
addInstr(env, PPCInstr_Cmp(False, True,
7, tmp, PPCRH_Imm(False,1)));
return mk_PPCCondCode( Pct_TRUE, Pcf_7EQ );
}
if (e->tag == Iex_Unop
&& e->Iex.Unop.op == Iop_CmpNEZ8) {
HReg arg = iselWordExpr_R(env, e->Iex.Unop.arg);
HReg tmp = newVRegI(env);
addInstr(env, PPCInstr_Alu(Palu_AND, tmp, arg,
PPCRH_Imm(False,0xFF)));
addInstr(env, PPCInstr_Cmp(False, True,
7, tmp, PPCRH_Imm(False,0)));
return mk_PPCCondCode( Pct_FALSE, Pcf_7EQ );
}
if (e->tag == Iex_Unop
&& e->Iex.Unop.op == Iop_CmpNEZ32) {
HReg r1 = iselWordExpr_R(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Cmp(False, True,
7, r1, PPCRH_Imm(False,0)));
return mk_PPCCondCode( Pct_FALSE, Pcf_7EQ );
}
if (e->tag == Iex_Binop
&& (e->Iex.Binop.op == Iop_CmpEQ32
|| e->Iex.Binop.op == Iop_CmpNE32
|| e->Iex.Binop.op == Iop_CmpLT32S
|| e->Iex.Binop.op == Iop_CmpLT32U
|| e->Iex.Binop.op == Iop_CmpLE32S
|| e->Iex.Binop.op == Iop_CmpLE32U)) {
Bool syned = (e->Iex.Binop.op == Iop_CmpLT32S ||
e->Iex.Binop.op == Iop_CmpLE32S);
HReg r1 = iselWordExpr_R(env, e->Iex.Binop.arg1);
PPCRH* ri2 = iselWordExpr_RH(env, syned, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_Cmp(syned, True,
7, r1, ri2));
switch (e->Iex.Binop.op) {
case Iop_CmpEQ32: return mk_PPCCondCode( Pct_TRUE, Pcf_7EQ );
case Iop_CmpNE32: return mk_PPCCondCode( Pct_FALSE, Pcf_7EQ );
case Iop_CmpLT32U: case Iop_CmpLT32S:
return mk_PPCCondCode( Pct_TRUE, Pcf_7LT );
case Iop_CmpLE32U: case Iop_CmpLE32S:
return mk_PPCCondCode( Pct_FALSE, Pcf_7GT );
default: vpanic("iselCondCode(ppc): CmpXX32");
}
}
if (e->tag == Iex_Unop
&& e->Iex.Unop.op == Iop_CmpNEZ64) {
if (!env->mode64) {
HReg hi, lo;
HReg tmp = newVRegI(env);
iselInt64Expr( &hi, &lo, env, e->Iex.Unop.arg );
addInstr(env, PPCInstr_Alu(Palu_OR, tmp, lo, PPCRH_Reg(hi)));
addInstr(env, PPCInstr_Cmp(False, True,
7, tmp,PPCRH_Imm(False,0)));
return mk_PPCCondCode( Pct_FALSE, Pcf_7EQ );
} else {
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Cmp(False, False,
7, r_src,PPCRH_Imm(False,0)));
return mk_PPCCondCode( Pct_FALSE, Pcf_7EQ );
}
}
if (e->tag == Iex_Binop
&& (e->Iex.Binop.op == Iop_CmpEQ64
|| e->Iex.Binop.op == Iop_CmpNE64
|| e->Iex.Binop.op == Iop_CmpLT64S
|| e->Iex.Binop.op == Iop_CmpLT64U
|| e->Iex.Binop.op == Iop_CmpLE64S
|| e->Iex.Binop.op == Iop_CmpLE64U)) {
Bool syned = (e->Iex.Binop.op == Iop_CmpLT64S ||
e->Iex.Binop.op == Iop_CmpLE64S);
HReg r1 = iselWordExpr_R(env, e->Iex.Binop.arg1);
PPCRH* ri2 = iselWordExpr_RH(env, syned, e->Iex.Binop.arg2);
vassert(env->mode64);
addInstr(env, PPCInstr_Cmp(syned, False,
7, r1, ri2));
switch (e->Iex.Binop.op) {
case Iop_CmpEQ64: return mk_PPCCondCode( Pct_TRUE, Pcf_7EQ );
case Iop_CmpNE64: return mk_PPCCondCode( Pct_FALSE, Pcf_7EQ );
case Iop_CmpLT64U: return mk_PPCCondCode( Pct_TRUE, Pcf_7LT );
case Iop_CmpLE64U: return mk_PPCCondCode( Pct_FALSE, Pcf_7GT );
default: vpanic("iselCondCode(ppc): CmpXX64");
}
}
if (e->tag == Iex_RdTmp) {
HReg r_src = lookupIRTemp(env, e->Iex.RdTmp.tmp);
HReg src_masked = newVRegI(env);
addInstr(env,
PPCInstr_Alu(Palu_AND, src_masked,
r_src, PPCRH_Imm(False,1)));
addInstr(env,
PPCInstr_Cmp(False, True,
7, src_masked, PPCRH_Imm(False,1)));
return mk_PPCCondCode( Pct_TRUE, Pcf_7EQ );
}
vex_printf("iselCondCode(ppc): No such tag(%u)\n", e->tag);
ppIRExpr(e);
vpanic("iselCondCode(ppc)");
}
static void iselInt128Expr ( HReg* rHi, HReg* rLo,
ISelEnv* env, IRExpr* e )
{
vassert(env->mode64);
iselInt128Expr_wrk(rHi, rLo, env, e);
# if 0
vex_printf("\n"); ppIRExpr(e); vex_printf("\n");
# endif
vassert(hregClass(*rHi) == HRcGPR(env->mode64));
vassert(hregIsVirtual(*rHi));
vassert(hregClass(*rLo) == HRcGPR(env->mode64));
vassert(hregIsVirtual(*rLo));
}
static void iselInt128Expr_wrk ( HReg* rHi, HReg* rLo,
ISelEnv* env, IRExpr* e )
{
vassert(e);
vassert(typeOfIRExpr(env->type_env,e) == Ity_I128);
if (e->tag == Iex_RdTmp) {
lookupIRTempPair( rHi, rLo, env, e->Iex.RdTmp.tmp);
return;
}
if (e->tag == Iex_Binop) {
switch (e->Iex.Binop.op) {
case Iop_MullU64:
case Iop_MullS64: {
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
Bool syned = toBool(e->Iex.Binop.op == Iop_MullS64);
HReg r_srcL = iselWordExpr_R(env, e->Iex.Binop.arg1);
HReg r_srcR = iselWordExpr_R(env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_MulL(False,
False, False,
tLo, r_srcL, r_srcR));
addInstr(env, PPCInstr_MulL(syned,
True, False,
tHi, r_srcL, r_srcR));
*rHi = tHi;
*rLo = tLo;
return;
}
case Iop_64HLto128:
*rHi = iselWordExpr_R(env, e->Iex.Binop.arg1);
*rLo = iselWordExpr_R(env, e->Iex.Binop.arg2);
return;
default:
break;
}
}
if (e->tag == Iex_Unop) {
switch (e->Iex.Unop.op) {
default:
break;
}
}
vex_printf("iselInt128Expr(ppc64): No such tag(%u)\n", e->tag);
ppIRExpr(e);
vpanic("iselInt128Expr(ppc64)");
}
static void <API key> ( HReg* rHi, HReg* rMedHi, HReg* rMedLo,
HReg* rLo, ISelEnv* env, IRExpr* e )
{
vassert(!env->mode64);
<API key>(rHi, rMedHi, rMedLo, rLo, env, e);
# if 0
vex_printf("\n"); ppIRExpr(e); vex_printf("\n");
# endif
vassert(hregClass(*rHi) == HRcInt32);
vassert(hregIsVirtual(*rHi));
vassert(hregClass(*rMedHi) == HRcInt32);
vassert(hregIsVirtual(*rMedHi));
vassert(hregClass(*rMedLo) == HRcInt32);
vassert(hregIsVirtual(*rMedLo));
vassert(hregClass(*rLo) == HRcInt32);
vassert(hregIsVirtual(*rLo));
}
static void <API key> ( HReg* rHi, HReg* rMedHi,
HReg* rMedLo, HReg* rLo,
ISelEnv* env, IRExpr* e )
{
vassert(e);
vassert(typeOfIRExpr(env->type_env,e) == Ity_I128);
if (e->tag == Iex_RdTmp) {
lookupIRTempQuad( rHi, rMedHi, rMedLo, rLo, env, e->Iex.RdTmp.tmp);
return;
}
if (e->tag == Iex_Binop) {
IROp op_binop = e->Iex.Binop.op;
switch (op_binop) {
case Iop_64HLto128:
iselInt64Expr(rHi, rMedHi, env, e->Iex.Binop.arg1);
iselInt64Expr(rMedLo, rLo, env, e->Iex.Binop.arg2);
return;
default:
vex_printf("<API key>: Binop case 0x%x not found\n",
op_binop);
break;
}
}
vex_printf("<API key>: e->tag 0x%x not found\n", e->tag);
return;
}
static void iselInt64Expr ( HReg* rHi, HReg* rLo,
ISelEnv* env, IRExpr* e )
{
vassert(!env->mode64);
iselInt64Expr_wrk(rHi, rLo, env, e);
# if 0
vex_printf("\n"); ppIRExpr(e); vex_printf("\n");
# endif
vassert(hregClass(*rHi) == HRcInt32);
vassert(hregIsVirtual(*rHi));
vassert(hregClass(*rLo) == HRcInt32);
vassert(hregIsVirtual(*rLo));
}
static void iselInt64Expr_wrk ( HReg* rHi, HReg* rLo,
ISelEnv* env, IRExpr* e )
{
vassert(e);
vassert(typeOfIRExpr(env->type_env,e) == Ity_I64);
if (e->tag == Iex_Load && e->Iex.Load.end == Iend_BE) {
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
HReg r_addr = iselWordExpr_R(env, e->Iex.Load.addr);
vassert(!env->mode64);
addInstr(env, PPCInstr_Load( 4,
tHi, PPCAMode_IR( 0, r_addr ),
False) );
addInstr(env, PPCInstr_Load( 4,
tLo, PPCAMode_IR( 4, r_addr ),
False) );
*rHi = tHi;
*rLo = tLo;
return;
}
if (e->tag == Iex_Const) {
ULong w64 = e->Iex.Const.con->Ico.U64;
UInt wHi = ((UInt)(w64 >> 32)) & 0xFFFFFFFF;
UInt wLo = ((UInt)w64) & 0xFFFFFFFF;
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
vassert(e->Iex.Const.con->tag == Ico_U64);
addInstr(env, PPCInstr_LI(tHi, (Long)(Int)wHi, False));
addInstr(env, PPCInstr_LI(tLo, (Long)(Int)wLo, False));
*rHi = tHi;
*rLo = tLo;
return;
}
if (e->tag == Iex_RdTmp) {
lookupIRTempPair( rHi, rLo, env, e->Iex.RdTmp.tmp);
return;
}
if (e->tag == Iex_Get) {
PPCAMode* am_addr = PPCAMode_IR( e->Iex.Get.offset,
GuestStatePtr(False) );
PPCAMode* am_addr4 = advance4(env, am_addr);
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
addInstr(env, PPCInstr_Load( 4, tHi, am_addr, False ));
addInstr(env, PPCInstr_Load( 4, tLo, am_addr4, False ));
*rHi = tHi;
*rLo = tLo;
return;
}
if (e->tag == Iex_Mux0X) {
HReg e0Lo, e0Hi, eXLo, eXHi;
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
PPCCondCode cc = mk_PPCCondCode( Pct_TRUE, Pcf_7EQ );
HReg r_cond = iselWordExpr_R(env, e->Iex.Mux0X.cond);
HReg r_tmp = newVRegI(env);
iselInt64Expr(&e0Hi, &e0Lo, env, e->Iex.Mux0X.expr0);
iselInt64Expr(&eXHi, &eXLo, env, e->Iex.Mux0X.exprX);
addInstr(env, mk_iMOVds_RR(tHi,eXHi));
addInstr(env, mk_iMOVds_RR(tLo,eXLo));
addInstr(env, PPCInstr_Alu(Palu_AND,
r_tmp, r_cond, PPCRH_Imm(False,0xFF)));
addInstr(env, PPCInstr_Cmp(False, True,
7, r_tmp, PPCRH_Imm(False,0)));
addInstr(env, PPCInstr_CMov(cc,tHi,PPCRI_Reg(e0Hi)));
addInstr(env, PPCInstr_CMov(cc,tLo,PPCRI_Reg(e0Lo)));
*rHi = tHi;
*rLo = tLo;
return;
}
if (e->tag == Iex_Binop) {
IROp op_binop = e->Iex.Binop.op;
switch (op_binop) {
case Iop_MullU32:
case Iop_MullS32: {
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
Bool syned = toBool(op_binop == Iop_MullS32);
HReg r_srcL = iselWordExpr_R(env, e->Iex.Binop.arg1);
HReg r_srcR = iselWordExpr_R(env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_MulL(False,
False, True,
tLo, r_srcL, r_srcR));
addInstr(env, PPCInstr_MulL(syned,
True, True,
tHi, r_srcL, r_srcR));
*rHi = tHi;
*rLo = tLo;
return;
}
case Iop_Or64:
case Iop_And64:
case Iop_Xor64: {
HReg xLo, xHi, yLo, yHi;
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
PPCAluOp op = (op_binop == Iop_Or64) ? Palu_OR :
(op_binop == Iop_And64) ? Palu_AND : Palu_XOR;
iselInt64Expr(&xHi, &xLo, env, e->Iex.Binop.arg1);
iselInt64Expr(&yHi, &yLo, env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_Alu(op, tHi, xHi, PPCRH_Reg(yHi)));
addInstr(env, PPCInstr_Alu(op, tLo, xLo, PPCRH_Reg(yLo)));
*rHi = tHi;
*rLo = tLo;
return;
}
case Iop_Add64: {
HReg xLo, xHi, yLo, yHi;
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
iselInt64Expr(&xHi, &xLo, env, e->Iex.Binop.arg1);
iselInt64Expr(&yHi, &yLo, env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_AddSubC( True, True ,
tLo, xLo, yLo));
addInstr(env, PPCInstr_AddSubC( True, False,
tHi, xHi, yHi));
*rHi = tHi;
*rLo = tLo;
return;
}
case Iop_32HLto64:
*rHi = iselWordExpr_R(env, e->Iex.Binop.arg1);
*rLo = iselWordExpr_R(env, e->Iex.Binop.arg2);
return;
case Iop_F64toI64S: case Iop_F64toI64U: {
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
HReg r1 = StackFramePtr(env->mode64);
PPCAMode* zero_r1 = PPCAMode_IR( 0, r1 );
PPCAMode* four_r1 = PPCAMode_IR( 4, r1 );
HReg fsrc = iselDblExpr(env, e->Iex.Binop.arg2);
HReg ftmp = newVRegF(env);
vassert(!env->mode64);
<API key>( env, e->Iex.Binop.arg1 );
sub_from_sp( env, 16 );
addInstr(env, PPCInstr_FpCftI(False, False,
(op_binop == Iop_F64toI64S) ? True : False,
True, ftmp, fsrc));
addInstr(env, PPCInstr_FpLdSt(False, 8, ftmp, zero_r1));
addInstr(env, PPCInstr_Load(4, tHi, zero_r1, False));
addInstr(env, PPCInstr_Load(4, tLo, four_r1, False));
add_to_sp( env, 16 );
*rHi = tHi;
*rLo = tLo;
return;
}
default:
break;
}
}
if (e->tag == Iex_Unop) {
switch (e->Iex.Unop.op) {
case Iop_CmpwNEZ64: {
HReg argHi, argLo;
HReg tmp1 = newVRegI(env);
HReg tmp2 = newVRegI(env);
iselInt64Expr(&argHi, &argLo, env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Alu(Palu_OR, tmp1, argHi, PPCRH_Reg(argLo)));
addInstr(env, PPCInstr_Unary(Pun_NEG,tmp2,tmp1));
addInstr(env, PPCInstr_Alu(Palu_OR, tmp2, tmp2, PPCRH_Reg(tmp1)));
addInstr(env, PPCInstr_Shft(Pshft_SAR, True,
tmp2, tmp2, PPCRH_Imm(False, 31)));
*rHi = tmp2;
*rLo = tmp2;
return;
}
case Iop_Left64: {
HReg argHi, argLo;
HReg zero32 = newVRegI(env);
HReg resHi = newVRegI(env);
HReg resLo = newVRegI(env);
iselInt64Expr(&argHi, &argLo, env, e->Iex.Unop.arg);
vassert(env->mode64 == False);
addInstr(env, PPCInstr_LI(zero32, 0, env->mode64));
addInstr(env, PPCInstr_AddSubC( False, True,
resLo, zero32, argLo ));
addInstr(env, PPCInstr_AddSubC( False, False,
resHi, zero32, argHi ));
addInstr(env, PPCInstr_Alu(Palu_OR, resLo, resLo, PPCRH_Reg(argLo)));
addInstr(env, PPCInstr_Alu(Palu_OR, resHi, resHi, PPCRH_Reg(argHi)));
*rHi = resHi;
*rLo = resLo;
return;
}
case Iop_32Sto64: {
HReg tHi = newVRegI(env);
HReg src = iselWordExpr_R(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Shft(Pshft_SAR, True,
tHi, src, PPCRH_Imm(False,31)));
*rHi = tHi;
*rLo = src;
return;
}
case Iop_32Uto64: {
HReg tHi = newVRegI(env);
HReg tLo = iselWordExpr_R(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_LI(tHi, 0, False));
*rHi = tHi;
*rLo = tLo;
return;
}
case Iop_128to64: {
HReg r_Hi = INVALID_HREG;
HReg r_MedHi = INVALID_HREG;
HReg r_MedLo = INVALID_HREG;
HReg r_Lo = INVALID_HREG;
<API key>(&r_Hi, &r_MedHi, &r_MedLo, &r_Lo,
env, e->Iex.Unop.arg);
*rHi = r_MedLo;
*rLo = r_Lo;
return;
}
case Iop_128HIto64: {
HReg r_Hi = INVALID_HREG;
HReg r_MedHi = INVALID_HREG;
HReg r_MedLo = INVALID_HREG;
HReg r_Lo = INVALID_HREG;
<API key>(&r_Hi, &r_MedHi, &r_MedLo, &r_Lo,
env, e->Iex.Unop.arg);
*rHi = r_Hi;
*rLo = r_MedHi;
return;
}
case Iop_V128HIto64:
case Iop_V128to64: {
HReg r_aligned16;
Int off = e->Iex.Unop.op==Iop_V128HIto64 ? 0 : 8;
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
HReg vec = iselVecExpr(env, e->Iex.Unop.arg);
PPCAMode *am_off0, *am_offLO, *am_offHI;
sub_from_sp( env, 32 );
r_aligned16 = get_sp_aligned16( env );
am_off0 = PPCAMode_IR( 0, r_aligned16 );
am_offHI = PPCAMode_IR( off, r_aligned16 );
am_offLO = PPCAMode_IR( off+4, r_aligned16 );
addInstr(env,
PPCInstr_AvLdSt( False, 16, vec, am_off0 ));
addInstr(env,
PPCInstr_Load( 4, tHi, am_offHI, False ));
addInstr(env,
PPCInstr_Load( 4, tLo, am_offLO, False ));
add_to_sp( env, 32 );
*rHi = tHi;
*rLo = tLo;
return;
}
case Iop_1Sto64: {
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
PPCCondCode cond = iselCondCode(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Set(cond,tLo));
addInstr(env, PPCInstr_Shft(Pshft_SHL, True,
tLo, tLo, PPCRH_Imm(False,31)));
addInstr(env, PPCInstr_Shft(Pshft_SAR, True,
tLo, tLo, PPCRH_Imm(False,31)));
addInstr(env, mk_iMOVds_RR(tHi, tLo));
*rHi = tHi;
*rLo = tLo;
return;
}
case Iop_Not64: {
HReg xLo, xHi;
HReg tmpLo = newVRegI(env);
HReg tmpHi = newVRegI(env);
iselInt64Expr(&xHi, &xLo, env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Unary(Pun_NOT,tmpLo,xLo));
addInstr(env, PPCInstr_Unary(Pun_NOT,tmpHi,xHi));
*rHi = tmpHi;
*rLo = tmpLo;
return;
}
case <API key>: {
PPCAMode *am_addr0, *am_addr1;
HReg fr_src = iselDblExpr(env, e->Iex.Unop.arg);
HReg r_dstLo = newVRegI(env);
HReg r_dstHi = newVRegI(env);
sub_from_sp( env, 16 );
am_addr0 = PPCAMode_IR( 0, StackFramePtr(False) );
am_addr1 = PPCAMode_IR( 4, StackFramePtr(False) );
addInstr(env, PPCInstr_FpLdSt( False, 8,
fr_src, am_addr0 ));
addInstr(env, PPCInstr_Load( 4, r_dstHi,
am_addr0, False ));
addInstr(env, PPCInstr_Load( 4, r_dstLo,
am_addr1, False ));
*rHi = r_dstHi;
*rLo = r_dstLo;
add_to_sp( env, 16 );
return;
}
case <API key>: {
HReg fr_src = iselDfp64Expr(env, e->Iex.Unop.arg);
PPCAMode *am_addr0, *am_addr1;
HReg r_dstLo = newVRegI(env);
HReg r_dstHi = newVRegI(env);
sub_from_sp( env, 16 );
am_addr0 = PPCAMode_IR( 0, StackFramePtr(False) );
am_addr1 = PPCAMode_IR( 4, StackFramePtr(False) );
addInstr(env, PPCInstr_FpLdSt( False, 8,
fr_src, am_addr0 ));
addInstr(env, PPCInstr_Load( 4, r_dstHi,
am_addr0, False ));
addInstr(env, PPCInstr_Load( 4, r_dstLo,
am_addr1, False ));
*rHi = r_dstHi;
*rLo = r_dstLo;
add_to_sp( env, 16 );
return;
}
case Iop_BCDtoDPB: {
PPCCondCode cc;
UInt argiregs;
HReg argregs[2];
Int argreg;
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
HReg tmpHi;
HReg tmpLo;
ULong target;
Bool mode64 = env->mode64;
argregs[0] = hregPPC_GPR3(mode64);
argregs[1] = hregPPC_GPR4(mode64);
argiregs = 0;
argreg = 0;
iselInt64Expr( &tmpHi, &tmpLo, env, e->Iex.Unop.arg );
argiregs |= ( 1 << (argreg+3 ) );
addInstr( env, mk_iMOVds_RR( argregs[argreg++], tmpHi ) );
argiregs |= ( 1 << (argreg+3 ) );
addInstr( env, mk_iMOVds_RR( argregs[argreg], tmpLo ) );
cc = mk_PPCCondCode( Pct_ALWAYS, Pcf_NONE );
target = toUInt( Ptr_to_ULong(h_BCDtoDPB ) );
addInstr( env, PPCInstr_Call( cc, (Addr64)target, argiregs ) );
addInstr( env, mk_iMOVds_RR( tHi, argregs[argreg-1] ) );
addInstr( env, mk_iMOVds_RR( tLo, argregs[argreg] ) );
*rHi = tHi;
*rLo = tLo;
return;
}
case Iop_DPBtoBCD: {
PPCCondCode cc;
UInt argiregs;
HReg argregs[2];
Int argreg;
HReg tLo = newVRegI(env);
HReg tHi = newVRegI(env);
HReg tmpHi;
HReg tmpLo;
ULong target;
Bool mode64 = env->mode64;
argregs[0] = hregPPC_GPR3(mode64);
argregs[1] = hregPPC_GPR4(mode64);
argiregs = 0;
argreg = 0;
iselInt64Expr(&tmpHi, &tmpLo, env, e->Iex.Unop.arg);
argiregs |= (1 << (argreg+3));
addInstr(env, mk_iMOVds_RR( argregs[argreg++], tmpHi ));
argiregs |= (1 << (argreg+3));
addInstr(env, mk_iMOVds_RR( argregs[argreg], tmpLo));
cc = mk_PPCCondCode( Pct_ALWAYS, Pcf_NONE );
target = toUInt( Ptr_to_ULong( h_DPBtoBCD ) );
addInstr(env, PPCInstr_Call( cc, (Addr64)target, argiregs ) );
addInstr(env, mk_iMOVds_RR(tHi, argregs[argreg-1]));
addInstr(env, mk_iMOVds_RR(tLo, argregs[argreg]));
*rHi = tHi;
*rLo = tLo;
return;
}
default:
break;
}
}
vex_printf("iselInt64Expr(ppc): No such tag(%u)\n", e->tag);
ppIRExpr(e);
vpanic("iselInt64Expr(ppc)");
}
static HReg iselFltExpr ( ISelEnv* env, IRExpr* e )
{
HReg r = iselFltExpr_wrk( env, e );
# if 0
vex_printf("\n"); ppIRExpr(e); vex_printf("\n");
# endif
vassert(hregClass(r) == HRcFlt64);
vassert(hregIsVirtual(r));
return r;
}
static HReg iselFltExpr_wrk ( ISelEnv* env, IRExpr* e )
{
Bool mode64 = env->mode64;
IRType ty = typeOfIRExpr(env->type_env,e);
vassert(ty == Ity_F32);
if (e->tag == Iex_RdTmp) {
return lookupIRTemp(env, e->Iex.RdTmp.tmp);
}
if (e->tag == Iex_Load && e->Iex.Load.end == Iend_BE) {
PPCAMode* am_addr;
HReg r_dst = newVRegF(env);
vassert(e->Iex.Load.ty == Ity_F32);
am_addr = iselWordExpr_AMode(env, e->Iex.Load.addr, Ity_F32);
addInstr(env, PPCInstr_FpLdSt(True, 4, r_dst, am_addr));
return r_dst;
}
if (e->tag == Iex_Get) {
HReg r_dst = newVRegF(env);
PPCAMode* am_addr = PPCAMode_IR( e->Iex.Get.offset,
GuestStatePtr(env->mode64) );
addInstr(env, PPCInstr_FpLdSt( True, 4, r_dst, am_addr ));
return r_dst;
}
if (e->tag == Iex_Unop && e->Iex.Unop.op == Iop_TruncF64asF32) {
/* This is quite subtle. The only way to do the relevant
truncation is to do a single-precision store and then a
double precision load to get it back into a register. The
problem is, if the data is then written to memory a second
time, as in
STbe(...) = TruncF64asF32(...)
then will the second truncation further alter the value? The
answer is no: flds (as generated here) followed by fsts
(generated for the STbe) is the identity function on 32-bit
floats, so we are safe.
Another upshot of this is that if iselStmt can see the
entirety of
STbe(...) = TruncF64asF32(arg)
then it can short circuit having to deal with TruncF64asF32
individually; instead just compute arg into a 64-bit FP
register and do 'fsts' (since that itself does the
truncation).
We generate pretty poor code here (should be ok both for
32-bit and 64-bit mode); but it is expected that for the most
part the latter optimisation will apply and hence this code
will not often be used.
*/
HReg fsrc = iselDblExpr(env, e->Iex.Unop.arg);
HReg fdst = newVRegF(env);
PPCAMode* zero_r1 = PPCAMode_IR( 0, StackFramePtr(env->mode64) );
sub_from_sp( env, 16 );
addInstr(env, PPCInstr_FpLdSt( False, 4,
fsrc, zero_r1 ));
addInstr(env, PPCInstr_FpLdSt( True, 4,
fdst, zero_r1 ));
add_to_sp( env, 16 );
return fdst;
}
if (e->tag == Iex_Binop && e->Iex.Binop.op == Iop_I64UtoF32) {
if (mode64) {
HReg fdst = newVRegF(env);
HReg isrc = iselWordExpr_R(env, e->Iex.Binop.arg2);
HReg r1 = StackFramePtr(env->mode64);
PPCAMode* zero_r1 = PPCAMode_IR( 0, r1 );
<API key>( env, e->Iex.Binop.arg1 );
sub_from_sp( env, 16 );
addInstr(env, PPCInstr_Store(8, zero_r1, isrc, True));
addInstr(env, PPCInstr_FpLdSt(True, 8, fdst, zero_r1));
addInstr(env, PPCInstr_FpCftI(True, False,
False, False,
fdst, fdst));
add_to_sp( env, 16 );
return fdst;
} else {
HReg fdst = newVRegF(env);
HReg isrcHi, isrcLo;
HReg r1 = StackFramePtr(env->mode64);
PPCAMode* zero_r1 = PPCAMode_IR( 0, r1 );
PPCAMode* four_r1 = PPCAMode_IR( 4, r1 );
iselInt64Expr(&isrcHi, &isrcLo, env, e->Iex.Binop.arg2);
<API key>( env, e->Iex.Binop.arg1 );
sub_from_sp( env, 16 );
addInstr(env, PPCInstr_Store(4, zero_r1, isrcHi, False));
addInstr(env, PPCInstr_Store(4, four_r1, isrcLo, False));
addInstr(env, PPCInstr_FpLdSt(True, 8, fdst, zero_r1));
addInstr(env, PPCInstr_FpCftI(True, False,
False, False,
fdst, fdst));
add_to_sp( env, 16 );
return fdst;
}
}
vex_printf("iselFltExpr(ppc): No such tag(%u)\n", e->tag);
ppIRExpr(e);
vpanic("iselFltExpr_wrk(ppc)");
}
static HReg iselDblExpr ( ISelEnv* env, IRExpr* e )
{
HReg r = iselDblExpr_wrk( env, e );
# if 0
vex_printf("\n"); ppIRExpr(e); vex_printf("\n");
# endif
vassert(hregClass(r) == HRcFlt64);
vassert(hregIsVirtual(r));
return r;
}
static HReg iselDblExpr_wrk ( ISelEnv* env, IRExpr* e )
{
Bool mode64 = env->mode64;
IRType ty = typeOfIRExpr(env->type_env,e);
vassert(e);
vassert(ty == Ity_F64);
if (e->tag == Iex_RdTmp) {
return lookupIRTemp(env, e->Iex.RdTmp.tmp);
}
if (e->tag == Iex_Const) {
union { UInt u32x2[2]; ULong u64; Double f64; } u;
vassert(sizeof(u) == 8);
vassert(sizeof(u.u64) == 8);
vassert(sizeof(u.f64) == 8);
vassert(sizeof(u.u32x2) == 8);
if (e->Iex.Const.con->tag == Ico_F64) {
u.f64 = e->Iex.Const.con->Ico.F64;
}
else if (e->Iex.Const.con->tag == Ico_F64i) {
u.u64 = e->Iex.Const.con->Ico.F64i;
}
else
vpanic("iselDblExpr(ppc): const");
if (!mode64) {
HReg r_srcHi = newVRegI(env);
HReg r_srcLo = newVRegI(env);
addInstr(env, PPCInstr_LI(r_srcHi, u.u32x2[0], mode64));
addInstr(env, PPCInstr_LI(r_srcLo, u.u32x2[1], mode64));
return mk_LoadRR32toFPR( env, r_srcHi, r_srcLo );
} else {
HReg r_src = newVRegI(env);
addInstr(env, PPCInstr_LI(r_src, u.u64, mode64));
return mk_LoadR64toFPR( env, r_src );
}
}
if (e->tag == Iex_Load && e->Iex.Load.end == Iend_BE) {
HReg r_dst = newVRegF(env);
PPCAMode* am_addr;
vassert(e->Iex.Load.ty == Ity_F64);
am_addr = iselWordExpr_AMode(env, e->Iex.Load.addr, Ity_F64);
addInstr(env, PPCInstr_FpLdSt(True, 8, r_dst, am_addr));
return r_dst;
}
if (e->tag == Iex_Get) {
HReg r_dst = newVRegF(env);
PPCAMode* am_addr = PPCAMode_IR( e->Iex.Get.offset,
GuestStatePtr(mode64) );
addInstr(env, PPCInstr_FpLdSt( True, 8, r_dst, am_addr ));
return r_dst;
}
if (e->tag == Iex_Qop) {
PPCFpOp fpop = Pfp_INVALID;
switch (e->Iex.Qop.details->op) {
case Iop_MAddF64: fpop = Pfp_MADDD; break;
case Iop_MAddF64r32: fpop = Pfp_MADDS; break;
case Iop_MSubF64: fpop = Pfp_MSUBD; break;
case Iop_MSubF64r32: fpop = Pfp_MSUBS; break;
default: break;
}
if (fpop != Pfp_INVALID) {
HReg r_dst = newVRegF(env);
HReg r_srcML = iselDblExpr(env, e->Iex.Qop.details->arg2);
HReg r_srcMR = iselDblExpr(env, e->Iex.Qop.details->arg3);
HReg r_srcAcc = iselDblExpr(env, e->Iex.Qop.details->arg4);
<API key>( env, e->Iex.Qop.details->arg1 );
addInstr(env, PPCInstr_FpMulAcc(fpop, r_dst,
r_srcML, r_srcMR, r_srcAcc));
return r_dst;
}
}
if (e->tag == Iex_Triop) {
IRTriop *triop = e->Iex.Triop.details;
PPCFpOp fpop = Pfp_INVALID;
switch (triop->op) {
case Iop_AddF64: fpop = Pfp_ADDD; break;
case Iop_SubF64: fpop = Pfp_SUBD; break;
case Iop_MulF64: fpop = Pfp_MULD; break;
case Iop_DivF64: fpop = Pfp_DIVD; break;
case Iop_AddF64r32: fpop = Pfp_ADDS; break;
case Iop_SubF64r32: fpop = Pfp_SUBS; break;
case Iop_MulF64r32: fpop = Pfp_MULS; break;
case Iop_DivF64r32: fpop = Pfp_DIVS; break;
default: break;
}
if (fpop != Pfp_INVALID) {
HReg r_dst = newVRegF(env);
HReg r_srcL = iselDblExpr(env, triop->arg2);
HReg r_srcR = iselDblExpr(env, triop->arg3);
<API key>( env, triop->arg1 );
addInstr(env, PPCInstr_FpBinary(fpop, r_dst, r_srcL, r_srcR));
return r_dst;
}
switch (triop->op) {
case Iop_QuantizeD64: fpop = Pfp_DQUA; break;
case <API key>: fpop = Pfp_RRDTR; break;
default: break;
}
if (fpop != Pfp_INVALID) {
HReg r_dst = newVRegF(env);
HReg r_srcL = iselDblExpr(env, triop->arg2);
HReg r_srcR = iselDblExpr(env, triop->arg3);
PPCRI* rmc = iselWordExpr_RI(env, triop->arg1);
addInstr(env, <API key>(fpop, r_dst, r_srcL, r_srcR, rmc));
return r_dst;
}
}
if (e->tag == Iex_Binop) {
PPCFpOp fpop = Pfp_INVALID;
switch (e->Iex.Binop.op) {
case Iop_SqrtF64: fpop = Pfp_SQRT; break;
case Iop_I64StoD64: fpop = Pfp_DCFFIX; break;
case Iop_D64toI64S: fpop = Pfp_DCTFIX; break;
default: break;
}
if (fpop != Pfp_INVALID) {
HReg fr_dst = newVRegF(env);
HReg fr_src = iselDblExpr(env, e->Iex.Binop.arg2);
<API key>( env, e->Iex.Binop.arg1 );
addInstr(env, PPCInstr_FpUnary(fpop, fr_dst, fr_src));
return fr_dst;
}
}
if (e->tag == Iex_Binop) {
if (e->Iex.Binop.op == Iop_RoundF64toF32) {
HReg r_dst = newVRegF(env);
HReg r_src = iselDblExpr(env, e->Iex.Binop.arg2);
<API key>( env, e->Iex.Binop.arg1 );
addInstr(env, PPCInstr_FpRSP(r_dst, r_src));
return r_dst;
}
if (e->Iex.Binop.op == Iop_I64StoF64 || e->Iex.Binop.op == Iop_I64UtoF64) {
if (mode64) {
HReg fdst = newVRegF(env);
HReg isrc = iselWordExpr_R(env, e->Iex.Binop.arg2);
HReg r1 = StackFramePtr(env->mode64);
PPCAMode* zero_r1 = PPCAMode_IR( 0, r1 );
<API key>( env, e->Iex.Binop.arg1 );
sub_from_sp( env, 16 );
addInstr(env, PPCInstr_Store(8, zero_r1, isrc, True));
addInstr(env, PPCInstr_FpLdSt(True, 8, fdst, zero_r1));
addInstr(env, PPCInstr_FpCftI(True, False,
e->Iex.Binop.op == Iop_I64StoF64,
True,
fdst, fdst));
add_to_sp( env, 16 );
return fdst;
} else {
HReg fdst = newVRegF(env);
HReg isrcHi, isrcLo;
HReg r1 = StackFramePtr(env->mode64);
PPCAMode* zero_r1 = PPCAMode_IR( 0, r1 );
PPCAMode* four_r1 = PPCAMode_IR( 4, r1 );
iselInt64Expr(&isrcHi, &isrcLo, env, e->Iex.Binop.arg2);
<API key>( env, e->Iex.Binop.arg1 );
sub_from_sp( env, 16 );
addInstr(env, PPCInstr_Store(4, zero_r1, isrcHi, False));
addInstr(env, PPCInstr_Store(4, four_r1, isrcLo, False));
addInstr(env, PPCInstr_FpLdSt(True, 8, fdst, zero_r1));
addInstr(env, PPCInstr_FpCftI(True, False,
e->Iex.Binop.op == Iop_I64StoF64,
True,
fdst, fdst));
add_to_sp( env, 16 );
return fdst;
}
}
}
if (e->tag == Iex_Unop) {
PPCFpOp fpop = Pfp_INVALID;
switch (e->Iex.Unop.op) {
case Iop_NegF64: fpop = Pfp_NEG; break;
case Iop_AbsF64: fpop = Pfp_ABS; break;
case Iop_Est5FRSqrt: fpop = Pfp_RSQRTE; break;
case <API key>: fpop = Pfp_FRIM; break;
case <API key>: fpop = Pfp_FRIP; break;
case <API key>: fpop = Pfp_FRIN; break;
case <API key>: fpop = Pfp_FRIZ; break;
case Iop_ExtractExpD64: fpop = Pfp_DXEX; break;
default: break;
}
if (fpop != Pfp_INVALID) {
HReg fr_dst = newVRegF(env);
HReg fr_src = iselDblExpr(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_FpUnary(fpop, fr_dst, fr_src));
return fr_dst;
}
}
if (e->tag == Iex_Unop) {
switch (e->Iex.Unop.op) {
case <API key>: {
if (!mode64) {
HReg r_srcHi, r_srcLo;
iselInt64Expr( &r_srcHi, &r_srcLo, env, e->Iex.Unop.arg);
return mk_LoadRR32toFPR( env, r_srcHi, r_srcLo );
} else {
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
return mk_LoadR64toFPR( env, r_src );
}
}
case Iop_F32toF64: {
if (e->Iex.Unop.arg->tag == Iex_Unop &&
e->Iex.Unop.arg->Iex.Unop.op == <API key> ) {
e = e->Iex.Unop.arg;
HReg src = iselWordExpr_R(env, e->Iex.Unop.arg);
HReg fr_dst = newVRegF(env);
PPCAMode *am_addr;
sub_from_sp( env, 16 );
am_addr = PPCAMode_IR( 0, StackFramePtr(env->mode64) );
addInstr(env, PPCInstr_Store( 4, am_addr, src, env->mode64 ));
addInstr(env, PPCInstr_FpLdSt(True, 4, fr_dst, am_addr));
add_to_sp( env, 16 );
return fr_dst;
}
HReg res = iselFltExpr(env, e->Iex.Unop.arg);
return res;
}
default:
break;
}
}
if (e->tag == Iex_Mux0X) {
if (ty == Ity_F64
&& typeOfIRExpr(env->type_env,e->Iex.Mux0X.cond) == Ity_I8) {
PPCCondCode cc = mk_PPCCondCode( Pct_TRUE, Pcf_7EQ );
HReg r_cond = iselWordExpr_R(env, e->Iex.Mux0X.cond);
HReg frX = iselDblExpr(env, e->Iex.Mux0X.exprX);
HReg fr0 = iselDblExpr(env, e->Iex.Mux0X.expr0);
HReg fr_dst = newVRegF(env);
HReg r_tmp = newVRegI(env);
addInstr(env, PPCInstr_Alu(Palu_AND, r_tmp,
r_cond, PPCRH_Imm(False,0xFF)));
addInstr(env, PPCInstr_FpUnary( Pfp_MOV, fr_dst, frX ));
addInstr(env, PPCInstr_Cmp(False, True,
7, r_tmp, PPCRH_Imm(False,0)));
addInstr(env, PPCInstr_FpCMov( cc, fr_dst, fr0 ));
return fr_dst;
}
}
vex_printf("iselDblExpr(ppc): No such tag(%u)\n", e->tag);
ppIRExpr(e);
vpanic("iselDblExpr_wrk(ppc)");
}
static HReg iselDfp64Expr(ISelEnv* env, IRExpr* e)
{
HReg r = iselDfp64Expr_wrk( env, e );
vassert(hregClass(r) == HRcFlt64);
vassert( hregIsVirtual(r) );
return r;
}
static HReg iselDfp64Expr_wrk(ISelEnv* env, IRExpr* e)
{
Bool mode64 = env->mode64;
IRType ty = typeOfIRExpr( env->type_env, e );
HReg r_dstHi, r_dstLo;
vassert( e );
vassert( ty == Ity_D64 );
if (e->tag == Iex_RdTmp) {
return lookupIRTemp( env, e->Iex.RdTmp.tmp );
}
if (e->tag == Iex_Get) {
HReg r_dst = newVRegF( env );
PPCAMode* am_addr = PPCAMode_IR( e->Iex.Get.offset,
GuestStatePtr(mode64) );
addInstr( env, PPCInstr_FpLdSt( True, 8, r_dst, am_addr ) );
return r_dst;
}
if (e->tag == Iex_Qop) {
HReg r_dst = newVRegF( env );
return r_dst;
}
if (e->tag == Iex_Unop) {
HReg fr_dst = newVRegF(env);
switch (e->Iex.Unop.op) {
case <API key>: {
if (!mode64) {
HReg r_srcHi, r_srcLo;
iselInt64Expr( &r_srcHi, &r_srcLo, env, e->Iex.Unop.arg);
return mk_LoadRR32toFPR( env, r_srcHi, r_srcLo );
} else {
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
return mk_LoadR64toFPR( env, r_src );
}
}
case Iop_ExtractExpD64: {
HReg fr_src = iselDfp64Expr(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Dfp64Unary(Pfp_DXEX, fr_dst, fr_src));
return fr_dst;
}
case Iop_ExtractExpD128: {
HReg r_srcHi;
HReg r_srcLo;
iselDfp128Expr(&r_srcHi, &r_srcLo, env, e->Iex.Unop.arg);
addInstr(env, <API key>(Pfp_DXEXQ, fr_dst,
r_srcHi, r_srcLo));
return fr_dst;
}
case Iop_D32toD64: {
HReg fr_src = iselDfp64Expr(env, e->Iex.Unop.arg);
addInstr(env, PPCInstr_Dfp64Unary(Pfp_DCTDP, fr_dst, fr_src));
return fr_dst;
}
case Iop_D128HItoD64:
iselDfp128Expr( &r_dstHi, &r_dstLo, env, e->Iex.Unop.arg );
return r_dstHi;
case Iop_D128LOtoD64:
iselDfp128Expr( &r_dstHi, &r_dstLo, env, e->Iex.Unop.arg );
return r_dstLo;
case Iop_InsertExpD64: {
HReg fr_srcL = iselDblExpr(env, e->Iex.Binop.arg1);
HReg fr_srcR = iselDblExpr(env, e->Iex.Binop.arg2);
addInstr(env, <API key>(Pfp_DIEX, fr_dst, fr_srcL,
fr_srcR));
return fr_dst;
}
default:
vex_printf( "ERROR: iselDfp64Expr_wrk, UNKNOWN unop case %d\n",
e->Iex.Unop.op );
}
}
if (e->tag == Iex_Binop) {
switch (e->Iex.Binop.op) {
case Iop_D128toI64S: {
PPCFpOp fpop = Pfp_DCTFIXQ;
HReg fr_dst = newVRegF(env);
HReg r_srcHi = newVRegF(env);
HReg r_srcLo = newVRegF(env);
<API key>( env, e->Iex.Binop.arg1 );
iselDfp128Expr(&r_srcHi, &r_srcLo, env, e->Iex.Binop.arg2);
addInstr(env, <API key>(fpop, fr_dst, r_srcHi, r_srcLo));
return fr_dst;
}
case Iop_D128toD64: {
PPCFpOp fpop = Pfp_DRDPQ;
HReg fr_dst = newVRegF(env);
HReg r_srcHi = newVRegF(env);
HReg r_srcLo = newVRegF(env);
<API key>( env, e->Iex.Binop.arg1 );
iselDfp128Expr(&r_srcHi, &r_srcLo, env, e->Iex.Binop.arg2);
addInstr(env, <API key>(fpop, fr_dst, r_srcHi, r_srcLo));
return fr_dst;
}
break;
default:
break;
}
if (e->Iex.Unop.op == Iop_RoundD64toInt) {
HReg fr_dst = newVRegF(env);
HReg fr_src = newVRegF(env);
PPCRI* r_rmc = iselWordExpr_RI(env, e->Iex.Binop.arg1);
fr_src = iselDfp64Expr(env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_DfpRound(fr_dst, fr_src, r_rmc));
return fr_dst;
}
}
if (e->tag == Iex_Binop) {
PPCFpOp fpop = Pfp_INVALID;
HReg fr_dst = newVRegF(env);
switch (e->Iex.Binop.op) {
case Iop_D64toD32: fpop = Pfp_DRSP; break;
case Iop_I64StoD64: fpop = Pfp_DCFFIX; break;
case Iop_D64toI64S: fpop = Pfp_DCTFIX; break;
default: break;
}
if (fpop != Pfp_INVALID) {
HReg fr_src = iselDfp64Expr(env, e->Iex.Binop.arg2);
<API key>( env, e->Iex.Binop.arg1 );
addInstr(env, PPCInstr_Dfp64Unary(fpop, fr_dst, fr_src));
return fr_dst;
}
switch (e->Iex.Binop.op) {
case Iop_ShlD64: fpop = Pfp_DSCLI; break;
case Iop_ShrD64: fpop = Pfp_DSCRI; break;
default: break;
}
if (fpop != Pfp_INVALID) {
HReg fr_src = iselDfp64Expr(env, e->Iex.Binop.arg1);
PPCRI* shift = iselWordExpr_RI(env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_DfpShift(fpop, fr_dst, fr_src, shift));
return fr_dst;
}
switch (e->Iex.Binop.op) {
case Iop_InsertExpD64:
fpop = Pfp_DIEX;
break;
default: break;
}
if (fpop != Pfp_INVALID) {
HReg fr_srcL = iselDfp64Expr(env, e->Iex.Binop.arg1);
HReg fr_srcR = iselDfp64Expr(env, e->Iex.Binop.arg2);
addInstr(env, <API key>(fpop, fr_dst, fr_srcL, fr_srcR));
return fr_dst;
}
}
if (e->tag == Iex_Triop) {
IRTriop *triop = e->Iex.Triop.details;
PPCFpOp fpop = Pfp_INVALID;
switch (triop->op) {
case Iop_AddD64:
fpop = Pfp_DFPADD;
break;
case Iop_SubD64:
fpop = Pfp_DFPSUB;
break;
case Iop_MulD64:
fpop = Pfp_DFPMUL;
break;
case Iop_DivD64:
fpop = Pfp_DFPDIV;
break;
default:
break;
}
if (fpop != Pfp_INVALID) {
HReg r_dst = newVRegF( env );
HReg r_srcL = iselDfp64Expr( env, triop->arg2 );
HReg r_srcR = iselDfp64Expr( env, triop->arg3 );
<API key>( env, triop->arg1 );
addInstr( env, <API key>( fpop, r_dst, r_srcL, r_srcR ) );
return r_dst;
}
switch (triop->op) {
case Iop_QuantizeD64: fpop = Pfp_DQUA; break;
case <API key>: fpop = Pfp_RRDTR; break;
default: break;
}
if (fpop != Pfp_INVALID) {
HReg r_dst = newVRegF(env);
HReg r_srcL = iselDfp64Expr(env, triop->arg2);
HReg r_srcR = iselDfp64Expr(env, triop->arg3);
PPCRI* rmc = iselWordExpr_RI(env, triop->arg1);
addInstr(env, <API key>(fpop, r_dst, r_srcL, r_srcR,
rmc));
return r_dst;
}
}
ppIRExpr( e );
vpanic( "iselDfp64Expr_wrk(ppc)" );
}
static void iselDfp128Expr(HReg* rHi, HReg* rLo, ISelEnv* env, IRExpr* e)
{
iselDfp128Expr_wrk( rHi, rLo, env, e );
vassert( hregIsVirtual(*rHi) );
vassert( hregIsVirtual(*rLo) );
}
static void iselDfp128Expr_wrk(HReg* rHi, HReg *rLo, ISelEnv* env, IRExpr* e)
{
vassert( e );
vassert( typeOfIRExpr(env->type_env,e) == Ity_D128 );
if (e->tag == Iex_RdTmp) {
lookupIRTempPair( rHi, rLo, env, e->Iex.RdTmp.tmp );
return;
}
if (e->tag == Iex_Unop) {
PPCFpOp fpop = Pfp_INVALID;
HReg r_dstHi = newVRegF(env);
HReg r_dstLo = newVRegF(env);
if (e->Iex.Unop.op == Iop_I64StoD128) {
HReg r_src = iselDfp64Expr(env, e->Iex.Unop.arg);
fpop = Pfp_DCFFIXQ;
addInstr(env, <API key>(fpop, r_dstHi, r_dstLo,
r_src));
}
if (e->Iex.Unop.op == Iop_D64toD128) {
HReg r_src = iselDfp64Expr(env, e->Iex.Unop.arg);
fpop = Pfp_DCTQPQ;
addInstr(env, <API key>(fpop, r_dstHi, r_dstLo,
r_src, r_src));
}
*rHi = r_dstHi;
*rLo = r_dstLo;
return;
}
if (e->tag == Iex_Binop) {
HReg r_srcHi;
HReg r_srcLo;
switch (e->Iex.Binop.op) {
case Iop_D64HLtoD128:
r_srcHi = iselDfp64Expr( env, e->Iex.Binop.arg1 );
r_srcLo = iselDfp64Expr( env, e->Iex.Binop.arg2 );
*rHi = r_srcHi;
*rLo = r_srcLo;
return;
break;
case Iop_D128toD64: {
PPCFpOp fpop = Pfp_DRDPQ;
HReg fr_dst = newVRegF(env);
<API key>( env, e->Iex.Binop.arg1 );
iselDfp128Expr(&r_srcHi, &r_srcLo, env, e->Iex.Binop.arg2);
addInstr(env, <API key>(fpop, fr_dst, r_srcHi, r_srcLo));
*rHi = fr_dst;
*rLo = fr_dst;
return;
}
case Iop_ShlD128:
case Iop_ShrD128: {
HReg fr_dst_hi = newVRegF(env);
HReg fr_dst_lo = newVRegF(env);
PPCRI* shift = iselWordExpr_RI(env, e->Iex.Binop.arg2);
PPCFpOp fpop = Pfp_DSCLIQ;
iselDfp128Expr(&r_srcHi, &r_srcLo, env, e->Iex.Binop.arg1);
if (e->Iex.Binop.op == Iop_ShrD128)
fpop = Pfp_DSCRIQ;
addInstr(env, <API key>(fpop, fr_dst_hi, fr_dst_lo,
r_srcHi, r_srcLo, shift));
*rHi = fr_dst_hi;
*rLo = fr_dst_lo;
return;
}
case Iop_RoundD128toInt: {
HReg r_dstHi = newVRegF(env);
HReg r_dstLo = newVRegF(env);
PPCRI* r_rmc = iselWordExpr_RI(env, e->Iex.Binop.arg1);
iselDfp128Expr(&r_srcHi, &r_srcLo, env, e->Iex.Binop.arg2);
addInstr(env, <API key>(r_dstHi, r_dstLo,
r_srcHi, r_srcLo, r_rmc));
*rHi = r_dstHi;
*rLo = r_dstLo;
return;
}
case Iop_InsertExpD128: {
HReg r_dstHi = newVRegF(env);
HReg r_dstLo = newVRegF(env);
HReg r_srcL = newVRegF(env);
r_srcL = iselDfp64Expr(env, e->Iex.Binop.arg1);
iselDfp128Expr(&r_srcHi, &r_srcLo, env, e->Iex.Binop.arg2);
addInstr(env, <API key>(Pfp_DIEXQ,
r_dstHi, r_dstLo,
r_srcL, r_srcHi, r_srcLo));
*rHi = r_dstHi;
*rLo = r_dstLo;
return;
}
default:
vex_printf( "ERROR: iselDfp128Expr_wrk, UNKNOWN binop case %d\n",
e->Iex.Binop.op );
break;
}
}
if (e->tag == Iex_Triop) {
IRTriop *triop = e->Iex.Triop.details;
PPCFpOp fpop = Pfp_INVALID;
switch (triop->op) {
case Iop_AddD128:
fpop = Pfp_DFPADDQ;
break;
case Iop_SubD128:
fpop = Pfp_DFPSUBQ;
break;
case Iop_MulD128:
fpop = Pfp_DFPMULQ;
break;
case Iop_DivD128:
fpop = Pfp_DFPDIVQ;
break;
default:
break;
}
if (fpop != Pfp_INVALID) {
HReg r_dstHi = newVRegV( env );
HReg r_dstLo = newVRegV( env );
HReg r_srcRHi = newVRegV( env );
HReg r_srcRLo = newVRegV( env );
iselDfp128Expr( &r_dstHi, &r_dstLo, env, triop->arg2 );
iselDfp128Expr( &r_srcRHi, &r_srcRLo, env, triop->arg3 );
<API key>( env, triop->arg1 );
addInstr( env,
<API key>( fpop, r_dstHi, r_dstLo,
r_srcRHi, r_srcRLo ) );
*rHi = r_dstHi;
*rLo = r_dstLo;
return;
}
switch (triop->op) {
case Iop_QuantizeD128: fpop = Pfp_DQUAQ; break;
case <API key>: fpop = Pfp_DRRNDQ; break;
default: break;
}
if (fpop != Pfp_INVALID) {
HReg r_dstHi = newVRegF(env);
HReg r_dstLo = newVRegF(env);
HReg r_srcHi = newVRegF(env);
HReg r_srcLo = newVRegF(env);
PPCRI* rmc = iselWordExpr_RI(env, triop->arg1);
iselDfp128Expr(&r_dstHi, &r_dstLo, env, triop->arg2);
iselDfp128Expr(&r_srcHi, &r_srcLo, env, triop->arg3);
addInstr(env, <API key>(fpop, r_dstHi, r_dstLo,
r_srcHi, r_srcLo, rmc));
*rHi = r_dstHi;
*rLo = r_dstLo;
return;
}
}
ppIRExpr( e );
vpanic( "iselDfp128Expr(ppc64)" );
}
static HReg iselVecExpr ( ISelEnv* env, IRExpr* e )
{
HReg r = iselVecExpr_wrk( env, e );
# if 0
vex_printf("\n"); ppIRExpr(e); vex_printf("\n");
# endif
vassert(hregClass(r) == HRcVec128);
vassert(hregIsVirtual(r));
return r;
}
static HReg iselVecExpr_wrk ( ISelEnv* env, IRExpr* e )
{
Bool mode64 = env->mode64;
PPCAvOp op = Pav_INVALID;
PPCAvFpOp fpop = Pavfp_INVALID;
IRType ty = typeOfIRExpr(env->type_env,e);
vassert(e);
vassert(ty == Ity_V128);
if (e->tag == Iex_RdTmp) {
return lookupIRTemp(env, e->Iex.RdTmp.tmp);
}
if (e->tag == Iex_Get) {
HReg dst = newVRegV(env);
addInstr(env,
PPCInstr_AvLdSt( True, 16, dst,
PPCAMode_IR( e->Iex.Get.offset,
GuestStatePtr(mode64) )));
return dst;
}
if (e->tag == Iex_Load && e->Iex.Load.end == Iend_BE) {
PPCAMode* am_addr;
HReg v_dst = newVRegV(env);
vassert(e->Iex.Load.ty == Ity_V128);
am_addr = iselWordExpr_AMode(env, e->Iex.Load.addr, Ity_V128);
addInstr(env, PPCInstr_AvLdSt( True, 16, v_dst, am_addr));
return v_dst;
}
if (e->tag == Iex_Unop) {
switch (e->Iex.Unop.op) {
case Iop_NotV128: {
HReg arg = iselVecExpr(env, e->Iex.Unop.arg);
HReg dst = newVRegV(env);
addInstr(env, PPCInstr_AvUnary(Pav_NOT, dst, arg));
return dst;
}
case Iop_CmpNEZ8x16: {
HReg arg = iselVecExpr(env, e->Iex.Unop.arg);
HReg zero = newVRegV(env);
HReg dst = newVRegV(env);
addInstr(env, PPCInstr_AvBinary(Pav_XOR, zero, zero, zero));
addInstr(env, PPCInstr_AvBin8x16(Pav_CMPEQU, dst, arg, zero));
addInstr(env, PPCInstr_AvUnary(Pav_NOT, dst, dst));
return dst;
}
case Iop_CmpNEZ16x8: {
HReg arg = iselVecExpr(env, e->Iex.Unop.arg);
HReg zero = newVRegV(env);
HReg dst = newVRegV(env);
addInstr(env, PPCInstr_AvBinary(Pav_XOR, zero, zero, zero));
addInstr(env, PPCInstr_AvBin16x8(Pav_CMPEQU, dst, arg, zero));
addInstr(env, PPCInstr_AvUnary(Pav_NOT, dst, dst));
return dst;
}
case Iop_CmpNEZ32x4: {
HReg arg = iselVecExpr(env, e->Iex.Unop.arg);
HReg zero = newVRegV(env);
HReg dst = newVRegV(env);
addInstr(env, PPCInstr_AvBinary(Pav_XOR, zero, zero, zero));
addInstr(env, PPCInstr_AvBin32x4(Pav_CMPEQU, dst, arg, zero));
addInstr(env, PPCInstr_AvUnary(Pav_NOT, dst, dst));
return dst;
}
case Iop_Recip32Fx4: fpop = Pavfp_RCPF; goto do_32Fx4_unary;
case Iop_RSqrt32Fx4: fpop = Pavfp_RSQRTF; goto do_32Fx4_unary;
case Iop_I32UtoFx4: fpop = Pavfp_CVTU2F; goto do_32Fx4_unary;
case Iop_I32StoFx4: fpop = Pavfp_CVTS2F; goto do_32Fx4_unary;
case Iop_QFtoI32Ux4_RZ: fpop = Pavfp_QCVTF2U; goto do_32Fx4_unary;
case Iop_QFtoI32Sx4_RZ: fpop = Pavfp_QCVTF2S; goto do_32Fx4_unary;
case Iop_RoundF32x4_RM: fpop = Pavfp_ROUNDM; goto do_32Fx4_unary;
case Iop_RoundF32x4_RP: fpop = Pavfp_ROUNDP; goto do_32Fx4_unary;
case Iop_RoundF32x4_RN: fpop = Pavfp_ROUNDN; goto do_32Fx4_unary;
case Iop_RoundF32x4_RZ: fpop = Pavfp_ROUNDZ; goto do_32Fx4_unary;
do_32Fx4_unary:
{
HReg arg = iselVecExpr(env, e->Iex.Unop.arg);
HReg dst = newVRegV(env);
addInstr(env, PPCInstr_AvUn32Fx4(fpop, dst, arg));
return dst;
}
case Iop_32UtoV128: {
HReg r_aligned16, r_zeros;
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
HReg dst = newVRegV(env);
PPCAMode *am_off0, *am_off4, *am_off8, *am_off12;
sub_from_sp( env, 32 );
r_aligned16 = get_sp_aligned16( env );
am_off0 = PPCAMode_IR( 0, r_aligned16 );
am_off4 = PPCAMode_IR( 4, r_aligned16 );
am_off8 = PPCAMode_IR( 8, r_aligned16 );
am_off12 = PPCAMode_IR( 12, r_aligned16 );
r_zeros = newVRegI(env);
addInstr(env, PPCInstr_LI(r_zeros, 0x0, mode64));
addInstr(env, PPCInstr_Store( 4, am_off0, r_zeros, mode64 ));
addInstr(env, PPCInstr_Store( 4, am_off4, r_zeros, mode64 ));
addInstr(env, PPCInstr_Store( 4, am_off8, r_zeros, mode64 ));
addInstr(env, PPCInstr_Store( 4, am_off12, r_src, mode64 ));
addInstr(env, PPCInstr_AvLdSt( True, 4, dst, am_off12 ));
add_to_sp( env, 32 );
return dst;
}
case Iop_Dup8x16:
case Iop_Dup16x8:
case Iop_Dup32x4:
return mk_AvDuplicateRI(env, e->Iex.Unop.arg);
default:
break;
}
}
if (e->tag == Iex_Binop) {
switch (e->Iex.Binop.op) {
case Iop_64HLtoV128: {
if (!mode64) {
HReg r3, r2, r1, r0, r_aligned16;
PPCAMode *am_off0, *am_off4, *am_off8, *am_off12;
HReg dst = newVRegV(env);
sub_from_sp( env, 32 );
r_aligned16 = get_sp_aligned16( env );
am_off0 = PPCAMode_IR( 0, r_aligned16 );
am_off4 = PPCAMode_IR( 4, r_aligned16 );
am_off8 = PPCAMode_IR( 8, r_aligned16 );
am_off12 = PPCAMode_IR( 12, r_aligned16 );
iselInt64Expr(&r1, &r0, env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_Store( 4, am_off12, r0, mode64 ));
addInstr(env, PPCInstr_Store( 4, am_off8, r1, mode64 ));
iselInt64Expr(&r3, &r2, env, e->Iex.Binop.arg1);
addInstr(env, PPCInstr_Store( 4, am_off4, r2, mode64 ));
addInstr(env, PPCInstr_Store( 4, am_off0, r3, mode64 ));
addInstr(env, PPCInstr_AvLdSt(True, 16, dst, am_off0));
add_to_sp( env, 32 );
return dst;
} else {
HReg rHi = iselWordExpr_R(env, e->Iex.Binop.arg1);
HReg rLo = iselWordExpr_R(env, e->Iex.Binop.arg2);
HReg dst = newVRegV(env);
HReg r_aligned16;
PPCAMode *am_off0, *am_off8;
sub_from_sp( env, 32 );
r_aligned16 = get_sp_aligned16( env );
am_off0 = PPCAMode_IR( 0, r_aligned16 );
am_off8 = PPCAMode_IR( 8, r_aligned16 );
addInstr(env, PPCInstr_Store( 8, am_off0, rHi, mode64 ));
addInstr(env, PPCInstr_Store( 8, am_off8, rLo, mode64 ));
addInstr(env, PPCInstr_AvLdSt(True, 16, dst, am_off0));
add_to_sp( env, 32 );
return dst;
}
}
case Iop_Add32Fx4: fpop = Pavfp_ADDF; goto do_32Fx4;
case Iop_Sub32Fx4: fpop = Pavfp_SUBF; goto do_32Fx4;
case Iop_Max32Fx4: fpop = Pavfp_MAXF; goto do_32Fx4;
case Iop_Min32Fx4: fpop = Pavfp_MINF; goto do_32Fx4;
case Iop_Mul32Fx4: fpop = Pavfp_MULF; goto do_32Fx4;
case Iop_CmpEQ32Fx4: fpop = Pavfp_CMPEQF; goto do_32Fx4;
case Iop_CmpGT32Fx4: fpop = Pavfp_CMPGTF; goto do_32Fx4;
case Iop_CmpGE32Fx4: fpop = Pavfp_CMPGEF; goto do_32Fx4;
do_32Fx4:
{
HReg argL = iselVecExpr(env, e->Iex.Binop.arg1);
HReg argR = iselVecExpr(env, e->Iex.Binop.arg2);
HReg dst = newVRegV(env);
addInstr(env, PPCInstr_AvBin32Fx4(fpop, dst, argL, argR));
return dst;
}
case Iop_CmpLE32Fx4: {
HReg argL = iselVecExpr(env, e->Iex.Binop.arg1);
HReg argR = iselVecExpr(env, e->Iex.Binop.arg2);
HReg dst = newVRegV(env);
HReg isNanLR = newVRegV(env);
HReg isNanL = isNan(env, argL);
HReg isNanR = isNan(env, argR);
addInstr(env, PPCInstr_AvBinary(Pav_OR, isNanLR,
isNanL, isNanR));
addInstr(env, PPCInstr_AvBin32Fx4(Pavfp_CMPGTF, dst,
argL, argR));
addInstr(env, PPCInstr_AvBinary(Pav_OR, dst, dst, isNanLR));
addInstr(env, PPCInstr_AvUnary(Pav_NOT, dst, dst));
return dst;
}
case Iop_AndV128: op = Pav_AND; goto do_AvBin;
case Iop_OrV128: op = Pav_OR; goto do_AvBin;
case Iop_XorV128: op = Pav_XOR; goto do_AvBin;
do_AvBin: {
HReg arg1 = iselVecExpr(env, e->Iex.Binop.arg1);
HReg arg2 = iselVecExpr(env, e->Iex.Binop.arg2);
HReg dst = newVRegV(env);
addInstr(env, PPCInstr_AvBinary(op, dst, arg1, arg2));
return dst;
}
case Iop_Shl8x16: op = Pav_SHL; goto do_AvBin8x16;
case Iop_Shr8x16: op = Pav_SHR; goto do_AvBin8x16;
case Iop_Sar8x16: op = Pav_SAR; goto do_AvBin8x16;
case Iop_Rol8x16: op = Pav_ROTL; goto do_AvBin8x16;
case <API key>: op = Pav_MRGHI; goto do_AvBin8x16;
case <API key>: op = Pav_MRGLO; goto do_AvBin8x16;
case Iop_Add8x16: op = Pav_ADDU; goto do_AvBin8x16;
case Iop_QAdd8Ux16: op = Pav_QADDU; goto do_AvBin8x16;
case Iop_QAdd8Sx16: op = Pav_QADDS; goto do_AvBin8x16;
case Iop_Sub8x16: op = Pav_SUBU; goto do_AvBin8x16;
case Iop_QSub8Ux16: op = Pav_QSUBU; goto do_AvBin8x16;
case Iop_QSub8Sx16: op = Pav_QSUBS; goto do_AvBin8x16;
case Iop_Avg8Ux16: op = Pav_AVGU; goto do_AvBin8x16;
case Iop_Avg8Sx16: op = Pav_AVGS; goto do_AvBin8x16;
case Iop_Max8Ux16: op = Pav_MAXU; goto do_AvBin8x16;
case Iop_Max8Sx16: op = Pav_MAXS; goto do_AvBin8x16;
case Iop_Min8Ux16: op = Pav_MINU; goto do_AvBin8x16;
case Iop_Min8Sx16: op = Pav_MINS; goto do_AvBin8x16;
case Iop_MullEven8Ux16: op = Pav_OMULU; goto do_AvBin8x16;
case Iop_MullEven8Sx16: op = Pav_OMULS; goto do_AvBin8x16;
case Iop_CmpEQ8x16: op = Pav_CMPEQU; goto do_AvBin8x16;
case Iop_CmpGT8Ux16: op = Pav_CMPGTU; goto do_AvBin8x16;
case Iop_CmpGT8Sx16: op = Pav_CMPGTS; goto do_AvBin8x16;
do_AvBin8x16: {
HReg arg1 = iselVecExpr(env, e->Iex.Binop.arg1);
HReg arg2 = iselVecExpr(env, e->Iex.Binop.arg2);
HReg dst = newVRegV(env);
addInstr(env, PPCInstr_AvBin8x16(op, dst, arg1, arg2));
return dst;
}
case Iop_Shl16x8: op = Pav_SHL; goto do_AvBin16x8;
case Iop_Shr16x8: op = Pav_SHR; goto do_AvBin16x8;
case Iop_Sar16x8: op = Pav_SAR; goto do_AvBin16x8;
case Iop_Rol16x8: op = Pav_ROTL; goto do_AvBin16x8;
case <API key>: op = Pav_PACKUU; goto do_AvBin16x8;
case <API key>: op = Pav_QPACKUU; goto do_AvBin16x8;
case <API key>: op = Pav_QPACKSS; goto do_AvBin16x8;
case <API key>: op = Pav_MRGHI; goto do_AvBin16x8;
case <API key>: op = Pav_MRGLO; goto do_AvBin16x8;
case Iop_Add16x8: op = Pav_ADDU; goto do_AvBin16x8;
case Iop_QAdd16Ux8: op = Pav_QADDU; goto do_AvBin16x8;
case Iop_QAdd16Sx8: op = Pav_QADDS; goto do_AvBin16x8;
case Iop_Sub16x8: op = Pav_SUBU; goto do_AvBin16x8;
case Iop_QSub16Ux8: op = Pav_QSUBU; goto do_AvBin16x8;
case Iop_QSub16Sx8: op = Pav_QSUBS; goto do_AvBin16x8;
case Iop_Avg16Ux8: op = Pav_AVGU; goto do_AvBin16x8;
case Iop_Avg16Sx8: op = Pav_AVGS; goto do_AvBin16x8;
case Iop_Max16Ux8: op = Pav_MAXU; goto do_AvBin16x8;
case Iop_Max16Sx8: op = Pav_MAXS; goto do_AvBin16x8;
case Iop_Min16Ux8: op = Pav_MINU; goto do_AvBin16x8;
case Iop_Min16Sx8: op = Pav_MINS; goto do_AvBin16x8;
case Iop_MullEven16Ux8: op = Pav_OMULU; goto do_AvBin16x8;
case Iop_MullEven16Sx8: op = Pav_OMULS; goto do_AvBin16x8;
case Iop_CmpEQ16x8: op = Pav_CMPEQU; goto do_AvBin16x8;
case Iop_CmpGT16Ux8: op = Pav_CMPGTU; goto do_AvBin16x8;
case Iop_CmpGT16Sx8: op = Pav_CMPGTS; goto do_AvBin16x8;
do_AvBin16x8: {
HReg arg1 = iselVecExpr(env, e->Iex.Binop.arg1);
HReg arg2 = iselVecExpr(env, e->Iex.Binop.arg2);
HReg dst = newVRegV(env);
addInstr(env, PPCInstr_AvBin16x8(op, dst, arg1, arg2));
return dst;
}
case Iop_Shl32x4: op = Pav_SHL; goto do_AvBin32x4;
case Iop_Shr32x4: op = Pav_SHR; goto do_AvBin32x4;
case Iop_Sar32x4: op = Pav_SAR; goto do_AvBin32x4;
case Iop_Rol32x4: op = Pav_ROTL; goto do_AvBin32x4;
case <API key>: op = Pav_PACKUU; goto do_AvBin32x4;
case <API key>: op = Pav_QPACKUU; goto do_AvBin32x4;
case <API key>: op = Pav_QPACKSS; goto do_AvBin32x4;
case <API key>: op = Pav_MRGHI; goto do_AvBin32x4;
case <API key>: op = Pav_MRGLO; goto do_AvBin32x4;
case Iop_Add32x4: op = Pav_ADDU; goto do_AvBin32x4;
case Iop_QAdd32Ux4: op = Pav_QADDU; goto do_AvBin32x4;
case Iop_QAdd32Sx4: op = Pav_QADDS; goto do_AvBin32x4;
case Iop_Sub32x4: op = Pav_SUBU; goto do_AvBin32x4;
case Iop_QSub32Ux4: op = Pav_QSUBU; goto do_AvBin32x4;
case Iop_QSub32Sx4: op = Pav_QSUBS; goto do_AvBin32x4;
case Iop_Avg32Ux4: op = Pav_AVGU; goto do_AvBin32x4;
case Iop_Avg32Sx4: op = Pav_AVGS; goto do_AvBin32x4;
case Iop_Max32Ux4: op = Pav_MAXU; goto do_AvBin32x4;
case Iop_Max32Sx4: op = Pav_MAXS; goto do_AvBin32x4;
case Iop_Min32Ux4: op = Pav_MINU; goto do_AvBin32x4;
case Iop_Min32Sx4: op = Pav_MINS; goto do_AvBin32x4;
case Iop_CmpEQ32x4: op = Pav_CMPEQU; goto do_AvBin32x4;
case Iop_CmpGT32Ux4: op = Pav_CMPGTU; goto do_AvBin32x4;
case Iop_CmpGT32Sx4: op = Pav_CMPGTS; goto do_AvBin32x4;
do_AvBin32x4: {
HReg arg1 = iselVecExpr(env, e->Iex.Binop.arg1);
HReg arg2 = iselVecExpr(env, e->Iex.Binop.arg2);
HReg dst = newVRegV(env);
addInstr(env, PPCInstr_AvBin32x4(op, dst, arg1, arg2));
return dst;
}
case Iop_ShlN8x16: op = Pav_SHL; goto do_AvShift8x16;
case Iop_SarN8x16: op = Pav_SAR; goto do_AvShift8x16;
do_AvShift8x16: {
HReg r_src = iselVecExpr(env, e->Iex.Binop.arg1);
HReg dst = newVRegV(env);
HReg v_shft = mk_AvDuplicateRI(env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_AvBin8x16(op, dst, r_src, v_shft));
return dst;
}
case Iop_ShlN16x8: op = Pav_SHL; goto do_AvShift16x8;
case Iop_ShrN16x8: op = Pav_SHR; goto do_AvShift16x8;
case Iop_SarN16x8: op = Pav_SAR; goto do_AvShift16x8;
do_AvShift16x8: {
HReg r_src = iselVecExpr(env, e->Iex.Binop.arg1);
HReg dst = newVRegV(env);
HReg v_shft = mk_AvDuplicateRI(env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_AvBin16x8(op, dst, r_src, v_shft));
return dst;
}
case Iop_ShlN32x4: op = Pav_SHL; goto do_AvShift32x4;
case Iop_ShrN32x4: op = Pav_SHR; goto do_AvShift32x4;
case Iop_SarN32x4: op = Pav_SAR; goto do_AvShift32x4;
do_AvShift32x4: {
HReg r_src = iselVecExpr(env, e->Iex.Binop.arg1);
HReg dst = newVRegV(env);
HReg v_shft = mk_AvDuplicateRI(env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_AvBin32x4(op, dst, r_src, v_shft));
return dst;
}
case Iop_ShrV128: op = Pav_SHR; goto do_AvShiftV128;
case Iop_ShlV128: op = Pav_SHL; goto do_AvShiftV128;
do_AvShiftV128: {
HReg dst = newVRegV(env);
HReg r_src = iselVecExpr(env, e->Iex.Binop.arg1);
HReg v_shft = mk_AvDuplicateRI(env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_AvBinary(op, dst, r_src, v_shft));
return dst;
}
case Iop_Perm8x16: {
HReg dst = newVRegV(env);
HReg v_src = iselVecExpr(env, e->Iex.Binop.arg1);
HReg v_ctl = iselVecExpr(env, e->Iex.Binop.arg2);
addInstr(env, PPCInstr_AvPerm(dst, v_src, v_src, v_ctl));
return dst;
}
default:
break;
}
}
if (e->tag == Iex_Const ) {
vassert(e->Iex.Const.con->tag == Ico_V128);
if (e->Iex.Const.con->Ico.V128 == 0x0000) {
return <API key>(env);
}
else if (e->Iex.Const.con->Ico.V128 == 0xffff) {
return generate_ones_V128(env);
}
}
vex_printf("iselVecExpr(ppc) (subarch = %s): can't reduce\n",
LibVEX_ppVexHwCaps(mode64 ? VexArchPPC64 : VexArchPPC32,
env->hwcaps));
ppIRExpr(e);
vpanic("iselVecExpr_wrk(ppc)");
}
static void iselStmt ( ISelEnv* env, IRStmt* stmt )
{
Bool mode64 = env->mode64;
if (vex_traceflags & VEX_TRACE_VCODE) {
vex_printf("\n
ppIRStmt(stmt);
vex_printf("\n");
}
switch (stmt->tag) {
case Ist_Store: {
IRType tya = typeOfIRExpr(env->type_env, stmt->Ist.Store.addr);
IRType tyd = typeOfIRExpr(env->type_env, stmt->Ist.Store.data);
IREndness end = stmt->Ist.Store.end;
if (end != Iend_BE)
goto stmt_fail;
if (!mode64 && (tya != Ity_I32))
goto stmt_fail;
if (mode64 && (tya != Ity_I64))
goto stmt_fail;
if (tyd == Ity_I8 || tyd == Ity_I16 || tyd == Ity_I32 ||
(mode64 && (tyd == Ity_I64))) {
PPCAMode* am_addr
= iselWordExpr_AMode(env, stmt->Ist.Store.addr, tyd);
HReg r_src = iselWordExpr_R(env, stmt->Ist.Store.data);
addInstr(env, PPCInstr_Store( toUChar(sizeofIRType(tyd)),
am_addr, r_src, mode64 ));
return;
}
if (tyd == Ity_F64) {
PPCAMode* am_addr
= iselWordExpr_AMode(env, stmt->Ist.Store.addr, tyd);
HReg fr_src = iselDblExpr(env, stmt->Ist.Store.data);
addInstr(env,
PPCInstr_FpLdSt(False, 8, fr_src, am_addr));
return;
}
if (tyd == Ity_F32) {
PPCAMode* am_addr
= iselWordExpr_AMode(env, stmt->Ist.Store.addr, tyd);
HReg fr_src = iselFltExpr(env, stmt->Ist.Store.data);
addInstr(env,
PPCInstr_FpLdSt(False, 4, fr_src, am_addr));
return;
}
if (tyd == Ity_V128) {
PPCAMode* am_addr
= iselWordExpr_AMode(env, stmt->Ist.Store.addr, tyd);
HReg v_src = iselVecExpr(env, stmt->Ist.Store.data);
addInstr(env,
PPCInstr_AvLdSt(False, 16, v_src, am_addr));
return;
}
if (tyd == Ity_I64 && !mode64) {
HReg rHi32, rLo32;
HReg r_addr = iselWordExpr_R(env, stmt->Ist.Store.addr);
iselInt64Expr( &rHi32, &rLo32, env, stmt->Ist.Store.data );
addInstr(env, PPCInstr_Store( 4,
PPCAMode_IR( 0, r_addr ),
rHi32,
False) );
addInstr(env, PPCInstr_Store( 4,
PPCAMode_IR( 4, r_addr ),
rLo32,
False) );
return;
}
break;
}
case Ist_Put: {
IRType ty = typeOfIRExpr(env->type_env, stmt->Ist.Put.data);
if (ty == Ity_I8 || ty == Ity_I16 ||
ty == Ity_I32 || ((ty == Ity_I64) && mode64)) {
HReg r_src = iselWordExpr_R(env, stmt->Ist.Put.data);
PPCAMode* am_addr = PPCAMode_IR( stmt->Ist.Put.offset,
GuestStatePtr(mode64) );
addInstr(env, PPCInstr_Store( toUChar(sizeofIRType(ty)),
am_addr, r_src, mode64 ));
return;
}
if (!mode64 && ty == Ity_I64) {
HReg rHi, rLo;
PPCAMode* am_addr = PPCAMode_IR( stmt->Ist.Put.offset,
GuestStatePtr(mode64) );
PPCAMode* am_addr4 = advance4(env, am_addr);
iselInt64Expr(&rHi,&rLo, env, stmt->Ist.Put.data);
addInstr(env, PPCInstr_Store( 4, am_addr, rHi, mode64 ));
addInstr(env, PPCInstr_Store( 4, am_addr4, rLo, mode64 ));
return;
}
if (ty == Ity_V128) {
HReg v_src = iselVecExpr(env, stmt->Ist.Put.data);
PPCAMode* am_addr = PPCAMode_IR( stmt->Ist.Put.offset,
GuestStatePtr(mode64) );
addInstr(env,
PPCInstr_AvLdSt(False, 16, v_src, am_addr));
return;
}
if (ty == Ity_F64) {
HReg fr_src = iselDblExpr(env, stmt->Ist.Put.data);
PPCAMode* am_addr = PPCAMode_IR( stmt->Ist.Put.offset,
GuestStatePtr(mode64) );
addInstr(env, PPCInstr_FpLdSt( False, 8,
fr_src, am_addr ));
return;
}
if (ty == Ity_D64) {
HReg fr_src = iselDfp64Expr( env, stmt->Ist.Put.data );
PPCAMode* am_addr = PPCAMode_IR( stmt->Ist.Put.offset,
GuestStatePtr(mode64) );
addInstr( env, PPCInstr_FpLdSt( False, 8, fr_src, am_addr ) );
return;
}
break;
}
case Ist_PutI: {
IRPutI *puti = stmt->Ist.PutI.details;
PPCAMode* dst_am
= genGuestArrayOffset(
env, puti->descr,
puti->ix, puti->bias );
IRType ty = typeOfIRExpr(env->type_env, puti->data);
if (mode64 && ty == Ity_I64) {
HReg r_src = iselWordExpr_R(env, puti->data);
addInstr(env, PPCInstr_Store( toUChar(8),
dst_am, r_src, mode64 ));
return;
}
if ((!mode64) && ty == Ity_I32) {
HReg r_src = iselWordExpr_R(env, puti->data);
addInstr(env, PPCInstr_Store( toUChar(4),
dst_am, r_src, mode64 ));
return;
}
break;
}
case Ist_WrTmp: {
IRTemp tmp = stmt->Ist.WrTmp.tmp;
IRType ty = typeOfIRTemp(env->type_env, tmp);
if (ty == Ity_I8 || ty == Ity_I16 ||
ty == Ity_I32 || ((ty == Ity_I64) && mode64)) {
HReg r_dst = lookupIRTemp(env, tmp);
HReg r_src = iselWordExpr_R(env, stmt->Ist.WrTmp.data);
addInstr(env, mk_iMOVds_RR( r_dst, r_src ));
return;
}
if (!mode64 && ty == Ity_I64) {
HReg r_srcHi, r_srcLo, r_dstHi, r_dstLo;
iselInt64Expr(&r_srcHi,&r_srcLo, env, stmt->Ist.WrTmp.data);
lookupIRTempPair( &r_dstHi, &r_dstLo, env, tmp);
addInstr(env, mk_iMOVds_RR(r_dstHi, r_srcHi) );
addInstr(env, mk_iMOVds_RR(r_dstLo, r_srcLo) );
return;
}
if (mode64 && ty == Ity_I128) {
HReg r_srcHi, r_srcLo, r_dstHi, r_dstLo;
iselInt128Expr(&r_srcHi,&r_srcLo, env, stmt->Ist.WrTmp.data);
lookupIRTempPair( &r_dstHi, &r_dstLo, env, tmp);
addInstr(env, mk_iMOVds_RR(r_dstHi, r_srcHi) );
addInstr(env, mk_iMOVds_RR(r_dstLo, r_srcLo) );
return;
}
if (!mode64 && ty == Ity_I128) {
HReg r_srcHi, r_srcMedHi, r_srcMedLo, r_srcLo;
HReg r_dstHi, r_dstMedHi, r_dstMedLo, r_dstLo;
<API key>(&r_srcHi, &r_srcMedHi,
&r_srcMedLo, &r_srcLo,
env, stmt->Ist.WrTmp.data);
lookupIRTempQuad( &r_dstHi, &r_dstMedHi, &r_dstMedLo,
&r_dstLo, env, tmp);
addInstr(env, mk_iMOVds_RR(r_dstHi, r_srcHi) );
addInstr(env, mk_iMOVds_RR(r_dstMedHi, r_srcMedHi) );
addInstr(env, mk_iMOVds_RR(r_dstMedLo, r_srcMedLo) );
addInstr(env, mk_iMOVds_RR(r_dstLo, r_srcLo) );
return;
}
if (ty == Ity_I1) {
PPCCondCode cond = iselCondCode(env, stmt->Ist.WrTmp.data);
HReg r_dst = lookupIRTemp(env, tmp);
addInstr(env, PPCInstr_Set(cond, r_dst));
return;
}
if (ty == Ity_F64) {
HReg fr_dst = lookupIRTemp(env, tmp);
HReg fr_src = iselDblExpr(env, stmt->Ist.WrTmp.data);
addInstr(env, PPCInstr_FpUnary(Pfp_MOV, fr_dst, fr_src));
return;
}
if (ty == Ity_F32) {
HReg fr_dst = lookupIRTemp(env, tmp);
HReg fr_src = iselFltExpr(env, stmt->Ist.WrTmp.data);
addInstr(env, PPCInstr_FpUnary(Pfp_MOV, fr_dst, fr_src));
return;
}
if (ty == Ity_V128) {
HReg v_dst = lookupIRTemp(env, tmp);
HReg v_src = iselVecExpr(env, stmt->Ist.WrTmp.data);
addInstr(env, PPCInstr_AvUnary(Pav_MOV, v_dst, v_src));
return;
}
if (ty == Ity_D64) {
HReg fr_dst = lookupIRTemp( env, tmp );
HReg fr_src = iselDfp64Expr( env, stmt->Ist.WrTmp.data );
addInstr( env, PPCInstr_Dfp64Unary( Pfp_MOV, fr_dst, fr_src ) );
return;
}
if (ty == Ity_D128) {
HReg fr_srcHi, fr_srcLo, fr_dstHi, fr_dstLo;
lookupIRTempPair( &fr_dstHi, &fr_dstLo, env, tmp );
iselDfp128Expr( &fr_srcHi, &fr_srcLo, env, stmt->Ist.WrTmp.data );
addInstr( env, PPCInstr_Dfp64Unary( Pfp_MOV, fr_dstHi, fr_srcHi ) );
addInstr( env, PPCInstr_Dfp64Unary( Pfp_MOV, fr_dstLo, fr_srcLo ) );
return;
}
break;
}
case Ist_LLSC: {
IRTemp res = stmt->Ist.LLSC.result;
IRType tyRes = typeOfIRTemp(env->type_env, res);
IRType tyAddr = typeOfIRExpr(env->type_env, stmt->Ist.LLSC.addr);
if (stmt->Ist.LLSC.end != Iend_BE)
goto stmt_fail;
if (!mode64 && (tyAddr != Ity_I32))
goto stmt_fail;
if (mode64 && (tyAddr != Ity_I64))
goto stmt_fail;
if (stmt->Ist.LLSC.storedata == NULL) {
HReg r_addr = iselWordExpr_R( env, stmt->Ist.LLSC.addr );
HReg r_dst = lookupIRTemp(env, res);
if (tyRes == Ity_I32) {
addInstr(env, PPCInstr_LoadL( 4, r_dst, r_addr, mode64 ));
return;
}
if (tyRes == Ity_I64 && mode64) {
addInstr(env, PPCInstr_LoadL( 8, r_dst, r_addr, mode64 ));
return;
}
;
} else {
HReg r_res = lookupIRTemp(env, res);
HReg r_a = iselWordExpr_R(env, stmt->Ist.LLSC.addr);
HReg r_src = iselWordExpr_R(env, stmt->Ist.LLSC.storedata);
HReg r_tmp = newVRegI(env);
IRType tyData = typeOfIRExpr(env->type_env,
stmt->Ist.LLSC.storedata);
vassert(tyRes == Ity_I1);
if (tyData == Ity_I32 || (tyData == Ity_I64 && mode64)) {
addInstr(env, PPCInstr_StoreC( tyData==Ity_I32 ? 4 : 8,
r_a, r_src, mode64 ));
addInstr(env, PPCInstr_MfCR( r_tmp ));
addInstr(env, PPCInstr_Shft(
Pshft_SHR,
env->mode64 ? False : True
,
r_tmp, r_tmp,
PPCRH_Imm(False, 29)));
addInstr(env, PPCInstr_Alu(
Palu_AND,
r_res, r_tmp,
PPCRH_Imm(False, 1)));
return;
}
}
goto stmt_fail;
}
case Ist_Dirty: {
IRType retty;
IRDirty* d = stmt->Ist.Dirty.details;
Bool passBBP = False;
if (d->nFxState == 0)
vassert(!d->needsBBP);
passBBP = toBool(d->nFxState > 0 && d->needsBBP);
doHelperCall( env, passBBP, d->guard, d->cee, d->args );
if (d->tmp == IRTemp_INVALID)
return;
retty = typeOfIRTemp(env->type_env, d->tmp);
if (!mode64 && retty == Ity_I64) {
HReg r_dstHi, r_dstLo;
lookupIRTempPair( &r_dstHi, &r_dstLo, env, d->tmp);
addInstr(env, mk_iMOVds_RR(r_dstHi, hregPPC_GPR3(mode64)));
addInstr(env, mk_iMOVds_RR(r_dstLo, hregPPC_GPR4(mode64)));
return;
}
if (retty == Ity_I8 || retty == Ity_I16 ||
retty == Ity_I32 || ((retty == Ity_I64) && mode64)) {
HReg r_dst = lookupIRTemp(env, d->tmp);
addInstr(env, mk_iMOVds_RR(r_dst, hregPPC_GPR3(mode64)));
return;
}
break;
}
case Ist_MBE:
switch (stmt->Ist.MBE.event) {
case Imbe_Fence:
addInstr(env, PPCInstr_MFence());
return;
default:
break;
}
break;
case Ist_IMark:
return;
case Ist_AbiHint:
return;
case Ist_NoOp:
return;
case Ist_Exit: {
IRConst* dst = stmt->Ist.Exit.dst;
if (!mode64 && dst->tag != Ico_U32)
vpanic("iselStmt(ppc): Ist_Exit: dst is not a 32-bit value");
if (mode64 && dst->tag != Ico_U64)
vpanic("iselStmt(ppc64): Ist_Exit: dst is not a 64-bit value");
PPCCondCode cc = iselCondCode(env, stmt->Ist.Exit.guard);
PPCAMode* amCIA = PPCAMode_IR(stmt->Ist.Exit.offsIP,
hregPPC_GPR31(mode64));
if (stmt->Ist.Exit.jk == Ijk_Boring
|| stmt->Ist.Exit.jk == Ijk_Call
) {
if (env->chainingAllowed) {
Bool toFastEP
= mode64
? (((Addr64)stmt->Ist.Exit.dst->Ico.U64) > (Addr64)env->max_ga)
: (((Addr32)stmt->Ist.Exit.dst->Ico.U32) > (Addr32)env->max_ga);
if (0) vex_printf("%s", toFastEP ? "Y" : ",");
addInstr(env, PPCInstr_XDirect(
mode64 ? (Addr64)stmt->Ist.Exit.dst->Ico.U64
: (Addr64)stmt->Ist.Exit.dst->Ico.U32,
amCIA, cc, toFastEP));
} else {
HReg r = iselWordExpr_R(env, IRExpr_Const(stmt->Ist.Exit.dst));
addInstr(env, PPCInstr_XAssisted(r, amCIA, cc, Ijk_Boring));
}
return;
}
switch (stmt->Ist.Exit.jk) {
case Ijk_ClientReq:
case Ijk_EmFail:
case Ijk_EmWarn:
case Ijk_NoDecode:
case Ijk_NoRedir:
case Ijk_SigBUS:
case Ijk_SigTRAP:
case Ijk_Sys_syscall:
case Ijk_TInval:
{
HReg r = iselWordExpr_R(env, IRExpr_Const(stmt->Ist.Exit.dst));
addInstr(env, PPCInstr_XAssisted(r, amCIA, cc,
stmt->Ist.Exit.jk));
return;
}
default:
break;
}
goto stmt_fail;
}
default: break;
}
stmt_fail:
ppIRStmt(stmt);
vpanic("iselStmt(ppc)");
}
static void iselNext ( ISelEnv* env,
IRExpr* next, IRJumpKind jk, Int offsIP )
{
if (vex_traceflags & VEX_TRACE_VCODE) {
vex_printf( "\n-- PUT(%d) = ", offsIP);
ppIRExpr( next );
vex_printf( "; exit-");
ppIRJumpKind(jk);
vex_printf( "\n");
}
PPCCondCode always = mk_PPCCondCode( Pct_ALWAYS, Pcf_NONE );
if (next->tag == Iex_Const) {
IRConst* cdst = next->Iex.Const.con;
vassert(cdst->tag == (env->mode64 ? Ico_U64 :Ico_U32));
if (jk == Ijk_Boring || jk == Ijk_Call) {
PPCAMode* amCIA = PPCAMode_IR(offsIP, hregPPC_GPR31(env->mode64));
if (env->chainingAllowed) {
Bool toFastEP
= env->mode64
? (((Addr64)cdst->Ico.U64) > (Addr64)env->max_ga)
: (((Addr32)cdst->Ico.U32) > (Addr32)env->max_ga);
if (0) vex_printf("%s", toFastEP ? "X" : ".");
addInstr(env, PPCInstr_XDirect(
env->mode64 ? (Addr64)cdst->Ico.U64
: (Addr64)cdst->Ico.U32,
amCIA, always, toFastEP));
} else {
HReg r = iselWordExpr_R(env, next);
addInstr(env, PPCInstr_XAssisted(r, amCIA, always,
Ijk_Boring));
}
return;
}
}
switch (jk) {
case Ijk_Boring: case Ijk_Ret: case Ijk_Call: {
HReg r = iselWordExpr_R(env, next);
PPCAMode* amCIA = PPCAMode_IR(offsIP, hregPPC_GPR31(env->mode64));
if (env->chainingAllowed) {
addInstr(env, PPCInstr_XIndir(r, amCIA, always));
} else {
addInstr(env, PPCInstr_XAssisted(r, amCIA, always,
Ijk_Boring));
}
return;
}
default:
break;
}
switch (jk) {
case Ijk_ClientReq:
case Ijk_EmFail:
case Ijk_EmWarn:
case Ijk_NoDecode:
case Ijk_NoRedir:
case Ijk_SigBUS:
case Ijk_SigTRAP:
case Ijk_Sys_syscall:
case Ijk_TInval:
{
HReg r = iselWordExpr_R(env, next);
PPCAMode* amCIA = PPCAMode_IR(offsIP, hregPPC_GPR31(env->mode64));
addInstr(env, PPCInstr_XAssisted(r, amCIA, always, jk));
return;
}
default:
break;
}
vex_printf( "\n-- PUT(%d) = ", offsIP);
ppIRExpr( next );
vex_printf( "; exit-");
ppIRJumpKind(jk);
vex_printf( "\n");
vassert(0);
}
HInstrArray* iselSB_PPC ( IRSB* bb,
VexArch arch_host,
VexArchInfo* archinfo_host,
VexAbiInfo* vbi,
Int <API key>,
Int <API key>,
Bool chainingAllowed,
Bool addProfInc,
Addr64 max_ga )
{
Int i, j;
HReg hregLo, hregMedLo, hregMedHi, hregHi;
ISelEnv* env;
UInt hwcaps_host = archinfo_host->hwcaps;
Bool mode64 = False;
UInt mask32, mask64;
PPCAMode *amCounter, *amFailAddr;
vassert(arch_host == VexArchPPC32 || arch_host == VexArchPPC64);
mode64 = arch_host == VexArchPPC64;
if (!mode64) vassert(max_ga <= 0xFFFFFFFFULL);
mask32 = VEX_HWCAPS_PPC32_F | VEX_HWCAPS_PPC32_V
| VEX_HWCAPS_PPC32_FX | VEX_HWCAPS_PPC32_GX | VEX_HWCAPS_PPC32_VX
| <API key>;
mask64 = VEX_HWCAPS_PPC64_V | VEX_HWCAPS_PPC64_FX
| VEX_HWCAPS_PPC64_GX | VEX_HWCAPS_PPC64_VX | <API key>;
if (mode64) {
vassert((hwcaps_host & mask32) == 0);
} else {
vassert((hwcaps_host & mask64) == 0);
}
env = LibVEX_Alloc(sizeof(ISelEnv));
env->vreg_ctr = 0;
env->mode64 = mode64;
env->code = newHInstrArray();
env->type_env = bb->tyenv;
env->n_vregmap = bb->tyenv->types_used;
env->vregmapLo = LibVEX_Alloc(env->n_vregmap * sizeof(HReg));
env->vregmapMedLo = LibVEX_Alloc(env->n_vregmap * sizeof(HReg));
if (mode64) {
env->vregmapMedHi = NULL;
env->vregmapHi = NULL;
} else {
env->vregmapMedHi = LibVEX_Alloc(env->n_vregmap * sizeof(HReg));
env->vregmapHi = LibVEX_Alloc(env->n_vregmap * sizeof(HReg));
}
env->chainingAllowed = chainingAllowed;
env->max_ga = max_ga;
env->hwcaps = hwcaps_host;
env->previous_rm = NULL;
env->vbi = vbi;
j = 0;
for (i = 0; i < env->n_vregmap; i++) {
hregLo = hregMedLo = hregMedHi = hregHi = INVALID_HREG;
switch (bb->tyenv->types[i]) {
case Ity_I1:
case Ity_I8:
case Ity_I16:
case Ity_I32:
if (mode64) { hregLo = mkHReg(j++, HRcInt64, True); break;
} else { hregLo = mkHReg(j++, HRcInt32, True); break;
}
case Ity_I64:
if (mode64) { hregLo = mkHReg(j++, HRcInt64, True); break;
} else { hregLo = mkHReg(j++, HRcInt32, True);
hregMedLo = mkHReg(j++, HRcInt32, True); break;
}
case Ity_I128:
if (mode64) { hregLo = mkHReg(j++, HRcInt64, True);
hregMedLo = mkHReg(j++, HRcInt64, True); break;
} else { hregLo = mkHReg(j++, HRcInt32, True);
hregMedLo = mkHReg(j++, HRcInt32, True);
hregMedHi = mkHReg(j++, HRcInt32, True);
hregHi = mkHReg(j++, HRcInt32, True); break;
}
case Ity_F32:
case Ity_F64: hregLo = mkHReg(j++, HRcFlt64, True); break;
case Ity_V128: hregLo = mkHReg(j++, HRcVec128, True); break;
case Ity_D64: hregLo = mkHReg(j++, HRcFlt64, True); break;
case Ity_D128: hregLo = mkHReg(j++, HRcFlt64, True);
hregMedLo = mkHReg(j++, HRcFlt64, True); break;
default:
ppIRType(bb->tyenv->types[i]);
vpanic("iselBB(ppc): IRTemp type");
}
env->vregmapLo[i] = hregLo;
env->vregmapMedLo[i] = hregMedLo;
if (!mode64) {
env->vregmapMedHi[i] = hregMedHi;
env->vregmapHi[i] = hregHi;
}
}
env->vreg_ctr = j;
amCounter = PPCAMode_IR(<API key>, hregPPC_GPR31(mode64));
amFailAddr = PPCAMode_IR(<API key>, hregPPC_GPR31(mode64));
addInstr(env, PPCInstr_EvCheck(amCounter, amFailAddr));
if (addProfInc) {
addInstr(env, PPCInstr_ProfInc());
}
for (i = 0; i < bb->stmts_used; i++)
iselStmt(env, bb->stmts[i]);
iselNext(env, bb->next, bb->jumpkind, bb->offsIP);
env->code->n_vregs = env->vreg_ctr;
return env->code;
}
|
<?php
chdir('../../');
require_once ('pika-danio.php');
pika_init();
$report_title = 'LSC Interim Case Services';
$report_name = "lsc_interim";
$base_url = pl_settings_get('base_url');
if(!<API key>($report_name))
{
$main_html = array();
$main_html['base_url'] = $base_url;
$main_html['page_title'] = $report_title;
$main_html['nav'] = "<a href=\"{$base_url}/\">Pika Home</a>
> <a href=\"{$base_url}/reports/\">Reports</a>
> $report_title";
$main_html['content'] = "You are not authorized to run this report";
$buffer = pl_template('templates/default.html', $main_html);
pika_exit($buffer);
}
$report_format = pl_grab_get('report_format');
$close_date_begin = pl_grab_get('close_date_begin');
$close_date_end = pl_grab_get('close_date_end');
$open_on_date = pl_grab_get('open_on_date');
$funding = pl_grab_get('funding');
$office = pl_grab_get('office');
$status = pl_grab_get('status');
$county = pl_grab_get('county');
$gender = pl_grab_get('gender');
$undup = pl_grab_get('undup');
$calendar_year = pl_grab_get('calendar_year');
$clean_calendar_year = <API key>($calendar_year);
$show_sql = pl_grab_get('show_sql');
$menu_undup = pl_menu_get('undup');
if ('csv' == $report_format)
{
require_once ('app/lib/plCsvReportTable.php');
require_once ('app/lib/plCsvReport.php');
$t = new plCsvReport();
}
else
{
require_once ('app/lib/plHtmlReportTable.php');
require_once ('app/lib/plHtmlReport.php');
$t = new plHtmlReport();
}
// run the report
$clb = $clean_calendar_year . "-01-01";
$cle = $clean_calendar_year . "-06-30";
$ood = $clean_calendar_year . "-06-30";
$eth_sql = "SELECT SUBSTRING(LPAD(problem, 2, '0'),1,1) AS category,
SUM(IF(close_code IN ('A', 'B'), 1, 0)) AS 'Cases Closed after Limited Service',
SUM(IF(close_code IN ('F', 'G', 'H', 'IA', 'IB', 'IC', 'K', 'L'), 1, 0)) AS 'Cases Closed after Extended Service',
SUM(IF(ISNULL(close_date) OR close_date > '{$clean_calendar_year}-06-30', 1, 0)) AS 'Cases Remaining Open on June 30'
FROM cases
WHERE status='2'";
// handle the crazy date range selection
$range1 = $range2 = "";
$sql = '';
$safe_clb = <API key>($clb);
$safe_cle = <API key>($cle);
$safe_ood = <API key>($ood);
if ($clb && $cle)
{
//$t->add_parameter('Closed Between', $safe_clb . " - " . $safe_cle);
$range1 = "close_date >= '{$safe_clb}' AND close_date <= '{$safe_cle}'";
}
elseif ($clb)
{
//$t->add_parameter('Closed After', $safe_clb);
$range1 = "close_date >= '{$safe_clb}'";
}
elseif ($cle)
{
//$t->add_parameter('Closed Before', $safe_cle);
$range1 = "close_date <= '{$safe_cle}'";
}
if ($ood)
{
//$t->add_parameter('Open On', $safe_ood);
$range2 = "(open_date <= '{$safe_ood}' AND (close_date IS NULL OR close_date > '{$safe_ood}'))";
}
if ($ood)
{
if ($clb || $cle)
{
$sql .= " AND (($range1) OR $range2)";
}
else
{
$sql .= " AND $range2";
}
}
else
{
if ($clb || $cle)
{
$sql .= " AND $range1";
}
}
// Other filters
$x = <API key>($funding);
if ($x != false)
{
$t->add_parameter('Funding Code(s)',$funding);
$sql .= " AND funding IN $x";
}
$x = <API key>($office);
if ($x != false)
{
$t->add_parameter('Office Code(s)',$office);
$sql .= " AND office IN $x";
}
$x = <API key>($status);
if ($x != false)
{
$t->add_parameter('Case Status Code(s)',$status);
$sql .= " AND status IN $x";
}
$x = <API key>($county);
if ($x != false)
{
$t->add_parameter('Counties',$county);
$sql .= " AND county IN $x";
}
if ($gender)
{
$t->add_parameter('Gender Code',$gender);
$safe_gender = <API key>($gender);
$sql .= " AND gender='{$safe_gender}'";
}
if ($undup == 1 || ($undup == 0 && $undup != ''))
{
$t->add_parameter('Undup Service',pl_array_lookup($undup,$menu_undup));
$safe_undup = <API key>($undup);
$sql .= " AND undup = '{$safe_undup}'";
}
$eth_sql .= $sql . " GROUP BY category";
$t->title = $report_title;
$t->set_table_title("Form G-1: Interim Case Services");
$t->display_row_count(false);
$t->set_header(array('Category','Cases Closed after Limited Service','Cases Closed after Extended Service','Cases Remaining Open on June 30'));
$t->add_parameter('Cases open between', $safe_clb . " - " . $safe_cle);
$t->add_parameter('Status Codes', "2, 5");
$t->add_parameter('Limited Service Closing Codes', 'A, B');
$t->add_parameter('Extended Service Closing Codes', 'F, G, H, IA, IB, IC, K, L');
$t->add_parameter('Funding', $funding);
$total = array();
$total['code'] = "";
$total['category'] = "";
$total["A"] = "0";
$total["B"] = "0";
$total["C"] = "0";
$total["D"] = "0";
$total["total"] = "0";
$result = mysql_query($eth_sql) or trigger_error();
while ($row = mysql_fetch_assoc($result))
{
$t->add_row($row);
$total["A"] += $row["Under 18"];
$total["B"] += $row["18 to 59"];
$total["C"] += $row["60 and Older"];
$total["D"] += $row["No Age Data"];
$total["total"] += $row["Total"];
}
//$t->add_row($total);
if($show_sql)
{
$t->set_sql($eth_sql);
}
// Add the PAI table
$t->add_table();
$t->set_table_title("Form G-1(d): Interim Case Services (PAI)");
$t->display_row_count(false);
$t->set_header(array('Category', 'Cases Closed after Limited Service','Cases Closed after Extended Service','Cases Remaining Open on June 30'));
$pai_sql = "SELECT SUBSTRING(LPAD(problem, 2, '0'),1,1) AS category,
SUM(IF(close_code IN ('A', 'B'), 1, 0)) AS 'Cases Closed after Limited Service',
SUM(IF(close_code IN ('F', 'G', 'H', 'IA', 'IB', 'IC', 'K', 'L'), 1, 0)) AS 'Cases Closed after Extended Service',
SUM(IF(ISNULL(close_date) OR close_date > '{$clean_calendar_year}-06-30', 1, 0)) AS 'Cases Remaining Open on June 30'
FROM cases
WHERE status='5'" . $sql . " GROUP BY category";
$result = mysql_query($pai_sql) or trigger_error();
while ($row = mysql_fetch_assoc($result))
{
$t->add_row($row);
}
//$t->add_row($total);
if($show_sql)
{
$t->set_sql($pai_sql);
}
$t->display();
exit();
?>
|
<?php
namespace Gh\Gloggiheime\Controller;
use FluidTYPO3\Flux\Controller\<API key>;
/**
* My custom ContentController to render my package's Content templates.
*
* @package Gloggiheime
* @subpackage Controller
*/
class ContentController extends <API key> {
/**
* bookingRepository
*
* @var \Gh\Gloggiheime\Domain\Repository\BookingRepository
* @inject
*/
protected $bookingRepository = NULL;
/**
* heimeRepository
*
* @var \Gh\Gloggiheime\Domain\Repository\HeimeRepository
* @inject
*/
protected $heimeRepository = NULL;
public function bookingAction() {
// Fix for stupid Extbase Persistency problems in Repository
$ext_conf = $this->getData();
$heim_id = $ext_conf[settings][flexform][heim_id];
$end_date_months = $ext_conf[settings][flexform][monate];
$heime = $this->heimeRepository->findAll();
$this->view->assign('heime', $heime);
// $bookings = $this->bookingRepository->findAll();
// $this->view->assign('bookings', $bookings);
$query = $this->bookingRepository->createQuery();
$date_start = new \DateTime('-1 month');
// $date_end = new \DateTime('+'.end_date_months.' month');
$query->matching(
$query->greaterThanOrEqual('from_booking', $date_start->format('Y-m-d H:i:s'))
);
debug($query);
$bookings = $query->execute();
$this->view->assign('bookings', $bookings);
$heim = $this->heimeRepository->findByUid($heim_id);
$this->view->assign('selectedheim', $heim);
}
public function preiseAction() {
// print($this);
$heime = $this->heimeRepository->findAll();
$this->view->assign('heime', $heime);
}
public function mapAction() {
$ext_conf = $this->getData();
$heim_id = $ext_conf[settings][flexform][heim_id];
$heimsingle = $this->heimeRepository->findByUid($heim_id);
$this->view->assign('heimsingle', $heimsingle);
// print($this);
$heime = $this->heimeRepository->findAll();
$this->view->assign('heime', $heime);
}
public function detailsAction() {
$ext_conf = $this->getData();
$heim_id = $ext_conf[settings][flexform][heim_id];
$heim = $this->heimeRepository->findByUid($heim_id);
$this->view->assign('heim', $heim);
}
}
?>
|
#!/bin/sh
# git-submodule.sh: add, init, update or list git submodules
dashless=$(basename "$0" | sed -e 's/-/ /')
USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]
or: $dashless [--quiet] init [--] [<path>...]
or: $dashless [--quiet] deinit [-f|--force] (--all| [--] <path>...)
or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--[no-]recommend-shallow] [--reference <repository>] [--recursive] [--] [<path>...]
or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
or: $dashless [--quiet] foreach [--recursive] <command>
or: $dashless [--quiet] sync [--recursive] [--] [<path>...]
or: $dashless [--quiet] absorbgitdirs [--] [<path>...]"
OPTIONS_SPEC=
SUBDIRECTORY_OK=Yes
. git-sh-setup
. git-parse-remote
require_work_tree
wt_prefix=$(git rev-parse --show-prefix)
cd_to_toplevel
# Tell the rest of git that any URLs we get don't come
# directly from the user, so it can apply policy as appropriate.
<API key>=0
export <API key>
command=
branch=
force=
reference=
cached=
recursive=
init=
files=
remote=
nofetch=
update=
prefix=
custom_name=
depth=
progress=
die_if_unmatched ()
{
if test "$1" = "#unmatched"
then
exit ${2:-1}
fi
}
# Print a submodule configuration setting
# $1 = submodule name
# $2 = option name
# $3 = default value
# Checks in the usual git-config places first (for overrides),
# otherwise it falls back on .gitmodules. This allows you to
# distribute project-wide defaults in .gitmodules, while still
# customizing individual repositories if necessary. If the option is
# not in .gitmodules either, print a default value.
<API key> () {
name="$1"
option="$2"
default="$3"
value=$(git config submodule."$name"."$option")
if test -z "$value"
then
value=$(git config -f .gitmodules submodule."$name"."$option")
fi
printf '%s' "${value:-$default}"
}
isnumber()
{
n=$(($1 + 0)) 2>/dev/null && test "$n" = "$1"
}
# Sanitize the local git environment for use within a submodule. We
# can't simply use clear_local_git_env since we want to preserve some
# of the settings from <API key>.
<API key>()
{
save_config=$<API key>
clear_local_git_env
<API key>=$save_config
export <API key>
}
# Add a new submodule to the working tree, .gitmodules and the index
# $@ = repo path
# optional branch is stored in global branch variable
cmd_add()
{
# parse $args after "submodule ... add".
reference_path=
while test $# -ne 0
do
case "$1" in
-b | --branch)
case "$2" in '') usage ;; esac
branch=$2
shift
;;
-f | --force)
force=$1
;;
-q|--quiet)
GIT_QUIET=1
;;
--reference)
case "$2" in '') usage ;; esac
reference_path=$2
shift
;;
--reference=*)
reference_path="${1#--reference=}"
;;
--name)
case "$2" in '') usage ;; esac
custom_name=$2
shift
;;
--depth)
case "$2" in '') usage ;; esac
depth="--depth=$2"
shift
;;
--depth=*)
depth=$1
;;
shift
break
;;
-*)
usage
;;
*)
break
;;
esac
shift
done
if test -n "$reference_path"
then
is_absolute_path "$reference_path" ||
reference_path="$wt_prefix$reference_path"
reference="--reference=$reference_path"
fi
repo=$1
sm_path=$2
if test -z "$sm_path"; then
sm_path=$(printf '%s\n' "$repo" |
sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*[/:]||g')
fi
if test -z "$repo" || test -z "$sm_path"; then
usage
fi
is_absolute_path "$sm_path" || sm_path="$wt_prefix$sm_path"
# assure repo is absolute or relative to parent
case "$repo" in
./*|../*)
# rewrite foo/bar as ../.. to find path from
# submodule work tree to superproject work tree
up_path="$(printf '%s\n' "$sm_path" | sed "s/[^/][^/]*/../g")" &&
# guarantee a trailing /
up_path=${up_path%/}/ &&
# path from submodule work tree to submodule origin repo
sub_origin_url=$(git submodule--helper <API key> "$url" "$up_path") &&
# path from superproject work tree to submodule origin repo
super_config_url=$(git submodule--helper <API key> "$url") || exit
;;
*)
sub_origin_url="$url"
super_config_url="$url"
;;
esac
if git config "submodule.$name.url" >/dev/null 2>/dev/null
then
displaypath=$(git submodule--helper relative-path "$prefix$sm_path" "$wt_prefix")
say "$(eval_gettext "Synchronizing submodule url for '\$displaypath'")"
git config submodule."$name".url "$super_config_url"
if test -e "$sm_path"/.git
then
(
<API key>
cd "$sm_path"
remote=$(get_default_remote)
git config remote."$remote".url "$sub_origin_url"
if test -n "$recursive"
then
prefix="$prefix$sm_path/"
eval cmd_sync
fi
)
fi
fi
done
}
cmd_absorbgitdirs()
{
git submodule--helper absorb-git-dirs --prefix "$wt_prefix" "$@"
}
# This loop parses the command line arguments to find the
# subcommand name to dispatch. Parsing of the subcommand specific
# options are primarily done by the subcommand implementations.
# Subcommand specific options such as --branch and --cached are
# parsed here as well, for backward compatibility.
while test $# != 0 && test -z "$command"
do
case "$1" in
add | foreach | init | deinit | update | status | summary | sync | absorbgitdirs)
command=$1
;;
-q|--quiet)
GIT_QUIET=1
;;
-b|--branch)
case "$2" in
'')
usage
;;
esac
branch="$2"; shift
;;
--cached)
cached="$1"
;;
break
;;
-*)
usage
;;
*)
break
;;
esac
shift
done
# No command word defaults to "status"
if test -z "$command"
then
if test $
then
command=status
else
usage
fi
fi
# "-b branch" is accepted only by "add"
if test -n "$branch" && test "$command" != add
then
usage
fi
# "--cached" is accepted only by "status" and "summary"
if test -n "$cached" && test "$command" != status && test "$command" != summary
then
usage
fi
"cmd_$command" "$@"
|
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/highmem.h>
#include <asm/cacheflush.h>
#include <asm/cachetype.h>
#include <asm/highmem.h>
#include <asm/smp_plat.h>
#include <asm/tlbflush.h>
#include "mm.h"
#ifdef <API key>
static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr)
{
unsigned long to = FLUSH_ALIAS_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT);
const int zero = 0;
set_top_pte(to, pfn_pte(pfn, PAGE_KERNEL));
asm( "mcrr p15, 0, %1, %0, c14\n"
" mcr p15, 0, %2, c7, c10, 4"
:
: "r" (to), "r" (to + PAGE_SIZE - L1_CACHE_BYTES), "r" (zero)
: "cc");
}
static void flush_icache_alias(unsigned long pfn, unsigned long vaddr, unsigned long len)
{
unsigned long va = FLUSH_ALIAS_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT);
unsigned long offset = vaddr & (PAGE_SIZE - 1);
unsigned long to;
set_top_pte(va, pfn_pte(pfn, PAGE_KERNEL));
to = va + offset;
flush_icache_range(to, to + len);
}
void flush_cache_mm(struct mm_struct *mm)
{
if (cache_is_vivt()) {
vivt_flush_cache_mm(mm);
return;
}
if (<API key>()) {
asm( "mcr p15, 0, %0, c7, c14, 0\n"
" mcr p15, 0, %0, c7, c10, 4"
:
: "r" (0)
: "cc");
}
}
void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
{
if (cache_is_vivt()) {
<API key>(vma, start, end);
return;
}
if (<API key>()) {
asm( "mcr p15, 0, %0, c7, c14, 0\n"
" mcr p15, 0, %0, c7, c10, 4"
:
: "r" (0)
: "cc");
}
if (vma->vm_flags & VM_EXEC)
__flush_icache_all();
}
void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn)
{
if (cache_is_vivt()) {
<API key>(vma, user_addr, pfn);
return;
}
if (<API key>()) {
flush_pfn_alias(pfn, user_addr);
__flush_icache_all();
}
if (vma->vm_flags & VM_EXEC && <API key>())
__flush_icache_all();
}
#else
#define flush_pfn_alias(pfn,vaddr) do { } while (0)
#define flush_icache_alias(pfn,vaddr,len) do { } while (0)
#endif
static void <API key>(void *args)
{
__flush_icache_all();
}
static
void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
unsigned long uaddr, void *kaddr, unsigned long len)
{
if (cache_is_vivt()) {
if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm))) {
unsigned long addr = (unsigned long)kaddr;
<API key>(addr, addr + len);
}
return;
}
if (<API key>()) {
flush_pfn_alias(page_to_pfn(page), uaddr);
__flush_icache_all();
return;
}
/* VIPT non-aliasing D-cache */
if (vma->vm_flags & VM_EXEC) {
unsigned long addr = (unsigned long)kaddr;
if (<API key>())
flush_icache_alias(page_to_pfn(page), uaddr, len);
else
<API key>(addr, addr + len);
if (<API key>())
smp_call_function(<API key>,
NULL, 1);
}
}
/*
* Copy user data from/to a page which is mapped into a different
* processes address space. Really, we want to allow our "user
* space" model to handle this.
*
* Note that this code needs to run on the current CPU.
*/
void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
unsigned long uaddr, void *dst, const void *src,
unsigned long len)
{
#ifdef CONFIG_SMP
preempt_disable();
#endif
memcpy(dst, src, len);
flush_ptrace_access(vma, page, uaddr, dst, len);
#ifdef CONFIG_SMP
preempt_enable();
#endif
}
void __flush_dcache_page(struct address_space *mapping, struct page *page)
{
/*
* Writeback any data associated with the kernel mapping of this
* page. This ensures that data in the physical page is mutually
* coherent with the kernels mapping.
*/
if (!PageHighMem(page)) {
<API key>(page_address(page), PAGE_SIZE);
} else {
void *addr = kmap_high_get(page);
if (addr) {
<API key>(addr, PAGE_SIZE);
kunmap_high(page);
} else if (cache_is_vipt()) {
/* unmapped pages might still be cached */
addr = kmap_atomic(page);
<API key>(addr, PAGE_SIZE);
kunmap_atomic(addr);
}
}
/*
* If this is a page cache page, and we have an aliasing VIPT cache,
* we only need to do one flush - which would be at the relevant
* userspace colour, which is congruent with page->index.
*/
if (mapping && <API key>())
flush_pfn_alias(page_to_pfn(page),
page->index << PAGE_CACHE_SHIFT);
}
static void <API key>(struct address_space *mapping, struct page *page)
{
struct mm_struct *mm = current->active_mm;
struct vm_area_struct *mpnt;
struct prio_tree_iter iter;
pgoff_t pgoff;
/*
* There are possible user space mappings of this page:
* - VIVT cache: we need to also write back and invalidate all user
* data in the current VM view associated with this page.
* - aliasing VIPT: we only need to find one mapping of this page.
*/
pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
<API key>(mapping);
<API key>(mpnt, &iter, &mapping->i_mmap, pgoff, pgoff) {
unsigned long offset;
/*
* If this VMA is not in our MM, we can ignore it.
*/
if (mpnt->vm_mm != mm)
continue;
if (!(mpnt->vm_flags & VM_MAYSHARE))
continue;
offset = (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT;
flush_cache_page(mpnt, mpnt->vm_start + offset, page_to_pfn(page));
}
<API key>(mapping);
}
#if __LINUX_ARM_ARCH__ >= 6
void <API key>(pte_t pteval)
{
unsigned long pfn;
struct page *page;
struct address_space *mapping;
if (!pte_present_user(pteval))
return;
if (<API key>() && !pte_exec(pteval))
/* only flush non-aliasing VIPT caches for exec mappings */
return;
pfn = pte_pfn(pteval);
if (!pfn_valid(pfn))
return;
page = pfn_to_page(pfn);
if (<API key>())
mapping = page_mapping(page);
else
mapping = NULL;
if (!test_and_set_bit(PG_dcache_clean, &page->flags))
__flush_dcache_page(mapping, page);
if (pte_exec(pteval))
__flush_icache_all();
}
#endif
/*
* Ensure cache coherency between kernel mapping and userspace mapping
* of this page.
*
* We have three cases to consider:
* - VIPT non-aliasing cache: fully coherent so nothing required.
* - VIVT: fully aliasing, so we need to handle every alias in our
* current VM view.
* - VIPT aliasing: need to handle one alias in our current VM view.
*
* If we need to handle aliasing:
* If the page only exists in the page cache and there are no user
* space mappings, we can be lazy and remember that we may have dirty
* kernel cache lines for later. Otherwise, we assume we have
* aliasing mappings.
*
* Note that we disable the lazy flush for SMP configurations where
* the cache maintenance operations are not automatically broadcasted.
*/
void flush_dcache_page(struct page *page)
{
struct address_space *mapping;
/*
* The zero page is never written to, so never has any dirty
* cache lines, and therefore never needs to be flushed.
*/
if (page == ZERO_PAGE(0))
return;
mapping = page_mapping(page);
if (!<API key>() &&
mapping && !mapping_mapped(mapping))
clear_bit(PG_dcache_clean, &page->flags);
else {
__flush_dcache_page(mapping, page);
if (mapping && cache_is_vivt())
<API key>(mapping, page);
else if (mapping)
__flush_icache_all();
set_bit(PG_dcache_clean, &page->flags);
}
}
EXPORT_SYMBOL(flush_dcache_page);
/*
* Flush an anonymous page so that users of get_user_pages()
* can safely access the data. The expected sequence is:
*
* get_user_pages()
* -> flush_anon_page
* memcpy() to/from page
* if written to page, flush_dcache_page()
*/
void __flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr)
{
unsigned long pfn;
/* VIPT non-aliasing caches need do nothing */
if (<API key>())
return;
/*
* Write back and invalidate userspace mapping.
*/
pfn = page_to_pfn(page);
if (cache_is_vivt()) {
flush_cache_page(vma, vmaddr, pfn);
} else {
/*
* For aliasing VIPT, we can flush an alias of the
* userspace address only.
*/
flush_pfn_alias(pfn, vmaddr);
__flush_icache_all();
}
/*
* Invalidate kernel mapping. No data should be contained
* in this mapping of the page. FIXME: this is overkill
* since we actually ask for a write-back and invalidate.
*/
<API key>(page_address(page), PAGE_SIZE);
}
|
// STLport regression testsuite component.
// To compile as a separate example, please #define MAIN.
#include <iterator>
#include <vector>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iterator>
#ifdef MAIN
#define partsum1_test main
#endif
#if !defined (STLPORT) || defined(<API key>)
using namespace std;
#endif
int partsum1_test(int, char**)
{
cout<<"Results of partsum1_test:"<<endl;
vector <int> v1(10);
iota(v1.begin(), v1.end(), 0);
vector <int> v2(v1.size());
partial_sum(v1.begin(), v1.end(), v2.begin());
ostream_iterator <int> iter(cout, " ");
copy(v1.begin(), v1.end(), iter);
cout << endl;
copy(v2.begin(), v2.end(), iter);
cout << endl;
return 0;
}
|
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <mach/rpm-regulator.h>
#include <mach/msm_bus_board.h>
#include <mach/msm_bus.h>
#include "mach/socinfo.h"
#include "acpuclock.h"
#include "acpuclock-krait.h"
#ifdef CONFIG_PERFLOCK
#include <mach/perflock.h>
#endif
static struct hfpll_data hfpll_data __initdata = {
.mode_offset = 0x00,
.l_offset = 0x08,
.m_offset = 0x0C,
.n_offset = 0x10,
.config_offset = 0x04,
.config_val = 0x7845C665,
.has_droop_ctl = true,
.droop_offset = 0x14,
.droop_val = 0x0108C000,
.low_vdd_l_max = 22,
.nom_vdd_l_max = 42,
.vdd[HFPLL_VDD_NONE] = 0,
.vdd[HFPLL_VDD_LOW] = 945000,
.vdd[HFPLL_VDD_NOM] = 1050000,
.vdd[HFPLL_VDD_HIGH] = 1150000,
};
static struct scalable scalable[] __initdata = {
[CPU0] = {
.hfpll_phys_base = 0x00903200,
.aux_clk_sel_phys = 0x02088014,
.aux_clk_sel = 3,
.sec_clk_sel = 2,
.l2cpmr_iaddr = 0x4501,
.vreg[VREG_CORE] = { "krait0", 1350000 },
.vreg[VREG_MEM] = { "krait0_mem", 1150000 },
.vreg[VREG_DIG] = { "krait0_dig", 1150000 },
.vreg[VREG_HFPLL_A] = { "krait0_hfpll", 1800000 },
},
[CPU1] = {
.hfpll_phys_base = 0x00903240,
.aux_clk_sel_phys = 0x02098014,
.aux_clk_sel = 3,
.sec_clk_sel = 2,
.l2cpmr_iaddr = 0x5501,
.vreg[VREG_CORE] = { "krait1", 1350000 },
.vreg[VREG_MEM] = { "krait1_mem", 1150000 },
.vreg[VREG_DIG] = { "krait1_dig", 1150000 },
.vreg[VREG_HFPLL_A] = { "krait1_hfpll", 1800000 },
},
[CPU2] = {
.hfpll_phys_base = 0x00903280,
.aux_clk_sel_phys = 0x020A8014,
.aux_clk_sel = 3,
.sec_clk_sel = 2,
.l2cpmr_iaddr = 0x6501,
.vreg[VREG_CORE] = { "krait2", 1350000 },
.vreg[VREG_MEM] = { "krait2_mem", 1150000 },
.vreg[VREG_DIG] = { "krait2_dig", 1150000 },
.vreg[VREG_HFPLL_A] = { "krait2_hfpll", 1800000 },
},
[CPU3] = {
.hfpll_phys_base = 0x009032C0,
.aux_clk_sel_phys = 0x020B8014,
.aux_clk_sel = 3,
.sec_clk_sel = 2,
.l2cpmr_iaddr = 0x7501,
.vreg[VREG_CORE] = { "krait3", 1350000 },
.vreg[VREG_MEM] = { "krait3_mem", 1150000 },
.vreg[VREG_DIG] = { "krait3_dig", 1150000 },
.vreg[VREG_HFPLL_A] = { "krait3_hfpll", 1800000 },
},
[L2] = {
.hfpll_phys_base = 0x00903300,
.aux_clk_sel_phys = 0x02011028,
.aux_clk_sel = 3,
.sec_clk_sel = 2,
.l2cpmr_iaddr = 0x0500,
.vreg[VREG_HFPLL_A] = { "l2_hfpll", 1800000 },
},
};
static struct msm_bus_paths bw_level_tbl[] __initdata = {
[0] = BW_MBPS(640),
[1] = BW_MBPS(1064),
[2] = BW_MBPS(1600),
[3] = BW_MBPS(2128),
[4] = BW_MBPS(3200),
[5] = BW_MBPS(4264),
};
static struct msm_bus_scale_pdata bus_scale_data __initdata = {
.usecase = bw_level_tbl,
.num_usecases = ARRAY_SIZE(bw_level_tbl),
.active_only = 1,
.name = "acpuclk-8064",
};
static struct l2_level l2_freq_tbl[] __initdata = {
[0] = { { 378000, HFPLL, 2, 0x1C }, 950000, 1050000, 1 },
[0] = { { 384000, PLL_8, 0, 0x00 }, 950000, 1050000, 1 },
[1] = { { 432000, HFPLL, 2, 0x20 }, 1050000, 1050000, 2 },
[2] = { { 486000, HFPLL, 2, 0x24 }, 1050000, 1050000, 2 },
[3] = { { 540000, HFPLL, 2, 0x28 }, 1050000, 1050000, 2 },
[4] = { { 594000, HFPLL, 1, 0x16 }, 1050000, 1050000, 2 },
[5] = { { 648000, HFPLL, 1, 0x18 }, 1050000, 1050000, 4 },
[6] = { { 702000, HFPLL, 1, 0x1A }, 1150000, 1150000, 4 },
[7] = { { 756000, HFPLL, 1, 0x1C }, 1150000, 1150000, 4 },
[8] = { { 810000, HFPLL, 1, 0x1E }, 1150000, 1150000, 4 },
[9] = { { 864000, HFPLL, 1, 0x20 }, 1150000, 1150000, 4 },
[10] = { { 918000, HFPLL, 1, 0x22 }, 1150000, 1150000, 5 },
[11] = { { 972000, HFPLL, 1, 0x24 }, 1150000, 1150000, 5 },
[12] = { { 1134000, HFPLL, 1, 0x2A }, 1150000, 1150000, 5 },
[13] = { { 1242000, HFPLL, 1, 0x2E }, 1150000, 1150000, 5 },
[14] = { { 1296000, HFPLL, 1, 0x30 }, 1150000, 1150000, 5 },
[15] = { { 1350000, HFPLL, 1, 0x32 }, 1150000, 1150000, 5 },
[16] = { { 1404000, HFPLL, 1, 0x34 }, 1150000, 1150000, 5 },
[17] = { { 1458000, HFPLL, 1, 0x36 }, 1150000, 1150000, 5 },
{ }
};
static struct acpu_level tbl_slow[] __initdata = {
{ 1, { 162000, HFPLL, 2, 0x0C }, L2(0), 900000 },
{ 1, { 216000, HFPLL, 2, 0x10 }, L2(0), 900000 },
{ 1, { 270000, HFPLL, 2, 0x14 }, L2(0), 900000 },
{ 1, { 324000, HFPLL, 2, 0x18 }, L2(0), 925000 },
{ 1, { 378000, HFPLL, 2, 0x1C }, L2(0), 925000 },
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 950000 },
{ 0, { 432000, HFPLL, 2, 0x20 }, L2(5), 975000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 975000 },
{ 0, { 540000, HFPLL, 2, 0x28 }, L2(5), 1000000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 1000000 },
{ 0, { 648000, HFPLL, 1, 0x18 }, L2(5), 1025000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 1025000 },
{ 0, { 756000, HFPLL, 1, 0x1C }, L2(5), 1075000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 1075000 },
{ 0, { 864000, HFPLL, 1, 0x20 }, L2(5), 1100000 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 1100000 },
{ 0, { 972000, HFPLL, 1, 0x24 }, L2(5), 1125000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 1125000 },
{ 0, { 1080000, HFPLL, 1, 0x28 }, L2(14), 1175000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 1175000 },
{ 0, { 1188000, HFPLL, 1, 0x2C }, L2(14), 1200000 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 1200000 },
{ 0, { 1296000, HFPLL, 1, 0x30 }, L2(14), 1225000 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(15), 1225000 },
{ 0, { 1404000, HFPLL, 1, 0x34 }, L2(15), 1237500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(15), 1237500 },
{ 1, { 1512000, HFPLL, 1, 0x38 }, L2(15), 1250000 },
{ 0, { 0 } }
};
static struct acpu_level tbl_nom[] __initdata = {
{ 1, { 162000, HFPLL, 2, 0x0C }, L2(0), 900000 },
{ 1, { 216000, HFPLL, 2, 0x10 }, L2(0), 900000 },
{ 1, { 270000, HFPLL, 2, 0x14 }, L2(0), 900000 },
{ 1, { 324000, HFPLL, 2, 0x18 }, L2(0), 925000 },
{ 1, { 378000, HFPLL, 2, 0x1C }, L2(0), 925000 },
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 900000 },
{ 0, { 432000, HFPLL, 2, 0x20 }, L2(5), 925000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 925000 },
{ 0, { 540000, HFPLL, 2, 0x28 }, L2(5), 950000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 950000 },
{ 0, { 648000, HFPLL, 1, 0x18 }, L2(5), 975000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 975000 },
{ 0, { 756000, HFPLL, 1, 0x1C }, L2(5), 1025000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 1025000 },
{ 0, { 864000, HFPLL, 1, 0x20 }, L2(5), 1050000 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 1050000 },
{ 0, { 972000, HFPLL, 1, 0x24 }, L2(5), 1075000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 1075000 },
{ 0, { 1080000, HFPLL, 1, 0x28 }, L2(14), 1125000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 1125000 },
{ 0, { 1188000, HFPLL, 1, 0x2C }, L2(14), 1150000 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 1150000 },
{ 0, { 1296000, HFPLL, 1, 0x30 }, L2(14), 1175000 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(15), 1175000 },
{ 0, { 1404000, HFPLL, 1, 0x34 }, L2(15), 1187500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(15), 1187500 },
{ 1, { 1512000, HFPLL, 1, 0x38 }, L2(15), 1200000 },
{ 0, { 0 } }
};
static struct acpu_level tbl_fast[] __initdata = {
{ 1, { 162000, HFPLL, 2, 0x0C }, L2(0), 900000 },
{ 1, { 216000, HFPLL, 2, 0x10 }, L2(0), 900000 },
{ 1, { 270000, HFPLL, 2, 0x14 }, L2(0), 900000 },
{ 1, { 324000, HFPLL, 2, 0x18 }, L2(0), 925000 },
{ 1, { 378000, HFPLL, 2, 0x1C }, L2(0), 925000 },
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 850000 },
{ 0, { 432000, HFPLL, 2, 0x20 }, L2(5), 875000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 875000 },
{ 0, { 540000, HFPLL, 2, 0x28 }, L2(5), 900000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 900000 },
{ 0, { 648000, HFPLL, 1, 0x18 }, L2(5), 925000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 925000 },
{ 0, { 756000, HFPLL, 1, 0x1C }, L2(5), 975000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 975000 },
{ 0, { 864000, HFPLL, 1, 0x20 }, L2(5), 1000000 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 1000000 },
{ 0, { 972000, HFPLL, 1, 0x24 }, L2(5), 1025000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 1025000 },
{ 0, { 1080000, HFPLL, 1, 0x28 }, L2(14), 1075000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 1075000 },
{ 0, { 1188000, HFPLL, 1, 0x2C }, L2(14), 1100000 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 1100000 },
{ 0, { 1296000, HFPLL, 1, 0x30 }, L2(14), 1125000 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(15), 1125000 },
{ 0, { 1404000, HFPLL, 1, 0x34 }, L2(15), 1137500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(15), 1137500 },
{ 1, { 1512000, HFPLL, 1, 0x38 }, L2(15), 1150000 },
{ 0, { 0 } }
};
static struct acpu_level tbl_faster[] __initdata = {
{ 1, { 162000, HFPLL, 2, 0x0C }, L2(0), 900000 },
{ 1, { 216000, HFPLL, 2, 0x10 }, L2(0), 900000 },
{ 1, { 270000, HFPLL, 2, 0x14 }, L2(0), 900000 },
{ 1, { 324000, HFPLL, 2, 0x18 }, L2(0), 925000 },
{ 1, { 378000, HFPLL, 2, 0x1C }, L2(0), 925000 },
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 850000 },
{ 0, { 432000, HFPLL, 2, 0x20 }, L2(5), 875000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 875000 },
{ 0, { 540000, HFPLL, 2, 0x28 }, L2(5), 900000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 900000 },
{ 0, { 648000, HFPLL, 1, 0x18 }, L2(5), 925000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 925000 },
{ 0, { 756000, HFPLL, 1, 0x1C }, L2(5), 962500 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 962500 },
{ 0, { 864000, HFPLL, 1, 0x20 }, L2(5), 975000 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 975000 },
{ 0, { 972000, HFPLL, 1, 0x24 }, L2(5), 1000000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 1000000 },
{ 0, { 1080000, HFPLL, 1, 0x28 }, L2(14), 1050000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 1050000 },
{ 0, { 1188000, HFPLL, 1, 0x2C }, L2(14), 1075000 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 1075000 },
{ 0, { 1296000, HFPLL, 1, 0x30 }, L2(14), 1100000 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(15), 1100000 },
{ 0, { 1404000, HFPLL, 1, 0x34 }, L2(15), 1112500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(15), 1112500 },
{ 1, { 1512000, HFPLL, 1, 0x38 }, L2(15), 1125000 },
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS0_1700MHz[] __initdata = {
{ 1, { 162000, HFPLL, 2, 0x0C }, L2(0), 900000 },
{ 1, { 216000, HFPLL, 2, 0x10 }, L2(0), 900000 },
{ 1, { 270000, HFPLL, 2, 0x14 }, L2(0), 900000 },
{ 1, { 324000, HFPLL, 2, 0x18 }, L2(0), 925000 },
{ 1, { 378000, HFPLL, 2, 0x1C }, L2(0), 925000 },
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 950000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 950000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 950000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 962500 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 1000000 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 1025000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 1037500 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 1075000 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 1087500 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(15), 1125000 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(15), 1150000 },
{ 1, { 1512000, HFPLL, 1, 0x38 }, L2(15), 1150000 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(15), 1175000 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(15), 1150000 },
{ 1, { 1728000, HFPLL, 1, 0x40 }, L2(15), 1175000 },
#ifdef CONFIG_CPU_OC
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(15), 1175000 },
{ 1, { 1836000, HFPLL, 1, 0x44 }, L2(15), 1200000 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(15), 1225000 },
#endif
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS1_1700MHz[] __initdata = {
{ 1, { 162000, HFPLL, 2, 0x0C }, L2(0), 900000 },
{ 1, { 216000, HFPLL, 2, 0x10 }, L2(0), 900000 },
{ 1, { 270000, HFPLL, 2, 0x14 }, L2(0), 900000 },
{ 1, { 324000, HFPLL, 2, 0x18 }, L2(0), 925000 },
{ 1, { 378000, HFPLL, 2, 0x1C }, L2(0), 925000 },
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 950000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 950000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 950000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 962500 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 975000 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 1000000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 1012500 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 1037500 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 1050000 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(15), 1087500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(15), 1112500 },
{ 1, { 1512000, HFPLL, 1, 0x38 }, L2(15), 1150000 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(15), 1150000 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(15), 1150000 },
{ 1, { 1728000, HFPLL, 1, 0x40 }, L2(15), 1175000 },
#ifdef CONFIG_CPU_OC
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(15), 1175000 },
{ 1, { 1836000, HFPLL, 1, 0x44 }, L2(15), 1200000 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(15), 1225000 },
#endif
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS2_1700MHz[] __initdata = {
{ 1, { 162000, HFPLL, 2, 0x0C }, L2(0), 900000 },
{ 1, { 216000, HFPLL, 2, 0x10 }, L2(0), 900000 },
{ 1, { 270000, HFPLL, 2, 0x14 }, L2(0), 900000 },
{ 1, { 324000, HFPLL, 2, 0x18 }, L2(0), 925000 },
{ 1, { 378000, HFPLL, 2, 0x1C }, L2(0), 925000 },
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 925000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 925000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 925000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 925000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 937500 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 950000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 975000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 1000000 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 1012500 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(15), 1037500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(15), 1075000 },
{ 1, { 1512000, HFPLL, 1, 0x38 }, L2(15), 1150000 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(15), 1100000 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(15), 1125000 },
{ 1, { 1728000, HFPLL, 1, 0x40 }, L2(15), 1150000 },
#ifdef CONFIG_CPU_OC
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(15), 1150000 },
{ 1, { 1836000, HFPLL, 1, 0x44 }, L2(15), 1175000 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(15), 1225000 },
#endif
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS3_1700MHz[] __initdata = {
{ 1, { 162000, HFPLL, 2, 0x0C }, L2(0), 900000 },
{ 1, { 216000, HFPLL, 2, 0x10 }, L2(0), 900000 },
{ 1, { 270000, HFPLL, 2, 0x14 }, L2(0), 900000 },
{ 1, { 324000, HFPLL, 2, 0x18 }, L2(0), 925000 },
{ 1, { 378000, HFPLL, 2, 0x1C }, L2(0), 925000 },
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 900000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 900000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 900000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 900000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 900000 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 925000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 950000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 975000 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 987500 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(15), 1000000 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(15), 1037500 },
{ 1, { 1512000, HFPLL, 1, 0x38 }, L2(15), 1150000 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(15), 1062500 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(15), 1100000 },
{ 1, { 1728000, HFPLL, 1, 0x40 }, L2(15), 1125000 },
#ifdef CONFIG_CPU_OC
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(15), 1125000 },
{ 1, { 1836000, HFPLL, 1, 0x44 }, L2(15), 1150000 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(15), 1175000 },
#endif
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS4_1700MHz[] __initdata = {
{ 1, { 162000, HFPLL, 2, 0x0C }, L2(0), 900000 },
{ 1, { 216000, HFPLL, 2, 0x10 }, L2(0), 900000 },
{ 1, { 270000, HFPLL, 2, 0x14 }, L2(0), 900000 },
{ 1, { 324000, HFPLL, 2, 0x18 }, L2(0), 925000 },
{ 1, { 378000, HFPLL, 2, 0x1C }, L2(0), 925000 },
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 875000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 875000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 875000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 875000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 887500 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 900000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 925000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 950000 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 962500 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(15), 975000 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(15), 1000000 },
{ 1, { 1512000, HFPLL, 1, 0x38 }, L2(15), 1150000 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(15), 1037500 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(15), 1075000 },
{ 1, { 1728000, HFPLL, 1, 0x40 }, L2(15), 1100000 },
#ifdef CONFIG_CPU_OC
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(15), 1125000 },
{ 1, { 1836000, HFPLL, 1, 0x44 }, L2(15), 1150000 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(15), 1175000 },
#endif
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS5_1700MHz[] __initdata = {
{ 1, { 162000, HFPLL, 2, 0x0C }, L2(0), 900000 },
{ 1, { 216000, HFPLL, 2, 0x10 }, L2(0), 900000 },
{ 1, { 270000, HFPLL, 2, 0x14 }, L2(0), 900000 },
{ 1, { 324000, HFPLL, 2, 0x18 }, L2(0), 925000 },
{ 1, { 378000, HFPLL, 2, 0x1C }, L2(0), 925000 },
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 875000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 875000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 875000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 875000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 887500 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 900000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 925000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 937500 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 950000 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(15), 962500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(15), 987500 },
{ 1, { 1512000, HFPLL, 1, 0x38 }, L2(15), 1150000 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(15), 1012500 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(15), 1050000 },
{ 1, { 1728000, HFPLL, 1, 0x40 }, L2(15), 1075000 },
#ifdef CONFIG_CPU_OC
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(15), 1125000 },
{ 1, { 1836000, HFPLL, 1, 0x44 }, L2(15), 1150000 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(15), 1175000 },
#endif
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS6_1700MHz[] __initdata = {
{ 1, { 162000, HFPLL, 2, 0x0C }, L2(0), 900000 },
{ 1, { 216000, HFPLL, 2, 0x10 }, L2(0), 900000 },
{ 1, { 270000, HFPLL, 2, 0x14 }, L2(0), 900000 },
{ 1, { 324000, HFPLL, 2, 0x18 }, L2(0), 925000 },
{ 1, { 378000, HFPLL, 2, 0x1C }, L2(0), 925000 },
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 875000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 875000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 875000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 875000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 887500 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 900000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 925000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 937500 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 950000 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(15), 962500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(15), 975000 },
{ 1, { 1512000, HFPLL, 1, 0x38 }, L2(15), 1150000 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(15), 1000000 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(15), 1025000 },
{ 1, { 1728000, HFPLL, 1, 0x40 }, L2(15), 1050000 },
#ifdef CONFIG_CPU_OC
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(15), 1100000 },
{ 1, { 1836000, HFPLL, 1, 0x44 }, L2(15), 1125000 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(15), 1175000 },
#endif
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS0_2000MHz[] __initdata = {
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 950000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 950000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 950000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 950000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 962500 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 975000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 1000000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 1025000 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 1037500 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(14), 1062500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(14), 1100000 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(14), 1125000 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(14), 1175000 },
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(14), 1225000 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(14), 1287500 },
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS1_2000MHz[] __initdata = {
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 925000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 925000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 925000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 925000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 937500 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 950000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 975000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 1000000 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 1012500 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(14), 1037500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(14), 1075000 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(14), 1100000 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(14), 1137500 },
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(14), 1187500 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(14), 1250000 },
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS2_2000MHz[] __initdata = {
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 900000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 900000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 900000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 900000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 912500 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 925000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 950000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 975000 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 987500 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(14), 1012500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(14), 1050000 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(14), 1075000 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(14), 1112500 },
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(14), 1162500 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(14), 1212500 },
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS3_2000MHz[] __initdata = {
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 900000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 900000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 900000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 900000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 900000 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 912500 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 937500 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 962500 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 975000 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(14), 1000000 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(14), 1025000 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(14), 1050000 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(14), 1087500 },
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(14), 1137500 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(14), 1175000 },
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS4_2000MHz[] __initdata = {
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 875000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 875000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 875000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 875000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 887500 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 900000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 925000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 950000 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 962500 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(14), 975000 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(14), 1000000 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(14), 1037500 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(14), 1075000 },
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(14), 1112500 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(14), 1150000 },
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS5_2000MHz[] __initdata = {
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 875000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 875000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 875000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 875000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 887500 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 900000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 925000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 937500 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 950000 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(14), 962500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(14), 987500 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(14), 1012500 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(14), 1050000 },
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(14), 1087500 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(14), 1125000 },
{ 0, { 0 } }
};
static struct acpu_level tbl_PVS6_2000MHz[] __initdata = {
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 875000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 875000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 875000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 875000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 887500 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 900000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 925000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 937500 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 950000 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(14), 962500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(14), 975000 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(14), 1000000 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(14), 1025000 },
{ 1, { 1782000, HFPLL, 1, 0x42 }, L2(14), 1062500 },
{ 1, { 1890000, HFPLL, 1, 0x46 }, L2(14), 1100000 },
{ 0, { 0 } }
};
static struct pvs_table pvs_tables[NUM_SPEED_BINS][NUM_PVS] __initdata = {
[0][PVS_SLOW] = {tbl_slow, sizeof(tbl_slow), 0 },
[0][PVS_NOMINAL] = {tbl_nom, sizeof(tbl_nom), 25000 },
[0][PVS_FAST] = {tbl_fast, sizeof(tbl_fast), 25000 },
[0][PVS_FASTER] = {tbl_faster, sizeof(tbl_faster), 25000 },
[1][0] = { tbl_PVS0_1700MHz, sizeof(tbl_PVS0_1700MHz), 0 },
[1][1] = { tbl_PVS1_1700MHz, sizeof(tbl_PVS1_1700MHz), 25000 },
[1][2] = { tbl_PVS2_1700MHz, sizeof(tbl_PVS2_1700MHz), 25000 },
[1][3] = { tbl_PVS3_1700MHz, sizeof(tbl_PVS3_1700MHz), 25000 },
[1][4] = { tbl_PVS4_1700MHz, sizeof(tbl_PVS4_1700MHz), 25000 },
[1][5] = { tbl_PVS5_1700MHz, sizeof(tbl_PVS5_1700MHz), 25000 },
[1][6] = { tbl_PVS6_1700MHz, sizeof(tbl_PVS6_1700MHz), 25000 },
[2][0] = { tbl_PVS0_2000MHz, sizeof(tbl_PVS0_2000MHz), 0 },
[2][1] = { tbl_PVS1_2000MHz, sizeof(tbl_PVS1_2000MHz), 25000 },
[2][2] = { tbl_PVS2_2000MHz, sizeof(tbl_PVS2_2000MHz), 25000 },
[2][3] = { tbl_PVS3_2000MHz, sizeof(tbl_PVS3_2000MHz), 25000 },
[2][4] = { tbl_PVS4_2000MHz, sizeof(tbl_PVS4_2000MHz), 25000 },
[2][5] = { tbl_PVS5_2000MHz, sizeof(tbl_PVS5_2000MHz), 25000 },
[2][6] = { tbl_PVS6_2000MHz, sizeof(tbl_PVS6_2000MHz), 25000 },
};
static struct <API key> acpuclk_8064_params __initdata = {
.scalable = scalable,
.scalable_size = sizeof(scalable),
.hfpll_data = &hfpll_data,
.pvs_tables = pvs_tables,
.l2_freq_tbl = l2_freq_tbl,
.l2_freq_tbl_size = sizeof(l2_freq_tbl),
.bus_scale = &bus_scale_data,
.pte_efuse_phys = 0x007000C0,
.stby_khz = 384000,
};
static int __init acpuclk_8064_probe(struct platform_device *pdev)
{
int ret;
if (cpu_is_apq8064ab() ||
<API key>(socinfo_get_version()) == 2) {
acpuclk_8064_params.hfpll_data->low_vdd_l_max = 37;
acpuclk_8064_params.hfpll_data->nom_vdd_l_max = 74;
}
ret = acpuclk_krait_init(&pdev->dev, &acpuclk_8064_params);
return ret;
}
static struct platform_driver acpuclk_8064_driver = {
.driver = {
.name = "acpuclk-8064",
.owner = THIS_MODULE,
},
};
static int __init acpuclk_8064_init(void)
{
return <API key>(&acpuclk_8064_driver,
acpuclk_8064_probe);
}
device_initcall(acpuclk_8064_init);
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* memset */
#include <libwzd-core/wzd_structs.h>
#include <libwzd-core/wzd_crc32.h>
#define C1 0x12345678
#define C2 0x9abcdef0
int main(int argc, char *argv[])
{
unsigned long c1 = C1;
unsigned long crc = 0x0;
char input1[1024];
const char * file1 = "file_crc.txt";
const unsigned long crc_ref = 0xEB2FAFAF; /* cksfv file_crc.txt */
char * srcdir = NULL;
unsigned long c2 = C2;
if (argc > 1) {
srcdir = argv[1];
} else {
srcdir = getenv("srcdir");
if (srcdir == NULL) {
fprintf(stderr, "Environment variable $srcdir not found, aborting\n");
return 1;
}
}
snprintf(input1,sizeof(input1)-1,"%s/%s",srcdir,file1);
if ( calc_crc32(input1,&crc,0,(unsigned long)-1) ) {
fprintf(stderr, "calc_crc32 failed\n");
return 1;
}
if ( crc != crc_ref ) {
fprintf(stderr, "calc_crc32 returned crap\n");
return 1;
}
if (c1 != C1) {
fprintf(stderr, "c1 nuked !\n");
return -1;
}
if (c2 != C2) {
fprintf(stderr, "c2 nuked !\n");
return -1;
}
return 0;
}
|
import json
import bottle
from pyrouted.util import make_spec
def route(method, path):
def decorator(f):
f.http_route = path
f.http_method = method
return f
return decorator
class APIv1(object):
prefix = '/v1'
def __init__(self, ndb, config):
self.ndb = ndb
self.config = config
@route('GET', '/sources')
def sources_list(self, mode='short'):
ret = {}
mode = bottle.request.query.mode or mode
for name, spec in self.ndb.sources.items():
ret[name] = {'class': spec.nl.__class__.__name__,
'status': spec.status}
if mode == 'full':
ret[name]['config'] = spec.nl_kwarg
return bottle.template('{{!ret}}', ret=json.dumps(ret))
@route('PUT', '/sources')
def sources_restart(self):
node = bottle.request.body.getvalue().decode('utf-8')
self.ndb.sources[node].start()
@route('POST', '/sources')
def sources_add(self):
data = bottle.request.body.getvalue().decode('utf-8')
node, spec = make_spec(data, self.config)
self.config['sources'].append(node)
self.ndb.connect_source(node, spec)
@route('DELETE', '/sources')
def sources_del(self):
node = bottle.request.body.getvalue().decode('utf-8')
self.config['sources'].remove(node)
self.ndb.disconnect_source(node)
@route('GET', '/config')
def config_get(self):
return bottle.template('{{!ret}}',
ret=json.dumps(self.config))
@route('PUT', '/config')
def config_dump(self):
path = bottle.request.body.getvalue().decode('utf-8')
self.config.dump(path)
@route('GET', '/<name:re:(%s|%s|%s|%s|%s|%s)>' % ('interfaces',
'addresses',
'routes',
'neighbours',
'vlans',
'bridges'))
def view(self, name):
ret = []
obj = getattr(self.ndb, name)
for line in obj.dump():
ret.append(line)
return bottle.template('{{!ret}}', ret=json.dumps(ret))
@route('GET', '/query/<name:re:(%s|%s|%s|%s)>' % ('nodes',
'p2p_edges',
'l2_edges',
'l3_edges'))
def query(self, name):
ret = []
obj = getattr(self.ndb.query, name)
for line in obj():
ret.append(line)
return bottle.template('{{!ret}}', ret=json.dumps(ret))
|
\documentclass{article}
\usepackage{epsfig}
\usepackage{color}
\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[german]{babel}
\usepackage{helvet}
\selectlanguage{german}
\oddsidemargin15pt
\evensidemargin15pt
\textheight25mm
\textwidth20cm
\begin{document}
\definecolor{bunt}{rgb}{1.0,1.0,0.9}
\thispagestyle{empty}
\sffamily
\LARGE
\pagecolor{black}
\color{white}
\noindent
Die zwei Brennpunkte der Marsbahn werden mit
einem \color{red}roten +\color{white} ~markiert.
Die Sonne steht in einem Brennpunkt der Bahn.
\end{document}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.