code
stringlengths 3
1.05M
| repo_name
stringlengths 4
116
| path
stringlengths 3
942
| language
stringclasses 30
values | license
stringclasses 15
values | size
int32 3
1.05M
|
---|---|---|---|---|---|
# จงเขียนโปรแกรมแสดงเลขคู่ในช่วง 0 ถึง 10 (รวม 10 ด้วย)
for i in range(11):
if (i % 2 == 0):
print(i) | supasate/word_prediction | Chapter4/4-7-even-solution.py | Python | gpl-2.0 | 193 |
# healthydesires.com.au
A Jekyll based website for healthydesires.com.au by [Bradly Sharpe IT](http://bradlysharpe.com.au)
### Build Status
[](https://travis-ci.org/brad7928/healthydesires.com.au) | brad7928/healthydesires.com.au-old | README.md | Markdown | gpl-2.0 | 285 |
// RUN: %clang_cc1 -analyze -inline-call -analyzer-store region -analyze-function f2 -verify %s
// Test parameter 'a' is registered to LiveVariables analysis data although it
// is not referenced in the function body.
// Before processing 'return 1;', in RemoveDeadBindings(), we query the liveness
// of 'a', because we have a binding for it due to parameter passing.
int f1(int a) {
return 1;
}
void f2() {
int x;
x = f1(1);
}
| vrtadmin/clamav-bytecode-compiler | clang/test/Analysis/inline2.c | C | gpl-2.0 | 438 |
<?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-ca">
<head>
<?php $this->RenderAsset('Head'); ?>
<meta property="qc:admins" content="266656217765113126654" />
</head>
<body id="<?php echo $BodyIdentifier; ?>" class="<?php echo $this->CssClass; ?>">
<div id="Frame">
<div id="Head">
<div class="Menu">
<h1><a class="Title" href="<?php echo Url('/'); ?>"><span><?php echo Gdn_Theme::Logo(); ?></span></a></h1>
<?php
$Session = Gdn::Session();
if ($this->Menu) {
$this->Menu->AddLink('Dashboard', T('Dashboard'), '/dashboard/settings', array('Garden.Settings.Manage'));
// $this->Menu->AddLink('Dashboard', T('Users'), '/user/browse', array('Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete'));
$this->Menu->AddLink('Activity', T('Activity'), '/activity');
if ($Session->IsValid()) {
$Name = $Session->User->Name;
$CountNotifications = $Session->User->CountNotifications;
if (is_numeric($CountNotifications) && $CountNotifications > 0)
$Name .= ' <span class="Alert">'.$CountNotifications.'</span>';
if (urlencode($Session->User->Name) == $Session->User->Name)
$ProfileSlug = $Session->User->Name;
else
$ProfileSlug = $Session->UserID.'/'.urlencode($Session->User->Name);
$this->Menu->AddLink('User', $Name, '/profile/'.$ProfileSlug, array('Garden.SignIn.Allow'), array('class' => 'UserNotifications'));
$this->Menu->AddLink('SignOut', T('Sign Out'), SignOutUrl(), FALSE, array('class' => 'NonTab SignOut'));
} else {
$Attribs = array();
if (SignInPopup() && strpos(Gdn::Request()->Url(), 'entry') === FALSE)
$Attribs['class'] = 'SignInPopup';
$this->Menu->AddLink('Entry', T('Sign In'), SignInUrl($this->SelfUrl), FALSE, array('class' => 'NonTab'), $Attribs);
}
echo $this->Menu->ToString();
}
?>
<div class="Search"><?php
$Form = Gdn::Factory('Form');
$Form->InputPrefix = '';
echo
$Form->Open(array('action' => Url('/search'), 'method' => 'get')),
$Form->TextBox('Search'),
$Form->Button('Go', array('Name' => '')),
$Form->Close();
?></div>
</div>
</div>
<div id="Body">
<div id="Content"><?php $this->RenderAsset('Content'); ?></div>
<div id="Panel"><?php $this->RenderAsset('Panel'); ?></div>
</div>
<div id="Foot">
<?php
$this->RenderAsset('Foot');
echo Wrap(Anchor(T('Powered by Vanilla'), C('Garden.VanillaUrl')), 'div');
?>
</div>
</div>
<?php $this->FireEvent('AfterBody'); ?>
</body>
</html>
| ttym7993/Garden | applications/dashboard/views/default.master.php | PHP | gpl-2.0 | 2,898 |
var ModuleManager = (function(){
//Directorio donde se encuentran los modulos
const BASE_PATH = "js/modules/";
//modules
var modules = {
"templateManager":{
"className":"TemplateManager",
"fileName":"templateManagerModule.js",
"order":1,
"loaded":false,
"dependences":null,
"instance":null
},
"preferences":{
"className":"Preferences",
"fileName":"preferencesModule.js",
"order":1,
"loaded":false,
"dependences":["templateManager"],
"instance":null
},
"logger":{
"className":"Logger",
"fileName":"logModule.js",
"order":2,
"loaded":false,
"dependences":null,
"instance":null
},
"webSpeech":{
"className":"WebSpeech",
"fileName":"webSpeechModule.js",
"order":3,
"loaded":false,
"dependences":null,
"instance":null
},
"utils":{
"className":"Utils",
"fileName":"utils.js",
"order":4,
"loaded":false,
"dependences":null,
"instance":null
},
"serviceLocator":{
"className":"ServiceLocator",
"fileName":"serviceLocatorModule.js",
"order":3,
"loaded":false,
"dependences":["logger","utils"],
"instance":null
},
"geoLocation":{
"className":"GeoLocation",
"fileName":"geolocationModule.js",
"order":4,
"loaded":false,
"dependences":["serviceLocator"],
"instance":null
},
"notificator":{
"className":"Notificator",
"fileName":"notificationsModule.js",
"order":5,
"loaded":false,
"dependences":["templateManager"],
"instance":null
},
"applicationsManager":{
"className":"ApplicationsManager",
"fileName":"applicationsModule.js",
"order":6,
"loaded":false,
"dependences":["templateManager","serviceLocator","notificator"],
"instance":null
},
"searchs":{
"className":"Searchs",
"fileName":"searchsModule.js",
"order":7,
"loaded":false,
"dependences":["templateManager","serviceLocator","webSpeech","applicationsManager","notificator"],
"instance":null
},
"contacts":{
"className":"Contacts",
"fileName":"contactsModule.js",
"order":8,
"loaded":false,
"dependences":["templateManager","serviceLocator","webSpeech","notificator","geoLocation"],
"instance":null
},
"gui":{
"className":"GUI",
"fileName":"guiModule.js",
"order":9,
"loaded":false,
"dependences":["serviceLocator","searchs","contacts","applicationsManager","notificator"],
"instance":null
}
};
/**
* Devuelve las dependencias a partir de los nombres.
*
* @param {Array} arr: names of the dependencies
* @return {Array} dependencies to bind
*/
var getDependencies = function(arr) {
return arr instanceof Array && arr.length ? arr.map(function (value) {
var o = modules[value] && modules[value].instance;
if (!o) {
throw new Error('Dependency ' + value + ' not found');
}else{
return o;
}
}) : false;
}
/**
* Extrae los nombres de las dependencias a inyectar.
*
* @param {Function} target: function to process
* @return {Array}
*/
var getArgs = function(target) {
if (!target instanceof Function) {
throw new TypeError('Target to process should be a Function');
}else{
var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
var COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var SPACES = /[\s|\t|\n|\r]+/mg;
var result = target.toString().match(FN_ARGS);
//Comprobamos si existe alguna dependencia a inyectar
if(result && result[1])
var args = result[1].replace(COMMENTS,'').replace(SPACES,'').split(',');
else
var args = false;
return args;
}
}
/**
* Crea el objeto con las dependencias previamente inyectadas.
*
* @param {Function} constructor: function to call as constructor
* @return {Object} object created from its constructor
*/
var create = function(constructor) {
var args = getArgs(constructor);
if (args) {
var args = [null].concat(getDependencies(args));
var o = new (Function.prototype.bind.apply(constructor, args))();
}else{
var o = new (Function.prototype.bind.apply(constructor))();
}
return o;
}
var loadScript = function(src, callback) {
var s,r,t;
r = false ;
s = document. createElement ('script' );
s.type = 'text/javascript' ;
s.src = src;
s.onload = s.onreadystatechange = function () {
if ( !r && (!this .readyState || this .readyState == 'complete' )){
r = true ;
typeof(callback) == "function" && callback();
}
};
t = document.getElementsByTagName ('script')[0];
t.parentNode.insertBefore (s, t);
}
var downloadModules = function(callback){
console.log(modules);
for(var module in modules)
(function(currentModule){
loadScript(BASE_PATH+currentModule.fileName,function(){
currentModule.loaded = true;
Object.keys(modules).map(function(key){
return modules[key].loaded;
}).indexOf(false) == -1 && typeof(callback) == "function" && callback();
});
})(modules[module]);
}
var loadModules = function(callback){
downloadModules(function(){
for(var module in modules){
console.log("Cargando Módulo : " + modules[module].className);
modules[module].instance = create(window[modules[module].className]);
delete window[modules[module].className];
}
typeof(callback) == "function" && callback();
});
}
//API pública
return{
loadModules:loadModules
}
})(); | sergio11/teVeo | js/managerModule.js | JavaScript | gpl-2.0 | 6,834 |
# ionic-audioguide
An audioguide app with geolocation and media streaming support for the ionic framework
# Howto
These files will not run standalone, you have to create a new ionic app to make use of them. The interesting code is in www/js/controllers.js and www/js/app.js
# Webserver and JSON
You will need a webserver which serves the media files and handles the JSON requests.
# Cordova plugins
Listing of needed cordova plugins in cordova-plugins.txt.
# License
Copyright (c) 2015 Felix Herrmann (github.com/hfx)
Licensed under GPL v2.
Code for the AudiostationsCtrl controller adapted from https://github.com/devgeeks/ExampleHTML5AudioStreaming/blob/master/www/scripts/html5audio.js, Copyright (c) 2011 Tommy-Carlos Williams (github.com/devgeeks).
This part of code is licensed under The MIT license by the original author, please see https://github.com/devgeeks/ExampleHTML5AudioStreaming#license
| hfx/ionic-audioguide | README.md | Markdown | gpl-2.0 | 913 |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>DOM.Node</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" href="../common/doxygen.css" />
<link rel="stylesheet" media="screen" type="text/css" title="KDE Colors" href="../common/kde.css" />
</head>
<body>
<div id="container">
<div id="header">
<div id="header_top">
<div>
<div>
<img alt ="" src="../common/top-kde.jpg"/>
KDE 4.9 PyKDE API Reference
</div>
</div>
</div>
<div id="header_bottom">
<div id="location">
<ul>
<li>KDE's Python API</li>
</ul>
</div>
<div id="menu">
<ul>
<li><a href="../modules.html">Overview</a></li>
<li><a href="http://techbase.kde.org/Development/Languages/Python">PyKDE Home</a></li>
<li><a href="http://kde.org/family/">Sitemap</a></li>
<li><a href="http://kde.org/contact/">Contact Us</a></li>
</ul>
</div>
</div>
</div>
<div id="body_wrapper">
<div id="body">
<div id="right">
<div class="content">
<div id="main">
<div class="clearer"> </div>
<h1>Node Class Reference</h1>
<code>from PyKDE4.khtml import *</code>
<p>
Subclasses: <a href="../khtml/DOM.Document.html">DOM.Document</a>, <a href="../khtml/DOM.DocumentFragment.html">DOM.DocumentFragment</a>, <a href="../khtml/DOM.DocumentType.html">DOM.DocumentType</a>, <a href="../khtml/DOM.Attr.html">DOM.Attr</a>, <a href="../khtml/DOM.Element.html">DOM.Element</a>, <a href="../khtml/DOM.CharacterData.html">DOM.CharacterData</a>, <a href="../khtml/DOM.Entity.html">DOM.Entity</a>, <a href="../khtml/DOM.EntityReference.html">DOM.EntityReference</a>, <a href="../khtml/DOM.Notation.html">DOM.Notation</a>, <a href="../khtml/DOM.ProcessingInstruction.html">DOM.ProcessingInstruction</a><br />
Namespace: <a href="../khtml/DOM.html">DOM</a><br />
<h2>Detailed Description</h2>
<p>The Node interface is the primary datatype for the
entire Document Object Model. It represents a single node in the
document tree. While all objects implementing the Node
interface expose methods for dealing with children, not all
objects implementing the Node interface may have
children. For example, Text nodes may not have
children, and adding children to such nodes results in a
DOMException being raised.
</p>
<p>
The attributes nodeName , nodeValue
and attributes are included as a mechanism to get at
node information without casting down to the specific derived
interface. In cases where there is no obvious mapping of these
attributes for a specific nodeType (e.g.,
nodeValue for an Element or attributes for a
Comment), this returns null . Note that the
specialized interfaces may contain additional and more convenient
mechanisms to get and set the relevant information.
</p>
<table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2"><br><h2>Enumerations</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="#DocumentPosition">DocumentPosition</a> </td><td class="memItemRight" valign="bottom">{ DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_PRECEDING, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC }</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="#NodeType">NodeType</a> </td><td class="memItemRight" valign="bottom">{ ELEMENT_NODE, ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, ENTITY_REFERENCE_NODE, ENTITY_NODE, PROCESSING_INSTRUCTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, DOCUMENT_FRAGMENT_NODE, NOTATION_NODE, XPATH_NAMESPACE_NODE }</td></tr>
<tr><td colspan="2"><br><h2>Methods</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#Node">__init__</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#Node">__init__</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#addEventListener">addEventListener</a> (self, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> type, <a href="../khtml/DOM.EventListener.html">DOM.EventListener</a> listener, bool useCapture)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#appendChild">appendChild</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> newChild)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#applyChanges">applyChanges</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.NamedNodeMap.html">DOM.NamedNodeMap</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#attributes">attributes</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.NodeList.html">DOM.NodeList</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#childNodes">childNodes</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#cloneNode">cloneNode</a> (self, bool deep)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned </td><td class="memItemRight" valign="bottom"><a class="el" href="#compareDocumentPosition">compareDocumentPosition</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#dispatchEvent">dispatchEvent</a> (self, <a href="../khtml/DOM.Event.html">DOM.Event</a> evt)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="#elementId">elementId</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#firstChild">firstChild</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int _x, int _y, int height </td><td class="memItemRight" valign="bottom"><a class="el" href="#getCursor">getCursor</a> (self, int offset)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QRect </td><td class="memItemRight" valign="bottom"><a class="el" href="#getRect">getRect</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#hasAttributes">hasAttributes</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#hasChildNodes">hasChildNodes</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="#index">index</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#insertBefore">insertBefore</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> newChild, <a href="../khtml/DOM.Node.html">DOM.Node</a> refChild)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#isNull">isNull</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#isSupported">isSupported</a> (self, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> feature, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> version)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#lastChild">lastChild</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#localName">localName</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#namespaceURI">namespaceURI</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#nextSibling">nextSibling</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#nodeName">nodeName</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#nodeType">nodeType</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#nodeValue">nodeValue</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#normalize">normalize</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#operator !=">operator !=</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#operator ==">operator ==</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Document.html">DOM.Document</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#ownerDocument">ownerDocument</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#parentNode">parentNode</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#prefix">prefix</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#previousSibling">previousSibling</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#removeChild">removeChild</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> oldChild)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#removeEventListener">removeEventListener</a> (self, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> type, <a href="../khtml/DOM.EventListener.html">DOM.EventListener</a> listener, bool useCapture)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#replaceChild">replaceChild</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> newChild, <a href="../khtml/DOM.Node.html">DOM.Node</a> oldChild)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setNodeValue">setNodeValue</a> (self, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> a0)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setPrefix">setPrefix</a> (self, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> prefix)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setTextContent">setTextContent</a> (self, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> text)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#textContent">textContent</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><a class="el" href="#toHTML">toHTML</a> (self)</td></tr>
</table>
<hr><h2>Method Documentation</h2><a class="anchor" name="Node"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"></div></div><a class="anchor" name="Node"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"></div></div><a class="anchor" name="addEventListener"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> addEventListener</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.EventListener.html">DOM.EventListener</a> </td>
<td class="paramname"><em>listener</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>useCapture</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Introduced in DOM Level 2
This method is from the EventTarget interface
</p>
<p>
This method allows the registration of event listeners on the event
target. If an EventListener is added to an EventTarget while it is
processing an event, it will not be triggered by the current actions but
may be triggered during a later stage of event flow, such as the
bubbling phase.
</p>
<p>
If multiple identical EventListeners are registered on the same
EventTarget with the same parameters the duplicate instances are
discarded. They do not cause the EventListener to be called twice and
since they are discarded they do not need to be removed with the
removeEventListener method. Parameters
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>type</em> </td><td> The event type for which the user is registering
</td></tr>
<tr><td></td><td valign="top"><em>listener</em> </td><td> The listener parameter takes an interface implemented by
the user which contains the methods to be called when the event occurs.
</td></tr>
<tr><td></td><td valign="top"><em>useCapture</em> </td><td> If true, useCapture indicates that the user wishes to
initiate capture. After initiating capture, all events of the specified
type will be dispatched to the registered EventListener before being
dispatched to any EventTargets beneath them in the tree. Events which
are bubbling upward through the tree will not trigger an EventListener
designated to use capture.
</td></tr>
</table></dl>
<p>
</p></div></div><a class="anchor" name="appendChild"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> appendChild</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td>
<td class="paramname"><em>newChild</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Adds the node newChild to the end of the list of
children of this node. If the newChild is
already in the tree, it is first removed.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>newChild</em> </td><td> The node to add.
</td></tr>
</table></dl>
<p> If it is a DocumentFragment object, the entire
contents of the document fragment are moved into the child list
of this node
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> The node added.
</dd></dl> </p>
<p>
DOMException
HIERARCHY_REQUEST_ERR: Raised if this node is of a type that
does not allow children of the type of the newChild
node, or if the node to append is one of this node's
ancestors.
</p>
<p>
WRONG_DOCUMENT_ERR: Raised if newChild was
created from a different document than the one that created
this node.
</p>
<p>
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
</p></div></div><a class="anchor" name="applyChanges"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> applyChanges</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"></div></div><a class="anchor" name="attributes"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.NamedNodeMap.html">DOM.NamedNodeMap</a> attributes</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>A NamedNodeMap containing the attributes of this
node (if it is an Element ) or null
otherwise.
</p></div></div><a class="anchor" name="childNodes"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.NodeList.html">DOM.NodeList</a> childNodes</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>A NodeList that contains all children of this
node. If there are no children, this is a NodeList
containing no nodes. The content of the returned
NodeList is &quot;live&quot; in the sense that, for
instance, changes to the children of the node object that it
was created from are immediately reflected in the nodes
returned by the NodeList accessors; it is not a
static snapshot of the content of the node. This is true for
every NodeList , including the ones returned by
the getElementsByTagName method.
</p></div></div><a class="anchor" name="cloneNode"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> cloneNode</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>deep</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns a duplicate of this node, i.e., serves as a generic
copy constructor for nodes. The duplicate node has no parent (
parentNode returns null .).
</p>
<p>
Cloning an Element copies all attributes and
their values, including those generated by the XML processor to
represent defaulted attributes, but this method does not copy
any text it contains unless it is a deep clone, since the text
is contained in a child Text node. Cloning any
other type of node simply returns a copy of this node.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>deep</em> </td><td> If true , recursively clone the
subtree under the specified node; if false ,
clone only the node itself (and its attributes, if it is an
</td></tr> </table></dl>
<p> Element ).
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> The duplicate node.
</dd></dl>
</p></div></div><a class="anchor" name="compareDocumentPosition"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">unsigned compareDocumentPosition</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Introduced in DOM Level 3.
</p>
<p>
This method compares the current node's position with that of 'other'
and returns it as a combination of DocumentPosition bitfields.
Here DOCUMENT_POSITION_FOLLOWING means that the 'other' is
after the current.
</p>
<p>
The notion of order here is a logical one; for example attributes
are viewed as if they were children of an element inserted
right before the real children. The method will also assign
some total order even if the nodes are not connected.
</p>
<p>
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.2.4
</dd></dl>
</p></div></div><a class="anchor" name="dispatchEvent"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool dispatchEvent</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.Event.html">DOM.Event</a> </td>
<td class="paramname"><em>evt</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Introduced in DOM Level 2
This method is from the EventTarget interface
</p>
<p>
This method allows the dispatch of events into the implementations event
model. Events dispatched in this manner will have the same capturing and
bubbling behavior as events dispatched directly by the implementation.
The target of the event is the EventTarget on which dispatchEvent is
called.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>evt</em> </td><td> Specifies the event type, behavior, and contextual
information to be used in processing the event.
</td></tr>
</table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> The return value of dispatchEvent indicates whether any of the
listeners which handled the event called preventDefault. If
preventDefault was called the value is false, else the value is true.
</dd></dl> </p>
<p>
EventException
UNSPECIFIED_EVENT_TYPE_ERR: Raised if the Event's type was not specified
by initializing the event before dispatchEvent was called. Specification
of the Event's type as null or an empty string will also trigger this
exception.
</p></div></div><a class="anchor" name="elementId"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">long elementId</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p><dl class="internal" compact><dt><b>Internal:</b></dt><dd>
not part of the DOM.
</dd></dl> <dl class="return" compact><dt><b>Returns:</b></dt><dd> the element id, in case this is an element, 0 otherwise
</dd></dl>
</p></div></div><a class="anchor" name="firstChild"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> firstChild</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>The first child of this node. If there is no such node, this
returns null .
</p></div></div><a class="anchor" name="getCursor"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">int _x, int _y, int height getCursor</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>offset</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p><dl class="deprecated" compact><dt><b>Deprecated:</b></dt><dd> without substitution since 3.2
</dd></dl>
</p></div></div><a class="anchor" name="getRect"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QRect getRect</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>not part of the DOM.
<dl class="return" compact><dt><b>Returns:</b></dt><dd> the exact coordinates and size of this element.
</dd></dl>
</p></div></div><a class="anchor" name="hasAttributes"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool hasAttributes</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns whether this node (if it is an element) has any attributes.
<dl class="return" compact><dt><b>Returns:</b></dt><dd> a boolean. True if this node has any attributes, false otherwise.
Introduced in DOM Level 2
</dd></dl>
</p></div></div><a class="anchor" name="hasChildNodes"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool hasChildNodes</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>This is a convenience method to allow easy determination of
whether a node has any children.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if the node has any children,
</dd></dl> false if the node has no children.
</p></div></div><a class="anchor" name="index"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">long index</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p><dl class="internal" compact><dt><b>Internal:</b></dt><dd> returns the index of a node
</dd></dl>
</p></div></div><a class="anchor" name="insertBefore"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> insertBefore</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td>
<td class="paramname"><em>newChild</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td>
<td class="paramname"><em>refChild</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Inserts the node newChild before the existing
child node refChild . If refChild
is null , insert newChild at the
end of the list of children.
</p>
<p>
If newChild is a DocumentFragment
object, all of its children are inserted, in the same
order, before refChild . If the newChild
is already in the tree, it is first removed.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>newChild</em> </td><td> The node to insert.
</td></tr>
<tr><td></td><td valign="top"><em>refChild</em> </td><td> The reference node, i.e., the node before which
the new node must be inserted.
</td></tr>
</table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> The node being inserted.
</dd></dl> </p>
<p>
DOMException
HIERARCHY_REQUEST_ERR: Raised if this node is of a type that
does not allow children of the type of the newChild
node, or if the node to insert is one of this node's
ancestors.
</p>
<p>
WRONG_DOCUMENT_ERR: Raised if newChild was
created from a different document than the one that created
this node.
</p>
<p>
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
</p>
<p>
NOT_FOUND_ERR: Raised if refChild is not a
child of this node.
</p></div></div><a class="anchor" name="isNull"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isNull</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>tests if this Node is 0. Useful especially, if casting to a derived
class:
</p>
<p>
<pre class="fragment">
Node n = .....;
// try to convert into an Element:
Element e = n;
if( e.isNull() )
kDebug() << "node isn't an element node";
</pre>
</p></div></div><a class="anchor" name="isSupported"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isSupported</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> </td>
<td class="paramname"><em>feature</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> </td>
<td class="paramname"><em>version</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Introduced in DOM Level 2
</p>
<p>
Tests whether the DOM implementation implements a specific feature and
that feature is supported by this node.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>feature</em> </td><td> The name of the feature to test. This is the same name
which can be passed to the method hasFeature on DOMImplementation.
</td></tr>
<tr><td></td><td valign="top"><em>version</em> </td><td> This is the version number of the feature to test. In
Level 2, version 1, this is the string "2.0". If the version is not
specified, supporting any version of the feature will cause the method
to return true.
</td></tr>
</table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> Returns true if the specified feature is supported on this node,
false otherwise.
</dd></dl>
</p></div></div><a class="anchor" name="lastChild"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> lastChild</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>The last child of this node. If there is no such node, this
returns null .
</p></div></div><a class="anchor" name="localName"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> localName</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Introduced in DOM Level 2
</p>
<p>
Returns the local part of the qualified name of this node.
For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and
nodes created with a DOM Level 1 method, such as createElement from the
Document interface, this is always null.
</p></div></div><a class="anchor" name="namespaceURI"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> namespaceURI</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Introduced in DOM Level 2
</p>
<p>
The namespace URI of this node, or null if it is unspecified.
This is not a computed value that is the result of a namespace lookup
based on an examination of the namespace declarations in scope. It is
merely the namespace URI given at creation time. For nodes of any type
other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM
Level 1 method, such as createElement from the Document interface, this
is always null.
</p>
<p>
Note: Per the Namespaces in XML Specification [Namespaces] an attribute
does not inherit its namespace from the element it is attached to. If an
attribute is not explicitly given a namespace, it simply has no
namespace.
</p></div></div><a class="anchor" name="nextSibling"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> nextSibling</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>The node immediately following this node. If there is no such
node, this returns null .
</p></div></div><a class="anchor" name="nodeName"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> nodeName</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>The name of this node, depending on its type; see the table
above.
</p></div></div><a class="anchor" name="nodeType"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">int nodeType</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>A code representing the type of the underlying object, as
defined above.
</p></div></div><a class="anchor" name="nodeValue"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> nodeValue</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>The value of this node, depending on its type; see the table
above.
</p>
<p>
DOMException
DOMSTRING_SIZE_ERR: Raised when it would return more characters
than fit in a DOMString variable on the
implementation platform.
</p></div></div><a class="anchor" name="normalize"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> normalize</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Modified in DOM Level 2
</p>
<p>
Puts all Text nodes in the full depth of the sub-tree underneath this
Node, including attribute nodes, into a "normal" form where only
structure (e.g., elements, comments, processing instructions, CDATA
sections, and entity references) separates Text nodes, i.e., there are
neither adjacent Text nodes nor empty Text nodes. This can be used to
ensure that the DOM view of a document is the same as if it were saved
and re-loaded, and is useful when operations (such as XPointer
[XPointer] lookups) that depend on a particular document tree structure
are to be used.
</p>
<p>
Note: In cases where the document contains CDATASections, the normalize
operation alone may not be sufficient, since XPointers do not
differentiate between Text nodes and CDATASection nodes.
</p></div></div><a class="anchor" name="operator !="></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool operator !=</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"></div></div><a class="anchor" name="operator =="></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool operator ==</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"></div></div><a class="anchor" name="ownerDocument"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.Document.html">DOM.Document</a> ownerDocument</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>The Document object associated with this node.
This is also the Document object used to create
new nodes. When this node is a Document this is
null .
</p></div></div><a class="anchor" name="parentNode"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> parentNode</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>The parent of this node. All nodes, except Document
, DocumentFragment , and Attr
may have a parent. However, if a node has just been
created and not yet added to the tree, or if it has been
removed from the tree, this is null .
</p></div></div><a class="anchor" name="prefix"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> prefix</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Introduced in DOM Level 2
</p>
<p>
The namespace prefix of this node, or null if it is unspecified.
Note that setting this attribute, when permitted, changes the nodeName
attribute, which holds the qualified name, as well as the tagName and
name attributes of the Element and Attr interfaces, when applicable.
Note also that changing the prefix of an attribute that is known to have
a default value, does not make a new attribute with the default value
and the original prefix appear, since the namespaceURI and localName do
not change.
For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and
nodes created with a DOM Level 1 method, such as createElement from the
Document interface, this is always null.
</p></div></div><a class="anchor" name="previousSibling"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> previousSibling</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>The node immediately preceding this node. If there is no such
node, this returns null .
</p></div></div><a class="anchor" name="removeChild"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> removeChild</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td>
<td class="paramname"><em>oldChild</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Removes the child node indicated by oldChild
from the list of children, and returns it.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>oldChild</em> </td><td> The node being removed.
</td></tr>
</table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> The node removed.
</dd></dl> </p>
<p>
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
</p>
<p>
NOT_FOUND_ERR: Raised if oldChild is not a
child of this node.
</p></div></div><a class="anchor" name="removeEventListener"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> removeEventListener</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.EventListener.html">DOM.EventListener</a> </td>
<td class="paramname"><em>listener</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>useCapture</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Introduced in DOM Level 2
This method is from the EventTarget interface
</p>
<p>
This method allows the removal of event listeners from the event target.
If an EventListener is removed from an EventTarget while it is
processing an event, it will not be triggered by the current actions.
</p>
<p>
EventListeners can never be invoked after being removed.
</p>
<p>
Calling removeEventListener with arguments which do not identify any
currently registered EventListener on the EventTarget has no effect.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>type</em> </td><td> Specifies the event type of the EventListener being removed.
</td></tr>
<tr><td></td><td valign="top"><em>listener</em> </td><td> The EventListener parameter indicates the EventListener
to be removed.
</td></tr>
<tr><td></td><td valign="top"><em>useCapture</em> </td><td> Specifies whether the EventListener being removed was
registered as a capturing listener or not. If a listener was registered
twice, one with capture and one without, each must be removed
separately. Removal of a capturing listener does not affect a
non-capturing version of the same listener, and vice versa.
</td></tr>
</table></dl>
<p>
</p></div></div><a class="anchor" name="replaceChild"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> replaceChild</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td>
<td class="paramname"><em>newChild</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a> </td>
<td class="paramname"><em>oldChild</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Replaces the child node oldChild with
newChild in the list of children, and returns the
oldChild node. If the newChild is
already in the tree, it is first removed.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>newChild</em> </td><td> The new node to put in the child list.
</td></tr>
<tr><td></td><td valign="top"><em>oldChild</em> </td><td> The node being replaced in the list.
</td></tr>
</table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> The node replaced.
</dd></dl> </p>
<p>
DOMException
HIERARCHY_REQUEST_ERR: Raised if this node is of a type that
does not allow children of the type of the newChild
node, or it the node to put in is one of this node's
ancestors.
</p>
<p>
WRONG_DOCUMENT_ERR: Raised if newChild was
created from a different document than the one that created
this node.
</p>
<p>
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
</p>
<p>
NOT_FOUND_ERR: Raised if oldChild is not a
child of this node.
</p></div></div><a class="anchor" name="setNodeValue"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setNodeValue</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> </td>
<td class="paramname"><em>a0</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>see nodeValue
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
</p></div></div><a class="anchor" name="setPrefix"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setPrefix</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> </td>
<td class="paramname"><em>prefix</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>see prefix
</p>
<p>
DOMException
INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
illegal character.
</p>
<p>
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
</p>
<p>
NAMESPACE_ERR: Raised if the specified prefix is malformed, if the
namespaceURI of this node is null, if the specified prefix is "xml" and
the namespaceURI of this node is different from
"http://www.w3.org/XML/1998/namespace", if this node is an attribute and
the specified prefix is "xmlns" and the namespaceURI of this node is
different from "http://www.w3.org/2000/xmlns/", or if this node is an
attribute and the qualifiedName of this node is "xmlns" [Namespaces].
</p></div></div><a class="anchor" name="setTextContent"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setTextContent</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> </td>
<td class="paramname"><em>text</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>see textContent()
</p>
<p>
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
</p></div></div><a class="anchor" name="textContent"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> textContent</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Introduced in DOM Level 3
</p>
<p>
This attribute returns the text content of this node and its
descendants. When it is defined to be null, setting it has no
effect. On setting, any possible children this node may have
are removed and, if it the new string is not empty or null,
replaced by a single Text node containing the string this
attribute is set to.
On getting, no serialization is performed, the returned string
does not contain any markup. No whitespace normalization is
performed and the returned string does not contain the white
spaces in element content (see the attribute
Text.isElementContentWhitespace). Similarly, on setting, no
parsing is performed either, the input string is taken as pure
textual content.
</p></div></div><a class="anchor" name="toHTML"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString toHTML</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"></div></div><hr><h2>Enumeration Documentation</h2><a class="anchor" name="DocumentPosition"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr><td class="memname">DocumentPosition</td>
</tr>
</table>
</div>
<div class="memdoc"><p>Introduced in DOM Level 3.
</p>
<p>
These constants represent bitflags returned by the compareDocumentPosition
method.
</p>
<p>
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.2.4
</dd></dl>
</p><dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0"><tr><td valign="top"><em>DOCUMENT_POSITION_DISCONNECTED</em> = 0x01</td><td><tr><td valign="top"><em>DOCUMENT_POSITION_PRECEDING</em> = 0x02</td><td><tr><td valign="top"><em>DOCUMENT_POSITION_FOLLOWING</em> = 0x04</td><td><tr><td valign="top"><em>DOCUMENT_POSITION_CONTAINS</em> = 0x08</td><td><tr><td valign="top"><em>DOCUMENT_POSITION_CONTAINED_BY</em> = 0x10</td><td><tr><td valign="top"><em>DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC</em> = 0x20</td><td></table>
</dl>
</div></div><p><a class="anchor" name="NodeType"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr><td class="memname">NodeType</td>
</tr>
</table>
</div>
<div class="memdoc"><p>An integer indicating which type of node this is.
</p>
<p>
<p>The values of nodeName, nodeValue,
and attributes vary according to the node type as follows:
<table border="1">
<tr>
<td></td>
<td>nodeName</td>
<td>nodeValue</td>
<td>attributes</td>
</tr>
<tr>
<td>Element</td>
<td>tagName</td>
<td>null</td>
<td>NamedNodeMap</td>
</tr>
<tr>
<td>Attr</td>
<td>name of attribute</td>
<td>value of attribute</td>
<td>null</td>
</tr>
<tr>
<td>Text</td>
<td>#text</td>
<td>content of the text node</td>
<td>null</td>
</tr>
<tr>
<td>CDATASection</td>
<td>#cdata-section</td>
<td>content of the CDATA Section</td>
<td>null</td>
</tr>
<tr>
<td>EntityReference</td>
<td>name of entity referenced</td>
<td>null</td>
<td>null</td>
</tr>
<tr>
<td>Entity</td>
<td>entity name</td>
<td>null</td>
<td>null</td>
</tr>
<tr>
<td>ProcessingInstruction</td>
<td>target</td>
<td>entire content excluding the target</td>
<td>null</td>
</tr>
<tr>
<td>Comment</td>
<td>#comment</td>
<td>content of the comment</td>
<td>null</td>
</tr>
<tr>
<td>Document</td>
<td>#document</td>
<td>null</td>
<td>null</td>
</tr>
<tr>
<td>DocumentType</td>
<td>document type name</td>
<td>null</td>
<td>null</td>
</tr>
<tr>
<td>DocumentFragment</td>
<td>#document-fragment</td>
<td>null</td>
<td>null</td>
</tr>
<tr>
<td>Notation</td>
<td>notation name</td>
<td>null</td>
<td>null</td>
</tr>
</table>
</p>
</p><dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0"><tr><td valign="top"><em>ELEMENT_NODE</em> = 1</td><td><tr><td valign="top"><em>ATTRIBUTE_NODE</em> = 2</td><td><tr><td valign="top"><em>TEXT_NODE</em> = 3</td><td><tr><td valign="top"><em>CDATA_SECTION_NODE</em> = 4</td><td><tr><td valign="top"><em>ENTITY_REFERENCE_NODE</em> = 5</td><td><tr><td valign="top"><em>ENTITY_NODE</em> = 6</td><td><tr><td valign="top"><em>PROCESSING_INSTRUCTION_NODE</em> = 7</td><td><tr><td valign="top"><em>COMMENT_NODE</em> = 8</td><td><tr><td valign="top"><em>DOCUMENT_NODE</em> = 9</td><td><tr><td valign="top"><em>DOCUMENT_TYPE_NODE</em> = 10</td><td><tr><td valign="top"><em>DOCUMENT_FRAGMENT_NODE</em> = 11</td><td><tr><td valign="top"><em>NOTATION_NODE</em> = 12</td><td><tr><td valign="top"><em>XPATH_NAMESPACE_NODE</em> = 13</td><td></table>
</dl>
</div></div><p>
</div>
</div>
</div>
<div id="left">
<div class="menu_box">
<div class="nav_list">
<ul>
<li><a href="../allclasses.html">Full Index</a></li>
</ul>
</div>
<a name="cp-menu" /><div class="menutitle"><div>
<h2 id="cp-menu-project">Modules</h2>
</div></div>
<div class="nav_list">
<ul><li><a href="../akonadi/index.html">akonadi</a></li>
<li><a href="../dnssd/index.html">dnssd</a></li>
<li><a href="../kdecore/index.html">kdecore</a></li>
<li><a href="../kdeui/index.html">kdeui</a></li>
<li><a href="../khtml/index.html">khtml</a></li>
<li><a href="../kio/index.html">kio</a></li>
<li><a href="../knewstuff/index.html">knewstuff</a></li>
<li><a href="../kparts/index.html">kparts</a></li>
<li><a href="../kutils/index.html">kutils</a></li>
<li><a href="../nepomuk/index.html">nepomuk</a></li>
<li><a href="../phonon/index.html">phonon</a></li>
<li><a href="../plasma/index.html">plasma</a></li>
<li><a href="../polkitqt/index.html">polkitqt</a></li>
<li><a href="../solid/index.html">solid</a></li>
<li><a href="../soprano/index.html">soprano</a></li>
</ul></div></div>
</div>
</div>
<div class="clearer"/>
</div>
<div id="end_body"></div>
</div>
<div id="footer"><div id="footer_text">
This documentation is maintained by <a href="mailto:simon@simonzone.com">Simon Edwards</a>.<br />
KDE<sup>®</sup> and <a href="../images/kde_gear_black.png">the K Desktop Environment<sup>®</sup> logo</a> are registered trademarks of <a href="http://ev.kde.org/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> |
<a href="http://www.kde.org/contact/impressum.php">Legal</a>
</div></div>
</body>
</html>
| KDE/pykde4 | docs/html/khtml/DOM.Node.html | HTML | gpl-2.0 | 56,993 |
<?php
/**
* H4PH - HTML4 PHP Helper
* @link https://github.com/Coft/H4PH
*/
class Td
{
/**
* contains all setted attributes
* @var array
*/
private $attrs = array();
/**
* keeps content
* @var string
*/
private $content = null;
/**
* holds markup name
* @var string
*/
private static $markupName = 'td';
/**
* tells is this markup can handle content
* @var bool
*/
private static $isContenerable = true;
/**
* __construct() - can add content to tag
* @param null|string $content
* @return Td
*/
public function __construct($content = null)
{
$argumentsNumber = func_num_args();
for ($i = 0; $i < $argumentsNumber; $i++) {
$this->addContent(func_get_arg($i));
}
}
/**
* renders tag and it content to string
* @param null|string $content
* @return Td
*/
public static function getInstance($content = null)
{
$markupTag = new Td;
$argumentsNumber = func_num_args();
for ($i = 0; $i < $argumentsNumber; $i++) {
$markupTag->addContent(func_get_arg($i));
}
return $markupTag;
}
/**
* adds content to tag
* @param null|string $content
* @return Td
*/
public function addContent($content = null)
{
$this->content .= (string) $content;
return $this;
}
/**
* renders tag and it content to string
* @return string
*/
public function __toString()
{
$parsedAttrs = '';
foreach ($this->attrs as $attrName => $attrValue) {
$parsedAttrs .= ' '.$attrName.'=\''.$attrValue.'\'';
}
return '<'.self::$markupName.$parsedAttrs.'>'.$this->content.'</'.self::$markupName.'>';
}
/**
* sets abbr attribute
* @param null|string $value
* @return Td
*/
public function abbr($value = null)
{
$this->attrs['abbr'] = $value;
return $this;
}
/**
* sets align attribute
* @param null|string $value
* @return Td
*/
public function align($value = null)
{
$this->attrs['align'] = $value;
return $this;
}
/**
* sets axis attribute
* @param null|string $value
* @return Td
*/
public function axis($value = null)
{
$this->attrs['axis'] = $value;
return $this;
}
/**
* sets char attribute
* @param null|string $value
* @return Td
*/
public function char($value = null)
{
$this->attrs['char'] = $value;
return $this;
}
/**
* sets charoff attribute
* @param null|string $value
* @return Td
*/
public function charoff($value = null)
{
$this->attrs['charoff'] = $value;
return $this;
}
/**
* sets colspan attribute
* @param null|string $value
* @return Td
*/
public function colspan($value = null)
{
$this->attrs['colspan'] = $value;
return $this;
}
/**
* sets headers attribute
* @param null|string $value
* @return Td
*/
public function headers($value = null)
{
$this->attrs['headers'] = $value;
return $this;
}
/**
* sets rowspan attribute
* @param null|string $value
* @return Td
*/
public function rowspan($value = null)
{
$this->attrs['rowspan'] = $value;
return $this;
}
/**
* sets scope attribute
* @param null|string $value
* @return Td
*/
public function scope($value = null)
{
$this->attrs['scope'] = $value;
return $this;
}
/**
* sets valign attribute
* @param null|string $value
* @return Td
*/
public function valign($value = null)
{
$this->attrs['valign'] = $value;
return $this;
}
/**
* sets classes attribute
* @param null|string $value
* @return Td
*/
public function classes($value = null)
{
$this->attrs['class'] = $value;
return $this;
}
/**
* sets dir attribute
* @param null|string $value
* @return Td
*/
public function dir($value = null)
{
$this->attrs['dir'] = $value;
return $this;
}
/**
* sets id attribute
* @param null|string $value
* @return Td
*/
public function id($value = null)
{
$this->attrs['id'] = $value;
return $this;
}
/**
* sets lang attribute
* @param null|string $value
* @return Td
*/
public function lang($value = null)
{
$this->attrs['lang'] = $value;
return $this;
}
/**
* sets style attribute
* @param null|string $value
* @return Td
*/
public function style($value = null)
{
$this->attrs['style'] = $value;
return $this;
}
/**
* sets title attribute
* @param null|string $value
* @return Td
*/
public function title($value = null)
{
$this->attrs['title'] = $value;
return $this;
}
/**
* sets xmlLang attribute
* @param null|string $value
* @return Td
*/
public function xmlLang($value = null)
{
$this->attrs['xml:lang'] = $value;
return $this;
}
/**
* sets onclick attribute
* @param null|string $value
* @return Td
*/
public function onclick($value = null)
{
$this->attrs['onclick'] = $value;
return $this;
}
/**
* sets ondblclick attribute
* @param null|string $value
* @return Td
*/
public function ondblclick($value = null)
{
$this->attrs['ondblclick'] = $value;
return $this;
}
/**
* sets onmousedown attribute
* @param null|string $value
* @return Td
*/
public function onmousedown($value = null)
{
$this->attrs['onmousedown'] = $value;
return $this;
}
/**
* sets onmousemove attribute
* @param null|string $value
* @return Td
*/
public function onmousemove($value = null)
{
$this->attrs['onmousemove'] = $value;
return $this;
}
/**
* sets onmouseout attribute
* @param null|string $value
* @return Td
*/
public function onmouseout($value = null)
{
$this->attrs['onmouseout'] = $value;
return $this;
}
/**
* sets onmouseover attribute
* @param null|string $value
* @return Td
*/
public function onmouseover($value = null)
{
$this->attrs['onmouseover'] = $value;
return $this;
}
/**
* sets onmouseup attribute
* @param null|string $value
* @return Td
*/
public function onmouseup($value = null)
{
$this->attrs['onmouseup'] = $value;
return $this;
}
/**
* sets onkeydown attribute
* @param null|string $value
* @return Td
*/
public function onkeydown($value = null)
{
$this->attrs['onkeydown'] = $value;
return $this;
}
/**
* sets onkeypress attribute
* @param null|string $value
* @return Td
*/
public function onkeypress($value = null)
{
$this->attrs['onkeypress'] = $value;
return $this;
}
/**
* sets onkeyup attribute
* @param null|string $value
* @return Td
*/
public function onkeyup($value = null)
{
$this->attrs['onkeyup'] = $value;
return $this;
}
}
?> | Coft/H4PH | classes/Td.php | PHP | gpl-2.0 | 7,819 |
var SPHERE = {
getSphereVertex: function (radius, res) { // Se obtienen los vértices, normales y coordenadas de textura
var vertexData = [], alpha, beta, x, y, z, u, v;
for (var i = 0; i <= res; i++) { // Se recorren las latitudes
alpha = i * Math.PI / res; // Ángulo latitud
for (var j = 0; j <= res; j++) { // Se recorren las longitudes
beta = j * 2 * Math.PI / res; // Ángulo longitud
// Cálculo de x, y, z para vértices y normales
x = Math.cos(beta) * Math.sin(alpha);
y = Math.cos(alpha);
z = Math.sin(beta) * Math.sin(alpha);
// Cálculo de u, v para las coordenadas de textura
u = 1 - (j / res);
v = 1 - (i / res);
// Vértices
vertexData.push(radius * x);
vertexData.push(radius * y);
vertexData.push(radius * z);
// Normales
vertexData.push(x);
vertexData.push(y);
vertexData.push(z);
// Coordenadas de textura
vertexData.push(u);
vertexData.push(v);
}
}
return vertexData;
},
getShereFaces: function (res) { // Se obtienen los índices para crear las caras
var indexData = [], first, second;
for (var i = 0; i < res; i++) { // Se recorren las latitudes
for (var j = 0; j < res; j++) { // Se recorren las longitudes
// Cálculo de las esquinas superior e inferior izquierda
first = (i * (res + 1)) + j;
second = first + res + 1;
// Cara par
indexData.push(first); // Esquina superior izquierda
indexData.push(second); // Esquina inferior izquierda
indexData.push(first + 1); // Esquina superior derecha
// Cara impar
indexData.push(second); // Esquina inferior izquierda
indexData.push(second + 1); // Esquina inferior derecha
indexData.push(first + 1); // Esquina superior derecha
}
}
return indexData;
}
}; | fblupi/grado_informatica-SG | P2/P2_1/SistemaSolar/js/sphere.js | JavaScript | gpl-2.0 | 2,248 |
/**
*
*/
package org.sylvani.io.voice.http;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.emf.common.util.EList;
import org.eclipse.smarthome.model.sitemap.Sitemap;
import org.eclipse.smarthome.model.sitemap.SitemapProvider;
import org.eclipse.smarthome.model.sitemap.Widget;
import org.eclipse.smarthome.ui.items.ItemUIRegistry;
/**
* Varianten
* - Simple and Stupid HAL9000
* - Volltext
* - Tagged Analyse
*
* @author hkuhn
*
*/
public class RecognitionRelayServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private ItemUIRegistry itemUIRegistry;
private List<SitemapProvider> sitemaps;
public RecognitionRelayServlet(ItemUIRegistry itemUIRegistry, List<SitemapProvider> sitemaps) {
this.itemUIRegistry = itemUIRegistry;
this.sitemaps = sitemaps;
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doPost(req, resp);
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
for (SitemapProvider sitemapProvider : sitemaps) {
for (String sitemapName : sitemapProvider.getSitemapNames()) {
System.out.println("sitemap " + sitemapName);
Sitemap sitemap = sitemapProvider.getSitemap(sitemapName);
EList<Widget> list = sitemap.getChildren();
for (Widget widget : list) {
System.out.println("#Widget " + widget.getLabel() + " " + widget.getItem());
}
}
}
}
}
| hkuhn42/sylvani | org.sylvani.io/src/main/java/org/sylvani/io/voice/http/RecognitionRelayServlet.java | Java | gpl-2.0 | 1,853 |
class Class3_Sub28 extends Class3 {
static Class94[] aClass94Array2566 = new Class94[200];
static int anInt2567 = -1;
private static Class94 aClass94_2568 = Class3_Sub4.buildString("Started 3d Library");
long aLong2569;
Class3_Sub28 aClass3_Sub28_2570;
static int anInt2571;
static int anInt2572;
static Class153 aClass153_2573;
static int[] anIntArray2574 = new int[14];
static int anInt2575;
static Class94 aClass94_2576 = aClass94_2568;
static int anInt2577 = 0;
Class3_Sub28 aClass3_Sub28_2578;
static final void method518(Class140_Sub4_Sub1 var0, int var1) {
try {
Class3_Sub9 var2 = (Class3_Sub9)Class3_Sub28_Sub7_Sub1.aClass130_4046.method1780(var0.aClass94_3967.method1578(-121), 0);
if(var1 >= -85) {
method523(40, -17, -52, -32, 9, -51, -85, -84, -19);
}
if(var2 != null) {
var2.method134(1);
} else {
Class70.method1286(var0.anIntArray2755[0], false, (Class111)null, 0, (Class140_Sub4_Sub2)null, var0.anIntArray2767[0], Class26.anInt501, var0);
}
} catch (RuntimeException var3) {
throw Class44.method1067(var3, "rg.UA(" + (var0 != null?"{...}":"null") + ',' + var1 + ')');
}
}
static final int method519(int var0, boolean var1, int var2, int var3) {
try {
var0 &= 3;
if(!var1) {
method520((byte)-89);
}
return 0 != var0?(~var0 != -2?(~var0 == -3?-var3 + 7:-var2 + 7):var2):var3;
} catch (RuntimeException var5) {
throw Class44.method1067(var5, "rg.RA(" + var0 + ',' + var1 + ',' + var2 + ',' + var3 + ')');
}
}
static final Class3_Sub28_Sub3 method520(byte var0) {
try {
int var1 = -122 % ((var0 - -48) / 33);
return Class3_Sub30.aClass3_Sub28_Sub3_2600;
} catch (RuntimeException var2) {
throw Class44.method1067(var2, "rg.OA(" + var0 + ')');
}
}
public static void method521(int var0) {
try {
aClass153_2573 = null;
if(var0 == -3) {
aClass94Array2566 = null;
aClass94_2568 = null;
anIntArray2574 = null;
aClass94_2576 = null;
}
} catch (RuntimeException var2) {
throw Class44.method1067(var2, "rg.QA(" + var0 + ')');
}
}
static final Class90 method522(int var0, int var1) {
try {
Class90 var2 = (Class90)Class3_Sub28_Sub7_Sub1.aClass93_4043.method1526((long)var0, (byte)121);
if(null == var2) {
byte[] var3 = Class29.aClass153_557.method2133(Class38_Sub1.method1031(var0, 2), (byte)-122, Canvas_Sub1.method54(var0, false));
var2 = new Class90();
if(var1 != 27112) {
anInt2572 = -67;
}
var2.anInt1284 = var0;
if(null != var3) {
var2.method1478(new Class3_Sub30(var3), 74);
}
var2.method1481(98);
Class3_Sub28_Sub7_Sub1.aClass93_4043.method1515((byte)-95, var2, (long)var0);
return var2;
} else {
return var2;
}
} catch (RuntimeException var4) {
throw Class44.method1067(var4, "rg.PA(" + var0 + ',' + var1 + ')');
}
}
static final void method523(int var0, int var1, int var2, int var3, int var4, int var5, int var6, int var7, int var8) {
try {
int var9 = var3 - var8;
int var11 = (-var5 + var0 << 16) / var9;
int var10 = -var4 + var6;
int var12 = (var7 + -var1 << 16) / var10;
Class83.method1410(var1, 0, var6, var4, var3, var5, var8, var12, var11, var2, -12541);
} catch (RuntimeException var13) {
throw Class44.method1067(var13, "rg.SA(" + var0 + ',' + var1 + ',' + var2 + ',' + var3 + ',' + var4 + ',' + var5 + ',' + var6 + ',' + var7 + ',' + var8 + ')');
}
}
final void method524(byte var1) {
try {
if(this.aClass3_Sub28_2570 != null) {
this.aClass3_Sub28_2570.aClass3_Sub28_2578 = this.aClass3_Sub28_2578;
this.aClass3_Sub28_2578.aClass3_Sub28_2570 = this.aClass3_Sub28_2570;
this.aClass3_Sub28_2578 = null;
this.aClass3_Sub28_2570 = null;
if(var1 != -107) {
this.aClass3_Sub28_2578 = (Class3_Sub28)null;
}
}
} catch (RuntimeException var3) {
throw Class44.method1067(var3, "rg.TA(" + var1 + ')');
}
}
}
| Lmctruck30/RiotScape-Client | src/Class3_Sub28.java | Java | gpl-2.0 | 4,615 |
/*
Kvalobs - Free Quality Control Software for Meteorological Observations
$Id: Data.h,v 1.2.6.2 2007/09/27 09:02:22 paule Exp $
Copyright (C) 2007 met.no
Contact information:
Norwegian Meteorological Institute
Box 43 Blindern
0313 OSLO
NORWAY
email: [email protected]
This file is part of KVALOBS
KVALOBS is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
KVALOBS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with KVALOBS; if not, write to the Free Software Foundation Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <boost/assign.hpp>
#include "EncodeBufr302053.h"
EncodeBufr302053::
EncodeBufr302053()
{
}
std::string
EncodeBufr302053::
logIdentifier() const
{
return "302053";
}
std::list<int>
EncodeBufr302053::
encodeIds()const
{
std::list<int> ids;
boost::assign::push_back( ids )(302053);
return ids;
}
void
EncodeBufr302053::
encode( )
{
bufr->addValue( 7032, stationInfo->heightVisability(), "h_V, height of visibility sensor above marine deck.", false );
bufr->addValue( 7033, FLT_MAX, "h_V, height of visibility sensor above water surface.", false );
bufr->addValue( 20001, data->VV, "VV, horisental visibility" );
}
| metno/kvbufrd | src/bufr/EncodeBufr302053.cc | C++ | gpl-2.0 | 1,668 |
## PostgreSQL 拒绝服务DDOS攻击与防范
### 作者
digoal
### 日期
2018-12-02
### 标签
PostgreSQL , ddos , 拒绝服务 , 锁 , SLOT
----
## 背景
连接数据库的过程中,需要数据库有足够的SLOT(连接槽,通过max_connections配置),认证。如果把连接槽位占用,或者在认证过程加锁(使得认证过程被锁),则可以制造DDOS攻击。
占用连接槽的攻击与防范方法:
[《PostgreSQL 连接攻击(类似DDoS)》](../201706/20170629_02.md)
认证过程加锁的攻击方法,本文会提到。
https://paquier.xyz/postgresql-2/postgres-12-dos-prevention/
https://www.postgresql.org/message-id/[email protected]
```
BUG #15182: Canceling authentication due to timeout aka Denial of Service Attack
From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: lalbin(at)scharp(dot)org
Subject: BUG #15182: Canceling authentication due to timeout aka Denial of Service Attack
Date: 2018-04-30 20:41:11
Message-ID: [email protected]
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-bugs pgsql-hackers
The following bug has been logged on the website:
Bug reference: 15182
Logged by: Lloyd Albin
Email address: lalbin(at)scharp(dot)org
PostgreSQL version: 10.3
Operating system: OpenSUSE
Description:
Over the last several weeks our developers caused a Denial of Service Attack
against ourselves by accident. When looking at the log files, I noticed that
we had authentication timeouts during these time periods. In researching the
problem I found this is due to locks being held on shared system catalog
items, aka system catalog items that are shared between all databases on the
same cluster/server. This can be caused by beginning a long running
transaction that queries pg_stat_activity, pg_roles, pg_database, etc and
then another connection that runs either a REINDEX DATABASE, REINDEX SYSTEM,
or VACUUM FULL. This issue is of particular importance to database resellers
who use the same cluster/server for multiple clients, as two clients can
cause this issue to happen inadvertently or a single client can either cause
it to happen maliciously or inadvertently. Note: The large cloud providers
give each of their clients their own cluster/server so this will not affect
across cloud clients but can affect an individual client. The problem is
that traditional hosting companies will have all clients from one or more
web servers share the same PostgreSQL cluster/server. This means that one or
two clients could inadvertently stop all the other clients from being able
to connect to their databases until the first client does either a COMMIT or
ROLLBACK of their transaction which they could hold open for hours, which is
what happened to us internally.
In Connection 1 we need to BEGIN a transaction and then query a shared
system item; pg_authid, pg_database, etc; or a view that depends on a shared
system item; pg_stat_activity, pg_roles, etc. Our developers were accessing
pg_roles.
Connection 1 (Any database, Any User)
BEGIN;
SELECT * FROM pg_stat_activity;
Connection 2 (Any database will do as long as you are the database owner)
REINDEX DATABASE postgres;
Connection 3 (Any Database, Any User)
psql -h sqltest-alt -d sandbox
All future Connection 3's will hang for however long the transaction in
Connection 1 runs. In our case this was hours and denied everybody else the
ability to log into the server until Connection 1 was committed. psql will
just hang for hours, even overnight in my testing, but our apps would get
the "Canceling authentication due to timeout" after 1 minute.
Connection 2 can also do any of these commands to also cause the same
issue:
REINDEX SYSTEM postgres;
VACUUM FULL pg_authid;
vacuumdb -f -h sqltest-alt -d lloyd -U lalbin
Even worse is that the VACUUM FULL pg_authid; can be started by an
unprivileged user and it will wait for the AccessShareLock by connection 1
to be released before returning the error that you don't have permission to
perform this action, so even an unprivileged user can cause this to happen.
The privilege check needs to happen before the waiting for the
AccessExclusiveLock happens.
This bug report has been simplified and shorted drastically. To read the
full information about this issue please see my blog post:
http://lloyd.thealbins.com/Canceling%20authentication%20due%20to%20timeout
Lloyd Albin
Database Administrator
Statistical Center for HIV/AIDS Research and Prevention (SCHARP)
Fred Hutchinson Cancer Research Center
```
复现方法如上。
## 防范
1、对于连接占用DDOS攻击的防范(1,设置认证超时参数。2,不要在公网监听。3,设置网络层防火墙。)
2、对于锁攻击(通常是无意识攻击),建议在操作大锁的SQL前,加锁超时,或者语句超时(尽量减少等待时长)。 (lock_timeout, statement_timeout都可以)
## 参考
[《PostgreSQL 锁等待监控 珍藏级SQL - 谁堵塞了谁》](../201705/20170521_01.md)
[《PostgreSQL 设置单条SQL的执行超时 - 防雪崩》](../201712/20171211_02.md)
[《如何防止数据库雪崩(泛洪 flood)》](../201609/20160909_01.md)
https://paquier.xyz/postgresql-2/postgres-12-dos-prevention/
[《PostgreSQL 连接攻击(类似DDoS)》](../201706/20170629_02.md)
#### [PostgreSQL 许愿链接](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216")
您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。[开不开森](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216").
#### [9.9元购买3个月阿里云RDS PostgreSQL实例](https://www.aliyun.com/database/postgresqlactivity "57258f76c37864c6e6d23383d05714ea")
#### [PostgreSQL 解决方案集合](https://yq.aliyun.com/topic/118 "40cff096e9ed7122c512b35d8561d9c8")
#### [德哥 / digoal's github - 公益是一辈子的事.](https://github.com/digoal/blog/blob/master/README.md "22709685feb7cab07d30f30387f0a9ae")

| digoal/blog | 201812/20181202_03.md | Markdown | gpl-2.0 | 8,041 |
using System;
namespace WIC
{
public enum DXGI_FORMAT
{
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_R32G32B32A32_TYPELESS,
DXGI_FORMAT_R32G32B32A32_FLOAT,
DXGI_FORMAT_R32G32B32A32_UINT,
DXGI_FORMAT_R32G32B32A32_SINT,
DXGI_FORMAT_R32G32B32_TYPELESS,
DXGI_FORMAT_R32G32B32_FLOAT,
DXGI_FORMAT_R32G32B32_UINT,
DXGI_FORMAT_R32G32B32_SINT,
DXGI_FORMAT_R16G16B16A16_TYPELESS,
DXGI_FORMAT_R16G16B16A16_FLOAT,
DXGI_FORMAT_R16G16B16A16_UNORM,
DXGI_FORMAT_R16G16B16A16_UINT,
DXGI_FORMAT_R16G16B16A16_SNORM,
DXGI_FORMAT_R16G16B16A16_SINT,
DXGI_FORMAT_R32G32_TYPELESS,
DXGI_FORMAT_R32G32_FLOAT,
DXGI_FORMAT_R32G32_UINT,
DXGI_FORMAT_R32G32_SINT,
DXGI_FORMAT_R32G8X24_TYPELESS,
DXGI_FORMAT_D32_FLOAT_S8X24_UINT,
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS,
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT,
DXGI_FORMAT_R10G10B10A2_TYPELESS,
DXGI_FORMAT_R10G10B10A2_UNORM,
DXGI_FORMAT_R10G10B10A2_UINT,
DXGI_FORMAT_R11G11B10_FLOAT,
DXGI_FORMAT_R8G8B8A8_TYPELESS,
DXGI_FORMAT_R8G8B8A8_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
DXGI_FORMAT_R8G8B8A8_UINT,
DXGI_FORMAT_R8G8B8A8_SNORM,
DXGI_FORMAT_R8G8B8A8_SINT,
DXGI_FORMAT_R16G16_TYPELESS,
DXGI_FORMAT_R16G16_FLOAT,
DXGI_FORMAT_R16G16_UNORM,
DXGI_FORMAT_R16G16_UINT,
DXGI_FORMAT_R16G16_SNORM,
DXGI_FORMAT_R16G16_SINT,
DXGI_FORMAT_R32_TYPELESS,
DXGI_FORMAT_D32_FLOAT,
DXGI_FORMAT_R32_FLOAT,
DXGI_FORMAT_R32_UINT,
DXGI_FORMAT_R32_SINT,
DXGI_FORMAT_R24G8_TYPELESS,
DXGI_FORMAT_D24_UNORM_S8_UINT,
DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
DXGI_FORMAT_X24_TYPELESS_G8_UINT,
DXGI_FORMAT_R8G8_TYPELESS,
DXGI_FORMAT_R8G8_UNORM,
DXGI_FORMAT_R8G8_UINT,
DXGI_FORMAT_R8G8_SNORM,
DXGI_FORMAT_R8G8_SINT,
DXGI_FORMAT_R16_TYPELESS,
DXGI_FORMAT_R16_FLOAT,
DXGI_FORMAT_D16_UNORM,
DXGI_FORMAT_R16_UNORM,
DXGI_FORMAT_R16_UINT,
DXGI_FORMAT_R16_SNORM,
DXGI_FORMAT_R16_SINT,
DXGI_FORMAT_R8_TYPELESS,
DXGI_FORMAT_R8_UNORM,
DXGI_FORMAT_R8_UINT,
DXGI_FORMAT_R8_SNORM,
DXGI_FORMAT_R8_SINT,
DXGI_FORMAT_A8_UNORM,
DXGI_FORMAT_R1_UNORM,
DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
DXGI_FORMAT_R8G8_B8G8_UNORM,
DXGI_FORMAT_G8R8_G8B8_UNORM,
DXGI_FORMAT_BC1_TYPELESS,
DXGI_FORMAT_BC1_UNORM,
DXGI_FORMAT_BC1_UNORM_SRGB,
DXGI_FORMAT_BC2_TYPELESS,
DXGI_FORMAT_BC2_UNORM,
DXGI_FORMAT_BC2_UNORM_SRGB,
DXGI_FORMAT_BC3_TYPELESS,
DXGI_FORMAT_BC3_UNORM,
DXGI_FORMAT_BC3_UNORM_SRGB,
DXGI_FORMAT_BC4_TYPELESS,
DXGI_FORMAT_BC4_UNORM,
DXGI_FORMAT_BC4_SNORM,
DXGI_FORMAT_BC5_TYPELESS,
DXGI_FORMAT_BC5_UNORM,
DXGI_FORMAT_BC5_SNORM,
DXGI_FORMAT_B5G6R5_UNORM,
DXGI_FORMAT_B5G5R5A1_UNORM,
DXGI_FORMAT_B8G8R8A8_UNORM,
DXGI_FORMAT_B8G8R8X8_UNORM,
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM,
DXGI_FORMAT_B8G8R8A8_TYPELESS,
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB,
DXGI_FORMAT_B8G8R8X8_TYPELESS,
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB,
DXGI_FORMAT_BC6H_TYPELESS,
DXGI_FORMAT_BC6H_UF16,
DXGI_FORMAT_BC6H_SF16,
DXGI_FORMAT_BC7_TYPELESS,
DXGI_FORMAT_BC7_UNORM,
DXGI_FORMAT_BC7_UNORM_SRGB,
DXGI_FORMAT_AYUV,
DXGI_FORMAT_Y410,
DXGI_FORMAT_Y416,
DXGI_FORMAT_NV12,
DXGI_FORMAT_P010,
DXGI_FORMAT_P016,
DXGI_FORMAT_420_OPAQUE,
DXGI_FORMAT_YUY2,
DXGI_FORMAT_Y210,
DXGI_FORMAT_Y216,
DXGI_FORMAT_NV11,
DXGI_FORMAT_AI44,
DXGI_FORMAT_IA44,
DXGI_FORMAT_P8,
DXGI_FORMAT_A8P8,
DXGI_FORMAT_B4G4R4A4_UNORM,
DXGI_FORMAT_FORCE_UINT = -1
}
}
| Rambalac/DummyWIC | Wic/WIC/DXGI_FORMAT.cs | C# | gpl-2.0 | 3,363 |
/***************************************************************************
getfmtast.cpp - returns the AST for formatted IO
-------------------
begin : July 22 2002
copyright : (C) 2002 by Marc Schellens
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
//#define FMT_DEBUG
#undef FMT_DEBUG
#include "includefirst.hpp"
#include "basegdl.hpp"
#include "fmtnode.hpp"
#include "print_tree.hpp"
#include "FMTLexer.hpp"
#include "FMTParser.hpp"
#include <antlr/ASTFactory.hpp>
using namespace std;
antlr::ASTFactory FMTNodeFactory("FMTNode",FMTNode::factory);
RefFMTNode GetFMTAST( DString fmtString)
{
istringstream istr(fmtString); //+"\n");
RefFMTNode fmtAST;
try {
antlr::TokenStreamSelector selector;
FMTLexer lexer( istr);
lexer.SetSelector( selector);
CFMTLexer cLexer( lexer.getInputState());
cLexer.SetSelector( selector);
lexer.SetCLexer( cLexer);
selector.select( &lexer);
FMTParser parser( selector);
// because we use the standard (ANTLR generated) constructor here
// we cannot do it in the constructor
parser.initializeASTFactory( FMTNodeFactory);
parser.setASTFactory( &FMTNodeFactory );
parser.format( 1);
fmtAST=parser.getAST();
#ifdef FMT_DEBUG
antlr::print_tree pt;
pt.pr_tree(static_cast<antlr::RefAST>(fmtAST));
cout << endl;
#endif
}
catch( GDLException& ex)
{
throw GDLException("Format: "+ex.getMessage());
}
catch( antlr::ANTLRException& ex)
{
throw GDLException("Format parser: "+ex.getMessage());
}
catch( exception& ex)
{
throw GDLException("Format exception: "+string(ex.what()));
}
catch(...)
{
throw GDLException("Format: general exception.");
}
return fmtAST;
}
| cenit/GDL | src/getfmtast.cpp | C++ | gpl-2.0 | 2,564 |
#
# \brief Download and unpack upstream library source codes
# \author Norman Feske
# \date 2009-10-16
#
#
# Print help information by default
#
help::
VERBOSE ?= @
ECHO = @echo
DOWNLOAD_DIR = download
CONTRIB_DIR = contrib
GNU_FIND = find
SHELL = bash
#
# Create download and contrib directory so that '<port>.mk' files
# do not need to care for them.
#
prepare:: $(DOWNLOAD_DIR) $(CONTRIB_DIR)
#
# Utility to check if a tool is installed
#
check_tool = $(if $(shell which $(1)),,$(error Need to have '$(1)' installed.))
$(call check_tool,wget)
$(call check_tool,patch)
#
# Include information about available ports
#
# Each '<port>.mk' file in the 'ports/' directory extends the following
# variables:
#
# PORTS - list names of the available ports, e.g., 'freetype-2.3.9'
# GEN_DIRS - list of automatically generated directories
# GEN_FILES - list of automatically generated files
#
# Furthermore, each '<port>.mk' file extends the 'prepare' rule for
# downloading and unpacking the corresponding upstream sources.
#
PKG ?= *
include $(addprefix ports/,$(addsuffix .mk,$(PKG)))
help::
$(ECHO) ""
$(ECHO) "Download and unpack upstream source codes:"
@for i in $(PORTS); do echo " $$i"; done
$(ECHO) ""
$(ECHO) "Downloads will be placed into the '$(DOWNLOAD_DIR)/' directory."
$(ECHO) "Source codes will be unpacked in the '$(CONTRIB_DIR)/' directory."
$(ECHO) ""
$(ECHO) "--- available commands ---"
$(ECHO) "prepare - download and unpack upstream source codes"
$(ECHO) "clean - remove upstream source codes"
$(ECHO) "cleanall - remove upstream source codes and downloads"
$(ECHO) ""
$(ECHO) "--- available arguments ---"
$(ECHO) "PKG=<package-list> - prepare only the specified packages,"
$(ECHO) " each package specified w/o version number"
#
# Remove download and contrib directories if empty
#
prepare::
$(VERBOSE)$(GNU_FIND) $(DOWNLOAD_DIR) -depth -type d -empty -delete
$(VERBOSE)$(GNU_FIND) $(CONTRIB_DIR) -depth -type d -empty -delete
$(DOWNLOAD_DIR) $(CONTRIB_DIR):
$(VERBOSE)mkdir -p $@
clean::
$(VERBOSE)rm -rf $(CONTRIB_DIR)
cleanall: clean
$(VERBOSE)rm -rf $(DOWNLOAD_DIR)
.NOTPARALLEL:
| m-stein/genode | ports/Makefile | Makefile | gpl-2.0 | 2,193 |
/*
* psgp_settings.h
*
* Created on: 21 Jan 2012
* Author: barillrl
*/
#ifndef PSGP_SETTINGS_H_
#define PSGP_SETTINGS_H_
//-----------------------------------------------------------------------------
// CONSTANTS AND OTHER GENERAL PARAMETERS
//-----------------------------------------------------------------------------
// Max number of parameters for PSGP (this limit is set by the R code)
#define NUM_PSGP_PARAMETERS 16
// Maximum number of observations kept for param estimation
#define MAX_OBS 1000
// Maximum number of active points
#define MAX_ACTIVE_POINTS 400
// Likelihood to nugget ratio
#define LIKELIHOOD_NUGGET_RATIO 0.01
// Number of sweeps through data with changing/fixed active set
#define NUM_SWEEPS_CHANGING 1
#define NUM_SWEEPS_FIXED 1
// Whether to use a GP instead of PSGP for parameter estimation
#define PARAMETER_ESTIMATION_USING_GP false
// Outer loops in parameter estimation for PSGP
#define PSGP_PARAM_ITERATIONS 3
// Inner loop (i.e. SCG iterations in each outer loop) for PSGP
#define PSGP_SCG_ITERATIONS 5
// Define whether to use full prediction (all data at once) or
// split prediction (by chunks of data)
#define USING_CHUNK_PREDICTION true
// Size of prediction chunk (in number of observations)
#define CHUNK_SIZE 1000
#endif /* PSGP_SETTINGS_H_ */
| SeSaMe-NUS/Smiler | src/predictor/GP/gp/psgp_settings.h | C | gpl-2.0 | 1,315 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="specimen_files/easytabs.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="specimen_files/specimen_stylesheet.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8" />
<style type="text/css">
body{
font-family: 'ralewaythin';
}
</style>
<title>Raleway Thin Specimen</title>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#container').easyTabs({defaultContent:1});
});
</script>
</head>
<body>
<div id="container">
<div id="header">
Raleway Thin </div>
<ul class="tabs">
<li><a href="#specimen">Specimen</a></li>
<li><a href="#layout">Sample Layout</a></li>
<li><a href="#glyphs">Glyphs & Languages</a></li>
<li><a href="#installing">Installing Webfonts</a></li>
</ul>
<div id="main_content">
<div id="specimen">
<div class="section">
<div class="grid12 firstcol">
<div class="huge">AaBb</div>
</div>
</div>
<div class="section">
<div class="glyph_range">A​B​C​D​E​F​G​H​I​J​K​L​M​N​O​P​Q​R​S​T​U​V​W​X​Y​Z​a​b​c​d​e​f​g​h​i​j​k​l​m​n​o​p​q​r​s​t​u​v​w​x​y​z​1​2​3​4​5​6​7​8​9​0​&​.​,​?​!​@​(​)​#​$​%​*​+​-​=​:​;</div>
</div>
<div class="section">
<div class="grid12 firstcol">
<table class="sample_table">
<tr><td>10</td><td class="size10">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>11</td><td class="size11">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>12</td><td class="size12">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>13</td><td class="size13">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>14</td><td class="size14">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>16</td><td class="size16">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>18</td><td class="size18">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>20</td><td class="size20">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>24</td><td class="size24">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>30</td><td class="size30">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>36</td><td class="size36">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>48</td><td class="size48">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>60</td><td class="size60">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>72</td><td class="size72">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>90</td><td class="size90">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
</table>
</div>
</div>
<div class="section" id="bodycomparison">
<div id="xheight">
<div class="fontbody">◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼body</div><div class="arialbody">body</div><div class="verdanabody">body</div><div class="georgiabody">body</div></div>
<div class="fontbody" style="z-index:1">
body<span>Raleway Thin</span>
</div>
<div class="arialbody" style="z-index:1">
body<span>Arial</span>
</div>
<div class="verdanabody" style="z-index:1">
body<span>Verdana</span>
</div>
<div class="georgiabody" style="z-index:1">
body<span>Georgia</span>
</div>
</div>
<div class="section psample psample_row1" id="">
<div class="grid2 firstcol">
<p class="size10"><span>10.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid3">
<p class="size11"><span>11.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid3">
<p class="size12"><span>12.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid4">
<p class="size13"><span>13.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="white_blend"></div>
</div>
<div class="section psample psample_row2" id="">
<div class="grid3 firstcol">
<p class="size14"><span>14.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid4">
<p class="size16"><span>16.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid5">
<p class="size18"><span>18.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="white_blend"></div>
</div>
<div class="section psample psample_row3" id="">
<div class="grid5 firstcol">
<p class="size20"><span>20.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid7">
<p class="size24"><span>24.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="white_blend"></div>
</div>
<div class="section psample psample_row4" id="">
<div class="grid12 firstcol">
<p class="size30"><span>30.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="white_blend"></div>
</div>
<div class="section psample psample_row1 fullreverse">
<div class="grid2 firstcol">
<p class="size10"><span>10.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid3">
<p class="size11"><span>11.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid3">
<p class="size12"><span>12.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid4">
<p class="size13"><span>13.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="black_blend"></div>
</div>
<div class="section psample psample_row2 fullreverse">
<div class="grid3 firstcol">
<p class="size14"><span>14.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid4">
<p class="size16"><span>16.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid5">
<p class="size18"><span>18.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="black_blend"></div>
</div>
<div class="section psample fullreverse psample_row3" id="">
<div class="grid5 firstcol">
<p class="size20"><span>20.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid7">
<p class="size24"><span>24.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="black_blend"></div>
</div>
<div class="section psample fullreverse psample_row4" id="" style="border-bottom: 20px #000 solid;">
<div class="grid12 firstcol">
<p class="size30"><span>30.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="black_blend"></div>
</div>
</div>
<div id="layout">
<div class="section">
<div class="grid12 firstcol">
<h1>Lorem Ipsum Dolor</h1>
<h2>Etiam porta sem malesuada magna mollis euismod</h2>
<p class="byline">By <a href="#link">Aenean Lacinia</a></p>
</div>
</div>
<div class="section">
<div class="grid8 firstcol">
<p class="large">Donec sed odio dui. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. </p>
<h3>Pellentesque ornare sem</h3>
<p>Maecenas sed diam eget risus varius blandit sit amet non magna. Maecenas faucibus mollis interdum. Donec ullamcorper nulla non metus auctor fringilla. Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam id dolor id nibh ultricies vehicula ut id elit. </p>
<p>Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. </p>
<p>Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Aenean lacinia bibendum nulla sed consectetur. </p>
<p>Nullam quis risus eget urna mollis ornare vel eu leo. Nullam quis risus eget urna mollis ornare vel eu leo. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec ullamcorper nulla non metus auctor fringilla. </p>
<h3>Cras mattis consectetur</h3>
<p>Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Aenean lacinia bibendum nulla sed consectetur. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras mattis consectetur purus sit amet fermentum. </p>
<p>Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam quis risus eget urna mollis ornare vel eu leo. Cras mattis consectetur purus sit amet fermentum.</p>
</div>
<div class="grid4 sidebar">
<div class="box reverse">
<p class="last">Nullam quis risus eget urna mollis ornare vel eu leo. Donec ullamcorper nulla non metus auctor fringilla. Cras mattis consectetur purus sit amet fermentum. Sed posuere consectetur est at lobortis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>
</div>
<p class="caption">Maecenas sed diam eget risus varius.</p>
<p>Vestibulum id ligula porta felis euismod semper. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Vestibulum id ligula porta felis euismod semper. Sed posuere consectetur est at lobortis. Maecenas sed diam eget risus varius blandit sit amet non magna. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. </p>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Nullam quis risus eget urna mollis ornare vel eu leo. </p>
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec ullamcorper nulla non metus auctor fringilla. Maecenas faucibus mollis interdum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. </p>
</div>
</div>
</div>
<div id="glyphs">
<div class="section">
<div class="grid12 firstcol">
<h1>Language Support</h1>
<p>The subset of Raleway Thin in this kit supports the following languages:<br />
Albanian, Basque, Breton, Chamorro, Danish, Dutch, English, Faroese, Finnish, French, Frisian, Galician, German, Icelandic, Italian, Malagasy, Norwegian, Portuguese, Spanish, Swedish </p>
<h1>Glyph Chart</h1>
<p>The subset of Raleway Thin in this kit includes all the glyphs listed below. Unicode entities are included above each glyph to help you insert individual characters into your layout.</p>
<div id="glyph_chart">
<div><p>&#13;</p> </div>
<div><p>&#32;</p> </div>
<div><p>&#33;</p>!</div>
<div><p>&#34;</p>"</div>
<div><p>&#35;</p>#</div>
<div><p>&#36;</p>$</div>
<div><p>&#37;</p>%</div>
<div><p>&#38;</p>&</div>
<div><p>&#39;</p>'</div>
<div><p>&#40;</p>(</div>
<div><p>&#41;</p>)</div>
<div><p>&#42;</p>*</div>
<div><p>&#43;</p>+</div>
<div><p>&#44;</p>,</div>
<div><p>&#45;</p>-</div>
<div><p>&#46;</p>.</div>
<div><p>&#47;</p>/</div>
<div><p>&#48;</p>0</div>
<div><p>&#49;</p>1</div>
<div><p>&#50;</p>2</div>
<div><p>&#51;</p>3</div>
<div><p>&#52;</p>4</div>
<div><p>&#53;</p>5</div>
<div><p>&#54;</p>6</div>
<div><p>&#55;</p>7</div>
<div><p>&#56;</p>8</div>
<div><p>&#57;</p>9</div>
<div><p>&#58;</p>:</div>
<div><p>&#59;</p>;</div>
<div><p>&#60;</p><</div>
<div><p>&#61;</p>=</div>
<div><p>&#62;</p>></div>
<div><p>&#63;</p>?</div>
<div><p>&#64;</p>@</div>
<div><p>&#65;</p>A</div>
<div><p>&#66;</p>B</div>
<div><p>&#67;</p>C</div>
<div><p>&#68;</p>D</div>
<div><p>&#69;</p>E</div>
<div><p>&#70;</p>F</div>
<div><p>&#71;</p>G</div>
<div><p>&#72;</p>H</div>
<div><p>&#73;</p>I</div>
<div><p>&#74;</p>J</div>
<div><p>&#75;</p>K</div>
<div><p>&#76;</p>L</div>
<div><p>&#77;</p>M</div>
<div><p>&#78;</p>N</div>
<div><p>&#79;</p>O</div>
<div><p>&#80;</p>P</div>
<div><p>&#81;</p>Q</div>
<div><p>&#82;</p>R</div>
<div><p>&#83;</p>S</div>
<div><p>&#84;</p>T</div>
<div><p>&#85;</p>U</div>
<div><p>&#86;</p>V</div>
<div><p>&#87;</p>W</div>
<div><p>&#88;</p>X</div>
<div><p>&#89;</p>Y</div>
<div><p>&#90;</p>Z</div>
<div><p>&#91;</p>[</div>
<div><p>&#92;</p>\</div>
<div><p>&#93;</p>]</div>
<div><p>&#94;</p>^</div>
<div><p>&#95;</p>_</div>
<div><p>&#96;</p>`</div>
<div><p>&#97;</p>a</div>
<div><p>&#98;</p>b</div>
<div><p>&#99;</p>c</div>
<div><p>&#100;</p>d</div>
<div><p>&#101;</p>e</div>
<div><p>&#102;</p>f</div>
<div><p>&#103;</p>g</div>
<div><p>&#104;</p>h</div>
<div><p>&#105;</p>i</div>
<div><p>&#106;</p>j</div>
<div><p>&#107;</p>k</div>
<div><p>&#108;</p>l</div>
<div><p>&#109;</p>m</div>
<div><p>&#110;</p>n</div>
<div><p>&#111;</p>o</div>
<div><p>&#112;</p>p</div>
<div><p>&#113;</p>q</div>
<div><p>&#114;</p>r</div>
<div><p>&#115;</p>s</div>
<div><p>&#116;</p>t</div>
<div><p>&#117;</p>u</div>
<div><p>&#118;</p>v</div>
<div><p>&#119;</p>w</div>
<div><p>&#120;</p>x</div>
<div><p>&#121;</p>y</div>
<div><p>&#122;</p>z</div>
<div><p>&#123;</p>{</div>
<div><p>&#124;</p>|</div>
<div><p>&#125;</p>}</div>
<div><p>&#126;</p>~</div>
<div><p>&#160;</p> </div>
<div><p>&#161;</p>¡</div>
<div><p>&#162;</p>¢</div>
<div><p>&#163;</p>£</div>
<div><p>&#165;</p>¥</div>
<div><p>&#166;</p>¦</div>
<div><p>&#167;</p>§</div>
<div><p>&#168;</p>¨</div>
<div><p>&#169;</p>©</div>
<div><p>&#170;</p>ª</div>
<div><p>&#171;</p>«</div>
<div><p>&#172;</p>¬</div>
<div><p>&#173;</p>­</div>
<div><p>&#174;</p>®</div>
<div><p>&#175;</p>¯</div>
<div><p>&#176;</p>°</div>
<div><p>&#177;</p>±</div>
<div><p>&#178;</p>²</div>
<div><p>&#179;</p>³</div>
<div><p>&#180;</p>´</div>
<div><p>&#181;</p>µ</div>
<div><p>&#182;</p>¶</div>
<div><p>&#183;</p>·</div>
<div><p>&#184;</p>¸</div>
<div><p>&#185;</p>¹</div>
<div><p>&#186;</p>º</div>
<div><p>&#187;</p>»</div>
<div><p>&#188;</p>¼</div>
<div><p>&#189;</p>½</div>
<div><p>&#190;</p>¾</div>
<div><p>&#191;</p>¿</div>
<div><p>&#192;</p>À</div>
<div><p>&#193;</p>Á</div>
<div><p>&#194;</p>Â</div>
<div><p>&#195;</p>Ã</div>
<div><p>&#196;</p>Ä</div>
<div><p>&#197;</p>Å</div>
<div><p>&#198;</p>Æ</div>
<div><p>&#199;</p>Ç</div>
<div><p>&#200;</p>È</div>
<div><p>&#201;</p>É</div>
<div><p>&#202;</p>Ê</div>
<div><p>&#203;</p>Ë</div>
<div><p>&#204;</p>Ì</div>
<div><p>&#205;</p>Í</div>
<div><p>&#206;</p>Î</div>
<div><p>&#207;</p>Ï</div>
<div><p>&#208;</p>Ð</div>
<div><p>&#209;</p>Ñ</div>
<div><p>&#210;</p>Ò</div>
<div><p>&#211;</p>Ó</div>
<div><p>&#212;</p>Ô</div>
<div><p>&#213;</p>Õ</div>
<div><p>&#214;</p>Ö</div>
<div><p>&#215;</p>×</div>
<div><p>&#216;</p>Ø</div>
<div><p>&#217;</p>Ù</div>
<div><p>&#218;</p>Ú</div>
<div><p>&#219;</p>Û</div>
<div><p>&#220;</p>Ü</div>
<div><p>&#221;</p>Ý</div>
<div><p>&#222;</p>Þ</div>
<div><p>&#223;</p>ß</div>
<div><p>&#224;</p>à</div>
<div><p>&#225;</p>á</div>
<div><p>&#226;</p>â</div>
<div><p>&#227;</p>ã</div>
<div><p>&#228;</p>ä</div>
<div><p>&#229;</p>å</div>
<div><p>&#230;</p>æ</div>
<div><p>&#231;</p>ç</div>
<div><p>&#232;</p>è</div>
<div><p>&#233;</p>é</div>
<div><p>&#234;</p>ê</div>
<div><p>&#235;</p>ë</div>
<div><p>&#236;</p>ì</div>
<div><p>&#237;</p>í</div>
<div><p>&#238;</p>î</div>
<div><p>&#239;</p>ï</div>
<div><p>&#240;</p>ð</div>
<div><p>&#241;</p>ñ</div>
<div><p>&#242;</p>ò</div>
<div><p>&#243;</p>ó</div>
<div><p>&#244;</p>ô</div>
<div><p>&#245;</p>õ</div>
<div><p>&#246;</p>ö</div>
<div><p>&#247;</p>÷</div>
<div><p>&#248;</p>ø</div>
<div><p>&#249;</p>ù</div>
<div><p>&#250;</p>ú</div>
<div><p>&#251;</p>û</div>
<div><p>&#252;</p>ü</div>
<div><p>&#253;</p>ý</div>
<div><p>&#254;</p>þ</div>
<div><p>&#255;</p>ÿ</div>
<div><p>&#338;</p>Œ</div>
<div><p>&#339;</p>œ</div>
<div><p>&#376;</p>Ÿ</div>
<div><p>&#710;</p>ˆ</div>
<div><p>&#732;</p>˜</div>
<div><p>&#8192;</p> </div>
<div><p>&#8193;</p> </div>
<div><p>&#8194;</p> </div>
<div><p>&#8195;</p> </div>
<div><p>&#8196;</p> </div>
<div><p>&#8197;</p> </div>
<div><p>&#8198;</p> </div>
<div><p>&#8199;</p> </div>
<div><p>&#8200;</p> </div>
<div><p>&#8201;</p> </div>
<div><p>&#8202;</p> </div>
<div><p>&#8208;</p>‐</div>
<div><p>&#8209;</p>‑</div>
<div><p>&#8210;</p>‒</div>
<div><p>&#8211;</p>–</div>
<div><p>&#8212;</p>—</div>
<div><p>&#8216;</p>‘</div>
<div><p>&#8217;</p>’</div>
<div><p>&#8218;</p>‚</div>
<div><p>&#8220;</p>“</div>
<div><p>&#8221;</p>”</div>
<div><p>&#8222;</p>„</div>
<div><p>&#8226;</p>•</div>
<div><p>&#8230;</p>…</div>
<div><p>&#8239;</p> </div>
<div><p>&#8249;</p>‹</div>
<div><p>&#8250;</p>›</div>
<div><p>&#8287;</p> </div>
<div><p>&#8364;</p>€</div>
<div><p>&#8482;</p>™</div>
<div><p>&#9724;</p>◼</div>
<div><p>&#64257;</p>fi</div>
<div><p>&#64258;</p>fl</div>
<div><p>&#64259;</p>ffi</div>
<div><p>&#64260;</p>ffl</div>
</div>
</div>
</div>
</div>
<div id="specs">
</div>
<div id="installing">
<div class="section">
<div class="grid7 firstcol">
<h1>Installing Webfonts</h1>
<p>Webfonts are supported by all major browser platforms but not all in the same way. There are currently four different font formats that must be included in order to target all browsers. This includes TTF, WOFF, EOT and SVG.</p>
<h2>1. Upload your webfonts</h2>
<p>You must upload your webfont kit to your website. They should be in or near the same directory as your CSS files.</p>
<h2>2. Include the webfont stylesheet</h2>
<p>A special CSS @font-face declaration helps the various browsers select the appropriate font it needs without causing you a bunch of headaches. Learn more about this syntax by reading the <a href="http://www.fontspring.com/blog/further-hardening-of-the-bulletproof-syntax">Fontspring blog post</a> about it. The code for it is as follows:</p>
<code>
@font-face{
font-family: 'MyWebFont';
src: url('WebFont.eot');
src: url('WebFont.eot?#iefix') format('embedded-opentype'),
url('WebFont.woff') format('woff'),
url('WebFont.ttf') format('truetype'),
url('WebFont.svg#webfont') format('svg');
}
</code>
<p>We've already gone ahead and generated the code for you. All you have to do is link to the stylesheet in your HTML, like this:</p>
<code><link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8" /></code>
<h2>3. Modify your own stylesheet</h2>
<p>To take advantage of your new fonts, you must tell your stylesheet to use them. Look at the original @font-face declaration above and find the property called "font-family." The name linked there will be what you use to reference the font. Prepend that webfont name to the font stack in the "font-family" property, inside the selector you want to change. For example:</p>
<code>p { font-family: 'WebFont', Arial, sans-serif; }</code>
<h2>4. Test</h2>
<p>Getting webfonts to work cross-browser <em>can</em> be tricky. Use the information in the sidebar to help you if you find that fonts aren't loading in a particular browser.</p>
</div>
<div class="grid5 sidebar">
<div class="box">
<h2>Troubleshooting<br />Font-Face Problems</h2>
<p>Having trouble getting your webfonts to load in your new website? Here are some tips to sort out what might be the problem.</p>
<h3>Fonts not showing in any browser</h3>
<p>This sounds like you need to work on the plumbing. You either did not upload the fonts to the correct directory, or you did not link the fonts properly in the CSS. If you've confirmed that all this is correct and you still have a problem, take a look at your .htaccess file and see if requests are getting intercepted.</p>
<h3>Fonts not loading in iPhone or iPad</h3>
<p>The most common problem here is that you are serving the fonts from an IIS server. IIS refuses to serve files that have unknown MIME types. If that is the case, you must set the MIME type for SVG to "image/svg+xml" in the server settings. Follow these instructions from Microsoft if you need help.</p>
<h3>Fonts not loading in Firefox</h3>
<p>The primary reason for this failure? You are still using a version Firefox older than 3.5. So upgrade already! If that isn't it, then you are very likely serving fonts from a different domain. Firefox requires that all font assets be served from the same domain. Lastly it is possible that you need to add WOFF to your list of MIME types (if you are serving via IIS.)</p>
<h3>Fonts not loading in IE</h3>
<p>Are you looking at Internet Explorer on an actual Windows machine or are you cheating by using a service like Adobe BrowserLab? Many of these screenshot services do not render @font-face for IE. Best to test it on a real machine.</p>
<h3>Fonts not loading in IE9</h3>
<p>IE9, like Firefox, requires that fonts be served from the same domain as the website. Make sure that is the case.</p>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
<p>©2010-2011 Font Squirrel. All rights reserved.</p>
</div>
</div>
</body>
</html>
| yujihayashi/socialismosustentavel | wp-content/themes/socialismosustentavel/fonts/raleway-thin-demo.html | HTML | gpl-2.0 | 37,757 |
<?php
/**
* Created by PhpStorm.
* User: Sheila
* Date: 12/12/2014
* Time: 6:51 AM
*/
| experimentX/worklor | wp-content/plugins/booklor/testlor.php | PHP | gpl-2.0 | 91 |
.club_logo {
text-align: center;
}
.club_name {
text-align: center;
}
.club_teams {
text-align: center;
}
.club_address {
text-align: center;
} | xbegault/clrh-idf | components/com_joomleague/assets/css/clubs.css | CSS | gpl-2.0 | 150 |
#!/usr/bin/env python
import math
fin = open('figs/single-rod-in-water.dat', 'r')
fout = open('figs/single-rods-calculated-density.dat', 'w')
kB = 3.16681539628059e-6 # This is Boltzmann's constant in Hartree/Kelvin
first = 1
nm = 18.8972613
for line in fin:
current = str(line)
pieces = current.split('\t')
if first:
r2 = float(pieces[0])/2*nm
E2 = float(pieces[1])
first = 0
else:
if ((float(pieces[0])/2*nm - r2) > 0.25):
r1 = r2
r2 = float(pieces[0])/2*nm
E1 = E2
E2 = float(pieces[1]) # actually it's energy per unit length!
length = 1 # arbitrary
r = (r1 + r2)/2
dEdR = (E2-E1)/(r2-r1)*length
area = 2*math.pi*r*length
force = dEdR
pressure = force/area
kT = kB*298 # about this
ncontact = pressure/kT
fout.write(str(r)+'\t'+str(ncontact)+'\n')
fin.close()
fout.close()
| droundy/deft | papers/hughes-saft/figs/density_calc.py | Python | gpl-2.0 | 986 |
/*
This is a File System Recognizer for IRIG 106 Ch10 Filesystem
Copyright (C) 2014 Arthur Walton.
Heavily derived from the File System Recognizer for RomFs
Copyright (C) 2001 Bo Brantén.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _ROM_FS_
#define _ROM_FS_
#define SECTOR_SIZE 512
#define CH10_MAGIC "FORTYtwo"
#define CH10_MAGIC_OFFSET 512
//
// Types used by Linux
//
#include "ltypes.h"
//
// Use 1 byte packing of on-disk structures
//
#include <pshpack1.h>
//
// The following is a subset of linux/include/linux/ch10fs_fs.h from
// version 2.2.14
//
/* The basic structures of the ch10fs filesystem */
#define CH10_BLOCK_SIZE 512
#define CH10_MAXFN 48
#define MAX_FILES_PER_DIR 4
#define CH10_MAX_DIR_BLOCKS 64
/*
* Ch10 Directory Entry
*/
struct ch10_dir_entry {
__u8 name[56]; // name of the directory entry
__u64 blockNum; // block number that the entry starts at
__u64 numBlocks; // length of the entry in blocks
__u64 size; // length of the entry in bytes
__u8 createDate[8]; // date entry was created
__u8 createTime[8]; // time entry was created
__u8 timeType; // time system the previous date and time were stored in
__u8 reserved[7]; // currently unused, reserved for future use
__u8 closeTime[8]; // time this entry was finished being written
};
/*
* Ch10 Directory Block
*/
struct ch10_dir_block {
__u8 magicNumAscii[8]; // Identifies this as being a directory block, always set to FORTYtwo
__u8 revNum; // revision number of the data recording standard in use
__u8 shutdown; // flag to indicate filesystem was not properly shutdown while writing to this directory
__u16 numEntries; // number of directory entries/files that are in this block
__u32 bytesPerBlock; // number of bytes per block
__u8 volName[32]; // name of this directory block
__u64 forwardLink:64; // block address of next directory block
__u64 reverseLink:64; // block address of previous directory block
struct ch10_dir_entry dirEntries[MAX_FILES_PER_DIR]; // all entries/files in the block
};
#include <poppack.h>
#endif
| ArthurWalton/windows-ch10-fs | ch10fsrec/inc/ch10_fs.h | C | gpl-2.0 | 2,857 |
dojo.require("dijit.Dialog");
dojo.require("dijit.form.FilteringSelect");
dojo.require('dijit.form.Button');
dojo.require('dijit.TooltipDialog');
dojo.require('dijit.form.DropDownButton');
dojo.require('dijit.form.CheckBox');
dojo.require('dojox.grid.DataGrid');
dojo.require('dojo.data.ItemFileWriteStore');
dojo.require('openils.widget.OrgUnitFilteringSelect');
dojo.require('openils.acq.CurrencyType');
dojo.require('openils.Event');
dojo.require('openils.Util');
dojo.require('openils.User');
dojo.require('openils.CGI');
dojo.require('openils.PermaCrud');
dojo.require('openils.widget.AutoGrid');
dojo.require('openils.widget.ProgressDialog');
dojo.require('fieldmapper.OrgUtils');
dojo.requireLocalization('openils.acq', 'acq');
var localeStrings = dojo.i18n.getLocalization('openils.acq', 'acq');
var contextOrg;
var rolloverResponses;
var rolloverMode = false;
var fundFleshFields = [
'spent_balance',
'combined_balance',
'spent_total',
'encumbrance_total',
'debit_total',
'allocation_total'
];
var adminPermOrgs = [];
var cachedFunds = [];
function initPage() {
contextOrg = openils.User.user.ws_ou();
/* Reveal controls for rollover without money if org units say ok.
* Actual ability to do the operation is controlled in the database, of
* course. */
var ouSettings = fieldmapper.aou.fetchOrgSettingBatch(
openils.User.user.ws_ou(), ["acq.fund.allow_rollover_without_money"]
);
if (
ouSettings["acq.fund.allow_rollover_without_money"] &&
ouSettings["acq.fund.allow_rollover_without_money"].value
) {
dojo.query(".encumb_only").forEach(
function(o) { openils.Util.show(o, "table-row"); }
);
}
var connect = function() {
dojo.connect(contextOrgSelector, 'onChange',
function() {
contextOrg = this.attr('value');
dojo.byId('oils-acq-rollover-ctxt-org').innerHTML =
fieldmapper.aou.findOrgUnit(contextOrg).shortname();
rolloverMode = false;
gridDataLoader();
}
);
};
dojo.connect(refreshButton, 'onClick',
function() { rolloverMode = false; gridDataLoader(); });
new openils.User().buildPermOrgSelector(
['ADMIN_ACQ_FUND', 'VIEW_FUND'],
contextOrgSelector, contextOrg, connect);
dojo.byId('oils-acq-rollover-ctxt-org').innerHTML =
fieldmapper.aou.findOrgUnit(contextOrg).shortname();
loadYearSelector();
lfGrid.onItemReceived = function(item) {cachedFunds.push(item)};
new openils.User().getPermOrgList(
'ADMIN_ACQ_FUND',
function(list) {
adminPermOrgs = list;
loadFundGrid(
new openils.CGI().param('year')
|| new Date().getFullYear().toString());
},
true, true
);
}
function gridDataLoader() {
lfGrid.resetStore();
if(rolloverMode) {
var offset = lfGrid.displayOffset;
for(var i = offset; i < (offset + lfGrid.displayLimit - 1); i++) {
var fund = rolloverResponses[i];
if(!fund) break;
lfGrid.store.newItem(fieldmapper.acqf.toStoreItem(fund));
}
} else {
loadFundGrid();
}
}
function getBalanceInfo(rowIdx, item) {
if (!item) return '';
var fundId = this.grid.store.getValue(item, 'id');
var fund = cachedFunds.filter(function(f) { return f.id() == fundId })[0];
var cb = fund.combined_balance();
return cb ? cb.amount() : '0';
}
function loadFundGrid(year) {
openils.Util.hide('acq-fund-list-rollover-summary');
year = year || fundFilterYearSelect.attr('value');
cachedFunds = [];
lfGrid.loadAll(
{
flesh : 1,
flesh_fields : {acqf : fundFleshFields},
// by default, sort funds I can edit to the front
order_by : [
{ 'class' : 'acqf',
field : 'org',
compare : {'in' : adminPermOrgs},
direction : 'desc'
},
{ 'class' : 'acqf',
field : 'name'
}
]
}, {
year : year,
org : fieldmapper.aou.descendantNodeList(contextOrg, true)
}
);
}
function loadYearSelector() {
fieldmapper.standardRequest(
['open-ils.acq', 'open-ils.acq.fund.org.years.retrieve'],
{ async : true,
params : [openils.User.authtoken, {}, {limit_perm : 'VIEW_FUND'}],
oncomplete : function(r) {
var yearList = openils.Util.readResponse(r);
if(!yearList) return;
yearList = yearList.map(function(year){return {year:year+''};}); // dojo wants strings
var yearStore = {identifier:'year', name:'year', items:yearList};
yearStore.items = yearStore.items.sort().reverse();
fundFilterYearSelect.store = new dojo.data.ItemFileWriteStore({data:yearStore});
// default to this year
fundFilterYearSelect.setValue(new Date().getFullYear().toString());
dojo.connect(
fundFilterYearSelect,
'onChange',
function() {
rolloverMode = false;
gridDataLoader();
}
);
}
}
);
}
function performRollover(args) {
rolloverMode = true;
progressDialog.show(true, "Processing...");
rolloverResponses = [];
var method = 'open-ils.acq.fiscal_rollover';
if(args.rollover[0] == 'on') {
method += '.combined';
} else {
method += '.propagate';
}
var dryRun = args.dry_run[0] == 'on';
if(dryRun) method += '.dry_run';
var encumbOnly = args.encumb_only[0] == 'on';
var count = 0;
var amount_rolled = 0;
var year = fundFilterYearSelect.attr('value'); // TODO alternate selector?
fieldmapper.standardRequest(
['open-ils.acq', method],
{
async : true,
params : [
openils.User.authtoken,
year,
contextOrg,
(args.child_orgs[0] == 'on'),
{ encumb_only : encumbOnly }
],
onresponse : function(r) {
var resp = openils.Util.readResponse(r);
rolloverResponses.push(resp.fund);
count += 1;
amount_rolled += Number(resp.rollover_amount);
},
oncomplete : function() {
var nextYear = Number(year) + 1;
rolloverResponses = rolloverResponses.sort(
function(a, b) {
if(a.code() > b.code())
return 1;
return -1;
}
)
// add the new, rolled funds to the cache. Note that in dry-run
// mode, these are ephemeral and no longer exist on the server.
cachedFunds = cachedFunds.concat(rolloverResponses);
dojo.byId('acq-fund-list-rollover-summary-header').innerHTML =
dojo.string.substitute(
localeStrings.FUND_LIST_ROLLOVER_SUMMARY,
[nextYear]
);
dojo.byId('acq-fund-list-rollover-summary-funds').innerHTML =
dojo.string.substitute(
localeStrings.FUND_LIST_ROLLOVER_SUMMARY_FUNDS,
[nextYear, count]
);
dojo.byId('acq-fund-list-rollover-summary-rollover-amount').innerHTML =
dojo.string.substitute(
localeStrings.FUND_LIST_ROLLOVER_SUMMARY_ROLLOVER_AMOUNT,
[nextYear, amount_rolled]
);
if(!dryRun) {
openils.Util.hide('acq-fund-list-rollover-summary-dry-run');
// add the new year to the year selector if it's not already there
fundFilterYearSelect.store.fetch({
query : {year : nextYear},
onComplete:
function(list) {
if(list && list.length > 0) return;
fundFilterYearSelect.store.newItem({year : nextYear});
}
});
}
openils.Util.show('acq-fund-list-rollover-summary');
progressDialog.hide();
gridDataLoader();
}
}
);
}
openils.Util.addOnLoad(initPage);
| ubcic/evergreen | Open-ILS/web/js/ui/default/acq/financial/list_funds.js | JavaScript | gpl-2.0 | 8,907 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Sims")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sims")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("69611fa1-6403-4862-abd4-bd4e91c43d06")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| efaruk/playground | sims/Sims/Properties/AssemblyInfo.cs | C# | gpl-2.0 | 1,420 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
Uses of Interface com.google.gwt.core.ext.soyc.HasDependencies (Google Web Toolkit Javadoc)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Interface com.google.gwt.core.ext.soyc.HasDependencies (Google Web Toolkit Javadoc)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/HasDependencies.html" title="interface in com.google.gwt.core.ext.soyc"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
GWT 2.6.0</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?com/google/gwt/core/ext/soyc//class-useHasDependencies.html" target="_top"><B>FRAMES</B></A>
<A HREF="HasDependencies.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Interface<br>com.google.gwt.core.ext.soyc.HasDependencies</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/HasDependencies.html" title="interface in com.google.gwt.core.ext.soyc">HasDependencies</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#com.google.gwt.core.ext.soyc"><B>com.google.gwt.core.ext.soyc</B></A></TD>
<TD>This package contains interfaces that provide access to
"Story of Your Compile" information. </TD>
</TR>
</TABLE>
<P>
<A NAME="com.google.gwt.core.ext.soyc"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/HasDependencies.html" title="interface in com.google.gwt.core.ext.soyc">HasDependencies</A> in <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/package-summary.html">com.google.gwt.core.ext.soyc</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Subinterfaces of <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/HasDependencies.html" title="interface in com.google.gwt.core.ext.soyc">HasDependencies</A> in <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/package-summary.html">com.google.gwt.core.ext.soyc</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> interface</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../../com/google/gwt/core/ext/soyc/ClassMember.html" title="interface in com.google.gwt.core.ext.soyc">ClassMember</A></B></CODE>
<BR>
Represents a reference type, such as a class or interface, in the compiled
output.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> interface</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../../com/google/gwt/core/ext/soyc/MethodMember.html" title="interface in com.google.gwt.core.ext.soyc">MethodMember</A></B></CODE>
<BR>
Represents compiled JS code derived from a Java method.</TD>
</TR>
</TABLE>
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/HasDependencies.html" title="interface in com.google.gwt.core.ext.soyc"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
GWT 2.6.0</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?com/google/gwt/core/ext/soyc//class-useHasDependencies.html" target="_top"><B>FRAMES</B></A>
<A HREF="HasDependencies.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| JakaCikac/dScrum | web/WEB-INF/classes/gwt-2.6.0/doc/javadoc/com/google/gwt/core/ext/soyc/class-use/HasDependencies.html | HTML | gpl-2.0 | 8,539 |
<!DOCTYPE html>
<!-- Website template by freewebsitetemplates.com -->
<html>
<head>
<meta charset="UTF-8">
<title>Blog - Astronomy Website Template</title>
<link rel="stylesheet" href="css/style.css" type="text/css">
</head>
<body>
<div id="header">
<div class="wrapper clearfix">
<div id="logo">
<a href="index.html"><img src="images/logo.png" alt="LOGO"></a>
</div>
<ul id="navigation">
<li>
<a href="index.html">Home</a>
</li>
<li>
<a href="about.html">About</a>
</li>
<li class="selected">
<a href="blog.html">Blog</a>
</li>
<li>
<a href="gallery.html">Gallery</a>
</li>
<li>
<a href="contact.html">Contact Us</a>
</li>
</ul>
</div>
</div>
<div id="contents">
<div class="wrapper clearfix">
<div id="sidebar">
<ul>
<li>
<a href="blog.html"><img src="images/earth-small.jpg" alt="Img" height="154" width="213"></a>
</li>
<li>
<a href="blog.html"><img src="images/spaceshuttle-closeup.jpg" alt="Img" height="154" width="213"></a>
</li>
</ul>
<div class="click-here">
<h1>Lorem Ipsum Dolor!</h1>
<a href="index.html" class="btn1">Click Here!</a>
</div>
</div>
<div class="main">
<h1>Blog</h1>
<ul class="list">
<li>
<span class="time">01-01-2012</span>
<h4>Blog Title One</h4>
<p>
This website template has been designed by <a href="http://www.freewebsitetemplates.com/">Free Website Templates</a> for you, for free. You can replace all this text with your
own text.This website template has been designed by <a href="http://www.freewebsitetemplates.com/">Free Website Templates</a> for you, for free. You can replace all this text with
your own text.
</p>
<a href="blog.html" class="more">Read more>></a>
</li>
<li>
<span class="time">01-01-2012</span>
<h4>Blog Title One</h4>
<p>
This website template has been designed by <a href="http://www.freewebsitetemplates.com/">Free Website Templates</a> for you, for free. You can replace all this text with your
own text.This website template has been designed by <a href="http://www.freewebsitetemplates.com/">Free Website Templates</a> for you, for free. You can replace all this text with
your own text.
</p>
<a href="blog.html" class="more">Read more>></a>
</li>
<li>
<span class="time">01-01-2012</span>
<h4>Blog Title One</h4>
<p>
This website template has been designed by <a href="http://www.freewebsitetemplates.com/">Free Website Templates</a> for you, for free. You can replace all this text with your
own text.This website template has been designed by <a href="http://www.freewebsitetemplates.com/">Free Website Templates</a> for you, for free. You can replace all this text with
your own text.
</p>
<a href="blog.html" class="more">Read more>></a>
</li>
</ul>
<ul class="pagination">
<li>
<a href="blog.html"><<</a>
</li>
<li>
<a href="blog.html">First</a>
</li>
<li class="selected">
<a href="blog.html">1</a>
</li>
<li>
<a href="blog.html">2</a>
</li>
<li>
<a href="blog.html">3</a>
</li>
<li>
<a href="blog.html">4</a>
</li>
<li>
<a href="blog.html">5</a>
</li>
<li>
<a href="blog.html">6</a>
</li>
<li>
<a href="blog.html">7</a>
</li>
<li>
<a href="blog.html">8</a>
</li>
<li>
<a href="blog.html">9</a>
</li>
<li>
<a href="blog.html">10</a>
</li>
<li>
<a href="blog.html">11</a>
</li>
<li>
<a href="blog.html">12</a>
</li>
<li>
<a href="blog.html">13</a>
</li>
<li>
<a href="blog.html">14</a>
</li>
<li>
<a href="blog.html">15</a>
</li>
<li>
<a href="blog.html">16</a>
</li>
<li>
<a href="blog.html">17</a>
</li>
<li>
<a href="blog.html">18</a>
</li>
<li>
<a href="blog.html">19</a>
</li>
<li>
<a href="blog.html">20</a>
</li>
<li>
<a href="blog.html">Last</a>
</li>
<li>
<a href="blog.html">>></a>
</li>
</ul>
<!-- /.pagination -->
</div>
</div>
</div>
<div id="footer">
<ul id="featured" class="wrapper clearfix">
<li>
<img src="images/astronaut.jpg" alt="Img" height="204" width="220">
<h3><a href="blog.html">Category 1</a></h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec mi tortor. Phasellus commodo semper vehicula.
</p>
</li>
<li>
<img src="images/earth.jpg" alt="Img" height="204" width="220">
<h3><a href="blog.html">Category 2</a></h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec mi tortor. Phasellus commodo semper vehicula.
</p>
</li>
<li>
<img src="images/spacecraft-small.jpg" alt="Img" height="204" width="220">
<h3><a href="blog.html">Category 3</a></h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec mi tortor. Phasellus commodo semper vehicula.
</p>
</li>
<li>
<img src="images/space-shuttle.jpg" alt="Img" height="204" width="220">
<h3><a href="blog.html">Category 4</a></h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec mi tortor. Phasellus commodo semper vehicula.
</p>
</li>
</ul>
<div class="body">
<div class="wrapper clearfix">
<div id="links">
<div>
<h4>Social</h4>
<ul>
<li>
<a href="http://freewebsitetemplates.com/go/googleplus/" target="_blank">Google +</a>
</li>
<li>
<a href="http://freewebsitetemplates.com/go/facebook/" target="_blank">Facebook</a>
</li>
<li>
<a href="http://freewebsitetemplates.com/go/youtube/" target="_blank">Youtube</a>
</li>
</ul>
</div>
<div>
<h4>Heading placeholder</h4>
<ul>
<li>
<a href="index.html">Link Title 1</a>
</li>
<li>
<a href="index.html">Link Title 2</a>
</li>
<li>
<a href="index.html">Link Title 3</a>
</li>
</ul>
</div>
</div>
<div id="newsletter">
<h4>Newsletter</h4>
<p>
Sign up for Our Newsletter
</p>
<form action="index.html" method="post">
<input type="text" value="">
<input type="submit" value="Sign Up!">
</form>
</div>
<p class="footnote">
© Copyright © 2023.Company name all rights reserved
</p>
</div>
</div>
</div>
</body>
</html> | emgrob1/georginagrobquincenera.com | public/astronomywebsitetemplate/blog.html | HTML | gpl-2.0 | 6,776 |
package lionse.client.stage;
import java.util.ArrayList;
import java.util.List;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import lionse.client.Display;
import lionse.client.asset.Asset;
import lionse.client.net.Header;
import lionse.client.net.Server;
public class Character implements Renderable {
// character format constant values
public static final float RESOLUTION = 1.5f;
public static final float C_HEAD = 0 * RESOLUTION;
public static final float C_FACE = 10 * RESOLUTION;
public static final float C_BODY = 24 * RESOLUTION;
public static final float C_HAND = 29 * RESOLUTION;
public static final float C_LEG = 30 * RESOLUTION;
public static LabelStyle NAME_TAG_STYLE;
public static float[] SINE_WAVE = { 0, 0.27f, 0.52f, 0.74f, 0.89f, 0.98f, 0.99f, 0.93f, 0.79f, 0.59f, 0.35f, 0.08f, -0.19f, -0.45f, -0.67f, -0.85f, -0.96f,
-0.99f, -0.95f, -0.84f, -0.66f, -0.43f, -0.17f };
static {
NAME_TAG_STYLE = new LabelStyle();
NAME_TAG_STYLE.font = Asset.Font.get(Asset.NanumGothic);
NAME_TAG_STYLE.fontColor = Color.BLACK;
}
public boolean me = false;
// character property
public String name;
public int head;
public int face;
public int body;
public int clothes;
public int weapon;
public float speed = 200f;
// positioning property
public Point position;
public Point target;
public Point bottom;
// character graphics
public Label nameTag;
// ��dz�� ���
public TalkBalloon talkBalloon;
// ��ũ ���߱� ���
public List<Path> path;
public int pathIndex = 0;
public int direction = 0;
public boolean moving = false;
private int step = 0;
// graphics variables
private float stepTime = 0;
private int next = -1;
// graphics cache
private TextureRegion[] texture_head;
private TextureRegion[] texture_face;
private TextureRegion[] texture_body;
private TextureRegion[] texture_hand;
private TextureRegion[] texture_leg_stop;
private TextureRegion[] texture_leg_step1;
private TextureRegion[] texture_leg_step2;
private TextureRegion[] texture_leg_step3;
private TextureRegion[] texture_leg_step4;
// animated character format (sine-wave)
private float p_head;
private float p_face;
private float p_body;
private float p_hand;
// name, head, face, body, clothes, weapon
public Character(String name, int head, int face, int body, int weapon) {
this.name = name;
this.head = head;
this.face = face;
this.body = body;
this.weapon = weapon;
this.position = new Point();
this.bottom = new Point();
this.talkBalloon = new TalkBalloon(this);
this.nameTag = new Label(name, NAME_TAG_STYLE);
this.path = new ArrayList<Path>();
cache();
}
// cache values. if this method is not called when texture value is
// changed.noting happens to the graphic
public void cache() {
texture_head = Asset.Character.get("HEAD");
texture_face = Asset.Character.get("FACE");
texture_body = Asset.Character.get("BODY");
texture_hand = Asset.Character.get("HAND");
texture_leg_stop = Asset.Character.get("LEG_STAND");
texture_leg_step1 = Asset.Character.get("LEG_STEP1");
texture_leg_step2 = Asset.Character.get("LEG_STEP2");
texture_leg_step3 = Asset.Character.get("LEG_STEP3");
texture_leg_step4 = Asset.Character.get("LEG_STEP4");
}
public void talk(String message) {
talkBalloon.show(message);
}
@Override
public void draw(SpriteBatch spriteBatch, float delta) {
// Debugger.log(texture_head.length);
// draw leg
if (moving) {
switch (step) {
case 0:
spriteBatch.draw(texture_leg_step1[direction], position.x, Display.HEIGHT - (position.y + C_LEG));
break;
case 1:
spriteBatch.draw(texture_leg_step2[direction], position.x, Display.HEIGHT - (position.y + C_LEG));
break;
case 2:
spriteBatch.draw(texture_leg_stop[direction], position.x, Display.HEIGHT - (position.y + C_LEG));
break;
case 3:
spriteBatch.draw(texture_leg_step3[direction], position.x, Display.HEIGHT - (position.y + C_LEG));
break;
case 4:
spriteBatch.draw(texture_leg_step4[direction], position.x, Display.HEIGHT - (position.y + C_LEG));
break;
case 5:
spriteBatch.draw(texture_leg_step3[direction], position.x, Display.HEIGHT - (position.y + C_LEG));
break;
}
} else {
spriteBatch.draw(texture_leg_stop[direction], position.x, Display.HEIGHT - (position.y + C_LEG));
}
// draw body
spriteBatch.draw(texture_body[direction], position.x, Display.HEIGHT - (position.y + p_body));
// draw hands
spriteBatch.draw(texture_hand[direction], position.x, Display.HEIGHT - (position.y + p_hand));
// draw face
spriteBatch.draw(texture_face[direction], position.x, Display.HEIGHT - (position.y + p_face));
// draw head
spriteBatch.draw(texture_head[direction], position.x, Display.HEIGHT - (position.y + p_head));
// draw name tag
nameTag.draw(spriteBatch, 1);
// draw talk balloon
if (talkBalloon.talking)
talkBalloon.draw(spriteBatch, delta);
}
@Override
public void update(float delta) {
// update time values.
stepTime += delta;
next += 1;
if (next >= SINE_WAVE.length)
next = 0;
// increase step if moving.
if (stepTime > 0.05f && moving) {
step += 1;
stepTime = 0;
if (step > 5)
step = 0;
}
// �̵����̶�� ��ǥ�� ������Ʈ�Ѵ�.
// if (moving) {
// updatePosition(delta);
// �̵� ���� �� ��ũ ������ ���Ѵ�.
if (me && moving) {
updatePosition(delta);
} else if (this.path.size() > 0 && !me && this.path.size() > pathIndex) {
Path path = this.path.get(pathIndex);
if (path.disabled) {
pathIndex++;
} else {
this.direction = path.direction;
if (path.target == null) {
updatePosition(delta);
} else {
// moveTo(path, delta);
updatePosition(delta);
}
// ���� ��ǥ�� Ÿ�� ��ǥ�� �˻��ؼ� ���� �ȿ� ������ �Ϸ�
if (path.check(position)) {
// �Ϸ� ��, ���ÿ��� �����Ͱ� 0�̸� ������ �ʱ�ȭ�Ѵ� (�� ���)
if (this.path.size() - 1 <= pathIndex) {
this.path.clear();
pathIndex = 0;
} else {
pathIndex++;
}
// ���̰� �ʹ� ũ�� �� ��� �ϵ弼���Ѵ�.
} else if (path.previousDistance > 2000 && path.target != null) {
// ������ ���� ����
position.x = path.target.x;
position.y = path.target.y;
}
}
}
nameTag.setPosition(position.x - (nameTag.getWidth() / 2) + 27, Display.HEIGHT - position.y + 27);
if (talkBalloon.talking)
talkBalloon.update(delta);
// ���� ������ ���� ������ ���� �Ųٱ� ���� ��δ� �������� �̺�Ʈ�� ���� �� �̸� ����� ���´�.
// ���� �Ųٴ� ���� move �̺�Ʈ�� ���Դٸ� ���ÿ� �״´�.
// ��� ������ �����̹Ƿ�, ��ǥ üũ�� �����ϴ�! ^^
// animation effect. (sine wave)
p_head = C_HEAD + SINE_WAVE[next] * 2f;
p_face = C_FACE + SINE_WAVE[next] * 2f;
p_body = C_BODY + SINE_WAVE[next] * 2;
p_hand = C_HAND + SINE_WAVE[next] * 2;
}
private void updatePosition(float delta) {
switch (direction) {
case 0:
position.x -= speed * delta;
position.y += speed * delta / 2;
break;
case 1:
position.x -= speed * delta;
break;
case 2:
position.x -= speed * delta;
position.y -= speed * delta / 2;
break;
case 3:
position.y -= speed * delta / 2;
break;
case 4:
position.x += speed * delta;
position.y -= speed * delta / 2;
break;
case 5:
position.x += speed * delta;
break;
case 6:
position.x += speed * delta;
position.y += speed * delta / 2;
break;
case 7:
position.y += speed * delta / 2;
break;
}
}
@Override
public Point getPosition() {
bottom.x = position.x;
bottom.y = position.y + 150;
bottom.z = position.z;
return bottom;
}
public void move(int targetDirection) {
this.direction = targetDirection;
Server.send(Header.MOVE + Server.H_L + direction + Server.H_L + Math.round(speed) + Server.H_L + Math.round(position.x) + Server.H_L
+ Math.round(position.y) + Server.H_L + Math.round(position.z));
}
public void stop() {
Server.send(Header.STOP + Server.H_L + Math.round(position.x) + Server.H_L + Math.round(position.y) + Server.H_L + Math.round(position.z));
}
public int getDirection(Point point) {
int xdet = 0; // -1-����, 0-���� ����, 1-������
int ydet = 0; // -1-�Ʒ���, 0-���� ����, 1-����
if (point.x - position.x > 0) { // �����ʿ� �ִ�.
xdet = 1;
} else if (point.x == position.x) { // ����.
} else {// ���ʿ� �ִ�.
xdet = -1;
}
if (point.y - position.y > 0) { // ���ʿ� �ִ�.
ydet = -1;
} else if (point.y == position.y) { // ����.
} else {// �Ʒ��ʿ� �ִ�.
ydet = 1;
}
if (xdet > 0) { // ������
if (ydet > 0) { // ������ ��
return 4;
} else if (ydet == 0) { // �׳� ������
return 5;
} else { // ������ �Ʒ�
return 6;
}
} else if (xdet == 0) { // y�� ������
if (ydet > 0) { // ��
return 3;
} else if (ydet == 0) { // �� ������ (����Ʈ ��ũ!)
return -1;
} else { // �Ʒ�
return 7;
}
} else { // ����
if (ydet > 0) { // ���� ��
return 2;
} else if (ydet == 0) { // �׳� ����
return 1;
} else { // ���� �Ʒ�
return 0;
}
}
}
}
| agemor/lionse | src/lionse/client/stage/Character.java | Java | gpl-2.0 | 10,099 |
#include <linux/module.h>
#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/netfilter/x_tables.h>
#include <linux/netfilter/xt_NFLOG.h>
#include <net/netfilter/nf_log.h>
#include <net/netfilter/nfnetlink_log.h>
MODULE_AUTHOR("Patrick McHardy <[email protected]>");
MODULE_DESCRIPTION("Xtables: packet logging to netlink using NFLOG");
MODULE_LICENSE("GPL");
MODULE_ALIAS("ipt_NFLOG");
MODULE_ALIAS("ip6t_NFLOG");
static unsigned int
nflog_tg(struct sk_buff *skb, const struct xt_target_param *par)
{
const struct xt_nflog_info *info = par->targinfo;
struct nf_loginfo li;
li.type = NF_LOG_TYPE_ULOG;
li.u.ulog.copy_len = info->len;
li.u.ulog.group = info->group;
li.u.ulog.qthreshold = info->threshold;
nfulnl_log_packet(par->family, par->hooknum, skb, par->in,
par->out, &li, info->prefix);
return XT_CONTINUE;
}
static bool nflog_tg_check(const struct xt_tgchk_param *par)
{
const struct xt_nflog_info *info = par->targinfo;
if (info->flags & ~XT_NFLOG_MASK)
return false;
if (info->prefix[sizeof(info->prefix) - 1] != '\0')
return false;
return true;
}
static struct xt_target nflog_tg_reg __read_mostly = {
.name = "NFLOG",
.revision = 0,
.family = NFPROTO_UNSPEC,
.checkentry = nflog_tg_check,
.target = nflog_tg,
.targetsize = sizeof(struct xt_nflog_info),
.me = THIS_MODULE,
};
static int __init nflog_tg_init(void)
{
return xt_register_target(&nflog_tg_reg);
}
static void __exit nflog_tg_exit(void)
{
xt_unregister_target(&nflog_tg_reg);
}
module_init(nflog_tg_init);
module_exit(nflog_tg_exit);
| leemgs/OptimusOneKernel-KandroidCommunity | net/netfilter/xt_NFLOG.c | C | gpl-2.0 | 1,599 |
package com.lami.tuomatuo.mq.zookeeper.server;
import com.lami.tuomatuo.mq.zookeeper.jmx.ZKMBeanInfo;
/**
* This class implements the data tree MBean
*
* Created by xujiankang on 2017/3/19.
*/
public class DataTreeBean implements DataTreeMXBean, ZKMBeanInfo{
public DataTree dataTree;
public DataTreeBean(DataTree dataTree) {
this.dataTree = dataTree;
}
@Override
public int getNodeCount() {
return dataTree.getNodeCount();
}
@Override
public long approximateDataSize() {
return dataTree.approximateDataSize();
}
@Override
public int countEphemerals() {
return dataTree.getEphemeralsCount();
}
public int getWatchCount(){
return dataTree.getWatchCount();
}
@Override
public String getName() {
return "InMemoryDataTree";
}
@Override
public boolean isHidden() {
return false;
}
@Override
public String getLastZxid() {
return "0x" + Long.toHexString(dataTree.lastProcessedZxid);
}
}
| jackkiexu/tuomatuo | tuomatuo-mq/src/main/java/com/lami/tuomatuo/mq/zookeeper/server/DataTreeBean.java | Java | gpl-2.0 | 1,052 |
/*
* linux/arch/arm/kernel/setup.c
*
* Copyright (C) 1995-2001 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/utsname.h>
#include <linux/initrd.h>
#include <linux/console.h>
#include <linux/bootmem.h>
#include <linux/seq_file.h>
#include <linux/screen_info.h>
#include <linux/init.h>
#include <linux/kexec.h>
#include <linux/of_fdt.h>
#include <linux/crash_dump.h>
#include <linux/root_dev.h>
#include <linux/cpu.h>
#include <linux/interrupt.h>
#include <linux/smp.h>
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/memblock.h>
#include <asm/unified.h>
#include <asm/cpu.h>
#include <asm/cputype.h>
#include <asm/elf.h>
#include <asm/procinfo.h>
#include <asm/sections.h>
#include <asm/setup.h>
#include <asm/smp_plat.h>
#include <asm/mach-types.h>
#include <asm/cacheflush.h>
#include <asm/cachetype.h>
#include <asm/tlbflush.h>
#include <asm/prom.h>
#include <asm/mach/arch.h>
#include <asm/mach/irq.h>
#include <asm/mach/time.h>
#include <asm/traps.h>
#include <asm/unwind.h>
#if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
#include "compat.h"
#endif
#include "atags.h"
#include "tcm.h"
#ifndef MEM_SIZE
#define MEM_SIZE (16*1024*1024)
#endif
#if defined(CONFIG_FPE_NWFPE) || defined(CONFIG_FPE_FASTFPE)
char fpe_type[8];
static int __init fpe_setup(char *line)
{
memcpy(fpe_type, line, 8);
return 1;
}
__setup("fpe=", fpe_setup);
#endif
extern void paging_init(struct machine_desc *desc);
extern void sanity_check_meminfo(void);
extern void reboot_setup(char *str);
unsigned int processor_id;
EXPORT_SYMBOL(processor_id);
unsigned int __machine_arch_type __read_mostly;
EXPORT_SYMBOL(__machine_arch_type);
unsigned int cacheid __read_mostly;
EXPORT_SYMBOL(cacheid);
unsigned int __atags_pointer __initdata;
unsigned int system_rev;
EXPORT_SYMBOL(system_rev);
unsigned int system_serial_low;
EXPORT_SYMBOL(system_serial_low);
unsigned int system_serial_high;
EXPORT_SYMBOL(system_serial_high);
unsigned int elf_hwcap __read_mostly;
EXPORT_SYMBOL(elf_hwcap);
#ifdef MULTI_CPU
struct processor processor __read_mostly;
#endif
#ifdef MULTI_TLB
struct cpu_tlb_fns cpu_tlb __read_mostly;
#endif
#ifdef MULTI_USER
struct cpu_user_fns cpu_user __read_mostly;
#endif
#ifdef MULTI_CACHE
struct cpu_cache_fns cpu_cache __read_mostly;
#endif
#ifdef CONFIG_OUTER_CACHE
struct outer_cache_fns outer_cache __read_mostly;
EXPORT_SYMBOL(outer_cache);
#endif
struct stack {
u32 irq[3];
u32 abt[3];
u32 und[3];
} ____cacheline_aligned;
static struct stack stacks[NR_CPUS];
char elf_platform[ELF_PLATFORM_SIZE];
EXPORT_SYMBOL(elf_platform);
static const char *cpu_name;
static const char *machine_name;
static char __initdata cmd_line[COMMAND_LINE_SIZE];
struct machine_desc *machine_desc __initdata;
static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } };
#define ENDIANNESS ((char)endian_test.l)
DEFINE_PER_CPU(struct cpuinfo_arm, cpu_data);
/*
* Standard memory resources
*/
static struct resource mem_res[] = {
{
.name = "Video RAM",
.start = 0,
.end = 0,
.flags = IORESOURCE_MEM
},
{
.name = "Kernel text",
.start = 0,
.end = 0,
.flags = IORESOURCE_MEM
},
{
.name = "Kernel data",
.start = 0,
.end = 0,
.flags = IORESOURCE_MEM
}
};
#define video_ram mem_res[0]
#define kernel_code mem_res[1]
#define kernel_data mem_res[2]
static struct resource io_res[] = {
{
.name = "reserved",
.start = 0x3bc,
.end = 0x3be,
.flags = IORESOURCE_IO | IORESOURCE_BUSY
},
{
.name = "reserved",
.start = 0x378,
.end = 0x37f,
.flags = IORESOURCE_IO | IORESOURCE_BUSY
},
{
.name = "reserved",
.start = 0x278,
.end = 0x27f,
.flags = IORESOURCE_IO | IORESOURCE_BUSY
}
};
#define lp0 io_res[0]
#define lp1 io_res[1]
#define lp2 io_res[2]
static const char *proc_arch[] = {
"undefined/unknown",
"3",
"4",
"4T",
"5",
"5T",
"5TE",
"5TEJ",
"6TEJ",
"7",
"?(11)",
"?(12)",
"?(13)",
"?(14)",
"?(15)",
"?(16)",
"?(17)",
};
int cpu_architecture(void)
{
int cpu_arch;
if ((read_cpuid_id() & 0x0008f000) == 0) {
cpu_arch = CPU_ARCH_UNKNOWN;
} else if ((read_cpuid_id() & 0x0008f000) == 0x00007000) {
cpu_arch = (read_cpuid_id() & (1 << 23)) ? CPU_ARCH_ARMv4T : CPU_ARCH_ARMv3;
} else if ((read_cpuid_id() & 0x00080000) == 0x00000000) {
cpu_arch = (read_cpuid_id() >> 16) & 7;
if (cpu_arch)
cpu_arch += CPU_ARCH_ARMv3;
} else if ((read_cpuid_id() & 0x000f0000) == 0x000f0000) {
unsigned int mmfr0;
/* Revised CPUID format. Read the Memory Model Feature
* Register 0 and check for VMSAv7 or PMSAv7 */
asm("mrc p15, 0, %0, c0, c1, 4"
: "=r" (mmfr0));
if ((mmfr0 & 0x0000000f) >= 0x00000003 ||
(mmfr0 & 0x000000f0) >= 0x00000030)
cpu_arch = CPU_ARCH_ARMv7;
else if ((mmfr0 & 0x0000000f) == 0x00000002 ||
(mmfr0 & 0x000000f0) == 0x00000020)
cpu_arch = CPU_ARCH_ARMv6;
else
cpu_arch = CPU_ARCH_UNKNOWN;
} else
cpu_arch = CPU_ARCH_UNKNOWN;
return cpu_arch;
}
static int cpu_has_aliasing_icache(unsigned int arch)
{
int aliasing_icache;
unsigned int id_reg, num_sets, line_size;
/* arch specifies the register format */
switch (arch) {
case CPU_ARCH_ARMv7:
asm("mcr p15, 2, %0, c0, c0, 0 @ set CSSELR"
: /* No output operands */
: "r" (1));
isb();
asm("mrc p15, 1, %0, c0, c0, 0 @ read CCSIDR"
: "=r" (id_reg));
line_size = 4 << ((id_reg & 0x7) + 2);
num_sets = ((id_reg >> 13) & 0x7fff) + 1;
aliasing_icache = (line_size * num_sets) > PAGE_SIZE;
break;
case CPU_ARCH_ARMv6:
aliasing_icache = read_cpuid_cachetype() & (1 << 11);
break;
default:
/* I-cache aliases will be handled by D-cache aliasing code */
aliasing_icache = 0;
}
return aliasing_icache;
}
static void __init cacheid_init(void)
{
unsigned int cachetype = read_cpuid_cachetype();
unsigned int arch = cpu_architecture();
if (arch >= CPU_ARCH_ARMv6) {
if ((cachetype & (7 << 29)) == 4 << 29) {
/* ARMv7 register format */
cacheid = CACHEID_VIPT_NONALIASING;
if ((cachetype & (3 << 14)) == 1 << 14)
cacheid |= CACHEID_ASID_TAGGED;
else if (cpu_has_aliasing_icache(CPU_ARCH_ARMv7))
cacheid |= CACHEID_VIPT_I_ALIASING;
} else if (cachetype & (1 << 23)) {
cacheid = CACHEID_VIPT_ALIASING;
} else {
cacheid = CACHEID_VIPT_NONALIASING;
if (cpu_has_aliasing_icache(CPU_ARCH_ARMv6))
cacheid |= CACHEID_VIPT_I_ALIASING;
}
} else {
cacheid = CACHEID_VIVT;
}
printk("CPU: %s data cache, %s instruction cache\n",
cache_is_vivt() ? "VIVT" :
cache_is_vipt_aliasing() ? "VIPT aliasing" :
cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown",
cache_is_vivt() ? "VIVT" :
icache_is_vivt_asid_tagged() ? "VIVT ASID tagged" :
icache_is_vipt_aliasing() ? "VIPT aliasing" :
cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown");
}
/*
* These functions re-use the assembly code in head.S, which
* already provide the required functionality.
*/
extern struct proc_info_list *lookup_processor_type(unsigned int);
void __init early_print(const char *str, ...)
{
extern void printascii(const char *);
char buf[256];
va_list ap;
va_start(ap, str);
vsnprintf(buf, sizeof(buf), str, ap);
va_end(ap);
#ifdef CONFIG_DEBUG_LL
printascii(buf);
#endif
printk("%s", buf);
}
static void __init feat_v6_fixup(void)
{
int id = read_cpuid_id();
if ((id & 0xff0f0000) != 0x41070000)
return;
/*
* HWCAP_TLS is available only on 1136 r1p0 and later,
* see also kuser_get_tls_init.
*/
if ((((id >> 4) & 0xfff) == 0xb36) && (((id >> 20) & 3) == 0))
elf_hwcap &= ~HWCAP_TLS;
}
static void __init setup_processor(void)
{
struct proc_info_list *list;
/*
* locate processor in the list of supported processor
* types. The linker builds this table for us from the
* entries in arch/arm/mm/proc-*.S
*/
list = lookup_processor_type(read_cpuid_id());
if (!list) {
printk("CPU configuration botched (ID %08x), unable "
"to continue.\n", read_cpuid_id());
while (1);
}
cpu_name = list->cpu_name;
#ifdef MULTI_CPU
processor = *list->proc;
#endif
#ifdef MULTI_TLB
cpu_tlb = *list->tlb;
#endif
#ifdef MULTI_USER
cpu_user = *list->user;
#endif
#ifdef MULTI_CACHE
cpu_cache = *list->cache;
#endif
printk("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n",
cpu_name, read_cpuid_id(), read_cpuid_id() & 15,
proc_arch[cpu_architecture()], cr_alignment);
sprintf(init_utsname()->machine, "%s%c", list->arch_name, ENDIANNESS);
sprintf(elf_platform, "%s%c", list->elf_name, ENDIANNESS);
elf_hwcap = list->elf_hwcap;
#ifndef CONFIG_ARM_THUMB
elf_hwcap &= ~HWCAP_THUMB;
#endif
feat_v6_fixup();
cacheid_init();
cpu_proc_init();
}
/*
* cpu_init - initialise one CPU.
*
* cpu_init sets up the per-CPU stacks.
*/
void cpu_init(void)
{
unsigned int cpu = smp_processor_id();
struct stack *stk = &stacks[cpu];
if (cpu >= NR_CPUS) {
printk(KERN_CRIT "CPU%u: bad primary CPU number\n", cpu);
BUG();
}
/*
* Define the placement constraint for the inline asm directive below.
* In Thumb-2, msr with an immediate value is not allowed.
*/
#ifdef CONFIG_THUMB2_KERNEL
#define PLC "r"
#else
#define PLC "I"
#endif
/*
* setup stacks for re-entrant exception handlers
*/
__asm__ (
"msr cpsr_c, %1\n\t"
"add r14, %0, %2\n\t"
"mov sp, r14\n\t"
"msr cpsr_c, %3\n\t"
"add r14, %0, %4\n\t"
"mov sp, r14\n\t"
"msr cpsr_c, %5\n\t"
"add r14, %0, %6\n\t"
"mov sp, r14\n\t"
"msr cpsr_c, %7"
:
: "r" (stk),
PLC (PSR_F_BIT | PSR_I_BIT | IRQ_MODE),
"I" (offsetof(struct stack, irq[0])),
PLC (PSR_F_BIT | PSR_I_BIT | ABT_MODE),
"I" (offsetof(struct stack, abt[0])),
PLC (PSR_F_BIT | PSR_I_BIT | UND_MODE),
"I" (offsetof(struct stack, und[0])),
PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE)
: "r14");
}
void __init dump_machine_table(void)
{
struct machine_desc *p;
early_print("Available machine support:\n\nID (hex)\tNAME\n");
for_each_machine_desc(p)
early_print("%08x\t%s\n", p->nr, p->name);
early_print("\nPlease check your kernel config and/or bootloader.\n");
while (true)
/* can't use cpu_relax() here as it may require MMU setup */;
}
int __init arm_add_memory(phys_addr_t start, unsigned long size)
{
struct membank *bank = &meminfo.bank[meminfo.nr_banks];
if (meminfo.nr_banks >= NR_BANKS) {
printk(KERN_CRIT "NR_BANKS too low, "
"ignoring memory at 0x%08llx\n", (long long)start);
return -EINVAL;
}
/*
* Ensure that start/size are aligned to a page boundary.
* Size is appropriately rounded down, start is rounded up.
*/
size -= start & ~PAGE_MASK;
bank->start = PAGE_ALIGN(start);
bank->size = size & PAGE_MASK;
/*
* Check whether this memory region has non-zero size or
* invalid node number.
*/
if (bank->size == 0)
return -EINVAL;
meminfo.nr_banks++;
return 0;
}
/*
* Pick out the memory size. We look for mem=size@start,
* where start and size are "size[KkMm]"
*/
static int __init early_mem(char *p)
{
static int usermem __initdata = 0;
unsigned long size;
phys_addr_t start;
char *endp;
/*
* If the user specifies memory size, we
* blow away any automatically generated
* size.
*/
if (usermem == 0) {
usermem = 1;
meminfo.nr_banks = 0;
}
start = PHYS_OFFSET;
size = memparse(p, &endp);
if (*endp == '@')
start = memparse(endp + 1, NULL);
arm_add_memory(start, size);
return 0;
}
early_param("mem", early_mem);
static void __init
setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz)
{
#ifdef CONFIG_BLK_DEV_RAM
extern int rd_size, rd_image_start, rd_prompt, rd_doload;
rd_image_start = image_start;
rd_prompt = prompt;
rd_doload = doload;
if (rd_sz)
rd_size = rd_sz;
#endif
}
static void __init request_standard_resources(struct machine_desc *mdesc)
{
struct memblock_region *region;
struct resource *res;
kernel_code.start = virt_to_phys(_text);
kernel_code.end = virt_to_phys(_etext - 1);
kernel_data.start = virt_to_phys(_sdata);
kernel_data.end = virt_to_phys(_end - 1);
for_each_memblock(memory, region) {
res = alloc_bootmem_low(sizeof(*res));
res->name = "System RAM";
res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1;
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
request_resource(&iomem_resource, res);
if (kernel_code.start >= res->start &&
kernel_code.end <= res->end)
request_resource(res, &kernel_code);
if (kernel_data.start >= res->start &&
kernel_data.end <= res->end)
request_resource(res, &kernel_data);
}
if (mdesc->video_start) {
video_ram.start = mdesc->video_start;
video_ram.end = mdesc->video_end;
request_resource(&iomem_resource, &video_ram);
}
/*
* Some machines don't have the possibility of ever
* possessing lp0, lp1 or lp2
*/
if (mdesc->reserve_lp0)
request_resource(&ioport_resource, &lp0);
if (mdesc->reserve_lp1)
request_resource(&ioport_resource, &lp1);
if (mdesc->reserve_lp2)
request_resource(&ioport_resource, &lp2);
}
/*
* Tag parsing.
*
* This is the new way of passing data to the kernel at boot time. Rather
* than passing a fixed inflexible structure to the kernel, we pass a list
* of variable-sized tags to the kernel. The first tag must be a ATAG_CORE
* tag for the list to be recognised (to distinguish the tagged list from
* a param_struct). The list is terminated with a zero-length tag (this tag
* is not parsed in any way).
*/
static int __init parse_tag_core(const struct tag *tag)
{
if (tag->hdr.size > 2) {
if ((tag->u.core.flags & 1) == 0)
root_mountflags &= ~MS_RDONLY;
ROOT_DEV = old_decode_dev(tag->u.core.rootdev);
}
return 0;
}
__tagtable(ATAG_CORE, parse_tag_core);
static int __init parse_tag_mem32(const struct tag *tag)
{
return arm_add_memory(tag->u.mem.start, tag->u.mem.size);
}
__tagtable(ATAG_MEM, parse_tag_mem32);
#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
struct screen_info screen_info = {
.orig_video_lines = 30,
.orig_video_cols = 80,
.orig_video_mode = 0,
.orig_video_ega_bx = 0,
.orig_video_isVGA = 1,
.orig_video_points = 8
};
static int __init parse_tag_videotext(const struct tag *tag)
{
screen_info.orig_x = tag->u.videotext.x;
screen_info.orig_y = tag->u.videotext.y;
screen_info.orig_video_page = tag->u.videotext.video_page;
screen_info.orig_video_mode = tag->u.videotext.video_mode;
screen_info.orig_video_cols = tag->u.videotext.video_cols;
screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx;
screen_info.orig_video_lines = tag->u.videotext.video_lines;
screen_info.orig_video_isVGA = tag->u.videotext.video_isvga;
screen_info.orig_video_points = tag->u.videotext.video_points;
return 0;
}
__tagtable(ATAG_VIDEOTEXT, parse_tag_videotext);
#endif
static int __init parse_tag_ramdisk(const struct tag *tag)
{
setup_ramdisk((tag->u.ramdisk.flags & 1) == 0,
(tag->u.ramdisk.flags & 2) == 0,
tag->u.ramdisk.start, tag->u.ramdisk.size);
return 0;
}
__tagtable(ATAG_RAMDISK, parse_tag_ramdisk);
static int __init parse_tag_serialnr(const struct tag *tag)
{
system_serial_low = tag->u.serialnr.low;
system_serial_high = tag->u.serialnr.high;
return 0;
}
__tagtable(ATAG_SERIAL, parse_tag_serialnr);
static int __init parse_tag_revision(const struct tag *tag)
{
system_rev = tag->u.revision.rev;
return 0;
}
__tagtable(ATAG_REVISION, parse_tag_revision);
static int __init parse_tag_cmdline(const struct tag *tag)
{
#if defined(CONFIG_CMDLINE_EXTEND)
strlcat(default_command_line, " ", COMMAND_LINE_SIZE);
strlcat(default_command_line, tag->u.cmdline.cmdline,
COMMAND_LINE_SIZE);
#elif defined(CONFIG_CMDLINE_FORCE)
pr_warning("Ignoring tag cmdline (using the default kernel command line)\n");
#else
strlcpy(default_command_line, tag->u.cmdline.cmdline,
COMMAND_LINE_SIZE);
#endif
return 0;
}
__tagtable(ATAG_CMDLINE, parse_tag_cmdline);
/*
* Scan the tag table for this tag, and call its parse function.
* The tag table is built by the linker from all the __tagtable
* declarations.
*/
static int __init parse_tag(const struct tag *tag)
{
extern struct tagtable __tagtable_begin, __tagtable_end;
struct tagtable *t;
for (t = &__tagtable_begin; t < &__tagtable_end; t++)
if (tag->hdr.tag == t->tag) {
t->parse(tag);
break;
}
return t < &__tagtable_end;
}
/*
* Parse all tags in the list, checking both the global and architecture
* specific tag tables.
*/
static void __init parse_tags(const struct tag *t)
{
for (; t->hdr.size; t = tag_next(t))
if (!parse_tag(t))
printk(KERN_WARNING
"Ignoring unrecognised tag 0x%08x\n",
t->hdr.tag);
}
/*
* This holds our defaults.
*/
static struct init_tags {
struct tag_header hdr1;
struct tag_core core;
struct tag_header hdr2;
struct tag_mem32 mem;
struct tag_header hdr3;
} init_tags __initdata = {
{ tag_size(tag_core), ATAG_CORE },
{ 1, PAGE_SIZE, 0xff },
{ tag_size(tag_mem32), ATAG_MEM },
{ MEM_SIZE },
{ 0, ATAG_NONE }
};
static int __init customize_machine(void)
{
/* customizes platform devices, or adds new ones */
if (machine_desc->init_machine)
machine_desc->init_machine();
return 0;
}
arch_initcall(customize_machine);
#ifdef CONFIG_KEXEC
static inline unsigned long long get_total_mem(void)
{
unsigned long total;
total = max_low_pfn - min_low_pfn;
return total << PAGE_SHIFT;
}
/**
* reserve_crashkernel() - reserves memory are for crash kernel
*
* This function reserves memory area given in "crashkernel=" kernel command
* line parameter. The memory reserved is used by a dump capture kernel when
* primary kernel is crashing.
*/
static void __init reserve_crashkernel(void)
{
unsigned long long crash_size, crash_base;
unsigned long long total_mem;
int ret;
total_mem = get_total_mem();
ret = parse_crashkernel(boot_command_line, total_mem,
&crash_size, &crash_base);
if (ret)
return;
ret = reserve_bootmem(crash_base, crash_size, BOOTMEM_EXCLUSIVE);
if (ret < 0) {
printk(KERN_WARNING "crashkernel reservation failed - "
"memory is in use (0x%lx)\n", (unsigned long)crash_base);
return;
}
printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
"for crashkernel (System RAM: %ldMB)\n",
(unsigned long)(crash_size >> 20),
(unsigned long)(crash_base >> 20),
(unsigned long)(total_mem >> 20));
crashk_res.start = crash_base;
crashk_res.end = crash_base + crash_size - 1;
insert_resource(&iomem_resource, &crashk_res);
}
#else
static inline void reserve_crashkernel(void) {}
#endif /* CONFIG_KEXEC */
static void __init squash_mem_tags(struct tag *tag)
{
for (; tag->hdr.size; tag = tag_next(tag))
if (tag->hdr.tag == ATAG_MEM)
tag->hdr.tag = ATAG_NONE;
}
static struct machine_desc * __init setup_machine_tags(unsigned int nr)
{
struct tag *tags = (struct tag *)&init_tags;
struct machine_desc *mdesc = NULL, *p;
char *from = default_command_line;
init_tags.mem.start = PHYS_OFFSET;
/*
* locate machine in the list of supported machines.
*/
for_each_machine_desc(p)
if (nr == p->nr) {
printk("Machine: %s\n", p->name);
mdesc = p;
break;
}
if (!mdesc) {
early_print("\nError: unrecognized/unsupported machine ID"
" (r1 = 0x%08x).\n\n", nr);
dump_machine_table(); /* does not return */
}
if (__atags_pointer)
tags = phys_to_virt(__atags_pointer);
else if (mdesc->boot_params) {
#ifdef CONFIG_MMU
/*
* We still are executing with a minimal MMU mapping created
* with the presumption that the machine default for this
* is located in the first MB of RAM. Anything else will
* fault and silently hang the kernel at this point.
*/
if (mdesc->boot_params < PHYS_OFFSET ||
mdesc->boot_params >= PHYS_OFFSET + SZ_1M) {
printk(KERN_WARNING
"Default boot params at physical 0x%08lx out of reach\n",
mdesc->boot_params);
} else
#endif
{
tags = phys_to_virt(mdesc->boot_params);
}
}
#if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
/*
* If we have the old style parameters, convert them to
* a tag list.
*/
if (tags->hdr.tag != ATAG_CORE)
convert_to_tag_list(tags);
#endif
if (tags->hdr.tag != ATAG_CORE) {
#if defined(CONFIG_OF)
/*
* If CONFIG_OF is set, then assume this is a reasonably
* modern system that should pass boot parameters
*/
early_print("Warning: Neither atags nor dtb found\n");
#endif
tags = (struct tag *)&init_tags;
}
if (mdesc->fixup)
mdesc->fixup(mdesc, tags, &from, &meminfo);
if (tags->hdr.tag == ATAG_CORE) {
if (meminfo.nr_banks != 0)
squash_mem_tags(tags);
save_atags(tags);
parse_tags(tags);
}
/* parse_early_param needs a boot_command_line */
strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
return mdesc;
}
void __init setup_arch(char **cmdline_p)
{
struct machine_desc *mdesc;
unwind_init();
setup_processor();
mdesc = setup_machine_fdt(__atags_pointer);
if (!mdesc)
mdesc = setup_machine_tags(machine_arch_type);
machine_desc = mdesc;
machine_name = mdesc->name;
#ifdef CONFIG_ZONE_DMA
if (mdesc->dma_zone_size) {
extern unsigned long arm_dma_zone_size;
arm_dma_zone_size = mdesc->dma_zone_size;
}
#endif
if (mdesc->soft_reboot)
reboot_setup("s");
init_mm.start_code = (unsigned long) _text;
init_mm.end_code = (unsigned long) _etext;
init_mm.end_data = (unsigned long) _edata;
init_mm.brk = (unsigned long) _end;
/* populate cmd_line too for later use, preserving boot_command_line */
strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
*cmdline_p = cmd_line;
parse_early_param();
sanity_check_meminfo();
arm_memblock_init(&meminfo, mdesc);
paging_init(mdesc);
request_standard_resources(mdesc);
unflatten_device_tree();
#ifdef CONFIG_SMP
if (is_smp())
smp_init_cpus();
#endif
reserve_crashkernel();
cpu_init();
tcm_init();
#ifdef CONFIG_MULTI_IRQ_HANDLER
handle_arch_irq = mdesc->handle_irq;
#endif
#ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE)
conswitchp = &vga_con;
#elif defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
#endif
#endif
early_trap_init();
if (mdesc->init_early)
mdesc->init_early();
}
static int __init topology_init(void)
{
int cpu;
for_each_possible_cpu(cpu) {
struct cpuinfo_arm *cpuinfo = &per_cpu(cpu_data, cpu);
cpuinfo->cpu.hotpluggable = 1;
register_cpu(&cpuinfo->cpu, cpu);
}
return 0;
}
subsys_initcall(topology_init);
#ifdef CONFIG_HAVE_PROC_CPU
static int __init proc_cpu_init(void)
{
struct proc_dir_entry *res;
res = proc_mkdir("cpu", NULL);
if (!res)
return -ENOMEM;
return 0;
}
fs_initcall(proc_cpu_init);
#endif
static const char *hwcap_str[] = {
"swp",
"half",
"thumb",
"26bit",
"fastmult",
"fpa",
"vfp",
"edsp",
"java",
"iwmmxt",
"crunch",
"thumbee",
"neon",
"vfpv3",
"vfpv3d16",
"tls",
"vfpv4",
"idiva",
"idivt",
NULL
};
static int c_show(struct seq_file *m, void *v)
{
int i;
seq_printf(m, "Processor\t: %s rev %d (%s)\n",
cpu_name, read_cpuid_id() & 15, elf_platform);
#if defined(CONFIG_SMP)
for_each_online_cpu(i) {
/*
* glibc reads /proc/cpuinfo to determine the number of
* online processors, looking for lines beginning with
* "processor". Give glibc what it expects.
*/
seq_printf(m, "processor\t: %d\n", i);
seq_printf(m, "BogoMIPS\t: %lu.%02lu\n\n",
per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ),
(per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100);
}
#else /* CONFIG_SMP */
seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
loops_per_jiffy / (500000/HZ),
(loops_per_jiffy / (5000/HZ)) % 100);
#endif
/* dump out the processor features */
seq_puts(m, "Features\t: ");
for (i = 0; hwcap_str[i]; i++)
if (elf_hwcap & (1 << i))
seq_printf(m, "%s ", hwcap_str[i]);
seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24);
seq_printf(m, "CPU architecture: %s\n", proc_arch[cpu_architecture()]);
if ((read_cpuid_id() & 0x0008f000) == 0x00000000) {
/* pre-ARM7 */
seq_printf(m, "CPU part\t: %07x\n", read_cpuid_id() >> 4);
} else {
if ((read_cpuid_id() & 0x0008f000) == 0x00007000) {
/* ARM7 */
seq_printf(m, "CPU variant\t: 0x%02x\n",
(read_cpuid_id() >> 16) & 127);
} else {
/* post-ARM7 */
seq_printf(m, "CPU variant\t: 0x%x\n",
(read_cpuid_id() >> 20) & 15);
}
seq_printf(m, "CPU part\t: 0x%03x\n",
(read_cpuid_id() >> 4) & 0xfff);
}
seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15);
seq_puts(m, "\n");
seq_printf(m, "Hardware\t: %s\n", machine_name);
seq_printf(m, "Revision\t: %04x\n", system_rev);
seq_printf(m, "Serial\t\t: %08x%08x\n",
system_serial_high, system_serial_low);
return 0;
}
static void *c_start(struct seq_file *m, loff_t *pos)
{
return *pos < 1 ? (void *)1 : NULL;
}
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
++*pos;
return NULL;
}
static void c_stop(struct seq_file *m, void *v)
{
}
const struct seq_operations cpuinfo_op = {
.start = c_start,
.next = c_next,
.stop = c_stop,
.show = c_show
};
| GlitchKernel/Glitch | arch/arm/kernel/setup.c | C | gpl-2.0 | 25,452 |
/**
* Copyright (C) SiteSupra SIA, Riga, Latvia, 2015
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
YUI.add('itemmanager.itemlist-uploader', function (Y) {
//Invoke strict mode
"use strict";
//Shortcut
var Manager = Supra.Manager,
Action = Manager.PageContent;
/*
* Editable content
*/
function ItemListUploader (config) {
ItemListUploader.superclass.constructor.apply(this, arguments);
}
ItemListUploader.NAME = 'itemmanager-itemlist-uploader';
ItemListUploader.NS = 'uploader';
ItemListUploader.ATTRS = {};
Y.extend(ItemListUploader, Y.Plugin.Base, {
/**
* Supra.Uploader instance
* @type {Object}
* @private
*/
uploader: null,
/**
* File uploader ids to item ids
* @type {Object}
* @private
*/
ids: null,
/**
*
*/
initializer: function () {
var itemlist = this.get('host'),
container = itemlist.get('contentElement');
this.ids = {};
this.listeners = [];
this.listeners.push(itemlist.after('contentElementChange', this.reattachListeners, this));
if (container) {
this.reattachListeners();
}
},
destructor: function () {
this.resetAll();
// Listeners
var listeners = this.listeners,
i = 0,
ii = listeners.length;
for (; i < ii; i++) listeners[i].detach();
this.listeners = null;
},
/**
* Attach drag and drop listeners
*/
reattachListeners: function () {
var itemlist = this.get('host'),
container = itemlist.get('contentElement'),
//doc = null,
target = null;
if (this.uploader) {
this.uploader.destroy();
this.uploader = null;
}
if (!container) {
return false;
}
//Create uploader
target = itemlist.get('iframe').one('.supra-itemmanager-wrapper');
this.uploader = new Supra.Uploader({
'dropTarget': target,
'allowBrowse': false,
'allowMultiple': true,
'accept': 'image/*',
'requestUri': Supra.Url.generate('media_library_upload'),
'uploadFolderId': itemlist.get('host').options.imageUploadFolder
});
this.uploader.on('file:upload', this.onFileUploadStart, this);
this.uploader.on('file:complete', this.onFileUploadEnd, this);
this.uploader.on('file:error', this.onFileUploadError, this);
},
/**
* Reset all iframe content bindings, etc.
*/
resetAll: function () {
var uploader = this.uploader;
if (uploader) {
uploader.destroy(true);
this.uploader = null;
}
},
/* ------------------------ FILE UPLOAD ------------------------ */
/**
* Handle file upload start
*/
onFileUploadStart: function (e) {
var data = e.details[0],
itemlist = this.get('host'),
item = null;
// Prevent item from being opened for editing
itemlist.initializing = true;
item = itemlist.addItem({'title': e.title.replace(/\..+$/, '')});
itemlist.initializing = false;
this.ids[e.id] = item.__suid;
},
/**
* Handle file upload end
*/
onFileUploadEnd: function (e) {
var data = e.details[0],
itemlist = this.get('host'),
itemdrop = itemlist.drop;
if (e.old_id in this.ids) {
itemdrop.updateItemInCollection(data, this.ids[e.old_id]);
delete(this.ids[e.old_id]);
} else {
itemdrop.addItemToCollection(data);
}
},
/**
* Handle file upload error
*/
onFileUploadError: function (e) {
var itemlist = this.get('host');
itemlist.removeItem(this.ids[e.id]);
delete(this.ids[e.id]);
}
});
Supra.ItemManagerItemListUploader = ItemListUploader;
//Since this widget has Supra namespace, it doesn't need to be bound to each YUI instance
//Make sure this constructor function is called only once
delete(this.fn); this.fn = function () {};
}, YUI.version, {requires: ['plugin', 'supra.uploader']});
| sitesupra/sitesupra | lib/Supra/Package/Cms/Resources/public/content-manager/itemmanager/modules/itemlist-uploader.js | JavaScript | gpl-2.0 | 4,508 |
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | Fez - Digital Repository System |
// +----------------------------------------------------------------------+
// | Copyright (c) 2005, 2006, 2007 The University of Queensland, |
// | Australian Partnership for Sustainable Repositories, |
// | eScholarship Project |
// | |
// | Some of the Fez code was derived from Eventum (Copyright 2003, 2004 |
// | MySQL AB - http://dev.mysql.com/downloads/other/eventum/ - GPL) |
// | |
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to: |
// | |
// | Free Software Foundation, Inc. |
// | 59 Temple Place - Suite 330 |
// | Boston, MA 02111-1307, USA. |
// +----------------------------------------------------------------------+
// | Authors: Christiaan Kortekaas <[email protected]>, |
// | Matthew Smith <[email protected]> |
// +----------------------------------------------------------------------+
//
//
include_once("config.inc.php");
include_once(APP_INC_PATH . "class.lister.php");
include_once(APP_INC_PATH . "class.auth.php");
if (APP_AUTHOR_PROFILE_REDIRECT == 'ON') {
// Send to the new eSpace search profile page when only the author_id is supplied PT: #176474178
if (count($_GET) === 2 &&
array_key_exists('browse', $_GET) &&
$_GET['browse'] === 'author_id' &&
array_key_exists('value', $_GET) &&
is_numeric($_GET['value'])
) {
Lister::authorProfileRedirect($_GET['value']);
}
}
$res = Lister::getList($_GET, true);
$pids = array();
if (is_array($res['list'])) {
foreach ($res['list'] as $record) {
if (array_key_exists('rek_pid', $record)) {
$pids[] = $record['rek_pid'];
}
}
}
/*
* If this is a logged in user we want to save this data for view pages, so when can create
* 'prev' and 'next' links
*/
$username = Auth::getUsername();
if (!empty($username)) {
$_SESSION['list'] = $pids;
$_SESSION['list_params'] = $_GET;
$_SESSION['script_name'] = $_SERVER['SCRIPT_NAME'];
$_SESSION['last_page'] = $res['list_info']['last_page'];
$_SESSION['view_page'] = $res['list_info']['current_page'];
}
| uqlibrary/fez | public/list.php | PHP | gpl-2.0 | 3,603 |
using System.Collections.Generic;
using System.Xml.Linq;
using UnityEngine;
namespace IaS.Xml
{
public class XmlTrackNode
{
public const string ElementTrackNode = "node";
private const string AttrTrackNodeId = "id";
private const string AttrTrackNodePosition = "p";
public Vector3 Position { get; private set; }
public string Id { get; private set; }
public XmlTrackNode Previous { get; private set; }
public XmlTrackNode Next { get; private set; }
public static XmlTrackNode FromElement(XElement element, Dictionary<string, int> counts)
{
string id = XmlValueMapper.FromAttribute(element, AttrTrackNodeId).AsIdValue("t_node", counts);
Vector3 position = XmlValueMapper.FromAttribute(element, AttrTrackNodePosition).AsVector3().MandatoryValue();
return new XmlTrackNode(id, position);
}
public XmlTrackNode(string id, Vector3 position)
{
Id = id;
Position = position;
}
}
}
| mANDROID99/IaS | Iron_And_steam/Assets/Scripts/Xml/XmlTrackNode.cs | C# | gpl-2.0 | 1,065 |
##
# This file is part of WhatWeb and may be subject to
# redistribution and commercial restrictions. Please see the WhatWeb
# web site for more information on licensing and terms of use.
# https://morningstarsecurity.com/research/whatweb
##
Plugin.define do
name "Movable-Type"
authors [
"Andrew Horton",
# v0.2 # remove :certainty.
# v0.3 # Uses :version=>//.
"Brendan Coles <[email protected]>", # v0.4 # 2011-07-07 # updated regex. added example urls, google dorks and version/path detection with mt-check.cgi.
]
version "0.4"
description "Blogging platform"
website "http://www.movabletype.org/"
# Google results as at 2011-07-07 #
# 122 for "Powered by Movable Type"
# 89 for inurl:/mt-check.cgi intitle:"Movable Type System Check [mt-check.cgi]"
# 26 for inurl:/mt/mt-check.cgi
# More examples:
# www.movabletype.com/showcase/
# Dorks #
dorks [
'"Powered by Movable Type"',
'inurl:/mt-check.cgi intitle:"Movable Type System Check [mt-check.cgi]"'
]
# Matches #
matches [
# javascript with 'mt' in the filename
{:name=>"javascript with 'mt' in the name",
:certainty=>50, :regexp=>/<script type="text\/javascript" src="[^"]+mt(-site)?\.js"><\/script>/},
# mt-tags|mt-tb|mt-cp|mt-search|mt-user-login|mt-recommend cgi
{:name=>"mt-tags|mt-tb|mt-cp|mt-search|mt-user-login|mt-recommend cgi",
:certainty=>75,
:regexp=>/"[^"]+\/mt-(tags|tb|cp|search|user-login|recommend)\.[f]?cgi[^"]*"/},
# Meta Generator
{:name=>"meta generator tag", :regexp=>/<meta name="generator" content="http:\/\/www\.movabletype\.org\/" \/>/},
# mt-check.cgi # Title
{ :text=>'<title>Movable Type System Check [mt-check.cgi]</title>' },
# Version Detection # mt-check.cgi
{ :version=>/<li><strong>Movable Type version:<\/strong> <code>([^<]+)<\/code><\/li>/ },
# Local Path Detection # mt-check.cgi
{ :filepath=>/<li><strong>Current working directory:<\/strong> <code>([^<]+)<\/code><\/li>/ },
# Powered by link
{:name=>"Powered by link", :regexp=>/<a href="http:\/\/sixapart\.com">Powered by Movable Type<\/a>/},
{:name=>"Powered by link", :regexp=>/Powered by <a href="http:\/\/www\.movabletype\.com\/"[^>]*>Movable Type<\/a>/ },
# Version Detection # Meta Generator
{:version=>/<meta name="generator" content="Movable Type ([^"]*)/, :name=>"meta generator tag" }
]
end
=begin
# An aggressive plugin could check the following paths for confirmation:
# /mt or /mt/mt-check.cgi (discloses versions, paths)
# /mt/mt-tags.fcgi
# /mt-tb.fcgi
# /mt-cp.[f]?cgi
# /mt-search.cgi
# /mt-user-login.cgi
# /mt-recommend.cgi
# can't detect:
barackobama.com
blogs.oracle.com
electricartists.com/corporate
muledesign.com
www.radaronline.com
www.theatlantic.com
www.thehuffingtonpost.com
=end
| urbanadventurer/WhatWeb | plugins/movable_type.rb | Ruby | gpl-2.0 | 2,692 |
import { apiBase, versionApi } from '../commons';
const apiMonitoringBeta = `${apiBase}/beta/monitoring`;
const apiMonitoring = `${apiBase}/${versionApi}/monitoring`;
export { apiMonitoringBeta, apiMonitoring };
| centreon/centreon | tests/e2e/cypress/support/model.ts | TypeScript | gpl-2.0 | 214 |
require("map/level")
local levellist = {}
levellist[LEVELTYPE.SURVIVAL] = {}
levellist[LEVELTYPE.CAVE] = {}
levellist[LEVELTYPE.ADVENTURE] = {}
levellist[LEVELTYPE.TEST] = {}
levellist[LEVELTYPE.CUSTOM] = {}
function AddLevel(type, data)
table.insert(levellist[type], Level(data))
end
require("map/levels/adventure")
require("map/levels/caves")
require("map/levels/survival")
function GetTypeForLevelID(id)
if id == nil or id:lower() == "unknown" then
return LEVELTYPE.UNKNOWN
end
id = id:lower()
for type, levels in pairs(levellist) do
for idx, level in ipairs(levels) do
if level.id:lower() == id then
return type
end
end
end
return LEVELTYPE.UNKNOWN
end
AddLevel(LEVELTYPE.TEST, {
name="TEST_LEVEL",
id="TEST",
overrides={
{"world_size", "tiny"},
{"day", "onlynight"},
{"waves", "off"},
{"location", "cave"},
{"boons", "never"},
{"poi", "never"},
{"traps", "never"},
{"protected", "never"},
{"start_setpeice", "CaveStart"},
{"start_node", "BGSinkholeRoom"},
},
tasks={
"CavesStart",
"CavesAlternateStart",
"FungalBatCave",
"BatCaves",
"TentacledCave",
"LargeFungalComplex",
"SingleBatCaveTask",
"RabbitsAndFungs",
"FungalPlain",
"Cavern",
},
numoptionaltasks = 1,
optionaltasks = {
"CaveBase",
"MushBase",
"SinkBase",
"RabbitTown",
},
override_triggers = {
-- ["RuinsStart"] = {
-- {"SeasonColourCube", "caves"},
-- -- {"SeasonColourCube", SEASONS.CAVES},
-- },
-- ["TheLabyrinth"] = {
-- {"SeasonColourCube", "caves_ruins"},
-- -- {"SeasonColourCube", { DAY = "images/colour_cubes/ruins_light_cc.tex",
-- -- DUSK = "images/colour_cubes/ruins_dim_cc.tex",
-- -- NIGHT = "images/colour_cubes/ruins_dark_cc.tex",
-- -- },
-- -- },
-- },
-- ["CityInRuins"] = {
-- {"SeasonColourCube", "caves_ruins"},
-- -- {"SeasonColourCube", { DAY = "images/colour_cubes/ruins_light_cc.tex",
-- -- DUSK = "images/colour_cubes/ruins_dim_cc.tex",
-- -- NIGHT = "images/colour_cubes/ruins_dark_cc.tex",
-- -- },
-- -- },
-- },
},
})
return { story_levels=levellist[LEVELTYPE.ADVENTURE],
sandbox_levels=levellist[LEVELTYPE.SURVIVAL],
cave_levels = levellist[LEVELTYPE.CAVE],
--free_level=levellist[LEVELTYPE.SURVIVAL][1],
test_level=levellist[LEVELTYPE.TEST][1],
custom_levels = levellist[LEVELTYPE.CUSTOM],
CAMPAIGN_LENGTH=CAMPAIGN_LENGTH,
GetTypeForLevelID = GetTypeForLevelID
}
| czfshine/Don-t-Starve | data/scripts/map/levels.lua | Lua | gpl-2.0 | 2,569 |
import tests.util.*;
import java.util.Map;
// Test case for Issue 134:
// http://code.google.com/p/checker-framework/issues/detail?id=134
// Handling of generics from different enclosing classes.
// TODO: revisit with nested types in 1.3.
// @skip-test
class GenericTest4 {
public interface Foo {}
class Outer<O> {
O getOuter() { return null; }
class Inner<I> {
O getInner() { return null; }
I setter1(O p) { return null; }
O setter2(I p) { return null; }
Map<O, I> wow(Map<O, I> p) { return null; }
}
}
class OuterImpl extends Outer<Foo> {
void test() {
Foo foo = getOuter();
}
class InnerImpl extends Inner<@Odd String> {
void test() {
Foo foo = getInner();
String s = setter1(foo);
foo = setter2(s);
}
void testWow(Map<Foo, String> p) {
p = wow(p);
}
}
}
// Add uses from outside of both classes.
}
| biddyweb/checker-framework | framework/tests/framework/GenericTest4.java | Java | gpl-2.0 | 939 |
<?php
/**
* Themes shortcode image options go here
*
* @package Omega
* @subpackage Core
* @since 1.0
*
* @copyright (c) 2014 Oxygenna.com
* @license http://wiki.envato.com/support/legal-terms/licensing-terms/
* @version 1.7.3
*/
return array(
'title' => __('Image options', 'omega-admin-td'),
'fields' => array(
array(
'name' => __('Image Shape', 'omega-admin-td'),
'desc' => __('Choose the shape of the image', 'omega-admin-td'),
'id' => 'image_shape',
'type' => 'select',
'options' => array(
'box-round' => __('Round', 'omega-admin-td'),
'box-rect' => __('Rectangle', 'omega-admin-td'),
'box-square' => __('Square', 'omega-admin-td'),
),
'default' => 'box-round',
),
array(
'name' => __('Image Size', 'omega-admin-td'),
'desc' => __('Choose the size of the image', 'omega-admin-td'),
'id' => 'image_size',
'type' => 'select',
'options' => array(
'box-mini' => __('Mini', 'omega-admin-td'),
'no-small' => __('Small', 'omega-admin-td'),
'box-medium' => __('Medium', 'omega-admin-td'),
'box-big' => __('Big', 'omega-admin-td'),
'box-huge' => __('Huge', 'omega-admin-td'),
),
'default' => 'box-medium',
),
)
); | rinodung/wordpress-demo | wp-content/themes/omega/inc/options/shortcodes/shortcode-image-options.php | PHP | gpl-2.0 | 1,670 |
<?php
/*
Template Name: Products Template
*
*/
?>
<?php get_header(); ?>
<div class="wrap-full banner-background cf" style="<?php if( get_field('background_banner')){ echo "background-image: url('". get_field('background_banner')."')"; } ?>">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="products-container cf">
<h1><?php the_title(); ?> <span class="tagline"><?php the_field('tagline'); ?></span></h1>
<?php if($_GET['ativo'] == "tilbud") : ?>
<div class="price-table-column blue" style="display: block; margin: 0 auto 50px;">
<div class="price-table-header slim">
<span class="price-table-header-value"><h2>Ativo Medlemstilbud</h2></span>
</div>
<div class="price-table-price-row">
<span class="price-value price-eksl">Månedspris: 350,- <span style="color: #7f7f7f; font-size: 22px; text-decoration: line-through;">450,-</span></span>
</div>
<div class="price-table-cell">
<div class=""></div>
<span class="price-table-cell-value">Vedligeholdelse + Fuld Service</span>
<div class="price-table-cell-info">Alt fra pakken til 450,- her under, til en venlig pris :-)</div>
</div>
<div class="price-table-cell">
<div class=""></div>
<span class="price-table-cell-value">TILMELD</span>
<div class="price-table-cell-info">
<?php echo do_shortcode("[stripeform serviceid='service350']"); ?>
</div>
</div>
<div class="price-table-footer"></div>
</div>
<?php endif; ?>
<?php
// check if any products are created
if( have_rows('product') ):
// loop through products
while( have_rows('product') ): the_row(); ?>
<div class="price-table-column <?php the_sub_field('product_color'); ?>">
<div class="price-table-header slim">
<?php if(get_sub_field('product_link')) { ?><a href="<?php the_sub_field('product_link'); ?>"><?php } ?>
<span class="price-table-header-value"><h2><?php the_sub_field('product_name'); ?></h2></span>
<?php if(get_sub_field('product_link')) { ?></a><?php } ?>
</div>
<div class="price-table-price-row">
<?php if(get_sub_field('price_label') == 'from') { ?> <span class="price-value price-from price-eksl"><?php the_sub_field('product_price'); ?>,-</span><?php } ?>
<?php if(get_sub_field('price_label') == 'more') { ?> <span class="price-readmore"><?php the_sub_field('product_price'); ?></span><?php } ?>
<?php if(get_sub_field('price_label') == 'none') { ?> <span class="price-value price-eksl"><?php the_sub_field('product_price'); ?>,-</span><?php } ?>
</div>
<?php
if( get_sub_field('product_description') ):
?>
<div class="price-table-description">
<span><?php the_sub_field('product_description'); ?></span>
</div>
<?php endif; ?>
<?php
// check if any product items exists
if( have_rows('product_items') ):
// loop through product items
while( have_rows('product_items') ): the_row(); ?>
<div class="price-table-cell">
<div class="<?php the_sub_field('class'); ?>"></div>
<span class="price-table-cell-value"><?php the_sub_field('label'); ?></span>
<div class="price-table-cell-info"><?php echo do_shortcode(get_sub_field('description')); ?></div>
</div>
<?php endwhile; ?>
<?php endif; ?>
<div class="price-table-footer">
<?php if(get_sub_field('product_link')) { ?>
<a href="<?php the_sub_field('product_link'); ?>">
<span class="price-table-footer-value">Læs mere</span></a>
</a><?php } ?>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php endwhile; endif; ?>
</div>
<?php include (TEMPLATEPATH . '/contact-ribbon.php'); ?>
<div id="content">
<div id="inner-content" class="wrap cf">
<main id="main" class="m-all t-2of3 d-5of7 cf" role="main" itemscope itemprop="mainContentOfPage" itemtype="http://schema.org/Blog">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'cf' ); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">
<section class="entry-content cf" itemprop="articleBody">
<?php the_content(); ?>
</section> <?php // end article section ?>
<footer class="article-footer cf">
</footer>
</article>
<?php endwhile; endif; ?>
</main>
<!--
<?php get_sidebar(); ?>
-->
</div>
</div>
<?php get_footer(); ?>
| kragej/ativo | themes/bones/page-products.php | PHP | gpl-2.0 | 5,029 |
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, [email protected]
This software is distributed under the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "omp_compat.h"
#include <cmath>
#include "pair_lj_charmm_coul_long_omp.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "suffix.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
PairLJCharmmCoulLongOMP::PairLJCharmmCoulLongOMP(LAMMPS *lmp) :
PairLJCharmmCoulLong(lmp), ThrOMP(lmp, THR_PAIR)
{
suffix_flag |= Suffix::OMP;
respa_enable = 0;
cut_respa = NULL;
}
/* ---------------------------------------------------------------------- */
void PairLJCharmmCoulLongOMP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
const int nall = atom->nlocal + atom->nghost;
const int nthreads = comm->nthreads;
const int inum = list->inum;
#if defined(_OPENMP)
#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(eflag,vflag)
#endif
{
int ifrom, ito, tid;
loop_setup_thr(ifrom, ito, tid, inum, nthreads);
ThrData *thr = fix->get_thr(tid);
thr->timer(Timer::START);
ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr);
if (evflag) {
if (eflag) {
if (force->newton_pair) eval<1,1,1>(ifrom, ito, thr);
else eval<1,1,0>(ifrom, ito, thr);
} else {
if (force->newton_pair) eval<1,0,1>(ifrom, ito, thr);
else eval<1,0,0>(ifrom, ito, thr);
}
} else {
if (force->newton_pair) eval<0,0,1>(ifrom, ito, thr);
else eval<0,0,0>(ifrom, ito, thr);
}
thr->timer(Timer::PAIR);
reduce_thr(this, eflag, vflag, thr);
} // end of omp parallel region
}
/* ---------------------------------------------------------------------- */
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
void PairLJCharmmCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr)
{
const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0];
dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0];
const double * _noalias const q = atom->q;
const int * _noalias const type = atom->type;
const double * _noalias const special_coul = force->special_coul;
const double * _noalias const special_lj = force->special_lj;
const double qqrd2e = force->qqrd2e;
const double inv_denom_lj = 1.0/denom_lj;
const int * const ilist = list->ilist;
const int * const numneigh = list->numneigh;
const int * const * const firstneigh = list->firstneigh;
const int nlocal = atom->nlocal;
// loop over neighbors of my atoms
for (int ii = iifrom; ii < iito; ++ii) {
const int i = ilist[ii];
const int itype = type[i];
const double qtmp = q[i];
const double xtmp = x[i].x;
const double ytmp = x[i].y;
const double ztmp = x[i].z;
double fxtmp,fytmp,fztmp;
fxtmp=fytmp=fztmp=0.0;
const int * const jlist = firstneigh[i];
const int jnum = numneigh[i];
const double * _noalias const lj1i = lj1[itype];
const double * _noalias const lj2i = lj2[itype];
const double * _noalias const lj3i = lj3[itype];
const double * _noalias const lj4i = lj4[itype];
for (int jj = 0; jj < jnum; jj++) {
double forcecoul, forcelj, evdwl, ecoul;
forcecoul = forcelj = evdwl = ecoul = 0.0;
const int sbindex = sbmask(jlist[jj]);
const int j = jlist[jj] & NEIGHMASK;
const double delx = xtmp - x[j].x;
const double dely = ytmp - x[j].y;
const double delz = ztmp - x[j].z;
const double rsq = delx*delx + dely*dely + delz*delz;
const int jtype = type[j];
if (rsq < cut_bothsq) {
const double r2inv = 1.0/rsq;
if (rsq < cut_coulsq) {
if (!ncoultablebits || rsq <= tabinnersq) {
const double A1 = 0.254829592;
const double A2 = -0.284496736;
const double A3 = 1.421413741;
const double A4 = -1.453152027;
const double A5 = 1.061405429;
const double EWALD_F = 1.12837917;
const double INV_EWALD_P = 1.0/0.3275911;
const double r = sqrt(rsq);
const double grij = g_ewald * r;
const double expm2 = exp(-grij*grij);
const double t = INV_EWALD_P / (INV_EWALD_P + grij);
const double erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
const double prefactor = qqrd2e * qtmp*q[j]/r;
forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
if (EFLAG) ecoul = prefactor*erfc;
if (sbindex) {
const double adjust = (1.0-special_coul[sbindex])*prefactor;
forcecoul -= adjust;
if (EFLAG) ecoul -= adjust;
}
} else {
union_int_float_t rsq_lookup;
rsq_lookup.f = rsq;
const int itable = (rsq_lookup.i & ncoulmask) >> ncoulshiftbits;
const double fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
const double table = ftable[itable] + fraction*dftable[itable];
forcecoul = qtmp*q[j] * table;
if (EFLAG) ecoul = qtmp*q[j] * (etable[itable] + fraction*detable[itable]);
if (sbindex) {
const double table2 = ctable[itable] + fraction*dctable[itable];
const double prefactor = qtmp*q[j] * table2;
const double adjust = (1.0-special_coul[sbindex])*prefactor;
forcecoul -= adjust;
if (EFLAG) ecoul -= adjust;
}
}
}
if (rsq < cut_ljsq) {
const double r6inv = r2inv*r2inv*r2inv;
forcelj = r6inv * (lj1i[jtype]*r6inv - lj2i[jtype]);
const double philj = r6inv*(lj3i[jtype]*r6inv-lj4i[jtype]);
if (EFLAG) evdwl = philj;
if (rsq > cut_lj_innersq) {
const double drsq = cut_ljsq - rsq;
const double cut2 = (rsq - cut_lj_innersq) * drsq;
const double switch1 = drsq * (drsq*drsq + 3.0*cut2) * inv_denom_lj;
const double switch2 = 12.0*rsq * cut2 * inv_denom_lj;
forcelj = forcelj*switch1 + philj*switch2;
if (EFLAG) evdwl *= switch1;
}
if (sbindex) {
const double factor_lj = special_lj[sbindex];
forcelj *= factor_lj;
if (EFLAG) evdwl *= factor_lj;
}
}
const double fpair = (forcecoul + forcelj) * r2inv;
fxtmp += delx*fpair;
fytmp += dely*fpair;
fztmp += delz*fpair;
if (NEWTON_PAIR || j < nlocal) {
f[j].x -= delx*fpair;
f[j].y -= dely*fpair;
f[j].z -= delz*fpair;
}
if (EVFLAG) ev_tally_thr(this,i,j,nlocal,NEWTON_PAIR,
evdwl,ecoul,fpair,delx,dely,delz,thr);
}
}
f[i].x += fxtmp;
f[i].y += fytmp;
f[i].z += fztmp;
}
}
/* ---------------------------------------------------------------------- */
double PairLJCharmmCoulLongOMP::memory_usage()
{
double bytes = memory_usage_thr();
bytes += PairLJCharmmCoulLong::memory_usage();
return bytes;
}
| pastewka/lammps | src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp | C++ | gpl-2.0 | 7,636 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Backends</title>
<link rel="stylesheet" type="text/css" media="screen" href="../general/css/style.css" />
</head>
<body>
<h1>Backends</h1>
<h2>General Information</h2>
<p>The NagVis code is separated into several layers. One of these layers is
the "data layer". The data layer is used to handle requests for
information from third party sources like the socket of MKLivestatus. We
call this layer "backend" in general. There are some components
inside NagVis to manage these backends which act as the glue between the
single backends and the other layers.</p>
<h2>Default backend</h2>
<p>At the moment there are a few backends delivered with the NagVis core
packages: the most important ones are the mklivestatus and ndomy backends. All backend
configuration parameters are described in detail on their own pages.</p>
<p>The ndomy backend has been the default backend from NagVis 1.0 to NagVis 1.5.
It fetches Nagios information from the NDO MySQL database. Since NagVis 1.5
the default backend has been switched to MKLivestatus backend.</p>
<p>In NagVis 1.9, the pgsql backend has been added to fetch the Nagios information
from a PostgreSQL database as used by e.g. Icinga 2.</p>
<h2>Backend types</h2>
<ul>
<li><a href=backend_mklivestatus.html>MKLivestatus</a></li>
<li><a href=backend_ndomy.html>NDOMy</a></li>
<li><a href=backend_nagiosbp.html>NagiosBP</a></li>
<li><a href=backend_pgsql.html>PgSQL</a></li>
<li>MerlinMy</li>
</ul>
<h2>Configuring backends</h2>
<p>The backends are defined in the main configuration file. See
<a href="nagvis_config_format_description.html#backend">main configuration format description</a>
on how to define backends.</p>
</body>
</html>
| NagVis/nagvis | docs/en_US/backends.html | HTML | gpl-2.0 | 2,146 |
MyRaspberry-Utilities
====================
Bash Scripts for Raspberry 24/7
| tbhCiro/MyRasperry-Utilities | README.md | Markdown | gpl-2.0 | 76 |
/* $Id: memuserkernel-r0drv-darwin.cpp $ */
/** @file
* IPRT - User & Kernel Memory, Ring-0 Driver, Darwin.
*/
/*
* Copyright (C) 2009 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "the-darwin-kernel.h"
#include "internal/iprt.h"
#include <iprt/mem.h>
#include <iprt/assert.h>
#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
# include <iprt/asm-amd64-x86.h>
#endif
#include <iprt/err.h>
RTR0DECL(int) RTR0MemUserCopyFrom(void *pvDst, RTR3PTR R3PtrSrc, size_t cb)
{
RT_ASSERT_INTS_ON();
int rc = copyin((const user_addr_t)R3PtrSrc, pvDst, cb);
if (RT_LIKELY(rc == 0))
return VINF_SUCCESS;
return VERR_ACCESS_DENIED;
}
RTR0DECL(int) RTR0MemUserCopyTo(RTR3PTR R3PtrDst, void const *pvSrc, size_t cb)
{
RT_ASSERT_INTS_ON();
int rc = copyout(pvSrc, R3PtrDst, cb);
if (RT_LIKELY(rc == 0))
return VINF_SUCCESS;
return VERR_ACCESS_DENIED;
}
RTR0DECL(bool) RTR0MemUserIsValidAddr(RTR3PTR R3Ptr)
{
/* the commpage is above this. */
#ifdef RT_ARCH_X86
return R3Ptr < VM_MAX_ADDRESS;
#else
return R3Ptr < VM_MAX_PAGE_ADDRESS;
#endif
}
RTR0DECL(bool) RTR0MemKernelIsValidAddr(void *pv)
{
/* Found no public #define or symbol for checking this, so we'll
have to make do with thing found in the debugger and the sources. */
#ifdef RT_ARCH_X86
NOREF(pv);
return true; /* Almost anything is a valid kernel address here. */
#elif defined(RT_ARCH_AMD64)
return (uintptr_t)pv >= UINT64_C(0xffff800000000000);
#else
# error "PORTME"
#endif
}
RTR0DECL(bool) RTR0MemAreKrnlAndUsrDifferent(void)
{
/* As mentioned in RTR0MemKernelIsValidAddr, found no way of checking
this at compiler or runtime. */
#ifdef RT_ARCH_X86
return false;
#else
return true;
#endif
}
| JSansalone/VirtualBox4.1.18 | src/VBox/Runtime/r0drv/darwin/memuserkernel-r0drv-darwin.cpp | C++ | gpl-2.0 | 2,937 |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SteamShift.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute( "System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0" )]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute( "Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode" )]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute( global::System.ComponentModel.EditorBrowsableState.Advanced )]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ( ( resourceMan == null ) )
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager( "SteamShift.Properties.Resources", typeof( Resources ).Assembly );
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute( global::System.ComponentModel.EditorBrowsableState.Advanced )]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
| MiszouGit/SteamShift | SteamShift/Properties/Resources.Designer.cs | C# | gpl-2.0 | 2,447 |
<div id="obligee_volumen" class="viz" data-viz="treemap-a" data-graph="treemap-a">
<div class="row">
<div class="col-sm-12">
<h3>Volumen de recursos de revisión, por sujeto obligado y por sentido de la resolución: <span class="year-range">2007 - 2015</span></h3>
<p class="lead">Recursos de revisión que se realizan por sujeto obligado, tanto de acceso a la información como de datos personales</p>
<!--<a href="#" class="download" download><b></b>Descargar datos</a>-->
</div>
<div class="col-sm-10 col-sm-offset-1">
<p class="instructions">Da clic sobre un sector para observar la distribución del número de solicitudes por sujeto obligado
y tipo de solicitud. Para regresar, da clic sobre el área gris en la parte superior de la gráfica.
</p>
</div>
</div>
<section id="treemap-a"></section>
<!--source-->
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<!--source-->
<?php include "templates/source.php";?>
<p class="lead info">Distribución de la gráfica</p>
<ul class="info row">
<li class="col-sm-3">Primer nivel: <strong>Sector</strong></li>
<li class="col-sm-3">Segundo nivel: <strong>Sujeto obligado</strong></li>
<li class="col-sm-3">Tercer nivel: <strong>Sentido de la resolución</strong>
</li>
<li class="col-sm-3">Tamaño: <strong>Número de solicitudes</strong></li>
</ul>
</div>
</div>
</div>
| GobiernoFacil/mapadai | includes/recursos/obligee/volumen.php | PHP | gpl-2.0 | 1,410 |
#ifndef LAC_DIFFERENCE_NEIGHBOR_SET_H
#define LAC_DIFFERENCE_NEIGHBOR_SET_H 1
#include <utility>
#include <list>
#include <algorithm>
namespace LAC {
namespace Difference {
template<typename T>
struct NeighborSet {
typedef T data_t;
typedef std::list<T> queue_t;
typedef typename queue_t::iterator it_t;
typedef typename queue_t::const_iterator const_it_t;
NeighborSet(size_t count) : m_count(std::max((size_t)1,count)) {}
~NeighborSet(){}
void Append(const T& d){
it_t it = std::lower_bound(m_queue.begin(),
m_queue.end(),
d);
m_queue.insert(it, d);
if(m_queue.size() > m_count)
m_queue.pop_back();
}
const_it_t Begin() const { return m_queue.begin(); }
const_it_t End() const { return m_queue.end(); }
size_t m_count;
queue_t m_queue;
};
}
}
#endif
| landmarkacoustics/dissUtils | src/neighbor_set.h | C | gpl-2.0 | 906 |
package com.carpoolsophia;
import java.util.concurrent.ExecutionException;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Fragment;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import butterknife.InjectView;
import butterknife.Views;
import com.carpoolsophia.gcloudApi.model.CarpoolSophiaUser;
import com.carpoolsophia.service.CarpoolSophiaUserService;
import com.carpoolsophia.service.ProfileService;
import com.facebook.AccessToken;
import com.facebook.AccessTokenUtils;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
public class ProfileFragment extends Fragment {
private final static String CLASSNAME = ProfileFragment.class.getSimpleName();
@InjectView(R.id.TestLoadFromFB)
Button testLoadFromFbBtn;
@InjectView(R.id.profile_firstName)
EditText profileFirstName;
@InjectView(R.id.profile_lastName)
EditText profileLastName;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.profile_fragment, container, false);
Views.inject(this, view);
return view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final ProfileFragment finalThis = this;
testLoadFromFbBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.w(ProfileFragment.class.getSimpleName(), "loadFromFB");
CarpoolSophiaUser user;
try {
user = (new LoadUserFromFbTask(finalThis).execute()).get();
if (user != null) {
// Log.w(getClass().getSimpleName(),
// "user loaded: "+ModelToJSONParseAdapter.toJSONParse(user));
profileFirstName.setText(user.getFirstName());
profileLastName.setText(user.getLastName());
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
}
public void updateProfileInfo(View btn) {
Log.w(getClass().getSimpleName(), "updateProfileInfo");
}
private class LoadUserFromFbTask extends
AsyncTask<CarpoolSophiaUser, Void, CarpoolSophiaUser> {
private ProfileFragment profileFragment;
public LoadUserFromFbTask(ProfileFragment fragment) {
super();
this.profileFragment = fragment;
}
@SuppressWarnings("serial")
protected CarpoolSophiaUser doInBackground(final CarpoolSophiaUser... users) {
CarpoolSophiaUser user = CarpoolSophiaUserService.get()
.getCurrentCSuser();
AccessToken accessToken = AccessTokenUtils.deserializeToken(user
.getAccessToken());
GraphRequest request = GraphRequest.newMeRequest(accessToken,
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject object, GraphResponse response) {
// Log.d(CLASSNAME, "JSONobject: " + object);
// Log.d(CLASSNAME, "GraphResponse #1: " +
// response.getRawResponse());
}
});
GraphResponse response = request.executeAndWait();
Log.d(CLASSNAME, "GraphResponse #2: " + response.getRawResponse());
CarpoolSophiaUser userFromFB = new CarpoolSophiaUser();
try {
userFromFB.setFirstName(response.getJSONObject()
.getString("first_name"));
userFromFB.setLastName(response.getJSONObject().getString("last_name"));
} catch (JSONException e) {
e.printStackTrace();
}
ProfileService.get().refreshCSUser(user, userFromFB);
return user;
}
@Override
protected void onPostExecute(CarpoolSophiaUser result) {
super.onPostExecute(result);
}
}
}
| cernier/carpoolsophia | carpoolsophia/src/main/java/com/carpoolsophia/ProfileFragment.java | Java | gpl-2.0 | 4,190 |
//---------------------------------------------------------------------------
// NEOPOP : Emulator as in Dreamland
//
// Copyright (c) 2001-2002 by neopop_uk
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version. See also the license.txt file for
// additional informations.
//---------------------------------------------------------------------------
/*
//---------------------------------------------------------------------------
//=========================================================================
TLCS900h_registers_mapCodeB0.h
//=========================================================================
//---------------------------------------------------------------------------
History of changes:
===================
20 JUL 2002 - neopop_uk
=======================================
- Cleaned and tidied up for the source release
//---------------------------------------------------------------------------
*/
((_u8*)&gprBank[0][0]) + BYTE0,((_u8*)&gprBank[0][0]) + BYTE1, //BANK 0
((_u8*)&gprBank[0][0]) + BYTE2, ((_u8*)&gprBank[0][0]) + BYTE3,
((_u8*)&gprBank[0][1]) + BYTE0,((_u8*)&gprBank[0][1]) + BYTE1,
((_u8*)&gprBank[0][1]) + BYTE2, ((_u8*)&gprBank[0][1]) + BYTE3,
((_u8*)&gprBank[0][2]) + BYTE0,((_u8*)&gprBank[0][2]) + BYTE1,
((_u8*)&gprBank[0][2]) + BYTE2, ((_u8*)&gprBank[0][2]) + BYTE3,
((_u8*)&gprBank[0][3]) + BYTE0,((_u8*)&gprBank[0][3]) + BYTE1,
((_u8*)&gprBank[0][3]) + BYTE2, ((_u8*)&gprBank[0][3]) + BYTE3,
((_u8*)&gprBank[1][0]) + BYTE0,((_u8*)&gprBank[1][0]) + BYTE1, //BANK 1
((_u8*)&gprBank[1][0]) + BYTE2, ((_u8*)&gprBank[1][0]) + BYTE3,
((_u8*)&gprBank[1][1]) + BYTE0,((_u8*)&gprBank[1][1]) + BYTE1,
((_u8*)&gprBank[1][1]) + BYTE2, ((_u8*)&gprBank[1][1]) + BYTE3,
((_u8*)&gprBank[1][2]) + BYTE0,((_u8*)&gprBank[1][2]) + BYTE1,
((_u8*)&gprBank[1][2]) + BYTE2, ((_u8*)&gprBank[1][2]) + BYTE3,
((_u8*)&gprBank[1][3]) + BYTE0,((_u8*)&gprBank[1][3]) + BYTE1,
((_u8*)&gprBank[1][3]) + BYTE2, ((_u8*)&gprBank[1][3]) + BYTE3,
((_u8*)&gprBank[2][0]) + BYTE0,((_u8*)&gprBank[2][0]) + BYTE1, //BANK 2
((_u8*)&gprBank[2][0]) + BYTE2, ((_u8*)&gprBank[2][0]) + BYTE3,
((_u8*)&gprBank[2][1]) + BYTE0,((_u8*)&gprBank[2][1]) + BYTE1,
((_u8*)&gprBank[2][1]) + BYTE2, ((_u8*)&gprBank[2][1]) + BYTE3,
((_u8*)&gprBank[2][2]) + BYTE0,((_u8*)&gprBank[2][2]) + BYTE1,
((_u8*)&gprBank[2][2]) + BYTE2, ((_u8*)&gprBank[2][2]) + BYTE3,
((_u8*)&gprBank[2][3]) + BYTE0,((_u8*)&gprBank[2][3]) + BYTE1,
((_u8*)&gprBank[2][3]) + BYTE2, ((_u8*)&gprBank[2][3]) + BYTE3,
((_u8*)&gprBank[3][0]) + BYTE0,((_u8*)&gprBank[3][0]) + BYTE1, //BANK 3
((_u8*)&gprBank[3][0]) + BYTE2, ((_u8*)&gprBank[3][0]) + BYTE3,
((_u8*)&gprBank[3][1]) + BYTE0,((_u8*)&gprBank[3][1]) + BYTE1,
((_u8*)&gprBank[3][1]) + BYTE2, ((_u8*)&gprBank[3][1]) + BYTE3,
((_u8*)&gprBank[3][2]) + BYTE0,((_u8*)&gprBank[3][2]) + BYTE1,
((_u8*)&gprBank[3][2]) + BYTE2, ((_u8*)&gprBank[3][2]) + BYTE3,
((_u8*)&gprBank[3][3]) + BYTE0,((_u8*)&gprBank[3][3]) + BYTE1,
((_u8*)&gprBank[3][3]) + BYTE2, ((_u8*)&gprBank[3][3]) + BYTE3,
(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,
(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,
(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,
(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,
(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,(_u8*)&rErr,
//Previous Bank
(_u8*)&rErr,(_u8*)&rErr,
(_u8*)&rErr,(_u8*)&rErr,
(_u8*)&rErr,(_u8*)&rErr,
(_u8*)&rErr,(_u8*)&rErr,
(_u8*)&rErr,(_u8*)&rErr,
(_u8*)&rErr,(_u8*)&rErr,
(_u8*)&rErr,(_u8*)&rErr,
(_u8*)&rErr,(_u8*)&rErr,
//Current Bank
((_u8*)&gprBank[0][0]) + BYTE0,((_u8*)&gprBank[0][0]) + BYTE1,
((_u8*)&gprBank[0][0]) + BYTE2, ((_u8*)&gprBank[0][0]) + BYTE3,
((_u8*)&gprBank[0][1]) + BYTE0,((_u8*)&gprBank[0][1]) + BYTE1,
((_u8*)&gprBank[0][1]) + BYTE2, ((_u8*)&gprBank[0][1]) + BYTE3,
((_u8*)&gprBank[0][2]) + BYTE0,((_u8*)&gprBank[0][2]) + BYTE1,
((_u8*)&gprBank[0][2]) + BYTE2, ((_u8*)&gprBank[0][2]) + BYTE3,
((_u8*)&gprBank[0][3]) + BYTE0,((_u8*)&gprBank[0][3]) + BYTE1,
((_u8*)&gprBank[0][3]) + BYTE2, ((_u8*)&gprBank[0][3]) + BYTE3,
((_u8*)&gpr[0]) + BYTE0, ((_u8*)&gpr[0]) + BYTE1,
((_u8*)&gpr[0]) + BYTE2, ((_u8*)&gpr[0]) + BYTE3,
((_u8*)&gpr[1]) + BYTE0, ((_u8*)&gpr[1]) + BYTE1,
((_u8*)&gpr[1]) + BYTE2, ((_u8*)&gpr[1]) + BYTE3,
((_u8*)&gpr[2]) + BYTE0, ((_u8*)&gpr[2]) + BYTE1,
((_u8*)&gpr[2]) + BYTE2, ((_u8*)&gpr[2]) + BYTE3,
((_u8*)&gpr[3]) + BYTE0, ((_u8*)&gpr[3]) + BYTE1,
((_u8*)&gpr[3]) + BYTE2, ((_u8*)&gpr[3]) + BYTE3
//=============================================================================
| Cpasjuste/neopop-sdl | Core/TLCS-900h/TLCS900h_registers_mapCodeB0.h | C | gpl-2.0 | 6,424 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>ShipCAD: ShipCADlib/subdivbase.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">ShipCAD
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_f0b6ef187c5b1483641b038f81654ac4.html">ShipCADlib</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">subdivbase.cpp File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include <iostream></code><br />
<code>#include "<a class="el" href="subdivbase_8h_source.html">subdivbase.h</a>"</code><br />
<code>#include "<a class="el" href="subdivsurface_8h_source.html">subdivsurface.h</a>"</code><br />
</div>
<p><a href="subdivbase_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a84a51d41cc05085431b75e5148141ca9"><td class="memItemLeft" align="right" valign="top">ostream & </td><td class="memItemRight" valign="bottom"><a class="el" href="subdivbase_8cpp.html#a84a51d41cc05085431b75e5148141ca9">operator<<</a> (ostream &os, const <a class="el" href="classShipCAD_1_1SubdivisionBase.html">ShipCAD::SubdivisionBase</a> &base)</td></tr>
<tr class="separator:a84a51d41cc05085431b75e5148141ca9"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a84a51d41cc05085431b75e5148141ca9"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ostream& operator<< </td>
<td>(</td>
<td class="paramtype">ostream & </td>
<td class="paramname"><em>os</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classShipCAD_1_1SubdivisionBase.html">ShipCAD::SubdivisionBase</a> & </td>
<td class="paramname"><em>base</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="subdivbase_8cpp_source.html#l00062">62</a> of file <a class="el" href="subdivbase_8cpp_source.html">subdivbase.cpp</a>.</p>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Feb 25 2018 15:36:00 for ShipCAD by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
| gpgreen/ShipCAD | doc/html/subdivbase_8cpp.html | HTML | gpl-2.0 | 6,049 |
/*
* fs/fs-writeback.c
*
* Copyright (C) 2002, Linus Torvalds.
*
* Contains all the functions related to writing back and waiting
* upon dirty inodes against superblocks, and writing back dirty
* pages against inodes. ie: data writeback. Writeout of the
* inode itself is not handled here.
*
* 10Apr2002 Andrew Morton
* Split out of fs/inode.c
* Additions for address_space-based writeback
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
#include <linux/writeback.h>
#include <linux/blkdev.h>
#include <linux/backing-dev.h>
#include <linux/buffer_head.h>
#include <linux/tracepoint.h>
#include <trace/events/vfs.h>
#include "internal.h"
/*
* Passed into wb_writeback(), essentially a subset of writeback_control
*/
struct wb_writeback_work {
long nr_pages;
struct super_block *sb;
unsigned long *older_than_this;
enum writeback_sync_modes sync_mode;
unsigned int tagged_writepages:1;
unsigned int for_kupdate:1;
unsigned int range_cyclic:1;
unsigned int for_background:1;
enum wb_reason reason; /* why was writeback initiated? */
struct list_head list; /* pending work list */
struct completion *done; /* set if the caller waits */
};
/*
* Include the creation of the trace points after defining the
* wb_writeback_work structure so that the definition remains local to this
* file.
*/
#define CREATE_TRACE_POINTS
#include <trace/events/writeback.h>
/*
* We don't actually have pdflush, but this one is exported though /proc...
*/
int nr_pdflush_threads;
/**
* writeback_in_progress - determine whether there is writeback in progress
* @bdi: the device's backing_dev_info structure.
*
* Determine whether there is writeback waiting to be handled against a
* backing device.
*/
int writeback_in_progress(struct backing_dev_info *bdi)
{
return test_bit(BDI_writeback_running, &bdi->state);
}
static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
if (strcmp(sb->s_type->name, "bdev") == 0)
return inode->i_mapping->backing_dev_info;
return sb->s_bdi;
}
static inline struct inode *wb_inode(struct list_head *head)
{
return list_entry(head, struct inode, i_wb_list);
}
/* Wakeup flusher thread or forker thread to fork it. Requires bdi->wb_lock. */
static void bdi_wakeup_flusher(struct backing_dev_info *bdi)
{
if (bdi->wb.task) {
wake_up_process(bdi->wb.task);
} else {
/*
* The bdi thread isn't there, wake up the forker thread which
* will create and run it.
*/
wake_up_process(default_backing_dev_info.wb.task);
}
}
static void bdi_queue_work(struct backing_dev_info *bdi,
struct wb_writeback_work *work)
{
trace_writeback_queue(bdi, work);
spin_lock_bh(&bdi->wb_lock);
list_add_tail(&work->list, &bdi->work_list);
if (!bdi->wb.task)
trace_writeback_nothread(bdi, work);
bdi_wakeup_flusher(bdi);
spin_unlock_bh(&bdi->wb_lock);
}
static void
__bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
bool range_cyclic, enum wb_reason reason)
{
struct wb_writeback_work *work;
/*
* This is WB_SYNC_NONE writeback, so if allocation fails just
* wakeup the thread for old dirty data writeback
*/
work = kzalloc(sizeof(*work), GFP_ATOMIC);
if (!work) {
if (bdi->wb.task) {
trace_writeback_nowork(bdi);
wake_up_process(bdi->wb.task);
}
return;
}
work->sync_mode = WB_SYNC_NONE;
work->nr_pages = nr_pages;
work->range_cyclic = range_cyclic;
work->reason = reason;
bdi_queue_work(bdi, work);
}
/**
* bdi_start_writeback - start writeback
* @bdi: the backing device to write from
* @nr_pages: the number of pages to write
* @reason: reason why some writeback work was initiated
*
* Description:
* This does WB_SYNC_NONE opportunistic writeback. The IO is only
* started when this function returns, we make no guarantees on
* completion. Caller need not hold sb s_umount semaphore.
*
*/
void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
enum wb_reason reason)
{
__bdi_start_writeback(bdi, nr_pages, true, reason);
}
/**
* bdi_start_background_writeback - start background writeback
* @bdi: the backing device to write from
*
* Description:
* This makes sure WB_SYNC_NONE background writeback happens. When
* this function returns, it is only guaranteed that for given BDI
* some IO is happening if we are over background dirty threshold.
* Caller need not hold sb s_umount semaphore.
*/
void bdi_start_background_writeback(struct backing_dev_info *bdi)
{
/*
* We just wake up the flusher thread. It will perform background
* writeback as soon as there is no other work to do.
*/
trace_writeback_wake_background(bdi);
spin_lock_bh(&bdi->wb_lock);
bdi_wakeup_flusher(bdi);
spin_unlock_bh(&bdi->wb_lock);
}
/*
* Remove the inode from the writeback list it is on.
*/
void inode_wb_list_del(struct inode *inode)
{
struct backing_dev_info *bdi = inode_to_bdi(inode);
spin_lock(&bdi->wb.list_lock);
list_del_init(&inode->i_wb_list);
spin_unlock(&bdi->wb.list_lock);
}
/*
* Redirty an inode: set its when-it-was dirtied timestamp and move it to the
* furthest end of its superblock's dirty-inode list.
*
* Before stamping the inode's ->dirtied_when, we check to see whether it is
* already the most-recently-dirtied inode on the b_dirty list. If that is
* the case then the inode must have been redirtied while it was being written
* out and we don't reset its dirtied_when.
*/
static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
{
assert_spin_locked(&wb->list_lock);
if (!list_empty(&wb->b_dirty)) {
struct inode *tail;
tail = wb_inode(wb->b_dirty.next);
if (time_before(inode->dirtied_when, tail->dirtied_when))
inode->dirtied_when = jiffies;
}
list_move(&inode->i_wb_list, &wb->b_dirty);
}
/*
* requeue inode for re-scanning after bdi->b_io list is exhausted.
*/
static void requeue_io(struct inode *inode, struct bdi_writeback *wb)
{
assert_spin_locked(&wb->list_lock);
list_move(&inode->i_wb_list, &wb->b_more_io);
}
static void inode_sync_complete(struct inode *inode)
{
/*
* Prevent speculative execution through
* spin_unlock(&wb->list_lock);
*/
smp_mb();
wake_up_bit(&inode->i_state, __I_SYNC);
}
static bool inode_dirtied_after(struct inode *inode, unsigned long t)
{
bool ret = time_after(inode->dirtied_when, t);
#ifndef CONFIG_64BIT
/*
* For inodes being constantly redirtied, dirtied_when can get stuck.
* It _appears_ to be in the future, but is actually in distant past.
* This test is necessary to prevent such wrapped-around relative times
* from permanently stopping the whole bdi writeback.
*/
ret = ret && time_before_eq(inode->dirtied_when, jiffies);
#endif
return ret;
}
/*
* Move expired dirty inodes from @delaying_queue to @dispatch_queue.
*/
static int move_expired_inodes(struct list_head *delaying_queue,
struct list_head *dispatch_queue,
struct wb_writeback_work *work)
{
LIST_HEAD(tmp);
struct list_head *pos, *node;
struct super_block *sb = NULL;
struct inode *inode;
int do_sb_sort = 0;
int moved = 0;
while (!list_empty(delaying_queue)) {
inode = wb_inode(delaying_queue->prev);
if (work->older_than_this &&
inode_dirtied_after(inode, *work->older_than_this))
break;
if (sb && sb != inode->i_sb)
do_sb_sort = 1;
sb = inode->i_sb;
list_move(&inode->i_wb_list, &tmp);
moved++;
}
/* just one sb in list, splice to dispatch_queue and we're done */
if (!do_sb_sort) {
list_splice(&tmp, dispatch_queue);
goto out;
}
/* Move inodes from one superblock together */
while (!list_empty(&tmp)) {
sb = wb_inode(tmp.prev)->i_sb;
list_for_each_prev_safe(pos, node, &tmp) {
inode = wb_inode(pos);
if (inode->i_sb == sb)
list_move(&inode->i_wb_list, dispatch_queue);
}
}
out:
return moved;
}
/*
* Queue all expired dirty inodes for io, eldest first.
* Before
* newly dirtied b_dirty b_io b_more_io
* =============> gf edc BA
* After
* newly dirtied b_dirty b_io b_more_io
* =============> g fBAedc
* |
* +--> dequeue for IO
*/
static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work)
{
int moved;
assert_spin_locked(&wb->list_lock);
list_splice_init(&wb->b_more_io, &wb->b_io);
moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, work);
trace_writeback_queue_io(wb, work, moved);
}
static int write_inode(struct inode *inode, struct writeback_control *wbc)
{
if (inode->i_sb->s_op->write_inode && !is_bad_inode(inode))
return inode->i_sb->s_op->write_inode(inode, wbc);
return 0;
}
/*
* Wait for writeback on an inode to complete.
*/
static void inode_wait_for_writeback(struct inode *inode,
struct bdi_writeback *wb)
{
DEFINE_WAIT_BIT(wq, &inode->i_state, __I_SYNC);
wait_queue_head_t *wqh;
wqh = bit_waitqueue(&inode->i_state, __I_SYNC);
while (inode->i_state & I_SYNC) {
spin_unlock(&inode->i_lock);
spin_unlock(&wb->list_lock);
__wait_on_bit(wqh, &wq, inode_wait, TASK_UNINTERRUPTIBLE);
spin_lock(&wb->list_lock);
spin_lock(&inode->i_lock);
}
}
/*
* Write out an inode's dirty pages. Called under wb->list_lock and
* inode->i_lock. Either the caller has an active reference on the inode or
* the inode has I_WILL_FREE set.
*
* If `wait' is set, wait on the writeout.
*
* The whole writeout design is quite complex and fragile. We want to avoid
* starvation of particular inodes when others are being redirtied, prevent
* livelocks, etc.
*/
static int
writeback_single_inode(struct inode *inode, struct bdi_writeback *wb,
struct writeback_control *wbc)
{
struct address_space *mapping = inode->i_mapping;
long nr_to_write = wbc->nr_to_write;
unsigned dirty;
int ret;
assert_spin_locked(&wb->list_lock);
assert_spin_locked(&inode->i_lock);
if (!atomic_read(&inode->i_count))
WARN_ON(!(inode->i_state & (I_WILL_FREE|I_FREEING)));
else
WARN_ON(inode->i_state & I_WILL_FREE);
if (inode->i_state & I_SYNC) {
/*
* If this inode is locked for writeback and we are not doing
* writeback-for-data-integrity, move it to b_more_io so that
* writeback can proceed with the other inodes on s_io.
*
* We'll have another go at writing back this inode when we
* completed a full scan of b_io.
*/
if (wbc->sync_mode != WB_SYNC_ALL) {
requeue_io(inode, wb);
trace_writeback_single_inode_requeue(inode, wbc,
nr_to_write);
return 0;
}
/*
* It's a data-integrity sync. We must wait.
*/
inode_wait_for_writeback(inode, wb);
}
BUG_ON(inode->i_state & I_SYNC);
/* Set I_SYNC, reset I_DIRTY_PAGES */
inode->i_state |= I_SYNC;
inode->i_state &= ~I_DIRTY_PAGES;
spin_unlock(&inode->i_lock);
spin_unlock(&wb->list_lock);
ret = do_writepages(mapping, wbc);
/*
* Make sure to wait on the data before writing out the metadata.
* This is important for filesystems that modify metadata on data
* I/O completion.
*/
if (wbc->sync_mode == WB_SYNC_ALL) {
int err = filemap_fdatawait(mapping);
if (ret == 0)
ret = err;
}
/*
* Some filesystems may redirty the inode during the writeback
* due to delalloc, clear dirty metadata flags right before
* write_inode()
*/
spin_lock(&inode->i_lock);
dirty = inode->i_state & I_DIRTY;
inode->i_state &= ~(I_DIRTY_SYNC | I_DIRTY_DATASYNC);
spin_unlock(&inode->i_lock);
/* Don't write the inode if only I_DIRTY_PAGES was set */
if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) {
int err = write_inode(inode, wbc);
if (ret == 0)
ret = err;
}
spin_lock(&wb->list_lock);
spin_lock(&inode->i_lock);
inode->i_state &= ~I_SYNC;
if (!(inode->i_state & I_FREEING)) {
/*
* Sync livelock prevention. Each inode is tagged and synced in
* one shot. If still dirty, it will be redirty_tail()'ed below.
* Update the dirty time to prevent enqueue and sync it again.
*/
if ((inode->i_state & I_DIRTY) &&
(wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages))
inode->dirtied_when = jiffies;
if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
/*
* We didn't write back all the pages. nfs_writepages()
* sometimes bales out without doing anything.
*/
inode->i_state |= I_DIRTY_PAGES;
if (wbc->nr_to_write <= 0) {
/*
* slice used up: queue for next turn
*/
requeue_io(inode, wb);
} else {
/*
* Writeback blocked by something other than
* congestion. Delay the inode for some time to
* avoid spinning on the CPU (100% iowait)
* retrying writeback of the dirty page/inode
* that cannot be performed immediately.
*/
redirty_tail(inode, wb);
}
} else if (inode->i_state & I_DIRTY) {
/*
* Filesystems can dirty the inode during writeback
* operations, such as delayed allocation during
* submission or metadata updates after data IO
* completion.
*/
redirty_tail(inode, wb);
} else {
/*
* The inode is clean. At this point we either have
* a reference to the inode or it's on it's way out.
* No need to add it back to the LRU.
*/
list_del_init(&inode->i_wb_list);
}
}
inode_sync_complete(inode);
trace_writeback_single_inode(inode, wbc, nr_to_write);
return ret;
}
static long writeback_chunk_size(struct backing_dev_info *bdi,
struct wb_writeback_work *work)
{
long pages;
/*
* WB_SYNC_ALL mode does livelock avoidance by syncing dirty
* inodes/pages in one big loop. Setting wbc.nr_to_write=LONG_MAX
* here avoids calling into writeback_inodes_wb() more than once.
*
* The intended call sequence for WB_SYNC_ALL writeback is:
*
* wb_writeback()
* writeback_sb_inodes() <== called only once
* write_cache_pages() <== called once for each inode
* (quickly) tag currently dirty pages
* (maybe slowly) sync all tagged pages
*/
if (work->sync_mode == WB_SYNC_ALL || work->tagged_writepages)
pages = LONG_MAX;
else {
pages = min(bdi->avg_write_bandwidth / 2,
global_dirty_limit / DIRTY_SCOPE);
pages = min(pages, work->nr_pages);
pages = round_down(pages + MIN_WRITEBACK_PAGES,
MIN_WRITEBACK_PAGES);
}
return pages;
}
/*
* Write a portion of b_io inodes which belong to @sb.
*
* If @only_this_sb is true, then find and write all such
* inodes. Otherwise write only ones which go sequentially
* in reverse order.
*
* Return the number of pages and/or inodes written.
*/
static long writeback_sb_inodes(struct super_block *sb,
struct bdi_writeback *wb,
struct wb_writeback_work *work)
{
struct writeback_control wbc = {
.sync_mode = work->sync_mode,
.tagged_writepages = work->tagged_writepages,
.for_kupdate = work->for_kupdate,
.for_background = work->for_background,
.range_cyclic = work->range_cyclic,
.range_start = 0,
.range_end = LLONG_MAX,
};
unsigned long start_time = jiffies;
long write_chunk;
long wrote = 0; /* count both pages and inodes */
while (!list_empty(&wb->b_io)) {
struct inode *inode = wb_inode(wb->b_io.prev);
if (inode->i_sb != sb) {
if (work->sb) {
/*
* We only want to write back data for this
* superblock, move all inodes not belonging
* to it back onto the dirty list.
*/
redirty_tail(inode, wb);
continue;
}
/*
* The inode belongs to a different superblock.
* Bounce back to the caller to unpin this and
* pin the next superblock.
*/
break;
}
/*
* Don't bother with new inodes or inodes beeing freed, first
* kind does not need peridic writeout yet, and for the latter
* kind writeout is handled by the freer.
*/
spin_lock(&inode->i_lock);
if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) {
spin_unlock(&inode->i_lock);
redirty_tail(inode, wb);
continue;
}
__iget(inode);
write_chunk = writeback_chunk_size(wb->bdi, work);
wbc.nr_to_write = write_chunk;
wbc.pages_skipped = 0;
writeback_single_inode(inode, wb, &wbc);
work->nr_pages -= write_chunk - wbc.nr_to_write;
wrote += write_chunk - wbc.nr_to_write;
if (!(inode->i_state & I_DIRTY))
wrote++;
if (wbc.pages_skipped) {
/*
* writeback is not making progress due to locked
* buffers. Skip this inode for now.
*/
redirty_tail(inode, wb);
}
spin_unlock(&inode->i_lock);
spin_unlock(&wb->list_lock);
iput(inode);
cond_resched();
spin_lock(&wb->list_lock);
/*
* bail out to wb_writeback() often enough to check
* background threshold and other termination conditions.
*/
if (wrote) {
if (time_is_before_jiffies(start_time + HZ / 10UL))
break;
if (work->nr_pages <= 0)
break;
}
}
return wrote;
}
static long __writeback_inodes_wb(struct bdi_writeback *wb,
struct wb_writeback_work *work)
{
unsigned long start_time = jiffies;
long wrote = 0;
while (!list_empty(&wb->b_io)) {
struct inode *inode = wb_inode(wb->b_io.prev);
struct super_block *sb = inode->i_sb;
if (!grab_super_passive(sb)) {
/*
* grab_super_passive() may fail consistently due to
* s_umount being grabbed by someone else. Don't use
* requeue_io() to avoid busy retrying the inode/sb.
*/
redirty_tail(inode, wb);
continue;
}
wrote += writeback_sb_inodes(sb, wb, work);
drop_super(sb);
/* refer to the same tests at the end of writeback_sb_inodes */
if (wrote) {
if (time_is_before_jiffies(start_time + HZ / 10UL))
break;
if (work->nr_pages <= 0)
break;
}
}
/* Leave any unwritten inodes on b_io */
return wrote;
}
long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
enum wb_reason reason)
{
struct wb_writeback_work work = {
.nr_pages = nr_pages,
.sync_mode = WB_SYNC_NONE,
.range_cyclic = 1,
.reason = reason,
};
spin_lock(&wb->list_lock);
if (list_empty(&wb->b_io))
queue_io(wb, &work);
__writeback_inodes_wb(wb, &work);
spin_unlock(&wb->list_lock);
return nr_pages - work.nr_pages;
}
static bool over_bground_thresh(struct backing_dev_info *bdi)
{
unsigned long background_thresh, dirty_thresh;
global_dirty_limits(&background_thresh, &dirty_thresh);
if (global_page_state(NR_FILE_DIRTY) +
global_page_state(NR_UNSTABLE_NFS) > background_thresh)
return true;
if (bdi_stat(bdi, BDI_RECLAIMABLE) >
bdi_dirty_limit(bdi, background_thresh))
return true;
return false;
}
/*
* Called under wb->list_lock. If there are multiple wb per bdi,
* only the flusher working on the first wb should do it.
*/
static void wb_update_bandwidth(struct bdi_writeback *wb,
unsigned long start_time)
{
__bdi_update_bandwidth(wb->bdi, 0, 0, 0, 0, 0, start_time);
}
/*
* Explicit flushing or periodic writeback of "old" data.
*
* Define "old": the first time one of an inode's pages is dirtied, we mark the
* dirtying-time in the inode's address_space. So this periodic writeback code
* just walks the superblock inode list, writing back any inodes which are
* older than a specific point in time.
*
* Try to run once per dirty_writeback_interval. But if a writeback event
* takes longer than a dirty_writeback_interval interval, then leave a
* one-second gap.
*
* older_than_this takes precedence over nr_to_write. So we'll only write back
* all dirty pages if they are all attached to "old" mappings.
*/
static long wb_writeback(struct bdi_writeback *wb,
struct wb_writeback_work *work)
{
unsigned long wb_start = jiffies;
long nr_pages = work->nr_pages;
unsigned long oldest_jif;
struct inode *inode;
long progress;
oldest_jif = jiffies;
work->older_than_this = &oldest_jif;
spin_lock(&wb->list_lock);
for (;;) {
/*
* Stop writeback when nr_pages has been consumed
*/
if (work->nr_pages <= 0)
break;
/*
* Background writeout and kupdate-style writeback may
* run forever. Stop them if there is other work to do
* so that e.g. sync can proceed. They'll be restarted
* after the other works are all done.
*/
if ((work->for_background || work->for_kupdate) &&
!list_empty(&wb->bdi->work_list))
break;
/*
* For background writeout, stop when we are below the
* background dirty threshold
*/
if (work->for_background && !over_bground_thresh(wb->bdi))
break;
if (work->for_kupdate) {
oldest_jif = jiffies -
msecs_to_jiffies(dirty_expire_interval * 10);
work->older_than_this = &oldest_jif;
}
trace_writeback_start(wb->bdi, work);
if (list_empty(&wb->b_io))
queue_io(wb, work);
if (work->sb)
progress = writeback_sb_inodes(work->sb, wb, work);
else
progress = __writeback_inodes_wb(wb, work);
trace_writeback_written(wb->bdi, work);
wb_update_bandwidth(wb, wb_start);
/*
* Did we write something? Try for more
*
* Dirty inodes are moved to b_io for writeback in batches.
* The completion of the current batch does not necessarily
* mean the overall work is done. So we keep looping as long
* as made some progress on cleaning pages or inodes.
*/
if (progress)
continue;
/*
* No more inodes for IO, bail
*/
if (list_empty(&wb->b_more_io))
break;
/*
* Nothing written. Wait for some inode to
* become available for writeback. Otherwise
* we'll just busyloop.
*/
if (!list_empty(&wb->b_more_io)) {
trace_writeback_wait(wb->bdi, work);
inode = wb_inode(wb->b_more_io.prev);
spin_lock(&inode->i_lock);
inode_wait_for_writeback(inode, wb);
spin_unlock(&inode->i_lock);
}
}
spin_unlock(&wb->list_lock);
return nr_pages - work->nr_pages;
}
/*
* Return the next wb_writeback_work struct that hasn't been processed yet.
*/
static struct wb_writeback_work *
get_next_work_item(struct backing_dev_info *bdi)
{
struct wb_writeback_work *work = NULL;
spin_lock_bh(&bdi->wb_lock);
if (!list_empty(&bdi->work_list)) {
work = list_entry(bdi->work_list.next,
struct wb_writeback_work, list);
list_del_init(&work->list);
}
spin_unlock_bh(&bdi->wb_lock);
return work;
}
/*
* Add in the number of potentially dirty inodes, because each inode
* write can dirty pagecache in the underlying blockdev.
*/
static unsigned long get_nr_dirty_pages(void)
{
return global_page_state(NR_FILE_DIRTY) +
global_page_state(NR_UNSTABLE_NFS) +
get_nr_dirty_inodes();
}
static long wb_check_background_flush(struct bdi_writeback *wb)
{
if (over_bground_thresh(wb->bdi)) {
struct wb_writeback_work work = {
.nr_pages = LONG_MAX,
.sync_mode = WB_SYNC_NONE,
.for_background = 1,
.range_cyclic = 1,
.reason = WB_REASON_BACKGROUND,
};
return wb_writeback(wb, &work);
}
return 0;
}
static long wb_check_old_data_flush(struct bdi_writeback *wb)
{
unsigned long expired;
long nr_pages;
/*
* When set to zero, disable periodic writeback
*/
if (!dirty_writeback_interval)
return 0;
expired = wb->last_old_flush +
msecs_to_jiffies(dirty_writeback_interval * 10);
if (time_before(jiffies, expired))
return 0;
wb->last_old_flush = jiffies;
nr_pages = get_nr_dirty_pages();
if (nr_pages) {
struct wb_writeback_work work = {
.nr_pages = nr_pages,
.sync_mode = WB_SYNC_NONE,
.for_kupdate = 1,
.range_cyclic = 1,
.reason = WB_REASON_PERIODIC,
};
return wb_writeback(wb, &work);
}
return 0;
}
/*
* Retrieve work items and do the writeback they describe
*/
long wb_do_writeback(struct bdi_writeback *wb, int force_wait)
{
struct backing_dev_info *bdi = wb->bdi;
struct wb_writeback_work *work;
long wrote = 0;
set_bit(BDI_writeback_running, &wb->bdi->state);
while ((work = get_next_work_item(bdi)) != NULL) {
/*
* Override sync mode, in case we must wait for completion
* because this thread is exiting now.
*/
if (force_wait)
work->sync_mode = WB_SYNC_ALL;
trace_writeback_exec(bdi, work);
wrote += wb_writeback(wb, work);
/*
* Notify the caller of completion if this is a synchronous
* work item, otherwise just free it.
*/
if (work->done)
complete(work->done);
else
kfree(work);
}
/*
* Check for periodic writeback, kupdated() style
*/
wrote += wb_check_old_data_flush(wb);
wrote += wb_check_background_flush(wb);
clear_bit(BDI_writeback_running, &wb->bdi->state);
return wrote;
}
/*
* Handle writeback of dirty data for the device backed by this bdi. Also
* wakes up periodically and does kupdated style flushing.
*/
int bdi_writeback_thread(void *data)
{
struct bdi_writeback *wb = data;
struct backing_dev_info *bdi = wb->bdi;
long pages_written;
current->flags |= PF_SWAPWRITE;
set_freezable();
wb->last_active = jiffies;
/*
* Our parent may run at a different priority, just set us to normal
*/
set_user_nice(current, 0);
trace_writeback_thread_start(bdi);
while (!kthread_should_stop()) {
/*
* Remove own delayed wake-up timer, since we are already awake
* and we'll take care of the preriodic write-back.
*/
del_timer(&wb->wakeup_timer);
pages_written = wb_do_writeback(wb, 0);
trace_writeback_pages_written(pages_written);
if (pages_written)
wb->last_active = jiffies;
set_current_state(TASK_INTERRUPTIBLE);
if (!list_empty(&bdi->work_list) || kthread_should_stop()) {
__set_current_state(TASK_RUNNING);
continue;
}
if (wb_has_dirty_io(wb) && dirty_writeback_interval)
schedule_timeout(msecs_to_jiffies(dirty_writeback_interval * 10));
else {
/*
* We have nothing to do, so can go sleep without any
* timeout and save power. When a work is queued or
* something is made dirty - we will be woken up.
*/
schedule();
}
try_to_freeze();
}
/* Flush any work that raced with us exiting */
if (!list_empty(&bdi->work_list))
wb_do_writeback(wb, 1);
trace_writeback_thread_stop(bdi);
return 0;
}
/*
* Start writeback of `nr_pages' pages. If `nr_pages' is zero, write back
* the whole world.
*/
void wakeup_flusher_threads(long nr_pages, enum wb_reason reason)
{
struct backing_dev_info *bdi;
if (!nr_pages) {
nr_pages = global_page_state(NR_FILE_DIRTY) +
global_page_state(NR_UNSTABLE_NFS);
}
rcu_read_lock();
list_for_each_entry_rcu(bdi, &bdi_list, bdi_list) {
if (!bdi_has_dirty_io(bdi))
continue;
__bdi_start_writeback(bdi, nr_pages, false, reason);
}
rcu_read_unlock();
}
static noinline void block_dump___mark_inode_dirty(struct inode *inode)
{
if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev")) {
struct dentry *dentry;
const char *name = "?";
dentry = d_find_alias(inode);
if (dentry) {
spin_lock(&dentry->d_lock);
name = (const char *) dentry->d_name.name;
}
printk(KERN_DEBUG
"%s(%d): dirtied inode %lu (%s) on %s\n",
current->comm, task_pid_nr(current), inode->i_ino,
name, inode->i_sb->s_id);
if (dentry) {
spin_unlock(&dentry->d_lock);
dput(dentry);
}
}
}
/**
* __mark_inode_dirty - internal function
* @inode: inode to mark
* @flags: what kind of dirty (i.e. I_DIRTY_SYNC)
* Mark an inode as dirty. Callers should use mark_inode_dirty or
* mark_inode_dirty_sync.
*
* Put the inode on the super block's dirty list.
*
* CAREFUL! We mark it dirty unconditionally, but move it onto the
* dirty list only if it is hashed or if it refers to a blockdev.
* If it was not hashed, it will never be added to the dirty list
* even if it is later hashed, as it will have been marked dirty already.
*
* In short, make sure you hash any inodes _before_ you start marking
* them dirty.
*
* Note that for blockdevs, inode->dirtied_when represents the dirtying time of
* the block-special inode (/dev/hda1) itself. And the ->dirtied_when field of
* the kernel-internal blockdev inode represents the dirtying time of the
* blockdev's pages. This is why for I_DIRTY_PAGES we always use
* page->mapping->host, so the page-dirtying time is recorded in the internal
* blockdev inode.
*/
void __mark_inode_dirty(struct inode *inode, int flags)
{
struct super_block *sb = inode->i_sb;
struct backing_dev_info *bdi = NULL;
/*
* Don't do this for I_DIRTY_PAGES - that doesn't actually
* dirty the inode itself
*/
if (flags & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) {
if (sb->s_op->dirty_inode)
sb->s_op->dirty_inode(inode, flags);
}
/*
* make sure that changes are seen by all cpus before we test i_state
* -- mikulas
*/
smp_mb();
/* avoid the locking if we can */
if ((inode->i_state & flags) == flags)
return;
trace_dirty_inode(inode, current);
if (unlikely(block_dump))
block_dump___mark_inode_dirty(inode);
spin_lock(&inode->i_lock);
if ((inode->i_state & flags) != flags) {
const int was_dirty = inode->i_state & I_DIRTY;
inode->i_state |= flags;
/*
* If the inode is being synced, just update its dirty state.
* The unlocker will place the inode on the appropriate
* superblock list, based upon its state.
*/
if (inode->i_state & I_SYNC)
goto out_unlock_inode;
/*
* Only add valid (hashed) inodes to the superblock's
* dirty list. Add blockdev inodes as well.
*/
if (!S_ISBLK(inode->i_mode)) {
if (inode_unhashed(inode))
goto out_unlock_inode;
}
if (inode->i_state & I_FREEING)
goto out_unlock_inode;
/*
* If the inode was already on b_dirty/b_io/b_more_io, don't
* reposition it (that would break b_dirty time-ordering).
*/
if (!was_dirty) {
bool wakeup_bdi = false;
bdi = inode_to_bdi(inode);
if (bdi_cap_writeback_dirty(bdi)) {
WARN(!test_bit(BDI_registered, &bdi->state),
"bdi-%s not registered\n", bdi->name);
/*
* If this is the first dirty inode for this
* bdi, we have to wake-up the corresponding
* bdi thread to make sure background
* write-back happens later.
*/
if (!wb_has_dirty_io(&bdi->wb))
wakeup_bdi = true;
}
spin_unlock(&inode->i_lock);
spin_lock(&bdi->wb.list_lock);
inode->dirtied_when = jiffies;
list_move(&inode->i_wb_list, &bdi->wb.b_dirty);
spin_unlock(&bdi->wb.list_lock);
if (wakeup_bdi)
bdi_wakeup_thread_delayed(bdi);
return;
}
}
out_unlock_inode:
spin_unlock(&inode->i_lock);
}
EXPORT_SYMBOL(__mark_inode_dirty);
/*
* Write out a superblock's list of dirty inodes. A wait will be performed
* upon no inodes, all inodes or the final one, depending upon sync_mode.
*
* If older_than_this is non-NULL, then only write out inodes which
* had their first dirtying at a time earlier than *older_than_this.
*
* If `bdi' is non-zero then we're being asked to writeback a specific queue.
* This function assumes that the blockdev superblock's inodes are backed by
* a variety of queues, so all inodes are searched. For other superblocks,
* assume that all inodes are backed by the same queue.
*
* The inodes to be written are parked on bdi->b_io. They are moved back onto
* bdi->b_dirty as they are selected for writing. This way, none can be missed
* on the writer throttling path, and we get decent balancing between many
* throttled threads: we don't want them all piling up on inode_sync_wait.
*/
static void wait_sb_inodes(struct super_block *sb)
{
struct inode *inode, *old_inode = NULL;
/*
* We need to be protected against the filesystem going from
* r/o to r/w or vice versa.
*/
WARN_ON(!rwsem_is_locked(&sb->s_umount));
spin_lock(&inode_sb_list_lock);
/*
* Data integrity sync. Must wait for all pages under writeback,
* because there may have been pages dirtied before our sync
* call, but which had writeout started before we write it out.
* In which case, the inode may not be on the dirty list, but
* we still have to wait for that writeout.
*/
list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
struct address_space *mapping = inode->i_mapping;
spin_lock(&inode->i_lock);
if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) ||
(mapping->nrpages == 0)) {
spin_unlock(&inode->i_lock);
continue;
}
__iget(inode);
spin_unlock(&inode->i_lock);
spin_unlock(&inode_sb_list_lock);
/*
* We hold a reference to 'inode' so it couldn't have been
* removed from s_inodes list while we dropped the
* inode_sb_list_lock. We cannot iput the inode now as we can
* be holding the last reference and we cannot iput it under
* inode_sb_list_lock. So we keep the reference and iput it
* later.
*/
iput(old_inode);
old_inode = inode;
filemap_fdatawait(mapping);
cond_resched();
spin_lock(&inode_sb_list_lock);
}
spin_unlock(&inode_sb_list_lock);
iput(old_inode);
}
/**
* writeback_inodes_sb_nr - writeback dirty inodes from given super_block
* @sb: the superblock
* @nr: the number of pages to write
* @reason: reason why some writeback work initiated
*
* Start writeback on some inodes on this super_block. No guarantees are made
* on how many (if any) will be written, and this function does not wait
* for IO completion of submitted IO.
*/
void writeback_inodes_sb_nr(struct super_block *sb,
unsigned long nr,
enum wb_reason reason)
{
DECLARE_COMPLETION_ONSTACK(done);
struct wb_writeback_work work = {
.sb = sb,
.sync_mode = WB_SYNC_NONE,
.tagged_writepages = 1,
.done = &done,
.nr_pages = nr,
.reason = reason,
};
WARN_ON(!rwsem_is_locked(&sb->s_umount));
bdi_queue_work(sb->s_bdi, &work);
wait_for_completion(&done);
}
EXPORT_SYMBOL(writeback_inodes_sb_nr);
/**
* writeback_inodes_sb - writeback dirty inodes from given super_block
* @sb: the superblock
* @reason: reason why some writeback work was initiated
*
* Start writeback on some inodes on this super_block. No guarantees are made
* on how many (if any) will be written, and this function does not wait
* for IO completion of submitted IO.
*/
void writeback_inodes_sb(struct super_block *sb, enum wb_reason reason)
{
return writeback_inodes_sb_nr(sb, get_nr_dirty_pages(), reason);
}
EXPORT_SYMBOL(writeback_inodes_sb);
/**
* writeback_inodes_sb_if_idle - start writeback if none underway
* @sb: the superblock
* @reason: reason why some writeback work was initiated
*
* Invoke writeback_inodes_sb if no writeback is currently underway.
* Returns 1 if writeback was started, 0 if not.
*/
int writeback_inodes_sb_if_idle(struct super_block *sb, enum wb_reason reason)
{
if (!writeback_in_progress(sb->s_bdi)) {
down_read(&sb->s_umount);
writeback_inodes_sb(sb, reason);
up_read(&sb->s_umount);
return 1;
} else
return 0;
}
EXPORT_SYMBOL(writeback_inodes_sb_if_idle);
/**
* writeback_inodes_sb_if_idle - start writeback if none underway
* @sb: the superblock
* @nr: the number of pages to write
* @reason: reason why some writeback work was initiated
*
* Invoke writeback_inodes_sb if no writeback is currently underway.
* Returns 1 if writeback was started, 0 if not.
*/
int writeback_inodes_sb_nr_if_idle(struct super_block *sb,
unsigned long nr,
enum wb_reason reason)
{
if (!writeback_in_progress(sb->s_bdi)) {
down_read(&sb->s_umount);
writeback_inodes_sb_nr(sb, nr, reason);
up_read(&sb->s_umount);
return 1;
} else
return 0;
}
EXPORT_SYMBOL(writeback_inodes_sb_nr_if_idle);
/**
* sync_inodes_sb - sync sb inode pages
* @sb: the superblock
*
* This function writes and waits on any dirty inode belonging to this
* super_block.
*/
void sync_inodes_sb(struct super_block *sb)
{
DECLARE_COMPLETION_ONSTACK(done);
struct wb_writeback_work work = {
.sb = sb,
.sync_mode = WB_SYNC_ALL,
.nr_pages = LONG_MAX,
.range_cyclic = 0,
.done = &done,
.reason = WB_REASON_SYNC,
};
WARN_ON(!rwsem_is_locked(&sb->s_umount));
bdi_queue_work(sb->s_bdi, &work);
wait_for_completion(&done);
wait_sb_inodes(sb);
}
EXPORT_SYMBOL(sync_inodes_sb);
/**
* write_inode_now - write an inode to disk
* @inode: inode to write to disk
* @sync: whether the write should be synchronous or not
*
* This function commits an inode to disk immediately if it is dirty. This is
* primarily needed by knfsd.
*
* The caller must either have a ref on the inode or must have set I_WILL_FREE.
*/
int write_inode_now(struct inode *inode, int sync)
{
struct bdi_writeback *wb = &inode_to_bdi(inode)->wb;
int ret;
struct writeback_control wbc = {
.nr_to_write = LONG_MAX,
.sync_mode = sync ? WB_SYNC_ALL : WB_SYNC_NONE,
.range_start = 0,
.range_end = LLONG_MAX,
};
if (!mapping_cap_writeback_dirty(inode->i_mapping))
wbc.nr_to_write = 0;
might_sleep();
spin_lock(&wb->list_lock);
spin_lock(&inode->i_lock);
ret = writeback_single_inode(inode, wb, &wbc);
spin_unlock(&inode->i_lock);
spin_unlock(&wb->list_lock);
if (sync)
inode_sync_wait(inode);
return ret;
}
EXPORT_SYMBOL(write_inode_now);
/**
* sync_inode - write an inode and its pages to disk.
* @inode: the inode to sync
* @wbc: controls the writeback mode
*
* sync_inode() will write an inode and its pages to disk. It will also
* correctly update the inode on its superblock's dirty inode lists and will
* update inode->i_state.
*
* The caller must have a ref on the inode.
*/
int sync_inode(struct inode *inode, struct writeback_control *wbc)
{
struct bdi_writeback *wb = &inode_to_bdi(inode)->wb;
int ret;
spin_lock(&wb->list_lock);
spin_lock(&inode->i_lock);
ret = writeback_single_inode(inode, wb, wbc);
spin_unlock(&inode->i_lock);
spin_unlock(&wb->list_lock);
return ret;
}
EXPORT_SYMBOL(sync_inode);
/**
* sync_inode_metadata - write an inode to disk
* @inode: the inode to sync
* @wait: wait for I/O to complete.
*
* Write an inode to disk and adjust its dirty state after completion.
*
* Note: only writes the actual inode, no associated data or other metadata.
*/
int sync_inode_metadata(struct inode *inode, int wait)
{
struct writeback_control wbc = {
.sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_NONE,
.nr_to_write = 0, /* metadata-only */
};
return sync_inode(inode, &wbc);
}
EXPORT_SYMBOL(sync_inode_metadata);
| xplodwild/packaged-linux-linaro-3.2-ci | fs/fs-writeback.c | C | gpl-2.0 | 38,100 |
/*
* Copyright (C) 2011-2012 ArkCORE2 <http://www.arkania.net/>
* Copyright (C) 2010-2012 Project SkyFire <http://www.projectskyfire.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptPCH.h"
#include "ScriptedEscortAI.h"
#include "violet_hold.h"
#define GOSSIP_START_EVENT "Get your people to safety, we'll keep the Blue Dragonflight's forces at bay."
#define GOSSIP_ITEM_1 "Activate the crystals when we get in trouble, right"
#define GOSSIP_I_WANT_IN "I'm not fighting, so send me in now!"
#define SPAWN_TIME 20000
enum PortalCreatures
{
CREATURE_AZURE_INVADER_1 = 30661,
CREATURE_AZURE_INVADER_2 = 30961,
CREATURE_AZURE_SPELLBREAKER_1 = 30662,
CREATURE_AZURE_SPELLBREAKER_2 = 30962,
CREATURE_AZURE_BINDER_1 = 30663,
CREATURE_AZURE_BINDER_2 = 30918,
CREATURE_AZURE_MAGE_SLAYER_1 = 30664,
CREATURE_AZURE_MAGE_SLAYER_2 = 30963,
CREATURE_AZURE_CAPTAIN = 30666,
CREATURE_AZURE_SORCEROR = 30667,
CREATURE_AZURE_RAIDER = 30668,
CREATURE_AZURE_STALKER = 32191
};
enum AzureInvaderSpells
{
SPELL_CLEAVE = 15496,
SPELL_IMPALE = 58459,
H_SPELL_IMPALE = 59256,
SPELL_BRUTAL_STRIKE = 58460,
SPELL_SUNDER_ARMOR = 58461
};
enum AzureSellbreakerSpells
{
SPELL_ARCANE_BLAST = 58462,
H_SPELL_ARCANE_BLAST = 59257,
SPELL_SLOW = 25603,
SPELL_CHAINS_OF_ICE = 58464,
SPELL_CONE_OF_COLD = 58463,
H_SPELL_CONE_OF_COLD = 59258
};
enum AzureBinderSpells
{
SPELL_ARCANE_BARRAGE = 58456,
H_SPELL_ARCANE_BARRAGE = 59248,
SPELL_ARCANE_EXPLOSION = 58455,
H_SPELL_ARCANE_EXPLOSION = 59245,
SPELL_FROST_NOVA = 58458,
H_SPELL_FROST_NOVA = 59253,
SPELL_FROSTBOLT = 58457,
H_SPELL_FROSTBOLT = 59251,
};
enum AzureMageSlayerSpells
{
SPELL_ARCANE_EMPOWERMENT = 58469,
SPELL_SPELL_LOCK = 30849
};
enum AzureCaptainSpells
{
SPELL_MORTAL_STRIKE = 32736,
SPELL_WHIRLWIND_OF_STEEL = 41057
};
enum AzureSorcerorSpells
{
SPELL_ARCANE_STREAM = 60181,
H_SPELL_ARCANE_STREAM = 60204,
SPELL_MANA_DETONATION = 60182,
H_SPELL_MANA_DETONATION = 60205
};
enum AzureRaiderSpells
{
SPELL_CONCUSSION_BLOW = 52719,
SPELL_MAGIC_REFLECTION = 60158
};
enum AzureStalkerSpells
{
SPELL_BACKSTAB = 58471,
SPELL_TACTICAL_BLINK = 58470
};
enum AzureSaboteurSpells
{
SABOTEUR_SHIELD_DISRUPTION = 58291,
SABOTEUR_SHIELD_EFFECT = 45775
};
enum TrashDoorSpell
{
SPELL_DESTROY_DOOR_SEAL = 58040
};
enum Spells
{
SPELL_PORTAL_CHANNEL = 58012,
SPELL_CRYSTALL_ACTIVATION = 57804
};
enum eSinclari
{
SAY_SINCLARI_1 = -1608045
};
float FirstPortalWPs [6][3] =
{
{1877.670288f, 842.280273f, 43.333591f},
{1877.338867f, 834.615356f, 38.762287f},
{1872.161011f, 823.854309f, 38.645401f},
{1864.860474f, 815.787170f, 38.784843f},
{1858.953735f, 810.048950f, 44.008759f},
{1843.707153f, 805.807739f, 44.135197f}
//{1825.736084f, 807.305847f, 44.363785f}
};
float SecondPortalFirstWPs [9][3] =
{
{1902.561401f, 853.334656f, 47.106117f},
{1895.486084f, 855.376404f, 44.334591f},
{1882.805176f, 854.993286f, 43.333591f},
{1877.670288f, 842.280273f, 43.333591f},
{1877.338867f, 834.615356f, 38.762287f},
{1872.161011f, 823.854309f, 38.645401f},
{1864.860474f, 815.787170f, 38.784843f},
{1858.953735f, 810.048950f, 44.008759f},
{1843.707153f, 805.807739f, 44.135197f}
//{1825.736084f, 807.305847f, 44.363785f}
};
float SecondPortalSecondWPs [8][3] =
{
{1929.392212f, 837.614990f, 47.136166f},
{1928.290649f, 824.750427f, 45.474411f},
{1915.544922f, 826.919373f, 38.642811f},
{1900.933960f, 818.855652f, 38.801647f},
{1886.810547f, 813.536621f, 38.490490f},
{1869.079712f, 808.701538f, 38.689003f},
{1860.843384f, 806.645020f, 44.008789f},
{1843.707153f, 805.807739f, 44.135197f}
//{1825.736084f, 807.305847f, 44.363785f}
};
float ThirdPortalWPs [8][3] =
{
{1934.049438f, 815.778503f, 52.408699f},
{1928.290649f, 824.750427f, 45.474411f},
{1915.544922f, 826.919373f, 38.642811f},
{1900.933960f, 818.855652f, 38.801647f},
{1886.810547f, 813.536621f, 38.490490f},
{1869.079712f, 808.701538f, 38.689003f},
{1860.843384f, 806.645020f, 44.008789f},
{1843.707153f, 805.807739f, 44.135197f}
//{1825.736084f, 807.305847f, 44.363785f}
};
float FourthPortalWPs [9][3] =
{
{1921.658447f, 761.657043f, 50.866741f},
{1910.559814f, 755.780457f, 47.701447f},
{1896.664673f, 752.920898f, 47.667004f},
{1887.398804f, 763.633240f, 47.666851f},
{1879.020386f, 775.396973f, 38.705990f},
{1872.439087f, 782.568604f, 38.808292f},
{1863.573364f, 791.173584f, 38.743660f},
{1857.811890f, 796.765564f, 43.950329f},
{1845.577759f, 800.681152f, 44.104248f}
//{1827.100342f, 801.605957f, 44.363358f}
};
float FifthPortalWPs [6][3] =
{
{1887.398804f, 763.633240f, 47.666851f},
{1879.020386f, 775.396973f, 38.705990f},
{1872.439087f, 782.568604f, 38.808292f},
{1863.573364f, 791.173584f, 38.743660f},
{1857.811890f, 796.765564f, 43.950329f},
{1845.577759f, 800.681152f, 44.104248f}
//{1827.100342f, 801.605957f, 44.363358f}
};
float SixthPoralWPs [4][3] =
{
{1888.861084f, 805.074768f, 38.375790f},
{1869.793823f, 804.135804f, 38.647018f},
{1861.541504f, 804.149780f, 43.968292f},
{1843.567017f, 804.288208f, 44.139091f}
//{1826.889648f, 803.929993f, 44.363239f}
};
const float SaboteurFinalPos1[3][3] =
{
{1892.502319f, 777.410767f, 38.630402f},
{1891.165161f, 762.969421f, 47.666920f},
{1893.168091f, 740.919189f, 47.666920f}
};
const float SaboteurFinalPos2[3][3] =
{
{1882.242676f, 834.818726f, 38.646786f},
{1879.220825f, 842.224854f, 43.333641f},
{1873.842896f, 863.892456f, 43.333641f}
};
const float SaboteurFinalPos3[2][3] =
{
{1904.298340f, 792.400391f, 38.646782f},
{1935.716919f, 758.437073f, 30.627895f}
};
const float SaboteurFinalPos4[3] =
{
1855.006104f, 760.641724f, 38.655266f
};
const float SaboteurFinalPos5[3] =
{
1906.667358f, 841.705566f, 38.637894f
};
const float SaboteurFinalPos6[5][3] =
{
{1911.437012f, 821.289246f, 38.684128f},
{1920.734009f, 822.978027f, 41.525414f},
{1928.262939f, 830.836609f, 44.668266f},
{1929.338989f, 837.593933f, 47.137596f},
{1931.063354f, 848.468445f, 47.190434f}
};
const Position MovePosition = {1806.955566f, 803.851807f, 44.363323f, 0.0f};
const Position playerTeleportPosition = {1830.531006f, 803.939758f, 44.340508f, 6.281611f};
const Position sinclariOutsidePosition = {1817.315674f, 804.060608f, 44.363998f, 0.0f};
class npc_sinclari_vh : public CreatureScript
{
public:
npc_sinclari_vh() : CreatureScript("npc_sinclari_vh") { }
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*Sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
switch (action)
{
case GOSSIP_ACTION_INFO_DEF+1:
player->CLOSE_GOSSIP_MENU();
CAST_AI(npc_sinclari_vh::npc_sinclariAI, (creature->AI()))->uiPhase = 1;
if (InstanceScript* instance = creature->GetInstanceScript())
instance->SetData(DATA_MAIN_EVENT_PHASE, SPECIAL);
break;
case GOSSIP_ACTION_INFO_DEF+2:
player->SEND_GOSSIP_MENU(13854, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
player->NearTeleportTo(playerTeleportPosition.GetPositionX(), playerTeleportPosition.GetPositionY(), playerTeleportPosition.GetPositionZ(), playerTeleportPosition.GetOrientation(), true);
player->CLOSE_GOSSIP_MENU();
break;
}
return true;
}
bool OnGossipHello(Player* player, Creature* creature)
{
if (InstanceScript* instance = creature->GetInstanceScript())
{
switch (instance->GetData(DATA_MAIN_EVENT_PHASE))
{
case NOT_STARTED:
case FAIL: // Allow to start event if not started or wiped
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->SEND_GOSSIP_MENU(13853, creature->GetGUID());
break;
case IN_PROGRESS: // Allow to teleport inside if event is in progress
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_I_WANT_IN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
player->SEND_GOSSIP_MENU(13853, creature->GetGUID());
break;
default:
player->SEND_GOSSIP_MENU(13910, creature->GetGUID());
}
}
return true;
}
CreatureAI* GetAI(Creature* creature) const
{
return new npc_sinclariAI(creature);
}
struct npc_sinclariAI : public ScriptedAI
{
npc_sinclariAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
}
InstanceScript* instance;
uint8 uiPhase;
uint32 uiTimer;
void Reset()
{
uiPhase = 0;
uiTimer = 0;
me->SetReactState(REACT_AGGRESSIVE);
std::list<Creature*> GuardList;
me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f);
if (!GuardList.empty())
{
for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr)
{
if (Creature* pGuard = *itr)
{
pGuard->DisappearAndDie();
pGuard->Respawn();
pGuard->SetVisible(true);
pGuard->SetReactState(REACT_AGGRESSIVE);
}
}
}
}
void UpdateAI(const uint32 uiDiff)
{
ScriptedAI::UpdateAI(uiDiff);
if (uiPhase)
{
if (uiTimer <= uiDiff)
{
switch (uiPhase)
{
case 1:
DoScriptText(SAY_SINCLARI_1, me);
uiTimer = 4000;
uiPhase = 2;
break;
case 2:
{
std::list<Creature*> GuardList;
me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f);
if (!GuardList.empty())
for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr)
{
if (Creature* pGuard = *itr)
{
pGuard->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
pGuard->GetMotionMaster()->MovePoint(0, MovePosition);
}
}
uiTimer = 6000;
uiPhase = 3;
break;
}
case 3:
{
std::list<Creature*> GuardList;
me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f);
if (!GuardList.empty())
for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr)
{
if (Creature* pGuard = *itr)
{
pGuard->SetVisible(false);
pGuard->SetReactState(REACT_PASSIVE);
}
}
uiTimer = 2000;
uiPhase = 4;
break;
}
case 4:
me->GetMotionMaster()->MovePoint(0, sinclariOutsidePosition);
uiTimer = 4000;
uiPhase = 5;
break;
case 5:
if (instance)
instance->SetData(DATA_MAIN_EVENT_PHASE, IN_PROGRESS);
me->SetReactState(REACT_PASSIVE);
uiTimer = 0;
uiPhase = 0;
break;
}
}
else uiTimer -= uiDiff;
}
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
}
};
};
class mob_azure_saboteur : public CreatureScript
{
public:
mob_azure_saboteur() : CreatureScript("mob_azure_saboteur") { }
CreatureAI* GetAI(Creature* creature) const
{
return new mob_azure_saboteurAI (creature);
}
struct mob_azure_saboteurAI : public npc_escortAI
{
mob_azure_saboteurAI(Creature* c):npc_escortAI(c)
{
instance = c->GetInstanceScript();
bHasGotMovingPoints = false;
uiBoss = 0;
Reset();
}
InstanceScript* instance;
bool bHasGotMovingPoints;
uint32 uiBoss;
void Reset()
{
if (instance && !uiBoss)
uiBoss = instance->GetData(DATA_WAVE_COUNT) == 6 ? instance->GetData(DATA_FIRST_BOSS) : instance->GetData(DATA_SECOND_BOSS);
me->SetReactState(REACT_PASSIVE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
void WaypointReached(uint32 uiWPointId)
{
switch (uiBoss)
{
case 1:
if (uiWPointId == 2)
FinishPointReached();
break;
case 2:
if (uiWPointId == 2)
FinishPointReached();
break;
case 3:
if (uiWPointId == 1)
FinishPointReached();
break;
case 4:
if (uiWPointId == 0)
FinishPointReached();
break;
case 5:
if (uiWPointId == 0)
FinishPointReached();
break;
case 6:
if (uiWPointId == 4)
FinishPointReached();
break;
}
}
void UpdateAI(const uint32 diff)
{
if (instance && instance->GetData(DATA_MAIN_EVENT_PHASE) != IN_PROGRESS)
me->CastStop();
npc_escortAI::UpdateAI(diff);
if (!bHasGotMovingPoints)
{
bHasGotMovingPoints = true;
switch (uiBoss)
{
case 1:
for (int i=0;i<3;i++)
AddWaypoint(i, SaboteurFinalPos1[i][0], SaboteurFinalPos1[i][1], SaboteurFinalPos1[i][2], 0);
me->SetHomePosition(SaboteurFinalPos1[2][0], SaboteurFinalPos1[2][1], SaboteurFinalPos1[2][2], 4.762346f);
break;
case 2:
for (int i=0;i<3;i++)
AddWaypoint(i, SaboteurFinalPos2[i][0], SaboteurFinalPos2[i][1], SaboteurFinalPos2[i][2], 0);
me->SetHomePosition(SaboteurFinalPos2[2][0], SaboteurFinalPos2[2][1], SaboteurFinalPos2[2][2], 1.862674f);
break;
case 3:
for (int i=0;i<2;i++)
AddWaypoint(i, SaboteurFinalPos3[i][0], SaboteurFinalPos3[i][1], SaboteurFinalPos3[i][2], 0);
me->SetHomePosition(SaboteurFinalPos3[1][0], SaboteurFinalPos3[1][1], SaboteurFinalPos3[1][2], 5.500638f);
break;
case 4:
AddWaypoint(0, SaboteurFinalPos4[0], SaboteurFinalPos4[1], SaboteurFinalPos4[2], 0);
me->SetHomePosition(SaboteurFinalPos4[0], SaboteurFinalPos4[1], SaboteurFinalPos4[2], 3.991108f);
break;
case 5:
AddWaypoint(0, SaboteurFinalPos5[0], SaboteurFinalPos5[1], SaboteurFinalPos5[2], 0);
me->SetHomePosition(SaboteurFinalPos5[0], SaboteurFinalPos5[1], SaboteurFinalPos5[2], 1.100841f);
break;
case 6:
for (int i=0;i<5;i++)
AddWaypoint(i, SaboteurFinalPos6[i][0], SaboteurFinalPos6[i][1], SaboteurFinalPos6[i][2], 0);
me->SetHomePosition(SaboteurFinalPos6[4][0], SaboteurFinalPos6[4][1], SaboteurFinalPos6[4][2], 0.983031f);
break;
}
SetDespawnAtEnd(false);
Start(true, true);
}
}
void FinishPointReached()
{
me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false);
me->DisappearAndDie();
Creature* pSaboPort = Unit::GetCreature((*me), instance->GetData64(DATA_SABOTEUR_PORTAL));
if (pSaboPort)
pSaboPort->DisappearAndDie();
instance->SetData(DATA_START_BOSS_ENCOUNTER, 1);
}
};
};
class npc_teleportation_portal_vh : public CreatureScript
{
public:
npc_teleportation_portal_vh() : CreatureScript("npc_teleportation_portal_vh") { }
CreatureAI* GetAI(Creature* creature) const
{
return new npc_teleportation_portalAI(creature);
}
struct npc_teleportation_portalAI : public ScriptedAI
{
npc_teleportation_portalAI(Creature* c) : ScriptedAI(c), listOfMobs(me)
{
instance = c->GetInstanceScript();
uiTypeOfMobsPortal = urand(0, 1); // 0 - elite mobs 1 - portal guardian or portal keeper with regular mobs
bPortalGuardianOrKeeperOrEliteSpawn = false;
}
uint32 uiSpawnTimer;
bool bPortalGuardianOrKeeperOrEliteSpawn;
uint8 uiTypeOfMobsPortal;
SummonList listOfMobs;
InstanceScript* instance;
void Reset()
{
uiSpawnTimer = 10000;
bPortalGuardianOrKeeperOrEliteSpawn = false;
}
void EnterCombat(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
void UpdateAI(const uint32 diff)
{
if (!instance) //Massive usage of instance, global check
return;
if (instance->GetData(DATA_REMOVE_NPC) == 1)
{
me->DespawnOrUnsummon();
instance->SetData(DATA_REMOVE_NPC, 0);
}
uint8 uiWaveCount = instance->GetData(DATA_WAVE_COUNT);
if ((uiWaveCount == 6) || (uiWaveCount == 12)) //Don't spawn mobs on boss encounters
return;
switch (uiTypeOfMobsPortal)
{
// spawn elite mobs and then set portals visibility to make it look like it dissapeard
case 0:
if (!bPortalGuardianOrKeeperOrEliteSpawn)
{
if (uiSpawnTimer <= diff)
{
bPortalGuardianOrKeeperOrEliteSpawn = true;
uint8 k = uiWaveCount < 12 ? 2 : 3;
for (uint8 i = 0; i < k; ++i)
{
uint32 entry = RAND(CREATURE_AZURE_CAPTAIN, CREATURE_AZURE_RAIDER, CREATURE_AZURE_STALKER, CREATURE_AZURE_SORCEROR);
DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN);
}
me->SetVisible(false);
} else uiSpawnTimer -= diff;
}
else
{
// if all spawned elites have died kill portal
if (listOfMobs.empty())
{
me->Kill(me, false);
me->RemoveCorpse();
}
}
break;
// spawn portal guardian or portal keeper with regular mobs
case 1:
if (uiSpawnTimer <= diff)
{
if (bPortalGuardianOrKeeperOrEliteSpawn)
{
uint8 k = instance->GetData(DATA_WAVE_COUNT) < 12 ? 3 : 4;
for (uint8 i = 0; i < k; ++i)
{
uint32 entry = RAND(CREATURE_AZURE_INVADER_1, CREATURE_AZURE_INVADER_2, CREATURE_AZURE_SPELLBREAKER_1, CREATURE_AZURE_SPELLBREAKER_2, CREATURE_AZURE_MAGE_SLAYER_1, CREATURE_AZURE_MAGE_SLAYER_2, CREATURE_AZURE_BINDER_1, CREATURE_AZURE_BINDER_2);
DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN);
}
}
else
{
bPortalGuardianOrKeeperOrEliteSpawn = true;
uint32 entry = RAND(CREATURE_PORTAL_GUARDIAN, CREATURE_PORTAL_KEEPER);
if (Creature* pPortalKeeper = DoSummon(entry, me, 2.0f, 0, TEMPSUMMON_DEAD_DESPAWN))
me->CastSpell(pPortalKeeper, SPELL_PORTAL_CHANNEL, false);
}
uiSpawnTimer = SPAWN_TIME;
} else uiSpawnTimer -= diff;
if (bPortalGuardianOrKeeperOrEliteSpawn && !me->IsNonMeleeSpellCasted(false))
{
me->Kill(me, false);
me->RemoveCorpse();
}
break;
}
}
void JustDied(Unit* /*killer*/)
{
if (instance)
instance->SetData(DATA_WAVE_COUNT, instance->GetData(DATA_WAVE_COUNT)+1);
}
void JustSummoned(Creature* summoned)
{
listOfMobs.Summon(summoned);
if (summoned)
instance->SetData64(DATA_ADD_TRASH_MOB, summoned->GetGUID());
}
void SummonedMobDied(Creature* summoned)
{
listOfMobs.Despawn(summoned);
if (summoned)
instance->SetData64(DATA_DEL_TRASH_MOB, summoned->GetGUID());
}
};
};
struct violet_hold_trashAI : public npc_escortAI
{
violet_hold_trashAI(Creature* c):npc_escortAI(c)
{
instance = c->GetInstanceScript();
bHasGotMovingPoints = false;
if (instance)
portalLocationID = instance->GetData(DATA_PORTAL_LOCATION);
Reset();
}
public:
InstanceScript* instance;
bool bHasGotMovingPoints;
uint32 portalLocationID;
uint32 secondPortalRouteID;
void WaypointReached(uint32 uiPointId)
{
switch (portalLocationID)
{
case 0:
if (uiPointId == 5)
CreatureStartAttackDoor();
break;
case 1:
if ((uiPointId == 8 && secondPortalRouteID == 0) || (uiPointId == 7 && secondPortalRouteID == 1))
CreatureStartAttackDoor();
break;
case 2:
if (uiPointId == 7)
CreatureStartAttackDoor();
break;
case 3:
if (uiPointId == 8)
CreatureStartAttackDoor();
break;
case 4:
if (uiPointId == 5)
CreatureStartAttackDoor();
break;
case 5:
if (uiPointId == 3)
CreatureStartAttackDoor();
break;
}
}
void UpdateAI(const uint32)
{
if (instance && instance->GetData(DATA_MAIN_EVENT_PHASE) != IN_PROGRESS)
me->CastStop();
if (!bHasGotMovingPoints)
{
bHasGotMovingPoints = true;
switch (portalLocationID)
{
case 0:
for (int i=0;i<6;i++)
AddWaypoint(i, FirstPortalWPs[i][0]+irand(-1, 1), FirstPortalWPs[i][1]+irand(-1, 1), FirstPortalWPs[i][2]+irand(-1, 1), 0);
me->SetHomePosition(FirstPortalWPs[5][0], FirstPortalWPs[5][1], FirstPortalWPs[5][2], 3.149439f);
break;
case 1:
secondPortalRouteID = urand(0, 1);
switch (secondPortalRouteID)
{
case 0:
for (int i=0;i<9;i++)
AddWaypoint(i, SecondPortalFirstWPs[i][0]+irand(-1, 1), SecondPortalFirstWPs[i][1]+irand(-1, 1), SecondPortalFirstWPs[i][2], 0);
me->SetHomePosition(SecondPortalFirstWPs[8][0]+irand(-1, 1), SecondPortalFirstWPs[8][1]+irand(-1, 1), SecondPortalFirstWPs[8][2]+irand(-1, 1), 3.149439f);
break;
case 1:
for (int i=0;i<8;i++)
AddWaypoint(i, SecondPortalSecondWPs[i][0]+irand(-1, 1), SecondPortalSecondWPs[i][1]+irand(-1, 1), SecondPortalSecondWPs[i][2], 0);
me->SetHomePosition(SecondPortalSecondWPs[7][0], SecondPortalSecondWPs[7][1], SecondPortalSecondWPs[7][2], 3.149439f);
break;
}
break;
case 2:
for (int i=0;i<8;i++)
AddWaypoint(i, ThirdPortalWPs[i][0]+irand(-1, 1), ThirdPortalWPs[i][1]+irand(-1, 1), ThirdPortalWPs[i][2], 0);
me->SetHomePosition(ThirdPortalWPs[7][0], ThirdPortalWPs[7][1], ThirdPortalWPs[7][2], 3.149439f);
break;
case 3:
for (int i=0;i<9;i++)
AddWaypoint(i, FourthPortalWPs[i][0]+irand(-1, 1), FourthPortalWPs[i][1]+irand(-1, 1), FourthPortalWPs[i][2], 0);
me->SetHomePosition(FourthPortalWPs[8][0], FourthPortalWPs[8][1], FourthPortalWPs[8][2], 3.149439f);
break;
case 4:
for (int i=0;i<6;i++)
AddWaypoint(i, FifthPortalWPs[i][0]+irand(-1, 1), FifthPortalWPs[i][1]+irand(-1, 1), FifthPortalWPs[i][2], 0);
me->SetHomePosition(FifthPortalWPs[5][0], FifthPortalWPs[5][1], FifthPortalWPs[5][2], 3.149439f);
break;
case 5:
for (int i=0;i<4;i++)
AddWaypoint(i, SixthPoralWPs[i][0]+irand(-1, 1), SixthPoralWPs[i][1]+irand(-1, 1), SixthPoralWPs[i][2], 0);
me->SetHomePosition(SixthPoralWPs[3][0], SixthPoralWPs[3][1], SixthPoralWPs[3][2], 3.149439f);
break;
}
SetDespawnAtEnd(false);
Start(true, true);
}
}
void JustDied(Unit* /*unit*/)
{
if (Creature* portal = Unit::GetCreature((*me), instance->GetData64(DATA_TELEPORTATION_PORTAL)))
CAST_AI(npc_teleportation_portal_vh::npc_teleportation_portalAI, portal->AI())->SummonedMobDied(me);
if (instance)
instance->SetData(DATA_NPC_PRESENCE_AT_DOOR_REMOVE, 1);
}
void CreatureStartAttackDoor()
{
me->SetReactState(REACT_PASSIVE);
DoCast(SPELL_DESTROY_DOOR_SEAL);
if (instance)
instance->SetData(DATA_NPC_PRESENCE_AT_DOOR_ADD, 1);
}
};
class mob_azure_invader : public CreatureScript
{
public:
mob_azure_invader() : CreatureScript("mob_azure_invader") { }
CreatureAI* GetAI(Creature* creature) const
{
return new mob_azure_invaderAI (creature);
}
struct mob_azure_invaderAI : public violet_hold_trashAI
{
mob_azure_invaderAI(Creature* c) : violet_hold_trashAI(c)
{
instance = c->GetInstanceScript();
}
uint32 uiCleaveTimer;
uint32 uiImpaleTimer;
uint32 uiBrutalStrikeTimer;
uint32 uiSunderArmorTimer;
void Reset()
{
uiCleaveTimer = 5000;
uiImpaleTimer = 4000;
uiBrutalStrikeTimer = 5000;
uiSunderArmorTimer = 4000;
}
void UpdateAI(const uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
if (me->GetEntry() == CREATURE_AZURE_INVADER_1)
{
if (uiCleaveTimer <= diff)
{
DoCast(me->getVictim(), SPELL_CLEAVE);
uiCleaveTimer = 5000;
} else uiCleaveTimer -= diff;
if (uiImpaleTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (target)
DoCast(target, SPELL_IMPALE);
uiImpaleTimer = 4000;
} else uiImpaleTimer -= diff;
}
if (me->GetEntry() == CREATURE_AZURE_INVADER_2)
{
if (uiBrutalStrikeTimer <= diff)
{
DoCast(me->getVictim(), SPELL_BRUTAL_STRIKE);
uiBrutalStrikeTimer = 5000;
} else uiBrutalStrikeTimer -= diff;
if (uiSunderArmorTimer <= diff)
{
DoCast(me->getVictim(), SPELL_SUNDER_ARMOR);
uiSunderArmorTimer = urand(8000, 10000);
} else uiSunderArmorTimer -= diff;
DoMeleeAttackIfReady();
}
DoMeleeAttackIfReady();
}
};
};
class mob_azure_binder : public CreatureScript
{
public:
mob_azure_binder() : CreatureScript("mob_azure_binder") { }
CreatureAI* GetAI(Creature* creature) const
{
return new mob_azure_binderAI (creature);
}
struct mob_azure_binderAI : public violet_hold_trashAI
{
mob_azure_binderAI(Creature* c) : violet_hold_trashAI(c)
{
instance = c->GetInstanceScript();
}
uint32 uiArcaneExplosionTimer;
uint32 uiArcainBarrageTimer;
uint32 uiFrostNovaTimer;
uint32 uiFrostboltTimer;
void Reset()
{
uiArcaneExplosionTimer = 5000;
uiArcainBarrageTimer = 4000;
uiFrostNovaTimer = 5000;
uiFrostboltTimer = 4000;
}
void UpdateAI(const uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
if (me->GetEntry() == CREATURE_AZURE_BINDER_1)
{
if (uiArcaneExplosionTimer <= diff)
{
DoCast(DUNGEON_MODE(SPELL_ARCANE_EXPLOSION, H_SPELL_ARCANE_EXPLOSION));
uiArcaneExplosionTimer = 5000;
} else uiArcaneExplosionTimer -= diff;
if (uiArcainBarrageTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (target)
DoCast(target, DUNGEON_MODE(SPELL_ARCANE_BARRAGE, H_SPELL_ARCANE_BARRAGE));
uiArcainBarrageTimer = 6000;
} else uiArcainBarrageTimer -= diff;
}
if (me->GetEntry() == CREATURE_AZURE_BINDER_2)
{
if (uiFrostNovaTimer <= diff)
{
DoCast(DUNGEON_MODE(SPELL_FROST_NOVA, H_SPELL_FROST_NOVA));
uiFrostNovaTimer = 5000;
} else uiFrostNovaTimer -= diff;
if (uiFrostboltTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (target)
DoCast(target, DUNGEON_MODE(SPELL_FROSTBOLT, H_SPELL_FROSTBOLT));
uiFrostboltTimer = 6000;
} else uiFrostboltTimer -= diff;
}
DoMeleeAttackIfReady();
}
};
};
class mob_azure_mage_slayer : public CreatureScript
{
public:
mob_azure_mage_slayer() : CreatureScript("mob_azure_mage_slayer") { }
CreatureAI* GetAI(Creature* creature) const
{
return new mob_azure_mage_slayerAI (creature);
}
struct mob_azure_mage_slayerAI : public violet_hold_trashAI
{
mob_azure_mage_slayerAI(Creature* c) : violet_hold_trashAI(c)
{
instance = c->GetInstanceScript();
}
uint32 uiArcaneEmpowermentTimer;
uint32 uiSpellLockTimer;
void Reset()
{
uiArcaneEmpowermentTimer = 5000;
uiSpellLockTimer = 5000;
}
void UpdateAI(const uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
if (me->GetEntry() == CREATURE_AZURE_MAGE_SLAYER_1)
{
if (uiArcaneEmpowermentTimer <= diff)
{
DoCast(me, SPELL_ARCANE_EMPOWERMENT);
uiArcaneEmpowermentTimer = 14000;
} else uiArcaneEmpowermentTimer -= diff;
}
if (me->GetEntry() == CREATURE_AZURE_MAGE_SLAYER_2)
{
if (uiSpellLockTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (target)
DoCast(target, SPELL_SPELL_LOCK);
uiSpellLockTimer = 9000;
} else uiSpellLockTimer -= diff;
}
DoMeleeAttackIfReady();
}
};
};
class mob_azure_raider : public CreatureScript
{
public:
mob_azure_raider() : CreatureScript("mob_azure_raider") { }
CreatureAI* GetAI(Creature* creature) const
{
return new mob_azure_raiderAI (creature);
}
struct mob_azure_raiderAI : public violet_hold_trashAI
{
mob_azure_raiderAI(Creature* c) : violet_hold_trashAI(c)
{
instance = c->GetInstanceScript();
}
uint32 uiConcussionBlowTimer;
uint32 uiMagicReflectionTimer;
void Reset()
{
uiConcussionBlowTimer = 5000;
uiMagicReflectionTimer = 8000;
}
void UpdateAI(const uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
if (uiConcussionBlowTimer <= diff)
{
DoCast(me->getVictim(), SPELL_CONCUSSION_BLOW);
uiConcussionBlowTimer = 5000;
} else uiConcussionBlowTimer -= diff;
if (uiMagicReflectionTimer <= diff)
{
DoCast(SPELL_MAGIC_REFLECTION);
uiMagicReflectionTimer = urand(10000, 15000);
} else uiMagicReflectionTimer -= diff;
DoMeleeAttackIfReady();
}
};
};
class mob_azure_stalker : public CreatureScript
{
public:
mob_azure_stalker() : CreatureScript("mob_azure_stalker") { }
CreatureAI* GetAI(Creature* creature) const
{
return new mob_azure_stalkerAI (creature);
}
struct mob_azure_stalkerAI : public violet_hold_trashAI
{
mob_azure_stalkerAI(Creature* c) : violet_hold_trashAI(c)
{
instance = c->GetInstanceScript();
}
uint32 uiBackstabTimer;
uint32 uiTacticalBlinkTimer;
bool TacticalBlinkCasted;
void Reset()
{
uiBackstabTimer = 1300;
uiTacticalBlinkTimer = 8000;
TacticalBlinkCasted =false;
}
void UpdateAI(const uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
if (!TacticalBlinkCasted)
{
if (uiTacticalBlinkTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true);
if (target)
DoCast(target, SPELL_TACTICAL_BLINK);
uiTacticalBlinkTimer = 6000;
TacticalBlinkCasted = true;
} else uiTacticalBlinkTimer -= diff;
}
else
{
if (uiBackstabTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 10, true);
DoCast(target, SPELL_BACKSTAB);
TacticalBlinkCasted = false;
uiBackstabTimer =1300;
} else uiBackstabTimer -= diff;
}
DoMeleeAttackIfReady();
}
};
};
class mob_azure_spellbreaker : public CreatureScript
{
public:
mob_azure_spellbreaker() : CreatureScript("mob_azure_spellbreaker") { }
struct mob_azure_spellbreakerAI : public violet_hold_trashAI
{
mob_azure_spellbreakerAI(Creature* c) : violet_hold_trashAI(c)
{
instance = c->GetInstanceScript();
}
uint32 uiArcaneBlastTimer;
uint32 uiSlowTimer;
uint32 uiChainsOfIceTimer;
uint32 uiConeOfColdTimer;
void Reset()
{
uiArcaneBlastTimer = 5000;
uiSlowTimer = 4000;
uiChainsOfIceTimer = 5000;
uiConeOfColdTimer = 4000;
}
void UpdateAI(const uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
if (me->GetEntry() == CREATURE_AZURE_SPELLBREAKER_1)
{
if (uiArcaneBlastTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (target)
DoCast(target, DUNGEON_MODE(SPELL_ARCANE_BLAST, H_SPELL_ARCANE_BLAST));
uiArcaneBlastTimer = 6000;
} else uiArcaneBlastTimer -= diff;
if (uiSlowTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (target)
DoCast(target, SPELL_SLOW);
uiSlowTimer = 5000;
} else uiSlowTimer -= diff;
}
if (me->GetEntry() == CREATURE_AZURE_SPELLBREAKER_2)
{
if (uiChainsOfIceTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (target)
DoCast(target, SPELL_CHAINS_OF_ICE);
uiChainsOfIceTimer = 7000;
} else uiChainsOfIceTimer -= diff;
if (uiConeOfColdTimer <= diff)
{
DoCast(DUNGEON_MODE(SPELL_CONE_OF_COLD, H_SPELL_CONE_OF_COLD));
uiConeOfColdTimer = 5000;
} else uiConeOfColdTimer -= diff;
}
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const
{
return new mob_azure_spellbreakerAI (creature);
}
};
class mob_azure_captain : public CreatureScript
{
public:
mob_azure_captain() : CreatureScript("mob_azure_captain") { }
CreatureAI* GetAI(Creature* creature) const
{
return new mob_azure_captainAI (creature);
}
struct mob_azure_captainAI : public violet_hold_trashAI
{
mob_azure_captainAI(Creature* c) : violet_hold_trashAI(c)
{
instance = c->GetInstanceScript();
}
uint32 uiMortalStrikeTimer;
uint32 uiWhirlwindTimer;
void Reset()
{
uiMortalStrikeTimer = 5000;
uiWhirlwindTimer = 8000;
}
void UpdateAI(const uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
if (uiMortalStrikeTimer <= diff)
{
DoCast(me->getVictim(), SPELL_MORTAL_STRIKE);
uiMortalStrikeTimer = 5000;
} else uiMortalStrikeTimer -= diff;
if (uiWhirlwindTimer <= diff)
{
DoCast(me, SPELL_WHIRLWIND_OF_STEEL);
uiWhirlwindTimer = 8000;
} else uiWhirlwindTimer -= diff;
DoMeleeAttackIfReady();
}
};
};
class mob_azure_sorceror : public CreatureScript
{
public:
mob_azure_sorceror() : CreatureScript("mob_azure_sorceror") { }
CreatureAI* GetAI(Creature* creature) const
{
return new mob_azure_sorcerorAI (creature);
}
struct mob_azure_sorcerorAI : public violet_hold_trashAI
{
mob_azure_sorcerorAI(Creature* c) : violet_hold_trashAI(c)
{
instance = c->GetInstanceScript();
}
uint32 uiArcaneStreamTimer;
uint32 uiArcaneStreamTimerStartingValueHolder;
uint32 uiManaDetonationTimer;
void Reset()
{
uiArcaneStreamTimer = 4000;
uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer;
uiManaDetonationTimer = 5000;
}
void UpdateAI(const uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
if (uiArcaneStreamTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (target)
DoCast(target, DUNGEON_MODE(SPELL_ARCANE_STREAM, H_SPELL_ARCANE_STREAM));
uiArcaneStreamTimer = urand(0, 5000)+5000;
uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer;
} else uiArcaneStreamTimer -= diff;
if (uiManaDetonationTimer <= diff && uiArcaneStreamTimer >=1500 && uiArcaneStreamTimer <= uiArcaneStreamTimerStartingValueHolder/2)
{
DoCast(DUNGEON_MODE(SPELL_MANA_DETONATION, H_SPELL_MANA_DETONATION));
uiManaDetonationTimer = urand(2000, 6000);
} else uiManaDetonationTimer -= diff;
DoMeleeAttackIfReady();
}
};
};
void AddSC_violet_hold()
{
new npc_sinclari_vh();
new npc_teleportation_portal_vh();
new mob_azure_invader();
new mob_azure_spellbreaker();
new mob_azure_binder();
new mob_azure_mage_slayer();
new mob_azure_captain();
new mob_azure_sorceror();
new mob_azure_raider();
new mob_azure_stalker();
new mob_azure_saboteur();
} | alideny/ChgMangos_CTM | src/server/scripts/Northrend/VioletHold/violet_hold.cpp | C++ | gpl-2.0 | 45,090 |
/* Hey EMACS -*- linux-c -*- */
/* $Id: toolbar.h 4392 2011-08-01 09:24:05Z debrouxl $ */
/* TiLP - Tilp Is a Linking Program
* Copyright (C) 1999-2006 Romain Lievin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef GTOOLBAR_H
#define GTOOLBAR_H
void toolbar_refresh_buttons(void);
void toolbar_set_button(int sr);
#endif
| debrouxl/strip_tilp_nspire | src/toolbar.h | C | gpl-2.0 | 1,022 |
(function ($, window, document) {
"use strict";
$(document).on( 'ready', function(){
var $body = $('body'),
$topbar = $( document.getElementById('topbar') ),
$products_sliders = $('.products-slider-wrapper, .categories-slider-wrapper');
/*************************
* SHOP STYLE SWITCHER
*************************/
$('#list-or-grid').on( 'click', 'a', function(){
var trigger = $(this),
view = trigger.attr( 'class' ).replace('-view', '');
$( 'ul.products li' ).removeClass( 'list grid' ).addClass( view );
trigger.parent().find( 'a' ).removeClass( 'active' );
trigger.addClass( 'active' );
$.cookie( yit_shop_view_cookie, view );
return false;
});
/*************************
* Fix Product Name and Price
*************************/
var padding_nameprice = function () {
$('li.product .product-wrapper .info-product.slideup').each(function () {
$(this).find('h3').css( 'padding-' + ( ! yit.isRtl ? 'right' : 'left' ), $(this).find('span.price').width() + 10 );
});
};
if( $(window).width() > 1199 ){
padding_nameprice();
}
$(document).on('yith-wcan-ajax-filtered', padding_nameprice );
/*************************
* ADD TO CART
*************************/
var product, product_onsale;
var add_to_cart = function() {
$('ul.products').on('click', 'li.product .add_to_cart_button', function () {
product = $(this).parents('li.product');
product_onsale = product.find('.product-wrapper > .onsale');
if( typeof yit.load_gif != 'undefined' ) {
product.find('.thumb-wrapper').block({message: null, overlayCSS: {background: '#fff url(' + yit.load_gif + ') no-repeat center', opacity: 0.3, cursor: 'none'}});
}
else{
product.find('.thumb-wrapper').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url.substring(0, woocommerce_params.ajax_loader_url.length - 7) + '.gif) no-repeat center', opacity: 0.3, cursor: 'none'}});
}
});
}
add_to_cart();
$(document).on('yith-wcan-ajax-filtered', add_to_cart );
$body.on('added_to_cart', function () {
if( typeof product_onsale === 'undefined' && typeof product === 'undefined' ) return;
$( '.products-slider.swiper .swiper-slide .opacity .swiper-product-informations span.product-add-to-cart a.added_to_cart.wc-forward')
.addClass( 'btn btn-flat' )
.prev('a').remove();
if ( product_onsale.length ) {
product_onsale.remove();
}
product.find('.thumb-wrapper').append('<div class="added_to_cart_box"><div class="added_to_cart_label">' + yit.added_to_cart + '</div></div>');
product.find('.added_to_cart_label').append(product.find('a.added_to_cart'));
product.find('.product-wrapper div:first-child').addClass('nohover');
setTimeout( function(){
product.find('.added_to_cart_box').fadeOut(2000, function(){ $(this).remove(); });
product.find('.product-wrapper div:first-child').removeClass('nohover');
}, 3000 );
if (product.find('.product-wrapper > .added_to_cart_ico').length == 0) {
setTimeout(function() {
product.find('.product-wrapper').append('<span class="added_to_cart_ico">' + yit.added_to_cart_ico + '</span>');
}, 4000);
}
product.find('.thumb-wrapper').unblock();
});
/*************************
* PRODUCTS SLIDER
*************************/
if( $.fn.owlCarousel && $.fn.imagesLoaded && $products_sliders.length ) {
var product_slider = function(t) {
t.imagesLoaded(function(){
var cols = t.data('columns') ? t.data('columns') : 4;
var autoplay = (t.attr('data-autoplay')=='true') ? 3000 : false;
var owl = t.find('.products').owlCarousel({
items : cols,
responsiveClass : true,
responsive:{
0 : {
items: 2
},
479 : {
items: 3
},
767 : {
items: 4
},
992 : {
items: cols
}
},
autoplay : autoplay,
autoplayTimeout : 2000,
autoplayHoverPause: true,
loop : true,
rtl: yit.isRtl == true
});
// Custom Navigation Events
t.on('click', '.es-nav-next', function () {
owl.trigger('next.owl.carousel');
});
t.on('click', '.es-nav-prev', function () {
owl.trigger('prev.owl.carousel');
});
});
};
// initialize slider in only visible tabs
$products_sliders.each(function(){
var t = $(this);
if( ! t.closest('.panel.group').length || t.closest('.panel.group').hasClass('showing') ){
product_slider( t );
}
});
$('.tabs-container').on( 'yit_tabopened', function( e, tab ) {
product_slider( tab.find( $products_sliders ) );
});
}
/*************************
* VARIATIONS SELECT
*************************/
var variations_select = function(){
// variations select
if( $.fn.selectbox ) {
var form = $('form.variations_form');
var select = form.find('select:not(.yith_wccl_custom)');
if( form.data('wccl') ) {
select = select.filter(function(){
return $(this).data('type') == 'select'
});
}
select.selectbox({
effect: 'fade',
onOpen: function() {
//$('.variations select').trigger('focusin');
}
});
var update_select = function(event){ // console.log(event);
select.selectbox("detach");
select.selectbox("attach");
};
// fix variations select
form.on( 'woocommerce_update_variation_values', update_select);
form.find('.reset_variations').on('click.yit', update_select);
}
};
variations_select();
/*************************
* TOPBAR INDICATORS
*************************/
$topbar.find('#lang_sel .lang_sel_sel').append('<span class="sf-sub-indicator"> +</span>');
$topbar.find('#wcml_currency_switcher > ul > li a.sbSelector').append('<span class="sf-sub-indicator"> +</span>');
/*************************
* PRODUCT TABS
*************************/
$('.single-product-tabs.vertical').on('click', 'ul.tabs li .tab_name', function () {
var tab_trigger = $(this),
panel = tab_trigger.siblings('.panel'),
container = tab_trigger.closest('.single-product-tabs');
if ( ! tab_trigger.hasClass('active') ) {
//remove opened tab
container.find('.tab_name.active').siblings('div.panel').slideToggle('slow');
container.find('.tab_name.active').removeClass('active');
//open tab
tab_trigger.addClass('active');
} else {
tab_trigger.removeClass('active');
}
panel.slideToggle('slow');
});
/*************************
* INQUIRY FORM
*************************/
var inquiry_form = function(){
if ( $('#inquiry-form .product-inquiry').length ) {
$(document).on('click', '#inquiry-form .product-inquiry', function(event){
event.stopImmediatePropagation('click');
$(this).next('form.contact-form').slideToggle('slow');
});
}
};
inquiry_form();
$(document).on('yit_quick_view_loaded', inquiry_form);
if( $( 'body').hasClass( 'single-product' ) ) {
setTimeout( function() {
if( $.trim( $( 'div.user-message').html() ) != '' || $.trim( $( '.contact-form li div.msg-error' ).text() ) != '' ) {
$('form.contact-form').slideToggle('slow');
}
}, 200 );
}
/*************************
* Wishlist
*************************/
var wishlist_share = function() {
if ( $('#wishlist-share div.share-text').length ) {
$(document).on('click', '#wishlist-share div.share-text', function(){
$(this).next('div.share-link-container').slideToggle('slow');
});
}
};
wishlist_share();
$(document).on('yit_quick_view_loaded', wishlist_share);
/*************************
* Update Calculate Shipping Select
*************************/
var wc_version = 2.2;
if (typeof yit_woocommerce != 'undefined') wc_version = parseFloat(yit_woocommerce.version);
if ( wc_version < 2.3 && $.fn.selectbox ) {
$('#calc_shipping_state').next('.sbHolder').addClass('stateHolder');
$body.on('country_to_state_changing', function(){
$('.stateHolder').remove();
$('#calc_shipping_state').show().attr('sb', '');
$('select#calc_shipping_state').selectbox({
effect: 'fade',
classHolder: 'stateHolder sbHolder'
});
});
}
/*************************
* Login Form
*************************/
// $('#login-form').on('submit', function(){
// var a = $('#reg_password').val();
// var b = $('#reg_password_retype').val();
// if(!(a==b)){
// $('#reg_password_retype').addClass('invalid');
// return false;
// }else{
// $('#reg_password_retype').removeClass('invalid');
// return true;
// }
// });
/*************************
* PRODUCT QUICK VIEW
*************************/
function quick_view_trigger() {
$('div.quick-view a.trigger').yit_quick_view({
item_container: 'li.product',
loader : 'div.single-product.woocommerce',
assets : yit_quick_view.assets,
before : function (trigger, item) {
// add loading in the button
if( typeof yit.load_gif != 'undefined' ) {
trigger.parent().block({message: null, overlayCSS: {background: '#fff url(' + yit.load_gif + ') no-repeat center', opacity: 0.3, cursor: 'none'}});
}
else{
trigger.parent().block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url.substring(0, woocommerce_params.ajax_loader_url.length - 7) + '.gif) no-repeat center', opacity: 0.3, cursor: 'none'}});
}
item.find('.thumb-wrapper').addClass('hover');
},
openDialog : function (trigger, item) {
// remove loading from button
trigger.parent().unblock();
item.find('.thumb-wrapper').removeClass('hover');
},
completed : function (trigger, item, html, overlay) {
var data = $('<div>' + html + '</div>'),
title = data.find('h1.product_title').html(),
price = data.find('p.price').html(),
rating = data.find('div.star-rating').html(),
container = document.getElementById('wrapper'),
wrapper = $(overlay).find('.main .container');
// add main class to dialog container
$(overlay).addClass('product-quick-view');
// head
$('<p />').addClass('price').html(price).prependTo(wrapper.find('.head'));
$('<div />').addClass('star-rating').html(rating).prependTo(wrapper.find('.head'));
$('<h4 />').html(title).prependTo(wrapper.find('.head'));
//prettyPhoto
if ( typeof $.prettyPhoto != 'undefined' ) {
data.find( "a[rel^='thumbnails'], a.zoom" ).prettyPhoto({
social_tools : false,
theme : 'pp_woocommerce',
horizontal_padding: 40,
opacity : 0.9,
deeplinking : false
});
}
// quantity fields
$('div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)').addClass('buttons_added').append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />');
variations_select();
// add to cart
$('form.cart', overlay).on('submit', function (e) {
e.preventDefault();
var form = $(this),
button = form.find('button'),
product_url = item.find('a.thumb').attr('href');
if( typeof yit.load_gif != 'undefined' ) {
button.block({message: null, overlayCSS: {background: '#fff url(' + yit.load_gif + ') no-repeat center', opacity: 0.3, cursor: 'none'}});
}
else if (typeof( woocommerce_params.plugin_url ) != 'undefined') {
button.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.3, cursor: 'none'}});
}
else {
button.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url.substring(0, woocommerce_params.ajax_loader_url.length - 7) + '.gif) no-repeat center', opacity: 0.3, cursor: 'none'}});
}
$.post(product_url, form.serialize() + '&_wp_http_referer=' + product_url, function (result) {
var message = $( '.woocommerce-message', result ),
cart_dropdown = $( '#header .yit_cart_widget', result);
if( typeof wc_cart_fragments_params != 'undefined') {
// update fragments
var $supports_html5_storage;
try {
$supports_html5_storage = ( 'sessionStorage' in window && window.sessionStorage !== null );
window.sessionStorage.setItem('wc', 'test');
window.sessionStorage.removeItem('wc');
} catch (err) {
$supports_html5_storage = false;
}
$.ajax({
url : wc_cart_fragments_params.wc_ajax_url.toString().replace('%%endpoint%%', 'get_refreshed_fragments'),
type : 'POST',
success: function (data) {
if (data && data.fragments) {
$.each(data.fragments, function (key, value) {
$(key).replaceWith(value);
});
if ($supports_html5_storage) {
sessionStorage.setItem(wc_cart_fragments_params.fragment_name, JSON.stringify(data.fragments));
sessionStorage.setItem('wc_cart_hash', data.cart_hash);
}
$(document.body).trigger('wc_fragments_refreshed');
}
}
});
}
// add message
$('div.product', overlay).before(message);
// remove loading
button.unblock();
});
});
// others
$('#wishlist-share').find('.share-link-container').hide();
$('#inquiry-form').find('form.contact-form').hide();
},
action : 'yit_load_product_quick_view'
});
}
if ($.fn.yit_quick_view && typeof yit_quick_view != 'undefined') {
quick_view_trigger();
$(document).on('yith-wcan-ajax-filtered', quick_view_trigger);
}
/*************************
* WISHLIST LABEL
*************************/
$( '.yith-wcwl-add-button .add_to_wishlist').on( 'click', function() {
var feedback = $(this).closest('.yith-wcwl-add-to-wishlist').find('.yith-wcwl-wishlistaddedbrowse span.feedback');
feedback.fadeIn();
setTimeout( function(){
feedback.fadeOut('slow');
}, 4000 );
});
/*************************
* Widget Woo Price Filter
*************************/
if( yit.price_filter_slider == 'no' || typeof yit.price_filter_slider == 'undefined' ) {
var removePriceFilterSlider = function() {
$( 'input#min_price, input#max_price' ).show();
$('form > div.price_slider_wrapper').find( 'div.price_slider, div.price_label' ).hide();
};
removePriceFilterSlider();
}
/*****************************
* TERMS AND CONDITIONS POPUP
*****************************/
if ($.fn.yit_quick_view ) {
var term_popup = function() {
$('p.terms a').yit_quick_view({
item_container: 'p.terms',
loader: '#primary .content',
loadPage: true,
before: function( trigger, item ) {
// add loading in the button
if( typeof yit.load_gif != 'undefined' ) {
item.block({message: null, overlayCSS: {background: '#fff url(' + yit.load_gif + ') no-repeat center', opacity: 0.3, cursor: 'none'}});
} else {
item.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url.substring(0, woocommerce_params.ajax_loader_url.length - 7) + '.gif) no-repeat center', opacity: 0.3, cursor: 'none'}});
}
},
completed: function( trigger, item, html, overlay ) {
var data = $('<div>' + html + '</div>'),
title = trigger.text(),
container = document.getElementById( 'wrapper' ),
wrapper = $(overlay).find('.main .container');
// head
$('<h4 />').html(title).prependTo( wrapper.find('.head') );
$(overlay).addClass('terms-popup');
$(overlay).find('.content').removeClass('col-sm-12 col-sm-9');
},
openDialog: function( trigger, item ) {
item.unblock();
}
});
};
$body.on('updated_checkout', term_popup);
term_popup();
}
});
})( jQuery, window, document ); | lieison/IndustriasFenix | wp-content/themes/bishop/theme/assets/js/woocommerce.js | JavaScript | gpl-2.0 | 21,939 |
package com.yh.admin.bo;
import java.util.Date;
import com.yh.platform.core.bo.BaseBo;
public class UserAgent extends BaseBo {
private static final long serialVersionUID = 2715416587055228708L;
private Long userAgentOid;
private Long systemPositionOid;
private String userId; // 被代理人
private String agentUserId; // 指定的代理人
private Date effectiveDate; // 有效开始期
private Date expiredDt;
private String isActive;
public Long getSystemPositionOid() {
return systemPositionOid;
}
public void setSystemPositionOid(Long systemPositionOid) {
this.systemPositionOid = systemPositionOid;
}
public Long getUserAgentOid() {
return userAgentOid;
}
public void setUserAgentOid(Long userAgentOid) {
this.userAgentOid = userAgentOid;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getAgentUserId() {
return agentUserId;
}
public void setAgentUserId(String agentUserId) {
this.agentUserId = agentUserId;
}
public Date getExpiredDt() {
return expiredDt;
}
public void setExpiredDt(Date expiredDt) {
this.expiredDt = expiredDt;
}
public String getIsActive() {
return isActive;
}
public void setIsActive(String isActive) {
this.isActive = isActive;
}
public Date getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(Date effectiveDate) {
this.effectiveDate = effectiveDate;
}
}
| meijmOrg/Repo-test | freelance-admin/src/java/com/yh/admin/bo/UserAgent.java | Java | gpl-2.0 | 1,512 |
<?php
/*
* This file is part of PHPExifTool.
*
* (c) 2012 Romain Neutron <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPExiftool\Driver\Tag\File;
use PHPExiftool\Driver\AbstractTag;
class PreviewPNG extends AbstractTag
{
protected $Id = 'PreviewPNG';
protected $Name = 'PreviewPNG';
protected $FullName = 'Extra';
protected $GroupName = 'File';
protected $g0 = 'File';
protected $g1 = 'File';
protected $g2 = 'Image';
protected $Type = '?';
protected $Writable = false;
protected $Description = 'Preview PNG';
protected $flag_Binary = true;
}
| Droces/casabio | vendor/phpexiftool/phpexiftool/lib/PHPExiftool/Driver/Tag/File/PreviewPNG.php | PHP | gpl-2.0 | 725 |
<?php
/**
* @version $Id: blog.php 20960 2011-03-12 14:14:00Z chdemko $
* @package Chola.Site
* @subpackage com_content
* @copyright Copyright (C) 2005 - 2011 Cholalabs Software LLP. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// no direct access
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers');
?>
<div class="blog<?php echo $this->pageclass_sfx;?>">
<?php if ($this->params->get('show_page_heading', 1)) : ?>
<h1>
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($this->params->get('show_category_title', 1) OR $this->params->get('page_subheading')) : ?>
<h2>
<?php echo $this->escape($this->params->get('page_subheading')); ?>
<?php if ($this->params->get('show_category_title')) : ?>
<span class="subheading-category"><?php echo $this->category->title;?></span>
<?php endif; ?>
</h2>
<?php endif; ?>
<?php if ($this->params->get('show_description', 1) || $this->params->def('show_description_image', 1)) : ?>
<div class="category-desc">
<?php if ($this->params->get('show_description_image') && $this->category->getParams()->get('image')) : ?>
<img src="<?php echo $this->category->getParams()->get('image'); ?>"/>
<?php endif; ?>
<?php if ($this->params->get('show_description') && $this->category->description) : ?>
<?php echo JHtml::_('content.prepare', $this->category->description); ?>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php $leadingcount=0 ; ?>
<?php if (!empty($this->lead_items)) : ?>
<div class="items-leading">
<?php foreach ($this->lead_items as &$item) : ?>
<div class="leading-<?php echo $leadingcount; ?><?php echo $item->state == 0 ? ' system-unpublished' : null; ?>">
<?php
$this->item = &$item;
echo $this->loadTemplate('item');
?>
</div>
<?php
$leadingcount++;
?>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php
$introcount=(count($this->intro_items));
$counter=0;
?>
<?php if (!empty($this->intro_items)) : ?>
<?php foreach ($this->intro_items as $key => &$item) : ?>
<?php
$key= ($key-$leadingcount)+1;
$rowcount=( ((int)$key-1) % (int) $this->columns) +1;
$row = $counter / $this->columns ;
if ($rowcount==1) : ?>
<div class="items-row cols-<?php echo (int) $this->columns;?> <?php echo 'row-'.$row ; ?>">
<?php endif; ?>
<div class="item column-<?php echo $rowcount;?><?php echo $item->state == 0 ? ' system-unpublished' : null; ?>">
<?php
$this->item = &$item;
echo $this->loadTemplate('item');
?>
</div>
<?php $counter++; ?>
<?php if (($rowcount == $this->columns) or ($counter ==$introcount)): ?>
<span class="row-separator"></span>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php if (!empty($this->link_items)) : ?>
<?php echo $this->loadTemplate('links'); ?>
<?php endif; ?>
<?php if (!empty($this->children[$this->category->id])&& $this->maxLevel != 0) : ?>
<div class="cat-children">
<h3>
<?php echo JTEXT::_('JGLOBAL_SUBCATEGORIES'); ?>
</h3>
<?php echo $this->loadTemplate('children'); ?>
</div>
<?php endif; ?>
<?php if (($this->params->def('show_pagination', 1) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->get('pages.total') > 1)) : ?>
<div class="pagination">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
</div>
| cholalabs/CholaApps2.0 | components/com_content/views/category/tmpl/blog.php | PHP | gpl-2.0 | 3,631 |
local function isBotAllowed (userId, chatId)
local hash = 'anti-bot:allowed:'..chatId..':'..userId
local banned = redis:get(hash)
return banned
end
local function allowBot (userId, chatId)
local hash = 'anti-bot:allowed:'..chatId..':'..userId
redis:set(hash, true)
end
local function disallowBot (userId, chatId)
local hash = 'anti-bot:allowed:'..chatId..':'..userId
redis:del(hash)
end
-- Is anti-bot enabled on chat
local function isAntiBotEnabled (chatId)
local hash = 'anti-bot:enabled:'..chatId
local enabled = redis:get(hash)
return enabled
end
local function enableAntiBot (chatId)
local hash = 'anti-bot:enabled:'..chatId
redis:set(hash, true)
end
local function disableAntiBot (chatId)
local hash = 'anti-bot:enabled:'..chatId
redis:del(hash)
end
local function isABot (user)
-- Flag its a bot 0001000000000000
local binFlagIsBot = 4096
local result = bit32.band(user.flags, binFlagIsBot)
return result == binFlagIsBot
end
local function kickUser(userId, chatId)
local chat = 'chat#id'..chatId
local user = 'user#id'..userId
chat_del_user(chat, user, function (data, success, result)
if success ~= 1 then
print('I can\'t kick '..data.user..' but should be kicked')
end
end, {chat=chat, user=user})
end
local function run (msg, matches)
-- We wont return text if is a service msg
if matches[1] ~= 'chat_add_user' and matches[1] ~= 'chat_add_user_link' then
if msg.to.type ~= 'chat' then
return 'Anti-flood works only on channels'
end
end
local chatId = msg.to.id
if matches[1] == 'enable' then
enableAntiBot(chatId)
return 'Anti-bot enabled on this chat'
end
if matches[1] == 'disable' then
disableAntiBot(chatId)
return 'Anti-bot disabled on this chat'
end
if matches[1] == 'allow' then
local userId = matches[2]
allowBot(userId, chatId)
return 'Bot '..userId..' allowed'
end
if matches[1] == 'disallow' then
local userId = matches[2]
disallowBot(userId, chatId)
return 'Bot '..userId..' disallowed'
end
if matches[1] == 'chat_add_user' or matches[1] == 'chat_add_user_link' then
local user = msg.action.user or msg.from
if isABot(user) then
print('It\'s a bot!')
if isAntiBotEnabled(chatId) then
print('Anti bot is enabled')
local userId = user.id
if not isBotAllowed(userId, chatId) then
kickUser(userId, chatId)
else
print('This bot is allowed')
end
end
end
end
end
return {
description = 'When bot enters group kick it.',
usage = {
'[/!]antibot enable: Enable Anti-bot on current chat',
'[/!]antibot disable: Disable Anti-bot on current chat',
'[/!]antibot allow <botId>: Allow <botId> on this chat',
'[/!]antibot disallow <botId>: Disallow <botId> on this chat'
},
patterns = {
'^[/!]antibot (allow) (%d+)$',
'^[/!]antibot (disallow) (%d+)$',
'^[/!]antibot (enable)$',
'^[/!]antibot (disable)$',
'^!!tgservice (chat_add_user)$',
'^!!tgservice (chat_add_user_link)$'
},
run = run
}
| mamaddeveloper/DeveloperMMD_bot | plugins/anti-bot.lua | Lua | gpl-2.0 | 3,087 |
/* Cabal - Legacy Game Implementations
*
* Cabal is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
// Based on the ScummVM (GPLv2+) file of the same name
#ifdef ENABLE_HE
#include "scumm/he/floodfill_he.h"
#include "scumm/he/intern_he.h"
#include "scumm/resource.h"
#include "scumm/scumm.h"
namespace Scumm {
static bool floodFillPixelCheck(int x, int y, const FloodFillState *ffs) {
int diffColor = ffs->color1 - ffs->color2;
if (x >= 0 && x < ffs->dst_w && y >= 0 && y < ffs->dst_h) {
uint8 color = *(ffs->dst + y * ffs->dst_w + x);
diffColor = color - ffs->color1;
}
return diffColor == 0;
}
static void floodFillProcessRect(FloodFillState *ffs, const Common::Rect *r) {
Common::Rect *dr = &ffs->dstBox;
if (dr->right >= dr->left && dr->top <= dr->bottom) {
int rw = r->right - r->left + 1;
int rh = r->bottom - r->top + 1;
assert(r->top + rh <= ffs->dst_h);
assert(r->left + rw <= ffs->dst_w);
uint8 *dst = ffs->dst + r->top * ffs->dst_w + r->left;
if (rw <= 1) {
--rh;
while (rh >= 0) {
*dst = ffs->color2;
dst += ffs->dst_w;
--rh;
}
} else {
--rh;
while (rh >= 0) {
memset(dst, ffs->color2, rw);
dst += ffs->dst_w;
--rh;
}
}
dr->extend(*r);
} else {
*dr = *r;
}
}
static void floodFillAddLine(FloodFillLine **ffl, int y, int x1, int x2, int dy) {
(*ffl)->y = y;
(*ffl)->x1 = x1;
(*ffl)->x2 = x2;
(*ffl)->inc = dy;
(*ffl)++;
}
static void floodFillProcess(int x, int y, FloodFillState *ffs, FloodFillPixelCheckCallback pixelCheckCallback) {
ffs->dstBox.left = ffs->dstBox.top = 12345;
ffs->dstBox.right = ffs->dstBox.bottom = -12345;
FloodFillLine **fillLineCur = &ffs->fillLineTableCur;
FloodFillLine **fillLineEnd = &ffs->fillLineTableEnd;
assert(*fillLineCur < *fillLineEnd);
if (ffs->srcBox.top <= y + 1 && ffs->srcBox.bottom >= y + 1) {
(*fillLineCur)->y = y;
(*fillLineCur)->x1 = x;
(*fillLineCur)->x2 = x;
(*fillLineCur)->inc = 1;
(*fillLineCur)++;
}
assert(*fillLineCur < *fillLineEnd);
if (ffs->srcBox.top <= y && ffs->srcBox.bottom >= y) {
(*fillLineCur)->y = y + 1;
(*fillLineCur)->x1 = x;
(*fillLineCur)->x2 = x;
(*fillLineCur)->inc = -1;
(*fillLineCur)++;
}
assert(ffs->fillLineTable <= *fillLineCur);
FloodFillLine **fillLineStart = fillLineCur;
while (ffs->fillLineTable < *fillLineStart) {
Common::Rect r;
int x_start;
FloodFillLine *fflCur = --(*fillLineCur);
int dy = fflCur->inc;
int x_end = fflCur->x2;
int x1 = fflCur->x1;
int x2 = fflCur->x1 + 1;
r.bottom = r.top = y = fflCur->y + fflCur->inc;
r.left = x2;
r.right = x1;
x = x1;
while (ffs->srcBox.left <= x) {
if (!(*pixelCheckCallback)(x, y, ffs)) {
break;
}
r.left = x;
--x;
}
if (r.right >= r.left && r.top <= r.bottom) {
floodFillProcessRect(ffs, &r);
}
if (x >= x1) goto skip;
x_start = x + 1;
if (x1 > x_start) {
assert(*fillLineEnd > *fillLineCur);
if (ffs->srcBox.top <= y - dy && ffs->srcBox.bottom >= y - dy) {
--x1;
floodFillAddLine(fillLineCur, y, x_start, x1, -dy);
}
}
x = x2;
while (x_start <= x_end) {
r.left = x;
r.top = y;
r.right = x - 1;
r.bottom = y;
while (ffs->srcBox.right >= x) {
if (!(*pixelCheckCallback)(x, y, ffs)) {
break;
}
r.right = x;
++x;
}
if (r.right >= r.left && r.top <= r.bottom) {
floodFillProcessRect(ffs, &r);
}
assert(ffs->fillLineTableCur < ffs->fillLineTableEnd);
if (ffs->srcBox.top <= y + dy && ffs->srcBox.bottom >= y + dy) {
floodFillAddLine(&ffs->fillLineTableCur, y, x_start, x - 1, dy);
}
x_start = x_end + 1;
if (x > x_start) {
assert(ffs->fillLineTableCur < ffs->fillLineTableEnd);
if (ffs->srcBox.top <= y - dy && ffs->srcBox.bottom >= y - dy) {
floodFillAddLine(&ffs->fillLineTableCur, y, x_start, x - 1, -dy);
}
}
skip:
++x;
while (x <= x_end) {
if ((*pixelCheckCallback)(x, y, ffs)) {
break;
}
++x;
}
x_start = x;
}
}
}
void floodFill(FloodFillParameters *ffp, ScummEngine_v90he *vm) {
uint8 *dst;
VirtScreen *vs = &vm->_virtscr[kMainVirtScreen];
if (ffp->flags & 0x8000) {
dst = vs->getBackPixels(0, vs->topline);
} else {
dst = vs->getPixels(0, vs->topline);
}
uint8 color = ffp->flags & 0xFF;
Common::Rect r;
r.left = r.top = 12345;
r.right = r.bottom = -12345;
FloodFillState *ffs = new FloodFillState;
ffs->fillLineTableCount = vs->getHeight() * 2;
ffs->fillLineTable = new FloodFillLine[ffs->fillLineTableCount];
ffs->color2 = color;
ffs->dst = dst;
ffs->dst_w = vs->getWidth();
ffs->dst_h = vs->getHeight();
ffs->srcBox = ffp->box;
ffs->fillLineTableCur = &ffs->fillLineTable[0];
ffs->fillLineTableEnd = &ffs->fillLineTable[ffs->fillLineTableCount];
if (ffp->x < 0 || ffp->y < 0 || ffp->x >= vs->getWidth() || ffp->y >= vs->getHeight()) {
ffs->color1 = color;
} else {
ffs->color1 = *(dst + ffp->y * vs->getWidth() + ffp->x);
}
debug(5, "floodFill() x=%d y=%d color1=%d ffp->flags=0x%X", ffp->x, ffp->y, ffs->color1, ffp->flags);
if (ffs->color1 != color) {
floodFillProcess(ffp->x, ffp->y, ffs, floodFillPixelCheck);
r = ffs->dstBox;
}
r.debugPrint(5, "floodFill() dirty_rect");
delete[] ffs->fillLineTable;
delete ffs;
vm->VAR(119) = 1;
if (r.left <= r.right && r.top <= r.bottom) {
if (ffp->flags & 0x8000) {
vm->restoreBackgroundHE(r);
} else {
++r.bottom;
vm->markRectAsDirty(kMainVirtScreen, r);
}
}
}
void Wiz::fillWizFlood(const WizParameters *params) {
if (params->processFlags & kWPFClipBox2) {
int px = params->box2.left;
int py = params->box2.top;
uint8 *dataPtr = _vm->getResourceAddress(rtImage, params->img.resNum);
if (dataPtr) {
int state = 0;
if (params->processFlags & kWPFNewState) {
state = params->img.state;
}
uint8 *wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), dataPtr, state, 0);
assert(wizh);
int c = READ_LE_UINT32(wizh + 0x0);
int w = READ_LE_UINT32(wizh + 0x4);
int h = READ_LE_UINT32(wizh + 0x8);
assert(c == 0);
Common::Rect imageRect(w, h);
if (params->processFlags & kWPFClipBox) {
if (!imageRect.intersects(params->box)) {
return;
}
imageRect.clip(params->box);
}
uint8 color = _vm->VAR(93);
if (params->processFlags & kWPFFillColor) {
color = params->fillColor;
}
if (imageRect.contains(px, py)) {
uint8 *wizd = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), dataPtr, state, 0);
assert(wizd);
FloodFillState *ffs = new FloodFillState;
ffs->fillLineTableCount = h * 2;
ffs->fillLineTable = new FloodFillLine[ffs->fillLineTableCount];
ffs->color2 = color;
ffs->dst = wizd;
ffs->dst_w = w;
ffs->dst_h = h;
ffs->srcBox = imageRect;
ffs->fillLineTableCur = &ffs->fillLineTable[0];
ffs->fillLineTableEnd = &ffs->fillLineTable[ffs->fillLineTableCount];
if (px < 0 || py < 0 || px >= w || py >= h) {
ffs->color1 = color;
} else {
ffs->color1 = *(wizd + py * w + px);
}
debug(0, "floodFill() x=%d y=%d color1=%d", px, py, ffs->color1);
if (ffs->color1 != color) {
floodFillProcess(px, py, ffs, floodFillPixelCheck);
}
delete[] ffs->fillLineTable;
delete ffs;
}
}
}
_vm->_res->setModified(rtImage, params->img.resNum);
}
} // End of namespace Scumm
#endif // ENABLE_HE
| project-cabal/cabal | engines/scumm/he/floodfill_he.cpp | C++ | gpl-2.0 | 8,174 |
/* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
DROP PROCEDURE IF EXISTS ps_setup_show_enabled_consumers;
DELIMITER $$
CREATE DEFINER='root'@'localhost' PROCEDURE ps_setup_show_enabled_consumers ()
COMMENT '
Description
-----------
Shows all currently enabled consumers.
Parameters
-----------
None
Example
-----------
mysql> CALL sys.ps_setup_show_enabled_consumers();
+---------------------------+
| enabled_consumers |
+---------------------------+
| events_statements_current |
| global_instrumentation |
| thread_instrumentation |
| statements_digest |
+---------------------------+
4 rows in set (0.05 sec)
'
SQL SECURITY INVOKER
DETERMINISTIC
READS SQL DATA
BEGIN
SELECT name AS enabled_consumers
FROM performance_schema.setup_consumers
WHERE enabled = 'YES';
END$$
DELIMITER ;
| syaroslavtsev/mysql-sys | procedures/ps_setup_show_enabled_consumers.sql | SQL | gpl-2.0 | 1,784 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="Content-Language" content="zh-CN"><link href="stylesheet.css" media="all" rel="stylesheet" type="text/css">
<title>pg_database</title>
<script>var _hmt=_hmt||[]; (function(){ var hm=document.createElement("script"); hm.src="//hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s=document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm,s); })();</script>
</head><body class="SECT1">
<div>
<table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><th colspan="5" align="center" valign="bottom">PostgreSQL 8.2.3 中文文档</th></tr>
<tr><td width="10%" align="left" valign="top"><a href="catalog-pg-conversion.html" accesskey="P">后退</a></td><td width="10%" align="left" valign="top"><a href="catalogs.html">快退</a></td><td width="60%" align="center" valign="bottom">章43. 系统表</td><td width="10%" align="right" valign="top"><a href="catalogs.html">快进</a></td><td width="10%" align="right" valign="top"><a href="catalog-pg-depend.html" accesskey="N">前进</a></td></tr>
</table>
<hr align="LEFT" width="100%"></div>
<div class="SECT1"><h1 class="SECT1"><a name="CATALOG-PG-DATABASE">43.15. <tt class="STRUCTNAME">pg_database</tt></a></h1><a name="AEN63288"></a>
<p><tt class="STRUCTNAME">pg_database</tt> 表存储关于可用数据库的信息。数据库是用 <a href="sql-createdatabase.html"><i>CREATE DATABASE</i></a> 创建的。参考<a href="managing-databases.html">章19</a>获取一些参数的详细含义。</p>
<p>和大多数系统表不同,<tt class="STRUCTNAME">pg_database</tt> 是在一个集群里的所有数据库共享的:每个集群只有一份 <tt class="STRUCTNAME">pg_database</tt> 拷贝,而不是每个数据库一份。</p>
<div class="TABLE"><a name="AEN63297"></a>
<p><b>表43-15. <tt class="STRUCTNAME">pg_database</tt> 字段</b></p>
<table border="1" class="CALSTABLE"><col><col><col><col>
<thead>
<tr><th>名字</th><th>类型</th><th>引用</th><th>描述</th></tr>
</thead>
<tbody>
<tr><td><tt class="STRUCTFIELD">datname</tt></td><td><tt class="TYPE">name</tt></td><td> </td><td>数据库名字</td></tr>
<tr><td><tt class="STRUCTFIELD">datdba</tt></td><td><tt class="TYPE">oid</tt></td><td><tt class="LITERAL"><a href="catalog-pg-authid.html"><tt class="STRUCTNAME">pg_authid</tt></a>.oid</tt></td><td>数据库所有人,通常为其创建者</td></tr>
<tr><td><tt class="STRUCTFIELD">encoding</tt></td><td><tt class="TYPE">int4</tt></td><td> </td><td>数据库的字符编码方式(<code class="FUNCTION">pg_encoding_to_char()</code> 能够将这个数字转换为相应的编码名称)</td></tr>
<tr><td><tt class="STRUCTFIELD">datistemplate</tt></td><td><tt class="TYPE">bool</tt></td><td> </td><td>如果为真则此数据库可以用于 <tt class="COMMAND">CREATE DATABASE</tt> 的 <tt class="LITERAL">TEMPLATE</tt> 子句,把新数据库创建为此数据库的克隆。</td></tr>
<tr><td><tt class="STRUCTFIELD">datallowconn</tt></td><td><tt class="TYPE">bool</tt></td><td> </td><td>如果为假则没有人可以连接到这个数据库。这个字段用于保护 <tt class="LITERAL">template0</tt> 数据库不被更改。</td></tr>
<tr><td><tt class="STRUCTFIELD">datconnlimit</tt></td><td><tt class="TYPE">int4</tt></td><td> </td><td>设置该数据库上允许的最大并发连接数,-1 表示无限制。</td></tr>
<tr><td><tt class="STRUCTFIELD">datlastsysoid</tt></td><td><tt class="TYPE">oid</tt></td><td> </td><td>数据库里最后一个系统 OID ;对 <span class="APPLICATION">pg_dump</span> 特别有用。</td></tr>
<tr><td><tt class="STRUCTFIELD">datfrozenxid</tt></td><td><tt class="TYPE">xid</tt></td><td> </td><td>该数据库中中所有在这个之前的事务 ID 已经被一个固定的("frozen")事务 ID 替换。这用于跟踪该数据库是否需要为了防止事务 ID 重叠或者允许收缩 <tt class="LITERAL">pg_clog</tt> 而进行清理。它是针对每个表的 <tt class="STRUCTNAME">pg_class</tt>.<tt class="STRUCTFIELD">relfrozenxid</tt> 中的最小值。</td></tr>
<tr><td><tt class="STRUCTFIELD">dattablespace</tt></td><td><tt class="TYPE">oid</tt></td><td><tt class="LITERAL"><a href="catalog-pg-tablespace.html"><tt class="STRUCTNAME">pg_tablespace</tt></a>.oid</tt></td><td>该数据库的缺省表空间。在这个数据库里,所有 <tt class="STRUCTNAME">pg_class</tt>.<tt class="STRUCTFIELD">reltablespace</tt> 为零的表都将保存在这个表空间里;特别要指出的是,所有非共享的系统表也都存放在这里。</td></tr>
<tr><td><tt class="STRUCTFIELD">datconfig</tt></td><td><tt class="TYPE">text[]</tt></td><td> </td><td>运行时配置变量的会话缺省值</td></tr>
<tr><td><tt class="STRUCTFIELD">datacl</tt></td><td><tt class="TYPE">aclitem[]</tt></td><td> </td><td>访问权限,参阅 <a href="sql-grant.html"><i>GRANT</i></a> 和 <a href="sql-revoke.html"><i>REVOKE</i></a> 获取详细描述。</td></tr>
</tbody>
</table>
</div>
</div>
<div>
<hr align="LEFT" width="100%">
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td width="33%" align="left" valign="top"><a href="catalog-pg-conversion.html" accesskey="P">后退</a></td><td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">首页</a></td><td width="33%" align="right" valign="top"><a href="catalog-pg-depend.html" accesskey="N">前进</a></td></tr>
<tr><td width="33%" align="left" valign="top"><tt class="STRUCTNAME">pg_conversion</tt></td><td width="34%" align="center" valign="top"><a href="catalogs.html" accesskey="U">上一级</a></td><td width="33%" align="right" valign="top"><tt class="STRUCTNAME">pg_depend</tt></td></tr>
</table>
</div>
</body></html> | Pengfei-Gao/develop-reference-data | www.jinbuguo.com/postgresql/menu823/catalog-pg-database.html | HTML | gpl-2.0 | 6,001 |
if (Meteor.isServer) {
var
//// A lookup-table whose keys are generated each time an ‘you.register’ form is rendered using the `babelslug()` method.
//// The key is a babelslug, followed by hyphen, followed by a Meteor connection ID (like a session ID for anon users).
//// The value is the unix timestamp in milliseconds, which allows us to clear out old and unused babelslugs.
//// Two examples are shown here:
recentBabelslugs = { // @todo for a multi-servo project, move this functionality to a shared mongoDB collection
// 'MagentaMouse-KukNJw4d4vjGzzrQa': 1409341347912,
// 'BlueChessCat-YYJWMWTPq7RFWdKr6': 1409341399283
}
//// Clear out stale elements in the `recentBabelslugs` lookup-table.
, recentBabelslugsHousekeeping = function () {
var key
, now = Date.now()
;
for (key in recentBabelslugs) {
if (15 * 60 * 1000 < now - recentBabelslugs[key]) { // allow a user 15 minutes to fill in the registration form
delete recentBabelslugs[key];
}
}
}
//// Check how many times a given `username` exists in the user database. If all’s well, this should only ever return `0` or `1`.
, usernameCount = function (username) {
return Meteor.users.find({ 'profile.username': username }).count();
}
//// BabelSlug, from Rich Plastow’s work, 2014-02-09.
, ucs2 = [
[ // animal
{ en:'slug' ,es:'babosa' ,ru:'\u0441\u043B\u0438\u0437\u043D\u044F\u043A',fr:'limace' ,zh:'\u86DE\u8753',ar:'\u064A\u0631\u0642\u0627\u0646\u0629' }
, { en:'mouse' ,es:'rat\u00F3n',ru:'\u043C\u044B\u0448\u044C' ,fr:'souris' ,zh:'\u9F20\u6807',ar:'\u0641\u0623\u0631' }
, { en:'cow' ,es:'vaca' ,ru:'\u043A\u043E\u0440\u043E\u0432\u0430' ,fr:'vache' ,zh:'\u725B' ,ar:'\u0628\u0642\u0631\u0629' }
, { en:'cat' ,es:'gato' ,ru:'\u043A\u043E\u0448\u043A\u0430' ,fr:'chat' ,zh:'\u732B' ,ar:'\u0642\u0637' }
, { en:'rabbit',es:'conejo' ,ru:'\u043A\u0440\u043E\u043B\u0438\u043A' ,fr:'lapin' ,zh:'\u5154' ,ar:'\u0623\u0631\u0646\u0628' }
, { en:'deer' ,es:'ciervo' ,ru:'\u043E\u043B\u0435\u043D\u044C' ,fr:'cerf' ,zh:'\u9E7F' ,ar:'\u0623\u064A\u0644' }
, { en:'bear' ,es:'oso' ,ru:'\u043C\u0435\u0434\u0432\u0435\u0434\u044C',fr:'ours' ,zh:'\u718A' ,ar:'\u062F\u064F\u0628\u0651' }
, { en:'frog' ,es:'rana' ,ru:'\u043B\u044F\u0433\u0443\u0448\u043A\u0430',fr:'grenouille',zh:'\u9752\u86D9',ar:'\u0636\u0641\u062F\u0639' }
]
// , [ // texture
// { en:'-' ,es:'-' ,ru:'-' ,fr:'-' ,zh:'-' ,ar:'-' }
// , { en:'dotted' ,es:'punteado',ru:[1087,1091,1085,1082,1090,1080,1088,1085,1099,1081],fr:'pointill\u00E9',zh:[26001,28857],ar:[1605,1606,1602,1591] }
// , { en:'striped',es:'rayas' ,ru:[1087,1086,1083,1086,1089,1072,1090,1099,1081] ,fr:'ray\u00E9' ,zh:[26465,32441],ar:[1605,1602,1604,1605] }
// , { en:'chess' ,es:'ajedrez' ,ru:[1096,1072,1093,1084,1072,1090,1099] ,fr:'\u00E9checs' ,zh:[26827] ,ar:[1588,1591,1585,1606,1580] }
// ]
, [ // color1
{ en:'-' ,es:'-' ,ru:'-' ,fr:'-' ,zh:'-' ,ar:'-' }
, { en:'red' ,es:'rojo' ,ru:[1082,1088,1072,1089,1085,1099,1081] ,fr:'rouge' ,zh:[32418] ,ar:[1571,1581,1605,1585] }
, { en:'orange' ,es:'naranja' ,ru:[1086,1088,1072,1085,1078,1077,1074,1099,1081],fr:'orange' ,zh:[27225] ,ar:[1575,1604,1576,1585,1578,1602,1575,1604,1610] }
, { en:'yellow' ,es:'amarillo',ru:[1078,1077,1083,1090,1099,1081] ,fr:'jaune' ,zh:[40644] ,ar:[1571,1589,1601,1585] }
, { en:'green' ,es:'verde' ,ru:[1079,1077,1083,1077,1085,1099,1081] ,fr:'vert' ,zh:[32511] ,ar:[1571,1582,1590,1585] }
// , { en:'cyan' ,es:'cian' ,ru:[1075,1086,1083,1091,1073,1086,1081] ,fr:'cyan' ,zh:[38738] ,ar:[1587,1605,1575,1608,1610] }
, { en:'blue' ,es:'azul' ,ru:[1089,1080,1085,1080,1081] ,fr:'bleu' ,zh:[34013] ,ar:[1571,1586,1585,1602] }
, { en:'purple' ,es:'magenta' ,ru:[1087,1091,1088,1087,1091,1088,1085,1099,1081],fr:'magenta',zh:[27915,32418],ar:[1571,1585,1580,1608,1575,1606,1610] } // @todo translate purple (these are for magenta)
]
, [ // emotion @todo convert remaining languages from 2014-Work/BabelSlug/README.md
{ en:'-' ,es:'-' ,fr:'-' }
, { en:'happy' ,es:'feliz' ,fr:'heureux' }
// , { en:'sad' ,es:'triste' ,fr:'triste' }
, { en:'laughing' ,es:'risa' ,fr:'rire' }
, { en:'sleepy' ,es:'soñoliento' ,fr:'somnolent' }
, { en:'surprised',es:'sorprendido',fr:'étonné' }
// , { en:'playful' ,es:'juguetón' ,fr:'espiègle' }
, { en:'confused' ,es:'confundido' ,fr:'embrouillé' }
]
]
//// Prepare an empty cache, which may contain HTML entities converted from `ucs2`, if required.
, html = (function () {
var i, j, l, m ,html = {};
for (i=0, l=ucs2.length; i<l; i++) {
html[i] = [];
for (j=0, m=ucs2[i].length; j<m; j++) {
html[i][j] = {};
}
}
return html
} ())
// !!!! `numberToPhrase()`, then `i` becomes `num`, and then `ucs2` becomes an array, and `i` is iterator !!!!
, numberToPhrase = function (number, options) {
var key, len, rem, word
, num = ~~(number < 0 ? -number : number) // ensure `num` is a positive whole number, or zero
, opt = options || {}
, l18n = ucs2[0][0][opt.l18n] ? opt.l18n : 'en' // set to English if the localization option is invalid or unspecified
, phrase = []
;
for (key in ucs2) {
len = ucs2[key].length;
rem = num % len;
if (! opt.format || 'ucs2' === opt.format) {
word = ucs2[key][rem][l18n];
// console.log('key ' + key + ' format ' + 'ucs2' + ' word ' + word);
} else if ('html' === opt.format) {
word = html[key][rem][l18n];
if (! word) {
word = html[key][rem][l18n] = ucs2[key][rem][l18n].replace(/[\u00A0-\u2666]/g, function(c) {
return '&#' + c.charCodeAt(0) + ';';
});
// console.log('ADD TO CACHE key ' + key + ' format ' + 'html' + ' word ' + word);
} else {
// console.log('GET IN CACHE key ' + key + ' format ' + 'html' + ' word ' + word);
}
} else {
// @todo format error
}
if ('-' !== word) { phrase.unshift(word); }
num = ~~(num / len); // prepare for the next part in `ucs2`
if (0 === num) { break; } // low numbers don't need to step through every section in `ucs2`
}
return phrase.join('-');
}
;
Meteor.methods({
babelslug: function () {
var i, key, babelslug;
if (this.isSimulation) { return; } // clientside stub (return value is ignored)
//// Housekeeping on the `recentBabelslugs` lut.
recentBabelslugsHousekeeping();
//// Try, 200 times, to find a username which has not been taken. @todo this is quite brute-force ... can we come up with a more elegant solution?
for (i=200; i>0; i--) {
babelslug = numberToPhrase( Math.floor(Math.random() * 50000) );
if ( 3 === babelslug.split('-').length && ! recentBabelslugs[babelslug] && ! usernameCount(babelslug) ) { break; } // we are only using three-part usernames at present
}
if (! i) { throw new Meteor.Error(500, "Cannot generate a username! Please email " + Config.about.webmaster); } // @todo check `(! i)` can ever be truthy
recentBabelslugs[babelslug] = { // later, when the form is submitted, we will check that the babelslug value is expected
now: Date.now() // allows `recentBabelslugsHousekeeping()` to find stale babelslugs
, cid: this.connection.id
}
return babelslug + '_' + this.connection.id; // @todo is `this.connection.id` ever some unexpected value, for example `null`?
}
});
Accounts.onCreateUser(function (options, user) {
var babelslug, connectionId;
//// Housekeeping on the `recentBabelslugs` lut.
recentBabelslugsHousekeeping();
//// Validate the value of `<input id="AT_field_you-babelslug" ...>`.
babelslug = options.profile['you-babelslug'].split('_')[0];
connectionId = options.profile['you-babelslug'].split('_')[1];
if (! babelslug || ! connectionId) {
throw new Meteor.Error(500, "The ‘username’ field is invalid."); // @todo better error-code than 500?
}
if (! recentBabelslugs[babelslug]) {
throw new Meteor.Error(500, "Your registration form expired after 15 minutes. Please refresh the browser and try again."); // The ‘username’ value is unexpected, so this may actually be a hack attempt
}
if ( usernameCount(babelslug) ) {
throw new Meteor.Error(500, "The ‘username’ is already in use."); // prevent two `Meteor.user` records having the same username, which could happen on a multi-servo project, until we change `recentBabelslugs` to a shared mongoDB collection @todo
}
//// Remove the babelslug, as it’s not needed any more.
delete recentBabelslugs[babelslug];
//// Record the username (‘[email protected]’ gets a special username).
options.profile = options.profile || {};
options.profile.username = '[email protected]' === options.email ? 'red-cat' : babelslug;
//// Record other registration data.
if (options.profile['you-age-group-code']) { options.profile.agc = options.profile['you-age-group-code']; }
if (options.profile['you-based-in-code']) { options.profile.bic = options.profile['you-based-in-code']; }
if (options.profile['you-hear-about-code']) { options.profile.hac = options.profile['you-hear-about-code']; }
if (options.profile['you-hear-about-text']) { options.profile.hat = options.profile['you-hear-about-text']; }
if (options.profile['you-newsletter-opt']) { options.profile.nlo = options.profile['you-newsletter-opt']; }
//// The registration is valid, so record it as usual. http://docs.meteor.com/#accounts_oncreateuser
user.profile = options.profile;
return user;
});
}
| loopdotcoop/looptopia | you/you.create-user.js | JavaScript | gpl-2.0 | 11,763 |
#pragma once
#include <string>
class GameSettings
{
private:
int m_nFPS = 60;
std::string m_strPath = "../Settings.ini";
private:
GameSettings();
void Load();
void Save();
static GameSettings& GetInstance();
public:
static int FPS();
};
| sam1018/PacMan | PacMan/PacMan/GameSettings.h | C | gpl-2.0 | 269 |
package org.rebecalang.modeltransformer.ros.timedrebeca;
import java.util.HashMap;
import java.util.Map;
import org.rebecalang.compiler.modelcompiler.corerebeca.CoreRebecaTypeSystem;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.BinaryExpression;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.CastExpression;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.DotPrimary;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.Expression;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.FieldDeclaration;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.Literal;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.MsgsrvDeclaration;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.NonDetExpression;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.PlusSubExpression;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.PrimaryExpression;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.ReactiveClassDeclaration;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.RebecInstantiationPrimary;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.RebecaModel;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.TermPrimary;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.TernaryExpression;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.UnaryExpression;
import org.rebecalang.compiler.modelcompiler.corerebeca.objectmodel.VariableDeclarator;
import org.rebecalang.compiler.modelcompiler.timedrebeca.TimedRebecaTypeSystem;
import org.rebecalang.compiler.utils.CodeCompilationException;
import org.rebecalang.compiler.utils.ExceptionContainer;
import org.rebecalang.compiler.utils.Pair;
import org.rebecalang.modeltransformer.StatementTransformingException;
import org.rebecalang.modeltransformer.ros.Utilities;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class TimedRebeca2ROSExpressionTransformer {
public final static String NEW_LINE = "\r\n";
public final static String TAB = "\t";
static Integer i = 0;
private String modelName;
private ReactiveClassDeclaration rc;
private RebecaModel rebecaModel;
private Map <Pair<String, String>, String> methodCalls = new HashMap<Pair<String, String>, String>();
@Autowired
TimedRebecaTypeSystem timedRebecaTypeSystem;
@Autowired
ExceptionContainer exceptionContainer;
public void prepare(String modelName, ReactiveClassDeclaration rc, RebecaModel rebecaModel) {
this.modelName = modelName;
this.rebecaModel = rebecaModel;
this.rc = rc;
}
public String translate(Expression expression) {
String retValue = "";
if (expression instanceof TernaryExpression) {
TernaryExpression tExpression = (TernaryExpression)expression;
Expression condition = tExpression.getCondition();
retValue = "(" + (translate(condition)) + ")";
retValue += " ? " + "(" + translate(tExpression.getLeft()) + ")";
retValue += " : " + "(" + translate(tExpression.getRight()) + ")";
} else if (expression instanceof BinaryExpression) {
BinaryExpression bExpression = (BinaryExpression) expression;
String op = bExpression.getOperator();
retValue = translate(bExpression.getLeft()) +
" " + op + " " + translate(bExpression.getRight());
} else if (expression instanceof UnaryExpression) {
UnaryExpression uExpression = (UnaryExpression) expression;
retValue = uExpression.getOperator() + " " + translate(uExpression.getExpression());
} else if (expression instanceof CastExpression) {
exceptionContainer.addException(new StatementTransformingException("This version of transformer does not supprt " +
"\"cast\" expression.",
expression.getLineNumber(), expression.getCharacter()));
} else if (expression instanceof NonDetExpression) {
NonDetExpression nonDetExpression = (NonDetExpression)expression;
int numberOfChoices = nonDetExpression.getChoices().size();
retValue += nonDetExpression.getType().getTypeName();
retValue += "int numberOfChoices = " + Integer.toString(numberOfChoices) + ";" + NEW_LINE;
retValue += "int choice = " + "rand() % " + Integer.toString(numberOfChoices) + ";" + NEW_LINE;
int index = numberOfChoices;
for (Expression nonDetChoice : ((NonDetExpression)expression).getChoices()) {
retValue += "if (" + "choice ==" + Integer.toString(numberOfChoices - index) + ")" + NEW_LINE;
retValue += ((NonDetExpression)nonDetChoice);
index ++;
}
} else if (expression instanceof Literal) {
Literal lExpression = (Literal) expression;
retValue = lExpression.getLiteralValue();
if (retValue.equals("null"))
retValue = "\"dummy\"";
} else if (expression instanceof PlusSubExpression) {
retValue = translate(((PlusSubExpression)expression).getValue()) +
((PlusSubExpression)expression).getOperator();
} else if (expression instanceof PrimaryExpression) {
PrimaryExpression pExpression = (PrimaryExpression) expression;
retValue = translatePrimaryExpression(pExpression);
}
else {
exceptionContainer.addException(
new StatementTransformingException("Unknown translation rule for expression type "
+ expression.getClass(), expression.getLineNumber(), expression.getCharacter()));
}
return retValue;
}
protected String translatePrimaryExpression(PrimaryExpression pExpression) {
String retValue = "";
if (pExpression instanceof DotPrimary) {
DotPrimary dotPrimary = (DotPrimary) pExpression;
retValue = translateDotPrimary(dotPrimary);
} else if (pExpression instanceof TermPrimary) {
retValue = translatePrimaryTermExpression((TermPrimary) pExpression);
} else if (pExpression instanceof RebecInstantiationPrimary) {
RebecInstantiationPrimary rip = (RebecInstantiationPrimary) pExpression;
boolean hasMoreVariable = false;
String args = "";
try {
ReactiveClassDeclaration rcd = (ReactiveClassDeclaration) timedRebecaTypeSystem.getMetaData(rip.getType());
if (!rcd.getStatevars().isEmpty()) {
args += " , ";
for (FieldDeclaration fd : rcd.getStatevars()) {
for (VariableDeclarator vd : fd.getVariableDeclarators()) {
hasMoreVariable = true;
String typeInit = fd.getType() == CoreRebecaTypeSystem.BOOLEAN_TYPE ? "false" :
fd.getType().canTypeCastTo(CoreRebecaTypeSystem.INT_TYPE) ? "0" : "\"dummy\"";
args += "(" + rcd.getName() + "-" + vd.getVariableName() + " |-> " + typeInit + ") " ;
}
}
}
if (!hasMoreVariable)
args += "emptyValuation";
} catch (CodeCompilationException e) {
e.printStackTrace();
}
args += ",";
hasMoreVariable = false;
String typeName = rip.getType().getTypeName();
for (Expression expression : rip.getBindings()) {
args += " arg(" + translate(expression) + ")";
hasMoreVariable = true;
}
for (Expression expression : rip.getArguments()) {
args += " arg(" + translate(expression) + ")";
hasMoreVariable = true;
}
if (!hasMoreVariable)
args += "noArg";
retValue = " new (" + typeName + args + ")";
} else {
exceptionContainer.addException(new StatementTransformingException("Unknown translation rule for initializer type "
+ pExpression.getClass(), pExpression.getLineNumber(), pExpression.getCharacter()));
}
return retValue;
}
private String translateDotPrimary(DotPrimary dotPrimary) {
String retValue = "";
if (!(dotPrimary.getLeft() instanceof TermPrimary) || !(dotPrimary.getRight() instanceof TermPrimary)) {
exceptionContainer.addException(new StatementTransformingException("This version of transformer does not supprt " +
"nested record access expression.",
dotPrimary.getLineNumber(), dotPrimary.getCharacter()));
} else {
// TODO: Modified by Ehsan as the return vlaue type of message servers is always set to MSGSRV_TYPE
// if(TypesUtilities.getInstance().getSuperType(dotPrimary.getRight().getType()) == TypesUtilities.MSGSRV_TYPE) {
if(dotPrimary.getRight().getType() == CoreRebecaTypeSystem.MSGSRV_TYPE) {
retValue = mapToROSPublishing(dotPrimary);
}
}
return retValue;
}
private String mapToROSPublishing(DotPrimary dotPrimary) {
String retValue = "";
/* map to ROS Publishing */
retValue = modelName + "::" + ((TermPrimary)dotPrimary.getRight()).getName()
+ " " + "pubMsg" + i.toString() + ";" + NEW_LINE;
/* fill the ROS message fields with the arguments to be published */
int argumentIndex = 0;
for (Expression expression : ((TermPrimary)dotPrimary.getRight()).getParentSuffixPrimary().getArguments()) {
ReactiveClassDeclaration toClass = null;
TermPrimary toRebec = (TermPrimary)dotPrimary.getLeft();
toClass = Utilities.findKnownReactiveClass(rc, toRebec.getName(), rebecaModel);
String toMsgsrvName = ((TermPrimary)dotPrimary.getRight()).getName();
MsgsrvDeclaration toMsgsrv = Utilities.findTheMsgsrv(toClass, toMsgsrvName);
String argumentName = toMsgsrv.getFormalParameters().get(argumentIndex).getName();
retValue += "pubMsg" + i.toString() + "." + argumentName + " = " + translate(expression) + ";" + NEW_LINE;
argumentIndex ++;
}
retValue += "pubMsg" + i.toString() + "." + "sender" + "=" + "sender" + ";" + NEW_LINE;
retValue += ((TermPrimary) dotPrimary.getLeft()).getName() + "_" + ((TermPrimary)dotPrimary.getRight()).getName() + "_pub"
+ "." + "publish(" + "pubMsg" + i.toString() + ")" + ";" + NEW_LINE;
i ++; /* to prevent from repeated names */
/* end of publishing */
/* storing the name of callee rebec and the name of called msgsrv in order to declare publishers */
Pair<String, String> methodCall = new Pair<String, String>(
((TermPrimary)dotPrimary.getLeft()).getName(), ((TermPrimary)dotPrimary.getRight()).getName() );
methodCalls.put(methodCall, "");
//ReactiveClassDeclaration rcd = (ReactiveClassDeclaration) TransformingContext.getInstance().lookupInContext("current-reactive-class");
//retValue = ((TermPrimary) dotPrimary.getLeft()).getName();
//String typeName = TypesUtilities.getTypeName(((TermPrimary) dotPrimary.getLeft()).getType());
//System.out.println(typeName);
return retValue;
}
private String translatePrimaryTermExpression(TermPrimary pExpression) {
String retValue = "";
if(pExpression.getName().equals("assertion") ||
pExpression.getName().equals("after") ||
pExpression.getName().equals("deadline")){
return retValue;
}
if(pExpression.getName().equals("delay"))
retValue += "sleep";
else if(pExpression.getName().equals("sender"))
return "thisMsg.sender";
else
retValue += pExpression.getName();
if( pExpression.getParentSuffixPrimary() != null) {
retValue += "(";
for(Expression argument: pExpression.getParentSuffixPrimary().getArguments()) {
retValue += translate(argument) + ",";
}
if(! pExpression.getParentSuffixPrimary().getArguments().isEmpty()) {
retValue = retValue.substring(0, retValue.length() - 1);
}
retValue += ")";
}
//To support movement in ROS
if (retValue.compareTo("Move(1,0)")==0)
{
//ROSCode to publish on CM_Vel topic
}
else if (retValue.compareTo("Move(0,1)")==0)
{
//ROSCode to publish on CM_Vel topic
}
else if (retValue.compareTo("Move(-1,0)")==0)
{
//ROSCode to publish on CM_Vel topic
}
else if (retValue.compareTo("Move(0,-1)")==0)
{
//ROSCode to publish on CM_Vel topic
}
else if(retValue.compareTo("Move(1,1)")==0)
{
//ROSCode to publish on CM_Vel topic
}
else if(retValue.compareTo("Move(1,-1)")==0)
{
//ROSCode to publish on CM_Vel topic
}
else if(retValue.compareTo("Move(-1,1)")==0)
{
//ROSCode to publish on CM_Vel topic
}
else if(retValue.compareTo("Move(-1,-1)")==0)
{
//ROSCode to publish on CM_Vel topic
}
/* to support arrays */
for(Expression ex: pExpression.getIndices()) {
retValue += "[" + translate(ex) + "]";
}
return retValue;
}
public Map <Pair<String, String>, String> getMethodCalls() {
return methodCalls;
}
} | rebeca-lang/org.rebecalang.modeltransformer | src/main/java/org/rebecalang/modeltransformer/ros/timedrebeca/TimedRebeca2ROSExpressionTransformer.java | Java | gpl-2.0 | 12,240 |
/*
* Copyright (C) 2007 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License v.2.1.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _LVM_UTIL_H
#define _LVM_UTIL_H
#define min(a, b) ({ typeof(a) _a = (a); \
typeof(b) _b = (b); \
(void) (&_a == &_b); \
_a < _b ? _a : _b; })
#define max(a, b) ({ typeof(a) _a = (a); \
typeof(b) _b = (b); \
(void) (&_a == &_b); \
_a > _b ? _a : _b; })
#define uninitialized_var(x) x = x
#define KERNEL_VERSION(major, minor, release) (((major) << 16) + ((minor) << 8) + (release))
#endif
| SteamMOD/android_bootable_steam_device-mapper | lib/misc/util.h | C | gpl-2.0 | 958 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Mon Jul 03 11:07:20 PDT 2000 -->
<TITLE>
: Class Ins_dup2
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" ID="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" ID="NavBarCell1Rev"> <FONT ID="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../ojvm/loading/instructions/Ins_dup_x2.html"><B>PREV CLASS</B></A>
<A HREF="../../../ojvm/loading/instructions/Ins_dup2_x1.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="Ins_dup2.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#fields_inherited_from_class_ojvm.loading.instructions.Instruction">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
ojvm.loading.instructions</FONT>
<BR>
Class Ins_dup2</H2>
<PRE>
java.lang.Object
|
+--<A HREF="../../../ojvm/loading/instructions/Instruction.html">ojvm.loading.instructions.Instruction</A>
|
+--<B>ojvm.loading.instructions.Ins_dup2</B>
</PRE>
<HR>
<DL>
<DT>public class <B>Ins_dup2</B><DT>extends <A HREF="../../../ojvm/loading/instructions/Instruction.html">Instruction</A></DL>
<P>
The encapsulation of a dup2 instruction.
<P>
<HR>
<P>
<!-- ======== INNER CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="fields_inherited_from_class_ojvm.loading.instructions.Instruction"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" ID="TableSubHeadingColor">
<TD><B>Fields inherited from class ojvm.loading.instructions.<A HREF="../../../ojvm/loading/instructions/Instruction.html">Instruction</A></B></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD><CODE><A HREF="../../../ojvm/loading/instructions/Instruction.html#length">length</A>,
<A HREF="../../../ojvm/loading/instructions/Instruction.html#OPCODE">OPCODE</A>,
<A HREF="../../../ojvm/loading/instructions/Instruction.html#opcodeName">opcodeName</A></CODE></TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD><CODE><B><A HREF="../../../ojvm/loading/instructions/Ins_dup2.html#Ins_dup2(ojvm.loading.instructions.InstructionInputStream)">Ins_dup2</A></B>(<A HREF="../../../ojvm/loading/instructions/InstructionInputStream.html">InstructionInputStream</A> classFile)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../ojvm/loading/instructions/Ins_dup2.html#accept(ojvm.operations.InstructionVisitor)">accept</A></B>(<A HREF="../../../ojvm/operations/InstructionVisitor.html">InstructionVisitor</A> iv)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../ojvm/loading/instructions/Ins_dup2.html#toString()">toString</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_ojvm.loading.instructions.Instruction"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" ID="TableSubHeadingColor">
<TD><B>Methods inherited from class ojvm.loading.instructions.<A HREF="../../../ojvm/loading/instructions/Instruction.html">Instruction</A></B></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD><CODE><A HREF="../../../ojvm/loading/instructions/Instruction.html#getLength()">getLength</A>,
<A HREF="../../../ojvm/loading/instructions/Instruction.html#isActualInstruction()">isActualInstruction</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" ID="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD><CODE>clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="Ins_dup2(ojvm.loading.instructions.InstructionInputStream)"><!-- --></A><H3>
Ins_dup2</H3>
<PRE>
public <B>Ins_dup2</B>(<A HREF="../../../ojvm/loading/instructions/InstructionInputStream.html">InstructionInputStream</A> classFile)</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="accept(ojvm.operations.InstructionVisitor)"><!-- --></A><H3>
accept</H3>
<PRE>
public void <B>accept</B>(<A HREF="../../../ojvm/operations/InstructionVisitor.html">InstructionVisitor</A> iv)
throws <A HREF="../../../ojvm/data/JavaException.html">JavaException</A></PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD><A HREF="../../../ojvm/loading/instructions/Instruction.html#accept(ojvm.operations.InstructionVisitor)">accept</A> in class <A HREF="../../../ojvm/loading/instructions/Instruction.html">Instruction</A></DL>
</DD>
</DL>
<HR>
<A NAME="toString()"><!-- --></A><H3>
toString</H3>
<PRE>
public java.lang.String <B>toString</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD>toString in class java.lang.Object</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" ID="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" ID="NavBarCell1Rev"> <FONT ID="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../ojvm/loading/instructions/Ins_dup_x2.html"><B>PREV CLASS</B></A>
<A HREF="../../../ojvm/loading/instructions/Ins_dup2_x1.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="Ins_dup2.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#fields_inherited_from_class_ojvm.loading.instructions.Instruction">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
</BODY>
</HTML>
| adum/bitbath | hackjvm/src/doc/ojvm/loading/instructions/Ins_dup2.html | HTML | gpl-2.0 | 10,883 |
#!/usr/bin/perl
=head1 NAME
TMI pokal_sent.pl
=head1 SYNOPSIS
TBD
=head1 AUTHOR
[email protected]
=head1 CHANGELOG
2015-06-09 Thomas: Added Session Management
=head1 COPYRIGHT
Copyright (c) 2015, SocaPro Inc.
Created 2015-06-09
=cut
use lib '/tmapp/tmsrc/cgi-bin/';
use TMSession;
my $session = TMSession::getSession(tmi_login => 1);
my $trainer = $session->getUser();
my $leut = $trainer;
use CGI;
print "Content-type: text/html\n\n";
$query = new CGI;
$url = $query->param('url');
$tip[1] = $query->param('30....');
$tip[2] = $query->param('31....');
$tip[3] = $query->param('32....');
$tip[4] = $query->param('33....');
$tip[5] = $query->param('34....');
$tip[6] = $query->param('35....');
$tip[7] = $query->param('36....');
$tip[8] = $query->param('37....');
$tip[9] = $query->param('38....');
$tip[10] = $query->param('39....');
$tips = $query->param('tips');
$pokal = $query->param('pokal');
open(D7,"/tmdata/tmi/pokal/tip_status.txt");
$tip_status = <D7> ;
chomp $tip_status;
close(D7);
if ( $tip_status != 1 ) {
print "<title>Pokal Tipabgabe</title><font face=verdana size=2><br><br><br><br><br><b>Die Tipabgabefrist ist bereits abgelaufen ...\n";
exit ;
}
print "Content-type: text/html\n\n";
print "<title>Pokal Tipabgabe</title><body bgcolor=white text=black>\n";
print "<form name=Testform action=/cgi-mod/tmi/login.pl method=post></form>";
print "<script language=JavaScript>";
print" function AbGehts()";
print" {";
print" document.Testform.submit();";
print" }";
print" window.setTimeout(\"AbGehts()\",7000);";
print" </script>";
print "<p align=left><body bgcolor=white text=black link=darkred link=darkred> \n";
require "/tmapp/tmsrc/cgi-bin/tag.pl" ;
$agb = 0;
for ($x=1 ; $x<=10 ; $x++ ) {
if ( $tip[$x] ne "0&0" ) { $abg++ }
$reihe = $reihe . $tip[$x] . '.' ;
}
if ( $abg != $tips ) {
print "<font face=verdana size=2><br><br><br><br><br><b>Die Anzahl Ihrer abgegebenen Tips ist nicht korrekt ...<br>Sie haben $abg Tips anstatt der korrekten $tips Tips abgegeben .<br>Bitte kehren Sie zur Tipabgabe zurueck und korregieren Sie Ihre Tipabgabe .\n";
exit ;
}
$rf ="0";
$rx = "x" ;
my $liga = 0;
if ( $liga > 9 ) { $rf = "" }
$suche = '&'.$trainer.'&' ;
$s = 0;
open(D2,"/tmdata/tmi/history.txt");
while(<D2>) {
$s++;
if ($_ =~ /$suche/) {
@lor = split (/&/, $_);
$liga = $s ;
}
}
close(D2);
$id_verein = 0;
$y = 0;
for ( $x = 1; $x < 19; $x++ )
{
$y++;
chomp $lor[$y];
$data[$x] = $lor[$y];
$teams[$x] = $lor[$y];
$team[$x] = $lor[$y];
$y++;
chomp $lor[$y];
$datb[$x] = $lor[$y];
if ( $datb[$x] eq $trainer ) {$id = $x }
if ( $datb[$x] eq $trainer ) {$id_verein = (($liga-1)*18)+ $x }
if ( $datb[$x] eq $trainer ) {$verein = $data[$x] }
$y++;
chomp $lor[$y];
$datc[$x] = $lor[$y];
if ( $datb[$x] eq $trainer ) {$recipient = $datc[$x] }
}
$rr = 0;
$li=0;
$liga=0;
open(D2,"/tmdata/tmi/history.txt");
while(<D2>) {
$li++;
@vereine = split (/&/, $_);
$y = 0;
for ( $x = 1; $x < 19; $x++ )
{
$rr++;
$y++;
chomp $verein[$y];
$teams[$rr] = $vereine[$y];
$team[$rr] = $vereine[$y];
$y++;
chomp $verein[$y];
$datb[$rr] = $vereine[$y];
$y++;
chomp $verein[$y];
$datc[$rr] = $vereine[$y];
}
}
close(D2);
my $url = "/tmdata/tmi/pokal/tips/" ;
if ( $id_verein<10 ) { $url = $url . '0' }
if ( $id_verein<100 ) { $url = $url . '0' }
if ( $id_verein<1000 ) { $url = $url . '0' }
open(D7,"/tmdata/tmi/pokal/pokal_datum.txt");
$spielrunde_ersatz = <D7> ;
chomp $spielrunde_ersatz;
close(D7);
$runde = $spielrunde_ersatz;
$url=$url.$id_verein. '-' . $pokal . '-' . $runde . '.txt' ;
open(D2,">$url");
print D2 "$reihe\n";
close (D2) ;
print "<font face=verdana size=2><br><br><br><b> Ihre Tipabgabe wurde registriert .<br> Sie werden zu Ihrem LogIn Bereich weitergeleitet ...\n";
| tipmaster/tipmaster | tmsrc/cgi-bin/tmi/pokal/pokal_sent.pl | Perl | gpl-2.0 | 3,837 |
/*
* The ManaPlus Client
* Copyright (C) 2013-2015 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "utils/fuzzer.h"
#ifdef USE_FUZZER
#include "client.h"
#include "logger.h"
#include "settings.h"
#include "utils/stringutils.h"
#include "debug.h"
namespace
{
Logger *fuzz = nullptr;
int fuzzRand = 50;
} // namespace
void Fuzzer::init()
{
fuzz = new Logger;
fuzz->setLogFile(settings.localDataDir + "/fuzzer.log");
unsigned int sr = time(nullptr);
fuzz->log("Srand: %u", sr);
srand(sr);
}
bool Fuzzer::conditionTerminate(const char *const name)
{
if ((rand() % 100) <= fuzzRand)
{
fuzz->log("deleted: %s", name);
return true;
}
fuzz->log("passed: %s", name);
return false;
}
#endif
| Rawng/ManaPlus | src/utils/fuzzer.cpp | C++ | gpl-2.0 | 1,441 |
<?php
/**
* HTML attribute filters.
* Most of these functions filter the generic values from the framework found in hoot/functions/attr.php
* Attributes for non-generic structural elements (mostly theme specific) can be loaded in this file.
*
* @package hoot
* @subpackage responsive-brix
* @since responsive-brix 1.0
*/
/* Modify Original Filters from Framework */
add_filter( 'hoot_attr_content', 'hoot_theme_attr_content' );
add_filter( 'hoot_attr_sidebar', 'hoot_theme_attr_sidebar', 10, 2 );
/* New Theme Filters */
add_filter( 'hoot_attr_page_wrapper', 'hoot_theme_attr_page_wrapper' );
add_filter( 'hoot_attr_page_template_content', 'hoot_theme_page_template_content', 10, 2 );
/* Misc Filters */
add_filter( 'hoot_attr_social_icons_icon', 'hoot_theme_attr_social_icons_icon', 10, 2 );
/**
* Modify Main content container of the page attributes.
*
* @since 1.0
* @access public
* @param array $attr
* @return array
*/
function hoot_theme_attr_content( $attr ) {
$layout_class = hoot_main_layout_class( 'content' );
if ( !empty( $layout_class ) ) {
if ( isset( $attr['class'] ) )
$attr['class'] .= ' ' . $layout_class;
else
$attr['class'] = $layout_class;
}
return $attr;
}
/**
* Modify Sidebar attributes.
*
* @since 1.0
* @access public
* @param array $attr
* @param string $context
* @return array
*/
function hoot_theme_attr_sidebar( $attr, $context ) {
if ( !empty( $context ) && $context == 'primary' ) {
$layout_class = hoot_main_layout_class( 'primary-sidebar' );
if ( !empty( $layout_class ) ) {
if ( isset( $attr['class'] ) )
$attr['class'] .= ' ' . $layout_class;
else
$attr['class'] = $layout_class;
}
}
return $attr;
}
/**
* Page wrapper attributes.
*
* @since 1.0
* @access public
* @param array $attr
* @return array
*/
function hoot_theme_attr_page_wrapper( $attr ) {
$site_layout = hoot_get_mod( 'site_layout' );
$attr['class'] = ( $site_layout == 'boxed' ) ? 'grid site-boxed' : 'site-stretch';
$attr['class'] .= ' page-wrapper';
return $attr;
}
/**
* Main content container of the page attributes when a page template is being displayed
*
* @since 1.0
* @access public
* @param array $attr
* @param string $context
* @return array
*/
function hoot_theme_page_template_content( $attr, $context ) {
if ( is_page_template() && $context == 'none' ) {
$attr['id'] = 'content';
$attr['class'] = 'content sidebar-none';
$attr['role'] = 'main';
$attr['itemprop'] = 'mainContentOfPage';
$template_slug = basename( get_page_template(), '.php' );
$attr['class'] .= ' ' . sanitize_html_class( 'content-' . $template_slug );
} elseif ( function_exists( 'hoot_attr_content' ) ) {
// Get page attributes for main content container of a non-template regular page
$attr = apply_filters( "hoot_attr_content", $attr, $context );
}
return $attr;
}
/**
* Social Icons Widget - Icons
*
* @since 2.0
* @access public
* @param array $attr
* @param string $context
* @return array
*/
function hoot_theme_attr_social_icons_icon( $attr, $context ) {
$attr['class'] = 'social-icons-icon';
if ( $context != 'email' )
$attr['target'] = '_blank';
return $attr;
} | BellarmineBTDesigns/mashariki | wp-content/themes/responsive-brix/hoot-theme/attr.php | PHP | gpl-2.0 | 3,197 |
Photoshop files, icons, transparency images, anything that has been edited and is not an original photograph.
| usavarsity/usa.varsity-sub201511 | docs/resources/designs/readme.md | Markdown | gpl-2.0 | 110 |
var iconhead={
title:"Icon Heading Shortcode",
id :'oscitas-form-iconhead',
pluginName: 'iconhead',
setRowColors:false
};
(function() {
_create_tinyMCE_options(iconhead,800);
})();
function create_oscitas_iconhead(pluginObj){
if(jQuery(pluginObj.hashId).length){
jQuery(pluginObj.hashId).remove();
}
// creates a form to be displayed everytime the button is clicked
// you should achieve this using AJAX instead of direct html code like this
var iconhead_fa='';
/*if(ebs.ebs_fa_inclusion==1){
iconhead_fa='<h4>Font Awesome</h4><ul name="oscitas-heading-icon_servicebox" class="oscitas-heading-icon">'+ebsfaicons+'</ul>';
}*/
iconhead_fa='<h4>Font Awesome</h4><ul name="oscitas-heading-icon_servicebox" class="oscitas-heading-icon">'+ebsfaicons+'</ul>';
// creates a form to be displayed everytime the button is clicked
// you should achieve this using AJAX instead of direct html code like this
var form = jQuery('<div id="'+pluginObj.id+'" class="oscitas-container" title="'+pluginObj.title+'"><table id="gallery-table" class="form-table">\
<tr>\
<th><label for="oscitas-heading-icon">Select Icon:</label></th>\
<td><div id="click_icon_list" class="oscitas-icon-div"><span id="osc_show_icon"></span><span class="show-drop"></span></div><input type="hidden" id="oscitas-iconhead-icon" value=""><input type="hidden" id="oscitas-iconhead-icontype" value="">\
<div id="osc_show_iconlist" class="oscitas-icon" style="display:none;width:100%"><h4>Glyphicons</h4><ul name="oscitas-heading-icon_servicebox" class="oscitas-heading-icon">'+ebsicons+'</ul>'+iconhead_fa+'</div>\
</td>\
</tr>\
<tr>\
<th><label for="oscitas-iconhead-iconcolor">Icon Color:</label></th>\
<td><input type="text" name="label" id="oscitas-iconhead-iconcolor" class="color" value="" /><br />\
</td>\
</tr>\
<tr>\
<th><label for="oscitas-iconhead-headingtype">Heading Type:</label></th>\
<td><select name="oscitas-iconhead-headingtype" id="oscitas-iconhead-headingtype">\
<option value="h1">H1</option>\
<option value="h2">H2</option>\
<option value="h3">H3</option>\
<option value="h4">H4</option>\
<option value="h5">H5</option>\
<option value="h6">H6</option>\
</select><br />\
</td>\
</tr>\
<tr>\
<th><label for="oscitas-iconhead-heading">Heading:</label></th>\
<td><input type="text" name="oscitas-iconhead-heading" id="oscitas-iconhead-heading" value="Heading"/><br />\
</td>\
</tr>\
<tr>\
<th><label for="oscitas-iconhead-class">Custom Class:</label></th>\
<td><input type="text" name="line" id="oscitas-iconhead-class" value=""/><br />\
</td>\
</tr>\
</table>\
<p class="submit">\
<input type="button" id="oscitas-iconhead-submit" class="button-primary" value="Insert Icon Heading" name="submit" />\
</p>\
</div>');
var table = form.find('table');
jQuery('.glyphicon').css('display','inline');
form.appendTo('body').hide();
form.find('.color').wpColorPicker();
table.find('#click_icon_list').click(function(){
if(!jQuery(this).hasClass('osc_icon_showing')){
jQuery(this).addClass('osc_icon_showing')
table.find('#osc_show_iconlist').show();
} else{
jQuery(this).removeClass('osc_icon_showing')
table.find('#osc_show_iconlist').hide();
}
});
table.find('.oscitas-heading-icon li').click(function(){
var val=jQuery(this).attr('data-value');
var type=jQuery(this).attr('type');
table.find('.oscitas-heading-icon li').removeClass('osc_icon_selected');
jQuery(this).addClass('osc_icon_selected');
table.find('#click_icon_list').removeClass('osc_icon_showing');
table.find('#osc_show_iconlist').hide();
table.find('#osc_show_icon').removeClass().addClass(type).addClass(val);
table.find('#oscitas-iconhead-icon').val(val);
table.find('#oscitas-iconhead-icontype').val(type);
});
// // handles the click event of the submit button
form.find('#oscitas-iconhead-submit').click(function() {
// defines the options and their default values
// again, this is not the most elegant way to do this
// but well, this gets the job done nonetheless
var type=jQuery('#oscitas-iconhead-headingtype').val();
var cusclass='',style='';
if(table.find('#oscitas-iconhead-icon').val()!=''){
style=' style="' + table.find('#oscitas-iconhead-icon').val()+'"' ;
}
if(table.find('#oscitas-iconhead-icontype').val()!=''){
style+=' icontype="' + table.find('#oscitas-iconhead-icontype').val()+'"' ;
}
if(table.find('#oscitas-iconhead-iconcolor').val()!=''){
cusclass+= ' color="'+table.find('#oscitas-iconhead-iconcolor').val()+'"';
}
if(table.find('#oscitas-iconhead-class').val()!=''){
cusclass+= ' class="'+table.find('#oscitas-iconhead-class').val()+'"';
}
var shortcode = '[iconheading type="'+type+'"';
shortcode += style+cusclass ;
shortcode += ']'+table.find('#oscitas-iconhead-heading').val()+'[/iconheading]' ;
// inserts the shortcode into the active editor
tinyMCE.activeEditor.execCommand('mceInsertContent',0 , shortcode);
// closes Dialoguebox
close_dialogue(pluginObj.hashId);
});
}
| wjmendez/easy-bootstrap-shortcodes | shortcode/iconhead/iconhead_plugin.js | JavaScript | gpl-2.0 | 5,742 |
using System;
using System.Threading.Tasks;
using System.Windows.Threading;
using Disp = System.Windows.Threading.Dispatcher;
using Op = System.Windows.Threading.DispatcherOperation;
using DO = System.Windows.Threading.DispatcherObject;
using static System.Array;
namespace AphidUI
{
public static class DispatcherObjectExtension
{
public static void Invoke(this Disp dispatcher, Action action) =>
dispatcher.Invoke(action, Empty<object>());
public static void Sync(this Disp dispatcher, Action action) =>
dispatcher.Invoke(action, Empty<object>());
public static Op BeginInvoke(this Disp dispatcher, Action action, params object[] args) =>
dispatcher.BeginInvoke(action, args);
public static Op Async(this Disp dispatcher, Action action, params object[] args) =>
dispatcher.BeginInvoke(action, args);
public static Task Run(this Disp dispatcher, Action action, params object[] args) =>
dispatcher.BeginInvoke(action, args).Task;
public static TResult Invoke<TResult>(this Disp dispatcher, Func<TResult> action) =>
(TResult)dispatcher.Invoke(action, Empty<object>());
public static TResult Sync<TResult>(this Disp dispatcher, Func<TResult> action) =>
(TResult)dispatcher.Invoke(action, Empty<object>());
public static Op BeginInvoke(this DO @do, Action action, params object[] args) =>
@do.Dispatcher.BeginInvoke(action, args);
public static Op Async(this DO @do, Action action, params object[] args) =>
@do.Dispatcher.BeginInvoke(action, args);
public static Task Run(this DO @do, Action action, params object[] args) =>
@do.BeginInvoke(action, args).Task;
public static Task Run<TArg>(this DO @do, Action<TArg> action, TArg arg0) =>
@do.Dispatcher.BeginInvoke(action, new object[] { arg0 }).Task;
public static void Invoke(this DO @do, Action action) =>
@do.Dispatcher.Invoke(action, Empty<object>());
public static void Sync(this DO @do, Action action) =>
@do.Dispatcher.Invoke(action, Empty<object>());
public static TResult Invoke<TResult>(this DO @do, Func<TResult> action) =>
(TResult)@do.Dispatcher.Invoke(action, Empty<object>());
public static TResult Sync<TResult>(this DO @do, Func<TResult> action) =>
(TResult)@do.Dispatcher.Invoke(action, Empty<object>());
public static DispatcherProcessingDisabled DisableProcessing(this DO @do) =>
@do.Dispatcher.DisableProcessing();
}
}
| John-Leitch/Aphid | AphidUI/DispatcherObjectExtension.cs | C# | gpl-2.0 | 2,708 |
<?php
/**
* @desc Modify from component Media Manager of Joomla
*
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
/**
* Weblinks Weblink Controller
*
* @package Joomla
* @subpackage Weblinks
* @since 1.5
*/
class JaextmanagerControllerFile extends JaextmanagerController
{
/**
* Upload a file
*
* @since 1.5
*/
function upload()
{
global $mainframe;
// Check for request forgeries
JRequest::checkToken( 'request' ) or jexit( 'Invalid Token' );
$file = JRequest::getVar( 'Filedata', '', 'files', 'array' );
$folder = JRequest::getVar( 'folder', '', '', 'path' );
$format = JRequest::getVar( 'format', 'html', '', 'cmd');
$return = JRequest::getVar( 'return-url', null, 'post', 'base64' );
$err = null;
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
// Make the filename safe
jimport('joomla.filesystem.file');
$file['name'] = JFile::makeSafe($file['name']);
if (isset($file['name'])) {
$filepath = JPath::clean(JA_WORKING_DATA_FOLDER.DS.$folder.DS.strtolower($file['name']));
if (!RepoHelper::canUpload( $file, $err )) {
if ($format == 'json') {
jimport('joomla.error.log');
$log = &JLog::getInstance('upload.error.php');
$log->addEntry(array('comment' => 'Invalid: '.$filepath.': '.$err));
header('HTTP/1.0 415 Unsupported Media Type');
jexit('Error. Unsupported Media Type!');
} else {
JError::raiseNotice(100, JText::_($err));
// REDIRECT
if ($return) {
$mainframe->redirect(base64_decode($return).'&folder='.$folder);
}
return;
}
}
if (JFile::exists($filepath)) {
if ($format == 'json') {
jimport('joomla.error.log');
$log = &JLog::getInstance('upload.error.php');
$log->addEntry(array('comment' => 'File already exists: '.$filepath));
header('HTTP/1.0 409 Conflict');
jexit('Error. File already exists');
} else {
JError::raiseNotice(100, JText::_('Error. File already exists'));
// REDIRECT
if ($return) {
$mainframe->redirect(base64_decode($return).'&folder='.$folder);
}
return;
}
}
if (!JFile::upload($file['tmp_name'], $filepath)) {
if ($format == 'json') {
jimport('joomla.error.log');
$log = &JLog::getInstance('upload.error.php');
$log->addEntry(array('comment' => 'Cannot upload: '.$filepath));
header('HTTP/1.0 400 Bad Request');
jexit('Error. Unable to upload file');
} else {
JError::raiseWarning(100, JText::_('Error. Unable to upload file'));
// REDIRECT
if ($return) {
$mainframe->redirect(base64_decode($return).'&folder='.$folder);
}
return;
}
} else {
if ($format == 'json') {
jimport('joomla.error.log');
$log = &JLog::getInstance();
$log->addEntry(array('comment' => $folder));
jexit('Upload complete');
} else {
$mainframe->enqueueMessage(JText::_('Upload complete'));
// REDIRECT
if ($return) {
$mainframe->redirect(base64_decode($return).'&folder='.$folder);
}
return;
}
}
} else {
$mainframe->redirect('index.php', 'Invalid Request', 'error');
}
}
/**
* Deletes paths from the current path
*
* @param string $listFolder The image directory to delete a file from
* @since 1.5
*/
function delete()
{
global $mainframe;
JRequest::checkToken( 'request' ) or jexit( 'Invalid Token' );
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
// Get some data from the request
$tmpl = JRequest::getCmd( 'tmpl' );
$paths = JRequest::getVar( 'rm', array(), '', 'array' );
$folder = JRequest::getVar( 'folder', '', '', 'path');
// Initialize variables
$msg = array();
$ret = true;
if (count($paths)) {
foreach ($paths as $path)
{
if ($path !== JFile::makeSafe($path)) {
JError::raiseWarning(100, JText::_('Unable to delete:').htmlspecialchars($path, ENT_COMPAT, 'UTF-8').' '.JText::_('WARNFILENAME'));
continue;
}
$fullPath = JPath::clean(JA_WORKING_DATA_FOLDER.DS.$folder.DS.$path);
if (is_file($fullPath)) {
$ret |= !JFile::delete($fullPath);
} else if (is_dir($fullPath)) {
$files = JFolder::files($fullPath, '.', true);
$canDelete = true;
foreach ($files as $file) {
if ($file != 'index.html') {
$canDelete = false;
}
}
if ($canDelete) {
$ret |= !JFolder::delete($fullPath);
} else {
//allow remove folder not empty on local repository
$ret2 = JFolder::delete($fullPath);
$ret |= !$ret2;
if($ret2 == false) {
JError::raiseWarning(100, JText::_('Unable to delete:').$fullPath);
}
}
}
}
}
if ($ret) {
JError::raiseNotice(200, JText::_('Successfully delete a seleted item(s).'));
}
if ($tmpl == 'component') {
// We are inside the iframe
$mainframe->redirect('index.php?option='.JACOMPONENT.'&view=repolist&folder='.$folder.'&tmpl=component');
} else {
$mainframe->redirect('index.php?option='.JACOMPONENT.'&view=repolist&folder='.$folder);
}
}
function download()
{
global $mainframe;
JRequest::checkToken( 'request' ) or jexit( 'Invalid Token' );
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
// Get some data from the request
$tmpl = JRequest::getCmd( 'tmpl' );
$paths = JRequest::getVar( 'rm', array(), '', 'array' );
$folder = JRequest::getVar( 'folder', '', '', 'path');
// Initialize variables
$msg = array();
$ret = true;
if (count($paths)) {
foreach ($paths as $path)
{
$fullPath = JPath::clean(JA_WORKING_DATA_FOLDER.DS.$folder.DS.$path);
if(is_file($fullPath) && JFile::getExt($fullPath) == 'zip') {
// Set headers
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$fullPath");
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");
// Read the file from disk
readfile($fullPath);
exit();
}
}
}
if ($tmpl == 'component') {
// We are inside the iframe
$mainframe->redirect('index.php?option='.JACOMPONENT.'&view=repolist&folder='.$folder.'&tmpl=component');
} else {
$mainframe->redirect('index.php?option='.JACOMPONENT.'&view=repolist&folder='.$folder);
}
}
}
| rlee1962/diylegalcenter | administrator/components/com_jaextmanager/controllers/file.php | PHP | gpl-2.0 | 6,634 |
# Rshell
A simple command shell designed by Trevor Smith and Chianh Wu.
## What it does (currently)
This shell will handle standard command line programs and their arguments. Similarly, these commands can be linked with `&&`,`||`, or `;`.
We are orking on adding precidence via parentheses. The shell itself will also handle comments starting with the `#` symbol. There is also a built
in function that will test if a file or directory exits, and can be executed via `test` with flags `-e` to check existance, `-f` to check for
a regular file, and `-d` to check if it is a directory. Also, `test` can be represented as `[]` (e.g. `test -e /home/user/` = `[ -e /home/user/ ]`);
note also that this is white space sensetive `[-e /home/user/]` will not work.
## How to Run
- `$ git clone https://github.com/tsmit019/rshell.git`
- `$ cd rshell`
- `$ git checkout hw4`
- `$ make`
- `$ bin/rshell`
## If you want to run test
- `$ git clone https://github.com/tsmit019/rshell.git`
- `$ cd rshell`
- `$ git checkout hw4`
- `$ make`
- `$ cd tests`
From here you can chose any of the `.sh` and run them. Make sure they are executable by checking using `ls -l`. If they are not executable, then type `chmod 711 *.sh` to make all the `.sh` files executable.
## Bugs
Input redirection and output redirection work most of the time except for when they are the first set of commands (e.g. `cat < test.txt` will through an out of range. I have looked
for the reason for a while and have not been able to identify why). But, if you use the redirects after a connector (e.g. `echo hhallllllllu && cat < test` or `ls -al; echo why does this not work > sad.txt`)
then it works perfectly fine. Same for piping. I don't quite know.
Nested redirects dont quite work as intended e.g. `cat < test.txt > test_clone.txt` will not write to test_clone.txt but just execute the `cat < test.txt`.
If you give a command that is parenthese, connector, then command (e.g. `(echo a && echo b) || echo c`) you get a out of range error that I was
not able to resolve. Similarly, any connector directly after a closing parenthese will cause this behavior and I am unsure why. I will try and fix
this by the next release.
Similarly, commands with connectors right after each other will through a similar out of range error. E.g `echo a && ||` will give you out of range.
| tsmit019/rshell | README.md | Markdown | gpl-2.0 | 2,347 |
---
name: Feature request
about: Please consider reporting directly to https://github.com/magento/community-features
---
<!---
Important: This repository is intended only for Magento 2 Technical Issues. Enter Feature Requests at https://github.com/magento/community-features. Project stakeholders monitor and manage requests. Feature requests entered using this form may be moved to the forum. Fields marked with (*) are required. Please don't remove the template.
-->
### Description (*)
<!--- Describe the feature you would like to add. -->
### Expected behavior (*)
<!--- What is the expected behavior of this feature? How is it going to work? -->
### Benefits
<!--- How do you think this feature would improve Magento? -->
### Additional information
<!--- What other information can you provide about the desired feature? -->
| kunj1988/Magento2 | .github/ISSUE_TEMPLATE/feature_request.md | Markdown | gpl-2.0 | 836 |
<!DOCTYPE html>
<html>
<h1>muppets_mug5</h1>
<p> BOLD: 2/2 correct and 0/2false</p>
<p> SIFT: 0/2 correct and 2/2false</p><br>
<img src = "../../../BVD_M01/muppets_mug/muppets_mug5.jpg" alt = "muppets_mug5.html" style= " width:320px;height:240px;"> <h1> Falsely compared to: </h1><br>
<img src = "../../../" alt = "" style= " width:320px;height:240px;"> <img src = "../../../" alt = "" style= " width:320px;height:240px;"> </html> | MarcGroef/ros-vision | catkin_ws/Reports/BOLD_SIFT_1CAN-10fold-10%/muppets_mug/muppets_mug5.html | HTML | gpl-2.0 | 431 |
/**
@mainpage SOIL
Jonathan Dummer
2007-07-26-10.36
Simple OpenGL Image Library
A tiny c library for uploading images as
textures into OpenGL. Also saving and
loading of images is supported.
I'm using Sean's Tool Box image loader as a base:
http://www.nothings.org/
I'm upgrading it to load TGA and DDS files, and a direct
path for loading DDS files straight into OpenGL textures,
when applicable.
Image Formats:
- BMP load & save
- TGA load & save
- DDS load & save
- PNG load
- JPG load
OpenGL Texture Features:
- resample to power-of-two sizes
- MIPmap generation
- compressed texture S3TC formats (if supported)
- can pre-multiply alpha for you, for better compositing
- can flip image about the y-axis (except pre-compressed DDS files)
Thanks to:
* Sean Barret - for the awesome stb_image
* Dan Venkitachalam - for finding some non-compliant DDS files, and patching some explicit casts
* everybody at gamedev.net
**/
#ifndef HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY
#define HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY
#ifdef __cplusplus
extern "C" {
#endif
/**
The format of images that may be loaded (force_channels).
SOIL_LOAD_AUTO leaves the image in whatever format it was found.
SOIL_LOAD_L forces the image to load as Luminous (greyscale)
SOIL_LOAD_LA forces the image to load as Luminous with Alpha
SOIL_LOAD_RGB forces the image to load as Red Green Blue
SOIL_LOAD_RGBA forces the image to load as Red Green Blue Alpha
**/
enum
{
SOIL_LOAD_AUTO = 0,
SOIL_LOAD_L = 1,
SOIL_LOAD_LA = 2,
SOIL_LOAD_RGB = 3,
SOIL_LOAD_RGBA = 4
};
/**
Passed in as reuse_texture_ID, will cause SOIL to
register a new texture ID using glGenTextures().
If the value passed into reuse_texture_ID > 0 then
SOIL will just re-use that texture ID (great for
reloading image assets in-game!)
**/
enum
{
SOIL_CREATE_NEW_ID = 0
};
/**
flags you can pass into SOIL_load_OGL_texture()
and SOIL_create_OGL_texture().
(note that if SOIL_FLAG_DDS_LOAD_DIRECT is used
the rest of the flags with the exception of
SOIL_FLAG_TEXTURE_REPEATS will be ignored while
loading already-compressed DDS files.)
SOIL_FLAG_POWER_OF_TWO: force the image to be POT
SOIL_FLAG_MIPMAPS: generate mipmaps for the texture
SOIL_FLAG_TEXTURE_REPEATS: otherwise will clamp
SOIL_FLAG_MULTIPLY_ALPHA: for using (GL_ONE,GL_ONE_MINUS_SRC_ALPHA) blending
SOIL_FLAG_INVERT_Y: flip the image vertically
SOIL_FLAG_COMPRESS_TO_DXT: if the card can display them, will convert RGB to DXT1, RGBA to DXT5
SOIL_FLAG_DDS_LOAD_DIRECT: will load DDS files directly without _ANY_ additional processing
SOIL_FLAG_NTSC_SAFE_RGB: clamps RGB components to the range [16,235]
SOIL_FLAG_CoCg_Y: Google YCoCg; RGB=>CoYCg, RGBA=>CoCgAY
SOIL_FLAG_TEXTURE_RECTANGE: uses ARB_texture_rectangle ; pixel indexed & no repeat or MIPmaps or cubemaps
**/
enum
{
SOIL_FLAG_POWER_OF_TWO = 1,
SOIL_FLAG_MIPMAPS = 2,
SOIL_FLAG_TEXTURE_REPEATS = 4,
SOIL_FLAG_MULTIPLY_ALPHA = 8,
SOIL_FLAG_INVERT_Y = 16,
SOIL_FLAG_COMPRESS_TO_DXT = 32,
SOIL_FLAG_DDS_LOAD_DIRECT = 64,
SOIL_FLAG_NTSC_SAFE_RGB = 128,
SOIL_FLAG_CoCg_Y = 256,
SOIL_FLAG_TEXTURE_RECTANGLE = 512
};
/**
The types of images that may be saved.
(TGA supports uncompressed RGB / RGBA)
(BMP supports uncompressed RGB)
(DDS supports DXT1 and DXT5)
**/
enum
{
SOIL_SAVE_TYPE_TGA = 0,
SOIL_SAVE_TYPE_BMP = 1,
SOIL_SAVE_TYPE_DDS = 2
};
/**
Defines the order of faces in a DDS cubemap.
I recommend that you use the same order in single
image cubemap files, so they will be interchangeable
with DDS cubemaps when using SOIL.
**/
#define SOIL_DDS_CUBEMAP_FACE_ORDER "EWUDNS"
/**
The types of internal fake HDR representations
SOIL_HDR_RGBE: RGB * pow( 2.0, A - 128.0 )
SOIL_HDR_RGBdivA: RGB / A
SOIL_HDR_RGBdivA2: RGB / (A*A)
**/
enum
{
SOIL_HDR_RGBE = 0,
SOIL_HDR_RGBdivA = 1,
SOIL_HDR_RGBdivA2 = 2
};
/**
Loads an image from disk into an OpenGL texture.
\param filename the name of the file to upload as a texture
\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA
\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)
\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT
\return 0-failed, otherwise returns the OpenGL texture handle
**/
unsigned int
SOIL_load_OGL_texture
(
const char *filename,
int force_channels,
unsigned int reuse_texture_ID,
unsigned int flags
);
/**
Loads 6 images from disk into an OpenGL cubemap texture.
\param x_pos_file the name of the file to upload as the +x cube face
\param x_neg_file the name of the file to upload as the -x cube face
\param y_pos_file the name of the file to upload as the +y cube face
\param y_neg_file the name of the file to upload as the -y cube face
\param z_pos_file the name of the file to upload as the +z cube face
\param z_neg_file the name of the file to upload as the -z cube face
\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA
\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)
\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT
\return 0-failed, otherwise returns the OpenGL texture handle
**/
unsigned int
SOIL_load_OGL_cubemap
(
const char *x_pos_file,
const char *x_neg_file,
const char *y_pos_file,
const char *y_neg_file,
const char *z_pos_file,
const char *z_neg_file,
int force_channels,
unsigned int reuse_texture_ID,
unsigned int flags
);
/**
Loads 1 image from disk and splits it into an OpenGL cubemap texture.
\param filename the name of the file to upload as a texture
\param face_order the order of the faces in the file, any combination of NSWEUD, for North, South, Up, etc.
\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA
\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)
\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT
\return 0-failed, otherwise returns the OpenGL texture handle
**/
unsigned int
SOIL_load_OGL_single_cubemap
(
const char *filename,
const char face_order[6],
int force_channels,
unsigned int reuse_texture_ID,
unsigned int flags
);
/**
Loads an HDR image from disk into an OpenGL texture.
\param filename the name of the file to upload as a texture
\param fake_HDR_format SOIL_HDR_RGBE, SOIL_HDR_RGBdivA, SOIL_HDR_RGBdivA2
\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)
\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT
\return 0-failed, otherwise returns the OpenGL texture handle
**/
unsigned int
SOIL_load_OGL_HDR_texture
(
const char *filename,
int fake_HDR_format,
int rescale_to_max,
unsigned int reuse_texture_ID,
unsigned int flags
);
/**
Loads an image from RAM into an OpenGL texture.
\param buffer the image data in RAM just as if it were still in a file
\param buffer_length the size of the buffer in bytes
\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA
\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)
\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT
\param width
\param height
\param channels
\return 0-failed, otherwise returns the OpenGL texture handle
**/
unsigned int
SOIL_load_OGL_texture_and_info_from_memory
(
const unsigned char *const buffer,
int buffer_length,
int force_channels,
unsigned int reuse_texture_ID,
unsigned int flags,
int *width,
int *height,
int *channels
);
/**
Loads an image from RAM into an OpenGL texture.
\param buffer the image data in RAM just as if it were still in a file
\param buffer_length the size of the buffer in bytes
\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA
\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)
\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT
\return 0-failed, otherwise returns the OpenGL texture handle
**/
unsigned int
SOIL_load_OGL_texture_from_memory
(
const unsigned char *const buffer,
int buffer_length,
int force_channels,
unsigned int reuse_texture_ID,
unsigned int flags
);
/**
Loads 6 images from memory into an OpenGL cubemap texture.
\param x_pos_buffer the image data in RAM to upload as the +x cube face
\param x_pos_buffer_length the size of the above buffer
\param x_neg_buffer the image data in RAM to upload as the +x cube face
\param x_neg_buffer_length the size of the above buffer
\param y_pos_buffer the image data in RAM to upload as the +x cube face
\param y_pos_buffer_length the size of the above buffer
\param y_neg_buffer the image data in RAM to upload as the +x cube face
\param y_neg_buffer_length the size of the above buffer
\param z_pos_buffer the image data in RAM to upload as the +x cube face
\param z_pos_buffer_length the size of the above buffer
\param z_neg_buffer the image data in RAM to upload as the +x cube face
\param z_neg_buffer_length the size of the above buffer
\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA
\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)
\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT
\return 0-failed, otherwise returns the OpenGL texture handle
**/
unsigned int
SOIL_load_OGL_cubemap_from_memory
(
const unsigned char *const x_pos_buffer,
int x_pos_buffer_length,
const unsigned char *const x_neg_buffer,
int x_neg_buffer_length,
const unsigned char *const y_pos_buffer,
int y_pos_buffer_length,
const unsigned char *const y_neg_buffer,
int y_neg_buffer_length,
const unsigned char *const z_pos_buffer,
int z_pos_buffer_length,
const unsigned char *const z_neg_buffer,
int z_neg_buffer_length,
int force_channels,
unsigned int reuse_texture_ID,
unsigned int flags
);
/**
Loads 1 image from RAM and splits it into an OpenGL cubemap texture.
\param buffer the image data in RAM just as if it were still in a file
\param buffer_length the size of the buffer in bytes
\param face_order the order of the faces in the file, any combination of NSWEUD, for North, South, Up, etc.
\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA
\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)
\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT
\return 0-failed, otherwise returns the OpenGL texture handle
**/
unsigned int
SOIL_load_OGL_single_cubemap_from_memory
(
const unsigned char *const buffer,
int buffer_length,
const char face_order[6],
int force_channels,
unsigned int reuse_texture_ID,
unsigned int flags
);
/**
Creates a 2D OpenGL texture from raw image data. Note that the raw data is
_NOT_ freed after the upload (so the user can load various versions).
\param data the raw data to be uploaded as an OpenGL texture
\param width the width of the image in pixels
\param height the height of the image in pixels
\param channels the number of channels: 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA
\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)
\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT
\return 0-failed, otherwise returns the OpenGL texture handle
**/
unsigned int
SOIL_create_OGL_texture
(
const unsigned char *const data,
int width, int height, int channels,
unsigned int reuse_texture_ID,
unsigned int flags
);
/**
Creates an OpenGL cubemap texture by splitting up 1 image into 6 parts.
\param data the raw data to be uploaded as an OpenGL texture
\param width the width of the image in pixels
\param height the height of the image in pixels
\param channels the number of channels: 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA
\param face_order the order of the faces in the file, and combination of NSWEUD, for North, South, Up, etc.
\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)
\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT
\return 0-failed, otherwise returns the OpenGL texture handle
**/
unsigned int
SOIL_create_OGL_single_cubemap
(
const unsigned char *const data,
int width, int height, int channels,
const char face_order[6],
unsigned int reuse_texture_ID,
unsigned int flags
);
/**
Captures the OpenGL window (RGB) and saves it to disk
\return 0 if it failed, otherwise returns 1
**/
int
SOIL_save_screenshot
(
const char *filename,
int image_type,
int x, int y,
int width, int height
);
/**
Loads an image from disk into an array of unsigned chars.
Note that *channels return the original channel count of the
image. If force_channels was other than SOIL_LOAD_AUTO,
the resulting image has force_channels, but *channels may be
different (if the original image had a different channel
count).
\return 0 if failed, otherwise returns 1
**/
unsigned char*
SOIL_load_image
(
const char *filename,
int *width, int *height, int *channels,
int force_channels
);
/**
Loads an image from memory into an array of unsigned chars.
Note that *channels return the original channel count of the
image. If force_channels was other than SOIL_LOAD_AUTO,
the resulting image has force_channels, but *channels may be
different (if the original image had a different channel
count).
\return 0 if failed, otherwise returns 1
**/
unsigned char*
SOIL_load_image_from_memory
(
const unsigned char *const buffer,
int buffer_length,
int *width, int *height, int *channels,
int force_channels
);
/**
Saves an image from an array of unsigned chars (RGBA) to disk
\return 0 if failed, otherwise returns 1
**/
int
SOIL_save_image
(
const char *filename,
int image_type,
int width, int height, int channels,
const unsigned char *const data
);
/**
Frees the image data (note, this is just C's "free()"...this function is
present mostly so C++ programmers don't forget to use "free()" and call
"delete []" instead [8^)
**/
void
SOIL_free_image_data
(
unsigned char *img_data
);
/**
This function resturn a pointer to a string describing the last thing
that happened inside SOIL. It can be used to determine why an image
failed to load.
**/
const char*
SOIL_last_result
(
void
);
#ifdef __cplusplus
}
#endif
#endif /* HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY */
| cheeseEater/ihge | src/core/soil/SOIL.h | C | gpl-2.0 | 16,510 |
/*
Google HTML5 slides template
Authors: Luke Mahé (code)
Marcin Wichary (code and design)
Dominic Mazzoni (browser compatibility)
Charles Chen (ChromeVox support)
URL: http://code.google.com/p/html5slides/
*/
/* Framework */
html {
height: 100%;
}
body {
margin: 0;
padding: 0;
display: block !important;
height: 100%;
min-height: 740px;
overflow-x: hidden;
overflow-y: auto;
background: rgb(215, 215, 215);
background: -o-radial-gradient(rgb(240, 240, 240), rgb(190, 190, 190));
background: -moz-radial-gradient(rgb(240, 240, 240), rgb(190, 190, 190));
background: -webkit-radial-gradient(rgb(240, 240, 240), rgb(190, 190, 190));
background: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 500, from(rgb(240, 240, 240)), to(rgb(190, 190, 190)));
-webkit-font-smoothing: antialiased;
}
.slides {
width: 100%;
height: 100%;
left: 0;
top: 0;
position: absolute;
-webkit-transform: translate3d(0, 0, 0);
}
.slides > article {
display: block;
position: absolute;
overflow: hidden;
width: 900px;
height: 700px;
left: 50%;
top: 50%;
margin-left: -450px;
margin-top: -350px;
padding: 40px 60px;
box-sizing: border-box;
-o-box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
border-radius: 10px;
-o-border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
background-color: white;
box-shadow: 0 2px 6px rgba(0, 0, 0, .1);
border: 1px solid rgba(0, 0, 0, .3);
transition: transform .3s ease-out;
-o-transition: -o-transform .3s ease-out;
-moz-transition: -moz-transform .3s ease-out;
-webkit-transition: -webkit-transform .3s ease-out;
}
.slides.layout-widescreen > article {
margin-left: -550px;
width: 1100px;
}
.slides.layout-faux-widescreen > article {
margin-left: -550px;
width: 1100px;
padding: 40px 160px;
}
.slides.template-default > article:not(.nobackground):not(.biglogo) {
background: url(images/google-logo-small.jpg) 710px 625px no-repeat;
background-color: white;
}
.slides.template-io2011 > article:not(.nobackground):not(.biglogo) {
background: url(images/colorbar.png) 0 600px repeat-x,
url(images/googleio-logo.jpg) 640px 625px no-repeat;
background-size: 100%, 225px;
background-color: white;
}
.slides.layout-widescreen > article:not(.nobackground):not(.biglogo),
.slides.layout-faux-widescreen > article:not(.nobackground):not(.biglogo) {
background-position-x: 0, 840px;
}
/* Clickable/tappable areas */
.slide-area {
z-index: 1000;
position: absolute;
left: 0;
top: 0;
width: 150px;
height: 700px;
left: 50%;
top: 50%;
cursor: pointer;
margin-top: -350px;
tap-highlight-color: transparent;
-o-tap-highlight-color: transparent;
-moz-tap-highlight-color: transparent;
-webkit-tap-highlight-color: transparent;
}
#prev-slide-area {
margin-left: -550px;
}
#next-slide-area {
margin-left: 400px;
}
.slides.layout-widescreen #prev-slide-area,
.slides.layout-faux-widescreen #prev-slide-area {
margin-left: -650px;
}
.slides.layout-widescreen #next-slide-area,
.slides.layout-faux-widescreen #next-slide-area {
margin-left: 500px;
}
/* Slide styles */
.slides.template-default article.biglogo {
background: white url(images/google-logo.jpg) 50% 50% no-repeat;
}
.slides.template-io2011 article.biglogo {
background: white url(images/googleio-logo.jpg) 50% 50% no-repeat;
background-size: 600px;
}
/* Slides */
.slides > article {
display: none;
}
.slides > article.far-past {
display: block;
transform: translate(-2040px);
-o-transform: translate(-2040px);
-moz-transform: translate(-2040px);
-webkit-transform: translate3d(-2040px, 0, 0);
}
.slides > article.past {
display: block;
transform: translate(-1020px);
-o-transform: translate(-1020px);
-moz-transform: translate(-1020px);
-webkit-transform: translate3d(-1020px, 0, 0);
}
.slides > article.current {
display: block;
transform: translate(0);
-o-transform: translate(0);
-moz-transform: translate(0);
-webkit-transform: translate3d(0, 0, 0);
}
.slides > article.next {
display: block;
transform: translate(1020px);
-o-transform: translate(1020px);
-moz-transform: translate(1020px);
-webkit-transform: translate3d(1020px, 0, 0);
}
.slides > article.far-next {
display: block;
transform: translate(2040px);
-o-transform: translate(2040px);
-moz-transform: translate(2040px);
-webkit-transform: translate3d(2040px, 0, 0);
}
.slides.layout-widescreen > article.far-past,
.slides.layout-faux-widescreen > article.far-past {
display: block;
transform: translate(-2260px);
-o-transform: translate(-2260px);
-moz-transform: translate(-2260px);
-webkit-transform: translate3d(-2260px, 0, 0);
}
.slides.layout-widescreen > article.past,
.slides.layout-faux-widescreen > article.past {
display: block;
transform: translate(-1130px);
-o-transform: translate(-1130px);
-moz-transform: translate(-1130px);
-webkit-transform: translate3d(-1130px, 0, 0);
}
.slides.layout-widescreen > article.current,
.slides.layout-faux-widescreen > article.current {
display: block;
transform: translate(0);
-o-transform: translate(0);
-moz-transform: translate(0);
-webkit-transform: translate3d(0, 0, 0);
}
.slides.layout-widescreen > article.next,
.slides.layout-faux-widescreen > article.next {
display: block;
transform: translate(1130px);
-o-transform: translate(1130px);
-moz-transform: translate(1130px);
-webkit-transform: translate3d(1130px, 0, 0);
}
.slides.layout-widescreen > article.far-next,
.slides.layout-faux-widescreen > article.far-next {
display: block;
transform: translate(2260px);
-o-transform: translate(2260px);
-moz-transform: translate(2260px);
-webkit-transform: translate3d(2260px, 0, 0);
}
/* Styles for slides */
.slides > article {
font-family: 'Open Sans', Arial, sans-serif;
color: rgb(102, 102, 102);
text-shadow: 0 1px 1px rgba(0, 0, 0, .1);
font-size: 30px;
line-height: 36px;
letter-spacing: -1px;
}
b {
font-weight: 600;
}
.blue {
color: rgb(0, 102, 204);
}
.yellow {
color: rgb(255, 211, 25);
}
.green {
color: rgb(0, 138, 53);
}
.red {
color: rgb(255, 0, 0);
}
.black {
color: black;
}
.white {
color: white;
}
a {
color: rgb(0, 102, 204);
}
a:visited {
color: rgba(0, 102, 204, .75);
}
a:hover {
color: black;
}
p {
margin: 0;
padding: 0;
margin-top: 20px;
}
p:first-child {
margin-top: 0;
}
h1 {
font-size: 60px;
line-height: 60px;
padding: 0;
margin: 0;
margin-top: 200px;
padding-right: 40px;
font-weight: 600;
letter-spacing: -3px;
color: rgb(51, 51, 51);
}
h2 {
font-size: 45px;
line-height: 45px;
position: absolute;
bottom: 150px;
padding: 0;
margin: 0;
padding-right: 40px;
font-weight: 600;
letter-spacing: -2px;
color: rgb(51, 51, 51);
}
h3 {
font-size: 30px;
line-height: 36px;
padding: 0;
margin: 0;
padding-right: 40px;
font-weight: 600;
letter-spacing: -1px;
color: rgb(51, 51, 51);
}
article.fill h3 {
background: rgba(0, 0, 0, .35);
padding-top: .2em;
padding-bottom: .3em;
margin-top: -.2em;
margin-left: -60px;
padding-left: 60px;
margin-right: -60px;
padding-right: 60px;
}
ul {
list-style: none;
margin: 0;
padding: 0;
margin-top: 40px;
margin-left: .75em;
}
ul:first-child {
margin-top: 0;
}
ul ul {
margin-top: .5em;
}
li {
padding: 0;
margin: 0;
margin-bottom: .5em;
}
li::before {
content: '·';
width: .75em;
margin-left: -.75em;
position: absolute;
}
pre {
font-family: 'Droid Sans Mono', 'Courier New', monospace;
font-size: 20px;
line-height: 28px;
padding: 5px 10px;
letter-spacing: -1px;
margin-top: 40px;
margin-bottom: 40px;
color: black;
background: rgb(240, 240, 240);
border: 1px solid rgb(224, 224, 224);
box-shadow: inset 0 2px 6px rgba(0, 0, 0, .1);
overflow: hidden;
}
code {
font-size: 95%;
font-family: 'Droid Sans Mono', 'Courier New', monospace;
color: black;
}
iframe {
width: 100%;
height: 620px;
background: white;
border: 1px solid rgb(192, 192, 192);
margin: -1px;
/*box-shadow: inset 0 2px 6px rgba(0, 0, 0, .1);*/
}
h3 + iframe {
margin-top: 40px;
height: 540px;
}
article.fill iframe {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border: 0;
margin: 0;
border-radius: 10px;
-o-border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
z-index: -1;
}
article.fill img {
position: absolute;
left: 0;
top: 0;
min-width: 100%;
min-height: 100%;
border-radius: 10px;
-o-border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
z-index: -1;
}
img.centered {
margin: 0 auto;
display: block;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 40px;
}
th {
font-weight: 600;
text-align: left;
}
td,
th {
border: 1px solid rgb(224, 224, 224);
padding: 5px 10px;
vertical-align: top;
}
.source {
position: absolute;
left: 60px;
top: 644px;
padding-right: 175px;
font-size: 15px;
letter-spacing: 0;
line-height: 18px;
}
q {
display: block;
font-size: 60px;
line-height: 72px;
margin-left: 20px;
margin-top: 100px;
margin-right: 150px;
}
q::before {
content: '“';
position: absolute;
display: inline-block;
margin-left: -2.1em;
width: 2em;
text-align: right;
font-size: 90px;
color: rgb(192, 192, 192);
}
q::after {
content: '”';
position: absolute;
margin-left: .1em;
font-size: 90px;
color: rgb(192, 192, 192);
}
div.author {
text-align: right;
font-size: 40px;
margin-top: 20px;
margin-right: 150px;
}
div.author::before {
content: '—';
}
/* Size variants */
article.smaller p,
article.smaller ul {
font-size: 20px;
line-height: 24px;
letter-spacing: 0;
}
article.smaller table {
font-size: 20px;
line-height: 24px;
letter-spacing: 0;
}
article.smaller pre {
font-size: 15px;
line-height: 20px;
letter-spacing: 0;
}
article.smaller q {
font-size: 40px;
line-height: 48px;
}
article.smaller q::before,
article.smaller q::after {
font-size: 60px;
}
/* Builds */
.build > * {
transition: opacity 0.5s ease-in-out 0.2s;
-o-transition: opacity 0.5s ease-in-out 0.2s;
-moz-transition: opacity 0.5s ease-in-out 0.2s;
-webkit-transition: opacity 0.5s ease-in-out 0.2s;
}
.to-build {
opacity: 0;
}
/* Pretty print */
.prettyprint .str, /* string content */
.prettyprint .atv { /* a markup attribute value */
color: rgb(0, 138, 53);
}
.prettyprint .kwd, /* a keyword */
.prettyprint .tag { /* a markup tag name */
color: rgb(0, 102, 204);
}
.prettyprint .com { /* a comment */
color: rgb(127, 127, 127);
font-style: italic;
}
.prettyprint .lit { /* a literal value */
color: rgb(127, 0, 0);
}
.prettyprint .pun, /* punctuation, lisp open bracket, lisp close bracket */
.prettyprint .opn,
.prettyprint .clo {
color: rgb(127, 127, 127);
}
.prettyprint .typ, /* a type name */
.prettyprint .atn, /* a markup attribute name */
.prettyprint .dec,
.prettyprint .var { /* a declaration; a variable name */
color: rgb(127, 0, 127);
}
.mylogo{
width: 200px;
height: 80px;
background: white;
position: absolute;
bottom: 0;
right: 0;
} | Urinx/Web.Page | Demo/ppt3.0/Presentation.google_files/styles.css | CSS | gpl-2.0 | 11,441 |
/*
Linux PINMUX.C
*/
#include <asm/arch/am_regs.h>
#include <asm/arch/am_eth_reg.h>
#include <asm/arch/pinmux.h>
int clear_mio_mux(unsigned mux_index, unsigned mux_mask)
{
unsigned mux_reg[] = {PERIPHS_PIN_MUX_0, PERIPHS_PIN_MUX_1, PERIPHS_PIN_MUX_2,PERIPHS_PIN_MUX_3,
PERIPHS_PIN_MUX_4,PERIPHS_PIN_MUX_5,PERIPHS_PIN_MUX_6,PERIPHS_PIN_MUX_7,PERIPHS_PIN_MUX_8,
PERIPHS_PIN_MUX_9,PERIPHS_PIN_MUX_10,PERIPHS_PIN_MUX_11,PERIPHS_PIN_MUX_12};
if (mux_index < 13) {
CLEAR_CBUS_REG_MASK(mux_reg[mux_index], mux_mask);
return 0;
}
return -1;
}
int set_mio_mux(unsigned mux_index, unsigned mux_mask)
{
unsigned mux_reg[] = {PERIPHS_PIN_MUX_0, PERIPHS_PIN_MUX_1, PERIPHS_PIN_MUX_2,PERIPHS_PIN_MUX_3,
PERIPHS_PIN_MUX_4,PERIPHS_PIN_MUX_5,PERIPHS_PIN_MUX_6,PERIPHS_PIN_MUX_7,PERIPHS_PIN_MUX_8,
PERIPHS_PIN_MUX_9,PERIPHS_PIN_MUX_10,PERIPHS_PIN_MUX_11,PERIPHS_PIN_MUX_12};
if (mux_index < 13) {
SET_CBUS_REG_MASK(mux_reg[mux_index], mux_mask);
return 0;
}
return -1;
}
/*
call it before pinmux init;
call it before soft reset;
*/
void clearall_pinmux(void)
{
int i;
for(i=0;i<13;i++)
clear_mio_mux(i,0xffffffff);
return;
}
/*ETH PINMUX SETTING
More details can get from am_eth_pinmux.h
*/
int eth_set_pinmux(int bank_id,int clk_in_out_id,unsigned long ext_msk)
{
int ret=0;
switch(bank_id)
{
case ETH_BANK0_GPIOX46_X54:
if(ext_msk>0)
set_mio_mux(ETH_BANK0_REG1,ext_msk);
else
set_mio_mux(ETH_BANK0_REG1,ETH_BANK0_REG1_VAL);
break;
case ETH_BANK1_GPIOX59_X67:
if(ext_msk>0)
set_mio_mux(ETH_BANK1_REG1,ext_msk);
else
set_mio_mux(ETH_BANK1_REG1,ETH_BANK1_REG1_VAL);
break;
default:
printf("UNknow pinmux setting of ethernet!error bankid=%d,must be 0-2\n",bank_id);
ret=-1;
}
switch(clk_in_out_id)
{
case ETH_CLK_IN_GPIOX45_REG3_11:
set_mio_mux(3,1<<11);
break;
case ETH_CLK_IN_GPIOX55_REG3_0:
set_mio_mux(3,1);
break;
case ETH_CLK_IN_GPIOX58_REG3_24:
set_mio_mux(3,1<<24);
break;
case ETH_CLK_IN_GPIOX68_REG3_13:
set_mio_mux(3,1<<13);
break;
case ETH_CLK_OUT_GPIOX45_REG3_12:
set_mio_mux(3,1<<12);
break;
case ETH_CLK_OUT_GPIOX55_REG3_1:
set_mio_mux(3,1<<1);
break;
case ETH_CLK_OUT_GPIOX58_REG3_25:
set_mio_mux(3,1<<25);
break;
case ETH_CLK_OUT_GPIOX68_REG3_14:
set_mio_mux(3,1<<14);
break;
default:
printf("UNknow clk_in_out_id setting of ethernet!error clk_in_out_id=%d,must be 0-7\n",clk_in_out_id);
ret=-1;
}
return ret;
}
| bogdanov-d-a/Amlogic-reff16-uboot | arch/arm/cpu/aml_meson/m2/pinmux.c | C | gpl-2.0 | 2,559 |
<?php
/**
* @version $Id: helper.php 20228 2011-01-10 00:52:54Z eddieajau $
* @package Joomla.Site
* @subpackage mod_stats
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// no direct access
defined('_JEXEC') or die;
/**
* @package Joomla.Site
* @subpackage mod_stats
* @since 1.5
*/
class modStatsHelper
{
static function &getList(&$params)
{
$app = JFactory::getApplication();
$db = JFactory::getDbo();
$rows = array();
$query = $db->getQuery(true);
$serverinfo = $params->get('serverinfo');
$siteinfo = $params->get('siteinfo');
$counter = $params->get('counter');
$increase = $params->get('increase');
$i = 0;
if ($serverinfo) {
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_OS');
$rows[$i]->data = substr(php_uname(), 0, 7);
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_PHP');
$rows[$i]->data = phpversion();
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_MYSQL');
$rows[$i]->data = $db->getVersion();
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JTEXT::_('MOD_STATS_TIME');
$rows[$i]->data = JHTML::_('date','now', 'H:i');
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_CACHING');
$rows[$i]->data = $app->getCfg('caching') ? JText::_('JENABLED'):JText::_('JDISABLED');
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_GZIP');
$rows[$i]->data = $app->getCfg('gzip') ? JText::_('JENABLED'):JText::_('JDISABLED');
$i++;
}
if ($siteinfo) {
$query->select('COUNT(id) AS count_users');
$query->from('#__users');
$db->setQuery($query);
$users = $db->loadResult();
$query->clear();
$query->select('COUNT(id) AS count_items');
$query->from('#__content');
$query->where('state = 1');
$db->setQuery($query);
$items = $db->loadResult();
$query->clear();
$query->select('COUNT(id) AS count_links ');
$query->from('#__weblinks');
$query->where('state = 1');
$db->setQuery($query);
$links = $db->loadResult();
if ($users) {
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_USERS');
$rows[$i]->data = $users;
$i++;
}
if ($items) {
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_ARTICLES');
$rows[$i]->data = $items;
$i++;
}
if ($links) {
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_WEBLINKS');
$rows[$i]->data = $links;
$i++;
}
}
if ($counter) {
$query->clear();
$query->select('SUM(hits) AS count_hits');
$query->from('#__content');
$query->where('state = 1');
$db->setQuery($query);
$hits = $db->loadResult();
if ($hits) {
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_ARTICLES_VIEW_HITS');
$rows[$i]->data = $hits + $increase;
$i++;
}
}
return $rows;
}
} | emelynelisboa/studiosummo | modules/mod_stats/helper.php | PHP | gpl-2.0 | 3,177 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_55) on Sun Feb 15 12:26:30 PST 2015 -->
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>Uses of Class org.apache.solr.handler.component.HttpShardHandler (Solr 5.0.0 API)</title>
<meta name="date" content="2015-02-15">
<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="Uses of Class org.apache.solr.handler.component.HttpShardHandler (Solr 5.0.0 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<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><a href="../../../../../../org/apache/solr/handler/component/HttpShardHandler.html" title="class in org.apache.solr.handler.component">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="../../../../../../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?org/apache/solr/handler/component/class-use/HttpShardHandler.html" target="_top">Frames</a></li>
<li><a href="HttpShardHandler.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.solr.handler.component.HttpShardHandler" class="title">Uses of Class<br>org.apache.solr.handler.component.HttpShardHandler</h2>
</div>
<div class="classUseContainer">No usage of org.apache.solr.handler.component.HttpShardHandler</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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="../../../../../../org/apache/solr/handler/component/HttpShardHandler.html" title="class in org.apache.solr.handler.component">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="../../../../../../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?org/apache/solr/handler/component/class-use/HttpShardHandler.html" target="_top">Frames</a></li>
<li><a href="HttpShardHandler.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
<i>Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.</i>
<script src='../../../../../../prettify.js' type='text/javascript'></script>
<script type='text/javascript'>
(function(){
var oldonload = window.onload;
if (typeof oldonload != 'function') {
window.onload = prettyPrint;
} else {
window.onload = function() {
oldonload();
prettyPrint();
}
}
})();
</script>
</small></p>
</body>
</html>
| annieweng/solr_example | solr-5.0.0/docs/solr-core/org/apache/solr/handler/component/class-use/HttpShardHandler.html | HTML | gpl-2.0 | 4,943 |
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 by Alan Korr
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "config.h"
#include "hwcompat.h"
#include "kernel.h"
#include "lcd.h"
#include "system.h"
/*** definitions ***/
#define LCD_SET_LOWER_COLUMN_ADDRESS ((char)0x00)
#define LCD_SET_HIGHER_COLUMN_ADDRESS ((char)0x10)
#define LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO ((char)0x20)
#define LCD_SET_POWER_CONTROL_REGISTER ((char)0x28)
#define LCD_SET_DISPLAY_START_LINE ((char)0x40)
#define LCD_SET_CONTRAST_CONTROL_REGISTER ((char)0x81)
#define LCD_SET_SEGMENT_REMAP ((char)0xA0)
#define LCD_SET_LCD_BIAS ((char)0xA2)
#define LCD_SET_ENTIRE_DISPLAY_OFF ((char)0xA4)
#define LCD_SET_ENTIRE_DISPLAY_ON ((char)0xA5)
#define LCD_SET_NORMAL_DISPLAY ((char)0xA6)
#define LCD_SET_REVERSE_DISPLAY ((char)0xA7)
#define LCD_SET_MULTIPLEX_RATIO ((char)0xA8)
#define LCD_SET_BIAS_TC_OSC ((char)0xA9)
#define LCD_SET_1OVER4_BIAS_RATIO ((char)0xAA)
#define LCD_SET_INDICATOR_OFF ((char)0xAC)
#define LCD_SET_INDICATOR_ON ((char)0xAD)
#define LCD_SET_DISPLAY_OFF ((char)0xAE)
#define LCD_SET_DISPLAY_ON ((char)0xAF)
#define LCD_SET_PAGE_ADDRESS ((char)0xB0)
#define LCD_SET_COM_OUTPUT_SCAN_DIRECTION ((char)0xC0)
#define LCD_SET_TOTAL_FRAME_PHASES ((char)0xD2)
#define LCD_SET_DISPLAY_OFFSET ((char)0xD3)
#define LCD_SET_READ_MODIFY_WRITE_MODE ((char)0xE0)
#define LCD_SOFTWARE_RESET ((char)0xE2)
#define LCD_NOP ((char)0xE3)
#define LCD_SET_END_OF_READ_MODIFY_WRITE_MODE ((char)0xEE)
/* LCD command codes */
#define LCD_CNTL_RESET 0xe2 /* Software reset */
#define LCD_CNTL_POWER 0x2f /* Power control */
#define LCD_CNTL_CONTRAST 0x81 /* Contrast */
#define LCD_CNTL_OUTSCAN 0xc8 /* Output scan direction */
#define LCD_CNTL_SEGREMAP 0xa1 /* Segment remap */
#define LCD_CNTL_DISPON 0xaf /* Display on */
#define LCD_CNTL_PAGE 0xb0 /* Page address */
#define LCD_CNTL_HIGHCOL 0x10 /* Upper column address */
#define LCD_CNTL_LOWCOL 0x00 /* Lower column address */
/** globals **/
static int xoffset; /* needed for flip */
/*** hardware configuration ***/
int lcd_default_contrast(void)
{
return (HW_MASK & LCD_CONTRAST_BIAS) ? 31 : 49;
}
void lcd_set_contrast(int val)
{
lcd_write_command(LCD_CNTL_CONTRAST);
lcd_write_command(val);
}
void lcd_set_invert_display(bool yesno)
{
if (yesno)
lcd_write_command(LCD_SET_REVERSE_DISPLAY);
else
lcd_write_command(LCD_SET_NORMAL_DISPLAY);
}
/* turn the display upside down (call lcd_update() afterwards) */
void lcd_set_flip(bool yesno)
{
#ifdef HAVE_DISPLAY_FLIPPED
if (!yesno)
#else
if (yesno)
#endif
{
lcd_write_command(LCD_SET_SEGMENT_REMAP);
lcd_write_command(LCD_SET_COM_OUTPUT_SCAN_DIRECTION);
xoffset = 132 - LCD_WIDTH; /* 132 colums minus the 112 we have */
}
else
{
lcd_write_command(LCD_SET_SEGMENT_REMAP | 0x01);
lcd_write_command(LCD_SET_COM_OUTPUT_SCAN_DIRECTION | 0x08);
xoffset = 0;
}
}
void lcd_init_device(void)
{
/* Initialize PB0-3 as output pins */
PBCR2 &= 0xff00; /* MD = 00 */
PBIOR |= 0x000f; /* IOR = 1 */
/* inits like the original firmware */
lcd_write_command(LCD_SOFTWARE_RESET);
lcd_write_command(LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO + 4);
lcd_write_command(LCD_SET_1OVER4_BIAS_RATIO + 0); /* force 1/4 bias: 0 */
lcd_write_command(LCD_SET_POWER_CONTROL_REGISTER + 7);
/* power control register: op-amp=1, regulator=1, booster=1 */
lcd_write_command(LCD_SET_DISPLAY_ON);
lcd_write_command(LCD_SET_NORMAL_DISPLAY);
lcd_set_flip(false);
lcd_write_command(LCD_SET_DISPLAY_START_LINE + 0);
lcd_set_contrast(lcd_default_contrast());
lcd_write_command(LCD_SET_PAGE_ADDRESS);
lcd_write_command(LCD_SET_LOWER_COLUMN_ADDRESS + 0);
lcd_write_command(LCD_SET_HIGHER_COLUMN_ADDRESS + 0);
lcd_clear_display();
lcd_update();
}
/*** Update functions ***/
/* Performance function that works with an external buffer
note that by and bheight are in 8-pixel units! */
void lcd_blit_mono(const unsigned char *data, int x, int by, int width,
int bheight, int stride)
{
/* Copy display bitmap to hardware */
while (bheight--)
{
lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf));
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+xoffset)>>4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | ((x+xoffset) & 0xf));
lcd_write_data(data, width);
data += stride;
}
}
/* Helper function for lcd_grey_phase_blit(). */
void lcd_grey_data(unsigned char *values, unsigned char *phases, int count);
/* Performance function that works with an external buffer
note that by and bheight are in 8-pixel units! */
void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases,
int x, int by, int width, int bheight, int stride)
{
stride <<= 3; /* 8 pixels per block */
while (bheight--)
{
lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf));
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+xoffset)>>4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | ((x+xoffset) & 0xf));
lcd_grey_data(values, phases, width);
values += stride;
phases += stride;
}
}
/* Update the display.
This must be called after all other LCD functions that change the display. */
void lcd_update(void)
{
int y;
/* Copy display bitmap to hardware */
for (y = 0; y < LCD_FBHEIGHT; y++)
{
lcd_write_command (LCD_CNTL_PAGE | (y & 0xf));
lcd_write_command (LCD_CNTL_HIGHCOL | ((xoffset >> 4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | (xoffset & 0xf));
lcd_write_data (FBADDR(0, y), LCD_WIDTH);
}
}
/* Update a fraction of the display. */
void lcd_update_rect(int x, int y, int width, int height)
{
int ymax;
/* The Y coordinates have to work on even 8 pixel rows */
ymax = (y + height-1) >> 3;
y >>= 3;
if(x + width > LCD_WIDTH)
width = LCD_WIDTH - x;
if (width <= 0)
return; /* nothing left to do, 0 is harmful to lcd_write_data() */
if(ymax >= LCD_FBHEIGHT)
ymax = LCD_FBHEIGHT-1;
/* Copy specified rectange bitmap to hardware */
for (; y <= ymax; y++)
{
lcd_write_command (LCD_CNTL_PAGE | (y & 0xf));
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+xoffset) >> 4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | ((x+xoffset) & 0xf));
lcd_write_data (FBADDR(x,y), width);
}
}
| renolui/RenoStudio | Player/firmware/target/sh/archos/lcd-archos-bitmap.c | C | gpl-2.0 | 7,922 |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace XORCISMModel
{
using System;
using System.Collections.Generic;
public partial class PERIMETER
{
public int PerimeterID { get; set; }
}
}
| athiasjerome/XORCISM | SOURCES/XORCISMModel/PERIMETER.cs | C# | gpl-2.0 | 604 |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pt.jkaiui.core.messages;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import pt.jkaiui.core.KaiString;
import pt.jkaiui.manager.I_InMessage;
/**
*
* @author yuu@akron
*/
public class ConnectedArena extends Message implements I_InMessage {
public ConnectedArena() {
}
public Message parse(String s) {
Pattern p = Pattern.compile("KAI_CLIENT_CONNECTED_ARENA;");
Matcher m = p.matcher(s);
if (m.matches()){
ConnectedArena msg = new ConnectedArena();
return msg;
}
return null;
}
}
| yuuakron/jKaiUI_Custom | src/pt/jkaiui/core/messages/ConnectedArena.java | Java | gpl-2.0 | 731 |
#ifndef NO_OGL
//OpenGL library
#pragma comment( lib, "OpenGL32" )
// MFC
#include "stdafx.h"
//GUI
#include "MainWnd.h"
#include "FullscreenSettings.h"
// Internals
#include "../System.h"
#include "../gba/GBA.h"
#include "../gba/Globals.h"
#include "../Util.h"
#include "../gb/gbGlobals.h"
#include "../common/memgzio.h"
//Math
#include <cmath>
#include <sys/stat.h>
// OpenGL
#include <gl/GL.h> // main include file
#include <GL/glu.h>
#include "glFont.h"
#include <gl/glext.h>
typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)( int );
extern int Init_2xSaI(u32);
extern void winlog(const char *,...);
extern int systemSpeed;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#ifdef MMX
extern "C" bool cpu_mmx;
extern bool detectMMX();
#endif
class OpenGLDisplay : public IDisplay {
private:
HDC hDC;
HGLRC hRC;
GLuint texture;
int width,height;
float size;
u8 *filterData;
RECT destRect;
bool failed;
GLFONT font;
int pitch;
u8 *data;
DWORD currentAdapter;
void initializeMatrices( int w, int h );
bool initializeTexture( int w, int h );
void updateFiltering( int value );
void setVSync( int interval = 1 );
void calculateDestRect( int w, int h );
void initializeFont();
public:
OpenGLDisplay();
virtual ~OpenGLDisplay();
virtual DISPLAY_TYPE getType() { return OPENGL; };
virtual void EnableOpenGL();
virtual void DisableOpenGL();
virtual bool initialize();
virtual void cleanup();
virtual void clear();
virtual void render();
virtual bool changeRenderSize( int w, int h );
virtual void resize( int w, int h );
virtual void setOption( const char *, int );
virtual bool selectFullScreenMode( VIDEO_MODE &mode );
};
#include "gzglfont.h"
//Load GL font
void OpenGLDisplay::initializeFont()
{
int ret;
z_stream strm;
char *buf = (char *)malloc(GZGLFONT_SIZE);
/* allocate inflate state */
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.avail_in = 0;
strm.next_in = Z_NULL;
ret = inflateInit2(&strm, 16+MAX_WBITS);
if (ret != Z_OK)
return;
strm.avail_in = sizeof(gzglfont);
strm.next_in = gzglfont;
strm.avail_out = GZGLFONT_SIZE;
strm.next_out = (Bytef *)buf;
ret = inflate(&strm, Z_NO_FLUSH);
if (ret==Z_STREAM_END)
{
glGenTextures( 1, &texture );
glFontCreate(&font, (char *)buf, texture);
texture=0;
}
free(buf);
(void)inflateEnd(&strm);
}
//OpenGL class constructor
OpenGLDisplay::OpenGLDisplay()
{
hDC = NULL;
hRC = NULL;
texture = 0;
width = 0;
height = 0;
size = 0.0f;
failed = false;
filterData = NULL;
currentAdapter = 0;
}
//OpenGL class destroyer
OpenGLDisplay::~OpenGLDisplay()
{
cleanup();
}
//Set OpenGL PFD and contexts
void OpenGLDisplay::EnableOpenGL()
{
PIXELFORMATDESCRIPTOR pfd;
// get the device context (DC)
hDC = GetDC( theApp.m_pMainWnd->GetSafeHwnd() );
// set the pixel format for the DC
ZeroMemory( &pfd, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
SetPixelFormat (GetDC (theApp.m_pMainWnd->GetSafeHwnd()), ChoosePixelFormat ( GetDC (theApp.m_pMainWnd->GetSafeHwnd()), &pfd), &pfd);
wglMakeCurrent (GetDC (theApp.m_pMainWnd->GetSafeHwnd()), wglCreateContext(GetDC (theApp.m_pMainWnd->GetSafeHwnd()) ) );
}
//Remove contexts
void OpenGLDisplay::DisableOpenGL()
{
wglMakeCurrent( NULL, NULL );
wglDeleteContext( hRC );
ReleaseDC( theApp.m_pMainWnd->GetSafeHwnd(), hDC );
}
//Remove resources used
void OpenGLDisplay::cleanup()
{
if(texture != 0) {
glDeleteTextures(1, &texture);
texture = 0;
}
DisableOpenGL();
if(filterData) {
free(filterData);
filterData = NULL;
}
width = 0;
height = 0;
size = 0.0f;
DISPLAY_DEVICE dev;
ZeroMemory( &dev, sizeof(dev) );
dev.cb = sizeof(dev);
EnumDisplayDevices( NULL, currentAdapter, &dev, 0 );
// restore default video mode
ChangeDisplaySettingsEx( dev.DeviceName, NULL, NULL, 0, NULL );
}
//init renderer
bool OpenGLDisplay::initialize()
{
switch( theApp.cartridgeType )
{
case IMAGE_GBA:
theApp.sizeX = 240;
theApp.sizeY = 160;
break;
case IMAGE_GB:
if ( gbBorderOn )
{
theApp.sizeX = 256;
theApp.sizeY = 224;
}
else
{
theApp.sizeX = 160;
theApp.sizeY = 144;
}
break;
}
switch(theApp.videoOption)
{
case VIDEO_1X:
theApp.surfaceSizeX = theApp.sizeX;
theApp.surfaceSizeY = theApp.sizeY;
break;
case VIDEO_2X:
theApp.surfaceSizeX = theApp.sizeX * 2;
theApp.surfaceSizeY = theApp.sizeY * 2;
break;
case VIDEO_3X:
theApp.surfaceSizeX = theApp.sizeX * 3;
theApp.surfaceSizeY = theApp.sizeY * 3;
break;
case VIDEO_4X:
theApp.surfaceSizeX = theApp.sizeX * 4;
theApp.surfaceSizeY = theApp.sizeY * 4;
break;
case VIDEO_5X:
theApp.surfaceSizeX = theApp.sizeX * 5;
theApp.surfaceSizeY = theApp.sizeY * 5;
break;
case VIDEO_6X:
theApp.surfaceSizeX = theApp.sizeX * 6;
theApp.surfaceSizeY = theApp.sizeY * 6;
break;
case VIDEO_320x240:
case VIDEO_640x480:
case VIDEO_800x600:
case VIDEO_1024x768:
case VIDEO_1280x1024:
case VIDEO_OTHER:
{
if( theApp.fullScreenStretch ) {
theApp.surfaceSizeX = theApp.fsWidth;
theApp.surfaceSizeY = theApp.fsHeight;
} else {
float scaleX = (float)theApp.fsWidth / (float)theApp.sizeX;
float scaleY = (float)theApp.fsHeight / (float)theApp.sizeY;
float min = ( scaleX < scaleY ) ? scaleX : scaleY;
if( theApp.maxScale )
min = ( min > (float)theApp.maxScale ) ? (float)theApp.maxScale : min;
theApp.surfaceSizeX = (int)((float)theApp.sizeX * min);
theApp.surfaceSizeY = (int)((float)theApp.sizeY * min);
}
}
break;
}
theApp.rect.left = 0;
theApp.rect.top = 0;
theApp.rect.right = theApp.sizeX;
theApp.rect.bottom = theApp.sizeY;
theApp.dest.left = 0;
theApp.dest.top = 0;
theApp.dest.right = theApp.surfaceSizeX;
theApp.dest.bottom = theApp.surfaceSizeY;
DWORD style = WS_POPUP | WS_VISIBLE;
DWORD styleEx = 0;
if( theApp.videoOption <= VIDEO_6X )
style |= WS_OVERLAPPEDWINDOW;
else
styleEx = 0;
if( theApp.videoOption <= VIDEO_6X )
AdjustWindowRectEx( &theApp.dest, style, TRUE, styleEx );
else
AdjustWindowRectEx( &theApp.dest, style, FALSE, styleEx );
int winSizeX = theApp.dest.right - theApp.dest.left;
int winSizeY = theApp.dest.bottom - theApp.dest.top;
int x = 0, y = 0;
if( theApp.videoOption <= VIDEO_6X ) {
x = theApp.windowPositionX;
y = theApp.windowPositionY;
} else {
winSizeX = theApp.fsWidth;
winSizeY = theApp.fsHeight;
}
theApp.updateMenuBar();
theApp.adjustDestRect();
currentAdapter = theApp.fsAdapter;
DISPLAY_DEVICE dev;
ZeroMemory( &dev, sizeof(dev) );
dev.cb = sizeof(dev);
EnumDisplayDevices( NULL, currentAdapter, &dev, 0 );
if( theApp.videoOption >= VIDEO_320x240 ) {
// enter full screen mode
DEVMODE mode;
ZeroMemory( &mode, sizeof(mode) );
mode.dmSize = sizeof(mode);
mode.dmBitsPerPel = theApp.fsColorDepth;
mode.dmPelsWidth = theApp.fsWidth;
mode.dmPelsHeight = theApp.fsHeight;
mode.dmDisplayFrequency = theApp.fsFrequency;
mode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
LONG ret = ChangeDisplaySettingsEx( dev.DeviceName, &mode, NULL, CDS_FULLSCREEN, NULL );
if( ret != DISP_CHANGE_SUCCESSFUL ) {
systemMessage( 0, "Can not change display mode!" );
failed = true;
}
} else {
// restore default mode
ChangeDisplaySettingsEx( dev.DeviceName, NULL, NULL, 0, NULL );
}
EnableOpenGL();
initializeFont();
glPushAttrib( GL_ENABLE_BIT );
glDisable( GL_DEPTH_TEST );
glDisable( GL_CULL_FACE );
glEnable( GL_TEXTURE_2D );
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
initializeMatrices( theApp.surfaceSizeX, theApp.surfaceSizeY );
setVSync( theApp.vsync );
#ifdef MMX
if(!theApp.disableMMX)
cpu_mmx = theApp.detectMMX();
else
cpu_mmx = 0;
#endif
systemRedShift = 3;
systemGreenShift = 11;
systemBlueShift = 19;
systemColorDepth = 32;
theApp.fsColorDepth = 32;
Init_2xSaI(32);
utilUpdateSystemColorMaps(theApp.cartridgeType == IMAGE_GBA && gbColorOption == 1);
theApp.updateFilter();
theApp.updateIFB();
pitch = theApp.filterWidth * (systemColorDepth>>3) + 4;
data = pix + ( theApp.sizeX + 1 ) * 4;
if(failed)
return false;
return true;
}
//clear colour buffer
void OpenGLDisplay::clear()
{
glClearColor(0.0,0.0,0.0,1.0);
glClear( GL_COLOR_BUFFER_BIT );
}
//main render func
void OpenGLDisplay::render()
{
clear();
pitch = theApp.filterWidth * (systemColorDepth>>3) + 4;
data = pix + ( theApp.sizeX + 1 ) * 4;
// apply pixel filter
if(theApp.filterFunction) {
data = filterData;
theApp.filterFunction(
pix + pitch,
pitch,
(u8*)theApp.delta,
(u8*)filterData,
width * 4 ,
theApp.filterWidth,
theApp.filterHeight);
}
// Texturemap complete texture to surface
// so we have free scaling and antialiasing
if( theApp.filterFunction ) {
glPixelStorei( GL_UNPACK_ROW_LENGTH, width);
} else {
glPixelStorei( GL_UNPACK_ROW_LENGTH, theApp.sizeX + 1 );
}
glTexSubImage2D(GL_TEXTURE_2D,0,0,0,width,height,GL_RGBA,GL_UNSIGNED_BYTE,data );
glBegin( GL_QUADS );
glTexCoord2f( 0.0f, 0.0f );
glVertex3i( 0, 0, 0 );
glTexCoord2f( (float)(width) / size, 0.0f );
glVertex3i( theApp.surfaceSizeX, 0, 0 );
glTexCoord2f( (float)(width) / size, (float)(height) / size );
glVertex3i( theApp.surfaceSizeX, theApp.surfaceSizeY, 0 );
glTexCoord2f( 0.0f, (float)(height) / size );
glVertex3i( 0, theApp.surfaceSizeY, 0 );
glEnd();
if( theApp.showSpeed ) { // && ( theApp.videoOption > VIDEO_6X ) ) {
char buffer[30];
if( theApp.showSpeed == 1 ) {
sprintf( buffer, "%3d%%", systemSpeed );
} else {
sprintf( buffer, "%3d%%(%d, %d fps)", systemSpeed, systemFrameSkip, theApp.showRenderedFrames );
}
glFontBegin(&font);
glPushMatrix();
float fontscale = (float)theApp.surfaceSizeX / 100.0f;
glScalef(fontscale, fontscale, fontscale);
glColor4f(1.0f, 0.25f, 0.25f, 1.0f);
glFontTextOut(buffer, (theApp.surfaceSizeX-(strlen(buffer)*11))/(fontscale*2), (theApp.surfaceSizeY-20)/fontscale, 0);
glPopMatrix();
glFontEnd();
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBindTexture( GL_TEXTURE_2D, texture );
}
if( theApp.screenMessage ) {
if( ( ( GetTickCount() - theApp.screenMessageTime ) < 3000 ) && !theApp.disableStatusMessage ) {
glFontBegin(&font);
glPushMatrix();
float fontscale = (float)theApp.surfaceSizeX / 100.0f;
glScalef(fontscale, fontscale, fontscale);
glColor4f(1.0f, 0.25f, 0.25f, 1.0f);
glFontTextOut((char *)((const char *)theApp.screenMessageBuffer), (theApp.surfaceSizeX-(theApp.screenMessageBuffer.GetLength()*11))/(fontscale*2), (theApp.surfaceSizeY-40)/fontscale, 0);
glPopMatrix();
glFontEnd();
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBindTexture( GL_TEXTURE_2D, texture );
} else {
theApp.screenMessage = false;
}
}
glFlush();
SwapBuffers( hDC );
// since OpenGL draws on the back buffer,
// we have to swap it to the front buffer to see the content
}
//resize screen
void OpenGLDisplay::resize( int w, int h )
{
initializeMatrices( w, h );
}
//update filtering methods
void OpenGLDisplay::updateFiltering( int value )
{
switch( value )
{
case 0:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
break;
case 1:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
break;
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
}
//init projection matrixes and viewports
void OpenGLDisplay::initializeMatrices( int w, int h )
{
if( theApp.fullScreenStretch ) {
glViewport( 0, 0, w, h );
} else {
calculateDestRect( w, h );
glViewport(
destRect.left,
destRect.top,
destRect.right - destRect.left,
destRect.bottom - destRect.top );
}
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(
/* left */ 1.0f,
/* right */ (GLdouble)(w - 1),
/* bottom */ (GLdouble)(h - 1),
/* top */ 1.0f,
0.0f,
1.0f );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
//init font texture
bool OpenGLDisplay::initializeTexture( int w, int h )
{
// size = 2^n
// w = 24 > size = 256 = 2^8
// w = 255 > size = 256 = 2^8
// w = 256 > size = 512 = 2^9
// w = 300 > size = 512 = 2^9
// OpenGL textures have to be square and a power of 2
// We could use methods that allow tex's to not be powers of two
// but that requires extra OGL extensions
float n1 = log10( (float)w ) / log10( 2.0f );
float n2 = log10( (float)h ) / log10( 2.0f );
float n = ( n1 > n2 ) ? n1 : n2;
if( ((float)((int)n)) != n ) {
// round up
n = ((float)((int)n)) + 1.0f;
}
size = pow( 2.0f, n );
glGenTextures( 1, &texture );
glBindTexture( GL_TEXTURE_2D, texture );
updateFiltering( theApp.glFilter );
glTexImage2D(
GL_TEXTURE_2D,
0,
GL_RGBA,
(GLsizei)size,
(GLsizei)size,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
NULL );
width = w;
height = h;
//return ( glGetError() == GL_NO_ERROR) ? true : false;
// Workaround: We usually get GL_INVALID_VALUE, but somehow it works nevertheless
// In consequence, we must not treat it as an error or else the app behaves as if an error occured.
// This in the end results in theApp->input not being created = no input when switching from D3D to OGL
return true;
}
//turn vsync on or off
void OpenGLDisplay::setVSync( int interval )
{
const char *extensions = (const char *)glGetString( GL_EXTENSIONS );
if( strstr( extensions, "WGL_EXT_swap_control" ) == 0 ) {
winlog( "Error: WGL_EXT_swap_control extension not supported on your computer.\n" );
return;
} else {
PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = NULL;
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress( "wglSwapIntervalEXT" );
if( wglSwapIntervalEXT ) {
wglSwapIntervalEXT( interval );
}
}
}
//change render size for fonts and filter data
bool OpenGLDisplay::changeRenderSize( int w, int h )
{
if( (width != w) || (height != h) ) {
if( texture != 0 ) {
glDeleteTextures( 1, &texture );
texture = 0;
}
if( !initializeTexture( w, h ) ) {
failed = true;
return false;
}
if (filterData)
free(filterData);
filterData = (u8 *)malloc(4*w*h);
}
return true;
}
//calculate RECTs
void OpenGLDisplay::calculateDestRect( int w, int h )
{
float scaleX = (float)w / (float)width;
float scaleY = (float)h / (float)height;
float min = (scaleX < scaleY) ? scaleX : scaleY;
if( theApp.maxScale && (min > theApp.maxScale) ) {
min = (float)theApp.maxScale;
}
destRect.left = 0;
destRect.top = 0;
destRect.right = (LONG)(width * min);
destRect.bottom = (LONG)(height * min);
if( destRect.right != w ) {
LONG diff = (w - destRect.right) / 2;
destRect.left += diff;
destRect.right += diff;
}
if( destRect.bottom != h ) {
LONG diff = (h - destRect.bottom) / 2;
destRect.top += diff;
destRect.bottom += diff;
}
}
//config options
void OpenGLDisplay::setOption( const char *option, int value )
{
if( !_tcscmp( option, _T("vsync") ) ) {
setVSync( value );
}
if( !_tcscmp( option, _T("glFilter") ) ) {
updateFiltering( value );
}
if( !_tcscmp( option, _T("maxScale") ) ) {
initializeMatrices( theApp.dest.right-theApp.dest.left, theApp.dest.bottom-theApp.dest.top );
}
if( !_tcscmp( option, _T("fullScreenStretch") ) ) {
initializeMatrices( theApp.dest.right-theApp.dest.left, theApp.dest.bottom-theApp.dest.top );
}
}
//set fullscreen mode
bool OpenGLDisplay::selectFullScreenMode( VIDEO_MODE &mode )
{
FullscreenSettings dlg;
dlg.setAPI( this->getType() );
INT_PTR ret = dlg.DoModal();
if( ret == IDOK ) {
mode.adapter = dlg.m_device;
switch( dlg.m_colorDepth )
{
case 30:
// TODO: support
return false;
break;
case 24:
mode.bitDepth = 32;
break;
case 16:
case 15:
mode.bitDepth = 16;
break;
}
mode.width = dlg.m_width;
mode.height = dlg.m_height;
mode.frequency = dlg.m_refreshRate;
return true;
} else {
return false;
}
}
IDisplay *newOpenGLDisplay()
{
return new OpenGLDisplay();
}
#endif // #ifndef NO_OGL
| wowzaman12/vba | trunk/src/win32/OpenGL.cpp | C++ | gpl-2.0 | 16,390 |
/* asn.h
*
* Copyright (C) 2006-2016 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef WOLF_CRYPT_ASN_H
#define WOLF_CRYPT_ASN_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_ASN
#include <wolfssl/wolfcrypt/integer.h>
#ifndef NO_RSA
#include <wolfssl/wolfcrypt/rsa.h>
#endif
/* fips declare of RsaPrivateKeyDecode @wc_fips */
#if defined(HAVE_FIPS) && !defined(NO_RSA)
#include <cyassl/ctaocrypt/rsa.h>
#endif
#ifndef NO_DH
#include <wolfssl/wolfcrypt/dh.h>
#endif
#ifndef NO_DSA
#include <wolfssl/wolfcrypt/dsa.h>
#endif
#ifndef NO_SHA
#include <wolfssl/wolfcrypt/sha.h>
#endif
#ifndef NO_MD5
#include <wolfssl/wolfcrypt/md5.h>
#endif
#include <wolfssl/wolfcrypt/sha256.h>
#include <wolfssl/wolfcrypt/asn_public.h> /* public interface */
#ifdef HAVE_ECC
#include <wolfssl/wolfcrypt/ecc.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
enum {
ISSUER = 0,
SUBJECT = 1,
EXTERNAL_SERIAL_SIZE = 32,
BEFORE = 0,
AFTER = 1
};
/* ASN Tags */
enum ASN_Tags {
ASN_BOOLEAN = 0x01,
ASN_INTEGER = 0x02,
ASN_BIT_STRING = 0x03,
ASN_OCTET_STRING = 0x04,
ASN_TAG_NULL = 0x05,
ASN_OBJECT_ID = 0x06,
ASN_ENUMERATED = 0x0a,
ASN_UTF8STRING = 0x0c,
ASN_SEQUENCE = 0x10,
ASN_SET = 0x11,
ASN_UTC_TIME = 0x17,
ASN_OTHER_TYPE = 0x00,
ASN_RFC822_TYPE = 0x01,
ASN_DNS_TYPE = 0x02,
ASN_DIR_TYPE = 0x04,
ASN_GENERALIZED_TIME = 0x18,
CRL_EXTENSIONS = 0xa0,
ASN_EXTENSIONS = 0xa3,
ASN_LONG_LENGTH = 0x80
};
enum ASN_Flags{
ASN_CONSTRUCTED = 0x20,
ASN_CONTEXT_SPECIFIC = 0x80
};
enum DN_Tags {
ASN_COMMON_NAME = 0x03, /* CN */
ASN_SUR_NAME = 0x04, /* SN */
ASN_SERIAL_NUMBER = 0x05, /* serialNumber */
ASN_COUNTRY_NAME = 0x06, /* C */
ASN_LOCALITY_NAME = 0x07, /* L */
ASN_STATE_NAME = 0x08, /* ST */
ASN_ORG_NAME = 0x0a, /* O */
ASN_ORGUNIT_NAME = 0x0b /* OU */
};
enum PBES {
PBE_MD5_DES = 0,
PBE_SHA1_DES = 1,
PBE_SHA1_DES3 = 2,
PBE_SHA1_RC4_128 = 3,
PBES2 = 13 /* algo ID */
};
enum ENCRYPTION_TYPES {
DES_TYPE = 0,
DES3_TYPE = 1,
RC4_TYPE = 2
};
enum ECC_TYPES {
ECC_PREFIX_0 = 160,
ECC_PREFIX_1 = 161
};
enum Misc_ASN {
ASN_NAME_MAX = 256,
MAX_SALT_SIZE = 64, /* MAX PKCS Salt length */
MAX_IV_SIZE = 64, /* MAX PKCS Iv length */
MAX_KEY_SIZE = 64, /* MAX PKCS Key length */
PKCS5 = 5, /* PKCS oid tag */
PKCS5v2 = 6, /* PKCS #5 v2.0 */
PKCS12 = 12, /* PKCS #12 */
MAX_UNICODE_SZ = 256,
ASN_BOOL_SIZE = 2, /* including type */
ASN_ECC_HEADER_SZ = 2, /* String type + 1 byte len */
ASN_ECC_CONTEXT_SZ = 2, /* Content specific type + 1 byte len */
#ifdef NO_SHA
KEYID_SIZE = SHA256_DIGEST_SIZE,
#else
KEYID_SIZE = SHA_DIGEST_SIZE,
#endif
RSA_INTS = 8, /* RSA ints in private key */
DSA_INTS = 5, /* DSA ints in private key */
MIN_DATE_SIZE = 13,
MAX_DATE_SIZE = 32,
ASN_GEN_TIME_SZ = 15, /* 7 numbers * 2 + Zulu tag */
MAX_ENCODED_SIG_SZ = 512,
MAX_SIG_SZ = 256,
MAX_ALGO_SZ = 20,
MAX_SEQ_SZ = 5, /* enum(seq | con) + length(4) */
MAX_SET_SZ = 5, /* enum(set | con) + length(4) */
MAX_OCTET_STR_SZ = 5, /* enum(set | con) + length(4) */
MAX_EXP_SZ = 5, /* enum(contextspec|con|exp) + length(4) */
MAX_PRSTR_SZ = 5, /* enum(prstr) + length(4) */
MAX_VERSION_SZ = 5, /* enum + id + version(byte) + (header(2))*/
MAX_ENCODED_DIG_SZ = 73, /* sha512 + enum(bit or octet) + length(4) */
MAX_RSA_INT_SZ = 517, /* RSA raw sz 4096 for bits + tag + len(4) */
MAX_NTRU_KEY_SZ = 610, /* NTRU 112 bit public key */
MAX_NTRU_ENC_SZ = 628, /* NTRU 112 bit DER public encoding */
MAX_LENGTH_SZ = 4, /* Max length size for DER encoding */
MAX_RSA_E_SZ = 16, /* Max RSA public e size */
MAX_CA_SZ = 32, /* Max encoded CA basic constraint length */
MAX_SN_SZ = 35, /* Max encoded serial number (INT) length */
MAX_DER_DIGEST_SZ = MAX_ENCODED_DIG_SZ + MAX_ALGO_SZ + MAX_SEQ_SZ, /* Maximum DER digest size */
#ifdef WOLFSSL_CERT_GEN
#ifdef WOLFSSL_CERT_REQ
/* Max encoded cert req attributes length */
MAX_ATTRIB_SZ = MAX_SEQ_SZ * 3 + (11 + MAX_SEQ_SZ) * 2 +
MAX_PRSTR_SZ + CTC_NAME_SIZE, /* 11 is the OID size */
#endif
#if defined(WOLFSSL_ALT_NAMES) || defined(WOLFSSL_CERT_EXT)
MAX_EXTENSIONS_SZ = 1 + MAX_LENGTH_SZ + CTC_MAX_ALT_SIZE,
#else
MAX_EXTENSIONS_SZ = 1 + MAX_LENGTH_SZ + MAX_CA_SZ,
#endif
/* Max total extensions, id + len + others */
#endif
#ifdef WOLFSSL_CERT_EXT
MAX_KID_SZ = 45, /* Max encoded KID length (SHA-256 case) */
MAX_KEYUSAGE_SZ = 18, /* Max encoded Key Usage length */
MAX_OID_SZ = 32, /* Max DER length of OID*/
MAX_OID_STRING_SZ = 64, /* Max string length representation of OID*/
MAX_CERTPOL_NB = CTC_MAX_CERTPOL_NB,/* Max number of Cert Policy */
MAX_CERTPOL_SZ = CTC_MAX_CERTPOL_SZ,
#endif
OCSP_NONCE_EXT_SZ = 37, /* OCSP Nonce Extension size */
MAX_OCSP_EXT_SZ = 58, /* Max OCSP Extension length */
MAX_OCSP_NONCE_SZ = 16, /* OCSP Nonce size */
EIGHTK_BUF = 8192, /* Tmp buffer size */
MAX_PUBLIC_KEY_SZ = MAX_NTRU_ENC_SZ + MAX_ALGO_SZ + MAX_SEQ_SZ * 2,
/* use bigger NTRU size */
HEADER_ENCRYPTED_KEY_SIZE = 88,/* Extra header size for encrypted key */
TRAILING_ZERO = 1 /* Used for size of zero pad */
};
enum Oid_Types {
oidHashType = 0,
oidSigType = 1,
oidKeyType = 2,
oidCurveType = 3,
oidBlkType = 4,
oidOcspType = 5,
oidCertExtType = 6,
oidCertAuthInfoType = 7,
oidCertPolicyType = 8,
oidCertAltNameType = 9,
oidCertKeyUseType = 10,
oidKdfType = 11,
oidIgnoreType
};
enum Hash_Sum {
MD2h = 646,
MD5h = 649,
SHAh = 88,
SHA256h = 414,
SHA384h = 415,
SHA512h = 416
};
enum Block_Sum {
DESb = 69,
DES3b = 652
};
enum Key_Sum {
DSAk = 515,
RSAk = 645,
NTRUk = 274,
ECDSAk = 518
};
enum Ecc_Sum {
ECC_256R1 = 526,
ECC_384R1 = 210,
ECC_521R1 = 211,
ECC_160R1 = 184,
ECC_192R1 = 520,
ECC_224R1 = 209
};
enum KDF_Sum {
PBKDF2_OID = 660
};
enum Extensions_Sum {
BASIC_CA_OID = 133,
ALT_NAMES_OID = 131,
CRL_DIST_OID = 145,
AUTH_INFO_OID = 69,
AUTH_KEY_OID = 149,
SUBJ_KEY_OID = 128,
CERT_POLICY_OID = 146,
KEY_USAGE_OID = 129, /* 2.5.29.15 */
INHIBIT_ANY_OID = 168, /* 2.5.29.54 */
EXT_KEY_USAGE_OID = 151, /* 2.5.29.37 */
NAME_CONS_OID = 144 /* 2.5.29.30 */
};
enum CertificatePolicy_Sum {
CP_ANY_OID = 146 /* id-ce 32 0 */
};
enum SepHardwareName_Sum {
HW_NAME_OID = 79 /* 1.3.6.1.5.5.7.8.4 from RFC 4108*/
};
enum AuthInfo_Sum {
AIA_OCSP_OID = 116, /* 1.3.6.1.5.5.7.48.1 */
AIA_CA_ISSUER_OID = 117 /* 1.3.6.1.5.5.7.48.2 */
};
enum ExtKeyUsage_Sum { /* From RFC 5280 */
EKU_ANY_OID = 151, /* 2.5.29.37.0, anyExtendedKeyUsage */
EKU_SERVER_AUTH_OID = 71, /* 1.3.6.1.5.5.7.3.1, id-kp-serverAuth */
EKU_CLIENT_AUTH_OID = 72, /* 1.3.6.1.5.5.7.3.2, id-kp-clientAuth */
EKU_OCSP_SIGN_OID = 79 /* 1.3.6.1.5.5.7.3.9, OCSPSigning */
};
enum VerifyType {
NO_VERIFY = 0,
VERIFY = 1
};
#ifdef WOLFSSL_CERT_EXT
enum KeyIdType {
SKID_TYPE = 0,
AKID_TYPE = 1
};
#endif
/* Key usage extension bits */
#define KEYUSE_DIGITAL_SIG 0x0080
#define KEYUSE_CONTENT_COMMIT 0x0040
#define KEYUSE_KEY_ENCIPHER 0x0020
#define KEYUSE_DATA_ENCIPHER 0x0010
#define KEYUSE_KEY_AGREE 0x0008
#define KEYUSE_KEY_CERT_SIGN 0x0004
#define KEYUSE_CRL_SIGN 0x0002
#define KEYUSE_ENCIPHER_ONLY 0x0001
#define KEYUSE_DECIPHER_ONLY 0x8000
#define EXTKEYUSE_ANY 0x08
#define EXTKEYUSE_OCSP_SIGN 0x04
#define EXTKEYUSE_CLIENT_AUTH 0x02
#define EXTKEYUSE_SERVER_AUTH 0x01
typedef struct DNS_entry DNS_entry;
struct DNS_entry {
DNS_entry* next; /* next on DNS list */
char* name; /* actual DNS name */
};
typedef struct Base_entry Base_entry;
struct Base_entry {
Base_entry* next; /* next on name base list */
char* name; /* actual name base */
int nameSz; /* name length */
byte type; /* Name base type (DNS or RFC822) */
};
struct DecodedName {
char* fullName;
int fullNameLen;
int entryCount;
int cnIdx;
int cnLen;
int snIdx;
int snLen;
int cIdx;
int cLen;
int lIdx;
int lLen;
int stIdx;
int stLen;
int oIdx;
int oLen;
int ouIdx;
int ouLen;
int emailIdx;
int emailLen;
int uidIdx;
int uidLen;
int serialIdx;
int serialLen;
};
typedef struct DecodedCert DecodedCert;
typedef struct DecodedName DecodedName;
typedef struct Signer Signer;
#ifdef WOLFSSL_TRUST_PEER_CERT
typedef struct TrustedPeerCert TrustedPeerCert;
#endif /* WOLFSSL_TRUST_PEER_CERT */
struct DecodedCert {
byte* publicKey;
word32 pubKeySize;
int pubKeyStored;
word32 certBegin; /* offset to start of cert */
word32 sigIndex; /* offset to start of signature */
word32 sigLength; /* length of signature */
word32 signatureOID; /* sum of algorithm object id */
word32 keyOID; /* sum of key algo object id */
int version; /* cert version, 1 or 3 */
DNS_entry* altNames; /* alt names list of dns entries */
#ifndef IGNORE_NAME_CONSTRAINTS
DNS_entry* altEmailNames; /* alt names list of RFC822 entries */
Base_entry* permittedNames; /* Permitted name bases */
Base_entry* excludedNames; /* Excluded name bases */
#endif /* IGNORE_NAME_CONSTRAINTS */
byte subjectHash[KEYID_SIZE]; /* hash of all Names */
byte issuerHash[KEYID_SIZE]; /* hash of all Names */
#ifdef HAVE_OCSP
byte issuerKeyHash[KEYID_SIZE]; /* hash of the public Key */
#endif /* HAVE_OCSP */
byte* signature; /* not owned, points into raw cert */
char* subjectCN; /* CommonName */
int subjectCNLen; /* CommonName Length */
char subjectCNEnc; /* CommonName Encoding */
int subjectCNStored; /* have we saved a copy we own */
char issuer[ASN_NAME_MAX]; /* full name including common name */
char subject[ASN_NAME_MAX]; /* full name including common name */
int verify; /* Default to yes, but could be off */
byte* source; /* byte buffer holder cert, NOT owner */
word32 srcIdx; /* current offset into buffer */
word32 maxIdx; /* max offset based on init size */
void* heap; /* for user memory overrides */
byte serial[EXTERNAL_SERIAL_SIZE]; /* raw serial number */
int serialSz; /* raw serial bytes stored */
byte* extensions; /* not owned, points into raw cert */
int extensionsSz; /* length of cert extensions */
word32 extensionsIdx; /* if want to go back and parse later */
byte* extAuthInfo; /* Authority Information Access URI */
int extAuthInfoSz; /* length of the URI */
byte* extCrlInfo; /* CRL Distribution Points */
int extCrlInfoSz; /* length of the URI */
byte extSubjKeyId[KEYID_SIZE]; /* Subject Key ID */
byte extSubjKeyIdSet; /* Set when the SKID was read from cert */
byte extAuthKeyId[KEYID_SIZE]; /* Authority Key ID */
byte extAuthKeyIdSet; /* Set when the AKID was read from cert */
#ifndef IGNORE_NAME_CONSTRAINTS
byte extNameConstraintSet;
#endif /* IGNORE_NAME_CONSTRAINTS */
byte isCA; /* CA basic constraint true */
byte weOwnAltNames; /* altNames haven't been given to copy */
byte extKeyUsageSet;
word16 extKeyUsage; /* Key usage bitfield */
byte extExtKeyUsageSet; /* Extended Key Usage */
byte extExtKeyUsage; /* Extended Key usage bitfield */
#ifdef OPENSSL_EXTRA
byte extBasicConstSet;
byte extBasicConstCrit;
byte extBasicConstPlSet;
word32 pathLength; /* CA basic constraint path length, opt */
byte extSubjAltNameSet;
byte extSubjAltNameCrit;
byte extAuthKeyIdCrit;
#ifndef IGNORE_NAME_CONSTRAINTS
byte extNameConstraintCrit;
#endif /* IGNORE_NAME_CONSTRAINTS */
byte extSubjKeyIdCrit;
byte extKeyUsageCrit;
byte extExtKeyUsageCrit;
byte* extExtKeyUsageSrc;
word32 extExtKeyUsageSz;
word32 extExtKeyUsageCount;
byte* extAuthKeyIdSrc;
word32 extAuthKeyIdSz;
byte* extSubjKeyIdSrc;
word32 extSubjKeyIdSz;
#endif
#ifdef HAVE_ECC
word32 pkCurveOID; /* Public Key's curve OID */
#endif /* HAVE_ECC */
byte* beforeDate;
int beforeDateLen;
byte* afterDate;
int afterDateLen;
#ifdef HAVE_PKCS7
byte* issuerRaw; /* pointer to issuer inside source */
int issuerRawLen;
#endif
#ifndef IGNORE_NAME_CONSTRAINT
byte* subjectRaw; /* pointer to subject inside source */
int subjectRawLen;
#endif
#if defined(WOLFSSL_CERT_GEN)
/* easy access to subject info for other sign */
char* subjectSN;
int subjectSNLen;
char subjectSNEnc;
char* subjectC;
int subjectCLen;
char subjectCEnc;
char* subjectL;
int subjectLLen;
char subjectLEnc;
char* subjectST;
int subjectSTLen;
char subjectSTEnc;
char* subjectO;
int subjectOLen;
char subjectOEnc;
char* subjectOU;
int subjectOULen;
char subjectOUEnc;
char* subjectEmail;
int subjectEmailLen;
#endif /* WOLFSSL_CERT_GEN */
#ifdef OPENSSL_EXTRA
DecodedName issuerName;
DecodedName subjectName;
#endif /* OPENSSL_EXTRA */
#ifdef WOLFSSL_SEP
int deviceTypeSz;
byte* deviceType;
int hwTypeSz;
byte* hwType;
int hwSerialNumSz;
byte* hwSerialNum;
#ifdef OPENSSL_EXTRA
byte extCertPolicySet;
byte extCertPolicyCrit;
#endif /* OPENSSL_EXTRA */
#endif /* WOLFSSL_SEP */
#ifdef WOLFSSL_CERT_EXT
char extCertPolicies[MAX_CERTPOL_NB][MAX_CERTPOL_SZ];
int extCertPoliciesNb;
#endif /* WOLFSSL_CERT_EXT */
};
extern const char* BEGIN_CERT;
extern const char* END_CERT;
extern const char* BEGIN_CERT_REQ;
extern const char* END_CERT_REQ;
extern const char* BEGIN_DH_PARAM;
extern const char* END_DH_PARAM;
extern const char* BEGIN_X509_CRL;
extern const char* END_X509_CRL;
extern const char* BEGIN_RSA_PRIV;
extern const char* END_RSA_PRIV;
extern const char* BEGIN_PRIV_KEY;
extern const char* END_PRIV_KEY;
extern const char* BEGIN_ENC_PRIV_KEY;
extern const char* END_ENC_PRIV_KEY;
extern const char* BEGIN_EC_PRIV;
extern const char* END_EC_PRIV;
extern const char* BEGIN_DSA_PRIV;
extern const char* END_DSA_PRIV;
extern const char* BEGIN_PUB_KEY;
extern const char* END_PUB_KEY;
#ifdef NO_SHA
#define SIGNER_DIGEST_SIZE SHA256_DIGEST_SIZE
#else
#define SIGNER_DIGEST_SIZE SHA_DIGEST_SIZE
#endif
/* CA Signers */
/* if change layout change PERSIST_CERT_CACHE functions too */
struct Signer {
word32 pubKeySize;
word32 keyOID; /* key type */
word16 keyUsage;
byte* publicKey;
int nameLen;
char* name; /* common name */
#ifndef IGNORE_NAME_CONSTRAINTS
Base_entry* permittedNames;
Base_entry* excludedNames;
#endif /* IGNORE_NAME_CONSTRAINTS */
byte subjectNameHash[SIGNER_DIGEST_SIZE];
/* sha hash of names in certificate */
#ifndef NO_SKID
byte subjectKeyIdHash[SIGNER_DIGEST_SIZE];
/* sha hash of names in certificate */
#endif
Signer* next;
};
#ifdef WOLFSSL_TRUST_PEER_CERT
/* used for having trusted peer certs rather then CA */
struct TrustedPeerCert {
int nameLen;
char* name; /* common name */
#ifndef IGNORE_NAME_CONSTRAINTS
Base_entry* permittedNames;
Base_entry* excludedNames;
#endif /* IGNORE_NAME_CONSTRAINTS */
byte subjectNameHash[SIGNER_DIGEST_SIZE];
/* sha hash of names in certificate */
#ifndef NO_SKID
byte subjectKeyIdHash[SIGNER_DIGEST_SIZE];
/* sha hash of names in certificate */
#endif
word32 sigLen;
byte* sig;
struct TrustedPeerCert* next;
};
#endif /* WOLFSSL_TRUST_PEER_CERT */
/* not for public consumption but may use for testing sometimes */
#ifdef WOLFSSL_TEST_CERT
#define WOLFSSL_TEST_API WOLFSSL_API
#else
#define WOLFSSL_TEST_API WOLFSSL_LOCAL
#endif
WOLFSSL_TEST_API void FreeAltNames(DNS_entry*, void*);
#ifndef IGNORE_NAME_CONSTRAINTS
WOLFSSL_TEST_API void FreeNameSubtrees(Base_entry*, void*);
#endif /* IGNORE_NAME_CONSTRAINTS */
WOLFSSL_TEST_API void InitDecodedCert(DecodedCert*, byte*, word32, void*);
WOLFSSL_TEST_API void FreeDecodedCert(DecodedCert*);
WOLFSSL_TEST_API int ParseCert(DecodedCert*, int type, int verify, void* cm);
WOLFSSL_LOCAL int ParseCertRelative(DecodedCert*,int type,int verify,void* cm);
WOLFSSL_LOCAL int DecodeToKey(DecodedCert*, int verify);
WOLFSSL_LOCAL Signer* MakeSigner(void*);
WOLFSSL_LOCAL void FreeSigner(Signer*, void*);
WOLFSSL_LOCAL void FreeSignerTable(Signer**, int, void*);
#ifdef WOLFSSL_TRUST_PEER_CERT
WOLFSSL_LOCAL void FreeTrustedPeer(TrustedPeerCert*, void*);
WOLFSSL_LOCAL void FreeTrustedPeerTable(TrustedPeerCert**, int, void*);
#endif /* WOLFSSL_TRUST_PEER_CERT */
WOLFSSL_LOCAL int ToTraditional(byte* buffer, word32 length);
WOLFSSL_LOCAL int ToTraditionalEnc(byte* buffer, word32 length,const char*,int);
WOLFSSL_LOCAL int ValidateDate(const byte* date, byte format, int dateType);
/* ASN.1 helper functions */
WOLFSSL_LOCAL int GetLength(const byte* input, word32* inOutIdx, int* len,
word32 maxIdx);
WOLFSSL_LOCAL int GetSequence(const byte* input, word32* inOutIdx, int* len,
word32 maxIdx);
WOLFSSL_LOCAL int GetSet(const byte* input, word32* inOutIdx, int* len,
word32 maxIdx);
WOLFSSL_LOCAL int GetMyVersion(const byte* input, word32* inOutIdx,
int* version);
WOLFSSL_LOCAL int GetInt(mp_int* mpi, const byte* input, word32* inOutIdx,
word32 maxIdx);
WOLFSSL_LOCAL int GetObjectId(const byte* input, word32* inOutIdx, word32* oid,
word32 oidType, word32 maxIdx);
WOLFSSL_LOCAL int GetAlgoId(const byte* input, word32* inOutIdx, word32* oid,
word32 oidType, word32 maxIdx);
WOLFSSL_LOCAL word32 SetLength(word32 length, byte* output);
WOLFSSL_LOCAL word32 SetSequence(word32 len, byte* output);
WOLFSSL_LOCAL word32 SetOctetString(word32 len, byte* output);
WOLFSSL_LOCAL word32 SetImplicit(byte tag,byte number,word32 len,byte* output);
WOLFSSL_LOCAL word32 SetExplicit(byte number, word32 len, byte* output);
WOLFSSL_LOCAL word32 SetSet(word32 len, byte* output);
WOLFSSL_LOCAL word32 SetAlgoID(int algoOID,byte* output,int type,int curveSz);
WOLFSSL_LOCAL int SetMyVersion(word32 version, byte* output, int header);
WOLFSSL_LOCAL int SetSerialNumber(const byte* sn, word32 snSz, byte* output);
WOLFSSL_LOCAL int GetNameHash(const byte* source, word32* idx, byte* hash,
int maxIdx);
#ifdef HAVE_ECC
/* ASN sig helpers */
WOLFSSL_LOCAL int StoreECC_DSA_Sig(byte* out, word32* outLen, mp_int* r,
mp_int* s);
WOLFSSL_LOCAL int DecodeECC_DSA_Sig(const byte* sig, word32 sigLen,
mp_int* r, mp_int* s);
#endif
#ifdef WOLFSSL_CERT_GEN
enum cert_enums {
NAME_ENTRIES = 8,
JOINT_LEN = 2,
EMAIL_JOINT_LEN = 9,
RSA_KEY = 10,
NTRU_KEY = 11,
ECC_KEY = 12
};
#ifndef WOLFSSL_PEMCERT_TODER_DEFINED
#ifndef NO_FILESYSTEM
/* forward from wolfSSL */
WOLFSSL_API
int wolfSSL_PemCertToDer(const char* fileName,unsigned char* derBuf,int derSz);
#define WOLFSSL_PEMCERT_TODER_DEFINED
#endif
#endif
#endif /* WOLFSSL_CERT_GEN */
/* for pointer use */
typedef struct CertStatus CertStatus;
#ifdef HAVE_OCSP
enum Ocsp_Response_Status {
OCSP_SUCCESSFUL = 0, /* Response has valid confirmations */
OCSP_MALFORMED_REQUEST = 1, /* Illegal confirmation request */
OCSP_INTERNAL_ERROR = 2, /* Internal error in issuer */
OCSP_TRY_LATER = 3, /* Try again later */
OCSP_SIG_REQUIRED = 5, /* Must sign the request (4 is skipped) */
OCSP_UNAUTHROIZED = 6 /* Request unauthorized */
};
enum Ocsp_Cert_Status {
CERT_GOOD = 0,
CERT_REVOKED = 1,
CERT_UNKNOWN = 2
};
enum Ocsp_Sums {
OCSP_BASIC_OID = 117,
OCSP_NONCE_OID = 118
};
typedef struct OcspRequest OcspRequest;
typedef struct OcspResponse OcspResponse;
struct CertStatus {
CertStatus* next;
byte serial[EXTERNAL_SERIAL_SIZE];
int serialSz;
int status;
byte thisDate[MAX_DATE_SIZE];
byte nextDate[MAX_DATE_SIZE];
byte thisDateFormat;
byte nextDateFormat;
byte* rawOcspResponse;
word32 rawOcspResponseSz;
};
struct OcspResponse {
int responseStatus; /* return code from Responder */
byte* response; /* Pointer to beginning of OCSP Response */
word32 responseSz; /* length of the OCSP Response */
byte producedDate[MAX_DATE_SIZE];
/* Date at which this response was signed */
byte producedDateFormat; /* format of the producedDate */
byte* issuerHash;
byte* issuerKeyHash;
byte* cert;
word32 certSz;
byte* sig; /* Pointer to sig in source */
word32 sigSz; /* Length in octets for the sig */
word32 sigOID; /* OID for hash used for sig */
CertStatus* status; /* certificate status to fill out */
byte* nonce; /* pointer to nonce inside ASN.1 response */
int nonceSz; /* length of the nonce string */
byte* source; /* pointer to source buffer, not owned */
word32 maxIdx; /* max offset based on init size */
};
struct OcspRequest {
byte issuerHash[KEYID_SIZE];
byte issuerKeyHash[KEYID_SIZE];
byte* serial; /* copy of the serial number in source cert */
int serialSz;
byte* url; /* copy of the extAuthInfo in source cert */
int urlSz;
byte nonce[MAX_OCSP_NONCE_SZ];
int nonceSz;
};
WOLFSSL_LOCAL void InitOcspResponse(OcspResponse*, CertStatus*, byte*, word32);
WOLFSSL_LOCAL int OcspResponseDecode(OcspResponse*, void*);
WOLFSSL_LOCAL int InitOcspRequest(OcspRequest*, DecodedCert*, byte);
WOLFSSL_LOCAL void FreeOcspRequest(OcspRequest*);
WOLFSSL_LOCAL int EncodeOcspRequest(OcspRequest*, byte*, word32);
WOLFSSL_LOCAL word32 EncodeOcspRequestExtensions(OcspRequest*, byte*, word32);
WOLFSSL_LOCAL int CompareOcspReqResp(OcspRequest*, OcspResponse*);
#endif /* HAVE_OCSP */
/* for pointer use */
typedef struct RevokedCert RevokedCert;
#ifdef HAVE_CRL
struct RevokedCert {
byte serialNumber[EXTERNAL_SERIAL_SIZE];
int serialSz;
RevokedCert* next;
};
typedef struct DecodedCRL DecodedCRL;
struct DecodedCRL {
word32 certBegin; /* offset to start of cert */
word32 sigIndex; /* offset to start of signature */
word32 sigLength; /* length of signature */
word32 signatureOID; /* sum of algorithm object id */
byte* signature; /* pointer into raw source, not owned */
byte issuerHash[SIGNER_DIGEST_SIZE]; /* issuer hash */
byte crlHash[SIGNER_DIGEST_SIZE]; /* raw crl data hash */
byte lastDate[MAX_DATE_SIZE]; /* last date updated */
byte nextDate[MAX_DATE_SIZE]; /* next update date */
byte lastDateFormat; /* format of last date */
byte nextDateFormat; /* format of next date */
RevokedCert* certs; /* revoked cert list */
int totalCerts; /* number on list */
};
WOLFSSL_LOCAL void InitDecodedCRL(DecodedCRL*);
WOLFSSL_LOCAL int ParseCRL(DecodedCRL*, const byte* buff, word32 sz, void* cm);
WOLFSSL_LOCAL void FreeDecodedCRL(DecodedCRL*);
#endif /* HAVE_CRL */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* !NO_ASN */
#endif /* WOLF_CRYPT_ASN_H */
| lchristina26/wolfssl | wolfssl/wolfcrypt/asn.h | C | gpl-2.0 | 26,993 |
/*
* Customer code to add GPIO control during WLAN start/stop
* Copyright (C) 1999-2010, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
* you also meet, for each linked independent module, the terms and conditions of
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
* $Id: dhd_custom_gpio.c,v 1.1.4.8.4.4 2011/01/20 20:23:09 Exp $
*/
#include <typedefs.h>
#include <linuxver.h>
#include <osl.h>
#include <bcmutils.h>
#include <dngl_stats.h>
#include <dhd.h>
#include <wlioctl.h>
#include <wl_iw.h>
#define WL_ERROR(x) printf x
#define WL_TRACE(x)
#ifdef CUSTOMER_HW_SAMSUNG
extern void bcm_wlan_power_off(int);
extern void bcm_wlan_power_on(int);
extern void wlan_setup_power(int, int);
#endif /* CUSTOMER_HW_SAMSUNG */
#ifdef CUSTOMER_HW
extern void bcm_wlan_power_off(int);
extern void bcm_wlan_power_on(int);
#endif /* CUSTOMER_HW */
#ifdef CUSTOMER_HW2
int wifi_set_carddetect(int on);
int wifi_set_power(int on, unsigned long msec);
int wifi_get_irq_number(unsigned long *irq_flags_ptr);
int wifi_get_mac_addr(unsigned char *buf);
void *wifi_get_country_code(char *ccode);
#endif
#if defined(OOB_INTR_ONLY)
#if defined(BCMLXSDMMC)
extern int sdioh_mmc_irq(int irq);
#endif /* (BCMLXSDMMC) */
#ifdef CUSTOMER_HW3
#include <mach/gpio.h>
#endif
/* Customer specific Host GPIO defintion */
/* Customer specific Host GPIO defintion */
#ifdef CUSTOMER_HW_SAMSUNG
static int dhd_oob_gpio_num = IRQ_EINT(20);
#else
static int dhd_oob_gpio_num = -1; /* GG 19 */
#endif
module_param(dhd_oob_gpio_num, int, 0644);
MODULE_PARM_DESC(dhd_oob_gpio_num, "DHD oob gpio number");
int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr)
{
int host_oob_irq = 0;
#ifdef CUSTOMER_HW2
host_oob_irq = wifi_get_irq_number(irq_flags_ptr);
#else /* for NOT CUSTOMER_HW2 */
#if defined(CUSTOM_OOB_GPIO_NUM)
if (dhd_oob_gpio_num < 0) {
dhd_oob_gpio_num = CUSTOM_OOB_GPIO_NUM;
}
#endif
if (dhd_oob_gpio_num < 0) {
WL_ERROR(("%s: ERROR customer specific Host GPIO is NOT defined \n",
__FUNCTION__));
return (dhd_oob_gpio_num);
}
WL_ERROR(("%s: customer specific Host GPIO number is (%d)\n",
__FUNCTION__, dhd_oob_gpio_num));
#if defined CUSTOMER_HW
host_oob_irq = MSM_GPIO_TO_INT(dhd_oob_gpio_num);
#elif defined CUSTOMER_HW3
gpio_request(dhd_oob_gpio_num, "oob irq");
host_oob_irq = gpio_to_irq(dhd_oob_gpio_num);
gpio_direction_input(dhd_oob_gpio_num);
#elif defined CUSTOMER_HW_SAMSUNG
host_oob_irq = dhd_oob_gpio_num;
#endif /* CUSTOMER_HW */
#endif /* CUSTOMER_HW2 */
return (host_oob_irq);
}
#endif /* defined(OOB_INTR_ONLY) */
/* Customer function to control hw specific wlan gpios */
void
dhd_customer_gpio_wlan_ctrl(int onoff)
{
switch (onoff) {
case WLAN_RESET_OFF:
WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n",
__FUNCTION__));
#ifdef CUSTOMER_HW_SAMSUNG
//bcm_wlan_power_off(2);
wlan_setup_power(0, 2);
#endif /* CUSTOMER_HW */
#ifdef CUSTOMER_HW
bcm_wlan_power_off(2);
#endif /* CUSTOMER_HW */
#ifdef CUSTOMER_HW2
wifi_set_power(0, 0);
#endif
WL_ERROR(("=========== WLAN placed in RESET ========\n"));
break;
case WLAN_RESET_ON:
WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n",
__FUNCTION__));
#ifdef CUSTOMER_HW_SAMSUNG
//bcm_wlan_power_on(2);
wlan_setup_power(1, 2);
#endif /* CUSTOMER_HW */
#ifdef CUSTOMER_HW
bcm_wlan_power_on(2);
#endif /* CUSTOMER_HW */
#ifdef CUSTOMER_HW2
wifi_set_power(1, 0);
#endif
WL_ERROR(("=========== WLAN going back to live ========\n"));
break;
case WLAN_POWER_OFF:
WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n",
__FUNCTION__));
#ifdef CUSTOMER_HW_SAMSUNG
//bcm_wlan_power_off(1);
wlan_setup_power(0, 1);
#endif /* CUSTOMER_HW */
#ifdef CUSTOMER_HW
bcm_wlan_power_off(1);
#endif /* CUSTOMER_HW */
break;
case WLAN_POWER_ON:
WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n",
__FUNCTION__));
#ifdef CUSTOMER_HW_SAMSUNG
//bcm_wlan_power_on(1);
wlan_setup_power(1, 1);
#endif /* CUSTOMER_HW */
#ifdef CUSTOMER_HW
bcm_wlan_power_on(1);
/* Lets customer power to get stable */
OSL_DELAY(50);
#endif /* CUSTOMER_HW */
break;
}
}
#ifdef GET_CUSTOM_MAC_ENABLE
/* Function to get custom MAC address */
int
dhd_custom_get_mac_address(unsigned char *buf)
{
int ret = 0;
WL_TRACE(("%s Enter\n", __FUNCTION__));
if (!buf)
return -EINVAL;
/* Customer access to MAC address stored outside of DHD driver */
#ifdef CUSTOMER_HW2
ret = wifi_get_mac_addr(buf);
#endif
#ifdef EXAMPLE_GET_MAC
/* EXAMPLE code */
{
struct ether_addr ea_example = {{0x00, 0x11, 0x22, 0x33, 0x44, 0xFF}};
bcopy((char *)&ea_example, buf, sizeof(struct ether_addr));
}
#endif /* EXAMPLE_GET_MAC */
return ret;
}
#endif /* GET_CUSTOM_MAC_ENABLE */
/* Customized Locale table : OPTIONAL feature */
const struct cntry_locales_custom translate_custom_table[] = {
/* Table should be filled out based on custom platform regulatory requirement */
#ifdef EXAMPLE_TABLE
{"", "XY", 4}, /* universal */
{"US", "US", 69}, /* input ISO "US" to : US regrev 69 */
{"CA", "US", 69}, /* input ISO "CA" to : US regrev 69 */
{"EU", "EU", 5}, /* European union countries */
{"AT", "EU", 5},
{"BE", "EU", 5},
{"BG", "EU", 5},
{"CY", "EU", 5},
{"CZ", "EU", 5},
{"DK", "EU", 5},
{"EE", "EU", 5},
{"FI", "EU", 5},
{"FR", "EU", 5},
{"DE", "EU", 5},
{"GR", "EU", 5},
{"HU", "EU", 5},
{"IE", "EU", 5},
{"IT", "EU", 5},
{"LV", "EU", 5},
{"LI", "EU", 5},
{"LT", "EU", 5},
{"LU", "EU", 5},
{"MT", "EU", 5},
{"NL", "EU", 5},
{"PL", "EU", 5},
{"PT", "EU", 5},
{"RO", "EU", 5},
{"SK", "EU", 5},
{"SI", "EU", 5},
{"ES", "EU", 5},
{"SE", "EU", 5},
{"GB", "EU", 5}, /* input ISO "GB" to : EU regrev 05 */
{"IL", "IL", 0},
{"CH", "CH", 0},
{"TR", "TR", 0},
{"NO", "NO", 0},
{"KR", "XY", 3},
{"AU", "XY", 3},
{"CN", "XY", 3}, /* input ISO "CN" to : XY regrev 03 */
{"TW", "XY", 3},
{"AR", "XY", 3},
{"MX", "XY", 3}
#endif /* EXAMPLE_TABLE */
};
/* Customized Locale convertor
* input : ISO 3166-1 country abbreviation
* output: customized cspec
*/
void get_customized_country_code(char *country_iso_code, wl_country_t *cspec)
{
#ifdef CUSTOMER_HW2
struct cntry_locales_custom *cloc_ptr;
if (!cspec)
return;
cloc_ptr = wifi_get_country_code(country_iso_code);
if (cloc_ptr) {
strlcpy(cspec->ccode, cloc_ptr->custom_locale, WLC_CNTRY_BUF_SZ);
cspec->rev = cloc_ptr->custom_locale_rev;
}
return;
#else
int size, i;
size = ARRAYSIZE(translate_custom_table);
if (cspec == 0)
return;
if (size == 0)
return;
for (i = 0; i < size; i++) {
if (strcmp(country_iso_code, translate_custom_table[i].iso_abbrev) == 0) {
memcpy(cspec->ccode, translate_custom_table[i].custom_locale, WLC_CNTRY_BUF_SZ);
cspec->rev = translate_custom_table[i].custom_locale_rev;
return;
}
}
memcpy(cspec->ccode, translate_custom_table[0].custom_locale, WLC_CNTRY_BUF_SZ);
cspec->rev = translate_custom_table[0].custom_locale_rev;
return;
#endif
}
| sdadier/gb_kernel_2.6.32.9-mtd | Kernel/drivers/net/wireless/bcm4329/dhd_custom_gpio.c | C | gpl-2.0 | 8,018 |
// Test for method java.util.IllegalFormatPrecisionException.getClass().getFields()
// Copyright (C) 2012 Pavel Tisnovsky <[email protected]>
// This file is part of Mauve.
// Mauve is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
// Mauve is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Mauve; see the file COPYING. If not, write to
// the Free Software Foundation, Inc., 51 Franklin Street,
// Fifth Floor, Boston, MA 02110-1301 USA.
// Tags: JDK1.5
package gnu.testlet.java.util.IllegalFormatPrecisionException.classInfo;
import gnu.testlet.TestHarness;
import gnu.testlet.Testlet;
import java.util.IllegalFormatPrecisionException;
import java.util.Map;
import java.util.HashMap;
/**
* Test for method java.util.IllegalFormatPrecisionException.getClass().getFields()
*/
public class getFields implements Testlet
{
/**
* Runs the test using the specified harness.
*
* @param harness the test harness (<code>null</code> not permitted).
*/
public void test(TestHarness harness)
{
// map of fields which should exists
Map<String, String> testedFields = null;
// map of fields for (Open)JDK6
Map<String, String> testedFields_jdk6 = new HashMap<String, String>();
// map of fields for (Open)JDK7
Map<String, String> testedFields_jdk7 = new HashMap<String, String>();
// map for fields declared in (Open)JDK6
// --- empty ---
// map for fields declared in (Open)JDK7
// --- empty ---
// create instance of a class IllegalFormatPrecisionException
final Object o = new IllegalFormatPrecisionException(42);
// get a runtime class of an object "o"
final Class c = o.getClass();
// get the right map containing field signatures
testedFields = getJavaVersion() < 7 ? testedFields_jdk6 : testedFields_jdk7;
// get all fields for this class
java.lang.reflect.Field[] fields = c.getFields();
// expected number of fields
final int expectedNumberOfFields = testedFields.size();
// basic check for a number of fields
harness.check(fields.length, expectedNumberOfFields);
}
/**
* Returns version of Java. The input could have the following form: "1.7.0_06"
* and we are interested only in "7" in this case.
*
* @return Java version
*/
protected int getJavaVersion() {
String javaVersionStr = System.getProperty("java.version");
String[] parts = javaVersionStr.split("\\.");
return Integer.parseInt(parts[1]);
}
}
| niloc132/mauve-gwt | src/main/java/gnu/testlet/java/util/IllegalFormatPrecisionException/classInfo/getFields.java | Java | gpl-2.0 | 3,040 |
# Turn Off the Lights Browser Extension
<img alt="Turn Off the Lights Browser Extension Logo" src="https://github.com/turnoffthelights/Turn-Off-the-Lights-Chrome-extension/blob/master/src/icons/icon48.png" align="left" style="padding: 0 10px 5px 0">
**Turn Off the Lights** is a popular browser extension that works on all major web browsers such as Google Chrome, Firefox, Opera, Safari, Yandex, Maxthon, Brave, Vivaldi, Cốc Cốc, and Microsoft Edge.



Project<br>
[](https://github.com/turnoffthelights/Turn-Off-the-Lights-Chrome-extension/actions/workflows/codeql-analysis.yml)
[](https://lgtm.com/projects/g/turnoffthelights/Turn-Off-the-Lights-Chrome-extension/context:javascript)
Using Turn Off the Lights to dims the web page and reduces the eye strain caused by the bright screen. And it will highlight the video player on that web page such as on YouTube.
**[Join our growing community on Facebook](https://www.facebook.com/turnoffthelight) to stay up to date!**
**[Join our growing Translators community on Crowdin](https://www.crowdin.com/project/turnoffthelights) to stay up to date!**
**[Please use and enjoy it, and if you can make a donation of any amount, I'd appreciate it immensely](https://www.turnoffthelights.com/donate.html)**
<div style="text-align:center">
<img alt="Turn Off the Lights Browser extension Screenshot in Google Chrome" src="https://www.turnoffthelights.com/images/turnoffthelights-twitter.png">
</div>
## Features
* Turn the lights back on, by clicking on it
* Support multiple video sites: YouTube, HTML5 video,... and more
* Customize your YouTube:
* Auto HD: Set videos to play in HD automatically. Users can select from highres > 8K > 5K> 4K > 1080p > 720p > 480p > 360p > 240p > 144p > default
* Auto Wide: Automatically plays the video on the widest mode
,... and more
* Easter Eggs:
* Shortcut key: T -> Do you like a real movie theater feeling?
* Option to make the screen dark when the user clicks on the play button
* Option to turn on/off the fade in and fade out effects
* Custom colors
* Option to Flash Detection
* Option to Show Dimness Level Bar
* Option Eye Protection for when it's night. And with whitelist/blacklist filter
* Option atmosphere lighting that shows a glow around the video player
* Option to show the dark layer on the top of the window
* Options to shortcut keys:
* Ctrl + Shift + L to toggle the lights
* Alt + F8 to restore the default opacity value
* Alt + F9 to save the current opacity value
* Alt + F10 to enable/disable the Eye Protection feature
* Alt + (arrow up) to increase the opacity
* Alt + (arrow down) to decrease the opacity
* Alt + * to toggle the lights on all open tabs
* Option Camera Motion
* Option Speech Recognition
* Option for Mouse Wheel Volume Control for each HTML5 video player
* Option to add a filter to the current HTML5 video player (grayscale, sepia, invert, contrast, saturate, hue rotation and brightness)
* Option to show the Audio Visualization effect on top of the current HTML5 video (Blocks, Frequency and Music Tunnel)
* Option to loop the current HTML5 video player
* Option to place the Night Mode switch to toggle YouTube in black or white theme. And with whitelist/blacklist filter
* Time stamp: Activate the Night Mode within the chosen time
* Blackout: Dims the web page and activates the Night Mode
* Option to stop YouTube and HTML5 videos from automatically playing.
## Installation
#### Loading it in Chrome:
1. Open your Google Chrome web browser, browse to [chrome://extensions](chrome://extensions)
1. If you have already Turn Off the Lights Chrome extension installed, disable it
1. Check **Developer mode** in the top of the Extensions page
1. Click **Load unpacked extension...**
1. Choose the sub-directory **src** (where manifest.json resides)
#### Store hyperlinks:
The Browser extension is available in the following stores:
* [Google Chrome in the Chrome web store](https://chrome.google.com/webstore/detail/turn-off-the-lights/bfbmjmiodbnnpllbbbfblcplfjjepjdn)
* [Opera in the Opera Extension gallery](https://addons.opera.com/extensions/details/turn-off-the-lights/)
* [Firefox in the Firefox Extension gallery](https://addons.mozilla.org/firefox/addon/turn-off-the-lights/)
* [Safari in the Safari Extension gallery](https://itunes.apple.com/us/app/turn-off-the-lights-for-safari/id1273998507?ls=1&mt=12&at=1010lwtb)
* Available for Yandex: See Yandex built-in extension
* [Maxthon in the Maxthon Extension gallery](http://extension.maxthon.com/detail/index.php?view_id=1813)
* [Microsoft Edge in the Windows Store](https://microsoftedge.microsoft.com/addons/detail/turn-off-the-lights/fmamkbgpnienhphflfdamlhnljffjdgm)
| turnoffthelights/Turn-Off-the-Lights-Chrome-extension | .github/README.md | Markdown | gpl-2.0 | 5,391 |
/** ============================================================================
* @file zsp800m_map.c
*
* @path $(APUDRV)/gpp/src/arch/ZSP800M/
*
* @desc Defines the configuration mapping information for the APU DRIVER
* driver.
*
* @ver 0.01.00.00
* ============================================================================
* Copyright (C) 2011-2012, Nufront Incorporated - http://www.nufront.com/
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
* whether express or implied; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* ============================================================================
*/
/* ----------------------------------- APU DRIVER Headers */
#include <apudrv.h>
#include <_apudrv.h>
#if defined (POOL_COMPONENT)
#include <pooldefs.h>
#endif /* if defined (POOL_COMPONENT) */
#if defined (MSGQ_COMPONENT)
#include <msgqdefs.h>
#endif /* if defined (MSGQ_COMPONENT) */
#include <cfgmap.h>
#if defined (__cplusplus)
EXTERN "C" {
#endif /* defined (__cplusplus) */
/** ============================================================================
* @name ZSP800MMAP_DspObjects
*
* @desc Array of configuration mapping objects for the DSPs in the system.
* ============================================================================
*/
EXTERN DSP_Interface ZSP800M_Interface ;
CONST CFGMAP_Dsp ZSP800MMAP_DspObjects [] =
{
{
"ZSP800M", /* NAME : Name of the DSP */
&ZSP800M_Interface /* INTERFACE : DSP interface table */
}
} ;
/** ============================================================================
* @name ZSP800MMAP_LoaderObjects
*
* @desc Array of configuration mapping objects for the DSP executable
* loaders in the system.
* ============================================================================
*/
EXTERN KFILE_Interface KFILEPSEUDO_Interface ;
EXTERN KFILE_Interface KFILEDEF_Interface ;
CONST CFGMAP_Loader ZSP800MMAP_LoaderObjects [] =
{
{
"BIN",
NULL,//&BINFILE_Interface,
&KFILEDEF_Interface
}
} ;
#if (!defined (ONLY_PROC_COMPONENT))
/** ============================================================================
* @name ZSP800MMAP_LinkDrvObjects
*
* @desc Array of configuration mapping objects for the link drivers in the
* system.
* ============================================================================
*/
EXTERN DRV_Interface SHMDRV_Interface ;
CONST CFGMAP_LinkDrv ZSP800MMAP_LinkDrvObjects [] =
{
{
"SHMDRV", /* NAME : Name of the link driver */
&SHMDRV_Interface /* INTERFACE : Link driver interface table */
}
} ;
/** ============================================================================
* @name ZSP800MMAP_IpsObjects
*
* @desc Array of configuration mapping objects for the IPS components in the
* system.
* ============================================================================
*/
EXTERN FnIpsInit IPS_init ;
EXTERN FnIpsExit IPS_exit ;
#if defined (DDSP_DEBUG)
EXTERN FnIpsDebug IPS_debug ;
#endif /* if defined (DDSP_DEBUG) */
CONST CFGMAP_Ips ZSP800MMAP_IpsObjects [] =
{
{
"IPS", /* NAME : Name of the IPS */
(FnIpsInit) &IPS_init, /* FXN_INIT : Init function for the IPS */
(FnIpsExit) &IPS_exit, /* FXN_EXIT : Exit function for the IPS */
#if defined (DDSP_DEBUG)
(FnIpsDebug) &IPS_debug /* FXN_DEBUG : Debug function for the IPS */
#endif /* if defined (DDSP_DEBUG) */
}
} ;
#endif /* if (!defined (ONLY_PROC_COMPONENT)) */
#if defined (POOL_COMPONENT)
/** ============================================================================
* @name ZSP800MMAP_PoolObjects
*
* @desc Array of configuration mapping objects for the POOLs in the system.
* ============================================================================
*/
EXTERN FnPoolInit SMAPOOL_init ;
EXTERN FnPoolExit SMAPOOL_exit ;
EXTERN POOL_Interface SMAPOOL_Interface ;
#if defined (PCPY_LINK)
EXTERN FnPoolInit BUFPOOL_init ;
EXTERN FnPoolExit BUFPOOL_exit ;
EXTERN POOL_Interface BUFPOOL_Interface ;
#endif /* if defined (PCPY_LINK) */
CONST CFGMAP_Pool ZSP800MMAP_PoolObjects [] =
{
{
"SMAPOOL", /* NAME : Name of the pool */
(FnPoolInit) &SMAPOOL_init, /* FXN_INIT : Init function for the pool */
(FnPoolExit) &SMAPOOL_exit, /* FXN_EXIT : Exit function for the pool */
&SMAPOOL_Interface /* INTERFACE : Pool interface table */
},
#if defined (PCPY_LINK)
{
"BUFPOOL", /* NAME : Name of the pool */
(FnPoolInit) &BUFPOOL_init, /* FXN_INIT : Init function for the pool */
(FnPoolExit) &BUFPOOL_exit, /* FXN_EXIT : Exit function for the pool */
&BUFPOOL_Interface /* INTERFACE : Pool interface table */
}
#endif /* if defined (PCPY_LINK) */
} ;
#endif /* if defined (POOL_COMPONENT) */
#if defined (CHNL_COMPONENT)
/** ============================================================================
* @name ZSP800MMAP_DataDrvObjects
*
* @desc Array of configuration mapping objects for the Data drivers in the
* system.
* ============================================================================
*/
EXTERN DATA_Interface ZCPYDATA_Interface ;
CONST CFGMAP_DataDrv ZSP800MMAP_DataDrvObjects [] =
{
{
"ZCPYDATA", /* NAME : Name of the data driver */
&ZCPYDATA_Interface /* INTERFACE : Data transfer interface table */
}
} ;
#endif /* if defined (CHNL_COMPONENT) */
#if defined (MSGQ_COMPONENT)
/** ============================================================================
* @name ZSP800MMAP_MqtObjects
*
* @desc Array of configuration mapping objects for the Message Queue
* Transports in the system.
* ============================================================================
*/
EXTERN MQT_Interface ZCPYMQT_Interface ;
CONST CFGMAP_Mqt ZSP800MMAP_MqtObjects [] =
{
{
"ZCPYMQT", /* NAME : Name of the Message Queue Transport */
&ZCPYMQT_Interface /* INTERFACE : MQT Interface table */
}
} ;
#endif /* if defined (MSGQ_COMPONENT) */
/** ============================================================================
* @name ZSP800MMAP_Config
*
* @desc APU DRIVER configuration mapping structure.
* ============================================================================
*/
CFGMAP_Object ZSP800MMAP_Config = {
1, /* NUMDSPS : Number of types of DSPs */
(CFGMAP_Dsp *) ZSP800MMAP_DspObjects, /* DSPOBJECTS : Array of DSP configuration mapping objects */
1, /* NUMLOADERS : Number of types of DSP executable loaders */
(CFGMAP_Loader *) ZSP800MMAP_LoaderObjects, /* LOADERS : Array of DSP executable loader configuration mapping objects */
#if (!defined (ONLY_PROC_COMPONENT))
1, /* NUMLINKDRVS : Number of types of link drivers */
(CFGMAP_LinkDrv *) ZSP800MMAP_LinkDrvObjects, /* LINKDRVOBJECTS : Array of Link Driver configuration mapping objects */
1, /* NUMIPS : Number of types of IPS */
(CFGMAP_Ips *) ZSP800MMAP_IpsObjects, /* IPSOBJECTS : Array of IPS configuration mapping objects */
#else
0, /* NUMLINKDRVS : Number of types of link drivers */
NULL, /* LINKDRVOBJECTS : Array of Link Driver configuration mapping objects */
0, /* NUMIPS : Number of types of IPS */
NULL, /* IPSOBJECTS : Array of IPS configuration mapping objects */
#endif /* if (!defined (ONLY_PROC_COMPONENT)) */
#if defined (POOL_COMPONENT)
1, /* NUMPOOLS : Number of types of POOLs */
(CFGMAP_Pool *) ZSP800MMAP_PoolObjects, /* POOLOBJECTS : Array of POOL configuration mapping objects */
#endif /* if defined (POOL_COMPONENT) */
#if defined (CHNL_COMPONENT)
1, /* NUMDATADRIVERS : Number of types of Data drivers */
(CFGMAP_DataDrv *) ZSP800MMAP_DataDrvObjects, /* DATADRIVERS : Array of Data driver configuration mapping objects */
#endif /* if defined (CHNL_COMPONENT) */
#if defined (MSGQ_COMPONENT)
1, /* NUMMQTS : Number of types of MQTs */
(CFGMAP_Mqt *) ZSP800MMAP_MqtObjects /* MQTOBJECTS : Array of MQT configuration mapping objects */
#endif /* if defined (MSGQ_COMPONENT) */
} ;
#if defined (__cplusplus)
}
#endif /* defined (__cplusplus) */
| adamdmcbride/Nufront_linux_kernel | drivers/char/apu/gpp/src/arch/ZSP800M/zsp800m_map.c | C | gpl-2.0 | 9,567 |
<?php
$consumer_key = $_GET['1'];
$consumer_secret = $_GET['2'];
$oauth_access_token = $_GET['3'];
$oauth_access_token_secret = $_GET['4'];
switch($_GET['url'])
{
case 'timeline':
$rest = 'statuses/user_timeline' ;
$params = Array('count' => $_GET['count'], 'include_rts' => $_GET['include_rts'], 'exclude_replies' => $_GET['exclude_replies'], 'screen_name' => $_GET['screen_name']);
break;
case 'search':
$rest = "search/tweets";
$params = Array('q' => $_GET['q'], 'count' => $_GET['count'], 'include_rts' => $_GET['include_rts']);
break;
case 'list':
$rest = "lists/statuses";
$params = Array('list_id' => $_GET['list_id'], 'count' => $_GET['count'], 'include_rts' => $_GET['include_rts']);
break;
default:
$rest = 'statuses/user_timeline' ;
$params = Array('count' => '20');
break;
}
$auth = new dcsnt_TwitterOAuth($consumer_key,$consumer_secret,$oauth_access_token,$oauth_access_token_secret);
$get = $auth->get( $rest, $params );
if( ! $get ) {
echo 'An error occurs while reading the feed, please check your connection or settings';
}
if( isset( $get->errors ) ) {
// foreach( $get->errors as $key => $val ) echo $val;
echo 'errors';
//print_r($get->errors);
} else {
echo $get;
}
/*
* Abraham Williams ([email protected]) http://abrah.am
*
* The first PHP Library to support OAuth for Twitter's REST API.
*/
/**
* Twitter OAuth class
*/
class dcsnt_TwitterOAuth {
/* Contains the last HTTP status code returned. */
public $http_code;
/* Contains the last API call. */
public $url;
/* Set up the API root URL. */
public $host = "https://api.twitter.com/1.1/";
/* Set timeout default. */
public $timeout = 30;
/* Set connect timeout. */
public $connecttimeout = 30;
/* Verify SSL Cert. */
public $ssl_verifypeer = FALSE;
/* Respons format. */
public $format = 'json';
/* Decode returned json data. */
public $decode_json = false;
/* Contains the last HTTP headers returned. */
public $http_info;
/* Set the useragnet. */
public $useragent = 'TwitterOAuth v0.2.0-beta2';
/* Immediately retry the API call if the response was not successful. */
//public $retry = TRUE;
/**
* Set API URLS
*/
function accessTokenURL() { return 'https://api.twitter.com/oauth/access_token'; }
function authenticateURL() { return 'https://api.twitter.com/oauth/authenticate'; }
function authorizeURL() { return 'https://api.twitter.com/oauth/authorize'; }
function requestTokenURL() { return 'https://api.twitter.com/oauth/request_token'; }
/**
* Debug helpers
*/
function lastStatusCode() { return $this->http_status; }
function lastAPICall() { return $this->last_api_call; }
/**
* construct TwitterOAuth object
*/
function __construct($consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL) {
$this->sha1_method = new dcsnt_OAuthSignatureMethod_HMAC_SHA1();
$this->consumer = new dcsnt_OAuthConsumer($consumer_key, $consumer_secret);
if (!empty($oauth_token) && !empty($oauth_token_secret)) {
$this->token = new dcsnt_OAuthConsumer($oauth_token, $oauth_token_secret);
} else {
$this->token = NULL;
}
}
/**
* Get a request_token from Twitter
*
* @returns a key/value array containing oauth_token and oauth_token_secret
*/
function getRequestToken($oauth_callback = NULL) {
$parameters = array();
if (!empty($oauth_callback)) {
$parameters['oauth_callback'] = $oauth_callback;
}
$request = $this->dcsnt_OAuthRequest($this->requestTokenURL(), 'GET', $parameters);
$token = dcsnt_OAuthUtil::parse_parameters($request);
$this->token = new dcsnt_OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
return $token;
}
/**
* Get the authorize URL
*
* @returns a string
*/
function getAuthorizeURL($token, $sign_in_with_twitter = TRUE) {
if (is_array($token)) {
$token = $token['oauth_token'];
}
if (empty($sign_in_with_twitter)) {
return $this->authorizeURL() . "?oauth_token={$token}";
} else {
return $this->authenticateURL() . "?oauth_token={$token}";
}
}
/**
* Exchange request token and secret for an access token and
* secret, to sign API calls.
*
* @returns array("oauth_token" => "the-access-token",
* "oauth_token_secret" => "the-access-secret",
* "user_id" => "9436992",
* "screen_name" => "abraham")
*/
function getAccessToken($oauth_verifier = FALSE) {
$parameters = array();
if (!empty($oauth_verifier)) {
$parameters['oauth_verifier'] = $oauth_verifier;
}
$request = $this->dcsnt_OAuthRequest($this->accessTokenURL(), 'GET', $parameters);
$token = dcsnt_OAuthUtil::parse_parameters($request);
$this->token = new dcsnt_OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
return $token;
}
/**
* One time exchange of username and password for access token and secret.
*
* @returns array("oauth_token" => "the-access-token",
* "oauth_token_secret" => "the-access-secret",
* "user_id" => "9436992",
* "screen_name" => "abraham",
* "x_auth_expires" => "0")
*/
function getXAuthToken($username, $password) {
$parameters = array();
$parameters['x_auth_username'] = $username;
$parameters['x_auth_password'] = $password;
$parameters['x_auth_mode'] = 'client_auth';
$request = $this->dcsnt_OAuthRequest($this->accessTokenURL(), 'POST', $parameters);
$token = dcsnt_OAuthUtil::parse_parameters($request);
$this->token = new dcsnt_OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
return $token;
}
/**
* GET wrapper for dcsnt_OAuthRequest.
*/
function get($url, $parameters = array()) {
$response = $this->dcsnt_OAuthRequest($url, 'GET', $parameters);
if ($this->format === 'json' && $this->decode_json) {
return json_decode($response);
}
return $response;
}
/**
* POST wrapper for dcsnt_OAuthRequest.
*/
function post($url, $parameters = array()) {
$response = $this->dcsnt_OAuthRequest($url, 'POST', $parameters);
if ($this->format === 'json' && $this->decode_json) {
return json_decode($response);
}
return $response;
}
/**
* DELETE wrapper for oAuthReqeust.
*/
function delete($url, $parameters = array()) {
$response = $this->dcsnt_OAuthRequest($url, 'DELETE', $parameters);
if ($this->format === 'json' && $this->decode_json) {
return json_decode($response);
}
return $response;
}
/**
* Format and sign an OAuth / API request
*/
function dcsnt_OAuthRequest($url, $method, $parameters) {
if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) {
$url = "{$this->host}{$url}.{$this->format}";
}
$request = dcsnt_OAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
$request->sign_request($this->sha1_method, $this->consumer, $this->token);
switch ($method) {
case 'GET':
return $this->http($request->to_url(), 'GET');
default:
return $this->http($request->get_normalized_http_url(), $method, $request->to_postdata());
}
}
/**
* Make an HTTP request
*
* @return API results
*/
function http($url, $method, $postfields = NULL) {
$this->http_info = array();
$ci = curl_init();
/* Curl settings */
curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent);
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
curl_setopt($ci, CURLOPT_HEADER, FALSE);
switch ($method) {
case 'POST':
curl_setopt($ci, CURLOPT_POST, TRUE);
if (!empty($postfields)) {
curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
}
break;
case 'DELETE':
curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
if (!empty($postfields)) {
$url = "{$url}?{$postfields}";
}
}
curl_setopt($ci, CURLOPT_URL, $url);
$response = curl_exec($ci);
$this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
$this->http_info = array_merge($this->http_info, curl_getinfo($ci));
$this->url = $url;
curl_close ($ci);
return $response;
}
/**
* Get the header info to store.
*/
function getHeader($ch, $header) {
$i = strpos($header, ':');
if (!empty($i)) {
$key = str_replace('-', '_', strtolower(substr($header, 0, $i)));
$value = trim(substr($header, $i + 2));
$this->http_header[$key] = $value;
}
return strlen($header);
}
}
// vim: foldmethod=marker
/* Generic exception class
*/
class dcsnt_OAuthException extends Exception {
// pass
}
class dcsnt_OAuthConsumer {
public $key;
public $secret;
function __construct($key, $secret, $callback_url=NULL) {
$this->key = $key;
$this->secret = $secret;
$this->callback_url = $callback_url;
}
function __toString() {
return "OAuthConsumer[key=$this->key,secret=$this->secret]";
}
}
class dcsnt_OAuthToken {
// access tokens and request tokens
public $key;
public $secret;
/**
* key = the token
* secret = the token secret
*/
function __construct($key, $secret) {
$this->key = $key;
$this->secret = $secret;
}
/**
* generates the basic string serialization of a token that a server
* would respond to request_token and access_token calls with
*/
function to_string() {
return "oauth_token=" .
dcsnt_OAuthUtil::urlencode_rfc3986($this->key) .
"&oauth_token_secret=" .
dcsnt_OAuthUtil::urlencode_rfc3986($this->secret);
}
function __toString() {
return $this->to_string();
}
}
/**
* A class for implementing a Signature Method
* See section 9 ("Signing Requests") in the spec
*/
abstract class dcsnt_OAuthSignatureMethod {
/**
* Needs to return the name of the Signature Method (ie HMAC-SHA1)
* @return string
*/
abstract public function get_name();
/**
* Build up the signature
* NOTE: The output of this function MUST NOT be urlencoded.
* the encoding is handled in dcsnt_OAuthRequest when the final
* request is serialized
* @param dcsnt_OAuthRequest $request
* @param OAuthConsumer $consumer
* @param dcsnt_OAuthToken $token
* @return string
*/
abstract public function build_signature($request, $consumer, $token);
/**
* Verifies that a given signature is correct
* @param dcsnt_OAuthRequest $request
* @param OAuthConsumer $consumer
* @param dcsnt_OAuthToken $token
* @param string $signature
* @return bool
*/
public function check_signature($request, $consumer, $token, $signature) {
$built = $this->build_signature($request, $consumer, $token);
return $built == $signature;
}
}
/**
* The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104]
* where the Signature Base String is the text and the key is the concatenated values (each first
* encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&'
* character (ASCII code 38) even if empty.
* - Chapter 9.2 ("HMAC-SHA1")
*/
class dcsnt_OAuthSignatureMethod_HMAC_SHA1 extends dcsnt_OAuthSignatureMethod {
function get_name() {
return "HMAC-SHA1";
}
public function build_signature($request, $consumer, $token) {
$base_string = $request->get_signature_base_string();
$request->base_string = $base_string;
$key_parts = array(
$consumer->secret,
($token) ? $token->secret : ""
);
$key_parts = dcsnt_OAuthUtil::urlencode_rfc3986($key_parts);
$key = implode('&', $key_parts);
return base64_encode(hash_hmac('sha1', $base_string, $key, true));
}
}
/**
* The PLAINTEXT method does not provide any security protection and SHOULD only be used
* over a secure channel such as HTTPS. It does not use the Signature Base String.
* - Chapter 9.4 ("PLAINTEXT")
*/
class dcsnt_OAuthSignatureMethod_PLAINTEXT extends dcsnt_OAuthSignatureMethod {
public function get_name() {
return "PLAINTEXT";
}
/**
* oauth_signature is set to the concatenated encoded values of the Consumer Secret and
* Token Secret, separated by a '&' character (ASCII code 38), even if either secret is
* empty. The result MUST be encoded again.
* - Chapter 9.4.1 ("Generating Signatures")
*
* Please note that the second encoding MUST NOT happen in the SignatureMethod, as
* dcsnt_OAuthRequest handles this!
*/
public function build_signature($request, $consumer, $token) {
$key_parts = array(
$consumer->secret,
($token) ? $token->secret : ""
);
$key_parts = dcsnt_OAuthUtil::urlencode_rfc3986($key_parts);
$key = implode('&', $key_parts);
$request->base_string = $key;
return $key;
}
}
/**
* The RSA-SHA1 signature method uses the RSASSA-PKCS1-v1_5 signature algorithm as defined in
* [RFC3447] section 8.2 (more simply known as PKCS#1), using SHA-1 as the hash function for
* EMSA-PKCS1-v1_5. It is assumed that the Consumer has provided its RSA public key in a
* verified way to the Service Provider, in a manner which is beyond the scope of this
* specification.
* - Chapter 9.3 ("RSA-SHA1")
*/
abstract class dcsnt_OAuthSignatureMethod_RSA_SHA1 extends dcsnt_OAuthSignatureMethod {
public function get_name() {
return "RSA-SHA1";
}
// Up to the SP to implement this lookup of keys. Possible ideas are:
// (1) do a lookup in a table of trusted certs keyed off of consumer
// (2) fetch via http using a url provided by the requester
// (3) some sort of specific discovery code based on request
//
// Either way should return a string representation of the certificate
protected abstract function fetch_public_cert(&$request);
// Up to the SP to implement this lookup of keys. Possible ideas are:
// (1) do a lookup in a table of trusted certs keyed off of consumer
//
// Either way should return a string representation of the certificate
protected abstract function fetch_private_cert(&$request);
public function build_signature($request, $consumer, $token) {
$base_string = $request->get_signature_base_string();
$request->base_string = $base_string;
// Fetch the private key cert based on the request
$cert = $this->fetch_private_cert($request);
// Pull the private key ID from the certificate
$privatekeyid = openssl_get_privatekey($cert);
// Sign using the key
$ok = openssl_sign($base_string, $signature, $privatekeyid);
// Release the key resource
openssl_free_key($privatekeyid);
return base64_encode($signature);
}
public function check_signature($request, $consumer, $token, $signature) {
$decoded_sig = base64_decode($signature);
$base_string = $request->get_signature_base_string();
// Fetch the public key cert based on the request
$cert = $this->fetch_public_cert($request);
// Pull the public key ID from the certificate
$publickeyid = openssl_get_publickey($cert);
// Check the computed signature against the one passed in the query
$ok = openssl_verify($base_string, $decoded_sig, $publickeyid);
// Release the key resource
openssl_free_key($publickeyid);
return $ok == 1;
}
}
class dcsnt_OAuthRequest {
private $parameters;
private $http_method;
private $http_url;
// for debug purposes
public $base_string;
public static $version = '1.0';
public static $POST_INPUT = 'php://input';
function __construct($http_method, $http_url, $parameters=NULL) {
@$parameters or $parameters = array();
$parameters = array_merge( dcsnt_OAuthUtil::parse_parameters(parse_url($http_url, PHP_URL_QUERY)), $parameters);
$this->parameters = $parameters;
$this->http_method = $http_method;
$this->http_url = $http_url;
}
/**
* attempt to build up a request from what was passed to the server
*/
public static function from_request($http_method=NULL, $http_url=NULL, $parameters=NULL) {
$scheme = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on")
? 'http'
: 'https';
@$http_url or $http_url = $scheme .
'://' . $_SERVER['HTTP_HOST'] .
':' .
$_SERVER['SERVER_PORT'] .
$_SERVER['REQUEST_URI'];
@$http_method or $http_method = $_SERVER['REQUEST_METHOD'];
// We weren't handed any parameters, so let's find the ones relevant to
// this request.
// If you run XML-RPC or similar you should use this to provide your own
// parsed parameter-list
if (!$parameters) {
// Find request headers
$request_headers = dcsnt_OAuthUtil::get_headers();
// Parse the query-string to find GET parameters
$parameters = dcsnt_OAuthUtil::parse_parameters($_SERVER['QUERY_STRING']);
// It's a POST request of the proper content-type, so parse POST
// parameters and add those overriding any duplicates from GET
if ($http_method == "POST"
&& @strstr($request_headers["Content-Type"],
"application/x-www-form-urlencoded")
) {
$post_data = dcsnt_OAuthUtil::parse_parameters(
file_get_contents(self::$POST_INPUT)
);
$parameters = array_merge($parameters, $post_data);
}
// We have a Authorization-header with OAuth data. Parse the header
// and add those overriding any duplicates from GET or POST
if (@substr($request_headers['Authorization'], 0, 6) == "OAuth ") {
$header_parameters = dcsnt_OAuthUtil::split_header(
$request_headers['Authorization']
);
$parameters = array_merge($parameters, $header_parameters);
}
}
return new dcsnt_OAuthRequest($http_method, $http_url, $parameters);
}
/**
* pretty much a helper function to set up the request
*/
public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL) {
@$parameters or $parameters = array();
$defaults = array("oauth_version" => dcsnt_OAuthRequest::$version,
"oauth_nonce" => dcsnt_OAuthRequest::generate_nonce(),
"oauth_timestamp" => dcsnt_OAuthRequest::generate_timestamp(),
"oauth_consumer_key" => $consumer->key);
if ($token)
$defaults['oauth_token'] = $token->key;
$parameters = array_merge($defaults, $parameters);
return new dcsnt_OAuthRequest($http_method, $http_url, $parameters);
}
public function set_parameter($name, $value, $allow_duplicates = true) {
if ($allow_duplicates && isset($this->parameters[$name])) {
// We have already added parameter(s) with this name, so add to the list
if (is_scalar($this->parameters[$name])) {
// This is the first duplicate, so transform scalar (string)
// into an array so we can add the duplicates
$this->parameters[$name] = array($this->parameters[$name]);
}
$this->parameters[$name][] = $value;
} else {
$this->parameters[$name] = $value;
}
}
public function get_parameter($name) {
return isset($this->parameters[$name]) ? $this->parameters[$name] : null;
}
public function get_parameters() {
return $this->parameters;
}
public function unset_parameter($name) {
unset($this->parameters[$name]);
}
/**
* The request parameters, sorted and concatenated into a normalized string.
* @return string
*/
public function get_signable_parameters() {
// Grab all parameters
$params = $this->parameters;
// Remove oauth_signature if present
// Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.")
if (isset($params['oauth_signature'])) {
unset($params['oauth_signature']);
}
return dcsnt_OAuthUtil::build_http_query($params);
}
/**
* Returns the base string of this request
*
* The base string defined as the method, the url
* and the parameters (normalized), each urlencoded
* and the concated with &.
*/
public function get_signature_base_string() {
$parts = array(
$this->get_normalized_http_method(),
$this->get_normalized_http_url(),
$this->get_signable_parameters()
);
$parts = dcsnt_OAuthUtil::urlencode_rfc3986($parts);
return implode('&', $parts);
}
/**
* just uppercases the http method
*/
public function get_normalized_http_method() {
return strtoupper($this->http_method);
}
/**
* parses the url and rebuilds it to be
* scheme://host/path
*/
public function get_normalized_http_url() {
$parts = parse_url($this->http_url);
$port = @$parts['port'];
$scheme = $parts['scheme'];
$host = $parts['host'];
$path = @$parts['path'];
$port or $port = ($scheme == 'https') ? '443' : '80';
if (($scheme == 'https' && $port != '443')
|| ($scheme == 'http' && $port != '80')) {
$host = "$host:$port";
}
return "$scheme://$host$path";
}
/**
* builds a url usable for a GET request
*/
public function to_url() {
$post_data = $this->to_postdata();
$out = $this->get_normalized_http_url();
if ($post_data) {
$out .= '?'.$post_data;
}
return $out;
}
/**
* builds the data one would send in a POST request
*/
public function to_postdata() {
return dcsnt_OAuthUtil::build_http_query($this->parameters);
}
/**
* builds the Authorization: header
*/
public function to_header($realm=null) {
$first = true;
if($realm) {
$out = 'Authorization: OAuth realm="' . dcsnt_OAuthUtil::urlencode_rfc3986($realm) . '"';
$first = false;
} else
$out = 'Authorization: OAuth';
$total = array();
foreach ($this->parameters as $k => $v) {
if (substr($k, 0, 5) != "oauth") continue;
if (is_array($v)) {
throw new dcsnt_OAuthException('Arrays not supported in headers');
}
$out .= ($first) ? ' ' : ',';
$out .= dcsnt_OAuthUtil::urlencode_rfc3986($k) .
'="' .
dcsnt_OAuthUtil::urlencode_rfc3986($v) .
'"';
$first = false;
}
return $out;
}
public function __toString() {
return $this->to_url();
}
public function sign_request($signature_method, $consumer, $token) {
$this->set_parameter(
"oauth_signature_method",
$signature_method->get_name(),
false
);
$signature = $this->build_signature($signature_method, $consumer, $token);
$this->set_parameter("oauth_signature", $signature, false);
}
public function build_signature($signature_method, $consumer, $token) {
$signature = $signature_method->build_signature($this, $consumer, $token);
return $signature;
}
/**
* util function: current timestamp
*/
private static function generate_timestamp() {
return time();
}
/**
* util function: current nonce
*/
private static function generate_nonce() {
$mt = microtime();
$rand = mt_rand();
return md5($mt . $rand); // md5s look nicer than numbers
}
}
class dcsnt_OAuthServer {
protected $timestamp_threshold = 300; // in seconds, five minutes
protected $version = '1.0'; // hi blaine
protected $signature_methods = array();
protected $data_store;
function __construct($data_store) {
$this->data_store = $data_store;
}
public function add_signature_method($signature_method) {
$this->signature_methods[$signature_method->get_name()] =
$signature_method;
}
// high level functions
/**
* process a request_token request
* returns the request token on success
*/
public function fetch_request_token(&$request) {
$this->get_version($request);
$consumer = $this->get_consumer($request);
// no token required for the initial token request
$token = NULL;
$this->check_signature($request, $consumer, $token);
// Rev A change
$callback = $request->get_parameter('oauth_callback');
$new_token = $this->data_store->new_request_token($consumer, $callback);
return $new_token;
}
/**
* process an access_token request
* returns the access token on success
*/
public function fetch_access_token(&$request) {
$this->get_version($request);
$consumer = $this->get_consumer($request);
// requires authorized request token
$token = $this->get_token($request, $consumer, "request");
$this->check_signature($request, $consumer, $token);
// Rev A change
$verifier = $request->get_parameter('oauth_verifier');
$new_token = $this->data_store->new_access_token($token, $consumer, $verifier);
return $new_token;
}
/**
* verify an api call, checks all the parameters
*/
public function verify_request(&$request) {
$this->get_version($request);
$consumer = $this->get_consumer($request);
$token = $this->get_token($request, $consumer, "access");
$this->check_signature($request, $consumer, $token);
return array($consumer, $token);
}
// Internals from here
/**
* version 1
*/
private function get_version(&$request) {
$version = $request->get_parameter("oauth_version");
if (!$version) {
// Service Providers MUST assume the protocol version to be 1.0 if this parameter is not present.
// Chapter 7.0 ("Accessing Protected Ressources")
$version = '1.0';
}
if ($version !== $this->version) {
throw new dcsnt_OAuthException("OAuth version '$version' not supported");
}
return $version;
}
/**
* figure out the signature with some defaults
*/
private function get_signature_method(&$request) {
$signature_method =
@$request->get_parameter("oauth_signature_method");
if (!$signature_method) {
// According to chapter 7 ("Accessing Protected Ressources") the signature-method
// parameter is required, and we can't just fallback to PLAINTEXT
throw new dcsnt_OAuthException('No signature method parameter. This parameter is required');
}
if (!in_array($signature_method,
array_keys($this->signature_methods))) {
throw new dcsnt_OAuthException(
"Signature method '$signature_method' not supported " .
"try one of the following: " .
implode(", ", array_keys($this->signature_methods))
);
}
return $this->signature_methods[$signature_method];
}
/**
* try to find the consumer for the provided request's consumer key
*/
private function get_consumer(&$request) {
$consumer_key = @$request->get_parameter("oauth_consumer_key");
if (!$consumer_key) {
throw new dcsnt_OAuthException("Invalid consumer key");
}
$consumer = $this->data_store->lookup_consumer($consumer_key);
if (!$consumer) {
throw new dcsnt_OAuthException("Invalid consumer");
}
return $consumer;
}
/**
* try to find the token for the provided request's token key
*/
private function get_token(&$request, $consumer, $token_type="access") {
$token_field = @$request->get_parameter('oauth_token');
$token = $this->data_store->lookup_token(
$consumer, $token_type, $token_field
);
if (!$token) {
throw new dcsnt_OAuthException("Invalid $token_type token: $token_field");
}
return $token;
}
/**
* all-in-one function to check the signature on a request
* should guess the signature method appropriately
*/
private function check_signature(&$request, $consumer, $token) {
// this should probably be in a different method
$timestamp = @$request->get_parameter('oauth_timestamp');
$nonce = @$request->get_parameter('oauth_nonce');
$this->check_timestamp($timestamp);
$this->check_nonce($consumer, $token, $nonce, $timestamp);
$signature_method = $this->get_signature_method($request);
$signature = $request->get_parameter('oauth_signature');
$valid_sig = $signature_method->check_signature(
$request,
$consumer,
$token,
$signature
);
if (!$valid_sig) {
throw new dcsnt_OAuthException("Invalid signature");
}
}
/**
* check that the timestamp is new enough
*/
private function check_timestamp($timestamp) {
if( ! $timestamp )
throw new dcsnt_OAuthException(
'Missing timestamp parameter. The parameter is required'
);
// verify that timestamp is recentish
$now = time();
if (abs($now - $timestamp) > $this->timestamp_threshold) {
throw new dcsnt_OAuthException(
"Expired timestamp, yours $timestamp, ours $now"
);
}
}
/**
* check that the nonce is not repeated
*/
private function check_nonce($consumer, $token, $nonce, $timestamp) {
if( ! $nonce )
throw new dcsnt_OAuthException(
'Missing nonce parameter. The parameter is required'
);
// verify that the nonce is uniqueish
$found = $this->data_store->lookup_nonce(
$consumer,
$token,
$nonce,
$timestamp
);
if ($found) {
throw new dcsnt_OAuthException("Nonce already used: $nonce");
}
}
}
class dcsnt_OAuthDataStore {
function lookup_consumer($consumer_key) {
// implement me
}
function lookup_token($consumer, $token_type, $token) {
// implement me
}
function lookup_nonce($consumer, $token, $nonce, $timestamp) {
// implement me
}
function new_request_token($consumer, $callback = null) {
// return a new token attached to this consumer
}
function new_access_token($token, $consumer, $verifier = null) {
// return a new access token attached to this consumer
// for the user associated with this token if the request token
// is authorized
// should also invalidate the request token
}
}
class dcsnt_OAuthUtil {
public static function urlencode_rfc3986($input) {
if (is_array($input)) {
return array_map(array('dcsnt_OAuthUtil', 'urlencode_rfc3986'), $input);
} else if (is_scalar($input)) {
return str_replace(
'+',
' ',
str_replace('%7E', '~', rawurlencode($input))
);
} else {
return '';
}
}
// This decode function isn't taking into consideration the above
// modifications to the encoding process. However, this method doesn't
// seem to be used anywhere so leaving it as is.
public static function urldecode_rfc3986($string) {
return urldecode($string);
}
// Utility function for turning the Authorization: header into
// parameters, has to do some unescaping
// Can filter out any non-oauth parameters if needed (default behaviour)
public static function split_header($header, $only_allow_oauth_parameters = true) {
$pattern = '/(([-_a-z]*)=("([^"]*)"|([^,]*)),?)/';
$offset = 0;
$params = array();
while (preg_match($pattern, $header, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) {
$match = $matches[0];
$header_name = $matches[2][0];
$header_content = (isset($matches[5])) ? $matches[5][0] : $matches[4][0];
if (preg_match('/^oauth_/', $header_name) || !$only_allow_oauth_parameters) {
$params[$header_name] = dcsnt_OAuthUtil::urldecode_rfc3986($header_content);
}
$offset = $match[1] + strlen($match[0]);
}
if (isset($params['realm'])) {
unset($params['realm']);
}
return $params;
}
// helper to try to sort out headers for people who aren't running apache
public static function get_headers() {
if (function_exists('apache_request_headers')) {
// we need this to get the actual Authorization: header
// because apache tends to tell us it doesn't exist
$headers = apache_request_headers();
// sanitize the output of apache_request_headers because
// we always want the keys to be Cased-Like-This and arh()
// returns the headers in the same case as they are in the
// request
$out = array();
foreach( $headers AS $key => $value ) {
$key = str_replace(
" ",
"-",
ucwords(strtolower(str_replace("-", " ", $key)))
);
$out[$key] = $value;
}
} else {
// otherwise we don't have apache and are just going to have to hope
// that $_SERVER actually contains what we need
$out = array();
if( isset($_SERVER['CONTENT_TYPE']) )
$out['Content-Type'] = $_SERVER['CONTENT_TYPE'];
if( isset($_ENV['CONTENT_TYPE']) )
$out['Content-Type'] = $_ENV['CONTENT_TYPE'];
foreach ($_SERVER as $key => $value) {
if (substr($key, 0, 5) == "HTTP_") {
// this is chaos, basically it is just there to capitalize the first
// letter of every word that is not an initial HTTP and strip HTTP
// code from przemek
$key = str_replace(
" ",
"-",
ucwords(strtolower(str_replace("_", " ", substr($key, 5))))
);
$out[$key] = $value;
}
}
}
return $out;
}
// This function takes a input like a=b&a=c&d=e and returns the parsed
// parameters like this
// array('a' => array('b','c'), 'd' => 'e')
public static function parse_parameters( $input ) {
if (!isset($input) || !$input) return array();
$pairs = explode('&', $input);
$parsed_parameters = array();
foreach ($pairs as $pair) {
$split = explode('=', $pair, 2);
$parameter = dcsnt_OAuthUtil::urldecode_rfc3986($split[0]);
$value = isset($split[1]) ? dcsnt_OAuthUtil::urldecode_rfc3986($split[1]) : '';
if (isset($parsed_parameters[$parameter])) {
// We have already recieved parameter(s) with this name, so add to the list
// of parameters with this name
if (is_scalar($parsed_parameters[$parameter])) {
// This is the first duplicate, so transform scalar (string) into an array
// so we can add the duplicates
$parsed_parameters[$parameter] = array($parsed_parameters[$parameter]);
}
$parsed_parameters[$parameter][] = $value;
} else {
$parsed_parameters[$parameter] = $value;
}
}
return $parsed_parameters;
}
public static function build_http_query($params) {
if (!$params) return '';
// Urlencode both keys and values
$keys = dcsnt_OAuthUtil::urlencode_rfc3986(array_keys($params));
$values = dcsnt_OAuthUtil::urlencode_rfc3986(array_values($params));
$params = array_combine($keys, $values);
// Parameters are sorted by name, using lexicographical byte value ordering.
// Ref: Spec: 9.1.1 (1)
uksort($params, 'strcmp');
$pairs = array();
foreach ($params as $parameter => $value) {
if (is_array($value)) {
// If two or more parameters share the same name, they are sorted by their value
// Ref: Spec: 9.1.1 (1)
natsort($value);
foreach ($value as $duplicate_value) {
$pairs[] = $parameter . '=' . $duplicate_value;
}
} else {
$pairs[] = $parameter . '=' . $value;
}
}
// For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
// Each name-value pair is separated by an '&' character (ASCII code 38)
return implode('&', $pairs);
}
}
?> | RomainGoncalves/cadell | wp-content/plugins/social-network-tabs/inc/dcwp_twitter.php | PHP | gpl-2.0 | 36,981 |
#if !defined(__MAC80211_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
#define __MAC80211_DRIVER_TRACE
#include <linux/tracepoint.h>
#include <net/mac80211.h>
#include "ieee80211_i.h"
#undef TRACE_SYSTEM
#define TRACE_SYSTEM mac80211
#define MAXNAME 32
#define LOCAL_ENTRY __array(char, wiphy_name, 32)
#define LOCAL_ASSIGN strlcpy(__entry->wiphy_name, wiphy_name(local->hw.wiphy), MAXNAME)
#define LOCAL_PR_FMT "%s"
#define LOCAL_PR_ARG __entry->wiphy_name
#define STA_ENTRY __array(char, sta_addr, ETH_ALEN)
#define STA_ASSIGN (sta ? memcpy(__entry->sta_addr, sta->addr, ETH_ALEN) : memset(__entry->sta_addr, 0, ETH_ALEN))
#define STA_PR_FMT " sta:%pM"
#define STA_PR_ARG __entry->sta_addr
#define VIF_ENTRY __field(enum nl80211_iftype, vif_type) __field(void *, sdata) \
__field(bool, p2p) \
__string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>")
#define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \
__entry->p2p = sdata->vif.p2p; \
__assign_str(vif_name, sdata->dev ? sdata->dev->name : "<nodev>")
#define VIF_PR_FMT " vif:%s(%d%s)"
#define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : ""
/*
* Tracing for driver callbacks.
*/
DECLARE_EVENT_CLASS(local_only_evt,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local),
TP_STRUCT__entry(
LOCAL_ENTRY
),
TP_fast_assign(
LOCAL_ASSIGN;
),
TP_printk(LOCAL_PR_FMT, LOCAL_PR_ARG)
);
DECLARE_EVENT_CLASS(local_sdata_addr_evt,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata),
TP_ARGS(local, sdata),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
__array(char, addr, 6)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
memcpy(__entry->addr, sdata->vif.addr, 6);
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT " addr:%pM",
LOCAL_PR_ARG, VIF_PR_ARG, __entry->addr
)
);
DECLARE_EVENT_CLASS(local_u32_evt,
TP_PROTO(struct ieee80211_local *local, u32 value),
TP_ARGS(local, value),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u32, value)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->value = value;
),
TP_printk(
LOCAL_PR_FMT " value:%d",
LOCAL_PR_ARG, __entry->value
)
);
DECLARE_EVENT_CLASS(local_sdata_evt,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata),
TP_ARGS(local, sdata),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT,
LOCAL_PR_ARG, VIF_PR_ARG
)
);
DEFINE_EVENT(local_only_evt, drv_return_void,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
TRACE_EVENT(drv_return_int,
TP_PROTO(struct ieee80211_local *local, int ret),
TP_ARGS(local, ret),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(int, ret)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->ret = ret;
),
TP_printk(LOCAL_PR_FMT " - %d", LOCAL_PR_ARG, __entry->ret)
);
TRACE_EVENT(drv_return_bool,
TP_PROTO(struct ieee80211_local *local, bool ret),
TP_ARGS(local, ret),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(bool, ret)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->ret = ret;
),
TP_printk(LOCAL_PR_FMT " - %s", LOCAL_PR_ARG, (__entry->ret) ?
"true" : "false")
);
TRACE_EVENT(drv_return_u64,
TP_PROTO(struct ieee80211_local *local, u64 ret),
TP_ARGS(local, ret),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u64, ret)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->ret = ret;
),
TP_printk(LOCAL_PR_FMT " - %llu", LOCAL_PR_ARG, __entry->ret)
);
DEFINE_EVENT(local_only_evt, drv_start,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
DEFINE_EVENT(local_only_evt, drv_suspend,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
DEFINE_EVENT(local_only_evt, drv_resume,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
TRACE_EVENT(drv_set_wakeup,
TP_PROTO(struct ieee80211_local *local, bool enabled),
TP_ARGS(local, enabled),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(bool, enabled)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->enabled = enabled;
),
TP_printk(LOCAL_PR_FMT " enabled:%d", LOCAL_PR_ARG, __entry->enabled)
);
DEFINE_EVENT(local_only_evt, drv_stop,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
DEFINE_EVENT(local_sdata_addr_evt, drv_add_interface,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata),
TP_ARGS(local, sdata)
);
TRACE_EVENT(drv_change_interface,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
enum nl80211_iftype type, bool p2p),
TP_ARGS(local, sdata, type, p2p),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
__field(u32, new_type)
__field(bool, new_p2p)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
__entry->new_type = type;
__entry->new_p2p = p2p;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT " new type:%d%s",
LOCAL_PR_ARG, VIF_PR_ARG, __entry->new_type,
__entry->new_p2p ? "/p2p" : ""
)
);
DEFINE_EVENT(local_sdata_addr_evt, drv_remove_interface,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata),
TP_ARGS(local, sdata)
);
TRACE_EVENT(drv_config,
TP_PROTO(struct ieee80211_local *local,
u32 changed),
TP_ARGS(local, changed),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u32, changed)
__field(u32, flags)
__field(int, power_level)
__field(int, dynamic_ps_timeout)
__field(int, max_sleep_period)
__field(u16, listen_interval)
__field(u8, long_frame_max_tx_count)
__field(u8, short_frame_max_tx_count)
__field(int, center_freq)
__field(int, channel_type)
__field(int, smps)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->changed = changed;
__entry->flags = local->hw.conf.flags;
__entry->power_level = local->hw.conf.power_level;
__entry->dynamic_ps_timeout = local->hw.conf.dynamic_ps_timeout;
__entry->max_sleep_period = local->hw.conf.max_sleep_period;
__entry->listen_interval = local->hw.conf.listen_interval;
__entry->long_frame_max_tx_count = local->hw.conf.long_frame_max_tx_count;
__entry->short_frame_max_tx_count = local->hw.conf.short_frame_max_tx_count;
__entry->center_freq = local->hw.conf.channel->center_freq;
__entry->channel_type = local->hw.conf.channel_type;
__entry->smps = local->hw.conf.smps_mode;
),
TP_printk(
LOCAL_PR_FMT " ch:%#x freq:%d",
LOCAL_PR_ARG, __entry->changed, __entry->center_freq
)
);
TRACE_EVENT(drv_bss_info_changed,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_bss_conf *info,
u32 changed),
TP_ARGS(local, sdata, info, changed),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
__field(bool, assoc)
__field(u16, aid)
__field(bool, cts)
__field(bool, shortpre)
__field(bool, shortslot)
__field(u8, dtimper)
__field(u16, bcnint)
__field(u16, assoc_cap)
__field(u64, timestamp)
__field(u32, basic_rates)
__field(u32, changed)
__field(bool, enable_beacon)
__field(u16, ht_operation_mode)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
__entry->changed = changed;
__entry->aid = info->aid;
__entry->assoc = info->assoc;
__entry->shortpre = info->use_short_preamble;
__entry->cts = info->use_cts_prot;
__entry->shortslot = info->use_short_slot;
__entry->dtimper = info->dtim_period;
__entry->bcnint = info->beacon_int;
__entry->assoc_cap = info->assoc_capability;
__entry->timestamp = info->last_tsf;
__entry->basic_rates = info->basic_rates;
__entry->enable_beacon = info->enable_beacon;
__entry->ht_operation_mode = info->ht_operation_mode;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT " changed:%#x",
LOCAL_PR_ARG, VIF_PR_ARG, __entry->changed
)
);
TRACE_EVENT(drv_prepare_multicast,
TP_PROTO(struct ieee80211_local *local, int mc_count),
TP_ARGS(local, mc_count),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(int, mc_count)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->mc_count = mc_count;
),
TP_printk(
LOCAL_PR_FMT " prepare mc (%d)",
LOCAL_PR_ARG, __entry->mc_count
)
);
TRACE_EVENT(drv_configure_filter,
TP_PROTO(struct ieee80211_local *local,
unsigned int changed_flags,
unsigned int *total_flags,
u64 multicast),
TP_ARGS(local, changed_flags, total_flags, multicast),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(unsigned int, changed)
__field(unsigned int, total)
__field(u64, multicast)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->changed = changed_flags;
__entry->total = *total_flags;
__entry->multicast = multicast;
),
TP_printk(
LOCAL_PR_FMT " changed:%#x total:%#x",
LOCAL_PR_ARG, __entry->changed, __entry->total
)
);
TRACE_EVENT(drv_set_tim,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sta *sta, bool set),
TP_ARGS(local, sta, set),
TP_STRUCT__entry(
LOCAL_ENTRY
STA_ENTRY
__field(bool, set)
),
TP_fast_assign(
LOCAL_ASSIGN;
STA_ASSIGN;
__entry->set = set;
),
TP_printk(
LOCAL_PR_FMT STA_PR_FMT " set:%d",
LOCAL_PR_ARG, STA_PR_FMT, __entry->set
)
);
TRACE_EVENT(drv_set_key,
TP_PROTO(struct ieee80211_local *local,
enum set_key_cmd cmd, struct ieee80211_sub_if_data *sdata,
struct ieee80211_sta *sta,
struct ieee80211_key_conf *key),
TP_ARGS(local, cmd, sdata, sta, key),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
STA_ENTRY
__field(u32, cipher)
__field(u8, hw_key_idx)
__field(u8, flags)
__field(s8, keyidx)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
STA_ASSIGN;
__entry->cipher = key->cipher;
__entry->flags = key->flags;
__entry->keyidx = key->keyidx;
__entry->hw_key_idx = key->hw_key_idx;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT,
LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG
)
);
TRACE_EVENT(drv_update_tkip_key,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_key_conf *conf,
struct ieee80211_sta *sta, u32 iv32),
TP_ARGS(local, sdata, conf, sta, iv32),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
STA_ENTRY
__field(u32, iv32)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
STA_ASSIGN;
__entry->iv32 = iv32;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " iv32:%#x",
LOCAL_PR_ARG,VIF_PR_ARG,STA_PR_ARG, __entry->iv32
)
);
DEFINE_EVENT(local_sdata_evt, drv_hw_scan,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata),
TP_ARGS(local, sdata)
);
DEFINE_EVENT(local_sdata_evt, drv_cancel_hw_scan,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata),
TP_ARGS(local, sdata)
);
DEFINE_EVENT(local_sdata_evt, drv_sched_scan_start,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata),
TP_ARGS(local, sdata)
);
DEFINE_EVENT(local_sdata_evt, drv_sched_scan_stop,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata),
TP_ARGS(local, sdata)
);
DEFINE_EVENT(local_only_evt, drv_sw_scan_start,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
DEFINE_EVENT(local_only_evt, drv_sw_scan_complete,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
TRACE_EVENT(drv_get_stats,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_low_level_stats *stats,
int ret),
TP_ARGS(local, stats, ret),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(int, ret)
__field(unsigned int, ackfail)
__field(unsigned int, rtsfail)
__field(unsigned int, fcserr)
__field(unsigned int, rtssucc)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->ret = ret;
__entry->ackfail = stats->dot11ACKFailureCount;
__entry->rtsfail = stats->dot11RTSFailureCount;
__entry->fcserr = stats->dot11FCSErrorCount;
__entry->rtssucc = stats->dot11RTSSuccessCount;
),
TP_printk(
LOCAL_PR_FMT " ret:%d",
LOCAL_PR_ARG, __entry->ret
)
);
TRACE_EVENT(drv_get_tkip_seq,
TP_PROTO(struct ieee80211_local *local,
u8 hw_key_idx, u32 *iv32, u16 *iv16),
TP_ARGS(local, hw_key_idx, iv32, iv16),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u8, hw_key_idx)
__field(u32, iv32)
__field(u16, iv16)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->hw_key_idx = hw_key_idx;
__entry->iv32 = *iv32;
__entry->iv16 = *iv16;
),
TP_printk(
LOCAL_PR_FMT, LOCAL_PR_ARG
)
);
DEFINE_EVENT(local_u32_evt, drv_set_frag_threshold,
TP_PROTO(struct ieee80211_local *local, u32 value),
TP_ARGS(local, value)
);
DEFINE_EVENT(local_u32_evt, drv_set_rts_threshold,
TP_PROTO(struct ieee80211_local *local, u32 value),
TP_ARGS(local, value)
);
TRACE_EVENT(drv_set_coverage_class,
TP_PROTO(struct ieee80211_local *local, u8 value),
TP_ARGS(local, value),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u8, value)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->value = value;
),
TP_printk(
LOCAL_PR_FMT " value:%d",
LOCAL_PR_ARG, __entry->value
)
);
TRACE_EVENT(drv_sta_notify,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
enum sta_notify_cmd cmd,
struct ieee80211_sta *sta),
TP_ARGS(local, sdata, cmd, sta),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
STA_ENTRY
__field(u32, cmd)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
STA_ASSIGN;
__entry->cmd = cmd;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " cmd:%d",
LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->cmd
)
);
TRACE_EVENT(drv_sta_state,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_sta *sta,
enum ieee80211_sta_state old_state,
enum ieee80211_sta_state new_state),
TP_ARGS(local, sdata, sta, old_state, new_state),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
STA_ENTRY
__field(u32, old_state)
__field(u32, new_state)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
STA_ASSIGN;
__entry->old_state = old_state;
__entry->new_state = new_state;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " state: %d->%d",
LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG,
__entry->old_state, __entry->new_state
)
);
TRACE_EVENT(drv_sta_rc_update,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_sta *sta,
u32 changed),
TP_ARGS(local, sdata, sta, changed),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
STA_ENTRY
__field(u32, changed)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
STA_ASSIGN;
__entry->changed = changed;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " changed: 0x%x",
LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->changed
)
);
TRACE_EVENT(drv_sta_add,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_sta *sta),
TP_ARGS(local, sdata, sta),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
STA_ENTRY
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
STA_ASSIGN;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT,
LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG
)
);
TRACE_EVENT(drv_sta_remove,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_sta *sta),
TP_ARGS(local, sdata, sta),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
STA_ENTRY
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
STA_ASSIGN;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT,
LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG
)
);
TRACE_EVENT(drv_conf_tx,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
u16 ac, const struct ieee80211_tx_queue_params *params),
TP_ARGS(local, sdata, ac, params),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
__field(u16, ac)
__field(u16, txop)
__field(u16, cw_min)
__field(u16, cw_max)
__field(u8, aifs)
__field(bool, uapsd)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
__entry->ac = ac;
__entry->txop = params->txop;
__entry->cw_max = params->cw_max;
__entry->cw_min = params->cw_min;
__entry->aifs = params->aifs;
__entry->uapsd = params->uapsd;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT " AC:%d",
LOCAL_PR_ARG, VIF_PR_ARG, __entry->ac
)
);
DEFINE_EVENT(local_sdata_evt, drv_get_tsf,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata),
TP_ARGS(local, sdata)
);
TRACE_EVENT(drv_set_tsf,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
u64 tsf),
TP_ARGS(local, sdata, tsf),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
__field(u64, tsf)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
__entry->tsf = tsf;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT " tsf:%llu",
LOCAL_PR_ARG, VIF_PR_ARG, (unsigned long long)__entry->tsf
)
);
DEFINE_EVENT(local_sdata_evt, drv_reset_tsf,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata),
TP_ARGS(local, sdata)
);
DEFINE_EVENT(local_only_evt, drv_tx_last_beacon,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
TRACE_EVENT(drv_ampdu_action,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
enum ieee80211_ampdu_mlme_action action,
struct ieee80211_sta *sta, u16 tid,
u16 *ssn, u8 buf_size),
TP_ARGS(local, sdata, action, sta, tid, ssn, buf_size),
TP_STRUCT__entry(
LOCAL_ENTRY
STA_ENTRY
__field(u32, action)
__field(u16, tid)
__field(u16, ssn)
__field(u8, buf_size)
VIF_ENTRY
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
STA_ASSIGN;
__entry->action = action;
__entry->tid = tid;
__entry->ssn = ssn ? *ssn : 0;
__entry->buf_size = buf_size;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " action:%d tid:%d buf:%d",
LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->action,
__entry->tid, __entry->buf_size
)
);
TRACE_EVENT(drv_get_survey,
TP_PROTO(struct ieee80211_local *local, int idx,
struct survey_info *survey),
TP_ARGS(local, idx, survey),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(int, idx)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->idx = idx;
),
TP_printk(
LOCAL_PR_FMT " idx:%d",
LOCAL_PR_ARG, __entry->idx
)
);
TRACE_EVENT(drv_flush,
TP_PROTO(struct ieee80211_local *local, bool drop),
TP_ARGS(local, drop),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(bool, drop)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->drop = drop;
),
TP_printk(
LOCAL_PR_FMT " drop:%d",
LOCAL_PR_ARG, __entry->drop
)
);
TRACE_EVENT(drv_channel_switch,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_channel_switch *ch_switch),
TP_ARGS(local, ch_switch),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u64, timestamp)
__field(bool, block_tx)
__field(u16, freq)
__field(u8, count)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->timestamp = ch_switch->timestamp;
__entry->block_tx = ch_switch->block_tx;
__entry->freq = ch_switch->channel->center_freq;
__entry->count = ch_switch->count;
),
TP_printk(
LOCAL_PR_FMT " new freq:%u count:%d",
LOCAL_PR_ARG, __entry->freq, __entry->count
)
);
TRACE_EVENT(drv_set_antenna,
TP_PROTO(struct ieee80211_local *local, u32 tx_ant, u32 rx_ant, int ret),
TP_ARGS(local, tx_ant, rx_ant, ret),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u32, tx_ant)
__field(u32, rx_ant)
__field(int, ret)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->tx_ant = tx_ant;
__entry->rx_ant = rx_ant;
__entry->ret = ret;
),
TP_printk(
LOCAL_PR_FMT " tx_ant:%d rx_ant:%d ret:%d",
LOCAL_PR_ARG, __entry->tx_ant, __entry->rx_ant, __entry->ret
)
);
TRACE_EVENT(drv_get_antenna,
TP_PROTO(struct ieee80211_local *local, u32 tx_ant, u32 rx_ant, int ret),
TP_ARGS(local, tx_ant, rx_ant, ret),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u32, tx_ant)
__field(u32, rx_ant)
__field(int, ret)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->tx_ant = tx_ant;
__entry->rx_ant = rx_ant;
__entry->ret = ret;
),
TP_printk(
LOCAL_PR_FMT " tx_ant:%d rx_ant:%d ret:%d",
LOCAL_PR_ARG, __entry->tx_ant, __entry->rx_ant, __entry->ret
)
);
TRACE_EVENT(drv_remain_on_channel,
TP_PROTO(struct ieee80211_local *local, struct ieee80211_channel *chan,
enum nl80211_channel_type chantype, unsigned int duration),
TP_ARGS(local, chan, chantype, duration),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(int, center_freq)
__field(int, channel_type)
__field(unsigned int, duration)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->center_freq = chan->center_freq;
__entry->channel_type = chantype;
__entry->duration = duration;
),
TP_printk(
LOCAL_PR_FMT " freq:%dMHz duration:%dms",
LOCAL_PR_ARG, __entry->center_freq, __entry->duration
)
);
DEFINE_EVENT(local_only_evt, drv_cancel_remain_on_channel,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
TRACE_EVENT(drv_offchannel_tx,
TP_PROTO(struct ieee80211_local *local, struct sk_buff *skb,
struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type,
unsigned int wait),
TP_ARGS(local, skb, chan, channel_type, wait),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(int, center_freq)
__field(int, channel_type)
__field(unsigned int, wait)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->center_freq = chan->center_freq;
__entry->channel_type = channel_type;
__entry->wait = wait;
),
TP_printk(
LOCAL_PR_FMT " freq:%dMHz, wait:%dms",
LOCAL_PR_ARG, __entry->center_freq, __entry->wait
)
);
TRACE_EVENT(drv_set_ringparam,
TP_PROTO(struct ieee80211_local *local, u32 tx, u32 rx),
TP_ARGS(local, tx, rx),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u32, tx)
__field(u32, rx)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->tx = tx;
__entry->rx = rx;
),
TP_printk(
LOCAL_PR_FMT " tx:%d rx %d",
LOCAL_PR_ARG, __entry->tx, __entry->rx
)
);
TRACE_EVENT(drv_get_ringparam,
TP_PROTO(struct ieee80211_local *local, u32 *tx, u32 *tx_max,
u32 *rx, u32 *rx_max),
TP_ARGS(local, tx, tx_max, rx, rx_max),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u32, tx)
__field(u32, tx_max)
__field(u32, rx)
__field(u32, rx_max)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->tx = *tx;
__entry->tx_max = *tx_max;
__entry->rx = *rx;
__entry->rx_max = *rx_max;
),
TP_printk(
LOCAL_PR_FMT " tx:%d tx_max %d rx %d rx_max %d",
LOCAL_PR_ARG,
__entry->tx, __entry->tx_max, __entry->rx, __entry->rx_max
)
);
DEFINE_EVENT(local_only_evt, drv_tx_frames_pending,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
DEFINE_EVENT(local_only_evt, drv_offchannel_tx_cancel_wait,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
TRACE_EVENT(drv_set_bitrate_mask,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
const struct cfg80211_bitrate_mask *mask),
TP_ARGS(local, sdata, mask),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
__field(u32, legacy_2g)
__field(u32, legacy_5g)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
__entry->legacy_2g = mask->control[IEEE80211_BAND_2GHZ].legacy;
__entry->legacy_5g = mask->control[IEEE80211_BAND_5GHZ].legacy;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT " 2G Mask:0x%x 5G Mask:0x%x",
LOCAL_PR_ARG, VIF_PR_ARG, __entry->legacy_2g, __entry->legacy_5g
)
);
TRACE_EVENT(drv_set_rekey_data,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct cfg80211_gtk_rekey_data *data),
TP_ARGS(local, sdata, data),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
__array(u8, kek, NL80211_KEK_LEN)
__array(u8, kck, NL80211_KCK_LEN)
__array(u8, replay_ctr, NL80211_REPLAY_CTR_LEN)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
memcpy(__entry->kek, data->kek, NL80211_KEK_LEN);
memcpy(__entry->kck, data->kck, NL80211_KCK_LEN);
memcpy(__entry->replay_ctr, data->replay_ctr,
NL80211_REPLAY_CTR_LEN);
),
TP_printk(LOCAL_PR_FMT VIF_PR_FMT,
LOCAL_PR_ARG, VIF_PR_ARG)
);
TRACE_EVENT(drv_rssi_callback,
TP_PROTO(struct ieee80211_local *local,
enum ieee80211_rssi_event rssi_event),
TP_ARGS(local, rssi_event),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u32, rssi_event)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->rssi_event = rssi_event;
),
TP_printk(
LOCAL_PR_FMT " rssi_event:%d",
LOCAL_PR_ARG, __entry->rssi_event
)
);
DECLARE_EVENT_CLASS(release_evt,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sta *sta,
u16 tids, int num_frames,
enum ieee80211_frame_release_type reason,
bool more_data),
TP_ARGS(local, sta, tids, num_frames, reason, more_data),
TP_STRUCT__entry(
LOCAL_ENTRY
STA_ENTRY
__field(u16, tids)
__field(int, num_frames)
__field(int, reason)
__field(bool, more_data)
),
TP_fast_assign(
LOCAL_ASSIGN;
STA_ASSIGN;
__entry->tids = tids;
__entry->num_frames = num_frames;
__entry->reason = reason;
__entry->more_data = more_data;
),
TP_printk(
LOCAL_PR_FMT STA_PR_FMT
" TIDs:0x%.4x frames:%d reason:%d more:%d",
LOCAL_PR_ARG, STA_PR_ARG, __entry->tids, __entry->num_frames,
__entry->reason, __entry->more_data
)
);
DEFINE_EVENT(release_evt, drv_release_buffered_frames,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sta *sta,
u16 tids, int num_frames,
enum ieee80211_frame_release_type reason,
bool more_data),
TP_ARGS(local, sta, tids, num_frames, reason, more_data)
);
DEFINE_EVENT(release_evt, drv_allow_buffered_frames,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sta *sta,
u16 tids, int num_frames,
enum ieee80211_frame_release_type reason,
bool more_data),
TP_ARGS(local, sta, tids, num_frames, reason, more_data)
);
/*
* Tracing for API calls that drivers call.
*/
TRACE_EVENT(api_start_tx_ba_session,
TP_PROTO(struct ieee80211_sta *sta, u16 tid),
TP_ARGS(sta, tid),
TP_STRUCT__entry(
STA_ENTRY
__field(u16, tid)
),
TP_fast_assign(
STA_ASSIGN;
__entry->tid = tid;
),
TP_printk(
STA_PR_FMT " tid:%d",
STA_PR_ARG, __entry->tid
)
);
TRACE_EVENT(api_start_tx_ba_cb,
TP_PROTO(struct ieee80211_sub_if_data *sdata, const u8 *ra, u16 tid),
TP_ARGS(sdata, ra, tid),
TP_STRUCT__entry(
VIF_ENTRY
__array(u8, ra, ETH_ALEN)
__field(u16, tid)
),
TP_fast_assign(
VIF_ASSIGN;
memcpy(__entry->ra, ra, ETH_ALEN);
__entry->tid = tid;
),
TP_printk(
VIF_PR_FMT " ra:%pM tid:%d",
VIF_PR_ARG, __entry->ra, __entry->tid
)
);
TRACE_EVENT(api_stop_tx_ba_session,
TP_PROTO(struct ieee80211_sta *sta, u16 tid),
TP_ARGS(sta, tid),
TP_STRUCT__entry(
STA_ENTRY
__field(u16, tid)
),
TP_fast_assign(
STA_ASSIGN;
__entry->tid = tid;
),
TP_printk(
STA_PR_FMT " tid:%d",
STA_PR_ARG, __entry->tid
)
);
TRACE_EVENT(api_stop_tx_ba_cb,
TP_PROTO(struct ieee80211_sub_if_data *sdata, const u8 *ra, u16 tid),
TP_ARGS(sdata, ra, tid),
TP_STRUCT__entry(
VIF_ENTRY
__array(u8, ra, ETH_ALEN)
__field(u16, tid)
),
TP_fast_assign(
VIF_ASSIGN;
memcpy(__entry->ra, ra, ETH_ALEN);
__entry->tid = tid;
),
TP_printk(
VIF_PR_FMT " ra:%pM tid:%d",
VIF_PR_ARG, __entry->ra, __entry->tid
)
);
DEFINE_EVENT(local_only_evt, api_restart_hw,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
TRACE_EVENT(api_beacon_loss,
TP_PROTO(struct ieee80211_sub_if_data *sdata),
TP_ARGS(sdata),
TP_STRUCT__entry(
VIF_ENTRY
),
TP_fast_assign(
VIF_ASSIGN;
),
TP_printk(
VIF_PR_FMT,
VIF_PR_ARG
)
);
TRACE_EVENT(api_connection_loss,
TP_PROTO(struct ieee80211_sub_if_data *sdata),
TP_ARGS(sdata),
TP_STRUCT__entry(
VIF_ENTRY
),
TP_fast_assign(
VIF_ASSIGN;
),
TP_printk(
VIF_PR_FMT,
VIF_PR_ARG
)
);
TRACE_EVENT(api_cqm_rssi_notify,
TP_PROTO(struct ieee80211_sub_if_data *sdata,
enum nl80211_cqm_rssi_threshold_event rssi_event),
TP_ARGS(sdata, rssi_event),
TP_STRUCT__entry(
VIF_ENTRY
__field(u32, rssi_event)
),
TP_fast_assign(
VIF_ASSIGN;
__entry->rssi_event = rssi_event;
),
TP_printk(
VIF_PR_FMT " event:%d",
VIF_PR_ARG, __entry->rssi_event
)
);
TRACE_EVENT(api_scan_completed,
TP_PROTO(struct ieee80211_local *local, bool aborted),
TP_ARGS(local, aborted),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(bool, aborted)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->aborted = aborted;
),
TP_printk(
LOCAL_PR_FMT " aborted:%d",
LOCAL_PR_ARG, __entry->aborted
)
);
TRACE_EVENT(api_sched_scan_results,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local),
TP_STRUCT__entry(
LOCAL_ENTRY
),
TP_fast_assign(
LOCAL_ASSIGN;
),
TP_printk(
LOCAL_PR_FMT, LOCAL_PR_ARG
)
);
TRACE_EVENT(api_sched_scan_stopped,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local),
TP_STRUCT__entry(
LOCAL_ENTRY
),
TP_fast_assign(
LOCAL_ASSIGN;
),
TP_printk(
LOCAL_PR_FMT, LOCAL_PR_ARG
)
);
TRACE_EVENT(api_sta_block_awake,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sta *sta, bool block),
TP_ARGS(local, sta, block),
TP_STRUCT__entry(
LOCAL_ENTRY
STA_ENTRY
__field(bool, block)
),
TP_fast_assign(
LOCAL_ASSIGN;
STA_ASSIGN;
__entry->block = block;
),
TP_printk(
LOCAL_PR_FMT STA_PR_FMT " block:%d",
LOCAL_PR_ARG, STA_PR_FMT, __entry->block
)
);
TRACE_EVENT(api_chswitch_done,
TP_PROTO(struct ieee80211_sub_if_data *sdata, bool success),
TP_ARGS(sdata, success),
TP_STRUCT__entry(
VIF_ENTRY
__field(bool, success)
),
TP_fast_assign(
VIF_ASSIGN;
__entry->success = success;
),
TP_printk(
VIF_PR_FMT " success=%d",
VIF_PR_ARG, __entry->success
)
);
DEFINE_EVENT(local_only_evt, api_ready_on_channel,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
DEFINE_EVENT(local_only_evt, api_remain_on_channel_expired,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
);
TRACE_EVENT(api_gtk_rekey_notify,
TP_PROTO(struct ieee80211_sub_if_data *sdata,
const u8 *bssid, const u8 *replay_ctr),
TP_ARGS(sdata, bssid, replay_ctr),
TP_STRUCT__entry(
VIF_ENTRY
__array(u8, bssid, ETH_ALEN)
__array(u8, replay_ctr, NL80211_REPLAY_CTR_LEN)
),
TP_fast_assign(
VIF_ASSIGN;
memcpy(__entry->bssid, bssid, ETH_ALEN);
memcpy(__entry->replay_ctr, replay_ctr, NL80211_REPLAY_CTR_LEN);
),
TP_printk(VIF_PR_FMT, VIF_PR_ARG)
);
TRACE_EVENT(api_enable_rssi_reports,
TP_PROTO(struct ieee80211_sub_if_data *sdata,
int rssi_min_thold, int rssi_max_thold),
TP_ARGS(sdata, rssi_min_thold, rssi_max_thold),
TP_STRUCT__entry(
VIF_ENTRY
__field(int, rssi_min_thold)
__field(int, rssi_max_thold)
),
TP_fast_assign(
VIF_ASSIGN;
__entry->rssi_min_thold = rssi_min_thold;
__entry->rssi_max_thold = rssi_max_thold;
),
TP_printk(
VIF_PR_FMT " rssi_min_thold =%d, rssi_max_thold = %d",
VIF_PR_ARG, __entry->rssi_min_thold, __entry->rssi_max_thold
)
);
TRACE_EVENT(api_eosp,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sta *sta),
TP_ARGS(local, sta),
TP_STRUCT__entry(
LOCAL_ENTRY
STA_ENTRY
),
TP_fast_assign(
LOCAL_ASSIGN;
STA_ASSIGN;
),
TP_printk(
LOCAL_PR_FMT STA_PR_FMT,
LOCAL_PR_ARG, STA_PR_FMT
)
);
/*
* Tracing for internal functions
* (which may also be called in response to driver calls)
*/
TRACE_EVENT(wake_queue,
TP_PROTO(struct ieee80211_local *local, u16 queue,
enum queue_stop_reason reason),
TP_ARGS(local, queue, reason),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u16, queue)
__field(u32, reason)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->queue = queue;
__entry->reason = reason;
),
TP_printk(
LOCAL_PR_FMT " queue:%d, reason:%d",
LOCAL_PR_ARG, __entry->queue, __entry->reason
)
);
TRACE_EVENT(stop_queue,
TP_PROTO(struct ieee80211_local *local, u16 queue,
enum queue_stop_reason reason),
TP_ARGS(local, queue, reason),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u16, queue)
__field(u32, reason)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->queue = queue;
__entry->reason = reason;
),
TP_printk(
LOCAL_PR_FMT " queue:%d, reason:%d",
LOCAL_PR_ARG, __entry->queue, __entry->reason
)
);
#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE driver-trace
#include <trace/define_trace.h>
| chunyeow/greenmesh | net/mac80211/driver-trace.h | C | gpl-2.0 | 31,797 |
import win32pipe
import win32console
import win32process
import time
import win32con
import codecs
import ctypes
user32 = ctypes.windll.user32
CONQUE_WINDOWS_VK = {
'3' : win32con.VK_CANCEL,
'8' : win32con.VK_BACK,
'9' : win32con.VK_TAB,
'12' : win32con.VK_CLEAR,
'13' : win32con.VK_RETURN,
'17' : win32con.VK_CONTROL,
'20' : win32con.VK_CAPITAL,
'27' : win32con.VK_ESCAPE,
'28' : win32con.VK_CONVERT,
'35' : win32con.VK_END,
'36' : win32con.VK_HOME,
'37' : win32con.VK_LEFT,
'38' : win32con.VK_UP,
'39' : win32con.VK_RIGHT,
'40' : win32con.VK_DOWN,
'45' : win32con.VK_INSERT,
'46' : win32con.VK_DELETE,
'47' : win32con.VK_HELP
}
def make_input_key(c, control_key_state=None):
kc = win32console.PyINPUT_RECORDType (win32console.KEY_EVENT)
kc.KeyDown = True
kc.RepeatCount = 1
cnum = ord(c)
if cnum == 3:
pid_list = win32console.GetConsoleProcessList()
win32console.GenerateConsoleCtrlEvent(win32con.CTRL_C_EVENT, 0)
return
else:
kc.Char = unicode(c)
if str(cnum) in CONQUE_WINDOWS_VK:
kc.VirtualKeyCode = CONQUE_WINDOWS_VK[str(cnum)]
else:
kc.VirtualKeyCode = ctypes.windll.user32.VkKeyScanA(cnum)
#kc.VirtualKeyCode = ctypes.windll.user32.VkKeyScanA(cnum+96)
#kc.ControlKeyState = win32con.LEFT_CTRL_PRESSED
return kc
#win32console.AttachConsole()
coord = win32console.PyCOORDType
con_stdout = win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE)
con_stdin = win32console.GetStdHandle(win32console.STD_INPUT_HANDLE)
flags = win32process.NORMAL_PRIORITY_CLASS
si = win32process.STARTUPINFO()
si.dwFlags |= win32con.STARTF_USESHOWWINDOW
(handle1, handle2, i1, i2) = win32process.CreateProcess(None, "cmd.exe", None, None, 0, flags, None, '.', si)
time.sleep(1)
#size = con_stdout.GetConsoleScreenBufferInfo()['Window']
# with codecs.open("log.txt", "w", "utf8") as f:
# for i in xrange(0, size.Bottom):
# f.write(con_stdout.ReadConsoleOutputCharacter(size.Right+1, coord(0, i)))
# f.write("\n")
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = "127.0.0.1"
PORT = 5554
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((HOST, PORT))
s.listen(1)
(sc, scname) = s.accept()
while True:
msg = sc.recv(1)
if ord(msg) == 0:
break
keys = [make_input_key(msg)]
if keys:
con_stdin.WriteConsoleInput(keys)
win32process.TerminateProcess(handle1, 0) | viswimmer1/PythonGenerator | data/python_files/34574373/cmss.py | Python | gpl-2.0 | 2,623 |
class EventsController < ApplicationController
before_filter :authorize_organizer, except: [:index, :show]
def index
@events_upcoming = Event.paginate(page: params[:page_upcoming], :per_page => 5).upcoming()
@events_past = Event.paginate(page: params[:page_past], :per_page => 5).past()
@events_past_count = Event.past().count
end
def show
@event = Event.find(params[:id])
end
def new
@event = Event.new
@event.date = Date.today
end
def edit
@event = Event.find(params[:id])
end
def create
@event = Event.new(params[:event])
if @event.save
flash[:success] = "Event was successfully created."
redirect_to @event
else
render 'new'
end
end
def update
@event = Event.find(params[:id])
if @event.update_attributes(params[:event])
flash[:success] = "Event was successfully updated."
redirect_to @event
else
render 'edit'
end
end
def destroy
@event = Event.find(params[:id])
@event.destroy
flash[:success] = "Event was successfully deleted."
redirect_to events_url
end
end
| sfreihofer/nama | app/controllers/events_controller.rb | Ruby | gpl-2.0 | 1,094 |
<?php global $woocommerce; ?>
<?php $woocommerce->show_messages(); ?>
<?php do_action('woocommerce_before_customer_login_form'); ?>
<?php if (get_option('woocommerce_enable_myaccount_registration')=='yes') : ?>
<div class="col2-set" id="customer_login">
<div class="col-1">
<?php endif; ?>
<h2><?php _e('Login', 'sp'); ?></h2>
<form method="post" class="login">
<p class="form-row form-row-first">
<label for="username"><?php _e('Username', 'sp'); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="username" id="username" />
</p>
<p class="form-row form-row-last">
<label for="password"><?php _e('Password', 'sp'); ?> <span class="required">*</span></label>
<input class="input-text" type="password" name="password" id="password" />
</p>
<div class="group"></div>
<p class="form-row">
<?php $woocommerce->nonce_field('login', 'login') ?>
<input type="submit" class="button" name="login" value="<?php _e('Login', 'sp'); ?>" />
<a class="lost_password" href="<?php echo esc_url( wp_lostpassword_url( home_url() ) ); ?>"><?php _e('Lost Password?', 'sp'); ?></a>
</p>
</form>
<?php if (get_option('woocommerce_enable_myaccount_registration')=='yes') : ?>
</div>
<div class="col-2">
<h2><?php _e('Register', 'sp'); ?></h2>
<form method="post" class="register">
<p class="form-row form-row-first">
<label for="reg_username"><?php _e('Username', 'sp'); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="username" id="reg_username" value="<?php if (isset($_POST['username'])) echo esc_attr($_POST['username']); ?>" />
</p>
<p class="form-row form-row-last">
<label for="reg_email"><?php _e('Email', 'sp'); ?> <span class="required">*</span></label>
<input type="email" class="input-text" name="email" id="reg_email" value="<?php if (isset($_POST['email'])) echo esc_attr($_POST['email']); ?>" />
</p>
<div class="group"></div>
<p class="form-row form-row-first">
<label for="reg_password"><?php _e('Password', 'sp'); ?> <span class="required">*</span></label>
<input type="password" class="input-text" name="password" id="reg_password" value="<?php if (isset($_POST['password'])) echo esc_attr($_POST['password']); ?>" />
</p>
<p class="form-row form-row-last">
<label for="reg_password2"><?php _e('Re-enter password', 'sp'); ?> <span class="required">*</span></label>
<input type="password" class="input-text" name="password2" id="reg_password2" value="<?php if (isset($_POST['password2'])) echo esc_attr($_POST['password2']); ?>" />
</p>
<div class="group"></div>
<!-- Spam Trap -->
<div style="left:-999em; position:absolute;"><label for="trap">Anti-spam</label><input type="text" name="email_2" id="trap" /></div>
<?php do_action( 'register_form' ); ?>
<p class="form-row">
<?php $woocommerce->nonce_field('register', 'register') ?>
<input type="submit" class="button" name="register" value="<?php _e('Register', 'sp'); ?>" />
</p>
</form>
</div>
</div>
<?php endif; ?>
<?php do_action('woocommerce_after_customer_login_form'); ?> | MedvedevKir/gmtest.ru | wp-content/themes/mio/woocommerce/myaccount/form-login.php | PHP | gpl-2.0 | 3,275 |
#!/bin/bash
#
###########################################################
# copie_clepub_veyon.sh
# Ce script est à lancer sur les clients veyon
# Il recupère la clé publique "teacher" du poste "maitre" veyon
# 20180327
##########################################################
DATE1=$(date +%F+%0kh%0M)
#Couleurs
ROUGE="\\033[1;31m"
VERT="\\033[1;32m"
BLEU="\\033[1;34m"
JAUNE="\\033[1;33m"
COLTITRE="\033[1;35m" # Rose
COLDEFAUT="\033[0;33m" # Brun-jaune
COLCMD="\033[1;37m" # Blanc
COLERREUR="\033[1;31m" # Rouge
COLTXT="\033[0;37m" # Gris
COLINFO="\033[0;36m" # Cyan
COLPARTIE="\033[1;34m" # Bleu
cle=key
repcle=/etc/veyon/keys/public/teacher
echo -e "$JAUNE"
echo "###########################################################################"
echo ""
echo "Voulez-vous configurer veyon (client) sur ce poste ?"
echo "Il faudra indiquer l'adresse ip du poste maitre veyon et son mdp root."
echo ""
echo "###########################################################################"
echo -e "$COLTXT"
echo -e "$COLINFO"
read -p "Que voulez-vous faire ?
1 (je veux configurer veyon sur ce client)
2 (non, je veux sortir !) : " rep
echo -e "$COLTXT"
case $rep in
1 )
echo -e "$JAUNE"
echo "Entrez l'adresse ip du poste veyon-master : "
echo -e "$COLTXT"
read IPMAST
cd /etc
rm -rf veyon
cd
mkdir -p $repcle
#mv $repcle/$cle $repcle/cle_$DATE1
cd $repcle
scp root@$IPMAST:$repcle/$cle . || ERREUR="1"
if [ "$ERREUR" = "1" ];then
echo -e "$COLERREUR"
echo "Erreur lors de la copie de la clé..."
echo "Vérifier l'adresse ip du poste veyon-master puis relancez le script."
echo -e "$COLTXT"
else
# Ajustement des droits et message
cd /etc
chmod -R 777 veyon/
echo -e "$VERT"
echo "La clé a été copiée depuis le poste veyon-master $IPMAST"
echo -e "$COLTXT"
# Neutralisation de master et de configurator sur le poste eleve
chmod -x /usr/bin/veyon-master
chmod -x /usr/bin/veyon-configurator
cd /usr/share/applications
mv veyon-master.desktop veyon-master.desktop.bak
mv veyon-configurator.desktop veyon-configurator.desktop.bak
cd
echo -e "$COLDEFAUT"
echo "Info : veyon-master et veyon-configurator ont été désactivés sur ce poste."
echo -e "$COLTXT"
fi
;;
* )
echo -e "$COLINFO"
echo "Pas de copie demandée."
echo -e "$VERT"
echo "###########################################################################"
echo ""
echo "Vous pourrez copier la clé publique veyon plus tard en lançant le script"
echo "/mnt/netlogon/alancer/copie_clepub_veyon.sh"
echo ""
echo "###########################################################################"
echo -e "$COLINFO"
echo "A bientôt !"
echo -e "$COLTXT"
exit 0
;;
esac
echo "Terminé !"
exit 0
| jcmousse/clinux | se3/alancer/copie_clepub_veyon.sh | Shell | gpl-2.0 | 3,308 |
$('#section').on('click', '[id$="Empty"]', function(event) {
event.preventDefault();
var match = /(.+)Empty/.exec($(event.target).closest('.unwell').attr('id'));
var id = match[1];
var emptyId = match[0];
$('#'+id).trigger('addrow');
$('#'+emptyId).addClass('hidden');
return false;
});
$('#section').on('submit', 'form[name="formItem"]', function(e) {
e.preventDefault();
var form = $(this),
btn = form.find('.btn-primary'),
valid = isFormValid(form);
$('select[name$=".type"]:not(:disabled)').each(function(i,e){
if($(e).val() == "Select an option"){
valid = false;
showPermanentError(form, "Please select a valid action.");
}
});
if (valid) {
btn.button('loading');
resetAlert($('#section'));
$.ajax({
type: 'POST',
url: form.attr('action'),
data: form.serialize()
}).always(function() {
btn.button('reset');
}).done(function(data, textStatus, jqXHR) {
showSuccess(form, "Saved");
window.location.hash = "#config/portal_module/"+form.find('input[name="id"]').val()+"/read"
}).fail(function(jqXHR) {
$("body,html").animate({scrollTop:0}, 'fast');
var status_msg = getStatusMsg(jqXHR);
showPermanentError(form, status_msg);
});
}
});
$('#section').on('click', '.delete-portal-module', function(e){
e.preventDefault();
var button = $(e.target);
button.button('loading');
$.ajax({
type: 'GET',
url: button.attr('href'),
}).always(function() {
}).done(function(data, textStatus, jqXHR) {
showSuccess(button.closest('.table'), "Deleted");
button.closest('tr').remove();
}).fail(function(jqXHR) {
button.button('reset');
$("body,html").animate({scrollTop:0}, 'fast');
var status_msg = getStatusMsg(jqXHR);
showPermanentError(button.closest('.table'), status_msg);
});
return false;
});
$('#section').on('click', '.expand', function(e){
e.preventDefault();
$(e.target).hide(function(){
$($(e.target).attr('data-expand')).slideDown();
});
return false;
});
$('#section').on('change', '#actions select[name$=".type"]', function(event) {
var type_input = $(event.currentTarget);
updateActionMatchInput(type_input,false);
});
$('#section').on('click', '#actionsContainer a[href="#add"]', function(event) {
setTimeout(initActionMatchInput, 3000);
});
function initActionMatchInput() {
$('select[name$=".type"]:not(:disabled)').each(function(i,e){
updateActionMatchInput($(e),true);
});
}
function updateActionMatchInput(type_input, keep) {
var match_input = type_input.next();
var type_value = type_input.val();
var match_input_template_id = '#' + type_value + "_action_match";
var match_input_template = $(match_input_template_id);
if ( match_input_template.length == 0 ) {
match_input_template = $('#default_action_match');
}
if ( match_input_template.length ) {
changeInputFromTemplate(match_input, match_input_template, keep);
if (type_value == "switch") {
type_input.next().typeahead({
source: searchSwitchesGenerator($('#section h2')),
minLength: 2,
items: 11,
matcher: function(item) { return true; }
});
}
}
}
| jrouzierinverse/packetfence | html/pfappserver/root/static/admin/config/portal_modules.js | JavaScript | gpl-2.0 | 3,343 |
/*
* EffecTV for Android
* Copyright (C) 2013 Morihiro Soft
*
* MatrixTV.h :
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*
* EffecTV - Realtime Digital Video Effector
* Copyright (C) 2001-2006 FUKUCHI Kentaro
*
* matrixTV - A Matrix Like effect.
* This plugin for EffectTV is under GNU General Public License
* See the "COPYING" that should be shiped with this source code
* Copyright (C) 2001-2003 Monniez Christophe
* [email protected]
*
* 2003/12/24 Kentaro Fukuchi
* - Completely rewrote but based on Monniez's idea.
* - Uses edge detection, not only G value of each pixel.
* - Added 4x4 font includes number, alphabet and Japanese Katakana characters.
*/
#ifndef __MATRIXTV__
#define __MATRIXTV__
#include "BaseEffecTV.h"
class MatrixTV : public BaseEffecTV {
typedef BaseEffecTV super;
protected:
struct Blip {
int mode;
int y;
int timer;
int speed;
};
int show_info;
int mode;
int pause;
int mapW;
int mapH;
unsigned char* cmap;
unsigned char* vmap;
unsigned char* img;
unsigned char* font;
RGB32* palette;
Blip* blips;
virtual void intialize(bool reset);
virtual int readConfig();
virtual int writeConfig();
public:
MatrixTV(void);
virtual ~MatrixTV(void);
virtual const char* name(void);
virtual const char* title(void);
virtual const char** funcs(void);
virtual int start(Utils* utils, int width, int height);
virtual int stop(void);
virtual int draw(YUV* src_yuv, RGB32* dst_rgb, char* dst_msg);
virtual const char* event(int key_code);
virtual const char* touch(int action, int x, int y);
protected:
RGB32 green(unsigned int v);
int setPalette(void);
int setPattern(void);
void drawChar(RGB32* dst, unsigned char c, unsigned char v);
void createImg(RGB32* src);
void updateCharMap(void);
void darkenColumn(int);
void blipNone(int x);
void blipFall(int x);
void blipStop(int x);
void blipSlide(int x);
};
#endif // __MATRIXTV__
| MorihiroSoft/EffecTV_for_Android | jni/effects/MatrixTV.h | C | gpl-2.0 | 2,596 |
jQuery(function($){
$.supersized({
//Functionality
slideshow : 1, //Slideshow on/off
autoplay : 1, //Slideshow starts playing automatically
start_slide : 1, //Start slide (0 is random)
slide_interval : 4000, //Length between transitions
slideshow_interval : 4000, //Length between transitions
transition : 1, //0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
transition_speed : 500, //Speed of transition
new_window : 1, //Image links open in new window/tab
pause_hover : 0, //Pause slideshow on hover
keyboard_nav : 1, //Keyboard navigation on/off
performance : 1, //0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
image_protect : 1, //Disables image dragging and right click with Javascript
image_path : 'img/', //Default image path
//Size & Position
min_width : 0, //Min width allowed (in pixels)
min_height : 0, //Min height allowed (in pixels)
vertical_center : 1, //Vertically center background
horizontal_center : 1, //Horizontally center background
fit_portrait : 1, //Portrait images will not exceed browser height
fit_landscape : 0, //Landscape images will not exceed browser width
//Components
navigation : 1, //Slideshow controls on/off
thumbnail_navigation : 1, //Thumbnail navigation
slide_counter : 1, //Display slide numbers
slide_captions : 1, //Slide caption (Pull from "title" in slides array)
slides : (function(){
var ret = new Array();
for(var i in supersizedImgs){
ret.push({image: supersizedImgs[i]});
}
return ret;
})()
});
}); | infosecdev/markroxberry | wp-content/themes/widephoto/supersized/js/supersized.imgs.js | JavaScript | gpl-2.0 | 2,098 |
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2012 ChromeOS Authors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdint.h>
#include <string.h>
#include <cbfs.h>
#include <cbmem.h>
#include <console/console.h>
#include <arch/cpu.h>
#include <cpu/x86/bist.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/mtrr.h>
#include <halt.h>
#include <lib.h>
#include <timestamp.h>
#include <arch/io.h>
#include <arch/stages.h>
#include <device/pci_def.h>
#include <cpu/x86/lapic.h>
#include <cbfs.h>
#include <romstage_handoff.h>
#include <reset.h>
#include <stage_cache.h>
#include <vendorcode/google/chromeos/chromeos.h>
#if CONFIG_EC_GOOGLE_CHROMEEC
#include <ec/google/chromeec/ec.h>
#endif
#include "haswell.h"
#include "northbridge/intel/haswell/haswell.h"
#include "northbridge/intel/haswell/raminit.h"
#include "southbridge/intel/lynxpoint/pch.h"
#include "southbridge/intel/lynxpoint/me.h"
static inline void reset_system(void)
{
hard_reset();
halt();
}
/* The cache-as-ram assembly file calls romstage_main() after setting up
* cache-as-ram. romstage_main() will then call the mainboards's
* mainboard_romstage_entry() function. That function then calls
* romstage_common() below. The reason for the back and forth is to provide
* common entry point from cache-as-ram while still allowing for code sharing.
* Because we can't use global variables the stack is used for allocations --
* thus the need to call back and forth. */
static inline u32 *stack_push(u32 *stack, u32 value)
{
stack = &stack[-1];
*stack = value;
return stack;
}
/* Romstage needs quite a bit of stack for decompressing images since the lzma
* lib keeps its state on the stack during romstage. */
#define ROMSTAGE_RAM_STACK_SIZE 0x5000
static unsigned long choose_top_of_stack(void)
{
unsigned long stack_top;
/* cbmem_add() does a find() before add(). */
stack_top = (unsigned long)cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK,
ROMSTAGE_RAM_STACK_SIZE);
stack_top += ROMSTAGE_RAM_STACK_SIZE;
return stack_top;
}
/* setup_romstage_stack_after_car() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use. */
static void *setup_romstage_stack_after_car(void)
{
unsigned long top_of_stack;
int num_mtrrs;
u32 *slot;
u32 mtrr_mask_upper;
u32 top_of_ram;
/* Top of stack needs to be aligned to a 4-byte boundary. */
top_of_stack = choose_top_of_stack() & ~3;
slot = (void *)top_of_stack;
num_mtrrs = 0;
/* The upper bits of the MTRR mask need to set according to the number
* of physical address bits. */
mtrr_mask_upper = (1 << ((cpuid_eax(0x80000008) & 0xff) - 32)) - 1;
/* The order for each MTRR is value then base with upper 32-bits of
* each value coming before the lower 32-bits. The reasoning for
* this ordering is to create a stack layout like the following:
* +0: Number of MTRRs
* +4: MTRR base 0 31:0
* +8: MTRR base 0 63:32
* +12: MTRR mask 0 31:0
* +16: MTRR mask 0 63:32
* +20: MTRR base 1 31:0
* +24: MTRR base 1 63:32
* +28: MTRR mask 1 31:0
* +32: MTRR mask 1 63:32
*/
/* Cache the ROM as WP just below 4GiB. */
slot = stack_push(slot, mtrr_mask_upper); /* upper mask */
slot = stack_push(slot, ~(CACHE_ROM_SIZE - 1) | MTRRphysMaskValid);
slot = stack_push(slot, 0); /* upper base */
slot = stack_push(slot, ~(CACHE_ROM_SIZE - 1) | MTRR_TYPE_WRPROT);
num_mtrrs++;
/* Cache RAM as WB from 0 -> CONFIG_RAMTOP. */
slot = stack_push(slot, mtrr_mask_upper); /* upper mask */
slot = stack_push(slot, ~(CONFIG_RAMTOP - 1) | MTRRphysMaskValid);
slot = stack_push(slot, 0); /* upper base */
slot = stack_push(slot, 0 | MTRR_TYPE_WRBACK);
num_mtrrs++;
top_of_ram = (uint32_t)cbmem_top();
/* Cache 8MiB below the top of ram. On haswell systems the top of
* ram under 4GiB is the start of the TSEG region. It is required to
* be 8MiB aligned. Set this area as cacheable so it can be used later
* for ramstage before setting up the entire RAM as cacheable. */
slot = stack_push(slot, mtrr_mask_upper); /* upper mask */
slot = stack_push(slot, ~((8 << 20) - 1) | MTRRphysMaskValid);
slot = stack_push(slot, 0); /* upper base */
slot = stack_push(slot, (top_of_ram - (8 << 20)) | MTRR_TYPE_WRBACK);
num_mtrrs++;
/* Cache 8MiB at the top of ram. Top of ram on haswell systems
* is where the TSEG region resides. However, it is not restricted
* to SMM mode until SMM has been relocated. By setting the region
* to cacheable it provides faster access when relocating the SMM
* handler as well as using the TSEG region for other purposes. */
slot = stack_push(slot, mtrr_mask_upper); /* upper mask */
slot = stack_push(slot, ~((8 << 20) - 1) | MTRRphysMaskValid);
slot = stack_push(slot, 0); /* upper base */
slot = stack_push(slot, top_of_ram | MTRR_TYPE_WRBACK);
num_mtrrs++;
/* Save the number of MTRRs to setup. Return the stack location
* pointing to the number of MTRRs. */
slot = stack_push(slot, num_mtrrs);
return slot;
}
void * asmlinkage romstage_main(unsigned long bist)
{
int i;
void *romstage_stack_after_car;
const int num_guards = 4;
const u32 stack_guard = 0xdeadbeef;
u32 *stack_base = (void *)(CONFIG_DCACHE_RAM_BASE +
CONFIG_DCACHE_RAM_SIZE -
CONFIG_DCACHE_RAM_ROMSTAGE_STACK_SIZE);
printk(BIOS_DEBUG, "Setting up stack guards.\n");
for (i = 0; i < num_guards; i++)
stack_base[i] = stack_guard;
mainboard_romstage_entry(bist);
/* Check the stack. */
for (i = 0; i < num_guards; i++) {
if (stack_base[i] == stack_guard)
continue;
printk(BIOS_DEBUG, "Smashed stack detected in romstage!\n");
}
/* Get the stack to use after cache-as-ram is torn down. */
romstage_stack_after_car = setup_romstage_stack_after_car();
return romstage_stack_after_car;
}
void romstage_common(const struct romstage_params *params)
{
int boot_mode;
int wake_from_s3;
struct romstage_handoff *handoff;
timestamp_init(get_initial_timestamp());
timestamp_add_now(TS_START_ROMSTAGE);
if (params->bist == 0)
enable_lapic();
wake_from_s3 = early_pch_init(params->gpio_map, params->rcba_config);
#if CONFIG_EC_GOOGLE_CHROMEEC
/* Ensure the EC is in the right mode for recovery */
google_chromeec_early_init();
#endif
/* Halt if there was a built in self test failure */
report_bist_failure(params->bist);
/* Perform some early chipset initialization required
* before RAM initialization can work
*/
haswell_early_initialization(HASWELL_MOBILE);
printk(BIOS_DEBUG, "Back from haswell_early_initialization()\n");
if (wake_from_s3) {
#if CONFIG_HAVE_ACPI_RESUME
printk(BIOS_DEBUG, "Resume from S3 detected.\n");
#else
printk(BIOS_DEBUG, "Resume from S3 detected, but disabled.\n");
wake_from_s3 = 0;
#endif
}
/* There are hard coded assumptions of 2 meaning s3 wake. Normalize
* the users of the 2 literal here based off wake_from_s3. */
boot_mode = wake_from_s3 ? 2 : 0;
/* Prepare USB controller early in S3 resume */
if (wake_from_s3)
enable_usb_bar();
post_code(0x3a);
params->pei_data->boot_mode = boot_mode;
timestamp_add_now(TS_BEFORE_INITRAM);
report_platform_info();
if (params->copy_spd != NULL)
params->copy_spd(params->pei_data);
sdram_initialize(params->pei_data);
timestamp_add_now(TS_AFTER_INITRAM);
post_code(0x3b);
intel_early_me_status();
quick_ram_check();
post_code(0x3e);
if (!wake_from_s3) {
cbmem_initialize_empty();
stage_cache_create_empty();
/* Save data returned from MRC on non-S3 resumes. */
save_mrc_data(params->pei_data);
} else {
stage_cache_recover();
if (cbmem_initialize()) {
#if CONFIG_HAVE_ACPI_RESUME
/* Failed S3 resume, reset to come up cleanly */
reset_system();
#endif
}
}
handoff = romstage_handoff_find_or_add();
if (handoff != NULL)
handoff->s3_resume = wake_from_s3;
else
printk(BIOS_DEBUG, "Romstage handoff structure not added!\n");
post_code(0x3f);
#if CONFIG_CHROMEOS
init_chromeos(boot_mode);
#endif
timestamp_add_now(TS_END_ROMSTAGE);
}
static inline void prepare_for_resume(struct romstage_handoff *handoff)
{
/* Only need to save memory when ramstage isn't relocatable. */
#if !CONFIG_RELOCATABLE_RAMSTAGE
#if CONFIG_HAVE_ACPI_RESUME
/* Back up the OS-controlled memory where ramstage will be loaded. */
if (handoff != NULL && handoff->s3_resume) {
void *src = (void *)CONFIG_RAMBASE;
void *dest = cbmem_find(CBMEM_ID_RESUME);
if (dest != NULL)
memcpy(dest, src, HIGH_MEMORY_SAVE);
}
#endif
#endif
}
void romstage_after_car(void)
{
struct romstage_handoff *handoff;
handoff = romstage_handoff_find_or_add();
prepare_for_resume(handoff);
/* Load the ramstage. */
copy_and_run();
}
#if IS_ENABLED(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM)
void stage_cache_external_region(void **base, size_t *size)
{
/* The ramstage cache lives in the TSEG region at RESERVED_SMM_OFFSET.
* The top of ram is defined to be the TSEG base address. */
*size = RESERVED_SMM_SIZE;
*base = (void *)((uint32_t)cbmem_top() + RESERVED_SMM_OFFSET);
}
void ramstage_cache_invalid(void)
{
#if CONFIG_RESET_ON_INVALID_RAMSTAGE_CACHE
reset_system();
#endif
}
#endif
| coreboot-gs45/coreboot | src/cpu/intel/haswell/romstage.c | C | gpl-2.0 | 9,829 |
package com.mmm.product.domain;
import java.io.Serializable;
public class ShippingDetails implements Serializable{
private static final long serialVersionUID = 5941389959992371612L;
}
| Lnjena/mmm.com | mmm-spring-boot/src/main/java/com/mmm/product/domain/ShippingDetails.java | Java | gpl-2.0 | 189 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.