code stringlengths 4 991k | repo_name stringlengths 6 116 | path stringlengths 4 249 | language stringclasses 30 values | license stringclasses 15 values | size int64 4 991k | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
---
layout: default
title: CAS - Attribute Definitions
category: Attributes
---
{% include variables.html %}
# Attribute Definitions
The definition of an attribute in CAS, when fetched and resolved from an authentication or attribute repository source, tends to be defined
and referenced using its name without any additional *metadata* or decorations. For example, you may wish to retrieve a `uid` attribute and virtually
rename and map it to a `userIdentifier` attribute either globally or for specific application integrations. For most use cases, this configuration
works quite comfortably and yet, depending on the nature of the target application and the authentication protocol used to complete the integration,
additional requirements could be imposed and may have to be specified to define an attribute with
additional pointers, when shared and released with a relying party. For example, a
SAML2 service provider may require a *scoped* attribute for an `eduPersonPrincipalName` whose value
is always determined from the `uid` attribute with a special friendly-name that is always provided regardless of the target application.
While bits and pieces of metadata about a given attribute can be defined either globally in CAS configuration settings
or defined inside a service definition, an attribute definition store allows one to describe metadata about necessary attributes
with special decorations to be considered during attribute resolution and release. The specification of the attribute definition store is entirely
optional and the store may not contain any attribute definitions.
{% include_cached casproperties.html properties="cas.authn.attribute-repository.attribute-definition-store" %}
## JSON Attribute Definitions
Attribute definitions may be defined inside a JSON file whose location is provided via CAS settings. The structure of the JSON file
may match the following:
```json
{
"@class" : "java.util.TreeMap",
"employeeId" : {
"@class" : "org.apereo.cas.authentication.attribute.DefaultAttributeDefinition",
"key" : "employeeId",
"scoped" : true,
"attribute" : "empl_identifier"
}
}
```
Generally-speaking, attribute definitions are specified using a `Map` whose key is the
attribute name, as resolved by the CAS [attribute resolution engine](Attribute-Resolution.html).
The attribute name as the key to the `Map` must match the `key` attribute of the attribute definition itself.
If the attribute in question is not already resolved as principal attribute with a valid set of values,
it might be possible, depending on the [attribute release policy](Attribute-Release.html), to
resolve and create that attribute on the fly as an attribute definition that can produce values.
The following settings can be specified by an attribute definition:
| Name | Description |
|------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| `key` | Attribute name, as resolved by the CAS [attribute resolution engine](Attribute-Resolution.html) |
| `name` | Comma-separated list of attribute name(s) to virtually rename/remap and share with the target application during attribute release. |
| `scoped` | (Optional) If `true`, the attribute value be scoped to the scope of the CAS server deployment defined in settings. |
| `encrypted` | (Optional) If `true`, the attribute value will be encrypted and encoded in base-64 using the service definition's defined public key. |
| `attribute` | (Optional) The source attribute to provide values for the attribute definition itself, replacing that of the original source. |
| `patternFormat` | (Optional) Template used in a `java.text.MessageFormat` to decorate the attribute values. |
| `script` | (Optional) Groovy script, external or embedded to process and produce attributes values. |
| `canonicalizationMode` | (Optional) Control transformation of attribute values; allowed values are `UPPER`, `LOWER` or `NONE`. |
The following operations in the order given should take place, if an attribute definition is to produce values:
- Produce attribute values based on the `attribute` setting specified in the attribute definition, if any.
- Produce attribute values based on the `script` setting specified in the attribute definition, if any.
- Produce attribute values based on the `scoped` setting specified in the attribute definition, if any.
- Produce attribute values based on the `patternFormat` setting specified in the attribute definition, if any.
- Produce attribute values based on the `encrypted` setting specified in the attribute definition, if any.
- Produce attribute values based on the `canonicalizationMode` setting specified in the attribute definition, if any.
## Examples
### Basic
Define an attribute definition for `employeeId` to produce scoped attributes
based on another attribute `empl_identifier` as the source:
```json
{
"@class" : "java.util.TreeMap",
"employeeId" : {
"@class" : "org.apereo.cas.authentication.attribute.DefaultAttributeDefinition",
"key" : "employeeId",
"scoped" : true,
"attribute" : "empl_identifier"
}
}
```
Now that the definition is available globally, the attribute [can then be released](Attribute-Release-Policies.html)
as usual with the following definition:
```json
...
"attributeReleasePolicy" : {
"@class" : "org.apereo.cas.services.ReturnAllowedAttributeReleasePolicy",
"allowedAttributes" : [ "java.util.ArrayList", [ "employeeId" ] ]
}
...
```
### Encrypted Attribute
Same use case as above, except the attribute value will be encrypted and encoded using the service definition's public key:
```json
{
"@class" : "java.util.TreeMap",
"employeeId" : {
"@class" : "org.apereo.cas.authentication.attribute.DefaultAttributeDefinition",
"key" : "employeeId",
"encrypted" : true,
"attribute" : "empl_identifier"
}
}
```
The service definition should have specified a public key definition:
```json
...
"publicKey" : {
"@class" : "org.apereo.cas.services.RegisteredServicePublicKeyImpl",
"location" : "classpath:public.key",
"algorithm" : "RSA"
}
...
```
The keys can be generated via the following commands:
```bash
openssl genrsa -out private.key 1024
openssl rsa -pubout -in private.key -out public.key -inform PEM -outform DER
openssl pkcs8 -topk8 -inform PER -outform DER -nocrypt -in private.key -out private.p8
```
### Pattern Formats
Define an attribute definition to produce values based on a pattern format:
```json
{
"@class" : "java.util.TreeMap",
"eduPersonPrincipalName" : {
"@class" : "org.apereo.cas.authentication.attribute.DefaultAttributeDefinition",
"key" : "eduPersonPrincipalName",
"name" : "urn:oid:1.3.6.1.4.1.5923.1.1.1.6",
"friendlyName" : "eduPersonPrincipalName",
"scoped" : true,
"patternFormat": "hello,{0}",
"attribute" : "uid"
}
}
```
If the resolved set of attributes are `uid=[test1, test2]` and the CAS server has a scope of `example.org`,
the final values of `eduPersonPrincipalName` would be [`hello,test1@example.org`,`hello,test2@example.org`]
released as `urn:oid:1.3.6.1.4.1.5923.1.1.1.6` with a friendly name of `eduPersonPrincipalName`.
### Embedded Script
Same use case as above, except the attribute value be additional processed by an embedded Groovy script
```json
{
"@class" : "java.util.TreeMap",
"eduPersonPrincipalName" : {
"@class" : "org.apereo.cas.authentication.attribute.DefaultAttributeDefinition",
"key" : "eduPersonPrincipalName",
"name" : "urn:oid:1.3.6.1.4.1.5923.1.1.1.6",
"friendlyName" : "eduPersonPrincipalName",
"scoped" : true,
"script": "groovy { logger.info(\" name: ${attributeName}, values: ${attributeValues} \"); return ['Hi', attributes['firstname']] }"
}
}
```
If the CAS server has a scope of `example.org`,
the final values of `eduPersonPrincipalName` would be [`Hi, casuser`]
released as `urn:oid:1.3.6.1.4.1.5923.1.1.1.6` with a friendly name of `eduPersonPrincipalName`.
### External Script
Same use case as above, except the attribute value be additionally processed by an external Groovy script:
```json
{
"@class" : "java.util.TreeMap",
"eduPersonPrincipalName" : {
"@class" : "org.apereo.cas.authentication.attribute.DefaultAttributeDefinition",
"key" : "eduPersonPrincipalName",
"name" : "urn:oid:1.3.6.1.4.1.5923.1.1.1.6",
"friendlyName" : "eduPersonPrincipalName",
"scoped" : true,
"script": "file:/attribute-definitions.groovy"
}
}
```
The outline of the Groovy script should be defined as:
```groovy
def run(Object[] args) {
def attributeName = args[0]
def attributeValues = args[1]
def logger = args[2]
def registeredService = args[3]
def attributes = args[4]
logger.info("name: ${attributeName}, values: ${attributeValues}, attributes: ${attributes}")
return ["Hello " + attributes['givenName']]
}
```
If the CAS server has a scope of `example.org`,
the final values of `eduPersonPrincipalName` would be [`Hello casuser`]
released as `urn:oid:1.3.6.1.4.1.5923.1.1.1.6` with a friendly name of `eduPersonPrincipalName`.
| apereo/cas | docs/cas-server-documentation/integration/Attribute-Definitions.md | Markdown | apache-2.0 | 9,748 | [
30522,
1011,
1011,
1011,
9621,
1024,
12398,
2516,
1024,
25222,
1011,
17961,
15182,
4696,
1024,
12332,
1011,
1011,
1011,
1063,
1003,
2421,
10857,
1012,
16129,
1003,
1065,
1001,
17961,
15182,
1996,
6210,
1997,
2019,
17961,
1999,
25222,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
!
! wavy - A spectral ocean wave modeling and development framework
! Copyright (c) 2017, Wavebit Scientific LLC
! All rights reserved.
!
! Licensed under the BSD-3 clause license. See LICENSE for details.
!
program test_phillips
use mod_precision,only:rk => realkind
use mod_spectrum,only:spectrum_type
use mod_spectral_shapes,only:phillips,jonswapPeakFrequency
use mod_utility,only:range
implicit none
type(spectrum_type) :: spec
real(kind=rk),dimension(:),allocatable :: wspd
real(kind=rk),dimension(:),allocatable :: fetch
real(kind=rk),parameter :: grav = 9.8_rk
integer :: m,n
write(*,*)
write(*,*)'Test omnidirectional spectrum with Phillips (1958) shape;'
write(*,*)'Vary fetch between 1, 10, and 100 km to compute the peak frequency'&
//' based on the JONSWAP spectrum.'
write(*,*)
! Initialize spectrum
spec = spectrum_type(fmin=0.0313_rk,fmax=2._rk,df=1.1_rk,ndirs=1,depth=1e3_rk)
! Set array of wind speed and fetch values
wspd = range(5,60,5)
fetch = [1e3_rk,1e4_rk,1e5_rk]
do m = 1,size(fetch)
write(*,*)
write(*,fmt='(a,f5.1,a)')'fetch = ',fetch(m)/1e3_rk,' km'
write(*,fmt='(a)')' wspd Hs Tp Tm1 Tm2 mss m0(f)'&
//' m1(f) m2(f)'
write(*,fmt='(a)')'----------------------------------------------------------'&
//'----------------------'
do n = 1,size(wspd)
! Set the spectrum field to Phillips parametric shape
call spec % setSpectrum(phillips(spec % getFrequency(),&
jonswapPeakFrequency(wspd(n),fetch(m),grav),grav))
write(*,fmt='(9(f8.4,1x))')wspd(n),spec % significantWaveHeight(),&
1./spec % peakFrequency(),spec % meanPeriod(),&
spec % meanPeriodZeroCrossing(),spec % meanSquareSlope(),&
spec % frequencyMoment(0),spec % frequencyMoment(1),&
spec % frequencyMoment(2)
enddo
enddo
endprogram test_phillips
| wavebitscientific/wavy | src/tests/integration/test_phillips.f90 | FORTRAN | bsd-3-clause | 1,875 | [
30522,
999,
999,
23098,
1011,
1037,
17435,
4153,
4400,
11643,
1998,
2458,
7705,
999,
9385,
1006,
1039,
1007,
2418,
1010,
4400,
16313,
4045,
11775,
999,
2035,
2916,
9235,
1012,
999,
999,
7000,
2104,
1996,
18667,
2094,
1011,
1017,
11075,
61... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCollectionTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('collection', function(Blueprint $table)
{
$table->string('text_id', 128)->primary();
$table->integer('seq');
});
DB::table('collection')->insert($this->getData());
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('collection');
}
/**
* Get Data
*
* @return array
*/
private function getData()
{
return array(
array('text_id' => 'biography','seq' => '40'),
array('text_id' => 'conflict-of-the-ages','seq' => '1'),
array('text_id' => 'devotionals','seq' => '3'),
array('text_id' => 'early-writings','seq' => '7'),
array('text_id' => 'education','seq' => '5'),
array('text_id' => 'exegesis','seq' => '10'),
array('text_id' => 'health','seq' => '4'),
array('text_id' => 'letters-and-manuscripts','seq' => '900'),
array('text_id' => 'manuscript-releases','seq' => '51'),
array('text_id' => 'miscellaneous','seq' => '99'),
array('text_id' => 'mission','seq' => '6'),
array('text_id' => 'modern-english','seq' => '200'),
array('text_id' => 'periodicals','seq' => '50'),
array('text_id' => 'prophecies','seq' => '8'),
array('text_id' => 'revival-and-reformation','seq' => '11'),
array('text_id' => 'teachings-of-christ','seq' => '9'),
array('text_id' => 'testimonies','seq' => '2')
);
}
}
| egwk/egwk | database/migrations/2018_10_09_183306_create_collection_table.php | PHP | gpl-3.0 | 1,596 | [
30522,
1026,
1029,
25718,
2224,
5665,
12717,
12556,
1032,
7809,
1032,
9230,
2015,
1032,
9230,
1025,
2224,
5665,
12717,
12556,
1032,
7809,
1032,
8040,
28433,
1032,
2630,
16550,
1025,
2465,
3443,
26895,
18491,
10880,
8908,
9230,
1063,
1013,
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... |
/**
* Autogenerated by Thrift for src/module2.thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated @nocommit
*/
#include "thrift/compiler/test/fixtures/qualified/gen-cpp2/module2_constants.h"
#include <thrift/lib/cpp2/gen/module_constants_cpp.h>
#include "thrift/compiler/test/fixtures/qualified/gen-cpp2/module0_constants.h"
#include "thrift/compiler/test/fixtures/qualified/gen-cpp2/module1_constants.h"
namespace module2 {
::module2::Struct const& module2_constants::c2() {
static folly::Indestructible<::module2::Struct> const instance(::apache::thrift::detail::make_constant< ::module2::Struct>(::apache::thrift::type_class::structure{}, ::apache::thrift::detail::wrap_struct_argument<::apache::thrift::tag::first>(static_cast<::module0::Struct>(::module0::module0_constants::c0())), ::apache::thrift::detail::wrap_struct_argument<::apache::thrift::tag::second>(static_cast<::module1::Struct>(::module1::module1_constants::c1()))));
return *instance;
}
::module2::Struct const& module2_constants::c3() {
static folly::Indestructible<::module2::Struct> const instance(::module2::module2_constants::c2());
return *instance;
}
::module2::Struct const& module2_constants::c4() {
static folly::Indestructible<::module2::Struct> const instance(::module2::module2_constants::c2());
return *instance;
}
} // module2
| facebook/fbthrift | thrift/compiler/test/fixtures/qualified/gen-cpp2/module2_constants.cpp | C++ | apache-2.0 | 1,375 | [
30522,
1013,
1008,
1008,
1008,
8285,
6914,
16848,
2011,
16215,
16338,
2005,
5034,
2278,
1013,
11336,
2475,
1012,
16215,
16338,
1008,
1008,
2079,
2025,
10086,
4983,
2017,
2024,
2469,
2008,
2017,
2113,
2054,
2017,
2024,
2725,
1008,
1030,
7013... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 VM5\IpBundle\Tests\Utility;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class Ipv4TypeTest extends WebTestCase
{
/**
* @var \Doctrine\ORM\EntityManager
*/
private $em;
/**
* {@inheritDoc}
*/
public function setUp()
{
self::bootKernel();
$this->em = static::$kernel->getContainer()
->get('doctrine')
->getManager()
;
}
public function testType()
{
return;
$ipAddresses = array(
'192.168.1.7' => 3232235783,
'127.0.0.1' => 2130706433,
'74.125.71.94' => 1249724254,
'217.174.146.30' => 3652096542
);
foreach ($ipAddresses as $sourceIp => $targetIp) {
$ipAddressEntity = new \VM5\IpBundle\Tests\Entity\IpAddress();
$ipAddressEntity->setSourceIp($sourceIp);
$ipAddressEntity->setTargetIp($targetIp);
$this->em->persist($ipAddressEntity);
}
$this->em->flush();
$connection = $this->em->getConnection();
foreach ($ipAddressEntity as $sourceIp => $targetIp) {
$ipAddressEntity = $this->em->find('VM5\IpBundle\Tests\Entity\IpAddress', $sourceIp);
$this->assertEquals($sourceIp, $ipAddressEntity->getTargetIp());
// $this->assertEquals($targetIp, $databaseIP);
}
}
/**
* {@inheritDoc}
*/
protected function tearDown()
{
parent::tearDown();
$this->em->close();
}
}
| vm5/IpBundle | lib/Tests/Utility/Ipv4TypeTest.php | PHP | gpl-2.0 | 1,551 | [
30522,
1026,
1029,
25718,
3415,
15327,
1058,
2213,
2629,
1032,
12997,
27265,
2571,
1032,
5852,
1032,
9710,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
14012,
1032,
7705,
27265,
2571,
1032,
3231,
1032,
4773,
22199,
18382,
1025,
2465,
12997,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/**
* QuoteSettings.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.sforce.soap._2006._04.metadata;
public class QuoteSettings extends com.sforce.soap._2006._04.metadata.Metadata implements java.io.Serializable {
private boolean enableQuote;
public QuoteSettings() {
}
public QuoteSettings(
java.lang.String fullName,
boolean enableQuote) {
super(
fullName);
this.enableQuote = enableQuote;
}
/**
* Gets the enableQuote value for this QuoteSettings.
*
* @return enableQuote
*/
public boolean isEnableQuote() {
return enableQuote;
}
/**
* Sets the enableQuote value for this QuoteSettings.
*
* @param enableQuote
*/
public void setEnableQuote(boolean enableQuote) {
this.enableQuote = enableQuote;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof QuoteSettings)) return false;
QuoteSettings other = (QuoteSettings) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj) &&
this.enableQuote == other.isEnableQuote();
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
_hashCode += (isEnableQuote() ? Boolean.TRUE : Boolean.FALSE).hashCode();
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(QuoteSettings.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://soap.sforce.com/2006/04/metadata", "QuoteSettings"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("enableQuote");
elemField.setXmlName(new javax.xml.namespace.QName("http://soap.sforce.com/2006/04/metadata", "enableQuote"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
| jwiesel/sfdcCommander | sfdcCommander/src/main/java/com/sforce/soap/_2006/_04/metadata/QuoteSettings.java | Java | mit | 3,704 | [
30522,
1013,
1008,
1008,
1008,
16614,
18319,
3070,
2015,
1012,
9262,
1008,
1008,
2023,
5371,
2001,
8285,
1011,
7013,
2013,
1059,
16150,
2140,
1008,
2011,
1996,
15895,
8123,
1015,
1012,
1018,
19804,
2570,
1010,
2294,
1006,
5757,
1024,
4583,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 BigD\ThemeBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('theme');
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.
return $treeBuilder;
}
}
| matudelatower/BigD | src/BigD/ThemeBundle/DependencyInjection/Configuration.php | PHP | mit | 870 | [
30522,
1026,
1029,
25718,
3415,
15327,
2502,
2094,
1032,
4323,
27265,
2571,
1032,
24394,
2378,
20614,
3258,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
6922,
1032,
9530,
8873,
2290,
1032,
6210,
1032,
12508,
1032,
3392,
8569,
23891,
2099,
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... |
/*
* Copyright (c) 1997, 2014, 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.
*
*/
#include "precompiled.hpp"
#include "ci/bcEscapeAnalyzer.hpp"
#include "compiler/oopMap.hpp"
#include "opto/callGenerator.hpp"
#include "opto/callnode.hpp"
#include "opto/escape.hpp"
#include "opto/locknode.hpp"
#include "opto/machnode.hpp"
#include "opto/matcher.hpp"
#include "opto/parse.hpp"
#include "opto/regalloc.hpp"
#include "opto/regmask.hpp"
#include "opto/rootnode.hpp"
#include "opto/runtime.hpp"
// Portions of code courtesy of Clifford Click
// Optimization - Graph Style
//=============================================================================
uint StartNode::size_of() const { return sizeof(*this); }
uint StartNode::cmp( const Node &n ) const
{ return _domain == ((StartNode&)n)._domain; }
const Type *StartNode::bottom_type() const { return _domain; }
const Type *StartNode::Value(PhaseTransform *phase) const { return _domain; }
#ifndef PRODUCT
void StartNode::dump_spec(outputStream *st) const { st->print(" #"); _domain->dump_on(st);}
#endif
//------------------------------Ideal------------------------------------------
Node *StartNode::Ideal(PhaseGVN *phase, bool can_reshape){
return remove_dead_region(phase, can_reshape) ? this : NULL;
}
//------------------------------calling_convention-----------------------------
void StartNode::calling_convention( BasicType* sig_bt, VMRegPair *parm_regs, uint argcnt ) const {
Matcher::calling_convention( sig_bt, parm_regs, argcnt, false );
}
//------------------------------Registers--------------------------------------
const RegMask &StartNode::in_RegMask(uint) const {
return RegMask::Empty;
}
//------------------------------match------------------------------------------
// Construct projections for incoming parameters, and their RegMask info
Node *StartNode::match( const ProjNode *proj, const Matcher *match ) {
switch (proj->_con) {
case TypeFunc::Control:
case TypeFunc::I_O:
case TypeFunc::Memory:
return new (match->C) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj);
case TypeFunc::FramePtr:
return new (match->C) MachProjNode(this,proj->_con,Matcher::c_frame_ptr_mask, Op_RegP);
case TypeFunc::ReturnAdr:
return new (match->C) MachProjNode(this,proj->_con,match->_return_addr_mask,Op_RegP);
case TypeFunc::Parms:
default: {
uint parm_num = proj->_con - TypeFunc::Parms;
const Type *t = _domain->field_at(proj->_con);
if (t->base() == Type::Half) // 2nd half of Longs and Doubles
return new (match->C) ConNode(Type::TOP);
uint ideal_reg = t->ideal_reg();
RegMask &rm = match->_calling_convention_mask[parm_num];
return new (match->C) MachProjNode(this,proj->_con,rm,ideal_reg);
}
}
return NULL;
}
//------------------------------StartOSRNode----------------------------------
// The method start node for an on stack replacement adapter
//------------------------------osr_domain-----------------------------
const TypeTuple *StartOSRNode::osr_domain() {
const Type **fields = TypeTuple::fields(2);
fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // address of osr buffer
return TypeTuple::make(TypeFunc::Parms+1, fields);
}
//=============================================================================
const char * const ParmNode::names[TypeFunc::Parms+1] = {
"Control", "I_O", "Memory", "FramePtr", "ReturnAdr", "Parms"
};
#ifndef PRODUCT
void ParmNode::dump_spec(outputStream *st) const {
if( _con < TypeFunc::Parms ) {
st->print("%s", names[_con]);
} else {
st->print("Parm%d: ",_con-TypeFunc::Parms);
// Verbose and WizardMode dump bottom_type for all nodes
if( !Verbose && !WizardMode ) bottom_type()->dump_on(st);
}
}
#endif
uint ParmNode::ideal_reg() const {
switch( _con ) {
case TypeFunc::Control : // fall through
case TypeFunc::I_O : // fall through
case TypeFunc::Memory : return 0;
case TypeFunc::FramePtr : // fall through
case TypeFunc::ReturnAdr: return Op_RegP;
default : assert( _con > TypeFunc::Parms, "" );
// fall through
case TypeFunc::Parms : {
// Type of argument being passed
const Type *t = in(0)->as_Start()->_domain->field_at(_con);
return t->ideal_reg();
}
}
ShouldNotReachHere();
return 0;
}
//=============================================================================
ReturnNode::ReturnNode(uint edges, Node *cntrl, Node *i_o, Node *memory, Node *frameptr, Node *retadr ) : Node(edges) {
init_req(TypeFunc::Control,cntrl);
init_req(TypeFunc::I_O,i_o);
init_req(TypeFunc::Memory,memory);
init_req(TypeFunc::FramePtr,frameptr);
init_req(TypeFunc::ReturnAdr,retadr);
}
Node *ReturnNode::Ideal(PhaseGVN *phase, bool can_reshape){
return remove_dead_region(phase, can_reshape) ? this : NULL;
}
const Type *ReturnNode::Value( PhaseTransform *phase ) const {
return ( phase->type(in(TypeFunc::Control)) == Type::TOP)
? Type::TOP
: Type::BOTTOM;
}
// Do we Match on this edge index or not? No edges on return nodes
uint ReturnNode::match_edge(uint idx) const {
return 0;
}
#ifndef PRODUCT
void ReturnNode::dump_req(outputStream *st) const {
// Dump the required inputs, enclosed in '(' and ')'
uint i; // Exit value of loop
for (i = 0; i < req(); i++) { // For all required inputs
if (i == TypeFunc::Parms) st->print("returns");
if (in(i)) st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
else st->print("_ ");
}
}
#endif
//=============================================================================
RethrowNode::RethrowNode(
Node* cntrl,
Node* i_o,
Node* memory,
Node* frameptr,
Node* ret_adr,
Node* exception
) : Node(TypeFunc::Parms + 1) {
init_req(TypeFunc::Control , cntrl );
init_req(TypeFunc::I_O , i_o );
init_req(TypeFunc::Memory , memory );
init_req(TypeFunc::FramePtr , frameptr );
init_req(TypeFunc::ReturnAdr, ret_adr);
init_req(TypeFunc::Parms , exception);
}
Node *RethrowNode::Ideal(PhaseGVN *phase, bool can_reshape){
return remove_dead_region(phase, can_reshape) ? this : NULL;
}
const Type *RethrowNode::Value( PhaseTransform *phase ) const {
return (phase->type(in(TypeFunc::Control)) == Type::TOP)
? Type::TOP
: Type::BOTTOM;
}
uint RethrowNode::match_edge(uint idx) const {
return 0;
}
#ifndef PRODUCT
void RethrowNode::dump_req(outputStream *st) const {
// Dump the required inputs, enclosed in '(' and ')'
uint i; // Exit value of loop
for (i = 0; i < req(); i++) { // For all required inputs
if (i == TypeFunc::Parms) st->print("exception");
if (in(i)) st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
else st->print("_ ");
}
}
#endif
//=============================================================================
// Do we Match on this edge index or not? Match only target address & method
uint TailCallNode::match_edge(uint idx) const {
return TypeFunc::Parms <= idx && idx <= TypeFunc::Parms+1;
}
//=============================================================================
// Do we Match on this edge index or not? Match only target address & oop
uint TailJumpNode::match_edge(uint idx) const {
return TypeFunc::Parms <= idx && idx <= TypeFunc::Parms+1;
}
//=============================================================================
JVMState::JVMState(ciMethod* method, JVMState* caller) :
_method(method) {
assert(method != NULL, "must be valid call site");
_reexecute = Reexecute_Undefined;
debug_only(_bci = -99); // random garbage value
debug_only(_map = (SafePointNode*)-1);
_caller = caller;
_depth = 1 + (caller == NULL ? 0 : caller->depth());
_locoff = TypeFunc::Parms;
_stkoff = _locoff + _method->max_locals();
_monoff = _stkoff + _method->max_stack();
_scloff = _monoff;
_endoff = _monoff;
_sp = 0;
}
JVMState::JVMState(int stack_size) :
_method(NULL) {
_bci = InvocationEntryBci;
_reexecute = Reexecute_Undefined;
debug_only(_map = (SafePointNode*)-1);
_caller = NULL;
_depth = 1;
_locoff = TypeFunc::Parms;
_stkoff = _locoff;
_monoff = _stkoff + stack_size;
_scloff = _monoff;
_endoff = _monoff;
_sp = 0;
}
//--------------------------------of_depth-------------------------------------
JVMState* JVMState::of_depth(int d) const {
const JVMState* jvmp = this;
assert(0 < d && (uint)d <= depth(), "oob");
for (int skip = depth() - d; skip > 0; skip--) {
jvmp = jvmp->caller();
}
assert(jvmp->depth() == (uint)d, "found the right one");
return (JVMState*)jvmp;
}
//-----------------------------same_calls_as-----------------------------------
bool JVMState::same_calls_as(const JVMState* that) const {
if (this == that) return true;
if (this->depth() != that->depth()) return false;
const JVMState* p = this;
const JVMState* q = that;
for (;;) {
if (p->_method != q->_method) return false;
if (p->_method == NULL) return true; // bci is irrelevant
if (p->_bci != q->_bci) return false;
if (p->_reexecute != q->_reexecute) return false;
p = p->caller();
q = q->caller();
if (p == q) return true;
assert(p != NULL && q != NULL, "depth check ensures we don't run off end");
}
}
//------------------------------debug_start------------------------------------
uint JVMState::debug_start() const {
debug_only(JVMState* jvmroot = of_depth(1));
assert(jvmroot->locoff() <= this->locoff(), "youngest JVMState must be last");
return of_depth(1)->locoff();
}
//-------------------------------debug_end-------------------------------------
uint JVMState::debug_end() const {
debug_only(JVMState* jvmroot = of_depth(1));
assert(jvmroot->endoff() <= this->endoff(), "youngest JVMState must be last");
return endoff();
}
//------------------------------debug_depth------------------------------------
uint JVMState::debug_depth() const {
uint total = 0;
for (const JVMState* jvmp = this; jvmp != NULL; jvmp = jvmp->caller()) {
total += jvmp->debug_size();
}
return total;
}
#ifndef PRODUCT
//------------------------------format_helper----------------------------------
// Given an allocation (a Chaitin object) and a Node decide if the Node carries
// any defined value or not. If it does, print out the register or constant.
static void format_helper( PhaseRegAlloc *regalloc, outputStream* st, Node *n, const char *msg, uint i, GrowableArray<SafePointScalarObjectNode*> *scobjs ) {
if (n == NULL) { st->print(" NULL"); return; }
if (n->is_SafePointScalarObject()) {
// Scalar replacement.
SafePointScalarObjectNode* spobj = n->as_SafePointScalarObject();
scobjs->append_if_missing(spobj);
int sco_n = scobjs->find(spobj);
assert(sco_n >= 0, "");
st->print(" %s%d]=#ScObj" INT32_FORMAT, msg, i, sco_n);
return;
}
if (regalloc->node_regs_max_index() > 0 &&
OptoReg::is_valid(regalloc->get_reg_first(n))) { // Check for undefined
char buf[50];
regalloc->dump_register(n,buf);
st->print(" %s%d]=%s",msg,i,buf);
} else { // No register, but might be constant
const Type *t = n->bottom_type();
switch (t->base()) {
case Type::Int:
st->print(" %s%d]=#"INT32_FORMAT,msg,i,t->is_int()->get_con());
break;
case Type::AnyPtr:
assert( t == TypePtr::NULL_PTR || n->in_dump(), "" );
st->print(" %s%d]=#NULL",msg,i);
break;
case Type::AryPtr:
case Type::InstPtr:
st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->isa_oopptr()->const_oop()));
break;
case Type::KlassPtr:
st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_klassptr()->klass()));
break;
case Type::MetadataPtr:
st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_metadataptr()->metadata()));
break;
case Type::NarrowOop:
st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_oopptr()->const_oop()));
break;
case Type::RawPtr:
st->print(" %s%d]=#Raw" INTPTR_FORMAT,msg,i,p2i(t->is_rawptr()));
break;
case Type::DoubleCon:
st->print(" %s%d]=#%fD",msg,i,t->is_double_constant()->_d);
break;
case Type::FloatCon:
st->print(" %s%d]=#%fF",msg,i,t->is_float_constant()->_f);
break;
case Type::Long:
st->print(" %s%d]=#"INT64_FORMAT,msg,i,(int64_t)(t->is_long()->get_con()));
break;
case Type::Half:
case Type::Top:
st->print(" %s%d]=_",msg,i);
break;
default: ShouldNotReachHere();
}
}
}
//------------------------------format-----------------------------------------
void JVMState::format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st) const {
st->print(" #");
if (_method) {
_method->print_short_name(st);
st->print(" @ bci:%d ",_bci);
} else {
st->print_cr(" runtime stub ");
return;
}
if (n->is_MachSafePoint()) {
GrowableArray<SafePointScalarObjectNode*> scobjs;
MachSafePointNode *mcall = n->as_MachSafePoint();
uint i;
// Print locals
for (i = 0; i < (uint)loc_size(); i++)
format_helper(regalloc, st, mcall->local(this, i), "L[", i, &scobjs);
// Print stack
for (i = 0; i < (uint)stk_size(); i++) {
if ((uint)(_stkoff + i) >= mcall->len())
st->print(" oob ");
else
format_helper(regalloc, st, mcall->stack(this, i), "STK[", i, &scobjs);
}
for (i = 0; (int)i < nof_monitors(); i++) {
Node *box = mcall->monitor_box(this, i);
Node *obj = mcall->monitor_obj(this, i);
if (regalloc->node_regs_max_index() > 0 &&
OptoReg::is_valid(regalloc->get_reg_first(box))) {
box = BoxLockNode::box_node(box);
format_helper(regalloc, st, box, "MON-BOX[", i, &scobjs);
} else {
OptoReg::Name box_reg = BoxLockNode::reg(box);
st->print(" MON-BOX%d=%s+%d",
i,
OptoReg::regname(OptoReg::c_frame_pointer),
regalloc->reg2offset(box_reg));
}
const char* obj_msg = "MON-OBJ[";
if (EliminateLocks) {
if (BoxLockNode::box_node(box)->is_eliminated())
obj_msg = "MON-OBJ(LOCK ELIMINATED)[";
}
format_helper(regalloc, st, obj, obj_msg, i, &scobjs);
}
for (i = 0; i < (uint)scobjs.length(); i++) {
// Scalar replaced objects.
st->cr();
st->print(" # ScObj" INT32_FORMAT " ", i);
SafePointScalarObjectNode* spobj = scobjs.at(i);
ciKlass* cik = spobj->bottom_type()->is_oopptr()->klass();
assert(cik->is_instance_klass() ||
cik->is_array_klass(), "Not supported allocation.");
ciInstanceKlass *iklass = NULL;
if (cik->is_instance_klass()) {
cik->print_name_on(st);
iklass = cik->as_instance_klass();
} else if (cik->is_type_array_klass()) {
cik->as_array_klass()->base_element_type()->print_name_on(st);
st->print("[%d]", spobj->n_fields());
} else if (cik->is_obj_array_klass()) {
ciKlass* cie = cik->as_obj_array_klass()->base_element_klass();
if (cie->is_instance_klass()) {
cie->print_name_on(st);
} else if (cie->is_type_array_klass()) {
cie->as_array_klass()->base_element_type()->print_name_on(st);
} else {
ShouldNotReachHere();
}
st->print("[%d]", spobj->n_fields());
int ndim = cik->as_array_klass()->dimension() - 1;
while (ndim-- > 0) {
st->print("[]");
}
}
st->print("={");
uint nf = spobj->n_fields();
if (nf > 0) {
uint first_ind = spobj->first_index(mcall->jvms());
Node* fld_node = mcall->in(first_ind);
ciField* cifield;
if (iklass != NULL) {
st->print(" [");
cifield = iklass->nonstatic_field_at(0);
cifield->print_name_on(st);
format_helper(regalloc, st, fld_node, ":", 0, &scobjs);
} else {
format_helper(regalloc, st, fld_node, "[", 0, &scobjs);
}
for (uint j = 1; j < nf; j++) {
fld_node = mcall->in(first_ind+j);
if (iklass != NULL) {
st->print(", [");
cifield = iklass->nonstatic_field_at(j);
cifield->print_name_on(st);
format_helper(regalloc, st, fld_node, ":", j, &scobjs);
} else {
format_helper(regalloc, st, fld_node, ", [", j, &scobjs);
}
}
}
st->print(" }");
}
}
st->cr();
if (caller() != NULL) caller()->format(regalloc, n, st);
}
void JVMState::dump_spec(outputStream *st) const {
if (_method != NULL) {
bool printed = false;
if (!Verbose) {
// The JVMS dumps make really, really long lines.
// Take out the most boring parts, which are the package prefixes.
char buf[500];
stringStream namest(buf, sizeof(buf));
_method->print_short_name(&namest);
if (namest.count() < sizeof(buf)) {
const char* name = namest.base();
if (name[0] == ' ') ++name;
const char* endcn = strchr(name, ':'); // end of class name
if (endcn == NULL) endcn = strchr(name, '(');
if (endcn == NULL) endcn = name + strlen(name);
while (endcn > name && endcn[-1] != '.' && endcn[-1] != '/')
--endcn;
st->print(" %s", endcn);
printed = true;
}
}
if (!printed)
_method->print_short_name(st);
st->print(" @ bci:%d",_bci);
if(_reexecute == Reexecute_True)
st->print(" reexecute");
} else {
st->print(" runtime stub");
}
if (caller() != NULL) caller()->dump_spec(st);
}
void JVMState::dump_on(outputStream* st) const {
bool print_map = _map && !((uintptr_t)_map & 1) &&
((caller() == NULL) || (caller()->map() != _map));
if (print_map) {
if (_map->len() > _map->req()) { // _map->has_exceptions()
Node* ex = _map->in(_map->req()); // _map->next_exception()
// skip the first one; it's already being printed
while (ex != NULL && ex->len() > ex->req()) {
ex = ex->in(ex->req()); // ex->next_exception()
ex->dump(1);
}
}
_map->dump(Verbose ? 2 : 1);
}
if (caller() != NULL) {
caller()->dump_on(st);
}
st->print("JVMS depth=%d loc=%d stk=%d arg=%d mon=%d scalar=%d end=%d mondepth=%d sp=%d bci=%d reexecute=%s method=",
depth(), locoff(), stkoff(), argoff(), monoff(), scloff(), endoff(), monitor_depth(), sp(), bci(), should_reexecute()?"true":"false");
if (_method == NULL) {
st->print_cr("(none)");
} else {
_method->print_name(st);
st->cr();
if (bci() >= 0 && bci() < _method->code_size()) {
st->print(" bc: ");
_method->print_codes_on(bci(), bci()+1, st);
}
}
}
// Extra way to dump a jvms from the debugger,
// to avoid a bug with C++ member function calls.
void dump_jvms(JVMState* jvms) {
jvms->dump();
}
#endif
//--------------------------clone_shallow--------------------------------------
JVMState* JVMState::clone_shallow(Compile* C) const {
JVMState* n = has_method() ? new (C) JVMState(_method, _caller) : new (C) JVMState(0);
n->set_bci(_bci);
n->_reexecute = _reexecute;
n->set_locoff(_locoff);
n->set_stkoff(_stkoff);
n->set_monoff(_monoff);
n->set_scloff(_scloff);
n->set_endoff(_endoff);
n->set_sp(_sp);
n->set_map(_map);
return n;
}
//---------------------------clone_deep----------------------------------------
JVMState* JVMState::clone_deep(Compile* C) const {
JVMState* n = clone_shallow(C);
for (JVMState* p = n; p->_caller != NULL; p = p->_caller) {
p->_caller = p->_caller->clone_shallow(C);
}
assert(n->depth() == depth(), "sanity");
assert(n->debug_depth() == debug_depth(), "sanity");
return n;
}
/**
* Reset map for all callers
*/
void JVMState::set_map_deep(SafePointNode* map) {
for (JVMState* p = this; p->_caller != NULL; p = p->_caller) {
p->set_map(map);
}
}
// Adapt offsets in in-array after adding or removing an edge.
// Prerequisite is that the JVMState is used by only one node.
void JVMState::adapt_position(int delta) {
for (JVMState* jvms = this; jvms != NULL; jvms = jvms->caller()) {
jvms->set_locoff(jvms->locoff() + delta);
jvms->set_stkoff(jvms->stkoff() + delta);
jvms->set_monoff(jvms->monoff() + delta);
jvms->set_scloff(jvms->scloff() + delta);
jvms->set_endoff(jvms->endoff() + delta);
}
}
// Mirror the stack size calculation in the deopt code
// How much stack space would we need at this point in the program in
// case of deoptimization?
int JVMState::interpreter_frame_size() const {
const JVMState* jvms = this;
int size = 0;
int callee_parameters = 0;
int callee_locals = 0;
int extra_args = method()->max_stack() - stk_size();
while (jvms != NULL) {
int locks = jvms->nof_monitors();
int temps = jvms->stk_size();
bool is_top_frame = (jvms == this);
ciMethod* method = jvms->method();
int frame_size = BytesPerWord * Interpreter::size_activation(method->max_stack(),
temps + callee_parameters,
extra_args,
locks,
callee_parameters,
callee_locals,
is_top_frame);
size += frame_size;
callee_parameters = method->size_of_parameters();
callee_locals = method->max_locals();
extra_args = 0;
jvms = jvms->caller();
}
return size + Deoptimization::last_frame_adjust(0, callee_locals) * BytesPerWord;
}
//=============================================================================
uint CallNode::cmp( const Node &n ) const
{ return _tf == ((CallNode&)n)._tf && _jvms == ((CallNode&)n)._jvms; }
#ifndef PRODUCT
void CallNode::dump_req(outputStream *st) const {
// Dump the required inputs, enclosed in '(' and ')'
uint i; // Exit value of loop
for (i = 0; i < req(); i++) { // For all required inputs
if (i == TypeFunc::Parms) st->print("(");
if (in(i)) st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
else st->print("_ ");
}
st->print(")");
}
void CallNode::dump_spec(outputStream *st) const {
st->print(" ");
tf()->dump_on(st);
if (_cnt != COUNT_UNKNOWN) st->print(" C=%f",_cnt);
if (jvms() != NULL) jvms()->dump_spec(st);
}
#endif
const Type *CallNode::bottom_type() const { return tf()->range(); }
const Type *CallNode::Value(PhaseTransform *phase) const {
if (phase->type(in(0)) == Type::TOP) return Type::TOP;
return tf()->range();
}
//------------------------------calling_convention-----------------------------
void CallNode::calling_convention( BasicType* sig_bt, VMRegPair *parm_regs, uint argcnt ) const {
// Use the standard compiler calling convention
Matcher::calling_convention( sig_bt, parm_regs, argcnt, true );
}
//------------------------------match------------------------------------------
// Construct projections for control, I/O, memory-fields, ..., and
// return result(s) along with their RegMask info
Node *CallNode::match( const ProjNode *proj, const Matcher *match ) {
switch (proj->_con) {
case TypeFunc::Control:
case TypeFunc::I_O:
case TypeFunc::Memory:
return new (match->C) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj);
case TypeFunc::Parms+1: // For LONG & DOUBLE returns
assert(tf()->_range->field_at(TypeFunc::Parms+1) == Type::HALF, "");
// 2nd half of doubles and longs
return new (match->C) MachProjNode(this,proj->_con, RegMask::Empty, (uint)OptoReg::Bad);
case TypeFunc::Parms: { // Normal returns
uint ideal_reg = tf()->range()->field_at(TypeFunc::Parms)->ideal_reg();
OptoRegPair regs = is_CallRuntime()
? match->c_return_value(ideal_reg,true) // Calls into C runtime
: match-> return_value(ideal_reg,true); // Calls into compiled Java code
RegMask rm = RegMask(regs.first());
if( OptoReg::is_valid(regs.second()) )
rm.Insert( regs.second() );
return new (match->C) MachProjNode(this,proj->_con,rm,ideal_reg);
}
case TypeFunc::ReturnAdr:
case TypeFunc::FramePtr:
default:
ShouldNotReachHere();
}
return NULL;
}
// Do we Match on this edge index or not? Match no edges
uint CallNode::match_edge(uint idx) const {
return 0;
}
//
// Determine whether the call could modify the field of the specified
// instance at the specified offset.
//
bool CallNode::may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase) {
assert((t_oop != NULL), "sanity");
if (t_oop->is_known_instance()) {
// The instance_id is set only for scalar-replaceable allocations which
// are not passed as arguments according to Escape Analysis.
return false;
}
if (t_oop->is_ptr_to_boxed_value()) {
ciKlass* boxing_klass = t_oop->klass();
if (is_CallStaticJava() && as_CallStaticJava()->is_boxing_method()) {
// Skip unrelated boxing methods.
Node* proj = proj_out(TypeFunc::Parms);
if ((proj == NULL) || (phase->type(proj)->is_instptr()->klass() != boxing_klass)) {
return false;
}
}
if (is_CallJava() && as_CallJava()->method() != NULL) {
ciMethod* meth = as_CallJava()->method();
if (meth->is_accessor()) {
return false;
}
// May modify (by reflection) if an boxing object is passed
// as argument or returned.
if (returns_pointer() && (proj_out(TypeFunc::Parms) != NULL)) {
Node* proj = proj_out(TypeFunc::Parms);
const TypeInstPtr* inst_t = phase->type(proj)->isa_instptr();
if ((inst_t != NULL) && (!inst_t->klass_is_exact() ||
(inst_t->klass() == boxing_klass))) {
return true;
}
}
const TypeTuple* d = tf()->domain();
for (uint i = TypeFunc::Parms; i < d->cnt(); i++) {
const TypeInstPtr* inst_t = d->field_at(i)->isa_instptr();
if ((inst_t != NULL) && (!inst_t->klass_is_exact() ||
(inst_t->klass() == boxing_klass))) {
return true;
}
}
return false;
}
}
return true;
}
// Does this call have a direct reference to n other than debug information?
bool CallNode::has_non_debug_use(Node *n) {
const TypeTuple * d = tf()->domain();
for (uint i = TypeFunc::Parms; i < d->cnt(); i++) {
Node *arg = in(i);
if (arg == n) {
return true;
}
}
return false;
}
// Returns the unique CheckCastPP of a call
// or 'this' if there are several CheckCastPP
// or returns NULL if there is no one.
Node *CallNode::result_cast() {
Node *cast = NULL;
Node *p = proj_out(TypeFunc::Parms);
if (p == NULL)
return NULL;
for (DUIterator_Fast imax, i = p->fast_outs(imax); i < imax; i++) {
Node *use = p->fast_out(i);
if (use->is_CheckCastPP()) {
if (cast != NULL) {
return this; // more than 1 CheckCastPP
}
cast = use;
}
}
return cast;
}
void CallNode::extract_projections(CallProjections* projs, bool separate_io_proj) {
projs->fallthrough_proj = NULL;
projs->fallthrough_catchproj = NULL;
projs->fallthrough_ioproj = NULL;
projs->catchall_ioproj = NULL;
projs->catchall_catchproj = NULL;
projs->fallthrough_memproj = NULL;
projs->catchall_memproj = NULL;
projs->resproj = NULL;
projs->exobj = NULL;
for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
ProjNode *pn = fast_out(i)->as_Proj();
if (pn->outcnt() == 0) continue;
switch (pn->_con) {
case TypeFunc::Control:
{
// For Control (fallthrough) and I_O (catch_all_index) we have CatchProj -> Catch -> Proj
projs->fallthrough_proj = pn;
DUIterator_Fast jmax, j = pn->fast_outs(jmax);
const Node *cn = pn->fast_out(j);
if (cn->is_Catch()) {
ProjNode *cpn = NULL;
for (DUIterator_Fast kmax, k = cn->fast_outs(kmax); k < kmax; k++) {
cpn = cn->fast_out(k)->as_Proj();
assert(cpn->is_CatchProj(), "must be a CatchProjNode");
if (cpn->_con == CatchProjNode::fall_through_index)
projs->fallthrough_catchproj = cpn;
else {
assert(cpn->_con == CatchProjNode::catch_all_index, "must be correct index.");
projs->catchall_catchproj = cpn;
}
}
}
break;
}
case TypeFunc::I_O:
if (pn->_is_io_use)
projs->catchall_ioproj = pn;
else
projs->fallthrough_ioproj = pn;
for (DUIterator j = pn->outs(); pn->has_out(j); j++) {
Node* e = pn->out(j);
if (e->Opcode() == Op_CreateEx && e->in(0)->is_CatchProj() && e->outcnt() > 0) {
assert(projs->exobj == NULL, "only one");
projs->exobj = e;
}
}
break;
case TypeFunc::Memory:
if (pn->_is_io_use)
projs->catchall_memproj = pn;
else
projs->fallthrough_memproj = pn;
break;
case TypeFunc::Parms:
projs->resproj = pn;
break;
default:
assert(false, "unexpected projection from allocation node.");
}
}
// The resproj may not exist because the result couuld be ignored
// and the exception object may not exist if an exception handler
// swallows the exception but all the other must exist and be found.
assert(projs->fallthrough_proj != NULL, "must be found");
assert(Compile::current()->inlining_incrementally() || projs->fallthrough_catchproj != NULL, "must be found");
assert(Compile::current()->inlining_incrementally() || projs->fallthrough_memproj != NULL, "must be found");
assert(Compile::current()->inlining_incrementally() || projs->fallthrough_ioproj != NULL, "must be found");
assert(Compile::current()->inlining_incrementally() || projs->catchall_catchproj != NULL, "must be found");
if (separate_io_proj) {
assert(Compile::current()->inlining_incrementally() || projs->catchall_memproj != NULL, "must be found");
assert(Compile::current()->inlining_incrementally() || projs->catchall_ioproj != NULL, "must be found");
}
}
Node *CallNode::Ideal(PhaseGVN *phase, bool can_reshape) {
CallGenerator* cg = generator();
if (can_reshape && cg != NULL && cg->is_mh_late_inline() && !cg->already_attempted()) {
// Check whether this MH handle call becomes a candidate for inlining
ciMethod* callee = cg->method();
vmIntrinsics::ID iid = callee->intrinsic_id();
if (iid == vmIntrinsics::_invokeBasic) {
if (in(TypeFunc::Parms)->Opcode() == Op_ConP) {
phase->C->prepend_late_inline(cg);
set_generator(NULL);
}
} else {
assert(callee->has_member_arg(), "wrong type of call?");
if (in(TypeFunc::Parms + callee->arg_size() - 1)->Opcode() == Op_ConP) {
phase->C->prepend_late_inline(cg);
set_generator(NULL);
}
}
}
return SafePointNode::Ideal(phase, can_reshape);
}
//=============================================================================
uint CallJavaNode::size_of() const { return sizeof(*this); }
uint CallJavaNode::cmp( const Node &n ) const {
CallJavaNode &call = (CallJavaNode&)n;
return CallNode::cmp(call) && _method == call._method;
}
#ifndef PRODUCT
void CallJavaNode::dump_spec(outputStream *st) const {
if( _method ) _method->print_short_name(st);
CallNode::dump_spec(st);
}
#endif
//=============================================================================
uint CallStaticJavaNode::size_of() const { return sizeof(*this); }
uint CallStaticJavaNode::cmp( const Node &n ) const {
CallStaticJavaNode &call = (CallStaticJavaNode&)n;
return CallJavaNode::cmp(call);
}
//----------------------------uncommon_trap_request----------------------------
// If this is an uncommon trap, return the request code, else zero.
int CallStaticJavaNode::uncommon_trap_request() const {
if (_name != NULL && !strcmp(_name, "uncommon_trap")) {
return extract_uncommon_trap_request(this);
}
return 0;
}
int CallStaticJavaNode::extract_uncommon_trap_request(const Node* call) {
#ifndef PRODUCT
if (!(call->req() > TypeFunc::Parms &&
call->in(TypeFunc::Parms) != NULL &&
call->in(TypeFunc::Parms)->is_Con())) {
assert(in_dump() != 0, "OK if dumping");
tty->print("[bad uncommon trap]");
return 0;
}
#endif
return call->in(TypeFunc::Parms)->bottom_type()->is_int()->get_con();
}
#ifndef PRODUCT
void CallStaticJavaNode::dump_spec(outputStream *st) const {
st->print("# Static ");
if (_name != NULL) {
st->print("%s", _name);
int trap_req = uncommon_trap_request();
if (trap_req != 0) {
char buf[100];
st->print("(%s)",
Deoptimization::format_trap_request(buf, sizeof(buf),
trap_req));
}
st->print(" ");
}
CallJavaNode::dump_spec(st);
}
#endif
//=============================================================================
uint CallDynamicJavaNode::size_of() const { return sizeof(*this); }
uint CallDynamicJavaNode::cmp( const Node &n ) const {
CallDynamicJavaNode &call = (CallDynamicJavaNode&)n;
return CallJavaNode::cmp(call);
}
#ifndef PRODUCT
void CallDynamicJavaNode::dump_spec(outputStream *st) const {
st->print("# Dynamic ");
CallJavaNode::dump_spec(st);
}
#endif
//=============================================================================
uint CallRuntimeNode::size_of() const { return sizeof(*this); }
uint CallRuntimeNode::cmp( const Node &n ) const {
CallRuntimeNode &call = (CallRuntimeNode&)n;
return CallNode::cmp(call) && !strcmp(_name,call._name);
}
#ifndef PRODUCT
void CallRuntimeNode::dump_spec(outputStream *st) const {
st->print("# ");
st->print("%s", _name);
CallNode::dump_spec(st);
}
#endif
//------------------------------calling_convention-----------------------------
void CallRuntimeNode::calling_convention( BasicType* sig_bt, VMRegPair *parm_regs, uint argcnt ) const {
Matcher::c_calling_convention( sig_bt, parm_regs, argcnt );
}
//=============================================================================
//------------------------------calling_convention-----------------------------
//=============================================================================
#ifndef PRODUCT
void CallLeafNode::dump_spec(outputStream *st) const {
st->print("# ");
st->print("%s", _name);
CallNode::dump_spec(st);
}
#endif
//=============================================================================
void SafePointNode::set_local(JVMState* jvms, uint idx, Node *c) {
assert(verify_jvms(jvms), "jvms must match");
int loc = jvms->locoff() + idx;
if (in(loc)->is_top() && idx > 0 && !c->is_top() ) {
// If current local idx is top then local idx - 1 could
// be a long/double that needs to be killed since top could
// represent the 2nd half ofthe long/double.
uint ideal = in(loc -1)->ideal_reg();
if (ideal == Op_RegD || ideal == Op_RegL) {
// set other (low index) half to top
set_req(loc - 1, in(loc));
}
}
set_req(loc, c);
}
uint SafePointNode::size_of() const { return sizeof(*this); }
uint SafePointNode::cmp( const Node &n ) const {
return (&n == this); // Always fail except on self
}
//-------------------------set_next_exception----------------------------------
void SafePointNode::set_next_exception(SafePointNode* n) {
assert(n == NULL || n->Opcode() == Op_SafePoint, "correct value for next_exception");
if (len() == req()) {
if (n != NULL) add_prec(n);
} else {
set_prec(req(), n);
}
}
//----------------------------next_exception-----------------------------------
SafePointNode* SafePointNode::next_exception() const {
if (len() == req()) {
return NULL;
} else {
Node* n = in(req());
assert(n == NULL || n->Opcode() == Op_SafePoint, "no other uses of prec edges");
return (SafePointNode*) n;
}
}
//------------------------------Ideal------------------------------------------
// Skip over any collapsed Regions
Node *SafePointNode::Ideal(PhaseGVN *phase, bool can_reshape) {
return remove_dead_region(phase, can_reshape) ? this : NULL;
}
//------------------------------Identity---------------------------------------
// Remove obviously duplicate safepoints
Node *SafePointNode::Identity( PhaseTransform *phase ) {
// If you have back to back safepoints, remove one
if( in(TypeFunc::Control)->is_SafePoint() )
return in(TypeFunc::Control);
if( in(0)->is_Proj() ) {
Node *n0 = in(0)->in(0);
// Check if he is a call projection (except Leaf Call)
if( n0->is_Catch() ) {
n0 = n0->in(0)->in(0);
assert( n0->is_Call(), "expect a call here" );
}
if( n0->is_Call() && n0->as_Call()->guaranteed_safepoint() ) {
// Useless Safepoint, so remove it
return in(TypeFunc::Control);
}
}
return this;
}
//------------------------------Value------------------------------------------
const Type *SafePointNode::Value( PhaseTransform *phase ) const {
if( phase->type(in(0)) == Type::TOP ) return Type::TOP;
if( phase->eqv( in(0), this ) ) return Type::TOP; // Dead infinite loop
return Type::CONTROL;
}
#ifndef PRODUCT
void SafePointNode::dump_spec(outputStream *st) const {
st->print(" SafePoint ");
}
#endif
const RegMask &SafePointNode::in_RegMask(uint idx) const {
if( idx < TypeFunc::Parms ) return RegMask::Empty;
// Values outside the domain represent debug info
return *(Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()]);
}
const RegMask &SafePointNode::out_RegMask() const {
return RegMask::Empty;
}
void SafePointNode::grow_stack(JVMState* jvms, uint grow_by) {
assert((int)grow_by > 0, "sanity");
int monoff = jvms->monoff();
int scloff = jvms->scloff();
int endoff = jvms->endoff();
assert(endoff == (int)req(), "no other states or debug info after me");
Node* top = Compile::current()->top();
for (uint i = 0; i < grow_by; i++) {
ins_req(monoff, top);
}
jvms->set_monoff(monoff + grow_by);
jvms->set_scloff(scloff + grow_by);
jvms->set_endoff(endoff + grow_by);
}
void SafePointNode::push_monitor(const FastLockNode *lock) {
// Add a LockNode, which points to both the original BoxLockNode (the
// stack space for the monitor) and the Object being locked.
const int MonitorEdges = 2;
assert(JVMState::logMonitorEdges == exact_log2(MonitorEdges), "correct MonitorEdges");
assert(req() == jvms()->endoff(), "correct sizing");
int nextmon = jvms()->scloff();
if (GenerateSynchronizationCode) {
ins_req(nextmon, lock->box_node());
ins_req(nextmon+1, lock->obj_node());
} else {
Node* top = Compile::current()->top();
ins_req(nextmon, top);
ins_req(nextmon, top);
}
jvms()->set_scloff(nextmon + MonitorEdges);
jvms()->set_endoff(req());
}
void SafePointNode::pop_monitor() {
// Delete last monitor from debug info
debug_only(int num_before_pop = jvms()->nof_monitors());
const int MonitorEdges = 2;
assert(JVMState::logMonitorEdges == exact_log2(MonitorEdges), "correct MonitorEdges");
int scloff = jvms()->scloff();
int endoff = jvms()->endoff();
int new_scloff = scloff - MonitorEdges;
int new_endoff = endoff - MonitorEdges;
jvms()->set_scloff(new_scloff);
jvms()->set_endoff(new_endoff);
while (scloff > new_scloff) del_req_ordered(--scloff);
assert(jvms()->nof_monitors() == num_before_pop-1, "");
}
Node *SafePointNode::peek_monitor_box() const {
int mon = jvms()->nof_monitors() - 1;
assert(mon >= 0, "most have a monitor");
return monitor_box(jvms(), mon);
}
Node *SafePointNode::peek_monitor_obj() const {
int mon = jvms()->nof_monitors() - 1;
assert(mon >= 0, "most have a monitor");
return monitor_obj(jvms(), mon);
}
// Do we Match on this edge index or not? Match no edges
uint SafePointNode::match_edge(uint idx) const {
if( !needs_polling_address_input() )
return 0;
return (TypeFunc::Parms == idx);
}
//============== SafePointScalarObjectNode ==============
SafePointScalarObjectNode::SafePointScalarObjectNode(const TypeOopPtr* tp,
#ifdef ASSERT
AllocateNode* alloc,
#endif
uint first_index,
uint n_fields) :
TypeNode(tp, 1), // 1 control input -- seems required. Get from root.
#ifdef ASSERT
_alloc(alloc),
#endif
_first_index(first_index),
_n_fields(n_fields)
{
init_class_id(Class_SafePointScalarObject);
}
// Do not allow value-numbering for SafePointScalarObject node.
uint SafePointScalarObjectNode::hash() const { return NO_HASH; }
uint SafePointScalarObjectNode::cmp( const Node &n ) const {
return (&n == this); // Always fail except on self
}
uint SafePointScalarObjectNode::ideal_reg() const {
return 0; // No matching to machine instruction
}
const RegMask &SafePointScalarObjectNode::in_RegMask(uint idx) const {
return *(Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()]);
}
const RegMask &SafePointScalarObjectNode::out_RegMask() const {
return RegMask::Empty;
}
uint SafePointScalarObjectNode::match_edge(uint idx) const {
return 0;
}
SafePointScalarObjectNode*
SafePointScalarObjectNode::clone(Dict* sosn_map) const {
void* cached = (*sosn_map)[(void*)this];
if (cached != NULL) {
return (SafePointScalarObjectNode*)cached;
}
SafePointScalarObjectNode* res = (SafePointScalarObjectNode*)Node::clone();
sosn_map->Insert((void*)this, (void*)res);
return res;
}
#ifndef PRODUCT
void SafePointScalarObjectNode::dump_spec(outputStream *st) const {
st->print(" # fields@[%d..%d]", first_index(),
first_index() + n_fields() - 1);
}
#endif
//=============================================================================
uint AllocateNode::size_of() const { return sizeof(*this); }
AllocateNode::AllocateNode(Compile* C, const TypeFunc *atype,
Node *ctrl, Node *mem, Node *abio,
Node *size, Node *klass_node, Node *initial_test)
: CallNode(atype, NULL, TypeRawPtr::BOTTOM)
{
init_class_id(Class_Allocate);
init_flags(Flag_is_macro);
_is_scalar_replaceable = false;
_is_non_escaping = false;
Node *topnode = C->top();
init_req( TypeFunc::Control , ctrl );
init_req( TypeFunc::I_O , abio );
init_req( TypeFunc::Memory , mem );
init_req( TypeFunc::ReturnAdr, topnode );
init_req( TypeFunc::FramePtr , topnode );
init_req( AllocSize , size);
init_req( KlassNode , klass_node);
init_req( InitialTest , initial_test);
init_req( ALength , topnode);
C->add_macro_node(this);
}
//=============================================================================
Node* AllocateArrayNode::Ideal(PhaseGVN *phase, bool can_reshape) {
if (remove_dead_region(phase, can_reshape)) return this;
// Don't bother trying to transform a dead node
if (in(0) && in(0)->is_top()) return NULL;
const Type* type = phase->type(Ideal_length());
if (type->isa_int() && type->is_int()->_hi < 0) {
if (can_reshape) {
PhaseIterGVN *igvn = phase->is_IterGVN();
// Unreachable fall through path (negative array length),
// the allocation can only throw so disconnect it.
Node* proj = proj_out(TypeFunc::Control);
Node* catchproj = NULL;
if (proj != NULL) {
for (DUIterator_Fast imax, i = proj->fast_outs(imax); i < imax; i++) {
Node *cn = proj->fast_out(i);
if (cn->is_Catch()) {
catchproj = cn->as_Multi()->proj_out(CatchProjNode::fall_through_index);
break;
}
}
}
if (catchproj != NULL && catchproj->outcnt() > 0 &&
(catchproj->outcnt() > 1 ||
catchproj->unique_out()->Opcode() != Op_Halt)) {
assert(catchproj->is_CatchProj(), "must be a CatchProjNode");
Node* nproj = catchproj->clone();
igvn->register_new_node_with_optimizer(nproj);
Node *frame = new (phase->C) ParmNode( phase->C->start(), TypeFunc::FramePtr );
frame = phase->transform(frame);
// Halt & Catch Fire
Node *halt = new (phase->C) HaltNode( nproj, frame );
phase->C->root()->add_req(halt);
phase->transform(halt);
igvn->replace_node(catchproj, phase->C->top());
return this;
}
} else {
// Can't correct it during regular GVN so register for IGVN
phase->C->record_for_igvn(this);
}
}
return NULL;
}
// Retrieve the length from the AllocateArrayNode. Narrow the type with a
// CastII, if appropriate. If we are not allowed to create new nodes, and
// a CastII is appropriate, return NULL.
Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseTransform *phase, bool allow_new_nodes) {
Node *length = in(AllocateNode::ALength);
assert(length != NULL, "length is not null");
const TypeInt* length_type = phase->find_int_type(length);
const TypeAryPtr* ary_type = oop_type->isa_aryptr();
if (ary_type != NULL && length_type != NULL) {
const TypeInt* narrow_length_type = ary_type->narrow_size_type(length_type);
if (narrow_length_type != length_type) {
// Assert one of:
// - the narrow_length is 0
// - the narrow_length is not wider than length
assert(narrow_length_type == TypeInt::ZERO ||
length_type->is_con() && narrow_length_type->is_con() &&
(narrow_length_type->_hi <= length_type->_lo) ||
(narrow_length_type->_hi <= length_type->_hi &&
narrow_length_type->_lo >= length_type->_lo),
"narrow type must be narrower than length type");
// Return NULL if new nodes are not allowed
if (!allow_new_nodes) return NULL;
// Create a cast which is control dependent on the initialization to
// propagate the fact that the array length must be positive.
length = new (phase->C) CastIINode(length, narrow_length_type);
length->set_req(0, initialization()->proj_out(0));
}
}
return length;
}
//=============================================================================
uint LockNode::size_of() const { return sizeof(*this); }
// Redundant lock elimination
//
// There are various patterns of locking where we release and
// immediately reacquire a lock in a piece of code where no operations
// occur in between that would be observable. In those cases we can
// skip releasing and reacquiring the lock without violating any
// fairness requirements. Doing this around a loop could cause a lock
// to be held for a very long time so we concentrate on non-looping
// control flow. We also require that the operations are fully
// redundant meaning that we don't introduce new lock operations on
// some paths so to be able to eliminate it on others ala PRE. This
// would probably require some more extensive graph manipulation to
// guarantee that the memory edges were all handled correctly.
//
// Assuming p is a simple predicate which can't trap in any way and s
// is a synchronized method consider this code:
//
// s();
// if (p)
// s();
// else
// s();
// s();
//
// 1. The unlocks of the first call to s can be eliminated if the
// locks inside the then and else branches are eliminated.
//
// 2. The unlocks of the then and else branches can be eliminated if
// the lock of the final call to s is eliminated.
//
// Either of these cases subsumes the simple case of sequential control flow
//
// Addtionally we can eliminate versions without the else case:
//
// s();
// if (p)
// s();
// s();
//
// 3. In this case we eliminate the unlock of the first s, the lock
// and unlock in the then case and the lock in the final s.
//
// Note also that in all these cases the then/else pieces don't have
// to be trivial as long as they begin and end with synchronization
// operations.
//
// s();
// if (p)
// s();
// f();
// s();
// s();
//
// The code will work properly for this case, leaving in the unlock
// before the call to f and the relock after it.
//
// A potentially interesting case which isn't handled here is when the
// locking is partially redundant.
//
// s();
// if (p)
// s();
//
// This could be eliminated putting unlocking on the else case and
// eliminating the first unlock and the lock in the then side.
// Alternatively the unlock could be moved out of the then side so it
// was after the merge and the first unlock and second lock
// eliminated. This might require less manipulation of the memory
// state to get correct.
//
// Additionally we might allow work between a unlock and lock before
// giving up eliminating the locks. The current code disallows any
// conditional control flow between these operations. A formulation
// similar to partial redundancy elimination computing the
// availability of unlocking and the anticipatability of locking at a
// program point would allow detection of fully redundant locking with
// some amount of work in between. I'm not sure how often I really
// think that would occur though. Most of the cases I've seen
// indicate it's likely non-trivial work would occur in between.
// There may be other more complicated constructs where we could
// eliminate locking but I haven't seen any others appear as hot or
// interesting.
//
// Locking and unlocking have a canonical form in ideal that looks
// roughly like this:
//
// <obj>
// | \\------+
// | \ \
// | BoxLock \
// | | | \
// | | \ \
// | | FastLock
// | | /
// | | /
// | | |
//
// Lock
// |
// Proj #0
// |
// MembarAcquire
// |
// Proj #0
//
// MembarRelease
// |
// Proj #0
// |
// Unlock
// |
// Proj #0
//
//
// This code proceeds by processing Lock nodes during PhaseIterGVN
// and searching back through its control for the proper code
// patterns. Once it finds a set of lock and unlock operations to
// eliminate they are marked as eliminatable which causes the
// expansion of the Lock and Unlock macro nodes to make the operation a NOP
//
//=============================================================================
//
// Utility function to skip over uninteresting control nodes. Nodes skipped are:
// - copy regions. (These may not have been optimized away yet.)
// - eliminated locking nodes
//
static Node *next_control(Node *ctrl) {
if (ctrl == NULL)
return NULL;
while (1) {
if (ctrl->is_Region()) {
RegionNode *r = ctrl->as_Region();
Node *n = r->is_copy();
if (n == NULL)
break; // hit a region, return it
else
ctrl = n;
} else if (ctrl->is_Proj()) {
Node *in0 = ctrl->in(0);
if (in0->is_AbstractLock() && in0->as_AbstractLock()->is_eliminated()) {
ctrl = in0->in(0);
} else {
break;
}
} else {
break; // found an interesting control
}
}
return ctrl;
}
//
// Given a control, see if it's the control projection of an Unlock which
// operating on the same object as lock.
//
bool AbstractLockNode::find_matching_unlock(const Node* ctrl, LockNode* lock,
GrowableArray<AbstractLockNode*> &lock_ops) {
ProjNode *ctrl_proj = (ctrl->is_Proj()) ? ctrl->as_Proj() : NULL;
if (ctrl_proj != NULL && ctrl_proj->_con == TypeFunc::Control) {
Node *n = ctrl_proj->in(0);
if (n != NULL && n->is_Unlock()) {
UnlockNode *unlock = n->as_Unlock();
if (lock->obj_node()->eqv_uncast(unlock->obj_node()) &&
BoxLockNode::same_slot(lock->box_node(), unlock->box_node()) &&
!unlock->is_eliminated()) {
lock_ops.append(unlock);
return true;
}
}
}
return false;
}
//
// Find the lock matching an unlock. Returns null if a safepoint
// or complicated control is encountered first.
LockNode *AbstractLockNode::find_matching_lock(UnlockNode* unlock) {
LockNode *lock_result = NULL;
// find the matching lock, or an intervening safepoint
Node *ctrl = next_control(unlock->in(0));
while (1) {
assert(ctrl != NULL, "invalid control graph");
assert(!ctrl->is_Start(), "missing lock for unlock");
if (ctrl->is_top()) break; // dead control path
if (ctrl->is_Proj()) ctrl = ctrl->in(0);
if (ctrl->is_SafePoint()) {
break; // found a safepoint (may be the lock we are searching for)
} else if (ctrl->is_Region()) {
// Check for a simple diamond pattern. Punt on anything more complicated
if (ctrl->req() == 3 && ctrl->in(1) != NULL && ctrl->in(2) != NULL) {
Node *in1 = next_control(ctrl->in(1));
Node *in2 = next_control(ctrl->in(2));
if (((in1->is_IfTrue() && in2->is_IfFalse()) ||
(in2->is_IfTrue() && in1->is_IfFalse())) && (in1->in(0) == in2->in(0))) {
ctrl = next_control(in1->in(0)->in(0));
} else {
break;
}
} else {
break;
}
} else {
ctrl = next_control(ctrl->in(0)); // keep searching
}
}
if (ctrl->is_Lock()) {
LockNode *lock = ctrl->as_Lock();
if (lock->obj_node()->eqv_uncast(unlock->obj_node()) &&
BoxLockNode::same_slot(lock->box_node(), unlock->box_node())) {
lock_result = lock;
}
}
return lock_result;
}
// This code corresponds to case 3 above.
bool AbstractLockNode::find_lock_and_unlock_through_if(Node* node, LockNode* lock,
GrowableArray<AbstractLockNode*> &lock_ops) {
Node* if_node = node->in(0);
bool if_true = node->is_IfTrue();
if (if_node->is_If() && if_node->outcnt() == 2 && (if_true || node->is_IfFalse())) {
Node *lock_ctrl = next_control(if_node->in(0));
if (find_matching_unlock(lock_ctrl, lock, lock_ops)) {
Node* lock1_node = NULL;
ProjNode* proj = if_node->as_If()->proj_out(!if_true);
if (if_true) {
if (proj->is_IfFalse() && proj->outcnt() == 1) {
lock1_node = proj->unique_out();
}
} else {
if (proj->is_IfTrue() && proj->outcnt() == 1) {
lock1_node = proj->unique_out();
}
}
if (lock1_node != NULL && lock1_node->is_Lock()) {
LockNode *lock1 = lock1_node->as_Lock();
if (lock->obj_node()->eqv_uncast(lock1->obj_node()) &&
BoxLockNode::same_slot(lock->box_node(), lock1->box_node()) &&
!lock1->is_eliminated()) {
lock_ops.append(lock1);
return true;
}
}
}
}
lock_ops.trunc_to(0);
return false;
}
bool AbstractLockNode::find_unlocks_for_region(const RegionNode* region, LockNode* lock,
GrowableArray<AbstractLockNode*> &lock_ops) {
// check each control merging at this point for a matching unlock.
// in(0) should be self edge so skip it.
for (int i = 1; i < (int)region->req(); i++) {
Node *in_node = next_control(region->in(i));
if (in_node != NULL) {
if (find_matching_unlock(in_node, lock, lock_ops)) {
// found a match so keep on checking.
continue;
} else if (find_lock_and_unlock_through_if(in_node, lock, lock_ops)) {
continue;
}
// If we fall through to here then it was some kind of node we
// don't understand or there wasn't a matching unlock, so give
// up trying to merge locks.
lock_ops.trunc_to(0);
return false;
}
}
return true;
}
#ifndef PRODUCT
//
// Create a counter which counts the number of times this lock is acquired
//
void AbstractLockNode::create_lock_counter(JVMState* state) {
_counter = OptoRuntime::new_named_counter(state, NamedCounter::LockCounter);
}
void AbstractLockNode::set_eliminated_lock_counter() {
if (_counter) {
// Update the counter to indicate that this lock was eliminated.
// The counter update code will stay around even though the
// optimizer will eliminate the lock operation itself.
_counter->set_tag(NamedCounter::EliminatedLockCounter);
}
}
#endif
//=============================================================================
Node *LockNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// perform any generic optimizations first (returns 'this' or NULL)
Node *result = SafePointNode::Ideal(phase, can_reshape);
if (result != NULL) return result;
// Don't bother trying to transform a dead node
if (in(0) && in(0)->is_top()) return NULL;
// Now see if we can optimize away this lock. We don't actually
// remove the locking here, we simply set the _eliminate flag which
// prevents macro expansion from expanding the lock. Since we don't
// modify the graph, the value returned from this function is the
// one computed above.
if (can_reshape && EliminateLocks && !is_non_esc_obj()) {
//
// If we are locking an unescaped object, the lock/unlock is unnecessary
//
ConnectionGraph *cgr = phase->C->congraph();
if (cgr != NULL && cgr->not_global_escape(obj_node())) {
assert(!is_eliminated() || is_coarsened(), "sanity");
// The lock could be marked eliminated by lock coarsening
// code during first IGVN before EA. Replace coarsened flag
// to eliminate all associated locks/unlocks.
this->set_non_esc_obj();
return result;
}
//
// Try lock coarsening
//
PhaseIterGVN* iter = phase->is_IterGVN();
if (iter != NULL && !is_eliminated()) {
GrowableArray<AbstractLockNode*> lock_ops;
Node *ctrl = next_control(in(0));
// now search back for a matching Unlock
if (find_matching_unlock(ctrl, this, lock_ops)) {
// found an unlock directly preceding this lock. This is the
// case of single unlock directly control dependent on a
// single lock which is the trivial version of case 1 or 2.
} else if (ctrl->is_Region() ) {
if (find_unlocks_for_region(ctrl->as_Region(), this, lock_ops)) {
// found lock preceded by multiple unlocks along all paths
// joining at this point which is case 3 in description above.
}
} else {
// see if this lock comes from either half of an if and the
// predecessors merges unlocks and the other half of the if
// performs a lock.
if (find_lock_and_unlock_through_if(ctrl, this, lock_ops)) {
// found unlock splitting to an if with locks on both branches.
}
}
if (lock_ops.length() > 0) {
// add ourselves to the list of locks to be eliminated.
lock_ops.append(this);
#ifndef PRODUCT
if (PrintEliminateLocks) {
int locks = 0;
int unlocks = 0;
for (int i = 0; i < lock_ops.length(); i++) {
AbstractLockNode* lock = lock_ops.at(i);
if (lock->Opcode() == Op_Lock)
locks++;
else
unlocks++;
if (Verbose) {
lock->dump(1);
}
}
tty->print_cr("***Eliminated %d unlocks and %d locks", unlocks, locks);
}
#endif
// for each of the identified locks, mark them
// as eliminatable
for (int i = 0; i < lock_ops.length(); i++) {
AbstractLockNode* lock = lock_ops.at(i);
// Mark it eliminated by coarsening and update any counters
lock->set_coarsened();
}
} else if (ctrl->is_Region() &&
iter->_worklist.member(ctrl)) {
// We weren't able to find any opportunities but the region this
// lock is control dependent on hasn't been processed yet so put
// this lock back on the worklist so we can check again once any
// region simplification has occurred.
iter->_worklist.push(this);
}
}
}
return result;
}
//=============================================================================
bool LockNode::is_nested_lock_region() {
BoxLockNode* box = box_node()->as_BoxLock();
int stk_slot = box->stack_slot();
if (stk_slot <= 0)
return false; // External lock or it is not Box (Phi node).
// Ignore complex cases: merged locks or multiple locks.
Node* obj = obj_node();
LockNode* unique_lock = NULL;
if (!box->is_simple_lock_region(&unique_lock, obj) ||
(unique_lock != this)) {
return false;
}
// Look for external lock for the same object.
SafePointNode* sfn = this->as_SafePoint();
JVMState* youngest_jvms = sfn->jvms();
int max_depth = youngest_jvms->depth();
for (int depth = 1; depth <= max_depth; depth++) {
JVMState* jvms = youngest_jvms->of_depth(depth);
int num_mon = jvms->nof_monitors();
// Loop over monitors
for (int idx = 0; idx < num_mon; idx++) {
Node* obj_node = sfn->monitor_obj(jvms, idx);
BoxLockNode* box_node = sfn->monitor_box(jvms, idx)->as_BoxLock();
if ((box_node->stack_slot() < stk_slot) && obj_node->eqv_uncast(obj)) {
return true;
}
}
}
return false;
}
//=============================================================================
uint UnlockNode::size_of() const { return sizeof(*this); }
//=============================================================================
Node *UnlockNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// perform any generic optimizations first (returns 'this' or NULL)
Node *result = SafePointNode::Ideal(phase, can_reshape);
if (result != NULL) return result;
// Don't bother trying to transform a dead node
if (in(0) && in(0)->is_top()) return NULL;
// Now see if we can optimize away this unlock. We don't actually
// remove the unlocking here, we simply set the _eliminate flag which
// prevents macro expansion from expanding the unlock. Since we don't
// modify the graph, the value returned from this function is the
// one computed above.
// Escape state is defined after Parse phase.
if (can_reshape && EliminateLocks && !is_non_esc_obj()) {
//
// If we are unlocking an unescaped object, the lock/unlock is unnecessary.
//
ConnectionGraph *cgr = phase->C->congraph();
if (cgr != NULL && cgr->not_global_escape(obj_node())) {
assert(!is_eliminated() || is_coarsened(), "sanity");
// The lock could be marked eliminated by lock coarsening
// code during first IGVN before EA. Replace coarsened flag
// to eliminate all associated locks/unlocks.
this->set_non_esc_obj();
}
}
return result;
}
| smarr/graal | src/share/vm/opto/callnode.cpp | C++ | gpl-2.0 | 64,301 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2722,
1010,
2297,
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,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
namespace AwesomeLogger.Audit.Api.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class Init : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.PatternMatches",
c => new
{
Id = c.Int(nullable: false, identity: true),
Created = c.DateTime(nullable: false),
MachineName = c.String(nullable: false, maxLength: 200),
SearchPath = c.String(nullable: false, maxLength: 255),
LogPath = c.String(nullable: false, maxLength: 255),
Pattern = c.String(nullable: false, maxLength: 200),
Line = c.Int(nullable: false),
Email = c.String(nullable: false, maxLength: 255),
Match = c.String(nullable: false),
})
.PrimaryKey(t => t.Id);
}
public override void Down()
{
DropTable("dbo.PatternMatches");
}
}
}
| alexey-ernest/awesome-logger | Package/Source/AwesomeLogger.Audit.Api/Migrations/201506211259170_Init.cs | C# | mit | 1,155 | [
30522,
3415,
15327,
12476,
21197,
4590,
1012,
15727,
1012,
17928,
1012,
9230,
2015,
1063,
2478,
2291,
1025,
2478,
2291,
1012,
2951,
1012,
9178,
1012,
9230,
2015,
1025,
2270,
7704,
2465,
1999,
4183,
1024,
16962,
4328,
29397,
1063,
2270,
2058... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 python
# -*- coding: utf-8 -*-
#
# pkpgcounter : a generic Page Description Language parser
#
# (c) 2003-2009 Jerome Alet <alet@librelogiciel.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, 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/>.
#
# $Id$
#
#
import sys
import glob
import os
import shutil
try :
from distutils.core import setup
except ImportError as msg :
sys.stderr.write("%s\n" % msg)
sys.stderr.write("You need the DistUtils Python module.\nunder Debian, you may have to install the python-dev package.\nOf course, YMMV.\n")
sys.exit(-1)
try :
from PIL import Image
except ImportError :
sys.stderr.write("You need the Python Imaging Library (aka PIL).\nYou can grab it from http://www.pythonware.com\n")
sys.exit(-1)
sys.path.insert(0, "pkpgpdls")
from pkpgpdls.version import __version__, __doc__
data_files = []
mofiles = glob.glob(os.sep.join(["po", "*", "*.mo"]))
for mofile in mofiles :
lang = mofile.split(os.sep)[1]
directory = os.sep.join(["share", "locale", lang, "LC_MESSAGES"])
data_files.append((directory, [ mofile ]))
docdir = "share/doc/pkpgcounter"
docfiles = ["README", "COPYING", "BUGS", "CREDITS", "AUTHORS", "TODO"]
data_files.append((docdir, docfiles))
if os.path.exists("ChangeLog") :
data_files.append((docdir, ["ChangeLog"]))
directory = os.sep.join(["share", "man", "man1"])
manpages = glob.glob(os.sep.join(["man", "*.1"]))
data_files.append((directory, manpages))
setup(name = "pkpgcounter", version = __version__,
license = "GNU GPL",
description = __doc__,
author = "Jerome Alet",
author_email = "alet@librelogiciel.com",
url = "http://www.pykota.com/software/pkpgcounter/",
packages = [ "pkpgpdls" ],
scripts = [ "bin/pkpgcounter" ],
data_files = data_files)
| lynxis/pkpgcounter | setup.py | Python | gpl-3.0 | 2,361 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
1001,
1052,
2243,
26952,
3597,
16671,
2121,
1024,
1037,
12391,
3931,
6412,
2653,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.wso2.andes.configuration.qpid;
import org.apache.commons.configuration.*;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.andes.configuration.AndesConfigurationManager;
import org.wso2.andes.configuration.enums.AndesConfiguration;
import org.wso2.andes.configuration.modules.JKSStore;
import org.wso2.andes.configuration.qpid.plugins.ConfigurationPlugin;
import org.wso2.andes.kernel.AndesException;
import org.wso2.andes.server.registry.ApplicationRegistry;
import org.wso2.andes.server.virtualhost.VirtualHost;
import org.wso2.andes.server.virtualhost.VirtualHostRegistry;
import sun.misc.Signal;
import sun.misc.SignalHandler;
import java.io.File;
import java.util.*;
import java.util.Map.Entry;
import static org.wso2.andes.transport.ConnectionSettings.WILDCARD_ADDRESS;
public class ServerConfiguration extends ConfigurationPlugin implements SignalHandler {
protected static final Log _logger = LogFactory.getLog(ServerConfiguration.class);
// Default Configuration values
public static final int DEFAULT_BUFFER_SIZE = 262144;
public static final int DEFAULT_SOCKET_BUFFER_SIZE = 32768;
public static final String DEFAULT_STATUS_UPDATES = "on";
public static final String SECURITY_CONFIG_RELOADED = "SECURITY CONFIGURATION RELOADED";
public static final int DEFAULT_FRAME_SIZE = 65536;
public static final int DEFAULT_PORT = 5672;
public static final int DEFAULT_SSL_PORT = 8672;
public static final long DEFAULT_HOUSEKEEPING_PERIOD = 30000L;
public static final int DEFAULT_JMXPORT = 8999;
public static final String QPID_HOME = "QPID_HOME";
public static final String QPID_WORK = "QPID_WORK";
private Map<String, VirtualHostConfiguration> _virtualHosts = new HashMap<String, VirtualHostConfiguration>();
private File _configFile;
private File _vhostsFile;
// Map of environment variables to config items
private static final Map<String, String> envVarMap = new HashMap<String, String>();
// Configuration values to be read from the configuration file
public static final String MGMT_CUSTOM_REGISTRY_SOCKET = "management.custom-registry-socket";
public static final String STATUS_UPDATES = "status-updates";
public static final String ADVANCED_LOCALE = "advanced.locale";
static {
envVarMap.put("QPID_ENABLEDIRECTBUFFERS", "advanced.enableDirectBuffers");
envVarMap.put("QPID_SSLPORT", "connector.ssl.port");
envVarMap.put("QPID_WRITEBIASED", "advanced.useWriteBiasedPool");
envVarMap.put("QPID_JMXPORT", "management.jmxport");
envVarMap.put("QPID_FRAMESIZE", "advanced.framesize");
envVarMap.put("QPID_MSGAUTH", "security.msg-auth");
envVarMap.put("QPID_AUTOREGISTER", "auto_register");
envVarMap.put("QPID_MANAGEMENTENABLED", "management.enabled");
envVarMap.put("QPID_HEARTBEATDELAY", "heartbeat.delay");
envVarMap.put("QPID_HEARTBEATTIMEOUTFACTOR", "heartbeat.timeoutFactor");
envVarMap.put("QPID_MAXIMUMMESSAGEAGE", "maximumMessageAge");
envVarMap.put("QPID_MAXIMUMMESSAGECOUNT", "maximumMessageCount");
envVarMap.put("QPID_MAXIMUMQUEUEDEPTH", "maximumQueueDepth");
envVarMap.put("QPID_MAXIMUMMESSAGESIZE", "maximumMessageSize");
envVarMap.put("QPID_MAXIMUMCHANNELCOUNT", "maximumChannelCount");
envVarMap.put("QPID_MINIMUMALERTREPEATGAP", "minimumAlertRepeatGap");
envVarMap.put("QPID_QUEUECAPACITY", "capacity");
envVarMap.put("QPID_FLOWRESUMECAPACITY", "flowResumeCapacity");
envVarMap.put("QPID_SOCKETRECEIVEBUFFER", "connector.socketReceiveBuffer");
envVarMap.put("QPID_SOCKETWRITEBUFFER", "connector.socketWriteBuffer");
envVarMap.put("QPID_TCPNODELAY", "connector.tcpNoDelay");
envVarMap.put("QPID_ENABLEPOOLEDALLOCATOR", "advanced.enablePooledAllocator");
envVarMap.put("QPID_STATUS-UPDATES", "status-updates");
}
/**
* Loads the given file and sets up the HUP signal handler.
* <p/>
* This will load the file and present the root level properties but will
* not perform any virtualhost configuration.
* <p/>
* To perform this {@link #initialise()} must be called.
* <p/>
* This has been made a two step process to allow the Plugin Manager and
* Configuration Manager to be initialised in the Application Registry.
* <p/>
* If using this ServerConfiguration via an ApplicationRegistry there is no
* need to explictly call {@link #initialise()} as this is done via the
* {@link ApplicationRegistry#initialise()} method.
*
* @param configurationURL
* @throws org.apache.commons.configuration.ConfigurationException
*
*/
public ServerConfiguration(File configurationURL) throws ConfigurationException {
this(parseConfig(configurationURL));
_configFile = configurationURL;
try {
Signal sig = new sun.misc.Signal("HUP");
sun.misc.Signal.handle(sig, this);
} catch (Exception e) {
_logger.info("Signal HUP not supported for OS: " + System.getProperty("os.name"));
// We're on something that doesn't handle SIGHUP, how sad, Windows.
}
}
/**
* Wraps the given Commons Configuration as a ServerConfiguration.
* <p/>
* Mainly used during testing and in locations where configuration is not
* desired but the interface requires configuration.
* <p/>
* If the given configuration has VirtualHost configuration then
* {@link #initialise()} must be called to perform the required setup.
* <p/>
* This has been made a two step process to allow the Plugin Manager and
* Configuration Manager to be initialised in the Application Registry.
* <p/>
* If using this ServerConfiguration via an ApplicationRegistry there is no
* need to explictly call {@link #initialise()} as this is done via the
* {@link ApplicationRegistry#initialise()} method.
*
* @param conf
*/
public ServerConfiguration(org.apache.commons.configuration.Configuration conf) {
_configuration = conf;
}
/**
* Processes this configuration and setups any VirtualHosts defined in the
* configuration.
* <p/>
* This has been separated from the constructor to allow the PluginManager
* time to be created and provide plugins to the ConfigurationManager for
* processing here.
* <p/>
* Called by {@link ApplicationRegistry#initialise()}.
* <p/>
* NOTE: A DEFAULT ApplicationRegistry must exist when using this method
* or a new ApplicationRegistry will be created.
*
* @throws ConfigurationException
*/
public void initialise() throws ConfigurationException {
setConfiguration("", _configuration);
setupVirtualHosts(_configuration);
}
public String[] getElementsProcessed() {
return new String[]{""};
}
@Override
public void validateConfiguration() throws ConfigurationException {
// Support for security.jmx.access was removed when JMX access rights were incorporated into the main ACL.
// This ensure that users remove the element from their configuration file.
if (getListValue("security.jmx.access").size() > 0) {
String message = "Validation error : security/jmx/access is no longer a supported element within the " +
"configuration xml."
+ (_configFile == null ? "" : " Configuration file : " + _configFile);
throw new ConfigurationException(message);
}
if (getListValue("security.jmx.principal-database").size() > 0) {
String message = "Validation error : security/jmx/principal-database is no longer a supported element " +
"within the configuration xml."
+ (_configFile == null ? "" : " Configuration file : " + _configFile);
throw new ConfigurationException(message);
}
if (getListValue("security.principal-databases.principal-database(0).class").size() > 0) {
String message = "Validation error : security/principal-databases is no longer supported within the " +
"configuration xml."
+ (_configFile == null ? "" : " Configuration file : " + _configFile);
throw new ConfigurationException(message);
}
}
/*
* Modified to enforce virtualhosts configuration in external file or main file, but not
* both, as a fix for QPID-2360 and QPID-2361.
*/
@SuppressWarnings("unchecked")
protected void setupVirtualHosts(org.apache.commons.configuration.Configuration conf) throws ConfigurationException {
String[] vhostFiles = conf.getStringArray("virtualhosts");
org.apache.commons.configuration.Configuration vhostConfig = conf.subset("virtualhosts");
// Only one configuration mechanism allowed
if (!(vhostFiles.length == 0) && !vhostConfig.subset("virtualhost").isEmpty()) {
throw new ConfigurationException("Only one of external or embedded virtualhosts configuration allowed.");
}
// We can only have one vhosts XML file included
if (vhostFiles.length > 1) {
throw new ConfigurationException("Only one external virtualhosts configuration file allowed, " +
"multiple filenames found.");
}
// Virtualhost configuration object
org.apache.commons.configuration.Configuration vhostConfiguration = new HierarchicalConfiguration();
// Load from embedded configuration if possible
if (!vhostConfig.subset("virtualhost").isEmpty()) {
vhostConfiguration = vhostConfig;
} else {
// Load from the external configuration if possible
for (String fileName : vhostFiles) {
// Open the vhosts XML file and copy values from it to our config
_vhostsFile = new File(fileName);
if (!_vhostsFile.exists()) {
throw new ConfigurationException("Virtualhosts file does not exist");
}
vhostConfiguration = parseConfig(new File(fileName));
// save the default virtualhost name
String defaultVirtualHost = vhostConfiguration.getString("default");
_configuration.setProperty("virtualhosts.default", defaultVirtualHost);
}
}
// Now extract the virtual host names from the configuration object
List hosts = vhostConfiguration.getList("virtualhost.name");
for (Object host : hosts) {
String name = (String) host;
// Add the virtual hosts to the server configuration
VirtualHostConfiguration virtualhost = new VirtualHostConfiguration(name,
vhostConfiguration.subset("virtualhost." + name));
_virtualHosts.put(virtualhost.getName(), virtualhost);
}
}
private static void substituteEnvironmentVariables(org.apache.commons.configuration.Configuration conf) {
for (Entry<String, String> var : envVarMap.entrySet()) {
String val = System.getenv(var.getKey());
if (val != null) {
conf.setProperty(var.getValue(), val);
}
}
}
private static org.apache.commons.configuration.Configuration parseConfig(File file) throws ConfigurationException {
ConfigurationFactory factory = new ConfigurationFactory();
factory.setConfigurationFileName(file.getAbsolutePath());
org.apache.commons.configuration.Configuration conf = factory.getConfiguration();
Iterator<?> keys = conf.getKeys();
if (!keys.hasNext()) {
conf = flatConfig(file);
}
substituteEnvironmentVariables(conf);
return conf;
}
/**
* Check the configuration file to see if status updates are enabled.
*
* @return true if status updates are enabled
*/
public boolean getStatusUpdatesEnabled() {
// Retrieve the setting from configuration but default to on.
String value = getStringValue(STATUS_UPDATES, DEFAULT_STATUS_UPDATES);
return value.equalsIgnoreCase("on");
}
/**
* The currently defined {@see Locale} for this broker
*
* @return the configuration defined locale
*/
public Locale getLocale() {
String localeString = getStringValue(ADVANCED_LOCALE);
// Expecting locale of format langauge_country_variant
// If the configuration does not have a defined locale use the JVM default
if (localeString == null) {
return Locale.getDefault();
}
String[] parts = localeString.split("_");
Locale locale;
switch (parts.length) {
case 1:
locale = new Locale(localeString);
break;
case 2:
locale = new Locale(parts[0], parts[1]);
break;
default:
StringBuilder variant = new StringBuilder(parts[2]);
// If we have a variant such as the Java doc suggests for Spanish
// Traditional_WIN we may end up with more than 3 parts on a
// split with '_'. So we should recombine the variant.
if (parts.length > 3) {
for (int index = 3; index < parts.length; index++) {
variant.append('_').append(parts[index]);
}
}
locale = new Locale(parts[0], parts[1], variant.toString());
}
return locale;
}
// Our configuration class needs to make the interpolate method
// public so it can be called below from the config method.
public static class MyConfiguration extends CompositeConfiguration {
public String interpolate(String obj) {
return super.interpolate(obj);
}
}
public static org.apache.commons.configuration.Configuration flatConfig(File file) throws ConfigurationException {
// We have to override the interpolate methods so that
// interpolation takes place accross the entirety of the
// composite configuration. Without doing this each
// configuration object only interpolates variables defined
// inside itself.
final MyConfiguration conf = new MyConfiguration();
conf.addConfiguration(new SystemConfiguration() {
protected String interpolate(String o) {
return conf.interpolate(o);
}
});
conf.addConfiguration(new XMLConfiguration(file) {
protected String interpolate(String o) {
return conf.interpolate(o);
}
});
return conf;
}
public void handle(Signal arg0) {
try {
reparseConfigFileSecuritySections();
} catch (ConfigurationException e) {
_logger.error("Could not reload configuration file security sections", e);
}
}
public void reparseConfigFileSecuritySections() throws ConfigurationException {
if (_configFile != null) {
org.apache.commons.configuration.Configuration newConfig = parseConfig(_configFile);
setConfiguration("", newConfig);
ApplicationRegistry.getInstance().getSecurityManager().configureHostPlugins(this);
// Reload virtualhosts from correct location
org.apache.commons.configuration.Configuration newVhosts;
if (_vhostsFile == null) {
newVhosts = newConfig.subset("virtualhosts");
} else {
newVhosts = parseConfig(_vhostsFile);
}
VirtualHostRegistry vhostRegistry = ApplicationRegistry.getInstance().getVirtualHostRegistry();
for (String hostName : _virtualHosts.keySet()) {
VirtualHost vhost = vhostRegistry.getVirtualHost(hostName);
Configuration vhostConfig = newVhosts.subset("virtualhost." + hostName);
vhost.getConfiguration().setConfiguration("virtualhosts.virtualhost", vhostConfig); // XXX
vhost.getSecurityManager().configureGlobalPlugins(this);
vhost.getSecurityManager().configureHostPlugins(vhost.getConfiguration());
}
_logger.warn(SECURITY_CONFIG_RELOADED);
}
}
public String getQpidWork() {
return System.getProperty(QPID_WORK, System.getProperty("java.io.tmpdir"));
}
public void setJMXManagementPort(int mport) {
getConfig().setProperty("management.jmxport", mport);
}
public int getJMXManagementPort() {
return getIntValue("management.jmxport", DEFAULT_JMXPORT);
}
public boolean getUseCustomRMISocketFactory() {
return getBooleanValue(MGMT_CUSTOM_REGISTRY_SOCKET, true);
}
public boolean getPlatformMbeanserver() {
return getBooleanValue("management.platform-mbeanserver", true);
}
public String[] getVirtualHosts() {
return _virtualHosts.keySet().toArray(new String[_virtualHosts.size()]);
}
public String getPluginDirectory() {
return getStringValue("plugin-directory");
}
public String getCacheDirectory() {
return getStringValue("cache-directory");
}
public VirtualHostConfiguration getVirtualHostConfig(String name) {
return _virtualHosts.get(name);
}
public int getFrameSize() {
return getIntValue("advanced.framesize", DEFAULT_FRAME_SIZE);
}
public boolean getSynchedClocks() {
return getBooleanValue("advanced.synced-clocks");
}
public boolean getMsgAuth() {
return getBooleanValue("security.msg-auth");
}
public String getManagementKeyStorePath() {
return getStringValue("management.ssl.keyStorePath");
}
public boolean getManagementSSLEnabled() {
return getBooleanValue("management.ssl.enabled", true);
}
public String getManagementKeyStorePassword() {
return getStringValue("management.ssl.keyStorePassword");
}
public boolean getQueueAutoRegister() {
return getBooleanValue("queue.auto_register", true);
}
public boolean getManagementEnabled() {
return getBooleanValue("management.enabled", true);
}
public void setManagementEnabled(boolean enabled) {
getConfig().setProperty("management.enabled", enabled);
}
public int getHeartBeatDelay() {
return getIntValue("heartbeat.delay", 0);
}
public double getHeartBeatTimeout() {
return getDoubleValue("heartbeat.timeoutFactor", 2.0);
}
public long getMaximumMessageAge() {
return getLongValue("maximumMessageAge");
}
public long getMaximumMessageCount() {
return getLongValue("maximumMessageCount");
}
public long getMaximumQueueDepth() {
return getLongValue("maximumQueueDepth");
}
public long getMaximumMessageSize() {
return getLongValue("maximumMessageSize");
}
public long getMinimumAlertRepeatGap() {
return getLongValue("minimumAlertRepeatGap");
}
public long getCapacity() {
return getLongValue("capacity");
}
public long getFlowResumeCapacity() {
return getLongValue("flowResumeCapacity", getCapacity());
}
public int getConnectorProcessors() {
return getIntValue("connector.processors", 4);
}
/**
* Retrieve Port from Andes configurations(broker.xml).
*
* @return Port
*/
public List getPorts() {
Integer port = AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_AMQP_DEFAULT_CONNECTION_PORT);
return Collections.singletonList(port);
}
public List getPortExclude010() {
return getListValue("connector.non010port");
}
public List getPortExclude091() {
return getListValue("connector.non091port");
}
public List getPortExclude09() {
return getListValue("connector.non09port");
}
public List getPortExclude08() {
return getListValue("connector.non08port");
}
/**
* Retrieve bind address from Andes configurations(broker.xml).
*
* @return Bind address
*/
public String getBind() {
return AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_AMQP_BIND_ADDRESS);
}
public int getReceiveBufferSize() {
return getIntValue("connector.socketReceiveBuffer", DEFAULT_SOCKET_BUFFER_SIZE);
}
public int getWriteBufferSize() {
return getIntValue("connector.socketWriteBuffer", DEFAULT_SOCKET_BUFFER_SIZE);
}
public boolean getTcpNoDelay() {
return getBooleanValue("connector.tcpNoDelay", true);
}
public boolean getEnableExecutorPool() {
return getBooleanValue("advanced.filterchain[@enableExecutorPool]");
}
public boolean getEnableSSL() {
return (Boolean)AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_AMQP_SSL_CONNECTION_ENABLED);
}
public boolean getSSLOnly() {
return (Boolean)AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_AMQP_SSL_CONNECTION_ENABLED) &&
!(Boolean)AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_AMQP_DEFAULT_CONNECTION_ENABLED);
}
public boolean getMQTTSSLOnly() {
return (Boolean) AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_MQTT_SSL_CONNECTION_ENABLED) &&
!(Boolean)AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_MQTT_DEFAULT_CONNECTION_ENABLED);
}
/**
* Retrieve SSL Port from Andes configurations(broker.xml).
*
* @return SSL Port List
*/
public List getSSLPorts() {
Integer sslPort = AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_AMQP_SSL_CONNECTION_PORT);
return Collections.singletonList(sslPort);
}
public String getKeystorePath() {
return ((JKSStore)AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_AMQP_SSL_CONNECTION_KEYSTORE)).getStoreLocation();
}
public String getKeystorePassword() {
return ((JKSStore)AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_AMQP_SSL_CONNECTION_KEYSTORE)).getPassword();
}
public String getKeyStoreCertType() {
return ((JKSStore)AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_AMQP_SSL_CONNECTION_KEYSTORE)).getStoreAlgorithm();
}
public boolean getUseBiasedWrites() {
return getBooleanValue("advanced.useWriteBiasedPool");
}
public String getDefaultVirtualHost() {
return getStringValue("virtualhosts.default");
}
public void setHousekeepingExpiredMessageCheckPeriod(long value) {
getConfig().setProperty("housekeeping.expiredMessageCheckPeriod", value);
}
public long getHousekeepingCheckPeriod() {
return getLongValue("housekeeping.checkPeriod",
getLongValue("housekeeping.expiredMessageCheckPeriod",
DEFAULT_HOUSEKEEPING_PERIOD));
}
public boolean isStatisticsGenerationBrokerEnabled() {
return getConfig().getBoolean("statistics.generation.broker", false);
}
public boolean isStatisticsGenerationVirtualhostsEnabled() {
return getConfig().getBoolean("statistics.generation.virtualhosts", false);
}
public boolean isStatisticsGenerationConnectionsEnabled() {
return getConfig().getBoolean("statistics.generation.connections", false);
}
public long getStatisticsReportingPeriod() {
return getConfig().getLong("statistics.reporting.period", 0L);
}
public boolean isStatisticsReportResetEnabled() {
return getConfig().getBoolean("statistics.reporting.reset", false);
}
public int getMaxChannelCount() {
return getIntValue("maximumChannelCount", 256);
}
}
| wso2/andes | modules/andes-core/broker/src/main/java/org/wso2/andes/configuration/qpid/ServerConfiguration.java | Java | apache-2.0 | 24,956 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2384,
1011,
30524,
1013,
7479,
1012,
1059,
6499,
2475,
1012,
8917,
1007,
2035,
2916,
9235,
1012,
1008,
1008,
1059,
6499,
2475,
4297,
1012,
15943,
2023,
5371,
2000,
2017,
2104,
1996,
15895,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/*
* Exynos PLL helper functions for clock drivers.
* Copyright (C) 2016 Samsung Electronics
* Thomas Abraham <thomas.ab@samsung.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
unsigned long pll145x_get_rate(unsigned int *con1, unsigned long fin_freq);
| guileschool/beagleboard | u-boot/drivers/clk/exynos/clk-pll.h | C | mit | 258 | [
30522,
1013,
1008,
1008,
4654,
6038,
2891,
20228,
2140,
2393,
2121,
4972,
2005,
5119,
6853,
1012,
1008,
9385,
1006,
1039,
30524,
1012,
11113,
1030,
19102,
1012,
4012,
1028,
1008,
1008,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
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... |
# Delphinium hispidum Boiss. SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Ranunculales/Ranunculaceae/Delphinium/Delphinium hispidum/README.md | Markdown | apache-2.0 | 176 | [
30522,
1001,
3972,
21850,
14907,
2010,
23267,
2819,
19651,
2015,
1012,
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,
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... |
/* First created by JCasGen Sun Nov 28 23:36:26 CET 2010 */
package org.apache.uima;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.cas.TOP_Type;
import org.apache.uima.jcas.cas.FSArray;
import org.apache.uima.jcas.tcas.Annotation;
/**
* Updated by JCasGen Fri Jun 07 17:39:54 CEST 2013
* XML source: /media/ext4/workspace/uima-connectors/desc/connectors/wstspl/AdhocWSTSPL2CASAE.xml
* @generated */
public class SentenceAnnotation extends Annotation {
/** @generated
* @ordered
*/
public final static int typeIndexID = JCasRegistry.register(SentenceAnnotation.class);
/** @generated
* @ordered
*/
public final static int type = typeIndexID;
/** @generated */
public int getTypeIndexID() {return typeIndexID;}
/** Never called. Disable default constructor
* @generated */
protected SentenceAnnotation() {/* intentionally empty block */}
/** Internal - constructor used by generator
* @generated */
public SentenceAnnotation(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
/** @generated */
public SentenceAnnotation(JCas jcas) {
super(jcas);
readObject();
}
/** @generated */
public SentenceAnnotation(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
}
/** <!-- begin-user-doc -->
* Write your own initialization here
* <!-- end-user-doc -->
@generated modifiable */
private void readObject() {}
//*--------------*
//* Feature: tokenList
/** getter for tokenList - gets
* @generated */
public FSArray getTokenList() {
if (SentenceAnnotation_Type.featOkTst && ((SentenceAnnotation_Type)jcasType).casFeat_tokenList == null)
jcasType.jcas.throwFeatMissing("tokenList", "org.apache.uima.SentenceAnnotation");
return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((SentenceAnnotation_Type)jcasType).casFeatCode_tokenList)));}
/** setter for tokenList - sets
* @generated */
public void setTokenList(FSArray v) {
if (SentenceAnnotation_Type.featOkTst && ((SentenceAnnotation_Type)jcasType).casFeat_tokenList == null)
jcasType.jcas.throwFeatMissing("tokenList", "org.apache.uima.SentenceAnnotation");
jcasType.ll_cas.ll_setRefValue(addr, ((SentenceAnnotation_Type)jcasType).casFeatCode_tokenList, jcasType.ll_cas.ll_getFSRef(v));}
/** indexed getter for tokenList - gets an indexed value -
* @generated */
public Annotation getTokenList(int i) {
if (SentenceAnnotation_Type.featOkTst && ((SentenceAnnotation_Type)jcasType).casFeat_tokenList == null)
jcasType.jcas.throwFeatMissing("tokenList", "org.apache.uima.SentenceAnnotation");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((SentenceAnnotation_Type)jcasType).casFeatCode_tokenList), i);
return (Annotation)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((SentenceAnnotation_Type)jcasType).casFeatCode_tokenList), i)));}
/** indexed setter for tokenList - sets an indexed value -
* @generated */
public void setTokenList(int i, Annotation v) {
if (SentenceAnnotation_Type.featOkTst && ((SentenceAnnotation_Type)jcasType).casFeat_tokenList == null)
jcasType.jcas.throwFeatMissing("tokenList", "org.apache.uima.SentenceAnnotation");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((SentenceAnnotation_Type)jcasType).casFeatCode_tokenList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((SentenceAnnotation_Type)jcasType).casFeatCode_tokenList), i, jcasType.ll_cas.ll_getFSRef(v));}
}
| nicolashernandez/dev-star | uima-star/uima-connectors/src/main/java/org/apache/uima/SentenceAnnotation.java | Java | apache-2.0 | 3,786 | [
30522,
1013,
1008,
2034,
2580,
2011,
29175,
3022,
6914,
3103,
13292,
2654,
2603,
1024,
4029,
1024,
2656,
8292,
2102,
2230,
1008,
1013,
7427,
8917,
1012,
15895,
1012,
21318,
2863,
1025,
12324,
8917,
1012,
15895,
1012,
21318,
2863,
1012,
2917... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
BuenaVista Rails plugin
=======================
The BuenaVista plugin makes your views nice. :)
There are some things you want to do in your Rails templates which make them nicer
for human consumption, but which are actually a bit tricky to do in practice. So it's
very tempting to get lazy and just do the simple thing instead. However, if you
really care about your user experience, you know that attention to detail matters.
In the BuenaVista plugin, we have collected a few reusable tools and helpers which
make it easier to implement those details which make your application beautiful and
delightful. See below for the things included.
To add BuenaVista to your Rails project:
$ ./script/plugin install git://github.com/rapportive-oss/buena_vista.git
To use BuenaVista's view helpers, add the following to your `ApplicationHelper`
(or other helper modules):
module ApplicationHelper
include BuenaVista::ViewHelpers
end
Intelligent truncation
----------------------
Sometimes we want to show the user the beginning of a chunk of text, and give them
the option to expand the rest if they are interested. Fair enough. So we have to
decide at what point we truncate the text. The obvious way of doing this is:
visible, hidden = text[0...VISIBLE_LENGTH] + '...', text[VISIBLE_LENGTH..-1]
...but of course that will truncate your text without any regard for the content.
Don't you hate it when a website truncates text in the middle of a word? I think
it's really ugly and it tells the user that we don't really care about them as a
human being.
Enter `BuenaVista::ViewHelpers#truncate_text`, which does truncation *nicely*.
It will prefer to break at the end of a sentence or paragraph, if possible; if
there's no sentence boundary nearby, it tries other punctuation; if that's not
convenient, at least it puts the split between two words. Only in very exceptional
cases do we split a word part way through.
More to come
------------
From time to time we will extract reusable bits from the Rapportive codebase and
add them to this plugin.
Patches are welcome. Please fork the repository, make sure you add tests for your
changes, and send us a GitHub pull request.
Who made this?
--------------
We are [Rapportive](http://rapportive.com), a San Francisco startup making email
a better place. We currently have a browser extension for Gmail which provides
information from social networks and business applications in a sidebar next to
your conversations.
By the way, we are hiring -- and if you're the sort of person who likes to explore
stuff on GitHub (as you are apparently doing), and you'd like to work with code
like this, you're exactly the kind of person we'd like to talk to. So please
[get in touch](http://rapportive.com)!
Copyright (c) 2010 Rapportive, Inc. Released under the terms of the MIT license.
| rapportive-oss/buena_vista | README.md | Markdown | mit | 2,861 | [
30522,
27493,
11365,
2696,
15168,
13354,
2378,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1996,
27493,
11365,
2696,
13354,
2378,
3084,
2115,
5328... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
/**
* @copyright Reinvently (c) 2017
* @link http://reinvently.com/
* @license https://opensource.org/licenses/Apache-2.0 Apache License 2.0
*/
namespace reinvently\ondemand\core\modules\settings\models\extrafee;
use reinvently\ondemand\core\components\model\CoreModel;
use reinvently\ondemand\core\components\transport\ApiInterface;
use reinvently\ondemand\core\components\transport\ApiTransportTrait;
/**
* Class ExtraFeeTime
* @package reinvently\ondemand\core\modules\settings\models\extrafee
*
* @property int id
* @property int extraFeeId
* @property string timeStart
* @property string timeFinish
*
*/
class ExtraFeeTime extends CoreModel implements ApiInterface
{
use ApiTransportTrait;
/**
* @return array the validation rules.
*/
public function rules()
{
return [
[['extraFeeId'], 'integer'],
[['timeStart', 'timeFinish'], 'validateTime'],
];
}
/**
* @param $attribute
* @param $param
*/
public function validateTime($attribute, $param)
{
$time = $this->getAttribute($attribute);
if(!strtotime($time)) {
$this->addError($attribute, \Yii::t('yii', 'Incorrect time format'));
}
}
/**
* @param bool $insert
* @return bool
*/
public function beforeSave($insert)
{
if($this->timeStart) {
$this->timeStart = (new \DateTime($this->timeStart))->format("H:i:s");
}
if($this->timeFinish) {
$this->timeFinish = (new \DateTime($this->timeFinish))->format("H:i:s");
}
return parent::beforeSave($insert);
}
/**
* @return array
*/
public function getItemForApi()
{
return [
'id' => $this->id,
'extraFeeId' => $this->extraFeeId,
'timeStart' => $this->timeStart,
'timeFinish' => $this->timeFinish,
];
}
/**
* @return array
*/
public function getItemShortForApi()
{
return [
'id' => $this->id,
'extraFeeId' => $this->extraFeeId,
'timeStart' => $this->timeStart,
'timeFinish' => $this->timeFinish,
];
}
} | Reinvently/On-Demand-Core | src/modules/settings/models/extrafee/ExtraFeeTime.php | PHP | apache-2.0 | 2,241 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
9385,
27788,
15338,
2135,
1006,
1039,
1007,
2418,
1008,
1030,
4957,
8299,
1024,
1013,
1013,
27788,
15338,
2135,
1012,
4012,
1013,
1008,
1030,
6105,
16770,
1024,
1013,
1013,
7480,
8162,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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>
<title>Liang-Barsky line clipping</title>
<script src="../dist/liang-barsky.umd.js"></script>
<style>
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
</head>
<body>
<script src="index.js"></script>
</body>
</html>
| w8r/liang-barsky | demo/index.html | HTML | mit | 355 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
2516,
1028,
16982,
1011,
6963,
4801,
2240,
12528,
4691,
1026,
1013,
2516,
1028,
1026,
5896,
5034,
2278,
1027,
1000,
1012,
1012,
1013,
4487,
3367,
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... |
'''
@author: KyleLevien
'''
from ..defaultpackage.package import Package
class _Ghostview(Package):
def __init__(self):
Package.__init__(self)
| mason-bially/windows-installer | packages/_Ghostview/_Ghostview.py | Python | mit | 169 | [
30522,
1005,
1005,
1005,
1030,
3166,
1024,
7648,
20414,
9013,
1005,
1005,
1005,
2013,
1012,
1012,
12398,
23947,
4270,
1012,
7427,
12324,
7427,
2465,
1035,
5745,
8584,
1006,
7427,
1007,
1024,
13366,
1035,
1035,
1999,
4183,
1035,
1035,
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) 2013 Red Hat, Inc.
*
* This library 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 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
* Author: Daniel P. Berrange <berrange@redhat.com>
*/
#include <config.h>
#ifdef __linux__
# include "internal.h"
# include <stdlib.h>
# include <dbus/dbus.h>
void dbus_connection_set_change_sigpipe(dbus_bool_t will_modify_sigpipe ATTRIBUTE_UNUSED)
{
}
DBusConnection *dbus_bus_get(DBusBusType type ATTRIBUTE_UNUSED,
DBusError *error ATTRIBUTE_UNUSED)
{
return (DBusConnection *)0x1;
}
void dbus_connection_set_exit_on_disconnect(DBusConnection *connection ATTRIBUTE_UNUSED,
dbus_bool_t exit_on_disconnect ATTRIBUTE_UNUSED)
{
}
dbus_bool_t dbus_connection_set_watch_functions(DBusConnection *connection ATTRIBUTE_UNUSED,
DBusAddWatchFunction add_function ATTRIBUTE_UNUSED,
DBusRemoveWatchFunction remove_function ATTRIBUTE_UNUSED,
DBusWatchToggledFunction toggled_function ATTRIBUTE_UNUSED,
void *data ATTRIBUTE_UNUSED,
DBusFreeFunction free_data_function ATTRIBUTE_UNUSED)
{
return 1;
}
dbus_bool_t dbus_message_set_reply_serial(DBusMessage *message ATTRIBUTE_UNUSED,
dbus_uint32_t serial ATTRIBUTE_UNUSED)
{
return 1;
}
DBusMessage *dbus_connection_send_with_reply_and_block(DBusConnection *connection ATTRIBUTE_UNUSED,
DBusMessage *message,
int timeout_milliseconds ATTRIBUTE_UNUSED,
DBusError *error ATTRIBUTE_UNUSED)
{
DBusMessage *reply = NULL;
const char *service = dbus_message_get_destination(message);
const char *member = dbus_message_get_member(message);
if (STREQ(service, "org.freedesktop.machine1")) {
if (getenv("FAIL_BAD_SERVICE")) {
DBusMessageIter iter;
const char *error_message = "Something went wrong creating the machine";
if (!(reply = dbus_message_new(DBUS_MESSAGE_TYPE_ERROR)))
return NULL;
dbus_message_set_error_name(reply, "org.freedesktop.systemd.badthing");
dbus_message_iter_init_append(reply, &iter);
if (!dbus_message_iter_append_basic(&iter,
DBUS_TYPE_STRING,
&error_message))
goto error;
} else {
reply = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN);
}
} else if (STREQ(service, "org.freedesktop.DBus") &&
STREQ(member, "ListActivatableNames")) {
const char *svc1 = "org.foo.bar.wizz";
const char *svc2 = "org.freedesktop.machine1";
DBusMessageIter iter, sub;
reply = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN);
dbus_message_iter_init_append(reply, &iter);
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
"s", &sub);
if (!dbus_message_iter_append_basic(&sub,
DBUS_TYPE_STRING,
&svc1))
goto error;
if (!getenv("FAIL_NO_SERVICE") &&
!dbus_message_iter_append_basic(&sub,
DBUS_TYPE_STRING,
&svc2))
goto error;
dbus_message_iter_close_container(&iter, &sub);
} else if (STREQ(service, "org.freedesktop.DBus") &&
STREQ(member, "ListNames")) {
const char *svc1 = "org.foo.bar.wizz";
const char *svc2 = "org.freedesktop.systemd1";
DBusMessageIter iter, sub;
reply = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN);
dbus_message_iter_init_append(reply, &iter);
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
"s", &sub);
if (!dbus_message_iter_append_basic(&sub,
DBUS_TYPE_STRING,
&svc1))
goto error;
if ((!getenv("FAIL_NO_SERVICE") && !getenv("FAIL_NOT_REGISTERED")) &&
!dbus_message_iter_append_basic(&sub,
DBUS_TYPE_STRING,
&svc2))
goto error;
dbus_message_iter_close_container(&iter, &sub);
} else {
reply = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN);
}
return reply;
error:
dbus_message_unref(reply);
return NULL;
}
#else
/* Nothing to override on non-__linux__ platforms */
#endif
| TelekomCloud/libvirt | tests/virsystemdmock.c | C | gpl-2.0 | 5,591 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2286,
2417,
6045,
1010,
4297,
1012,
1008,
1008,
2023,
3075,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
1008,
19933,
2009,
2104,
1996,
3408,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.zenframework.z8.server.db.sql.expressions;
import org.zenframework.z8.server.base.table.value.Field;
import org.zenframework.z8.server.db.sql.SqlField;
import org.zenframework.z8.server.db.sql.SqlToken;
import org.zenframework.z8.server.types.sql.sql_bool;
public class IsNot extends Rel {
public IsNot(Field field) {
this(new SqlField(field));
}
public IsNot(SqlToken token) {
super(token, Operation.NotEq, new sql_bool(true));
}
}
| zenframework/z8 | org.zenframework.z8.server/src/main/java/org/zenframework/z8/server/db/sql/expressions/IsNot.java | Java | lgpl-3.0 | 472 | [
30522,
7427,
8917,
1012,
16729,
15643,
6198,
1012,
1062,
2620,
1012,
30524,
1012,
1062,
2620,
1012,
8241,
1012,
2918,
1012,
2795,
1012,
3643,
1012,
2492,
1025,
12324,
8917,
1012,
16729,
15643,
6198,
1012,
1062,
2620,
1012,
8241,
1012,
16962... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using Microsoft.CodeAnalysis.Operations;
using Microsoft.CodeAnalysis.Shared.Utilities;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.PopulateSwitch
{
internal static class PopulateSwitchHelpers
{
public const string MissingCases = nameof(MissingCases);
public const string MissingDefaultCase = nameof(MissingDefaultCase);
public static bool HasDefaultCase(ISwitchOperation switchStatement)
{
for (var index = switchStatement.Cases.Length - 1; index >= 0; index--)
{
if (HasDefaultCase(switchStatement.Cases[index]))
{
return true;
}
}
return false;
}
private static bool HasDefaultCase(ISwitchCaseOperation switchCase)
{
foreach (var clause in switchCase.Clauses)
{
if (clause.CaseKind == CaseKind.Default)
{
return true;
}
}
return false;
}
public static ICollection<ISymbol> GetMissingEnumMembers(ISwitchOperation switchStatement)
{
var switchExpression = switchStatement.Value;
var switchExpressionType = switchExpression?.Type;
var enumMembers = new Dictionary<long, ISymbol>();
if (switchExpressionType?.TypeKind == TypeKind.Enum)
{
if (!TryGetAllEnumMembers(switchExpressionType, enumMembers) ||
!TryRemoveExistingEnumMembers(switchStatement, enumMembers))
{
return SpecializedCollections.EmptyCollection<ISymbol>();
}
}
return enumMembers.Values;
}
private static bool TryRemoveExistingEnumMembers(ISwitchOperation switchStatement, Dictionary<long, ISymbol> enumValues)
{
foreach (var switchCase in switchStatement.Cases)
{
foreach (var clause in switchCase.Clauses)
{
switch (clause.CaseKind)
{
default:
case CaseKind.None:
case CaseKind.Relational:
case CaseKind.Range:
// This was some sort of complex switch. For now just ignore
// these and assume that they're complete.
return false;
case CaseKind.Default:
// ignore the 'default/else' clause.
continue;
case CaseKind.SingleValue:
var value = ((ISingleValueCaseClauseOperation)clause).Value;
if (value == null || !value.ConstantValue.HasValue)
{
// We had a case which didn't resolve properly.
// Assume the switch is complete.
return false;
}
var caseValue = IntegerUtilities.ToInt64(value.ConstantValue.Value);
enumValues.Remove(caseValue);
break;
}
}
}
return true;
}
private static bool TryGetAllEnumMembers(
ITypeSymbol enumType,
Dictionary<long, ISymbol> enumValues)
{
foreach (var member in enumType.GetMembers())
{
// skip `.ctor` and `__value`
var fieldSymbol = member as IFieldSymbol;
if (fieldSymbol == null || fieldSymbol.Type.SpecialType != SpecialType.None)
{
continue;
}
if (fieldSymbol.ConstantValue == null)
{
// We have an enum that has problems with it (i.e. non-const members). We won't
// be able to determine properly if the switch is complete. Assume it is so we
// don't offer to do anything.
return false;
}
// Multiple enum members may have the same value. Only consider the first one
// we run int.
var enumValue = IntegerUtilities.ToInt64(fieldSymbol.ConstantValue);
if (!enumValues.ContainsKey(enumValue))
{
enumValues.Add(enumValue, fieldSymbol);
}
}
return true;
}
}
}
| mmitche/roslyn | src/Features/Core/Portable/PopulateSwitch/PopulateSwitchHelpers.cs | C# | apache-2.0 | 4,898 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
7513,
1012,
2035,
2916,
9235,
1012,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1012,
2156,
6105,
1012,
19067,
2102,
1999,
1996,
2622,
7117,
2005,
6105,
2592,
1012,
2478,
2291,
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... |
# Ichtyoselmis macrantha (Oliv.) Lidén SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
Pl. Syst. Evol. 206:415. 1997
#### Original name
Dicentra macrantha Oliv.
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Ranunculales/Papaveraceae/Ichtyoselmis/Ichtyoselmis macrantha/README.md | Markdown | apache-2.0 | 232 | [
30522,
1001,
22564,
3723,
9232,
13728,
2483,
6097,
17884,
3270,
1006,
19330,
12848,
1012,
1007,
11876,
2368,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
2248,
3269,
3415,
5950,
1001,
1001,
1001,
1001,
2405,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>V8 API Reference Guide for node.js v0.11.2: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v0.11.2
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1_reg_exp.html">RegExp</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">v8::RegExp Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a>, including all inherited members.</p>
<table class="directory">
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>BooleanValue</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#afeb999e9225dad0ca8605ed3015b268b">CallAsConstructor</a>(int argc, Handle< Value > argv[])</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a96ab0606a2c771ec6e2e5696749e7885">CallAsFunction</a>(Handle< Object > recv, int argc, Handle< Value > argv[])</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a5018c9d085aa71f65530cf1e073a04ad">Clone</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#af6966283a7d7e20779961eed434db04d">CreationContext</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>Delete</b>(Handle< Value > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Delete</b>(uint32_t index) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>DeleteHiddenValue</b>(Handle< String > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#adc2a7a92a120675bbd4c992163a20869">Equals</a>(Handle< Value > that) const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#ab2c5f7369abf08ae8f44dc84f5aa335a">FindInstanceInPrototypeChain</a>(Handle< FunctionTemplate > tmpl)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_reg_exp.html#aa4718a5c1f18472aff3bf51ed694fc5a">Flags</a> enum name</td><td class="entry"><a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>ForceDelete</b>(Handle< Value > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ForceSet</b>(Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>Get</b>(Handle< Value > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Get</b>(uint32_t index) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a6265087e94f67370247cbc7beeedac62">GetConstructor</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a7bbe987794658f20a3ec1b68326305e6">GetConstructorName</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_reg_exp.html#ad5a5e77e6e626b3c7c69eef7ba2908cc">GetFlags</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>GetHiddenValue</b>(Handle< String > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#ac1ece41e81a499920ec3a2a3471653bc">GetIdentityHash</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>GetIndexedPropertiesExternalArrayData</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>GetIndexedPropertiesExternalArrayDataLength</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>GetIndexedPropertiesExternalArrayDataType</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>GetIndexedPropertiesPixelData</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>GetIndexedPropertiesPixelDataLength</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#aeb48075bdfb7b2b49fe08361a6c4d2a8">GetOwnPropertyNames</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a45506d0a9192b023284b0211e9bf545b">GetPropertyAttributes</a>(Handle< Value > key)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a9f45786246c6e6027b32f685d900a41f">GetPropertyNames</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#ae8d3fed7d6dbd667c29cabb3039fe7af">GetPrototype</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a0eeeb35c6dc002a8359ebc445a49e964">GetRealNamedProperty</a>(Handle< String > key)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a36273f157697ff5e8e776a1461755182">GetRealNamedPropertyInPrototypeChain</a>(Handle< String > key)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_reg_exp.html#a448213f2a92d964ed260b51429d5e590">GetSource</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Has</b>(Handle< Value > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>Has</b>(uint32_t index) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a278913bcd203434870ce5184a538a9af">HasIndexedLookupInterceptor</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>HasIndexedPropertiesInExternalArrayData</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>HasIndexedPropertiesInPixelData</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a1e96fcb9ee17101c0299ec68f2cf8610">HasNamedLookupInterceptor</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>HasOwnProperty</b>(Handle< String > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>HasRealIndexedProperty</b>(uint32_t index) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>HasRealNamedCallbackProperty</b>(Handle< String > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>HasRealNamedProperty</b>(Handle< String > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Int32Value</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>IntegerValue</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#aaec28576353eebe6fee113bce2718ecc">InternalFieldCount</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#aaee0b144087d20eae02314c9393ff80f">IsArray</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a65f9dad740f2468b44dc16349611c351">IsArrayBuffer</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a0aceb7645e71b096df5cd73d1252b1b0">IsBoolean</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#abe7bc06283e5e66013f2f056a943168b">IsBooleanObject</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a23c2c1f23b50fab4a02e2f819641b865">IsCallable</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a8bc11fab0aded4a805722ab6df173cae">IsDate</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a3c1f8cfb754b5d29d5f1998b2047befd">IsDirty</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a7ac61a325c18af8dcb6d7d5bf47d2503">IsExternal</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a68c0296071d01ca899825d7643cf495a">IsFalse</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a4effc7ca1a221dd8c1e23c0f28145ef0">IsFloat32Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a293f140b81b0219d1497e937ed948b1e">IsFloat64Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a05532a34cdd215f273163830ed8b77e7">IsFunction</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a928c586639dd75ae4efdaa66b1fc4d50">IsInt16Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a01e1db51c65b2feace248b7acbf71a2c">IsInt32</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a48eac78a49c8b42d9f8cf05c514b3750">IsInt32Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a10a88a2794271dfcd9c3abd565e8f28a">IsInt8Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a579fb52e893cdc24f8b77e5acc77d06d">IsNativeError</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a1bd51e3e55f67c65b9a8f587fbffb7c7">IsNumber</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a5f4aa9504a6d8fc3af9489330179fe14">IsNumberObject</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a355b7991c5c978c0341f6f961b63c5a2">IsObject</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#aae41e43486937d6122c297a0d43ac0b8">IsRegExp</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a3e0f2727455fd01a39a60b92f77e28e0">IsStringObject</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#af3e6081c22d09a7bbc0a2aff59ed60a5">IsSymbol</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a867baa94cb8f1069452359e6cef6751e">IsSymbolObject</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a8f27462322186b295195eecb3e81d6d7">IsTrue</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#ac2f2f6c39f14a39fbb5b43577125dfe4">IsTypedArray</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a4a45fabf58b241f5de3086a3dd0a09ae">IsUint16Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a783c89631bac4ef3c4b909f40cc2b8d8">IsUint32</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a5e39229dc74d534835cf4ceba10676f4">IsUint32Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#acbe2cd9c9cce96ee498677ba37c8466d">IsUint8Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#ad3cb464ab5ef0215bd2cbdd4eb2b7e3d">IsUint8ClampedArray</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>kGlobal</b> enum value (defined in <a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a>)</td><td class="entry"><a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>kIgnoreCase</b> enum value (defined in <a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a>)</td><td class="entry"><a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>kMultiline</b> enum value (defined in <a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a>)</td><td class="entry"><a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>kNone</b> enum value (defined in <a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a>)</td><td class="entry"><a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_reg_exp.html#ac92fcff5a40cf8c698aefd021c823c2e">New</a>(Handle< String > pattern, Flags flags)</td><td class="entry"><a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>New</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>NumberValue</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#aeb2f524c806075e5f9032a24afd86869">ObjectProtoToString</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Set</b>(Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>Set</b>(uint32_t index, Handle< Value > value) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>SetAccessor</b>(Handle< String > name, AccessorGetter getter, AccessorSetter setter=0, Handle< Value > data=Handle< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>SetAccessor</b>(Handle< String > name, Handle< DeclaredAccessorDescriptor > descriptor, AccessControl settings=DEFAULT, PropertyAttribute attribute=None) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a0ccba69581f0b5e4e672bab90f26879b">SetAlignedPointerInInternalField</a>(int index, void *value)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a2200482b09feb914dc91d8256671f7f0">SetHiddenValue</a>(Handle< String > key, Handle< Value > value)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a530f661dec20ce1a0a1b15a45195418c">SetIndexedPropertiesToExternalArrayData</a>(void *data, ExternalArrayType array_type, int number_of_elements)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a6c552c4817b9a0eff1fb12b7ef089026">SetIndexedPropertiesToPixelData</a>(uint8_t *data, int length)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a361b1781e7db29b17b063ef31315989e">SetInternalField</a>(int index, Handle< Value > value)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#ab54bbd70d60e62d8bc22a8c8a6be593e">SetPrototype</a>(Handle< Value > prototype)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>StrictEquals</b>(Handle< Value > that) const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#ae810be0ae81a87f677592d0176daac48">ToArrayIndex</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ToBoolean</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>ToDetailString</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ToInt32</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>ToInteger</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ToNumber</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>ToObject</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ToString</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>ToUint32</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a6e9fe342c0f77995defa6b479d01a3bd">TurnOnAccessCheck</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>Uint32Value</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>V8_INLINE</b>(static RegExp *Cast(v8::Value *obj)) (defined in <a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a>)</td><td class="entry"><a class="el" href="classv8_1_1_reg_exp.html">v8::RegExp</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a478c557d3d547921436d1f8312deb831">v8::Object::V8_INLINE</a>(Local< Value > GetInternalField(int index))</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#abb14a7d7817c7b988957b3ad495adcca">v8::Object::V8_INLINE</a>(void *GetAlignedPointerFromInternalField(int index))</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>V8_INLINE</b>(static Object *Cast(Value *obj)) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#ab7fe6f0f40ad56063af2b549d9c16938">v8::Value::V8_INLINE</a>(bool IsUndefined() const)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a19bb214761816faf8b2784e4d78c9f21">v8::Value::V8_INLINE</a>(bool IsNull() const)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a14bd69255a9fd04fa641713188814958">v8::Value::V8_INLINE</a>(bool IsString() const)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Aug 11 2015 23:45:56 for V8 API Reference Guide for node.js v0.11.2 by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
| v8-dox/v8-dox.github.io | 0c405cf/html/classv8_1_1_reg_exp-members.html | HTML | mit | 34,824 | [
30522,
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,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
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... |
/*=============================================================================
Copyright (c) 2012 Paul Fultz II
delgate.h
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef BOOST_HOF_GUARD_FUNCTION_DELGATE_H
#define BOOST_HOF_GUARD_FUNCTION_DELGATE_H
#include <type_traits>
#include <utility>
#include <boost/hof/config.hpp>
#include <boost/hof/detail/and.hpp>
#include <boost/hof/detail/holder.hpp>
#include <boost/hof/detail/forward.hpp>
#include <boost/hof/detail/using.hpp>
#include <boost/hof/detail/intrinsics.hpp>
#include <boost/hof/detail/noexcept.hpp>
#define BOOST_HOF_ENABLE_IF_CONVERTIBLE(...) \
class=typename std::enable_if<BOOST_HOF_IS_CONVERTIBLE(__VA_ARGS__)>::type
#define BOOST_HOF_ENABLE_IF_CONVERTIBLE_UNPACK(...) \
class=typename std::enable_if<BOOST_HOF_AND_UNPACK(BOOST_HOF_IS_CONVERTIBLE(__VA_ARGS__))>::type
#define BOOST_HOF_ENABLE_IF_BASE_OF(...) \
class=typename std::enable_if<BOOST_HOF_IS_BASE_OF(__VA_ARGS__)>::type
#define BOOST_HOF_ENABLE_IF_CONSTRUCTIBLE(...) \
class=typename std::enable_if<BOOST_HOF_IS_CONSTRUCTIBLE(__VA_ARGS__)>::type
#define BOOST_HOF_NOEXCEPT_CONSTRUCTIBLE(...) \
BOOST_HOF_NOEXCEPT(BOOST_HOF_IS_NOTHROW_CONSTRUCTIBLE(__VA_ARGS__))
#define BOOST_HOF_INHERIT_DEFAULT(C, ...) \
template<bool FitPrivateEnableBool_##__LINE__=true, \
class=typename std::enable_if<FitPrivateEnableBool_##__LINE__ && boost::hof::detail::is_default_constructible_c<__VA_ARGS__>()>::type> \
constexpr C() BOOST_HOF_NOEXCEPT(boost::hof::detail::is_nothrow_default_constructible_c<__VA_ARGS__>()) {}
#define BOOST_HOF_INHERIT_DEFAULT_EMPTY(C, ...) \
template<bool FitPrivateEnableBool_##__LINE__=true, \
class=typename std::enable_if<FitPrivateEnableBool_##__LINE__ && \
boost::hof::detail::is_default_constructible_c<__VA_ARGS__>() && BOOST_HOF_IS_EMPTY(__VA_ARGS__) \
>::type> \
constexpr C() BOOST_HOF_NOEXCEPT(boost::hof::detail::is_nothrow_default_constructible_c<__VA_ARGS__>()) {}
#if BOOST_HOF_NO_TYPE_PACK_EXPANSION_IN_TEMPLATE
#define BOOST_HOF_DELGATE_PRIMITIVE_CONSTRUCTOR(constexpr_, C, T, var) \
template<class... FitXs, typename boost::hof::detail::enable_if_constructible<C, T, FitXs...>::type = 0> \
constexpr_ C(FitXs&&... fit_xs) \
BOOST_HOF_NOEXCEPT_CONSTRUCTIBLE(T, FitXs&&...) \
: var((FitXs&&)boost::hof::forward<FitXs>(fit_xs)...) {}
#else
#define BOOST_HOF_DELGATE_PRIMITIVE_CONSTRUCTOR(constexpr_, C, T, var) \
template<class... FitXs, BOOST_HOF_ENABLE_IF_CONSTRUCTIBLE(T, FitXs&&...)> \
constexpr_ C(FitXs&&... fit_xs) \
BOOST_HOF_NOEXCEPT_CONSTRUCTIBLE(T, FitXs&&...) \
: var(BOOST_HOF_FORWARD(FitXs)(fit_xs)...) {}
#endif
#define BOOST_HOF_DELEGATE_CONSTRUCTOR(C, T, var) BOOST_HOF_DELGATE_PRIMITIVE_CONSTRUCTOR(constexpr, C, T, var)
// Currently its faster to use `BOOST_HOF_DELEGATE_CONSTRUCTOR` than `using
// Base::Base;`
#if 1
#define BOOST_HOF_INHERIT_CONSTRUCTOR(Derived, Base) BOOST_HOF_DELEGATE_CONSTRUCTOR(Derived, Base, Base)
#else
#define BOOST_HOF_INHERIT_CONSTRUCTOR(Derived, Base) \
using fit_inherit_base = Base; \
using fit_inherit_base::fit_inherit_base; \
Derived()=default; \
template<class FitX, BOOST_HOF_ENABLE_IF_CONVERTIBLE(FitX, Base)> \
constexpr Derived(FitX&& fit_x) : Base(BOOST_HOF_FORWARD(FitX)(fit_x)) {}
#endif
namespace boost { namespace hof {
namespace detail {
template<class... Xs>
constexpr bool is_nothrow_default_constructible_c()
{
return BOOST_HOF_AND_UNPACK(BOOST_HOF_IS_NOTHROW_CONSTRUCTIBLE(Xs));
}
template<class... Xs>
constexpr bool is_default_constructible_c()
{
return BOOST_HOF_AND_UNPACK(BOOST_HOF_IS_DEFAULT_CONSTRUCTIBLE(Xs));
}
template<class... Xs>
BOOST_HOF_USING(is_default_constructible, std::integral_constant<bool, is_default_constructible_c<Xs...>()>);
template<class C, class X, class... Xs>
struct enable_if_constructible
: std::enable_if<is_constructible<X, Xs&&...>::value, int>
{};
}
}} // namespace boost::hof
#endif
| zcobell/MetOceanViewer | thirdparty/boost_1_67_0/boost/hof/detail/delegate.hpp | C++ | gpl-3.0 | 4,193 | [
30522,
1013,
1008,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
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... |
module.exports.default = undefined;
| webpack/webpack-cli | test/build/config/undefined-default/webpack.config.js | JavaScript | mit | 36 | [
30522,
11336,
1012,
14338,
1012,
12398,
1027,
6151,
28344,
1025,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/**
* Unit tests for FoxHound
*
* @license MIT
*
* @author Steven Velozo <steven@velozo.com>
*/
var Chai = require('chai');
var Expect = Chai.expect;
var Assert = Chai.assert;
var libFable = require('fable').new({});
var libFoxHound = require('../source/FoxHound.js');
suite
(
'FoxHound',
function()
{
setup
(
function()
{
}
);
suite
(
'Object Sanity',
function()
{
test
(
'initialize should build a happy little object',
function()
{
var testFoxHound = libFoxHound.new(libFable);
Expect(testFoxHound)
.to.be.an('object', 'FoxHound should initialize as an object directly from the require statement.');
Expect(testFoxHound).to.have.a.property('uuid')
.that.is.a('string');
Expect(testFoxHound).to.have.a.property('logLevel');
}
);
test
(
'basic class parameters',
function()
{
var testFoxHound = libFoxHound.new(libFable);
Expect(testFoxHound).to.have.a.property('parameters')
.that.is.a('object');
Expect(testFoxHound.parameters).to.have.a.property('scope')
.that.is.a('boolean'); // Scope is boolean false by default.
Expect(testFoxHound.parameters).to.have.a.property('dataElements')
.that.is.a('boolean'); // Scope is boolean false by default.
Expect(testFoxHound.parameters).to.have.a.property('filter')
.that.is.a('boolean'); // Scope is boolean false by default.
Expect(testFoxHound.parameters).to.have.a.property('begin')
.that.is.a('boolean'); // Scope is boolean false by default.
Expect(testFoxHound.parameters).to.have.a.property('cap')
.that.is.a('boolean'); // Scope is boolean false by default.
Expect(testFoxHound.parameters).to.have.a.property('sort')
.that.is.a('boolean'); // Scope is boolean false by default.
}
);
}
);
suite
(
'Basic Query Generation',
function()
{
test
(
'generate a simple query of all data in a set',
function()
{
// The default dialect is English. This one-liner is all-in.
Expect(libFoxHound.new(libFable).setLogLevel().setScope('Widget').buildReadQuery().query.body)
.to.equal('Please give me all your Widget records. Thanks.');
}
);
test
(
'change the dialect',
function()
{
var tmpQuery = libFoxHound.new(libFable).setLogLevel(5);
// Give a scope for the data to come from
tmpQuery.setScope('Widget');
// Expect there to not be a dialect yet
Expect(tmpQuery).to.have.a.property('dialect')
.that.is.a('boolean');
// Build the query
tmpQuery.buildReadQuery();
// Expect implicit dialect of English to be instantiated
Expect(tmpQuery.dialect.name)
.to.equal('English');
// Now submit a bad dialect
tmpQuery.setDialect();
// Expect implicit dialect of English to be instantiated
Expect(tmpQuery.dialect.name)
.to.equal('English');
// This is the query generated by the English dialect
Expect(tmpQuery.query.body)
.to.equal('Please give me all your Widget records. Thanks.');
// Now change to MySQL
tmpQuery.setDialect('MySQL');
Expect(tmpQuery.dialect.name)
.to.equal('MySQL');
// Build the query
tmpQuery.buildReadQuery();
// This is the query generated by the English dialect
Expect(tmpQuery.query.body)
.to.equal('SELECT `Widget`.* FROM `Widget`;');
}
);
}
);
suite
(
'State Management',
function()
{
test
(
'change the scope by function',
function()
{
var tmpQuery = libFoxHound.new(libFable);
Expect(tmpQuery.parameters.scope)
.to.equal(false);
tmpQuery.setScope('Widget');
Expect(tmpQuery.parameters.scope)
.to.equal('Widget');
}
);
test
(
'merge parameters',
function()
{
var tmpQuery = libFoxHound.new(libFable);
Expect(tmpQuery.parameters.scope)
.to.equal(false);
tmpQuery.mergeParameters({scope:'Fridget'});
Expect(tmpQuery.parameters.scope)
.to.equal('Fridget');
}
);
test
(
'clone the object',
function()
{
// Create a query
var tmpQuery = libFoxHound.new(libFable);
Expect(tmpQuery.parameters.scope).to.equal(false);
// Clone it
var tmpQueryCloneOne = tmpQuery.clone();
Expect(tmpQueryCloneOne.parameters.scope).to.equal(false);
// Set the first queries scope
tmpQuery.setScope('Widget');
Expect(tmpQuery.parameters.scope).to.equal('Widget');
Expect(tmpQueryCloneOne.parameters.scope).to.equal(false);
// Now clone again
var tmpQueryCloneTwo = tmpQuery.clone();
Expect(tmpQueryCloneTwo.parameters.scope).to.equal('Widget');
// Set some state on the second clone, make sure it doesn't pollute other objects
tmpQueryCloneTwo.setScope('Sprocket');
Expect(tmpQuery.parameters.scope).to.equal('Widget');
Expect(tmpQueryCloneOne.parameters.scope).to.equal(false);
Expect(tmpQueryCloneTwo.parameters.scope).to.equal('Sprocket');
}
);
test
(
'fail to change the scope by function',
function()
{
var tmpQuery = libFoxHound.new(libFable);
Expect(tmpQuery.parameters.scope)
.to.equal(false);
// Numbers are not valid scopes
tmpQuery.setScope(100);
Expect(tmpQuery.parameters.scope)
.to.equal(false);
}
);
test
(
'change the cap by function',
function()
{
var tmpQuery = libFoxHound.new(libFable);
Expect(tmpQuery.parameters.cap)
.to.equal(false);
tmpQuery.setCap(50);
Expect(tmpQuery.parameters.cap)
.to.equal(50);
}
);
test
(
'fail to change the cap by function',
function()
{
var tmpQuery = libFoxHound.new(libFable);
Expect(tmpQuery.parameters.cap)
.to.equal(false);
tmpQuery.setCap('Disaster');
Expect(tmpQuery.parameters.cap)
.to.equal(false);
}
);
test
(
'change the user ID',
function()
{
var tmpQuery = libFoxHound.new(libFable);
Expect(tmpQuery.parameters.userID)
.to.equal(0);
tmpQuery.setIDUser(1);
Expect(tmpQuery.parameters.userID)
.to.equal(1);
Expect(tmpQuery.parameters.query.IDUser)
.to.equal(1);
}
);
test
(
'fail to change the user ID',
function()
{
var tmpQuery = libFoxHound.new(libFable);
Expect(tmpQuery.parameters.userID)
.to.equal(0);
tmpQuery.setLogLevel(3);
tmpQuery.setIDUser('Disaster');
Expect(tmpQuery.parameters.userID)
.to.equal(0);
}
);
test
(
'change the begin by function',
function()
{
var tmpQuery = libFoxHound.new(libFable);
Expect(tmpQuery.parameters.begin)
.to.equal(false);
tmpQuery.setBegin(2);
Expect(tmpQuery.parameters.begin)
.to.equal(2);
}
);
test
(
'fail to change the begin by function',
function()
{
var tmpQuery = libFoxHound.new(libFable);
Expect(tmpQuery.parameters.begin)
.to.equal(false);
tmpQuery.setBegin('Looming');
Expect(tmpQuery.parameters.begin)
.to.equal(false);
}
);
test
(
'Manually set the parameters object',
function()
{
var tmpQuery = libFoxHound.new(libFable);
tmpQuery.parameters = {Frogs:'YES'};
Expect(tmpQuery.parameters.Frogs)
.to.equal('YES');
}
);
test
(
'Manually set the query object',
function()
{
var tmpQuery = libFoxHound.new(libFable);
tmpQuery.query = {body:'GET TO ALL DE CHOPPA RECORDS'};
Expect(tmpQuery.query.body)
.to.contain('CHOPPA');
}
);
test
(
'Manually set the result object',
function()
{
var tmpQuery = libFoxHound.new(libFable);
tmpQuery.result = {executed:true, value:[{Name:'Wendy'},{Name:'Griffin'}]};
Expect(tmpQuery.result.executed)
.to.equal(true);
}
);
test
(
'Set a bad dialect',
function()
{
var tmpQuery = libFoxHound.new(libFable).setDialect('Esperanto');
Expect(tmpQuery.dialect.name)
.to.equal('English');
}
);
test
(
'Try to pass bad filters',
function()
{
var tmpQuery = libFoxHound.new(libFable);
tmpQuery.addFilter();
tmpQuery.addFilter('Name');
Expect(tmpQuery.parameters.filter)
.to.equal(false);
}
);
test
(
'Pass many filters',
function()
{
var tmpQuery = libFoxHound.new(libFable);
tmpQuery.addFilter('Name', 'Smith');
tmpQuery.addFilter('City', 'Seattle');
Expect(tmpQuery.parameters.filter.length)
.to.equal(2);
tmpQuery.addFilter('Age', 25, '>', 'AND', 'AgeParameter');
Expect(tmpQuery.parameters.filter.length)
.to.equal(3); }
);
test
(
'Pass bad records',
function()
{
var tmpQuery = libFoxHound.new(libFable);
tmpQuery.addRecord();
Expect(tmpQuery.query.records)
.to.equal(false); }
);
test
(
'Pass multiple records',
function()
{
var tmpQuery = libFoxHound.new(libFable);
tmpQuery.addRecord({ID:10});
tmpQuery.addRecord({ID:100});
tmpQuery.addRecord({ID:1000});
Expect(tmpQuery.query.records.length)
.to.equal(3);
}
);
}
);
}
);
| stevenvelozo/foxhound | test/FoxHound_tests.js | JavaScript | mit | 9,683 | [
30522,
1013,
1008,
1008,
1008,
3131,
5852,
2005,
4419,
6806,
8630,
1008,
1008,
1030,
6105,
10210,
1008,
1008,
1030,
3166,
7112,
2310,
4135,
6844,
1026,
7112,
1030,
2310,
4135,
6844,
1012,
4012,
1028,
1008,
1013,
13075,
15775,
2072,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/**
* Bean Validation TCK
*
* License: Apache License, Version 2.0
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
*/
package org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.Payload;
/**
* @author Hardy Ferentschik
*/
@Documented
@Constraint(validatedBy = InvalidDefaultPayload.InvalidDefaultGroupValidator.class)
@Target({ TYPE })
@Retention(RUNTIME)
public @interface InvalidDefaultPayload {
public abstract String message() default "default message";
public abstract Class<?>[] groups() default { };
public abstract Class<? extends Payload>[] payload() default DummyPayload.class;
public class DummyPayload implements Payload {
}
public class InvalidDefaultGroupValidator implements ConstraintValidator<InvalidDefaultPayload, Object> {
@Override
public boolean isValid(Object object, ConstraintValidatorContext constraintValidatorContext) {
return false;
}
}
}
| gunnarmorling/beanvalidation-tck | tests/src/main/java/org/hibernate/beanvalidation/tck/tests/constraints/invalidconstraintdefinitions/InvalidDefaultPayload.java | Java | apache-2.0 | 1,365 | [
30522,
1013,
1008,
1008,
1008,
14068,
27354,
22975,
2243,
1008,
1008,
6105,
1024,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1008,
2156,
1996,
6105,
1012,
19067,
2102,
5371,
1999,
1996,
7117,
14176,
2030,
1026,
8299,
1024,
1013,
1013,
7479,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 Log4Jdbc.
*
* Log4Jdbc 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.
*
* Log4Jdbc 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 Log4Jdbc. If not, see <http://www.gnu.org/licenses/>.
*
*/
package fr.ms.log4jdbc.lang.reflect;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import fr.ms.log4jdbc.lang.delegate.DefaultStringMakerFactory;
import fr.ms.log4jdbc.lang.delegate.DefaultSyncLongFactory;
import fr.ms.log4jdbc.lang.delegate.StringMakerFactory;
import fr.ms.log4jdbc.lang.delegate.SyncLongFactory;
import fr.ms.log4jdbc.lang.stringmaker.impl.StringMaker;
import fr.ms.log4jdbc.lang.sync.impl.SyncLong;
import fr.ms.log4jdbc.util.logging.Logger;
import fr.ms.log4jdbc.util.logging.LoggerManager;
/**
*
* @see <a href="http://marcosemiao4j.wordpress.com">Marco4J</a>
*
*
* @author Marco Semiao
*
*/
public class TraceTimeInvocationHandler implements InvocationHandler {
public final static Logger LOG = LoggerManager.getLogger(TraceTimeInvocationHandler.class);
private final static StringMakerFactory stringFactory = DefaultStringMakerFactory.getInstance();
private final static SyncLongFactory syncLongFactory = DefaultSyncLongFactory.getInstance();
private final InvocationHandler invocationHandler;
private static long maxTime;
private static String maxMethodName;
private static SyncLong averageTime = syncLongFactory.newLong();
private static SyncLong quotient = syncLongFactory.newLong();
public TraceTimeInvocationHandler(final InvocationHandler invocationHandler) {
this.invocationHandler = invocationHandler;
}
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
final long start = System.currentTimeMillis();
final TimeInvocation invokeTime = (TimeInvocation) invocationHandler.invoke(proxy, method, args);
final long end = System.currentTimeMillis();
final long time = (end - start) - invokeTime.getExecTime();
final String methodName = getMethodCall(method.getDeclaringClass().getName() + "." + method.getName(), args);
if (time > maxTime) {
maxTime = time;
maxMethodName = methodName;
}
averageTime.addAndGet(time);
final StringMaker sb = stringFactory.newString();
sb.append("Time Process : ");
sb.append(time);
sb.append(" ms - Average Time : ");
sb.append(averageTime.get() / quotient.incrementAndGet());
sb.append(" ms - Method Name : ");
sb.append(methodName);
sb.append(" - Max Time Process : ");
sb.append(maxTime);
sb.append(" ms - Max Method Name : ");
sb.append(maxMethodName);
LOG.debug(sb.toString());
return invokeTime.getWrapInvocation().getInvoke();
}
public static String getMethodCall(final String methodName, final Object[] args) {
final StringMaker sb = stringFactory.newString();
sb.append(methodName);
sb.append("(");
if (args != null) {
for (int i = 0; i < args.length; i++) {
final Object arg = args[i];
if (arg != null) {
sb.append(arg.getClass());
if (i < args.length - 1) {
sb.append(",");
}
}
}
}
sb.append(");");
return sb.toString();
}
}
| marcosemiao/log4jdbc | core/log4jdbc-impl/src/main/java/fr/ms/log4jdbc/lang/reflect/TraceTimeInvocationHandler.java | Java | gpl-3.0 | 3,606 | [
30522,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
8833,
2549,
3501,
18939,
2278,
1012,
1008,
1008,
8833,
2549,
3501,
18939,
2278,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
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... |
##
# This file is part of WhatWeb and may be subject to
# redistribution and commercial restrictions. Please see the WhatWeb
# web site for more information on licensing and terms of use.
# http://www.morningstarsecurity.com/research/whatweb
##
Plugin.define "OurDisclaimer" do
author "Brendan Coles <bcoles@gmail.com>" # 2010-10-14
version "0.1"
description "OurDisclaimer.com - Third party disclaimer service. - homepage: http://ourdisclaimer.com/"
# 59 results for inurl:"ourdisclaimer.com/?i=" @ 2010-10-14
examples %w|
AshMax123.com
astarabeauty.co.za
CHEMICALPLANTSAFETY.NET
electronicmusic.com
elfulminador.com/disclaimer.html
kjkglobalindustries.com
letterofcredit.biz
metricationmatters.com
STROMBOLI.ORG
WIIWORLD.co.uk
www.CloudTweaks.com
|
matches [
# Get URL # Link & Image method
{ :version=>/<a[^>]+href[\s]*=[\s]*"http:\/\/ourdisclaimer.com\/\?i=([^\"]+)/i },
# Get URL # Iframe method
{ :version=>/<iframe[^>]+src[\s]*=[\s]*"http:\/\/ourdisclaimer.com\/\?i=([^\"]+)/i },
]
end
| tennc/WhatWeb | plugins/OurDisclaimer.rb | Ruby | gpl-2.0 | 1,000 | [
30522,
1001,
1001,
1001,
2023,
5371,
2003,
2112,
1997,
2054,
8545,
2497,
1998,
2089,
2022,
3395,
2000,
1001,
25707,
1998,
3293,
9259,
1012,
3531,
2156,
1996,
2054,
8545,
2497,
1001,
4773,
2609,
2005,
2062,
2592,
2006,
13202,
1998,
3408,
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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# PROJETO LAVAGEM A SECO
#
# MAIN
#
# Felipe Bandeira da Silva
# 26 jul 15
#
import logging
import tornado.escape
import tornado.ioloop
import tornado.web
import tornado.options
import tornado.websocket
import tornado.httpserver
import os.path
from tornado.concurrent import Future
from tornado import gen
from tornado.options import define, options, parse_command_line
import socket
import fcntl
import struct
import random
define("port", default=8888, help="run on the given port", type=int)
define("debug", default=False, help="run in debug mode")
import multiprocessing
import controle
import time
import os
import signal
import subprocess
import sys
from platform import uname
#NAVEGADOR = 'epiphany'
NAVEGADOR = 'midori -e Fullscreen -a'
# A pagina HTML contém informações interessantes e que devem ser
# apresentadas ao usuário. Quanto menor o tempo maior o processamento
# por parte do cliente ou dependendo do caso pelo servidor.
TEMPO_MS_ATUALIZACAO_HTML = 500
# Via websocket é possível mais um cliente conectado e todos devem
# receber as mensagens do servidor, bem como enviar.
# clientes do websocket
clients = []
# tarefa para atualizacao do pagina html
queue_joyx = multiprocessing.Queue()
queue_joyy = multiprocessing.Queue()
queue_joyz = multiprocessing.Queue()
# anemometro
queue_velocidade = multiprocessing.Queue()
queue_direcao = multiprocessing.Queue()
queue_distancia = multiprocessing.Queue()
# usado para o controle da página pelo joystick
queue_joy_botoes = multiprocessing.Queue()
#class NavegadorWEB(multiprocessing.Process):
# def __init__(self):
# multiprocessing.Process.__init__(self)
#
# self.navegador = subprocess.Popen(['epiphany-browser 192.168.42.1:8888'], stdout=subprocess.PIPE, \
# shell=True, preexec_fn=os.setsid)
#
# def run(self):
# while True:
# time.sleep(0.01)
def inicia_navegador():
navegador = subprocess.Popen([NAVEGADOR+' 192.168.42.1:8888'], \
stdout=subprocess.PIPE, \
shell=True, preexec_fn=os.setsid)
def fecha_navegador():
processos = subprocess.Popen(['pgrep', NAVEGADOR], stdout=subprocess.PIPE)
print 'PID dos processos', processos.stdout
for pid in processos.stdout:
os.kill(int(pid), signal.SIGTERM)
try:
time.sleep(3)
os.kill(int(pid), 0)
print u'erro: o processo %d ainda existe' % pid
except OSError as ex:
continue
def get_ip_address():
# Informa o endereço IP da primeira conexão funcionando
# visto em:
# http://code.activestate.com/recipes/439094-get-the-ip-address-associated-with-a-network-inter/
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
ifname = 'eth0'
return socket.inet_ntoa(fcntl.ioctl( \
s.fileno(), \
0x8915, # SIOCGIFADDR \
struct.pack('256s', ifname[:15]) \
)[20:24])
except:
try:
ifname = 'wlan0'
return socket.inet_ntoa(fcntl.ioctl( \
s.fileno(), \
0x8915, # SIOCGIFADDR \
struct.pack('256s', ifname[:15]) \
)[20:24])
except:
return "127.0.0.1"
def get_ip_address_interface(ifname):
# Informa o endereço de IP de uma rede <ifname>
# visto em:
# http://code.activestate.com/recipes/439094-get-the-ip-address-associated-with-a-network-inter/
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
return socket.inet_ntoa(fcntl.ioctl( \
s.fileno(), \
0x8915, # SIOCGIFADDR \
struct.pack('256s', ifname[:15]) \
)[20:24])
except:
return "0.0.0.0"
class MainHandler(tornado.web.RequestHandler):
# Atende ao GET e POST do cliente
def get(self):
# é possível via argumento renderizar a página html com
# informações interessantes, os comentários devem ter o mesmo
# nome da variável da página
self.render("index.html", title="LAVAGEM A SECO", \
ip_host=get_ip_address()+":"+str(options.port), \
msg_status="LIGADO")
class WebSocketHandler(tornado.websocket.WebSocketHandler):
# Todo cliente se encarrega de conectar-se ao servidor websocket.
# Quando existe uma nova conexão é salvo qual cliente foi.
def open(self):
print 'tornado: websocket: aviso: nova conexão de um cliente'
clients.append(self)
self.write_message("connected")
# Quando um cliente envia uma mensagem, esta é a função responsável
# por ler e aqui deve ficar a chamada dos get das filas(queue)
def on_message(self, message):
print 'tornado: websocket: aviso: nova mensagem: %s' % message
q = self.application.settings.get('queue')
q.put(message)
# Para evitar envios de informações a clientes que não existem mais
# é necessário retirá-los da lista
def on_close(self):
print 'tornado: websocket: aviso: conexão finalizada/perdida'
clients.remove(self)
fecha_navegador()
inicia_navegador()
def envia_cmd_websocket(cmd, arg):
# Facilita o trabalho repetitivo de envia mensagem para todo os clientes
# Envia um comando e seu argumento para todos os clientes
for c in clients:
c.write_message(cmd+";"+arg)
def tarefa_atualizacao_html():
# Esta função tem uma chamada periódica, responsável por atualizar os
# elementos atualizáveis na página html
envia_cmd_websocket("lan", get_ip_address())
envia_cmd_websocket("random", str(random.randint(0,1000)))
# para envia algo é necessário que fila tenha algo
if not queue_joyx.empty():
resultado = queue_joyx.get()
envia_cmd_websocket("joyx", str(resultado)[:6])
if not queue_joyy.empty():
resultado = queue_joyy.get()
envia_cmd_websocket("joyy", str(resultado)[:6])
if not queue_joyz.empty():
resultado = queue_joyz.get()
envia_cmd_websocket("joyz", str(resultado)[:6])
if not queue_joy_botoes.empty():
resultado = queue_joy_botoes.get()
envia_cmd_websocket("b", str(resultado))
if not queue_velocidade.empty():
resultado = queue_velocidade.get()
envia_cmd_websocket("v", str(resultado))
if not queue_direcao.empty():
resultado = queue_direcao.get()
envia_cmd_websocket("d", str(resultado))
if not queue_distancia.empty():
resultado = queue_distancia.get()
envia_cmd_websocket("x", str(resultado)[:6])
def main():
print u"Iniciando o servidor Tornado"
fecha_navegador()
tarefa_controle = multiprocessing.Queue()
# esse loop ler os dados do joystick e envia para o lavos
# sem ele, nenhuma resposta do Joystick é atendida.
controle_loop = controle.ControleLavagem(tarefa_controle, \
queue_joyx, \
queue_joyy, \
queue_joyz, \
queue_joy_botoes, \
queue_velocidade, \
queue_direcao, \
queue_distancia)
controle_loop.daemon = True
controle_loop.start()
# espera um pouco para que a tarefa esteja realmente pronta
# sincronismo é mais interessante?
time.sleep(1)
tarefa_controle.put("Testando Tarefa :)")
parse_command_line()
app = tornado.web.Application(
[
(r"/", MainHandler),
(r"/ws", WebSocketHandler)
],
cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
xsrf_cookies=True,
debug=options.debug,
autoreload=True,
queue=tarefa_controle,
)
# porta que o servidor irá usar
app.listen(options.port)
# carrega o servidor mas não inicia
main_loop = tornado.ioloop.IOLoop.instance()
# Aqui será a principal tarefa do lavagem, leitura e acionamento
tarefa_atualizacao_html_loop = tornado.ioloop.PeriodicCallback(tarefa_atualizacao_html,\
TEMPO_MS_ATUALIZACAO_HTML, \
io_loop = main_loop)
print u"aviso: tornado: start"
tarefa_atualizacao_html_loop.start()
inicia_navegador()
# o loop do servidor deve ser o último, já que não um daemon
main_loop.start()
if __name__ == "__main__":
main()
| lamotriz/lavagem-a-seco | src/main.py | Python | gpl-2.0 | 8,904 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
1001,
4013,
15759,
2080,
13697,
3351,
2213,
1037,
10819,
2080,
1001,
1001,
2364,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 ProductoUtil() {
var URL_BASE = "/productos";
this.agregar = function(p, callback) {
$.ajax(URL_BASE, {
type: "post",
data: JSON.stringify(p),
contentType: "application/json"
}).done(callback)
.fail(function() {
window.alert("Error al agregar");
});
};
this.modificar = function(p, callback) {
$.ajax(URL_BASE + "/" + p.id, {
type: "put",
data: JSON.stringify(p),
contentType: "application/json"
}).done(callback)
};
this.eliminar = function(id, callback) {
$.ajax(URL_BASE + "/" + id, {
type: "delete"
}).done(callback);
};
this.obtener = function(id, callback) {
$.ajax(URL_BASE + "/" + id, {
type: "get",
dataType: "json"
}).done(callback);
};
this.obtenerTodos = function(callback) {
$.ajax(URL_BASE, {
type: "get",
dataType: "json"
}).done(function(respuesta) {
callback(respuesta);
});
};
} | camposer/curso_angularjs | ejercicio3/public/javascripts/ProductoUtil.js | JavaScript | gpl-2.0 | 890 | [
30522,
3853,
4031,
5833,
4014,
1006,
1007,
1063,
13075,
24471,
2140,
1035,
2918,
1027,
1000,
1013,
4031,
2891,
1000,
1025,
2023,
1012,
12943,
2890,
6843,
1027,
3853,
1006,
1052,
1010,
2655,
5963,
1007,
1063,
1002,
1012,
18176,
1006,
24471,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
registerNpc(325, {
walk_speed = 0,
run_speed = 0,
scale = 170,
r_weapon = 0,
l_weapon = 0,
level = 79,
hp = 58,
attack = 322,
hit = 217,
def = 236,
res = 385,
avoid = 87,
attack_spd = 100,
is_magic_damage = 0,
ai_type = 96,
give_exp = 0,
drop_type = 0,
drop_money = 0,
drop_item = 99,
union_number = 99,
need_summon_count = 0,
sell_tab0 = 0,
sell_tab1 = 0,
sell_tab2 = 0,
sell_tab3 = 0,
can_target = 0,
attack_range = 10,
npc_type = 0,
hit_material_type = 2,
face_icon = 0,
summon_mob_type = 0,
quest_type = 0,
height = 0
});
function OnInit(entity)
return true
end
function OnCreate(entity)
return true
end
function OnDelete(entity)
return true
end
function OnDead(entity)
end
function OnDamaged(entity)
end | dev-osrose/osIROSE-new | scripts/mobs/ai/rune_stone.lua | Lua | apache-2.0 | 1,059 | [
30522,
4236,
16275,
2278,
1006,
19652,
1010,
1063,
3328,
1035,
3177,
1027,
1014,
1010,
2448,
1035,
3177,
1027,
1014,
1010,
4094,
1027,
10894,
1010,
1054,
1035,
5195,
1027,
1014,
1010,
1048,
1035,
5195,
1027,
1014,
1010,
2504,
1027,
6535,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 The Apollo Authors. 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.
* 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.
*****************************************************************************/
/*
* @file
*/
#include "modules/planning/open_space/trajectory_smoother/dual_variable_warm_start_slack_osqp_interface.h"
#include <algorithm>
#include "cyber/common/log.h"
#include "modules/common/configs/vehicle_config_helper.h"
#include "modules/common/math/math_utils.h"
#include "modules/common/util/util.h"
#include "modules/planning/common/planning_gflags.h"
namespace apollo {
namespace planning {
DualVariableWarmStartSlackOSQPInterface::
DualVariableWarmStartSlackOSQPInterface(
size_t horizon, double ts, const Eigen::MatrixXd& ego,
const Eigen::MatrixXi& obstacles_edges_num, const size_t obstacles_num,
const Eigen::MatrixXd& obstacles_A, const Eigen::MatrixXd& obstacles_b,
const Eigen::MatrixXd& xWS,
const PlannerOpenSpaceConfig& planner_open_space_config)
: ts_(ts),
ego_(ego),
obstacles_edges_num_(obstacles_edges_num),
obstacles_A_(obstacles_A),
obstacles_b_(obstacles_b),
xWS_(xWS) {
ACHECK(horizon < std::numeric_limits<int>::max())
<< "Invalid cast on horizon in open space planner";
horizon_ = static_cast<int>(horizon);
ACHECK(obstacles_num < std::numeric_limits<int>::max())
<< "Invalid cast on obstacles_num in open space planner";
obstacles_num_ = static_cast<int>(obstacles_num);
w_ev_ = ego_(1, 0) + ego_(3, 0);
l_ev_ = ego_(0, 0) + ego_(2, 0);
g_ = {l_ev_ / 2, w_ev_ / 2, l_ev_ / 2, w_ev_ / 2};
offset_ = (ego_(0, 0) + ego_(2, 0)) / 2 - ego_(2, 0);
obstacles_edges_sum_ = obstacles_edges_num_.sum();
l_start_index_ = 0;
n_start_index_ = l_start_index_ + obstacles_edges_sum_ * (horizon_ + 1);
s_start_index_ = n_start_index_ + 4 * obstacles_num_ * (horizon_ + 1);
l_warm_up_ = Eigen::MatrixXd::Zero(obstacles_edges_sum_, horizon_ + 1);
n_warm_up_ = Eigen::MatrixXd::Zero(4 * obstacles_num_, horizon_ + 1);
slacks_ = Eigen::MatrixXd::Zero(obstacles_num_, horizon_ + 1);
// get_nlp_info
lambda_horizon_ = obstacles_edges_sum_ * (horizon_ + 1);
miu_horizon_ = obstacles_num_ * 4 * (horizon_ + 1);
slack_horizon_ = obstacles_num_ * (horizon_ + 1);
// number of variables
num_of_variables_ = lambda_horizon_ + miu_horizon_ + slack_horizon_;
// number of constraints
num_of_constraints_ = 3 * obstacles_num_ * (horizon_ + 1) + num_of_variables_;
min_safety_distance_ =
planner_open_space_config.dual_variable_warm_start_config()
.min_safety_distance();
check_mode_ =
planner_open_space_config.dual_variable_warm_start_config().debug_osqp();
beta_ = planner_open_space_config.dual_variable_warm_start_config().beta();
osqp_config_ =
planner_open_space_config.dual_variable_warm_start_config().osqp_config();
}
void DualVariableWarmStartSlackOSQPInterface::printMatrix(
const int r, const int c, const std::vector<c_float>& P_data,
const std::vector<c_int>& P_indices, const std::vector<c_int>& P_indptr) {
Eigen::MatrixXf tmp = Eigen::MatrixXf::Zero(r, c);
for (size_t i = 0; i < P_indptr.size() - 1; ++i) {
if (P_indptr[i] < 0 || P_indptr[i] >= static_cast<int>(P_indices.size())) {
continue;
}
for (auto idx = P_indptr[i]; idx < P_indptr[i + 1]; ++idx) {
int tmp_c = static_cast<int>(i);
int tmp_r = static_cast<int>(P_indices[idx]);
tmp(tmp_r, tmp_c) = static_cast<float>(P_data[idx]);
}
}
AINFO << "row number: " << r;
AINFO << "col number: " << c;
for (int i = 0; i < r; ++i) {
AINFO << "row number: " << i;
AINFO << tmp.row(i);
}
}
void DualVariableWarmStartSlackOSQPInterface::assembleA(
const int r, const int c, const std::vector<c_float>& P_data,
const std::vector<c_int>& P_indices, const std::vector<c_int>& P_indptr) {
constraint_A_ = Eigen::MatrixXf::Zero(r, c);
for (size_t i = 0; i < P_indptr.size() - 1; ++i) {
if (P_indptr[i] < 0 || P_indptr[i] >= static_cast<int>(P_indices.size())) {
continue;
}
for (auto idx = P_indptr[i]; idx < P_indptr[i + 1]; ++idx) {
int tmp_c = static_cast<int>(i);
int tmp_r = static_cast<int>(P_indices[idx]);
constraint_A_(tmp_r, tmp_c) = static_cast<float>(P_data[idx]);
}
}
}
bool DualVariableWarmStartSlackOSQPInterface::optimize() {
// int kNumParam = num_of_variables_;
// int kNumConst = num_of_constraints_;
bool succ = true;
// assemble P, quadratic term in objective
std::vector<c_float> P_data;
std::vector<c_int> P_indices;
std::vector<c_int> P_indptr;
assembleP(&P_data, &P_indices, &P_indptr);
if (check_mode_) {
AINFO << "print P_data in whole: ";
printMatrix(num_of_variables_, num_of_variables_, P_data, P_indices,
P_indptr);
}
// assemble q, linear term in objective, \sum{beta * slacks}
c_float q[num_of_variables_]; // NOLINT
for (int i = 0; i < num_of_variables_; ++i) {
q[i] = 0.0;
if (i >= s_start_index_) {
q[i] = beta_;
}
}
// assemble A, linear term in constraints
std::vector<c_float> A_data;
std::vector<c_int> A_indices;
std::vector<c_int> A_indptr;
assembleConstraint(&A_data, &A_indices, &A_indptr);
if (check_mode_) {
AINFO << "print A_data in whole: ";
printMatrix(num_of_constraints_, num_of_variables_, A_data, A_indices,
A_indptr);
assembleA(num_of_constraints_, num_of_variables_, A_data, A_indices,
A_indptr);
}
// assemble lb & ub, slack_variable <= 0
c_float lb[num_of_constraints_]; // NOLINT
c_float ub[num_of_constraints_]; // NOLINT
int slack_indx = num_of_constraints_ - slack_horizon_;
for (int i = 0; i < num_of_constraints_; ++i) {
lb[i] = 0.0;
if (i >= slack_indx) {
lb[i] = -2e19;
}
if (i < 2 * obstacles_num_ * (horizon_ + 1)) {
ub[i] = 0.0;
} else if (i < slack_indx) {
ub[i] = 2e19;
} else {
ub[i] = 0.0;
}
}
// Problem settings
OSQPSettings* settings =
reinterpret_cast<OSQPSettings*>(c_malloc(sizeof(OSQPSettings)));
// Define Solver settings as default
osqp_set_default_settings(settings);
settings->alpha = osqp_config_.alpha(); // Change alpha parameter
settings->eps_abs = osqp_config_.eps_abs();
settings->eps_rel = osqp_config_.eps_rel();
settings->max_iter = osqp_config_.max_iter();
settings->polish = osqp_config_.polish();
settings->verbose = osqp_config_.osqp_debug_log();
// Populate data
OSQPData* data = reinterpret_cast<OSQPData*>(c_malloc(sizeof(OSQPData)));
data->n = num_of_variables_;
data->m = num_of_constraints_;
data->P = csc_matrix(data->n, data->n, P_data.size(), P_data.data(),
P_indices.data(), P_indptr.data());
data->q = q;
data->A = csc_matrix(data->m, data->n, A_data.size(), A_data.data(),
A_indices.data(), A_indptr.data());
data->l = lb;
data->u = ub;
// Workspace
OSQPWorkspace* work = nullptr;
// osqp_setup(&work, data, settings);
work = osqp_setup(data, settings);
// Solve Problem
osqp_solve(work);
// check state
if (work->info->status_val != 1 && work->info->status_val != 2) {
AWARN << "OSQP dual warm up unsuccess, "
<< "return status: " << work->info->status;
succ = false;
}
// transfer to make lambda's norm under 1
std::vector<double> lambda_norm;
int l_index = l_start_index_;
for (int i = 0; i < horizon_ + 1; ++i) {
int edges_counter = 0;
for (int j = 0; j < obstacles_num_; ++j) {
int current_edges_num = obstacles_edges_num_(j, 0);
Eigen::MatrixXd Aj =
obstacles_A_.block(edges_counter, 0, current_edges_num, 2);
double tmp1 = 0;
double tmp2 = 0;
for (int k = 0; k < current_edges_num; ++k) {
tmp1 += Aj(k, 0) * work->solution->x[l_index + k];
tmp2 += Aj(k, 1) * work->solution->x[l_index + k];
}
// norm(A * lambda)
double tmp_norm = tmp1 * tmp1 + tmp2 * tmp2;
if (tmp_norm >= 1e-5) {
lambda_norm.push_back(0.75 / std::sqrt(tmp_norm));
} else {
lambda_norm.push_back(0.0);
}
edges_counter += current_edges_num;
l_index += current_edges_num;
}
}
// extract primal results
int variable_index = 0;
// 1. lagrange constraint l, [0, obstacles_edges_sum_ - 1] * [0,
// horizon_l
for (int i = 0; i < horizon_ + 1; ++i) {
int r_index = 0;
for (int j = 0; j < obstacles_num_; ++j) {
for (int k = 0; k < obstacles_edges_num_(j, 0); ++k) {
l_warm_up_(r_index, i) = lambda_norm[i * obstacles_num_ + j] *
work->solution->x[variable_index];
++variable_index;
++r_index;
}
}
}
// 2. lagrange constraint n, [0, 4*obstacles_num-1] * [0, horizon_]
for (int i = 0; i < horizon_ + 1; ++i) {
int r_index = 0;
for (int j = 0; j < obstacles_num_; ++j) {
for (int k = 0; k < 4; ++k) {
n_warm_up_(r_index, i) = lambda_norm[i * obstacles_num_ + j] *
work->solution->x[variable_index];
++r_index;
++variable_index;
}
}
}
// 3. slack variables
for (int i = 0; i < horizon_ + 1; ++i) {
for (int j = 0; j < obstacles_num_; ++j) {
slacks_(j, i) = lambda_norm[i * obstacles_num_ + j] *
work->solution->x[variable_index];
++variable_index;
}
}
succ = succ & (work->info->obj_val <= 1.0);
// Cleanup
osqp_cleanup(work);
c_free(data->A);
c_free(data->P);
c_free(data);
c_free(settings);
return succ;
}
void DualVariableWarmStartSlackOSQPInterface::checkSolution(
const Eigen::MatrixXd& l_warm_up, const Eigen::MatrixXd& n_warm_up) {
// TODO(Runxin): extend
}
void DualVariableWarmStartSlackOSQPInterface::assembleP(
std::vector<c_float>* P_data, std::vector<c_int>* P_indices,
std::vector<c_int>* P_indptr) {
// the objective function is norm(A' * lambda)
std::vector<c_float> P_tmp;
int edges_counter = 0;
for (int j = 0; j < obstacles_num_; ++j) {
int current_edges_num = obstacles_edges_num_(j, 0);
Eigen::MatrixXd Aj;
Aj = obstacles_A_.block(edges_counter, 0, current_edges_num, 2);
// Eigen::MatrixXd AAj(current_edges_num, current_edges_num);
Aj = Aj * Aj.transpose();
CHECK_EQ(current_edges_num, Aj.cols());
CHECK_EQ(current_edges_num, Aj.rows());
for (int c = 0; c < current_edges_num; ++c) {
for (int r = 0; r < current_edges_num; ++r) {
P_tmp.emplace_back(Aj(r, c));
}
}
// Update index
edges_counter += current_edges_num;
}
int l_index = l_start_index_;
int first_row_location = 0;
// the objective function is norm(A' * lambda)
for (int i = 0; i < horizon_ + 1; ++i) {
edges_counter = 0;
for (auto item : P_tmp) {
P_data->emplace_back(item);
}
// current assumption: stationary obstacles
for (int j = 0; j < obstacles_num_; ++j) {
int current_edges_num = obstacles_edges_num_(j, 0);
for (int c = 0; c < current_edges_num; ++c) {
P_indptr->emplace_back(first_row_location);
for (int r = 0; r < current_edges_num; ++r) {
P_indices->emplace_back(r + l_index);
}
first_row_location += current_edges_num;
}
// Update index
edges_counter += current_edges_num;
l_index += current_edges_num;
}
}
CHECK_EQ(P_indptr->size(), static_cast<size_t>(lambda_horizon_));
for (int i = lambda_horizon_; i < num_of_variables_ + 1; ++i) {
P_indptr->emplace_back(first_row_location);
}
CHECK_EQ(P_data->size(), P_indices->size());
CHECK_EQ(P_indptr->size(), static_cast<size_t>(num_of_variables_) + 1);
}
void DualVariableWarmStartSlackOSQPInterface::assembleConstraint(
std::vector<c_float>* A_data, std::vector<c_int>* A_indices,
std::vector<c_int>* A_indptr) {
/*
* The constraint matrix is as the form,
* |R' * A', G', 0|, #: 2 * obstacles_num_ * (horizon_ + 1)
* |A * t - b, -g, I|, #: obstacles_num_ * (horizon_ + 1)
* |I, 0, 0|, #: num_of_lambda
* |0, I, 0|, #: num_of_miu
* |0, 0, I|, #: num_of_slack
*/
int r1_index = 0;
int r2_index = 2 * obstacles_num_ * (horizon_ + 1);
int r3_index = 3 * obstacles_num_ * (horizon_ + 1);
int r4_index = 3 * obstacles_num_ * (horizon_ + 1) + lambda_horizon_;
int r5_index = r4_index + miu_horizon_;
int first_row_location = 0;
// lambda variables
// lambda_horizon_ = obstacles_edges_sum_ * (horizon_ + 1);
for (int i = 0; i < horizon_ + 1; ++i) {
int edges_counter = 0;
Eigen::MatrixXd R(2, 2);
R << cos(xWS_(2, i)), sin(xWS_(2, i)), sin(xWS_(2, i)), cos(xWS_(2, i));
Eigen::MatrixXd t_trans(1, 2);
t_trans << (xWS_(0, i) + cos(xWS_(2, i)) * offset_),
(xWS_(1, i) + sin(xWS_(2, i)) * offset_);
// assume: stationary obstacles
for (int j = 0; j < obstacles_num_; ++j) {
int current_edges_num = obstacles_edges_num_(j, 0);
Eigen::MatrixXd Aj =
obstacles_A_.block(edges_counter, 0, current_edges_num, 2);
Eigen::MatrixXd bj =
obstacles_b_.block(edges_counter, 0, current_edges_num, 1);
Eigen::MatrixXd r1_block(2, current_edges_num);
r1_block = R * Aj.transpose();
Eigen::MatrixXd r2_block(1, current_edges_num);
r2_block = t_trans * Aj.transpose() - bj.transpose();
// insert into A matrix, col by col
for (int k = 0; k < current_edges_num; ++k) {
A_data->emplace_back(r1_block(0, k));
A_indices->emplace_back(r1_index);
A_data->emplace_back(r1_block(1, k));
A_indices->emplace_back(r1_index + 1);
A_data->emplace_back(r2_block(0, k));
A_indices->emplace_back(r2_index);
A_data->emplace_back(1.0);
A_indices->emplace_back(r3_index);
r3_index++;
A_indptr->emplace_back(first_row_location);
first_row_location += 4;
}
// Update index
edges_counter += current_edges_num;
r1_index += 2;
r2_index += 1;
}
}
// miu variables, miu_horizon_ = obstacles_num_ * 4 * (horizon_ + 1);
// G: ((1, 0, -1, 0), (0, 1, 0, -1))
// g: g_
r1_index = 0;
r2_index = 2 * obstacles_num_ * (horizon_ + 1);
for (int i = 0; i < horizon_ + 1; ++i) {
for (int j = 0; j < obstacles_num_; ++j) {
for (int k = 0; k < 4; ++k) {
// update G
if (k < 2) {
A_data->emplace_back(1.0);
} else {
A_data->emplace_back(-1.0);
}
A_indices->emplace_back(r1_index + k % 2);
// update g'
A_data->emplace_back(-g_[k]);
A_indices->emplace_back(r2_index);
// update I
A_data->emplace_back(1.0);
A_indices->emplace_back(r4_index);
r4_index++;
// update col index
A_indptr->emplace_back(first_row_location);
first_row_location += 3;
}
// update index
r1_index += 2;
r2_index += 1;
}
}
// slack variables
// slack_horizon_ = obstacles_edges_sum_ * (horizon_ + 1);
r2_index = 2 * obstacles_num_ * (horizon_ + 1);
for (int i = 0; i < horizon_ + 1; ++i) {
for (int j = 0; j < obstacles_num_; ++j) {
A_data->emplace_back(1.0);
A_indices->emplace_back(r2_index);
++r2_index;
A_data->emplace_back(1.0);
A_indices->emplace_back(r5_index);
++r5_index;
A_indptr->emplace_back(first_row_location);
first_row_location += 2;
}
}
A_indptr->emplace_back(first_row_location);
CHECK_EQ(A_data->size(), A_indices->size());
CHECK_EQ(A_indptr->size(), static_cast<size_t>(num_of_variables_) + 1);
}
void DualVariableWarmStartSlackOSQPInterface::get_optimization_results(
Eigen::MatrixXd* l_warm_up, Eigen::MatrixXd* n_warm_up,
Eigen::MatrixXd* s_warm_up) const {
*l_warm_up = l_warm_up_;
*n_warm_up = n_warm_up_;
*s_warm_up = slacks_;
// debug mode check slack values
double max_s = slacks_(0, 0);
double min_s = slacks_(0, 0);
for (int i = 0; i < horizon_ + 1; ++i) {
for (int j = 0; j < obstacles_num_; ++j) {
max_s = std::max(max_s, slacks_(j, i));
min_s = std::min(min_s, slacks_(j, i));
}
}
ADEBUG << "max_s: " << max_s;
ADEBUG << "min_s: " << min_s;
}
} // namespace planning
} // namespace apollo
| ApolloAuto/apollo | modules/planning/open_space/trajectory_smoother/dual_variable_warm_start_slack_osqp_interface.cc | C++ | apache-2.0 | 17,011 | [
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... |
package cn.edu.nju.dao.examDAO;
import cn.edu.nju.dao.DataException;
import cn.edu.nju.mapper.examMapper.StudentMapper;
import cn.edu.nju.model.examModel.StudentModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by Jiayiwu on 17/11/13.
* Mail:wujiayi@lgdreamer.com
* Change everywhere
*/
@Service(value = "studentDAO")
public class StudentDAOImpl implements IStudentDAO {
private final StudentMapper studentMapper;
@Autowired
public StudentDAOImpl(@Qualifier("studentMapper") StudentMapper studentMapper) {
this.studentMapper = studentMapper;
}
@Override
public List<StudentModel> getCourseStudents(
int courseId) throws DataException {
try {
return studentMapper.getCourseStudents(courseId);
} catch (Exception e) {
throw new DataException("该课程不存在");
}
}
@Override
public void deleteCourseStudents(
int courseId, List<String> emails) throws Exception {
studentMapper.deleteCourseStudents(courseId, emails);
}
@Override
public List<StudentModel> getExamStudents(
int examId, int courseId) throws DataException {
try {
return studentMapper.getExamStudents(examId, courseId);
} catch (Exception e) {
throw new DataException("该考试不存在");
}
}
@Override
public boolean isStudentFileMD5Exist(String md5Value) {
return studentMapper.getStudentMD5Count(md5Value) > 0;
}
@Override
public void updateStudents(List<StudentModel> students) throws Exception {
for (StudentModel student : students) {
studentMapper.updateStudent(student);
}
}
}
| bedisdover/ESS | application/src/main/java/cn/edu/nju/dao/examDAO/StudentDAOImpl.java | Java | mit | 1,893 | [
30522,
7427,
27166,
1012,
3968,
2226,
1012,
19193,
2226,
1012,
4830,
2080,
1012,
11360,
2850,
2080,
1025,
12324,
27166,
1012,
3968,
2226,
1012,
19193,
2226,
1012,
4830,
2080,
1012,
2951,
10288,
24422,
1025,
12324,
27166,
1012,
3968,
2226,
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... |
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class EntrustSetupTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Create table for storing roles
Schema::create('roles', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->unique();
$table->string('display_name')->nullable();
$table->string('description')->nullable();
$table->timestamps();
});
// Create table for associating roles to users (Many-to-Many)
Schema::create('role_user', function (Blueprint $table) {
$table->integer('user_id')->unsigned();
$table->integer('role_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')
->onUpdate('cascade')->onDelete('cascade');
$table->foreign('role_id')->references('id')->on('roles')
->onUpdate('cascade')->onDelete('cascade');
$table->primary(['user_id', 'role_id']);
});
// Create table for storing permissions
Schema::create('permissions', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->unique();
$table->string('display_name')->nullable();
$table->string('description')->nullable();
$table->timestamps();
});
// Create table for associating permissions to roles (Many-to-Many)
Schema::create('permission_role', function (Blueprint $table) {
$table->integer('permission_id')->unsigned();
$table->integer('role_id')->unsigned();
$table->foreign('permission_id')->references('id')->on('permissions')
->onUpdate('cascade')->onDelete('cascade');
$table->foreign('role_id')->references('id')->on('roles')
->onUpdate('cascade')->onDelete('cascade');
$table->primary(['permission_id', 'role_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('permission_role');
Schema::drop('permissions');
Schema::drop('role_user');
Schema::drop('roles');
}
}
| joselfonseca/laravel-admin | tests/migrations/2015_09_03_211017_entrust_setup_tables.php | PHP | mit | 2,384 | [
30522,
1026,
1029,
25718,
2224,
5665,
12717,
12556,
1032,
7809,
1032,
9230,
2015,
1032,
9230,
1025,
2224,
5665,
12717,
12556,
1032,
7809,
1032,
8040,
28433,
1032,
2630,
16550,
1025,
2465,
4372,
24669,
13462,
29441,
3085,
2015,
8908,
9230,
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 "_UILegibilityView.h"
@interface _UILegibilityLabel : _UILegibilityView
@end
| hbang/headers | UIKit/_UILegibilityLabel.h | C | unlicense | 87 | [
30522,
1001,
12324,
1000,
1035,
21318,
23115,
13464,
8584,
1012,
1044,
1000,
1030,
8278,
1035,
21318,
23115,
13464,
20470,
2884,
1024,
1035,
21318,
23115,
13464,
8584,
1030,
2203,
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,
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... |
<a href='https://github.com/angular/angular.js/edit/v1.4.x/src/ng/directive/ngEventDirs.js?message=docs(ngSubmit)%3A%20describe%20your%20change...#L317' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit"> </i>Improve this Doc</a>
<a href='https://github.com/angular/angular.js/tree/v1.4.12/src/ng/directive/ngEventDirs.js#L317' class='view-source pull-right btn btn-primary'>
<i class="glyphicon glyphicon-zoom-in"> </i>View Source
</a>
<header class="api-profile-header">
<h1 class="api-profile-header-heading">ngSubmit</h1>
<ol class="api-profile-header-structure naked-list step-list">
<li>
- directive in module <a href="api/ng">ng</a>
</li>
</ol>
</header>
<div class="api-profile-description">
<p>Enables binding angular expressions to onsubmit events.</p>
<p>Additionally it prevents the default action (which for form means sending the request to the
server and reloading the current page), but only if the form does not contain <code>action</code>,
<code>data-action</code>, or <code>x-action</code> attributes.</p>
<div class="alert alert-warning">
<strong>Warning:</strong> Be careful not to cause "double-submission" by using both the <code>ngClick</code> and
<code>ngSubmit</code> handlers together. See the
<a href="api/ng/directive/form#submitting-a-form-and-preventing-the-default-action"><code>form</code> directive documentation</a>
for a detailed discussion of when <code>ngSubmit</code> may be triggered.
</div>
</div>
<div>
<h2>Directive Info</h2>
<ul>
<li>This directive executes at priority level 0.</li>
</ul>
<h2 id="usage">Usage</h2>
<div class="usage">
<ul>
<li>as attribute:
<pre><code><form ng-submit="expression"> ... </form></code></pre>
</li>
</div>
<section class="api-section">
<h3>Arguments</h3>
<table class="variables-matrix input-arguments">
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>
ngSubmit
</td>
<td>
<a href="" class="label type-hint type-hint-expression">expression</a>
</td>
<td>
<p><a href="guide/expression">Expression</a> to eval.
(<a href="guide/expression#-event-">Event object is available as <code>$event</code></a>)</p>
</td>
</tr>
</tbody>
</table>
</section>
<h2 id="example">Example</h2><p>
<div>
<a ng-click="openPlunkr('examples/example-example79', $event)" class="btn pull-right">
<i class="glyphicon glyphicon-edit"> </i>
Edit in Plunker</a>
<div class="runnable-example"
path="examples/example-example79"
module="submitExample">
<div class="runnable-example-file"
name="index.html"
language="html"
type="html">
<pre><code><script> angular.module('submitExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.list = []; $scope.text = 'hello'; $scope.submit = function() { if ($scope.text) { $scope.list.push(this.text); $scope.text = ''; } }; }]); </script> <form ng-submit="submit()" ng-controller="ExampleController"> Enter text and hit enter: <input type="text" ng-model="text" name="text" /> <input type="submit" id="submit" value="Submit" /> <pre>list={{list}}</pre> </form></code></pre>
</div>
<div class="runnable-example-file"
name="protractor.js"
type="protractor"
language="js">
<pre><code>it('should check ng-submit', function() { expect(element(by.binding('list')).getText()).toBe('list=[]'); element(by.css('#submit')).click(); expect(element(by.binding('list')).getText()).toContain('hello'); expect(element(by.model('text')).getAttribute('value')).toBe(''); }); it('should ignore empty strings', function() { expect(element(by.binding('list')).getText()).toBe('list=[]'); element(by.css('#submit')).click(); element(by.css('#submit')).click(); expect(element(by.binding('list')).getText()).toContain('hello'); });</code></pre>
</div>
<iframe class="runnable-example-frame" src="examples/example-example79/index.html" name="example-example79"></iframe>
</div>
</div>
</p>
</div>
| bborbe/portfolio | files/libs/angularjs/1.4.12/docs/partials/api/ng/directive/ngSubmit.html | HTML | bsd-2-clause | 4,800 | [
30522,
1026,
1037,
17850,
12879,
1027,
1005,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
16108,
1013,
16108,
1012,
1046,
2015,
1013,
10086,
1013,
1058,
2487,
1012,
1018,
1012,
1060,
1013,
5034,
2278,
1013,
12835,
1013,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
def main():
"""Instantiate a DockerStats object and collect stats."""
print('Docker Service Module')
if __name__ == '__main__':
main()
| gomex/docker-zabbix | docker_service/__init__.py | Python | gpl-3.0 | 148 | [
30522,
13366,
2364,
1006,
1007,
1024,
1000,
1000,
1000,
7107,
13143,
1037,
8946,
2545,
29336,
2015,
4874,
1998,
8145,
26319,
1012,
1000,
1000,
1000,
6140,
1006,
1005,
8946,
2121,
2326,
11336,
1005,
1007,
2065,
1035,
1035,
2171,
1035,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 {
Command
} = require("discord.js-commando");
module.exports = class Say extends Command {
constructor(client) {
super(client, {
name: "say",
aliases: ["echo", "speak"],
group: "util",
memberName: "say",
description: "Says what you want it to say",
examples: ["say hello"],
autoAliases: true,
args: [{
key: "sayText",
prompt: "What do you want me to say?",
type: "string"
}]
});
}
run(msg, {
sayText
}) {
if (msg.deletable === true) {
msg.delete();
}
return msg.say(sayText);
};
} | SJHSBot/SJHS-Bot | commands/util/say.js | JavaScript | apache-2.0 | 729 | [
30522,
9530,
3367,
1063,
3094,
1065,
1027,
5478,
1006,
1000,
12532,
4103,
1012,
1046,
2015,
1011,
15054,
1000,
1007,
1025,
11336,
1012,
14338,
1027,
2465,
2360,
8908,
3094,
1063,
9570,
2953,
1006,
7396,
1007,
1063,
3565,
1006,
7396,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 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.ie.dto;
import com.google.ie.business.domain.Comment;
import com.google.ie.business.domain.Idea;
import com.google.ie.business.domain.User;
import java.io.Serializable;
/**
* A data transfer object representing the comment information.
*
* @author Charanjeet singh
*/
public class CommentDetail implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Comment object.
*/
private Comment comment;
private User user;
private Idea idea;
/**
* @param comment the comment to set
*/
public void setComment(Comment comment) {
this.comment = comment;
}
/**
* @return the comment
*/
public Comment getComment() {
return comment;
}
/**
* @param user the user to set
*/
public void setUser(User user) {
this.user = user;
}
/**
* @return the user
*/
public User getUser() {
return user;
}
public void setIdea(Idea idea) {
this.idea = idea;
}
public Idea getIdea() {
return idea;
}
}
| dslam/thoughtsite | src/main/java/com/google/ie/dto/CommentDetail.java | Java | apache-2.0 | 1,709 | [
30522,
1013,
1008,
9385,
2230,
8224,
4297,
1012,
1008,
30524,
1008,
8299,
1024,
1013,
1013,
7479,
1012,
15895,
1012,
8917,
1013,
15943,
1013,
6105,
1011,
1016,
1012,
1014,
1008,
1008,
4983,
3223,
2011,
12711,
2375,
2030,
3530,
2000,
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... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>General information — Kango 1.3.0 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.3.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Kango 1.3.0 documentation" href="../index.html" />
<link rel="next" title="Creating and Building Browser Extensions" href="creating-and-building-browser-extensions.html" />
<link rel="prev" title="KangoMessageSource" href="../api-reference/KangoMessageSource.html" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-23673413-1']);
_gaq.push(['_trackPageview']);
</script>
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="creating-and-building-browser-extensions.html" title="Creating and Building Browser Extensions"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="../api-reference/KangoMessageSource.html" title="KangoMessageSource"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Kango 1.3.0 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="general-information">
<h1>General information<a class="headerlink" href="#general-information" title="Permalink to this headline">¶</a></h1>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="creating-and-building-browser-extensions.html">Creating and Building Browser Extensions</a></li>
<li class="toctree-l1"><a class="reference internal" href="content-scripts.html">Content Scripts</a></li>
<li class="toctree-l1"><a class="reference internal" href="background-scripts.html">Background Scripts</a></li>
<li class="toctree-l1"><a class="reference internal" href="icons.html">Icons</a></li>
<li class="toctree-l1"><a class="reference internal" href="popup-api.html">Popup API</a></li>
<li class="toctree-l1"><a class="reference internal" href="messaging-api.html">Messaging API</a></li>
<li class="toctree-l1"><a class="reference internal" href="autoupdating-extensions.html">Autoupdating Extensions</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">FAQ</a></li>
<li class="toctree-l1"><a class="reference internal" href="samples.html">Samples</a></li>
</ul>
</div>
</div>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'kangoframework';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="../api-reference/KangoMessageSource.html"
title="previous chapter">KangoMessageSource</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="creating-and-building-browser-extensions.html"
title="next chapter">Creating and Building Browser Extensions</a></p>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="creating-and-building-browser-extensions.html" title="Creating and Building Browser Extensions"
>next</a> |</li>
<li class="right" >
<a href="../api-reference/KangoMessageSource.html" title="KangoMessageSource"
>previous</a> |</li>
<li><a href="../index.html">Kango 1.3.0 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2011-2013, Kango.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b3.
</div>
<script type="text/javascript">
(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>
<script type="text/javascript">
var disqus_shortname = 'kangoframework';
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
</body>
</html> | fedyk/fl.ru.am | kango/kango.1.3/docs/general/index.html | HTML | gpl-2.0 | 6,591 | [
30522,
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,
1024,
1013,
1013,
30524,
1060,
11039,
19968,
248... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
module Event::Part
class Calendar
include Cms::Part::Model
default_scope ->{ where(route: "event/calendar") }
end
end
| tecoda/opendata | app/models/event/part.rb | Ruby | mit | 131 | [
30522,
11336,
2724,
1024,
1024,
2112,
2465,
8094,
2421,
4642,
2015,
1024,
1024,
2112,
1024,
1024,
2944,
12398,
1035,
9531,
1011,
1028,
1063,
2073,
1006,
2799,
1024,
1000,
2724,
1013,
8094,
1000,
1007,
1065,
2203,
2203,
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,
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... |
[OBJ ParcImmobilier|Lot|L]
[!T:=[!L::initializeWS()!]!]
[!T::return!]
| ENG-SYSTEMS/Kob-Eye | Modules/ParcImmobilier/xml.md | Markdown | gpl-2.0 | 79 | [
30522,
1031,
27885,
3501,
27985,
5714,
5302,
14454,
3771,
1064,
2843,
1064,
1048,
1033,
1031,
999,
1056,
1024,
1027,
1031,
999,
1048,
1024,
1024,
3988,
4697,
9333,
1006,
1007,
999,
1033,
999,
1033,
1031,
999,
1056,
1024,
1024,
2709,
999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
# Plectranthus mysurensis Heyne ex Wall. SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Lamiales/Lamiaceae/Plectranthus/Plectranthus mysurensis/README.md | Markdown | apache-2.0 | 188 | [
30522,
1001,
20228,
22471,
17884,
9825,
2026,
28632,
11745,
4931,
2638,
4654,
2813,
1012,
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,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/**
*
* Spacebrew Library for Javascript
* --------------------------------
*
* This library was designed to work on front-end (browser) envrionments, and back-end (server)
* environments. Please refer to the readme file, the documentation and examples to learn how to
* use this library.
*
* Spacebrew is an open, dynamically re-routable software toolkit for choreographing interactive
* spaces. Or, in other words, a simple way to connect interactive things to one another. Learn
* more about Spacebrew here: http://docs.spacebrew.cc/
*
* To import into your web apps, we recommend using the minimized version of this library.
*
* Latest Updates:
* - added blank "options" attribute to config message - for future use
* - caps number of messages sent to 60 per second
* - reconnect to spacebrew if connection lost
* - enable client apps to extend libs with admin functionality.
* - added close method to close Spacebrew connection.
*
* @author Brett Renfer and Julio Terra from LAB @ Rockwell Group
* @filename sb-1.3.0.js
* @version 1.3.0
* @date May 7, 2013
*
*/
/**
* Check if Bind method exists in current enviroment. If not, it creates an implementation of
* this useful method.
*/
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function () {},
fBound = function () {
return fToBind.apply(this instanceof fNOP
? this
: oThis || window,
aArgs.concat(Array.prototype.slice.call(arguments)));
};
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
};
}
/**
* @namespace for Spacebrew library
*/
var Spacebrew = Spacebrew || {};
/**
* create placeholder var for WebSocket object, if it does not already exist
*/
var WebSocket = WebSocket || {};
/**
* Check if Running in Browser or Server (Node) Environment *
*/
// check if window object already exists to determine if running browswer
var window = window || undefined;
// check if module object already exists to determine if this is a node application
var module = module || undefined;
// if app is running in a browser, then define the getQueryString method
if (window) {
if (!window['getQueryString']){
/**
* Get parameters from a query string
* @param {String} name Name of query string to parse (w/o '?' or '&')
* @return {String} value of parameter (or empty string if not found)
*/
window.getQueryString = function( name ) {
if (!window.location) return;
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ) return "";
else return results[1];
}
}
}
// if app is running in a node server environment then package Spacebrew library as a module.
// WebSocket module (ws) needs to be saved in a node_modules so that it can be imported.
if (!window && module) {
WebSocket = require("ws");
module.exports = {
Spacebrew: Spacebrew
}
}
/**
* Define the Spacebrew Library *
*/
/**
* Spacebrew client!
* @constructor
* @param {String} server (Optional) Base address of Spacebrew server. This server address is overwritten if server defined in query string; defaults to localhost.
* @param {String} name (Optional) Base name of app. Base name is overwritten if "name" is defined in query string; defaults to window.location.href.
* @param {String} description (Optional) Base description of app. Description name is overwritten if "description" is defined in query string;
* @param {Object} options (Optional) An object that holds the optional parameters described below
* port (Optional) Port number for the Spacebrew server
* admin (Optional) Flag that identifies when app should register for admin privileges with server
* debug (Optional) Debug flag that turns on info and debug messaging (limited use)
*/
Spacebrew.Client = function( server, name, description, options ){
var options = options || {};
// check if the server variable is an object that holds all config values
if (server != undefined) {
if (toString.call(server) !== '[object String]') {
options.port = server.port || undefined;
options.debug = server.debug || false;
options.reconnect = server.reconnect || false;
description = server.description || undefined;
name = server.name || undefined;
server = server.server || undefined;
}
}
this.debug = (window.getQueryString('debug') === "true" ? true : (options.debug || false));
this.reconnect = options.reconnect || true;
this.reconnect_timer = undefined;
this.send_interval = 16;
this.send_blocked = false;
this.msg = {};
/**
* Name of app
* @type {String}
*/
this._name = name || "javascript client #";
if (window) {
this._name = (window.getQueryString('name') !== "" ? unescape(window.getQueryString('name')) : this._name);
}
/**
* Description of your app
* @type {String}
*/
this._description = description || "spacebrew javascript client";
if (window) {
this._description = (window.getQueryString('description') !== "" ? unescape(window.getQueryString('description')) : this._description);
}
/**
* Spacebrew server to which the app will connect
* @type {String}
*/
this.server = server || "sandbox.spacebrew.cc";
if (window) {
this.server = (window.getQueryString('server') !== "" ? unescape(window.getQueryString('server')) : this.server);
}
/**
* Port number on which Spacebrew server is running
* @type {Integer}
*/
this.port = options.port || 9000;
if (window) {
port = window.getQueryString('port');
if (port !== "" && !isNaN(port)) {
this.port = port;
}
}
/**
* Reference to WebSocket
* @type {WebSocket}
*/
this.socket = null;
/**
* Configuration file for Spacebrew
* @type {Object}
*/
this.client_config = {
name: this._name,
description: this._description,
publish:{
messages:[]
},
subscribe:{
messages:[]
},
options:{}
};
this.admin = {}
/**
* Are we connected to a Spacebrew server?
* @type {Boolean}
*/
this._isConnected = false;
}
/**
* Connect to Spacebrew
* @memberOf Spacebrew.Client
*/
Spacebrew.Client.prototype.connect = function(){
try {
this.socket = new WebSocket("ws://" + this.server + ":" + this.port);
this.socket.onopen = this._onOpen.bind(this);
this.socket.onmessage = this._onMessage.bind(this);
this.socket.onclose = this._onClose.bind(this);
} catch(e){
this._isConnected = false;
console.log("[connect:Spacebrew] connection attempt failed")
}
}
/**
* Close Spacebrew connection
* @memberOf Spacebrew.Client
*/
Spacebrew.Client.prototype.close = function(){
try {
if (this._isConnected) {
this.socket.close();
this._isConnected = false;
console.log("[close:Spacebrew] closing websocket connection")
}
} catch (e) {
this._isConnected = false;
}
}
/**
* Override in your app to receive on open event for connection
* @memberOf Spacebrew.Client
* @public
*/
Spacebrew.Client.prototype.onOpen = function( name, value ){}
/**
* Override in your app to receive on close event for connection
* @memberOf Spacebrew.Client
* @public
*/
Spacebrew.Client.prototype.onClose = function( name, value ){}
/**
* Override in your app to receive "range" messages, e.g. sb.onRangeMessage = yourRangeFunction
* @param {String} name Name of incoming route
* @param {String} value [description]
* @memberOf Spacebrew.Client
* @public
*/
Spacebrew.Client.prototype.onRangeMessage = function( name, value ){}
/**
* Override in your app to receive "boolean" messages, e.g. sb.onBooleanMessage = yourBoolFunction
* @param {String} name Name of incoming route
* @param {String} value [description]
* @memberOf Spacebrew.Client
* @public
*/
Spacebrew.Client.prototype.onBooleanMessage = function( name, value ){}
/**
* Override in your app to receive "string" messages, e.g. sb.onStringMessage = yourStringFunction
* @param {String} name Name of incoming route
* @param {String} value [description]
* @memberOf Spacebrew.Client
* @public
*/
Spacebrew.Client.prototype.onStringMessage = function( name, value ){}
/**
* Override in your app to receive "custom" messages, e.g. sb.onCustomMessage = yourStringFunction
* @param {String} name Name of incoming route
* @param {String} value [description]
* @memberOf Spacebrew.Client
* @public
*/
Spacebrew.Client.prototype.onCustomMessage = function( name, value, type ){}
/**
* Add a route you are publishing on
* @param {String} name Name of incoming route
* @param {String} type "boolean", "range", or "string"
* @param {String} def default value
* @memberOf Spacebrew.Client
* @public
*/
Spacebrew.Client.prototype.addPublish = function( name, type, def ){
this.client_config.publish.messages.push({"name":name, "type":type, "default":def});
this.updatePubSub();
}
/**
* [addSubscriber description]
* @param {String} name Name of outgoing route
* @param {String} type "boolean", "range", or "string"
* @memberOf Spacebrew.Client
* @public
*/
Spacebrew.Client.prototype.addSubscribe = function( name, type ){
this.client_config.subscribe.messages.push({"name":name, "type":type });
this.updatePubSub();
}
/**
* Update publishers and subscribers
* @memberOf Spacebrew.Client
* @private
*/
Spacebrew.Client.prototype.updatePubSub = function(){
if (this._isConnected) {
this.socket.send(JSON.stringify({"config": this.client_config}));
}
}
/**
* Send a route to Spacebrew
* @param {String} name Name of outgoing route (must match something in addPublish)
* @param {String} type "boolean", "range", or "string"
* @param {String} value Value to send
* @memberOf Spacebrew.Client
* @public
*/
Spacebrew.Client.prototype.send = function( name, type, value ){
var self = this;
this.msg = {
"message": {
"clientName":this._name,
"name": name,
"type": type,
"value": value
}
}
// if send block is not active then send message
if (!this.send_blocked) {
this.socket.send(JSON.stringify(this.msg));
this.send_blocked = true;
this.msg = undefined;
// set the timer to unblock message sending
setTimeout(function() {
self.send_blocked = false; // remove send block
if (self.msg != undefined) { // if message exists then sent it
self.send(self.msg.message.name, self.msg.message.type, self.msg.message.value);
}
}, self.send_interval);
}
}
/**
* Called on WebSocket open
* @private
* @memberOf Spacebrew.Client
*/
Spacebrew.Client.prototype._onOpen = function() {
console.log("[_onOpen:Spacebrew] Spacebrew connection opened, client name is: " + this._name);
this._isConnected = true;
if (this.admin.active) this.connectAdmin();
// if reconnect functionality is activated then clear interval timer when connection succeeds
if (this.reconnect_timer) {
console.log("[_onOpen:Spacebrew] tearing down reconnect timer")
this.reconnect_timer = clearInterval(this.reconnect_timer);
this.reconnect_timer = undefined;
}
// send my config
this.updatePubSub();
this.onOpen();
}
/**
* Called on WebSocket message
* @private
* @param {Object} e
* @memberOf Spacebrew.Client
*/
Spacebrew.Client.prototype._onMessage = function( e ){
var data = JSON.parse(e.data)
, name
, type
, value
;
// handle client messages
if (data["message"]) {
// check to make sure that this is not an admin message
if (!data.message["clientName"]) {
name = data.message.name;
type = data.message.type;
value = data.message.value;
switch( type ){
case "boolean":
this.onBooleanMessage( name, value == "true" );
break;
case "string":
this.onStringMessage( name, value );
break;
case "range":
this.onRangeMessage( name, Number(value) );
break;
default:
this.onCustomMessage( name, value, type );
}
}
}
// handle admin messages
else {
if (this.admin.active) {
this._handleAdminMessages( data );
}
}
}
/**
* Called on WebSocket close
* @private
* @memberOf Spacebrew.Client
*/
Spacebrew.Client.prototype._onClose = function() {
var self = this;
console.log("[_onClose:Spacebrew] Spacebrew connection closed");
this._isConnected = false;
if (this.admin.active) this.admin.remoteAddress = undefined;
// if reconnect functionality is activated set interval timer if connection dies
if (this.reconnect && !this.reconnect_timer) {
console.log("[_onClose:Spacebrew] setting up reconnect timer");
this.reconnect_timer = setInterval(function () {
if (self.isConnected != false) {
self.connect();
console.log("[reconnect:Spacebrew] attempting to reconnect to spacebrew");
}
}, 5000);
}
this.onClose();
};
/**
* name Method that sets or gets the spacebrew app name. If parameter is provided then it sets the name, otherwise
* it just returns the current app name.
* @param {String} newName New name of the spacebrew app
* @return {String} Returns the name of the spacebrew app if called as a getter function. If called as a
* setter function it will return false if the method is called after connecting to spacebrew,
* because the name must be configured before connection is made.
*/
Spacebrew.Client.prototype.name = function (newName){
if (newName) { // if a name has been passed in then update it
if (this._isConnected) return false; // if already connected we can't update name
this._name = newName;
if (window) {
this._name = (window.getQueryString('name') !== "" ? unescape(window.getQueryString('name')) : this._name);
}
this.client_config.name = this._name; // update spacebrew config file
}
return this._name;
};
/**
* name Method that sets or gets the spacebrew app description. If parameter is provided then it sets the description,
* otherwise it just returns the current app description.
* @param {String} newDesc New description of the spacebrew app
* @return {String} Returns the description of the spacebrew app if called as a getter function. If called as a
* setter function it will return false if the method is called after connecting to spacebrew,
* because the description must be configured before connection is made.
*/
Spacebrew.Client.prototype.description = function (newDesc){
if (newDesc) { // if a description has been passed in then update it
if (this._isConnected) return false; // if already connected we can't update description
this._description = newDesc || "spacebrew javascript client";
if (window) {
this._description = (window.getQueryString('description') !== "" ? unescape(window.getQueryString('description')) : this._description);
}
this.client_config.description = this._description; // update spacebrew config file
}
return this._description;
};
/**
* isConnected Method that returns current connection state of the spacebrew client.
* @return {Boolean} Returns true if currently connected to Spacebrew
*/
Spacebrew.Client.prototype.isConnected = function (){
return this._isConnected;
};
Spacebrew.Client.prototype.extend = function ( mixin ) {
for (var prop in mixin) {
if (mixin.hasOwnProperty(prop)) {
this[prop] = mixin[prop];
}
}
};
| RyanteckLTD/RTK-000-001-Controller | touchClient/js/sb-1.3.0.js | JavaScript | gpl-3.0 | 15,832 | [
30522,
1013,
1008,
1008,
1008,
1008,
2686,
13578,
2860,
3075,
2005,
9262,
22483,
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,
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... |
# 前端个人知识笔记(第四章 定位、层级以及居中)
标签(空格分隔): 前端笔记 知识库 HTML
---
[TOC]
## Position
- static 默认值,不定位
- relative 相对定位
- 只加相对定位,不设置元素移动的位置(top, bottom, left, right值),元素和之前是没有变化
- 根据自己原来的位置计算移动的位置
- 不脱离文档流,元素移走以后,原来的位置还会被保留
- 加上相对定位后对原来的元素本身的特征没有影响
- 提升层级
- absolute 绝对定位
- 完全脱离文档流
- 行内元素支持所有样式(与加上浮动或者inline-block以后的效果是一样的)
- 如果父级有定位,那位置会根据父级移动。如果父级没有定位,那位置根据可视区移动。(一般情况下,要用到绝对定位的时候,都会给父级来一个相对定位, *子元素绝对定位, 父元素相对定位*)
- 提升层级
- 触发BFC
- fixed 固定定位
- 完全脱离文档流
- 行内元素支持所有样式(与加上浮动或者inline-block以后的效果是一样的)
- 相对可视区来移动位置
- 提升层级
- 触发BFC
- IE6不支持
## z-index
- 在正常情况下,层级的大小由顺序决定,后面的元素要比前面的元素的层级要高
- 有定位元素的层级要比没有定位元素层级要高
- 在都有定位的情况下,层级还是取决于书写顺序
- z-index 层级,它的值是一个数字,数字越大层级越高(在同一个层里)
## 居中
需要注意的是, 以下例子中parent的宽高, 可以通过上下文确定或者手动指定。
### 水平居中
1. `margin: 0 auto`
- 用在子元素上的
- 如果它是行内元素, 需要把它转成块元素`display:block`(行内元素没margin效果)
2. `text-align: center`
- 用在父元素上的
- 子元素不能是行内元素, 需要是块元素或行内块元素。
### 水平垂直居中
1. 经典方法, 绝对定位加上子元素的宽高一半的负边距。
- 用在子元素上的
- 需要知道子元素的宽高
```css
.parent{
position: relative;
}
.children{
position: absolute;
width: 100px;
height: 150px;
top: 50%;
width: 50%;
margin-top: -75px; /* 高的一半 */
margin-left: -50px; /* 宽的一半 */
}
```
2. 经典方法: `margin: auto`
- 用在子元素上的
- 不用受子元素宽高限制
```css
.parent{
position: relative;
}
.children{
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
margin: auto;
}
```
3. 绝对定位和transform
- 用在子元素上的
- 使用了transform方法, 如果支持CSS3的话, 在性能上有优势。
```css
.parent{
position: relative;
}
.children{
position: absolute;
width: 100px;
height: 150px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
```
4. `display: table-cell`
- 用在父元素上的
- 让父元素变成表格, 再用表格的样式居中。
```css
.parent{
display: table-cell;
vertical-align: middle;
text-align: center;
width: 300px;
height: 300px;
}
.children{
width: 100px;
height: 150px;
}
```
5. CSS3新特性 flexbox
- 用在父元素身上
- PC有兼容问题, 移动端完美
- 未来的方法
```css
.parent{
display: flex;
justify-content: center;
align-items: center;
width: 300px;
height: 300px;
}
.children{
width: 100px;
height: 150px;
}
```
6. 利用`vertical-align: middle`
- 需要有一个块参照元素(如下面的`.refer`)
- 父元素需要使用`font-size: 0`消去子元素间产生的间隙
- 子元素宽高不需要确定
```css
.parent{
text-align:center;
font-size: 0;
}
.refer{
width: 0;
height: 100%;
vertical-align: middle;
display: inline-block;
}
.children{
display: inline-block;
vertical-align: middle;
font-size: 14px;
text-align: left;
}
```
```html
<div class="parent">
<div class=“refer”></div>
<div class=“children”>需要内容把我撑开</div>
</div>
``` | liu599/FrontEndEntryCourse | Note/Chapter4.md | Markdown | gpl-3.0 | 5,043 | [
30522,
1001,
1776,
100,
100,
1756,
100,
100,
100,
100,
1987,
100,
1798,
1932,
1822,
100,
1635,
100,
100,
100,
100,
100,
1746,
1007,
100,
100,
1987,
1930,
100,
1775,
100,
1988,
1993,
1776,
100,
100,
100,
100,
100,
100,
16129,
1011,
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... |
---
seo:
title: Scheduling Parameters
description: Scheduling an email with SMTP
keywords: SMTP, send email, scheduling
title: Scheduling Parameters
weight: 10
layout: page
navigation:
show: true
---
With scheduling, you can send large volumes of email in queued batches or target individual recipients by specifying a custom UNIX timestamp parameter.
Using the parameters defined below, you can queue batches of emails targeting individual recipients.
{% info %}
**Emails can be scheduled up to 72 hours in advance.** However, this scheduling constraint does not apply to campaigns sent via [Marketing Campaigns]({{root_url}}/User_Guide/Marketing_Campaigns/index.html).
{% endinfo%}
This parameter allows SendGrid to begin processing a customer’s email requests before sending. SendGrid queues the messages and releases them when the timestamp indicates. This technique allows for a more efficient way to distribute large email requests and can **improve overall mail delivery time** performance. This functionality:
* Improves efficiency of processing and distributing large volumes of email.
* Reduces email pre-processing time.
* Enables you to time email arrival to increase open rates.
* Is available for free to all SendGrid customers.
{% info %}
Cancel Scheduled sends by including a batch ID with your send. For more information, check out [Cancel Scheduled Sends]({{root_url}}/API_Reference/Web_API_v3/cancel_schedule_send.html)!
{% endinfo %}
{% warning %}
Using both `send_at` and `send_each_at` is not valid. Setting both causes your request to be dropped.
{% endwarning %}
{% anchor h2 %}
Send At
{% endanchor %}
To schedule a send request for a large batch of emails, use the `send_at` parameter which will send all emails at approximately the same time. `send_at` is a [UNIX timestamp](https://en.wikipedia.org/wiki/Unix_time).
<h4>Example of send_at email header</h4>
{% codeblock lang:json %}
{
"send_at": 1409348513
}
{% endcodeblock %}
{% anchor h2 %}
Send Each At
{% endanchor %}
To schedule a send request for individual recipients; use `send_each_at` to send emails to each recipient at the specified time. `send_each_at` is a sequence of UNIX timestamps, provided as an array. There must be one timestamp per email you wish to send.
<h4>Example of send_each_at email header</h4>
{% codeblock lang:json %}
{
"to": [
"<ben@example.com>",
"john@example.com",
"mikeexampexample@example.com",
"<example@example.com>",
"example@example.com",
"example@example.com"
],
"send_each_at": [
1409348513,
1409348514,
1409348515
]
}
{% endcodeblock %}
To allow for the cancellation of a scheduled send, you must include a `batch_id` with your send. To generate a valid `batch_id`, use the [batch id generation endpoint]({{root_url}}/API_Reference/Web_API_v3/cancel_scheduled_send.html#Cancel-Scheduled-Sends). A `batch_id` is valid for 10 days (864,000 seconds) after generation.
<h4>Example of including a batch_id</h4>
{% codeblock lang:json %}
{
"to": [
"<ben@example.com>",
"john@example.com",
"mikeexampexample@example.com",
"<example@example.com>",
"example@example.com",
"example@example.com"
],
"send_at": 1409348513,
"batch_id": "MWQxZmIyODYtNjE1Ni0xMWU1LWI3ZTUtMDgwMDI3OGJkMmY2LWEzMmViMjYxMw"
}
{% endcodeblock %}
{% anchor h2 %}
Additional Resources
{% endanchor h2 %}
- [SMTP Service Crash Course](https://sendgrid.com/blog/smtp-service-crash-course/)
- [Getting Started with the SMTP API]({{root_url}}/API_Reference/SMTP_API/getting_started_smtp.html)
- [Integrating with SMTP]({{root_url}}/API_Reference/SMTP_API/integrating_with_the_smtp_api.html)
- [Building an SMTP Email]({{root_url}}/API_Reference/SMTP_API/building_an_smtp_email.html)
| katieporter/docs | source/API_Reference/SMTP_API/scheduling_parameters.md | Markdown | mit | 3,769 | [
30522,
1011,
1011,
1011,
27457,
1024,
2516,
1024,
19940,
11709,
6412,
1024,
19940,
2019,
10373,
2007,
15488,
25856,
3145,
22104,
1024,
15488,
25856,
1010,
4604,
10373,
1010,
19940,
2516,
1024,
19940,
11709,
3635,
1024,
2184,
9621,
1024,
3931,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_HTTP_HTTP_STREAM_PARSER_H_
#define NET_HTTP_HTTP_STREAM_PARSER_H_
#include <string>
#include "base/basictypes.h"
#include "net/base/io_buffer.h"
#include "net/base/load_log.h"
#include "net/base/upload_data_stream.h"
#include "net/http/http_chunked_decoder.h"
#include "net/http/http_response_info.h"
#include "net/socket/client_socket_handle.h"
namespace net {
class ClientSocketHandle;
class HttpRequestInfo;
class HttpStreamParser {
public:
// Any data in |read_buffer| will be used before reading from the socket
// and any data left over after parsing the stream will be put into
// |read_buffer|. The left over data will start at offset 0 and the
// buffer's offset will be set to the first free byte. |read_buffer| may
// have its capacity changed.
HttpStreamParser(ClientSocketHandle* connection,
GrowableIOBuffer* read_buffer,
LoadLog* load_log);
~HttpStreamParser() {}
// These functions implement the interface described in HttpStream with
// some additional functionality
int SendRequest(const HttpRequestInfo* request, const std::string& headers,
UploadDataStream* request_body, HttpResponseInfo* response,
CompletionCallback* callback);
int ReadResponseHeaders(CompletionCallback* callback);
int ReadResponseBody(IOBuffer* buf, int buf_len,
CompletionCallback* callback);
uint64 GetUploadProgress() const;
HttpResponseInfo* GetResponseInfo();
bool IsResponseBodyComplete() const;
bool CanFindEndOfResponse() const;
bool IsMoreDataBuffered() const;
private:
// FOO_COMPLETE states implement the second half of potentially asynchronous
// operations and don't necessarily mean that FOO is complete.
enum State {
STATE_NONE,
STATE_SENDING_HEADERS,
STATE_SENDING_BODY,
STATE_REQUEST_SENT,
STATE_READ_HEADERS,
STATE_READ_HEADERS_COMPLETE,
STATE_BODY_PENDING,
STATE_READ_BODY,
STATE_READ_BODY_COMPLETE,
STATE_DONE
};
// The number of bytes by which the header buffer is grown when it reaches
// capacity.
enum { kHeaderBufInitialSize = 4096 };
// |kMaxHeaderBufSize| is the number of bytes that the response headers can
// grow to. If the body start is not found within this range of the
// response, the transaction will fail with ERR_RESPONSE_HEADERS_TOO_BIG.
// Note: |kMaxHeaderBufSize| should be a multiple of |kHeaderBufInitialSize|.
enum { kMaxHeaderBufSize = 256 * 1024 }; // 256 kilobytes.
// The maximum sane buffer size.
enum { kMaxBufSize = 2 * 1024 * 1024 }; // 2 megabytes.
// Handle callbacks.
void OnIOComplete(int result);
// Try to make progress sending/receiving the request/response.
int DoLoop(int result);
// The implementations of each state of the state machine.
int DoSendHeaders(int result);
int DoSendBody(int result);
int DoReadHeaders();
int DoReadHeadersComplete(int result);
int DoReadBody();
int DoReadBodyComplete(int result);
// Examines |read_buf_| to find the start and end of the headers. Return
// the offset for the end of the headers, or -1 if the complete headers
// were not found. If they are are found, parse them with
// DoParseResponseHeaders().
int ParseResponseHeaders();
// Parse the headers into response_.
void DoParseResponseHeaders(int end_of_header_offset);
// Examine the parsed headers to try to determine the response body size.
void CalculateResponseBodySize();
// Current state of the request.
State io_state_;
// The request to send.
const HttpRequestInfo* request_;
// The request header data.
scoped_refptr<DrainableIOBuffer> request_headers_;
// The request body data.
scoped_ptr<UploadDataStream> request_body_;
// Temporary buffer for reading.
scoped_refptr<GrowableIOBuffer> read_buf_;
// Offset of the first unused byte in |read_buf_|. May be nonzero due to
// a 1xx header, or body data in the same packet as header data.
int read_buf_unused_offset_;
// The amount beyond |read_buf_unused_offset_| where the status line starts;
// -1 if not found yet.
int response_header_start_offset_;
// The parsed response headers. Owned by the caller.
HttpResponseInfo* response_;
// Indicates the content length. If this value is less than zero
// (and chunked_decoder_ is null), then we must read until the server
// closes the connection.
int64 response_body_length_;
// Keep track of the number of response body bytes read so far.
int64 response_body_read_;
// Helper if the data is chunked.
scoped_ptr<HttpChunkedDecoder> chunked_decoder_;
// Where the caller wants the body data.
scoped_refptr<IOBuffer> user_read_buf_;
int user_read_buf_len_;
// The callback to notify a user that their request or response is
// complete or there was an error
CompletionCallback* user_callback_;
// In the client callback, the client can do anything, including
// destroying this class, so any pending callback must be issued
// after everything else is done. When it is time to issue the client
// callback, move it from |user_callback_| to |scheduled_callback_|.
CompletionCallback* scheduled_callback_;
// The underlying socket.
ClientSocketHandle* const connection_;
scoped_refptr<LoadLog> load_log_;
// Callback to be used when doing IO.
CompletionCallbackImpl<HttpStreamParser> io_callback_;
DISALLOW_COPY_AND_ASSIGN(HttpStreamParser);
};
} // namespace net
#endif // NET_HTTP_HTTP_STREAM_PARSER_H_
| rwatson/chromium-capsicum | net/http/http_stream_parser.h | C | bsd-3-clause | 5,721 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2268,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
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... |
package com.nd.android.u.square.interf;
/**
* 语音,图片,gif信息
*
* <br>
* Created 2014-10-29 下午4:17:31
*
* @version
* @author chenpeng
*
* @see
*/
public interface IMultimediaInfo {
// public MultiTypy ext;// 类型 audio, image, gif
// public long _id;// 一般不需要,当MultiType=audio的时候,最好传入音频所属对象的id
// public long fid;// 文件id,储存在文件系统的fid
// public String path;// 文件路径
// public String extra;// 额外信息:如音频长度
// 类型
public enum MultiTypy {
audio, image, circleimage, gif, video
};
/**
* 获得类型信息
*
* <br>Created 2014-10-29 下午5:26:54
* @return
* @author chenpeng
*/
public MultiTypy getExt();
// 设置类型
public void setExt(MultiTypy ext);
/**
* 获得Multimedia拥有对象id
*
* <br>Created 2014-10-29 下午5:27:16
* @return
* @author chenpeng
*/
public long getId();
// 设置Multimedia拥有对象id
public void setId(long id);
/**
* 获得Multimedia内容id
*
* <br>Created 2014-10-29 下午5:28:22
* @return
* @author chenpeng
*/
public long getFid();
// 设置Multimedia内容id
public void setFid(long fid);
/**
* 获得Multimedia内容下载地址
*
* <br>Created 2014-10-29 下午5:28:50
* @return
* @author chenpeng
*/
public String getPath();
// 设置Multimedia内容下载地址
public void setPath(String path);
/**
* 获得附加信息(如:音频文件的时长信息)
*
* <br>Created 2014-10-29 下午5:30:35
* @return
* @author chenpeng
*/
public String getExtra();
// 设置附加信息(如:音频文件的时长信息)
public void setExtra(String extra);
}
| treejames/StarAppSquare | src/com/nd/android/u/square/interf/IMultimediaInfo.java | Java | bsd-3-clause | 1,938 | [
30522,
7427,
4012,
1012,
1050,
2094,
1012,
11924,
1012,
1057,
1012,
2675,
1012,
6970,
2546,
1025,
1013,
1008,
1008,
1008,
100,
100,
1010,
100,
100,
1010,
21025,
2546,
1767,
100,
1008,
1008,
1026,
7987,
1028,
1008,
2580,
2297,
1011,
2184,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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) 2010-2015 JPEXS, All rights reserved.
*
* This library 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.0 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash;
import java.util.ResourceBundle;
/**
*
* @author JPEXS
*/
public class AppResources {
private static final ResourceBundle resourceBundle = ResourceBundle.getBundle("com.jpexs.decompiler.flash.locales.AppResources");
public static String translate(String key) {
return resourceBundle.getString(key);
}
public static String translate(String bundle, String key) {
ResourceBundle b = ResourceBundle.getBundle(bundle);
return b.getString(key);
}
}
| acenode/jpexs-decompiler | libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/AppResources.java | Java | gpl-3.0 | 1,221 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2230,
1011,
2325,
16545,
10288,
2015,
1010,
2035,
2916,
9235,
1012,
1008,
1008,
2023,
3075,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
1008,
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... |
<?php
declare(strict_types=1);
/**
* PlumSearch plugin for CakePHP Rapid Development Framework
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @author Evgeny Tomenko
* @since PlumSearch 0.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace PlumSearch\Test\App\Model\Table;
use Cake\ORM\Query;
/**
* Articles Table
*
* @property \PlumSearch\Test\App\Model\Table\AuthorsTable|\Cake\ORM\Association\BelongsTo $Authors
* @method \PlumSearch\Model\FilterRegistry filters()
* @method \Cake\ORM\Table addFilter(string $name, array $options = [])
* @method \Cake\ORM\Table removeFilter(string $name)
*/
class ArticlesTable extends \Cake\ORM\Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config): void
{
$this->setTable('articles');
$this->setDisplayField('id');
$this->setPrimaryKey('id');
$this->addBehavior('Timestamp');
$this->addBehavior('PlumSearch.Filterable');
$this->addFilter('title', ['className' => 'Like']);
$this->addFilter('tag', ['className' => 'Tags']);
// $this->addFilter('language', ['className' => 'Value']);
$this->addFilter('author_id', ['className' => 'Value']);
$this->belongsTo('Authors', [
'foreignKey' => 'author_id',
]);
}
/**
* Authors search finder
*
* @param Query $query query object instance
* @return $this
*/
public function findWithAuthors(Query $query)
{
return $query->matching('Authors');
}
}
| skie/plum_search | tests/App/Model/Table/ArticlesTable.php | PHP | mit | 1,749 | [
30522,
1026,
1029,
25718,
13520,
1006,
9384,
1035,
4127,
1027,
1015,
1007,
1025,
1013,
1008,
1008,
1008,
22088,
17310,
11140,
13354,
2378,
2005,
9850,
8458,
2361,
5915,
2458,
7705,
1008,
1008,
7000,
2104,
1996,
10210,
6105,
1008,
25707,
201... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 ruby
require 'rubygems'
require 'bundler/setup'
require 'logger'
require 'uri'
require 'restclient'
require 'sinatra'
$log = Logger.new(STDERR)
$log.level = Logger::INFO
module DomainAuthenticator
class DomainAuthenticatorSrv < Sinatra::Base
# Run with the production file on the server
if File.exists?('production')
PASSWORD_HOSTS = /^level05-\d+\.stripe-ctf\.com$/
ALLOWED_HOSTS = /\.stripe-ctf\.com$/
else
PASSWORD_HOSTS = /^localhost$/
ALLOWED_HOSTS = //
end
PASSWORD = File.read('password.txt').strip
enable :sessions
# Use persistent entropy file
entropy_file = 'entropy.dat'
unless File.exists?(entropy_file)
File.open(entropy_file, 'w') do |f|
f.write(OpenSSL::Random.random_bytes(24))
end
end
set :session_secret, File.read(entropy_file)
get '/*' do
output = <<EOF
<p>
Welcome to the Domain Authenticator. Please authenticate as a user from
your domain of choice.
</p>
<form action="" method="POST">
<p>Pingback URL: <input type="text" name="pingback" /></p>
<p>Username: <input type="text" name="username" /></p>
<p>Password: <input type="password" name="password" /></p>
<p><input type="submit" value="Submit"></p>
</form>
EOF
user = session[:auth_user]
host = session[:auth_host]
if user && host
output += "<p> You are authenticated as #{user}@#{host}. </p>"
if host =~ PASSWORD_HOSTS
output += "<p> Since you're a user of a password host and all,"
output += " you deserve to know this password: #{PASSWORD} </p>"
end
end
output
end
post '/*' do
pingback = params[:pingback]
username = params[:username]
password = params[:password]
pingback = "http://#{pingback}" unless pingback.include?('://')
host = URI.parse(pingback).host
unless host =~ ALLOWED_HOSTS
return "Host not allowed: #{host}" \
" (allowed authentication hosts are #{ALLOWED_HOSTS.inspect})"
end
begin
body = perform_authenticate(pingback, username, password)
rescue StandardError => e
return "An unknown error occurred while requesting #{pingback}: #{e}"
end
if authenticated?(body)
session[:auth_user] = username
session[:auth_host] = host
return "Remote server responded with: #{body}." \
" Authenticated as #{username}@#{host}!"
else
session[:auth_user] = nil
session[:auth_host] = nil
sleep(1) # prevent abuse
return "Remote server responded with: #{body}." \
" Unable to authenticate as #{username}@#{host}."
end
end
def perform_authenticate(url, username, password)
$log.info("Sending request to #{url}")
response = RestClient.post(url, {:password => password,
:username => username})
body = response.body
$log.info("Server responded with: #{body}")
body
end
def authenticated?(body)
body =~ /[^\w]AUTHENTICATED[^\w]*$/
end
end
end
def main
DomainAuthenticator::DomainAuthenticatorSrv.run!
end
if $0 == __FILE__
main
exit(0)
end
| robertdimarco/puzzles | stripe-ctf-2/level05-code/srv.rb | Ruby | mit | 3,240 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
10090,
5478,
1005,
10090,
3351,
5244,
1005,
5478,
1005,
14012,
2099,
1013,
16437,
1005,
5478,
1005,
8833,
4590,
1005,
5478,
1005,
24471,
2072,
1005,
5478,
1005,
2717,
20464,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
# File: mapentity.py
# import pygtk
# pygtk.require('2.0')
from gi.repository import Gtk, Gdk
class MapEntity:
# self.x = None
# self.y = None
# self.name = None
# self.texture = None
def getCoords(self):
return self.x,self.y
def getx(self):
return self.x
def gety(self):
return self.y
def setCoords(self,xcoord,ycoord):
self.x = xcoord
self.y = ycoord
def getName(self):
return self.name
def setName(self, strname):
self.name = strname
def __init__(self, xarg, yarg, namearg):
self.x = xarg
self.y = yarg
self.name = namearg
return | lotusronin/KronosEngine | editor/mapentity.py | Python | mit | 592 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
18750,
1001,
5371,
1024,
4949,
4765,
3012,
1012,
1052,
2100,
1001,
12324,
1052,
2100,
13512,
2243,
1001,
1052,
2100,
13512,
2243,
1012,
5478,
1006,
1005,
1016,
1012,
1014,
1005,
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... |
body{
/*-webkit-touch-callout:none;*/
-webkit-user-select:none;
margin:0;
padding:0;
overflow:hidden;
background:url(http://res.tu.qq.com/assets/opwumeiniang_img/bg_s.png);
}
img{
border:0 none;
}
a,a:hover,a:visited,a:link,a:active{
text-decoration:none;
}
.hide{
display:none;
}
.qzone-bar{
width:100%;
height:80px;
background-image:url(http://res.tu.qq.com/assets/opwumeiniang_img/logo_qzone.png);
background-repeat:no-repeat;
background-color:rgb(31, 31, 31);
position:fixed;
z-index:89;
left:0;
top:0;
}
.qzone-bar2{
width:101%;
height:80px;
margin-left:-50%;
background-image:url(http://res.tu.qq.com/assets/opwumeiniang_img/logo_qzone.png);
background-repeat:no-repeat;
background-color:rgb(31, 31, 31);
position:fixed;
z-index:89;
left:50%;
top:0;
}
.qzone-bar > div,
.qzone-bar2 > div{
line-height:80px;
margin-right:30px;
color:rgb(151, 151, 151);
text-align:right;
font-size:20px;
}
@keyframes loading {
from {transform:rotateY(0deg);}
to {transform:rotateY(180deg);}
}
@-webkit-keyframes loading {
from {-webkit-transform:rotateY(0deg);}
to {-webkit-transform:rotateY(180deg);}
}
.loading-mask{
width:100%;
height:100%;
line-height:80px;
font-size:32px;
font-weight:bold;
text-align:center;
color:white;
position:fixed;
z-index:91;
left:0;
top:0;
}
.loading-bg{
width:100%;
height:100%;
background-color:black;
opacity:0.3;
filter:alpha(opacity=30);
position:absolute;
z-index:92;
left:0;
top:0;
}
.loading-tips{
width:230px;
height:230px;
margin-left:-115px;
margin-top:-115px;
background:url(http://res.tu.qq.com/assets/opwumeiniang_img/loading.png) no-repeat;
position:absolute;
z-index:93;
left:50%;
top:50%;
}
.loading-mask > img,
img.loading-icon {
width:125px;
height:71px;
margin-left:-62px;
margin-top:-72px;
animation: loading 0.75s linear 0s infinite;
-webkit-animation: loading 0.75s linear 0s infinite;
position:fixed;
z-index:94;
left:50%;
top:50%;
}
.err-tips{
width:423px;
height:423px;
margin-left:-211px;
margin-top:-211px;
background:url(http://res.tu.qq.com/assets/opwumeiniang_img/tips_err.png) no-repeat;
position:fixed;
z-index:99;
left:50%;
top:50%;
}
.err-btn{
width:245px;
height:60px;
cursor:pointer;
margin:306px auto 0 auto;
}
.wrapper{
width:640px;
margin:0 auto;
position:relative;
z-index:0;
}
.inner-wrapper{
width:640px;
position:absolute;
left:0;
top:40px;
}
.pk-layer{
position:relative;
z-index:1;
}
img.pk-bg{
width:640px;
height:959px;
margin-top:-26px;
transition:opacity 0.3s;
-webkit-transition:opacity 0.3s;
}
input.upload-input{
visibility:hidden;
}
.crop-layer{
width:640px;
height:800px;
overflow:hidden;
background:url(http://res.tu.qq.com/assets/opwumeiniang_img/bg.jpg) no-repeat 0 -26px;
position:relative;
z-index:1;
}
.my-pic{
position:absolute;
z-index:3;
}
.my-canvas{
position:absolute;
z-index:2;
left:0;
top:0;
visibility:hidden;
}
.pk-cover{
width:640px;
height:311px;
margin-left:-320px;
background-image:url(http://res.tu.qq.com/assets/opwumeiniang_img/cover_pk.png?v=3);
background-repeat:no-repeat;
position:fixed;
z-index:81;
left:50%;
bottom:0;
}
.pk-tips{
width:360px;
height:40px;
text-align:center;
color:white;
font-size:26px;
font-weight:bold;
font-family:FZLTZHK--GBK1-0;
position:absolute;
left:140px;
top:90px;
}
.pk-btn{
width:340px;
height:95px;
cursor:pointer;
position:absolute;
left:150px;
top:142px;
}
.follow-section{
width:260px;
height:30px;
cursor:pointer;
position:absolute;
left:190px;
top:215px;
}
.follow-checkbox{
width:30px;
height:30px;
margin-left:15px;
display:inline;
float:left;
}
.follow-tips{
width:200px;
height:30px;
line-height:28px;
margin-left:15px;
display:inline;
float:left;
color:white;
font-size:23px;
font-weight:bold;
font-family:FZLTZHK--GBK1-0;
}
.crop-cover{
width:640px;
height:210px;
margin-left:-320px;
background-color:white;
opacity:0.9;
filter:alpha(opacity=90);
position:fixed;
z-index:82;
left:50%;
bottom:0;
}
.cancel-btn{
width:42px;
height:42px;
cursor:pointer;
background:url(http://res.tu.qq.com/assets/opwumeiniang_img/btns.png?v=2) no-repeat -2px -133px;
position:absolute;
left:45px;
top:90px;
}
.confirm-btn{
width:129px;
height:129px;
cursor:pointer;
background:url(http://res.tu.qq.com/assets/opwumeiniang_img/btns.png?v=2) no-repeat -2px -2px;
position:absolute;
left:255px;
top:40px;
}
.fbb-bg{
height:933px;
background-repeat:no-repeat;
}
.title-img{
width:433px;
height:58px;
margin-left:-216px;
position:absolute;
left:50%;
top:40px;
}
.share-title{
position:fixed;
left:0;
top:-100px;
}
p.myscore{
width:100%;
height:40px;
text-align:center;
color:white;
font-size:32px;
font-family:STHeiti;
position:absolute;
left:0;
top:80px;
}
.img-frame{
background-color:white;
border-radius:10px;
padding:8px 8px 5px 8px;
}
.fbb-img{
position:absolute;
z-index:1;
left:95px;
top:230px;
transform:rotate(-10deg);
-webkit-transform:rotate(-10deg);
}
.fbb-img > img{
height:270px;
}
.user-img{
position:absolute;
z-index:2;
left:160px;
top:190px;
transform:rotate(5deg);
-webkit-transform:rotate(5deg);
}
.user-img > img{
width:304px;
height:380px;
transition:opacity 0.3s;
-webkit-transition:opacity 0.3s;
}
.img-border-up{
width:310px;
height:5px;
background-color:white;
position:absolute;
z-index:3;
left:5px;
top:5px;
}
.img-border-down{
width:310px;
height:6px;
background-color:white;
position:absolute;
z-index:3;
left:5px;
bottom:4px;
}
.img-border-left{
width:5px;
height:386px;
background-color:white;
position:absolute;
z-index:3;
left:5px;
top:5px;
}
.img-border-right{
width:5px;
height:386px;
background-color:white;
position:absolute;
z-index:3;
right:5px;
top:5px;
}
.download-cover{
width:640px;
height:280px;
margin-left:-320px;
background:url(http://res.tu.qq.com/assets/opwumeiniang_img/cover_download.png?v=3) no-repeat 0 149px;
position:fixed;
z-index:81;
left:50%;
bottom:0;
}
.share-btn{
width:244px;
height:83px;
margin-left:-122px;
background:url(http://res.tu.qq.com/assets/opwumeiniang_img/btns.png?v=2) no-repeat -133px -2px;
position:absolute;
left:50%;
bottom:180px;
cursor:pointer;
}
.share-btn-qzone{
width:229px;
height:83px;
margin-left:-239px;
background:url(http://res.tu.qq.com/assets/opwumeiniang_img/btn_share_qzone.png) no-repeat;
position:absolute;
left:50%;
bottom:180px;
cursor:pointer;
}
.share-btn-wechat{
width:239px;
height:83px;
margin-left:10px;
background:url(http://res.tu.qq.com/assets/opwumeiniang_img/btn_share_wechat.png) no-repeat;
position:absolute;
left:50%;
bottom:180px;
cursor:pointer;
}
.play-btn{
width:244px;
height:83px;
margin-left:-122px;
background:url(http://res.tu.qq.com/assets/opwumeiniang_img/btns.png?v=2) no-repeat -133px -87px;
position:absolute;
left:50%;
bottom:180px;
cursor:pointer;
}
.rank-link-1{
width:160px;
height:28px;
margin-left:-150px;
text-align:center;
color:white;
font-size:22px;
font-family:FZLTHJW--GB1-0;
position:absolute;
left:50%;
bottom:132px;
cursor:pointer;
border-bottom: 2px solid white;
}
.rank-link-2{
width:160px;
height:28px;
margin-left:-80px;
text-align:center;
color:white;
font-size:22px;
font-family:FZLTHJW--GB1-0;
position:absolute;
left:50%;
bottom:132px;
cursor:pointer;
border-bottom: 2px solid white;
}
.retry-btn{
display:block;
width:94px;
height:28px;
margin-left:-47px;
text-align:center;
color:white;
font-size:22px;
font-family:FZLTHJW--GB1-0;
position:absolute;
left:50%;
bottom:132px;
border-bottom: 2px solid white;
cursor:pointer;
}
.download-btn{
width:640px;
height:90px;
position:absolute;
left:0;
bottom:0;
cursor:pointer;
}
.download-btn-2{
width:220px;
height:65px;
position:absolute;
right:0;
bottom:0;
cursor:pointer;
}
.share-bg{
width:100%;
height:100%;
background:black;
opacity:0.85;
filter:alpha(opacity=85);
position:fixed;
z-index:100;
left:0;
top:0;
}
.share-tips{
width:640px;
height:100%;
margin-left:-320px;
filter:alpha(opacity=50);
position:fixed;
z-index:101;
left:50%;
top:0;
}
.share-tips img{
position:absolute;
right:60px;
top:30px;
}
.share-tips p{
width:520px;
margin:0;
padding:0;
color:white;
font-size:38px;
font-family:FZLTZHK--GBK1-0;
position:absolute;
left:80px;
top:180px;
}
| island88/island88.github.io | test/h5/cosplay/css/pk.css | CSS | gpl-2.0 | 10,234 | [
30522,
2303,
1063,
1013,
1008,
1011,
4773,
23615,
1011,
3543,
1011,
2655,
5833,
1024,
3904,
1025,
1008,
1013,
1011,
4773,
23615,
1011,
5310,
1011,
7276,
1024,
3904,
1025,
7785,
1024,
1014,
1025,
11687,
4667,
1024,
1014,
1025,
2058,
12314,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 directory contains samples for VMC organization APIs:
Running the samples
$ python organization_operations.py -r <refresh_token>
* Testbed Requirement:
- At least one org associated with the calling user.
| pgbidkar/vsphere-automation-sdk-python | samples/vmc/orgs/README.md | Markdown | mit | 221 | [
30522,
2023,
14176,
3397,
8168,
2005,
1058,
12458,
3029,
17928,
2015,
1024,
2770,
1996,
8168,
1002,
18750,
3029,
1035,
3136,
1012,
1052,
2100,
1011,
1054,
1026,
25416,
21898,
1035,
19204,
1028,
1008,
3231,
8270,
9095,
1024,
1011,
2012,
2560... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 was automatically generated. Do not modify.
'use strict';
goog.provide('Blockly.Msg.id');
goog.require('Blockly.Msg');
Blockly.Msg.ADD_COMMENT = "Tambahkan sebuah comment";
Blockly.Msg.CHANGE_VALUE_TITLE = "Ubah nilai:";
Blockly.Msg.COLLAPSE_ALL = "Tutup blok";
Blockly.Msg.COLLAPSE_BLOCK = "Tutup blok";
Blockly.Msg.COLOUR_BLEND_COLOUR1 = "Warna 1";
Blockly.Msg.COLOUR_BLEND_COLOUR2 = "Warna 2";
Blockly.Msg.COLOUR_BLEND_HELPURL = "http://meyerweb.com/eric/tools/color-blend/";
Blockly.Msg.COLOUR_BLEND_RATIO = "rasio";
Blockly.Msg.COLOUR_BLEND_TITLE = "Tertutup";
Blockly.Msg.COLOUR_BLEND_TOOLTIP = "mencampur dua warna secara bersamaan dengan perbandingan (0.0-1.0).";
Blockly.Msg.COLOUR_PICKER_HELPURL = "https://en.wikipedia.org/wiki/Color";
Blockly.Msg.COLOUR_PICKER_TOOLTIP = "Pilih warna dari daftar warna.";
Blockly.Msg.COLOUR_RANDOM_HELPURL = "http://randomcolour.com"; // untranslated
Blockly.Msg.COLOUR_RANDOM_TITLE = "Warna acak";
Blockly.Msg.COLOUR_RANDOM_TOOLTIP = "Pilih warna secara acak.";
Blockly.Msg.COLOUR_RGB_BLUE = "biru";
Blockly.Msg.COLOUR_RGB_GREEN = "hijau";
Blockly.Msg.COLOUR_RGB_HELPURL = "http://www.december.com/html/spec/colorper.html";
Blockly.Msg.COLOUR_RGB_RED = "merah";
Blockly.Msg.COLOUR_RGB_TITLE = "Dengan warna";
Blockly.Msg.COLOUR_RGB_TOOLTIP = "Buatlah warna dengan jumlah yang ditentukan dari merah, hijau dan biru. Semua nilai harus antarai 0 sampai 100.";
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL = "https://code.google.com/p/blockly/wiki/Loops#Loop_Termination_Blocks";
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK = "Keluar dari perulangan";
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE = "Lanjutkan dengan langkah penggulangan berikutnya";
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK = "Keluar sementara dari perulanggan.";
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE = "Abaikan sisa dari loop ini, dan lanjutkan dengan iterasi berikutnya.";
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING = "Peringatan: Blok ini hanya dapat digunakan dalam loop.";
Blockly.Msg.CONTROLS_FOREACH_HELPURL = "https://code.google.com/p/blockly/wiki/Loops#for_each for each block";
Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST = "di dalam list";
Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST_TAIL = ""; // untranslated
Blockly.Msg.CONTROLS_FOREACH_INPUT_ITEM = "untuk setiap item";
Blockly.Msg.CONTROLS_FOREACH_TOOLTIP = "Untuk tiap-tiap item di dalam list, tetapkan variabel '%1' ke dalam item, selanjutnya kerjakan beberapa statement.";
Blockly.Msg.CONTROLS_FOR_HELPURL = "https://code.google.com/p/blockly/wiki/Loops#count_with";
Blockly.Msg.CONTROLS_FOR_INPUT_FROM_TO_BY = "dari %1 ke %2 dengan step / penambahan %3";
Blockly.Msg.CONTROLS_FOR_INPUT_WITH = "Cacah dengan";
Blockly.Msg.CONTROLS_FOR_TOOLTIP = "Menggunakan variabel %1 dengan mengambil nilai dari batas awal hingga ke batas akhir, dengan interval tertentu, dan mengerjakan block tertentu.";
Blockly.Msg.CONTROLS_IF_ELSEIF_TOOLTIP = "tambahkan prasyarat ke dalam blok IF.";
Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP = "Terakhir, tambahkan tangkap-semua kondisi kedalam blok jika (if).";
Blockly.Msg.CONTROLS_IF_HELPURL = "http://code.google.com/p/blockly/wiki/If_Then";
Blockly.Msg.CONTROLS_IF_IF_TOOLTIP = "Menambahkan, menghapus, atau menyusun kembali bagian untuk mengkonfigurasi blok IF ini.";
Blockly.Msg.CONTROLS_IF_MSG_ELSE = "else";
Blockly.Msg.CONTROLS_IF_MSG_ELSEIF = "else if";
Blockly.Msg.CONTROLS_IF_MSG_IF = "Jika";
Blockly.Msg.CONTROLS_IF_TOOLTIP_1 = "jika nilainya benar maka kerjakan perintah berikutnya.";
Blockly.Msg.CONTROLS_IF_TOOLTIP_2 = "jika nilainya benar, maka kerjakan blok perintah yang pertama. Jika tidak, kerjakan blok perintah yang kedua.";
Blockly.Msg.CONTROLS_IF_TOOLTIP_3 = "Jika nilai pertama adalah benar (true), maka lakukan perintah-perintah yang berada didalam blok pertama. Jika nilai kedua adalah benar (true), maka lakukan perintah-perintah yang berada didalam blok kedua.";
Blockly.Msg.CONTROLS_IF_TOOLTIP_4 = "Jika blok pertama adalah benar (true), maka lakukan perintah-perintah yang berada didalam blok pertama. Atau jika blok kedua adalah benar (true), maka lakukan perintah-perintah yang berada didalam blok kedua.";
Blockly.Msg.CONTROLS_REPEAT_HELPURL = "https://en.wikipedia.org/wiki/For_loop";
Blockly.Msg.CONTROLS_REPEAT_INPUT_DO = "kerjakan";
Blockly.Msg.CONTROLS_REPEAT_TITLE = "ulangi %1 kali";
Blockly.Msg.CONTROLS_REPEAT_TITLE_REPEAT = "ulangi";
Blockly.Msg.CONTROLS_REPEAT_TITLE_TIMES = "kali";
Blockly.Msg.CONTROLS_REPEAT_TOOLTIP = "Lakukan beberapa perintah beberapa kali.";
Blockly.Msg.CONTROLS_WHILEUNTIL_HELPURL = "http://code.google.com/p/blockly/wiki/Repeat";
Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL = "Ulangi sampai";
Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE = "Ulangi jika";
Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL = "Jika sementara nilai tidak benar (false), maka lakukan beberapa perintah.";
Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE = "Jika sementara nilai benar (true), maka lakukan beberapa perintah.";
Blockly.Msg.DELETE_BLOCK = "Hapus blok";
Blockly.Msg.DELETE_X_BLOCKS = "Hapus %1 blok";
Blockly.Msg.DISABLE_BLOCK = "Nonaktifkan blok";
Blockly.Msg.DUPLICATE_BLOCK = "Duplikat";
Blockly.Msg.ENABLE_BLOCK = "Aktifkan blok";
Blockly.Msg.EXPAND_ALL = "Kembangkan blok-blok";
Blockly.Msg.EXPAND_BLOCK = "Kembangkan blok";
Blockly.Msg.EXTERNAL_INPUTS = "Input-input eksternal";
Blockly.Msg.HELP = "Tolong";
Blockly.Msg.INLINE_INPUTS = "Input inline";
Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL = "https://en.wikipedia.org/wiki/Linked_list#Empty_lists";
Blockly.Msg.LISTS_CREATE_EMPTY_TITLE = "buat list kosong";
Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP = "Mengembalikan daftar, dengan panjang 0, tidak berisi data";
Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD = "list";
Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP = "Tambahkan, hapus, atau susun ulang bagian untuk mengkonfigurasi blok LIST (daftar) ini.";
Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH = "buat daftar (list) dengan";
Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP = "Tambahkan sebuah item ke daftar (list).";
Blockly.Msg.LISTS_CREATE_WITH_TOOLTIP = "Buat sebuah daftar (list) dengan sejumlah item.";
Blockly.Msg.LISTS_GET_INDEX_FIRST = "pertama";
Blockly.Msg.LISTS_GET_INDEX_FROM_END = "# dari akhir";
Blockly.Msg.LISTS_GET_INDEX_FROM_START = "#";
Blockly.Msg.LISTS_GET_INDEX_GET = "dapatkan";
Blockly.Msg.LISTS_GET_INDEX_GET_REMOVE = "dapatkan dan hapus";
Blockly.Msg.LISTS_GET_INDEX_LAST = "terakhir";
Blockly.Msg.LISTS_GET_INDEX_RANDOM = "acak";
Blockly.Msg.LISTS_GET_INDEX_REMOVE = "Hapus";
Blockly.Msg.LISTS_GET_INDEX_TAIL = ""; // untranslated
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST = "Kembalikan item pertama dalam daftar (list).";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM_END = "Sisipkan item ke dalam posisi yang telah ditentukan didalam list (daftar). Item pertama adalah item yang terakhir.";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM_START = "Sisipkan item ke dalam posisi yang telah ditentukan didalam list (daftar). Item pertama adalah item terakhir (yg paling akhir).";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST = "Mengembalikan item pertama dalam list (daftar).";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM = "Mengembalikan item acak dalam list (daftar).";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST = "Menghilangkan dan mengembalikan item pertama dalam list (daftar).";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM_END = "Menghilangkan dan mengembalikan barang di posisi tertentu dalam list (daftar). #1 adalah item terakhir.";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM_START = "Menghilangkan dan mengembalikan barang di posisi tertentu dalam list (daftar). #1 adalah item pertama.";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST = "Menghilangkan dan mengembalikan item terakhir dalam list (daftar).";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM = "Menghilangkan dan mengembalikan barang dengan acak dalam list (daftar).";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST = "Menghapus item pertama dalam daftar.";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM_END = "Menghapus item dengan posisi tertentu dalam daftar. Item pertama adalah item yang terakhir.";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM_START = "Menghapus item dengan posisi tertentu dalam daftar. Item pertama adalah item yang terakhir.";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST = "Menghapus item terakhir dalam daftar.";
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM = "Menghapus sebuah item secara acak dalam list.";
Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_END = "ke # dari akhir";
Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_START = "ke #";
Blockly.Msg.LISTS_GET_SUBLIST_END_LAST = "ke yang paling akhir";
Blockly.Msg.LISTS_GET_SUBLIST_HELPURL = "https://code.google.com/p/blockly/wiki/Lists#Getting_a_sublist";
Blockly.Msg.LISTS_GET_SUBLIST_START_FIRST = "Dapatkan bagian pertama dari list";
Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_END = "Dapatkan bagian list nomor # dari akhir";
Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_START = "Dapatkan bagian daftar dari #";
Blockly.Msg.LISTS_GET_SUBLIST_TAIL = ""; // untranslated
Blockly.Msg.LISTS_GET_SUBLIST_TOOLTIP = "Membuat salinan dari bagian tertentu dari list.";
Blockly.Msg.LISTS_INDEX_OF_FIRST = "cari kejadian pertama item";
Blockly.Msg.LISTS_INDEX_OF_HELPURL = "https://code.google.com/p/blockly/wiki/Lists#Getting_Items_from_a_List";
Blockly.Msg.LISTS_INDEX_OF_LAST = "Cari kejadian terakhir item";
Blockly.Msg.LISTS_INDEX_OF_TOOLTIP = "Mengembalikan indeks dari kejadian pertama/terakhir item dalam daftar. Menghasilkan 0 jika teks tidak ditemukan.";
Blockly.Msg.LISTS_INLIST = "dalam daftar";
Blockly.Msg.LISTS_IS_EMPTY_HELPURL = "https://code.google.com/p/blockly/wiki/Lists#is_empty";
Blockly.Msg.LISTS_IS_EMPTY_TITLE = "%1 kosong";
Blockly.Msg.LISTS_LENGTH_HELPURL = "https://code.google.com/p/blockly/wiki/Lists#length_of";
Blockly.Msg.LISTS_LENGTH_TITLE = "panjang dari %1";
Blockly.Msg.LISTS_LENGTH_TOOLTIP = "Mengembalikan panjang daftar.";
Blockly.Msg.LISTS_REPEAT_HELPURL = "https://code.google.com/p/blockly/wiki/Lists#create_list_with";
Blockly.Msg.LISTS_REPEAT_TITLE = "membuat daftar dengan item %1 diulang %2 kali";
Blockly.Msg.LISTS_REPEAT_TOOLTIP = "Ciptakan daftar yang terdiri dari nilai yang diberikan diulang jumlah waktu yang ditentukan.";
Blockly.Msg.LISTS_SET_INDEX_HELPURL = "https://code.google.com/p/blockly/wiki/Lists#in_list_..._set";
Blockly.Msg.LISTS_SET_INDEX_INPUT_TO = "sebagai";
Blockly.Msg.LISTS_SET_INDEX_INSERT = "sisipkan di";
Blockly.Msg.LISTS_SET_INDEX_SET = "tetapkan";
Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST = "Sisipkan item di bagian awal dari list.";
Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM_END = "Sisipkan item ke dalam posisi yang telah ditentukan di dalam list. #1 adalah item yang terakhir.";
Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM_START = "Sisipkan item ke dalam posisi yang telah ditentukan di dalam list. #1 adalah item yang pertama.";
Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST = "Tambahkan item ke bagian akhir list.";
Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM = "Sisipkan item secara acak ke dalam list.";
Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST = "Tetapkan item pertama di dalam list.";
Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM_END = "Tetapkan item ke dalam posisi yang telah ditentukan di dalam list. #1 adalah item yang terakhir.";
Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM_START = "Tetapkan item ke dalam posisi yang telah ditentukan di dalam list. #1 adalah item yang pertama.";
Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST = "Menetapkan item terakhir dalam list.";
Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM = "Tetapkan secara acak sebuah item dalam list.";
Blockly.Msg.LISTS_TOOLTIP = "Mengembalikan nilai benar (true) jika list kosong.";
Blockly.Msg.LOGIC_BOOLEAN_FALSE = "Salah";
Blockly.Msg.LOGIC_BOOLEAN_HELPURL = "http://code.google.com/p/blockly/wiki/True_False";
Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP = "Mengembalikan betul (true) atau salah (false).";
Blockly.Msg.LOGIC_BOOLEAN_TRUE = "Benar";
Blockly.Msg.LOGIC_COMPARE_HELPURL = "https://en.wikipedia.org/wiki/Inequality_(mathematics)";
Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ = "Mengembalikan betul jika input kedua-duanya sama dengan satu sama lain.";
Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT = "Mengembalikan nilai benar (true) jika input yang pertama lebih besar dari input yang kedua.";
Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE = "Mengembalikan nilai benar (true) jika input yang pertama lebih besar dari atau sama dengan input yang kedua.";
Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT = "Mengembalikan nilai benar (true) jika input yang pertama lebih kecil dari input yang kedua.";
Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE = "Mengembalikan nilai benar (true) jika input yang pertama lebih kecil atau sama dengan input yang kedua .";
Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ = "Mengembalikan nilai benar (true) jika kedua input tidak sama satu dengan yang lain.";
Blockly.Msg.LOGIC_NEGATE_HELPURL = "http://code.google.com/p/blockly/wiki/Not";
Blockly.Msg.LOGIC_NEGATE_TITLE = "bukan (not) %1";
Blockly.Msg.LOGIC_NEGATE_TOOLTIP = "Mengembalikan nilai benar (true) jika input false. Mengembalikan nilai salah (false) jika input true.";
Blockly.Msg.LOGIC_NULL = "null";
Blockly.Msg.LOGIC_NULL_HELPURL = "https://en.wikipedia.org/wiki/Nullable_type";
Blockly.Msg.LOGIC_NULL_TOOLTIP = "mengembalikan kosong.";
Blockly.Msg.LOGIC_OPERATION_AND = "dan";
Blockly.Msg.LOGIC_OPERATION_HELPURL = "http://code.google.com/p/blockly/wiki/And_Or";
Blockly.Msg.LOGIC_OPERATION_OR = "atau";
Blockly.Msg.LOGIC_OPERATION_TOOLTIP_AND = "Kembalikan betul jika kedua-dua input adalah betul.";
Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR = "Mengembalikan nilai benar (true) jika setidaknya salah satu masukan nilainya benar (true).";
Blockly.Msg.LOGIC_TERNARY_CONDITION = "test";
Blockly.Msg.LOGIC_TERNARY_HELPURL = "https://en.wikipedia.org/wiki/%3F:";
Blockly.Msg.LOGIC_TERNARY_IF_FALSE = "jika tidak benar (false)";
Blockly.Msg.LOGIC_TERNARY_IF_TRUE = "jika benar (true)";
Blockly.Msg.LOGIC_TERNARY_TOOLTIP = "Periksa kondisi di \"test\". Jika kondisi benar (true), mengembalikan nilai \"jika benar\" ; Jik sebaliknya akan mengembalikan nilai \"jika salah\".";
Blockly.Msg.MATH_ADDITION_SYMBOL = "+";
Blockly.Msg.MATH_ARITHMETIC_HELPURL = "https://id.wikipedia.org/wiki/Aritmetika";
Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_ADD = "Kembalikan jumlah dari kedua angka.";
Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE = "Kembalikan hasil bagi dari kedua angka.";
Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS = "Kembalikan selisih dari kedua angka.";
Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY = "Kembalikan perkalian dari kedua angka.";
Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_POWER = "Kembalikan angka pertama pangkat angka kedua.";
Blockly.Msg.MATH_CHANGE_HELPURL = "https://en.wikipedia.org/wiki/Programming_idiom#Incrementing_a_counter";
Blockly.Msg.MATH_CHANGE_INPUT_BY = "oleh";
Blockly.Msg.MATH_CHANGE_TITLE_CHANGE = "ubah";
Blockly.Msg.MATH_CHANGE_TOOLTIP = "Tambahkan angka kedalam variabel '%1'.";
Blockly.Msg.MATH_CONSTANT_HELPURL = "https://en.wikipedia.org/wiki/Mathematical_constant";
Blockly.Msg.MATH_CONSTANT_TOOLTIP = "Kembalikan salah satu konstant: π (3.141…), e (2.718…), φ (1.618…), sqrt(2) (1.414…), sqrt(½) (0.707…), atau ∞ (infinity).";
Blockly.Msg.MATH_CONSTRAIN_HELPURL = "https://en.wikipedia.org/wiki/Clamping_%28graphics%29";
Blockly.Msg.MATH_CONSTRAIN_TITLE = "Batasi %1 rendah %2 tinggi %3";
Blockly.Msg.MATH_CONSTRAIN_TOOLTIP = "Batasi angka antara batas yang ditentukan (inklusif).";
Blockly.Msg.MATH_DIVISION_SYMBOL = "÷";
Blockly.Msg.MATH_IS_DIVISIBLE_BY = "dibagi oleh";
Blockly.Msg.MATH_IS_EVEN = "adalah bilangan genap";
Blockly.Msg.MATH_IS_NEGATIVE = "adalah bilangan negatif";
Blockly.Msg.MATH_IS_ODD = "adalah bilangan ganjil";
Blockly.Msg.MATH_IS_POSITIVE = "adalah bilangan positif";
Blockly.Msg.MATH_IS_PRIME = "adalah bilangan pokok";
Blockly.Msg.MATH_IS_TOOLTIP = "Periksa apakah angka adalah bilangan genap, bilangan pokok, bilangan bulat, bilangan positif, bilangan negatif, atau apakan bisa dibagi oleh angka tertentu. Mengembalikan benar (true) atau salah (false).";
Blockly.Msg.MATH_IS_WHOLE = "adalah bilangan bulat";
Blockly.Msg.MATH_MODULO_HELPURL = "https://en.wikipedia.org/wiki/Modulo_operation";
Blockly.Msg.MATH_MODULO_TITLE = "sisa %1 ÷ %2";
Blockly.Msg.MATH_MODULO_TOOLTIP = "Kembalikan sisa dari pembagian ke dua angka.";
Blockly.Msg.MATH_MULTIPLICATION_SYMBOL = "×";
Blockly.Msg.MATH_NUMBER_HELPURL = "https://en.wikipedia.org/wiki/Number";
Blockly.Msg.MATH_NUMBER_TOOLTIP = "Suatu angka.";
Blockly.Msg.MATH_ONLIST_HELPURL = ""; // untranslated
Blockly.Msg.MATH_ONLIST_OPERATOR_AVERAGE = "rata-rata dari list (daftar)";
Blockly.Msg.MATH_ONLIST_OPERATOR_MAX = "maximum dari list (daftar)";
Blockly.Msg.MATH_ONLIST_OPERATOR_MEDIAN = "median dari list (daftar)";
Blockly.Msg.MATH_ONLIST_OPERATOR_MIN = "minimum dari list (daftar)";
Blockly.Msg.MATH_ONLIST_OPERATOR_MODE = "mode-mode dari list (daftar)";
Blockly.Msg.MATH_ONLIST_OPERATOR_RANDOM = "item acak dari list (daftar)";
Blockly.Msg.MATH_ONLIST_OPERATOR_STD_DEV = "deviasi standar dari list (daftar)";
Blockly.Msg.MATH_ONLIST_OPERATOR_SUM = "jumlah dari list (daftar)";
Blockly.Msg.MATH_ONLIST_TOOLTIP_AVERAGE = "Kembalikan rata-rata (mean aritmetik) dari nilai numerik dari list (daftar).";
Blockly.Msg.MATH_ONLIST_TOOLTIP_MAX = "Kembalikan angka terbesar dari list.";
Blockly.Msg.MATH_ONLIST_TOOLTIP_MEDIAN = "Kembalikan median dari list.";
Blockly.Msg.MATH_ONLIST_TOOLTIP_MIN = "Kembalikan angka terkecil dari list.";
Blockly.Msg.MATH_ONLIST_TOOLTIP_MODE = "Kembalikan list berisi item-item yang paling umum dari dalam list.";
Blockly.Msg.MATH_ONLIST_TOOLTIP_RANDOM = "Kembalikan element acak dari list.";
Blockly.Msg.MATH_ONLIST_TOOLTIP_STD_DEV = "Kembalikan standard deviasi dari list.";
Blockly.Msg.MATH_ONLIST_TOOLTIP_SUM = "Kembalikan jumlah dari seluruh bilangan dari list.";
Blockly.Msg.MATH_POWER_SYMBOL = "^";
Blockly.Msg.MATH_RANDOM_FLOAT_HELPURL = "https://en.wikipedia.org/wiki/Random_number_generation";
Blockly.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM = "Nilai pecahan acak";
Blockly.Msg.MATH_RANDOM_FLOAT_TOOLTIP = "Mengembalikan nilai acak pecahan antara 0.0 (inklusif) dan 1.0 (ekslusif).";
Blockly.Msg.MATH_RANDOM_INT_HELPURL = "https://en.wikipedia.org/wiki/Random_number_generation";
Blockly.Msg.MATH_RANDOM_INT_TITLE = "acak bulat dari %1 sampai %2";
Blockly.Msg.MATH_RANDOM_INT_TOOLTIP = "Mengembalikan bilangan acak antara dua batas yang ditentukan, inklusif.";
Blockly.Msg.MATH_ROUND_HELPURL = "https://en.wikipedia.org/wiki/Rounding";
Blockly.Msg.MATH_ROUND_OPERATOR_ROUND = "membulatkan";
Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN = "membulatkan kebawah";
Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDUP = "mengumpulkan";
Blockly.Msg.MATH_ROUND_TOOLTIP = "Bulatkan suatu bilangan naik atau turun.";
Blockly.Msg.MATH_SINGLE_HELPURL = "https://en.wikipedia.org/wiki/Square_root";
Blockly.Msg.MATH_SINGLE_OP_ABSOLUTE = "mutlak";
Blockly.Msg.MATH_SINGLE_OP_ROOT = "akar";
Blockly.Msg.MATH_SINGLE_TOOLTIP_ABS = "Kembalikan nilai absolut angka.";
Blockly.Msg.MATH_SINGLE_TOOLTIP_EXP = "Kembalikan 10 pangkat angka.";
Blockly.Msg.MATH_SINGLE_TOOLTIP_LN = "Kembalikan logaritma natural dari angka.";
Blockly.Msg.MATH_SINGLE_TOOLTIP_LOG10 = "Kembalikan dasar logaritma 10 dari angka.";
Blockly.Msg.MATH_SINGLE_TOOLTIP_NEG = "Kembalikan penyangkalan terhadap angka.";
Blockly.Msg.MATH_SINGLE_TOOLTIP_POW10 = "Kembalikan 10 pangkat angka.";
Blockly.Msg.MATH_SINGLE_TOOLTIP_ROOT = "Kembalikan akar dari angka.";
Blockly.Msg.MATH_SUBTRACTION_SYMBOL = "-";
Blockly.Msg.MATH_TRIG_ACOS = "acos";
Blockly.Msg.MATH_TRIG_ASIN = "asin";
Blockly.Msg.MATH_TRIG_ATAN = "atan";
Blockly.Msg.MATH_TRIG_COS = "cos";
Blockly.Msg.MATH_TRIG_HELPURL = "https://en.wikipedia.org/wiki/Trigonometric_functions";
Blockly.Msg.MATH_TRIG_SIN = "sin";
Blockly.Msg.MATH_TRIG_TAN = "tan";
Blockly.Msg.MATH_TRIG_TOOLTIP_ACOS = "Kembalikan acosine dari angka.";
Blockly.Msg.MATH_TRIG_TOOLTIP_ASIN = "Kembalikan asin dari angka.";
Blockly.Msg.MATH_TRIG_TOOLTIP_ATAN = "Kembalikan atan dari angka.";
Blockly.Msg.MATH_TRIG_TOOLTIP_COS = "Kembalikan cos dari derajat (bukan radian).";
Blockly.Msg.MATH_TRIG_TOOLTIP_SIN = "Kembalikan sinus dari derajat (bukan radian).";
Blockly.Msg.MATH_TRIG_TOOLTIP_TAN = "Kembalikan tangen dari derajat (tidak radian).";
Blockly.Msg.NEW_VARIABLE = "Pembolehubah baru...";
Blockly.Msg.NEW_VARIABLE_TITLE = "Nama pembolehubah baru:";
Blockly.Msg.ORDINAL_NUMBER_SUFFIX = ""; // untranslated
Blockly.Msg.PROCEDURES_BEFORE_PARAMS = "dengan:";
Blockly.Msg.PROCEDURES_CALLNORETURN_CALL = ""; // untranslated
Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29";
Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP = "Menjalankan fungsi '%1' yang ditetapkan pengguna.";
Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29";
Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP = "Menjalankan fungsi '%1' yang ditetapkan pengguna dan menggunakan outputnya.";
Blockly.Msg.PROCEDURES_CREATE_DO = "Buat '%1'";
Blockly.Msg.PROCEDURES_DEFNORETURN_DO = ""; // untranslated
Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29";
Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE = "buat sesuatu";
Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE = "untuk";
Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP = "Menciptakan sebuah fungsi dengan tiada output.";
Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29";
Blockly.Msg.PROCEDURES_DEFRETURN_RETURN = "kembali";
Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP = "Menciptakan sebuah fungsi dengan satu output.";
Blockly.Msg.PROCEDURES_DEF_DUPLICATE_WARNING = "Peringatan: Fungsi ini memiliki parameter duplikat.";
Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF = "Sorot definisi fungsi";
Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP = "Jika nilai yang benar, kemudian kembalikan nilai kedua.";
Blockly.Msg.PROCEDURES_IFRETURN_WARNING = "Peringatan: Blok ini dapat digunakan hanya dalam definisi fungsi.";
Blockly.Msg.PROCEDURES_MUTATORARG_TITLE = "masukan Nama:";
Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE = "input";
Blockly.Msg.REMOVE_COMMENT = "Hapus komentar";
Blockly.Msg.RENAME_VARIABLE = "namai ulang variabel...";
Blockly.Msg.RENAME_VARIABLE_TITLE = "Ubah nama semua variabel '%1' menjadi:";
Blockly.Msg.TEXT_APPEND_APPENDTEXT = "tambahkan teks";
Blockly.Msg.TEXT_APPEND_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Text_modification";
Blockly.Msg.TEXT_APPEND_TO = "untuk";
Blockly.Msg.TEXT_APPEND_TOOLTIP = "Tambahkan beberapa teks ke variabel '%1'.";
Blockly.Msg.TEXT_CHANGECASE_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Adjusting_text_case";
Blockly.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE = "menjadi huruf kecil";
Blockly.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE = "menjadi huruf pertama kapital";
Blockly.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE = "menjadi huruf kapital";
Blockly.Msg.TEXT_CHANGECASE_TOOLTIP = "Kembalikan kopi dari text dengan kapitalisasi yang berbeda.";
Blockly.Msg.TEXT_CHARAT_FIRST = "ambil huruf pertama";
Blockly.Msg.TEXT_CHARAT_FROM_END = "ambil huruf nomor # dari belakang";
Blockly.Msg.TEXT_CHARAT_FROM_START = "ambil huruf ke #";
Blockly.Msg.TEXT_CHARAT_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Extracting_text";
Blockly.Msg.TEXT_CHARAT_INPUT_INTEXT = "dalam teks";
Blockly.Msg.TEXT_CHARAT_LAST = "ambil huruf terakhir";
Blockly.Msg.TEXT_CHARAT_RANDOM = "ambil huruf secara acak";
Blockly.Msg.TEXT_CHARAT_TAIL = ""; // untranslated
Blockly.Msg.TEXT_CHARAT_TOOLTIP = "Kembalikan karakter dari posisi tertentu.";
Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP = "Tambahkan suatu item ke dalam teks.";
Blockly.Msg.TEXT_CREATE_JOIN_TITLE_JOIN = "join";
Blockly.Msg.TEXT_CREATE_JOIN_TOOLTIP = "Tambah, ambil, atau susun ulang teks blok.";
Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_END = "pada huruf nomer # dari terakhir";
Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_START = "pada huruf #";
Blockly.Msg.TEXT_GET_SUBSTRING_END_LAST = "pada huruf terakhir";
Blockly.Msg.TEXT_GET_SUBSTRING_HELPURL = "http://code.google.com/p/blockly/wiki/Text#Extracting_a_region_of_text";
Blockly.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT = "in teks";
Blockly.Msg.TEXT_GET_SUBSTRING_START_FIRST = "ambil bagian teks (substring) dari huruf pertama";
Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_END = "ambil bagian teks (substring) dari huruf ke # dari terakhir";
Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_START = "ambil bagian teks (substring) dari huruf no #";
Blockly.Msg.TEXT_GET_SUBSTRING_TAIL = ""; // untranslated
Blockly.Msg.TEXT_GET_SUBSTRING_TOOLTIP = "Mengembalikan spesifik bagian dari teks.";
Blockly.Msg.TEXT_INDEXOF_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Finding_text";
Blockly.Msg.TEXT_INDEXOF_INPUT_INTEXT = "dalam teks";
Blockly.Msg.TEXT_INDEXOF_OPERATOR_FIRST = "temukan kejadian pertama dalam teks";
Blockly.Msg.TEXT_INDEXOF_OPERATOR_LAST = "temukan kejadian terakhir dalam teks";
Blockly.Msg.TEXT_INDEXOF_TAIL = ""; // untranslated
Blockly.Msg.TEXT_INDEXOF_TOOLTIP = "Kembalikan indeks pertama dan terakhir dari kejadian pertama/terakhir dari teks pertama dalam teks kedua. Kembalikan 0 jika teks tidak ditemukan.";
Blockly.Msg.TEXT_ISEMPTY_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Checking_for_empty_text";
Blockly.Msg.TEXT_ISEMPTY_TITLE = "%1 kosong";
Blockly.Msg.TEXT_ISEMPTY_TOOLTIP = "Kembalikan benar (true) jika teks yang disediakan kosong.";
Blockly.Msg.TEXT_JOIN_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Text_creation";
Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH = "Buat teks dengan";
Blockly.Msg.TEXT_JOIN_TOOLTIP = "Buat teks dengan cara gabungkan sejumlah item.";
Blockly.Msg.TEXT_LENGTH_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Text_modification";
Blockly.Msg.TEXT_LENGTH_TITLE = "panjang dari %1";
Blockly.Msg.TEXT_LENGTH_TOOLTIP = "Kembalikan sejumlah huruf (termasuk spasi) dari teks yang disediakan.";
Blockly.Msg.TEXT_PRINT_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Printing_text";
Blockly.Msg.TEXT_PRINT_TITLE = "cetak %1";
Blockly.Msg.TEXT_PRINT_TOOLTIP = "Cetak teks yant ditentukan, angka atau ninlai lainnya.";
Blockly.Msg.TEXT_PROMPT_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Getting_input_from_the_user";
Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER = "Meminta pengguna untuk memberi sebuah angka.";
Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT = "Meminta pengguna untuk memberi beberapa teks.";
Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER = "Meminta angka dengan pesan";
Blockly.Msg.TEXT_PROMPT_TYPE_TEXT = "meminta teks dengan pesan";
Blockly.Msg.TEXT_TEXT_HELPURL = "https://en.wikipedia.org/wiki/String_(computer_science)";
Blockly.Msg.TEXT_TEXT_TOOLTIP = "Huruf, kata atau baris teks.";
Blockly.Msg.TEXT_TRIM_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Trimming_%28removing%29_spaces";
Blockly.Msg.TEXT_TRIM_OPERATOR_BOTH = "pangkas ruang dari kedua belah sisi";
Blockly.Msg.TEXT_TRIM_OPERATOR_LEFT = "pangkas ruang dari sisi kiri";
Blockly.Msg.TEXT_TRIM_OPERATOR_RIGHT = "pangkas ruang dari sisi kanan";
Blockly.Msg.TEXT_TRIM_TOOLTIP = "Kembali salinan teks dengan spasi dihapus dari satu atau kedua ujungnya.";
Blockly.Msg.VARIABLES_DEFAULT_NAME = "item";
Blockly.Msg.VARIABLES_GET_CREATE_SET = "Membuat 'tetapkan %1'";
Blockly.Msg.VARIABLES_GET_HELPURL = "http://code.google.com/p/blockly/wiki/Variables#Get";
Blockly.Msg.VARIABLES_GET_TAIL = ""; // untranslated
Blockly.Msg.VARIABLES_GET_TITLE = ""; // untranslated
Blockly.Msg.VARIABLES_GET_TOOLTIP = "Mengembalikan nilai variabel ini.";
Blockly.Msg.VARIABLES_SET_CREATE_GET = "Membuat 'dapatkan %1'";
Blockly.Msg.VARIABLES_SET_HELPURL = "http://code.google.com/p/blockly/wiki/Variables#Set";
Blockly.Msg.VARIABLES_SET_TAIL = "untuk";
Blockly.Msg.VARIABLES_SET_TITLE = "tetapkan";
Blockly.Msg.VARIABLES_SET_TOOLTIP = "tetapkan variabel ini dengan input yang sama.";
Blockly.Msg.PROCEDURES_DEFRETURN_TITLE = Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE;
Blockly.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST;
Blockly.Msg.LISTS_SET_INDEX_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST;
Blockly.Msg.PROCEDURES_DEFRETURN_PROCEDURE = Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE;
Blockly.Msg.VARIABLES_SET_ITEM = Blockly.Msg.VARIABLES_DEFAULT_NAME;
Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE = Blockly.Msg.VARIABLES_DEFAULT_NAME;
Blockly.Msg.MATH_CHANGE_TITLE_ITEM = Blockly.Msg.VARIABLES_DEFAULT_NAME;
Blockly.Msg.VARIABLES_GET_ITEM = Blockly.Msg.VARIABLES_DEFAULT_NAME;
Blockly.Msg.PROCEDURES_DEFRETURN_DO = Blockly.Msg.PROCEDURES_DEFNORETURN_DO;
Blockly.Msg.LISTS_GET_INDEX_HELPURL = Blockly.Msg.LISTS_INDEX_OF_HELPURL;
Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM = Blockly.Msg.VARIABLES_DEFAULT_NAME;
Blockly.Msg.CONTROLS_IF_MSG_THEN = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO;
Blockly.Msg.LISTS_INDEX_OF_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST;
Blockly.Msg.PROCEDURES_CALLRETURN_CALL = Blockly.Msg.PROCEDURES_CALLNORETURN_CALL;
Blockly.Msg.LISTS_GET_INDEX_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST;
Blockly.Msg.CONTROLS_FOR_INPUT_DO = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO;
Blockly.Msg.CONTROLS_FOREACH_INPUT_DO = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO;
Blockly.Msg.CONTROLS_IF_IF_TITLE_IF = Blockly.Msg.CONTROLS_IF_MSG_IF;
Blockly.Msg.CONTROLS_WHILEUNTIL_INPUT_DO = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO;
Blockly.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF = Blockly.Msg.CONTROLS_IF_MSG_ELSEIF;
Blockly.Msg.TEXT_APPEND_VARIABLE = Blockly.Msg.VARIABLES_DEFAULT_NAME;
Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE; | TechplexEngineer/blockly-old | msg/js/id.js | JavaScript | apache-2.0 | 29,832 | [
30522,
1013,
1013,
2023,
5371,
2001,
8073,
7013,
1012,
2079,
2025,
19933,
1012,
1005,
2224,
9384,
1005,
1025,
27571,
2290,
1012,
3073,
1006,
1005,
3796,
2135,
1012,
5796,
2290,
1012,
8909,
1005,
1007,
1025,
27571,
2290,
1012,
5478,
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... |
namespace EVTC_Log_Parser.Model
{
public class Interval
{
public int Start { get; set; }
public int End { get; set; }
}
}
| M4xZ3r0/GW2RaidTool | GW2RaidTool/EVTC-Log-Parser/Model/Data/Skill/Interval.cs | C# | mit | 153 | [
30522,
3415,
15327,
23408,
13535,
1035,
8833,
1035,
11968,
8043,
1012,
2944,
1063,
2270,
2465,
13483,
1063,
2270,
20014,
2707,
1063,
2131,
1025,
2275,
1025,
1065,
2270,
20014,
2203,
1063,
2131,
1025,
2275,
1025,
1065,
1065,
1065,
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,
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) 2018 Raffaele Conforti (www.raffaeleconforti.com)
*
* 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 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.vogella.algorithms.dijkstra.engine;
import de.vogella.algorithms.dijkstra.model.Edge;
import de.vogella.algorithms.dijkstra.model.Graph;
import de.vogella.algorithms.dijkstra.model.Vertex;
import org.eclipse.collections.impl.map.mutable.UnifiedMap;
import org.eclipse.collections.impl.set.mutable.UnifiedSet;
import java.util.*;
public class DijkstraAlgorithm {
private final List<Edge> edges;
private Set<Vertex> settledNodes;
private Set<Vertex> unSettledNodes;
private Map<Vertex, Vertex> predecessors;
private Map<Vertex, Integer> distance;
public DijkstraAlgorithm(Graph graph) {
// create a copy of the array so that we can operate on this array
this.edges = new ArrayList<Edge>(graph.getEdges());
}
public void execute(Vertex source) {
settledNodes = new UnifiedSet<Vertex>();
unSettledNodes = new UnifiedSet<Vertex>();
distance = new UnifiedMap<Vertex, Integer>();
predecessors = new UnifiedMap<Vertex, Vertex>();
distance.put(source, 0);
unSettledNodes.add(source);
while (unSettledNodes.size() > 0) {
Vertex node = getMinimum(unSettledNodes);
settledNodes.add(node);
unSettledNodes.remove(node);
findMinimalDistances(node);
}
}
private void findMinimalDistances(Vertex node) {
List<Vertex> adjacentNodes = getNeighbors(node);
for (Vertex target : adjacentNodes) {
if (getShortestDistance(target) > getShortestDistance(node)
+ getDistance(node, target)) {
distance.put(target, getShortestDistance(node)
+ getDistance(node, target));
predecessors.put(target, node);
unSettledNodes.add(target);
}
}
}
private int getDistance(Vertex node, Vertex target) {
for (Edge edge : edges) {
if (edge.getSource().equals(node)
&& edge.getDestination().equals(target)) {
return edge.getWeight();
}
}
throw new RuntimeException("Should not happen");
}
private List<Vertex> getNeighbors(Vertex node) {
List<Vertex> neighbors = new ArrayList<Vertex>();
for (Edge edge : edges) {
if (edge.getSource().equals(node)
&& !isSettled(edge.getDestination())) {
neighbors.add(edge.getDestination());
}
}
return neighbors;
}
private Vertex getMinimum(Set<Vertex> vertexes) {
Vertex minimum = null;
for (Vertex vertex : vertexes) {
if (minimum == null) {
minimum = vertex;
} else {
if (getShortestDistance(vertex) < getShortestDistance(minimum)) {
minimum = vertex;
}
}
}
return minimum;
}
private boolean isSettled(Vertex vertex) {
return settledNodes.contains(vertex);
}
private int getShortestDistance(Vertex destination) {
Integer d = distance.get(destination);
if (d == null) {
return Integer.MAX_VALUE;
} else {
return d;
}
}
/*
* This method returns the path from the source to the selected target and
* NULL if no path exists
*/
public ArrayList<Vertex> getPath(Vertex target) {
ArrayList<Vertex> path = new ArrayList<Vertex>();
Vertex step = target;
// check if a path exists
if (predecessors.get(step) == null) {
return null;
}
path.add(step);
while (predecessors.get(step) != null) {
step = predecessors.get(step);
path.add(step);
}
// Put it into the correct order
Collections.reverse(path);
return path;
}
} | raffaeleconforti/ResearchCode | graph-algorithms/src/main/java/de/vogella/algorithms/dijkstra/engine/DijkstraAlgorithm.java | Java | lgpl-3.0 | 4,662 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2760,
7148,
7011,
12260,
9530,
13028,
2072,
1006,
7479,
1012,
7148,
7011,
12260,
8663,
13028,
2072,
1012,
4012,
1007,
1008,
30524,
1008,
1996,
2489,
4007,
3192,
1010,
2593,
2544,
1017,
1997,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
namespace MiniORM
{
using System;
using System.Linq;
using System.Reflection;
internal static class ReflectionHelper
{
public static void ReplaceBackingField(object sourceObj, string propertyName, object targetObj)
{
var backingField = sourceObj.GetType()
.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.SetField)
.First(fi => fi.Name == $"<{propertyName}>k__BackingField");
backingField.SetValue(sourceObj, targetObj);
}
public static bool HasAttribute<T>(this MemberInfo mi)
where T : Attribute
{
var hasAttribute = mi.GetCustomAttribute<T>() != null;
return hasAttribute;
}
}
} | MrPIvanov/SoftUni | 12-Databases Advanced - Entity Framework/06-EXERCISE ORM FUNDAMENTALS/Solution/MiniORM/ReflectionHelper.cs | C# | mit | 652 | [
30522,
3415,
15327,
7163,
2953,
2213,
1063,
2478,
2291,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
9185,
1025,
4722,
10763,
2465,
9185,
16001,
4842,
1063,
2270,
10763,
11675,
5672,
5963,
2075,
3790,
1006,
4874,
3120,
16429... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Xunit;
namespace System.Globalization.Tests
{
public class StringInfoGetTextElementEnumerator
{
public static IEnumerable<object[]> GetTextElementEnumerator_TestData()
{
yield return new object[] { "", 0, new string[0] }; // Empty string
yield return new object[] { "Hello", 5, new string[0] }; // Index = string.Length
// Surrogate pair
yield return new object[] { "s\uDBFF\uDFFF$", 0, new string[] { "s", "\uDBFF\uDFFF", "$" } };
yield return new object[] { "s\uDBFF\uDFFF$", 1, new string[] { "\uDBFF\uDFFF", "$" } };
// Combining characters
yield return new object[] { "13229^a\u20D1a", 6, new string[] { "a\u20D1", "a" } };
yield return new object[] { "13229^a\u20D1a", 0, new string[] { "1", "3", "2", "2", "9", "^", "a\u20D1", "a" } };
// Single base and combining character
yield return new object[] { "a\u0300", 0, new string[] { "a\u0300" } };
yield return new object[] { "a\u0300", 1, new string[] { "\u0300" } };
// Lone combining character
yield return new object[] { "\u0300\u0300", 0, new string[] { "\u0300", "\u0300" } };
}
[Theory]
[MemberData(nameof(GetTextElementEnumerator_TestData))]
public void GetTextElementEnumerator(string str, int index, string[] expected)
{
if (index == 0)
{
TextElementEnumerator basicEnumerator = StringInfo.GetTextElementEnumerator(str);
int basicCounter = 0;
while (basicEnumerator.MoveNext())
{
Assert.Equal(expected[basicCounter], basicEnumerator.Current.ToString());
basicCounter++;
}
Assert.Equal(expected.Length, basicCounter);
}
TextElementEnumerator indexedEnumerator = StringInfo.GetTextElementEnumerator(str, index);
int indexedCounter = 0;
while (indexedEnumerator.MoveNext())
{
Assert.Equal(expected[indexedCounter], indexedEnumerator.Current.ToString());
indexedCounter++;
}
Assert.Equal(expected.Length, indexedCounter);
}
[Fact]
public void GetTextElementEnumerator_Invalid()
{
Assert.Throws<ArgumentNullException>("str", () => StringInfo.GetTextElementEnumerator(null)); // Str is null
Assert.Throws<ArgumentNullException>("str", () => StringInfo.GetTextElementEnumerator(null, 0)); // Str is null
Assert.Throws<ArgumentOutOfRangeException>("index", () => StringInfo.GetTextElementEnumerator("abc", -1)); // Index < 0
Assert.Throws<ArgumentOutOfRangeException>("index", () => StringInfo.GetTextElementEnumerator("abc", 4)); // Index > str.Length
}
}
}
| ellismg/corefx | src/System.Globalization/tests/StringInfo/StringInfoGetTextElementEnumerator.cs | C# | mit | 3,157 | [
30522,
1013,
1013,
7000,
2000,
1996,
1012,
5658,
3192,
2104,
2028,
2030,
2062,
10540,
1012,
1013,
1013,
1996,
1012,
5658,
3192,
15943,
2023,
5371,
2000,
2017,
2104,
1996,
10210,
6105,
1012,
1013,
1013,
2156,
1996,
6105,
5371,
1999,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is of the same format as file that generated by
// base/android/jni_generator/jni_generator.py
// For
// com/google/vr/cardboard/DisplaySynchronizer
// Local modification includes:
// 1. Remove all implementaiton, only keep definition.
// 2. Use absolute path instead of relative path.
// 3. Removed all helper functions such as: Create.
// 4. Added function RegisterDisplaySynchronizerNatives at the end of this file.
#ifndef com_google_vr_cardboard_DisplaySynchronizer_JNI
#define com_google_vr_cardboard_DisplaySynchronizer_JNI
#include "base/android/jni_android.h"
// ----------------------------------------------------------------------------
// Native JNI methods
// ----------------------------------------------------------------------------
#include <jni.h>
#include <atomic>
#include <type_traits>
#include "base/android/jni_generator/jni_generator_helper.h"
#include "base/android/jni_int_wrapper.h"
// Step 1: forward declarations.
namespace {
const char kDisplaySynchronizerClassPath[] =
"com/google/vr/cardboard/DisplaySynchronizer";
// Leaking this jclass as we cannot use LazyInstance from some threads.
std::atomic<jclass> g_DisplaySynchronizer_clazz __attribute__((unused))
(nullptr);
#define DisplaySynchronizer_clazz(env) \
base::android::LazyGetClass(env, kDisplaySynchronizerClassPath, \
&g_DisplaySynchronizer_clazz)
} // namespace
namespace DisplaySynchronizer {
extern "C" __attribute__((visibility("default"))) jlong
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeCreate(
JNIEnv* env,
jobject jcaller,
jclass classLoader,
jobject appContext);
// Step 2: method stubs.
extern "C" __attribute__((visibility("default"))) void
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeDestroy(
JNIEnv* env,
jobject jcaller,
jlong nativeDisplaySynchronizer);
extern "C" __attribute__((visibility("default"))) void
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeReset(
JNIEnv* env,
jobject jcaller,
jlong nativeDisplaySynchronizer,
jlong expectedInterval,
jlong vsyncOffset);
extern "C" __attribute__((visibility("default"))) void
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeUpdate(
JNIEnv* env,
jobject jcaller,
jlong nativeDisplaySynchronizer,
jlong syncTime,
jint currentRotation);
extern "C" __attribute__((visibility("default"))) void
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeOnMetricsChanged(
JNIEnv* env,
jobject obj,
jlong native_object);
// Step 3: RegisterNatives.
static const JNINativeMethod kMethodsDisplaySynchronizer[] = {
{"nativeCreate",
"("
"Ljava/lang/ClassLoader;"
"Landroid/content/Context;"
")"
"J",
reinterpret_cast<void*>(
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeCreate)},
{"nativeDestroy",
"("
"J"
")"
"V",
reinterpret_cast<void*>(
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeDestroy)},
{"nativeReset",
"("
"J"
"J"
"J"
")"
"V",
reinterpret_cast<void*>(
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeReset)},
{"nativeUpdate",
"("
"J"
"J"
"I"
")"
"V",
reinterpret_cast<void*>(
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeUpdate)},
{"nativeOnMetricsChanged",
"("
"J"
")"
"V",
reinterpret_cast<void*>(
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeOnMetricsChanged)},
};
static bool RegisterNativesImpl(JNIEnv* env) {
if (base::android::IsSelectiveJniRegistrationEnabled(env))
return true;
const int kMethodsDisplaySynchronizerSize =
std::extent<decltype(kMethodsDisplaySynchronizer)>();
if (env->RegisterNatives(DisplaySynchronizer_clazz(env),
kMethodsDisplaySynchronizer,
kMethodsDisplaySynchronizerSize) < 0) {
jni_generator::HandleRegistrationError(env, DisplaySynchronizer_clazz(env),
__FILE__);
return false;
}
return true;
}
static bool RegisterDisplaySynchronizerNatives(JNIEnv* env) {
return RegisterNativesImpl(env);
}
} // namespace DisplaySynchronizer
#endif // com_google_vr_cardboard_DisplaySynchronizer_JNI
| endlessm/chromium-browser | third_party/gvr-android-sdk/display_synchronizer_jni.h | C | bsd-3-clause | 4,558 | [
30522,
1013,
1013,
9385,
2297,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
1013,
2179,
1999,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/*
*@name slideOutRight
*@className slideOutRight animated
*@cssCode
*@editionLink codepen.io
*@author Dan Eden
*@source Animate.css
*@sourceUrl http://daneden.github.io/animate.css/
*@issues https://github.com/daneden/animate.css/issues
*@license MIT
*/
@keyframes slideOutRight {
0% {
transform: translateX(0);
}
100% {
visibility: hidden;
transform: translateX(100%);
}
}
.slideOutRight {
animation-name: slideOutRight;
}
| darielnoel/anicollection | animations/sliding_exits/slideOutRight.css | CSS | mit | 459 | [
30522,
1013,
1008,
1008,
1030,
2171,
7358,
5833,
15950,
1008,
1030,
2465,
18442,
7358,
5833,
15950,
6579,
1008,
1030,
20116,
9363,
3207,
1008,
1030,
3179,
13767,
3642,
11837,
1012,
22834,
1008,
1030,
3166,
4907,
10267,
1008,
1030,
3120,
201... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
module Cms::Extensions::ColumnValuesRelation
extend ActiveSupport::Concern
class LiquidExports < SS::Liquidization::LiquidExportsBase
def key?(name)
find_value(name).present?
end
def [](method_or_key)
find_value(method_or_key) || super
end
def find_value(id_or_name)
if id_or_name.is_a?(Integer)
@delegatee[id_or_name]
else
@delegatee.find { |val| val.id.to_s == id_or_name || val.name == id_or_name }
end
end
delegate :each, to: :@delegatee
delegate :fetch, to: :@delegatee
end
def to_liquid
LiquidExports.new(self.order_by(order: 1, name: 1).to_a.reject { |value| value.class == Cms::Column::Value::Base })
end
def move_up(value_id)
copy = Array(self.order_by(order: 1, name: 1).to_a)
index = copy.index { |value| value.id == value_id }
if index && index > 0
copy[index - 1], copy[index] = copy[index], copy[index - 1]
end
copy.each_with_index { |value, index| value.order = index }
end
def move_down(value_id)
copy = Array(self.order_by(order: 1, name: 1).to_a)
index = copy.index { |value| value.id == value_id }
if index && index < copy.length - 1
copy[index], copy[index + 1] = copy[index + 1], copy[index]
end
copy.each_with_index { |value, index| value.order = index }
end
def move_at(source_id, destination_index)
copy = Array(self.order_by(order: 1, name: 1).to_a)
source_index = copy.index { |value| value.id == source_id }
return if !source_index || source_index == destination_index
destination_index = 0 if destination_index < 0
destination_index = -1 if destination_index >= copy.length
copy.insert(destination_index, copy.delete_at(source_index))
copy.each_with_index { |value, index| value.order = index }
end
end
| itowtips/shirasagi | app/models/cms/extensions/column_values_relation.rb | Ruby | mit | 1,825 | [
30522,
11336,
4642,
2015,
1024,
1024,
14305,
1024,
1024,
5930,
10175,
15808,
16570,
3370,
7949,
3161,
6342,
9397,
11589,
1024,
1024,
5142,
2465,
6381,
10288,
25378,
1026,
7020,
1024,
1024,
6381,
3989,
1024,
1024,
6381,
10288,
25378,
15058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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';
const _ = require('lodash');
const moment = require('moment-timezone');
module.exports = BaseTypes => {
BaseTypes.ABSTRACT.prototype.dialectTypes = 'https://mariadb.com/kb/en/library/resultset/#field-types';
/**
* types: [buffer_type, ...]
* @see documentation : https://mariadb.com/kb/en/library/resultset/#field-types
* @see connector implementation : https://github.com/MariaDB/mariadb-connector-nodejs/blob/master/lib/const/field-type.js
*/
BaseTypes.DATE.types.mariadb = ['DATETIME'];
BaseTypes.STRING.types.mariadb = ['VAR_STRING'];
BaseTypes.CHAR.types.mariadb = ['STRING'];
BaseTypes.TEXT.types.mariadb = ['BLOB'];
BaseTypes.TINYINT.types.mariadb = ['TINY'];
BaseTypes.SMALLINT.types.mariadb = ['SHORT'];
BaseTypes.MEDIUMINT.types.mariadb = ['INT24'];
BaseTypes.INTEGER.types.mariadb = ['LONG'];
BaseTypes.BIGINT.types.mariadb = ['LONGLONG'];
BaseTypes.FLOAT.types.mariadb = ['FLOAT'];
BaseTypes.TIME.types.mariadb = ['TIME'];
BaseTypes.DATEONLY.types.mariadb = ['DATE'];
BaseTypes.BOOLEAN.types.mariadb = ['TINY'];
BaseTypes.BLOB.types.mariadb = ['TINYBLOB', 'BLOB', 'LONGBLOB'];
BaseTypes.DECIMAL.types.mariadb = ['NEWDECIMAL'];
BaseTypes.UUID.types.mariadb = false;
BaseTypes.ENUM.types.mariadb = false;
BaseTypes.REAL.types.mariadb = ['DOUBLE'];
BaseTypes.DOUBLE.types.mariadb = ['DOUBLE'];
BaseTypes.GEOMETRY.types.mariadb = ['GEOMETRY'];
BaseTypes.JSON.types.mariadb = ['JSON'];
class DECIMAL extends BaseTypes.DECIMAL {
toSql() {
let definition = super.toSql();
if (this._unsigned) {
definition += ' UNSIGNED';
}
if (this._zerofill) {
definition += ' ZEROFILL';
}
return definition;
}
}
class DATE extends BaseTypes.DATE {
toSql() {
return `DATETIME${this._length ? `(${this._length})` : ''}`;
}
_stringify(date, options) {
date = this._applyTimezone(date, options);
return date.format('YYYY-MM-DD HH:mm:ss.SSS');
}
static parse(value, options) {
value = value.string();
if (value === null) {
return value;
}
if (moment.tz.zone(options.timezone)) {
value = moment.tz(value, options.timezone).toDate();
}
else {
value = new Date(`${value} ${options.timezone}`);
}
return value;
}
}
class DATEONLY extends BaseTypes.DATEONLY {
static parse(value) {
return value.string();
}
}
class UUID extends BaseTypes.UUID {
toSql() {
return 'CHAR(36) BINARY';
}
}
class GEOMETRY extends BaseTypes.GEOMETRY {
constructor(type, srid) {
super(type, srid);
if (_.isEmpty(this.type)) {
this.sqlType = this.key;
}
else {
this.sqlType = this.type;
}
}
toSql() {
return this.sqlType;
}
}
class ENUM extends BaseTypes.ENUM {
toSql(options) {
return `ENUM(${this.values.map(value => options.escape(value)).join(', ')})`;
}
}
class JSONTYPE extends BaseTypes.JSON {
_stringify(value, options) {
return options.operation === 'where' && typeof value === 'string' ? value
: JSON.stringify(value);
}
}
return {
ENUM,
DATE,
DATEONLY,
UUID,
GEOMETRY,
DECIMAL,
JSON: JSONTYPE
};
};
| yjwong/sequelize | lib/dialects/mariadb/data-types.js | JavaScript | mit | 3,315 | [
30522,
1005,
2224,
9384,
1005,
1025,
9530,
3367,
1035,
1027,
5478,
1006,
1005,
8840,
8883,
2232,
1005,
1007,
1025,
9530,
3367,
2617,
1027,
5478,
1006,
1005,
2617,
1011,
2051,
15975,
1005,
1007,
1025,
11336,
1012,
14338,
1027,
2918,
13874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 ATOM_H
#define ATOM_H
#include "term.h"
#include "variable.h"
class Atom : public Term
{
public:
Atom (std::string s);
bool match(Term &term);
std::string symbol() const;
private:
std::string _symbol;
};
#endif
| Kagu82104/POSD | atom.h | C | mit | 235 | [
30522,
1001,
2065,
13629,
2546,
13787,
1035,
1044,
1001,
9375,
13787,
1035,
1044,
1001,
2421,
1000,
2744,
1012,
1044,
1000,
1001,
2421,
1000,
8023,
1012,
1044,
1000,
2465,
13787,
1024,
2270,
2744,
1063,
2270,
1024,
13787,
1006,
2358,
2094,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 {Component, NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
@Component({
selector: 'application',
template: `<div>Hello!</div>`
})
export class BasicInlineComponent {}
@NgModule({
imports: [BrowserModule],
declarations: [BasicInlineComponent],
bootstrap: [BasicInlineComponent],
})
export class BasicInlineModule {}
| clbond/angular-ssr | source/test/fixtures/application-basic-inline.ts | TypeScript | bsd-2-clause | 377 | [
30522,
12324,
1063,
6922,
1010,
12835,
5302,
8566,
2571,
1065,
2013,
1005,
1030,
16108,
1013,
4563,
1005,
1025,
12324,
1063,
16602,
5302,
8566,
2571,
1065,
2013,
1005,
1030,
16108,
1013,
4132,
1011,
16602,
1005,
1025,
1030,
6922,
1006,
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... |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PPAPI_PROXY_PLUGIN_RESOURCE_H_
#define PPAPI_PROXY_PLUGIN_RESOURCE_H_
#include <map>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_sender.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/proxy/connection.h"
#include "ppapi/proxy/plugin_resource_callback.h"
#include "ppapi/proxy/ppapi_message_utils.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
#include "ppapi/proxy/resource_message_params.h"
#include "ppapi/proxy/resource_reply_thread_registrar.h"
#include "ppapi/shared_impl/resource.h"
#include "ppapi/shared_impl/tracked_callback.h"
namespace ppapi {
namespace proxy {
class PluginDispatcher;
class PPAPI_PROXY_EXPORT PluginResource : public Resource {
public:
enum Destination {
RENDERER = 0,
BROWSER = 1
};
PluginResource(Connection connection, PP_Instance instance);
~PluginResource() override;
// Returns true if we've previously sent a create message to the browser
// or renderer. Generally resources will use these to tell if they should
// lazily send create messages.
bool sent_create_to_browser() const { return sent_create_to_browser_; }
bool sent_create_to_renderer() const { return sent_create_to_renderer_; }
// This handles a reply to a resource call. It works by looking up the
// callback that was registered when CallBrowser/CallRenderer was called
// and calling it with |params| and |msg|.
void OnReplyReceived(const proxy::ResourceMessageReplyParams& params,
const IPC::Message& msg) override;
// Resource overrides.
// Note: Subclasses shouldn't override these methods directly. Instead, they
// should implement LastPluginRefWasDeleted() or InstanceWasDeleted() to get
// notified.
void NotifyLastPluginRefWasDeleted() override;
void NotifyInstanceWasDeleted() override;
// Sends a create message to the browser or renderer for the current resource.
void SendCreate(Destination dest, const IPC::Message& msg);
// When the host returnes a resource to the plugin, it will create a pending
// ResourceHost and send an ID back to the plugin that identifies the pending
// object. The plugin uses this function to connect the plugin resource with
// the pending host resource. See also PpapiHostMsg_AttachToPendingHost. This
// is in lieu of sending a create message.
void AttachToPendingHost(Destination dest, int pending_host_id);
// Sends the given IPC message as a resource request to the host
// corresponding to this resource object and does not expect a reply.
void Post(Destination dest, const IPC::Message& msg);
// Like Post() but expects a response. |callback| is a |base::Callback| that
// will be run when a reply message with a sequence number matching that of
// the call is received. |ReplyMsgClass| is the type of the reply message that
// is expected. An example of usage:
//
// Call<PpapiPluginMsg_MyResourceType_MyReplyMessage>(
// BROWSER,
// PpapiHostMsg_MyResourceType_MyRequestMessage(),
// base::Bind(&MyPluginResource::ReplyHandler, base::Unretained(this)));
//
// If a reply message to this call is received whose type does not match
// |ReplyMsgClass| (for example, in the case of an error), the callback will
// still be invoked but with the default values of the message parameters.
//
// Returns the new request's sequence number which can be used to identify
// the callback. This value will never be 0, which you can use to identify
// an invalid callback.
//
// Note: 1) When all plugin references to this resource are gone or the
// corresponding plugin instance is deleted, all pending callbacks
// are abandoned.
// 2) It is *not* recommended to let |callback| hold any reference to
// |this|, in which it will be stored. Otherwise, this object will
// live forever if we fail to clean up the callback. It is safe to
// use base::Unretained(this) or a weak pointer, because this object
// will outlive the callback.
template<typename ReplyMsgClass, typename CallbackType>
int32_t Call(Destination dest,
const IPC::Message& msg,
const CallbackType& callback);
// Comparing with the previous Call() method, this method takes
// |reply_thread_hint| as a hint to determine which thread to handle the reply
// message.
//
// If |reply_thread_hint| is non-blocking, the reply message will be handled
// on the target thread of the callback; otherwise, it will be handled on the
// main thread.
//
// If handling a reply message will cause a TrackedCallback to be run, it is
// recommended to use this version of Call(). It eliminates unnecessary
// thread switching and therefore has better performance.
template<typename ReplyMsgClass, typename CallbackType>
int32_t Call(Destination dest,
const IPC::Message& msg,
const CallbackType& callback,
scoped_refptr<TrackedCallback> reply_thread_hint);
// Calls the browser/renderer with sync messages. Returns the pepper error
// code from the call.
// |ReplyMsgClass| is the type of the reply message that is expected. If it
// carries x parameters, then the method with x out parameters should be used.
// An example of usage:
//
// // Assuming the reply message carries a string and an integer.
// std::string param_1;
// int param_2 = 0;
// int32_t result = SyncCall<PpapiPluginMsg_MyResourceType_MyReplyMessage>(
// RENDERER, PpapiHostMsg_MyResourceType_MyRequestMessage(),
// ¶m_1, ¶m_2);
template <class ReplyMsgClass>
int32_t SyncCall(Destination dest, const IPC::Message& msg);
template <class ReplyMsgClass, class A>
int32_t SyncCall(Destination dest, const IPC::Message& msg, A* a);
template <class ReplyMsgClass, class A, class B>
int32_t SyncCall(Destination dest, const IPC::Message& msg, A* a, B* b);
template <class ReplyMsgClass, class A, class B, class C>
int32_t SyncCall(Destination dest, const IPC::Message& msg, A* a, B* b, C* c);
template <class ReplyMsgClass, class A, class B, class C, class D>
int32_t SyncCall(
Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d);
template <class ReplyMsgClass, class A, class B, class C, class D, class E>
int32_t SyncCall(
Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d, E* e);
int32_t GenericSyncCall(Destination dest,
const IPC::Message& msg,
IPC::Message* reply_msg,
ResourceMessageReplyParams* reply_params);
const Connection& connection() { return connection_; }
private:
IPC::Sender* GetSender(Destination dest) {
return dest == RENDERER ? connection_.renderer_sender :
connection_.browser_sender;
}
// Helper function to send a |PpapiHostMsg_ResourceCall| to the given
// destination with |nested_msg| and |call_params|.
bool SendResourceCall(Destination dest,
const ResourceMessageCallParams& call_params,
const IPC::Message& nested_msg);
int32_t GetNextSequence();
Connection connection_;
// Use GetNextSequence to retrieve the next value.
int32_t next_sequence_number_;
bool sent_create_to_browser_;
bool sent_create_to_renderer_;
typedef std::map<int32_t, scoped_refptr<PluginResourceCallbackBase> >
CallbackMap;
CallbackMap callbacks_;
scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_;
DISALLOW_COPY_AND_ASSIGN(PluginResource);
};
template<typename ReplyMsgClass, typename CallbackType>
int32_t PluginResource::Call(Destination dest,
const IPC::Message& msg,
const CallbackType& callback) {
return Call<ReplyMsgClass>(dest, msg, callback, NULL);
}
template<typename ReplyMsgClass, typename CallbackType>
int32_t PluginResource::Call(
Destination dest,
const IPC::Message& msg,
const CallbackType& callback,
scoped_refptr<TrackedCallback> reply_thread_hint) {
TRACE_EVENT2("ppapi proxy", "PluginResource::Call",
"Class", IPC_MESSAGE_ID_CLASS(msg.type()),
"Line", IPC_MESSAGE_ID_LINE(msg.type()));
ResourceMessageCallParams params(pp_resource(), next_sequence_number_++);
// Stash the |callback| in |callbacks_| identified by the sequence number of
// the call.
scoped_refptr<PluginResourceCallbackBase> plugin_callback(
new PluginResourceCallback<ReplyMsgClass, CallbackType>(callback));
callbacks_.insert(std::make_pair(params.sequence(), plugin_callback));
params.set_has_callback();
if (resource_reply_thread_registrar_.get()) {
resource_reply_thread_registrar_->Register(
pp_resource(), params.sequence(), reply_thread_hint);
}
SendResourceCall(dest, params, msg);
return params.sequence();
}
template <class ReplyMsgClass>
int32_t PluginResource::SyncCall(Destination dest, const IPC::Message& msg) {
IPC::Message reply;
ResourceMessageReplyParams reply_params;
return GenericSyncCall(dest, msg, &reply, &reply_params);
}
template <class ReplyMsgClass, class A>
int32_t PluginResource::SyncCall(
Destination dest, const IPC::Message& msg, A* a) {
IPC::Message reply;
ResourceMessageReplyParams reply_params;
int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
if (UnpackMessage<ReplyMsgClass>(reply, a))
return result;
return PP_ERROR_FAILED;
}
template <class ReplyMsgClass, class A, class B>
int32_t PluginResource::SyncCall(
Destination dest, const IPC::Message& msg, A* a, B* b) {
IPC::Message reply;
ResourceMessageReplyParams reply_params;
int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
if (UnpackMessage<ReplyMsgClass>(reply, a, b))
return result;
return PP_ERROR_FAILED;
}
template <class ReplyMsgClass, class A, class B, class C>
int32_t PluginResource::SyncCall(
Destination dest, const IPC::Message& msg, A* a, B* b, C* c) {
IPC::Message reply;
ResourceMessageReplyParams reply_params;
int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
if (UnpackMessage<ReplyMsgClass>(reply, a, b, c))
return result;
return PP_ERROR_FAILED;
}
template <class ReplyMsgClass, class A, class B, class C, class D>
int32_t PluginResource::SyncCall(
Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d) {
IPC::Message reply;
ResourceMessageReplyParams reply_params;
int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
if (UnpackMessage<ReplyMsgClass>(reply, a, b, c, d))
return result;
return PP_ERROR_FAILED;
}
template <class ReplyMsgClass, class A, class B, class C, class D, class E>
int32_t PluginResource::SyncCall(
Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d, E* e) {
IPC::Message reply;
ResourceMessageReplyParams reply_params;
int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
if (UnpackMessage<ReplyMsgClass>(reply, a, b, c, d, e))
return result;
return PP_ERROR_FAILED;
}
} // namespace proxy
} // namespace ppapi
#endif // PPAPI_PROXY_PLUGIN_RESOURCE_H_
| Chilledheart/chromium | ppapi/proxy/plugin_resource.h | C | bsd-3-clause | 11,487 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2262,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
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... |
package com.globalforge.infix;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import com.globalforge.infix.api.InfixSimpleActions;
import com.google.common.collect.ListMultimap;
/*-
The MIT License (MIT)
Copyright (c) 2019-2020 Global Forge LLC
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:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
public class TestAndOrSimple {
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
private ListMultimap<String, String> getResults(String sampleRule) throws Exception {
InfixSimpleActions rules = new InfixSimpleActions(sampleRule);
String result = rules.transformFIXMsg(TestAndOrSimple.sampleMessage1);
return StaticTestingUtils.parseMessage(result);
}
@Test
public void t1() {
try {
String sampleRule = "&45==0 && &47==0 ? &50=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("50").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t2() {
try {
String sampleRule = "&45==1 && &47==0 ? &50=1 : &50=2";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("2", resultStore.get("50").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t3() {
try {
String sampleRule = "&45!=1 && &47==0 ? &50=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("50").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t4() {
try {
String sampleRule = "&45==0 && &47 != 1 ? &50=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("50").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t9() {
try {
String sampleRule = "&45==0 && &47==0 && &48==1.5 ? &45=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("0", resultStore.get("47").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t10() {
try {
String sampleRule = "&45==1 && &47==0 && &48==1.5 ? &45=1 : &47=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("0", resultStore.get("45").get(0));
Assert.assertEquals("1", resultStore.get("47").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t11() {
try {
String sampleRule = "&45==0 && &47==1 && &48==1.5 ? &45=1 : &47=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("0", resultStore.get("45").get(0));
Assert.assertEquals("1", resultStore.get("47").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t12() {
try {
String sampleRule = "&45==0 && &47==0 && &48==1.6 ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("0", resultStore.get("45").get(0));
Assert.assertEquals("0", resultStore.get("47").get(0));
Assert.assertEquals("1", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t13() {
try {
String sampleRule = "&45==0 || &47==0 && &48==1.6 ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("0", resultStore.get("45").get(0));
Assert.assertEquals("0", resultStore.get("47").get(0));
Assert.assertEquals("1", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t14() {
try {
String sampleRule = "&45==0 && &47==0 || &48==1.6 ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("0", resultStore.get("47").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t15() {
try {
String sampleRule = "&45==0 || &47==0 && &48==1.6 ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("0", resultStore.get("45").get(0));
Assert.assertEquals("0", resultStore.get("47").get(0));
Assert.assertEquals("1", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t16() {
try {
String sampleRule = "(&45==0 || &47==0) && (&48==1.6) ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("0", resultStore.get("45").get(0));
Assert.assertEquals("0", resultStore.get("47").get(0));
Assert.assertEquals("1", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t17() {
try {
String sampleRule = "&45==0 || (&47==0 && &48==1.6) ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("0", resultStore.get("47").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t18() {
try {
String sampleRule = "^&45 && ^&47 && ^&48 ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t19() {
try {
String sampleRule = "^&45 && ^&47 && ^&50 ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("0", resultStore.get("45").get(0));
Assert.assertEquals("1", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t20() {
try {
String sampleRule = "^&45 || ^&47 || ^&50 ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t21() {
try {
String sampleRule = "!&50 && !&51 && !&52 ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t22() {
try {
String sampleRule = "^&45 || !&51 && !&52 ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t23() {
try {
String sampleRule = "(^&45 || !&51) && !&52 ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t24() {
try {
String sampleRule = "^&45 || (!&51 && !&52) ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t25() {
try {
String sampleRule = "!&50 || !&45 && !&52 ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t26() {
try {
String sampleRule = "(!&50 || !&45) && !&52 ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t27() {
try {
String sampleRule = "!&50 || (!&45 && !&52) ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t28() {
try {
String sampleRule = "!&55 && (!&54 && (!&53 && (!&47 && !&52))) ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("0", resultStore.get("45").get(0));
Assert.assertEquals("1", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t29() {
try {
String sampleRule = "!&55 && (!&54 && (!&53 && (!&56 && !&52))) ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t30() {
try {
String sampleRule = "(!&55 || (!&54 || (!&53 || (!&52 && !&47)))) ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t31() {
try {
String sampleRule = "((((!&55 || !&54) || !&53) || !&52) && !&47) ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("0", resultStore.get("45").get(0));
Assert.assertEquals("1", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t32() {
try {
String sampleRule = "(&382[1]->&655!=\"tarz\" || (&382[0]->&655==\"fubi\" "
+ "|| (&382[1]->&375==3 || (&382 >= 2 || (&45 > -1 || (&48 <=1.5 && &47 < 0.0001)))))) ? &45=1 : &48=1";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("45").get(0));
Assert.assertEquals("1.5", resultStore.get("48").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t34() {
try {
// left to right
String sampleRule = "&45 == 0 || &43 == -100 && &207 == \"USA\" ? &43=1 : &43=2";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("2", resultStore.get("43").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
@Test
public void t35() {
try {
String sampleRule = "&45 == 0 || (&43 == -100 && &207 == \"USA\") ? &43=1 : &43=2";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("1", resultStore.get("43").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
static final String sampleMessage1 = "8=FIX.4.4" + '\u0001' + "9=1000" + '\u0001' + "35=8"
+ '\u0001' + "44=3.142" + '\u0001' + "60=20130412-19:30:00.686" + '\u0001' + "75=20130412"
+ '\u0001' + "45=0" + '\u0001' + "47=0" + '\u0001' + "48=1.5" + '\u0001' + "49=8dhosb"
+ '\u0001' + "382=2" + '\u0001' + "375=1.5" + '\u0001' + "655=fubi" + '\u0001' + "375=3"
+ '\u0001' + "655=yubl" + '\u0001' + "10=004";
@Test
public void t36() {
try {
// 45=0,
String sampleRule = "(&45 == 0 || &43 == -100) && &207 == \"USA\" ? &43=1 : &43=2";
ListMultimap<String, String> resultStore = getResults(sampleRule);
Assert.assertEquals("2", resultStore.get("43").get(0));
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
}
| globalforge/infix | src/test/java/com/globalforge/infix/TestAndOrSimple.java | Java | mit | 16,486 | [
30522,
7427,
4012,
1012,
3795,
29278,
3351,
1012,
1999,
8873,
2595,
1025,
12324,
8917,
1012,
12022,
4183,
1012,
20865,
1025,
12324,
8917,
1012,
12022,
4183,
1012,
2077,
26266,
1025,
12324,
8917,
1012,
12022,
4183,
1012,
3231,
1025,
12324,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
//---------------------------------------------------------------------------//
//!
//! \file MonteCarlo_ElectroatomCore_def.hpp
//! \author Luke Kersting
//! \brief The electroatom core class template definitions
//!
//---------------------------------------------------------------------------//
#ifndef MONTE_CARLO_ELECTROATOM_CORE_DEF_HPP
#define MONTE_CARLO_ELECTROATOM_CORE_DEF_HPP
// FRENSIE Includes
#include "Utility_ContractException.hpp"
#include "MonteCarlo_AbsorptionElectroatomicReaction.hpp"
#include "MonteCarlo_VoidAbsorptionElectroatomicReaction.hpp"
namespace MonteCarlo{
// Basic constructor
/*! \details The scattering absorption and miscellaneous reactions will be
* organized using the standard scattering reactions, standard absorption
* reactions and the default scattering type map. Once organized, the
* total and absorption reactions will be created. If there is not standard
* absorption reaction a void absorption reaction will be inserted for the
* TotalAbsorptionReaction
*/
template<typename InterpPolicy>
ElectroatomCore::ElectroatomCore(
const Teuchos::ArrayRCP<double>& energy_grid,
const ReactionMap& standard_scattering_reactions,
const ReactionMap& standard_absorption_reactions,
const Teuchos::RCP<AtomicRelaxationModel>& relaxation_model,
const bool processed_atomic_cross_sections,
const InterpPolicy policy )
: d_total_reaction(),
d_total_absorption_reaction(),
d_scattering_reactions(),
d_absorption_reactions(),
d_miscellaneous_reactions(),
d_relaxation_model( relaxation_model )
{
// Make sure the energy grid is valid
testPrecondition( energy_grid.size() > 1 );
testPrecondition( Utility::Sort::isSortedAscending( energy_grid.begin(),
energy_grid.end() ) );
// There must be at least one reaction specified
testPrecondition( standard_scattering_reactions.size() +
standard_absorption_reactions.size() > 0 );
// Make sure the relaxation model is valid
testPrecondition( !relaxation_model.is_null() );
// Place reactions in the appropriate group
ReactionMap::const_iterator rxn_type_pointer =
standard_absorption_reactions.begin();
while( rxn_type_pointer != standard_absorption_reactions.end() )
{
if( ElectroatomCore::scattering_reaction_types.count( rxn_type_pointer->first ) )
d_scattering_reactions.insert( *rxn_type_pointer );
else
d_absorption_reactions.insert( *rxn_type_pointer );
++rxn_type_pointer;
}
rxn_type_pointer = standard_scattering_reactions.begin();
while( rxn_type_pointer != standard_scattering_reactions.end() )
{
if( ElectroatomCore::scattering_reaction_types.count( rxn_type_pointer->first ) )
d_scattering_reactions.insert( *rxn_type_pointer );
else
d_miscellaneous_reactions.insert( *rxn_type_pointer );
++rxn_type_pointer;
}
// Create the total absorption and total reactions
Teuchos::RCP<ElectroatomicReaction> total_absorption_reaction;
Teuchos::RCP<ElectroatomicReaction> total_reaction;
if( processed_atomic_cross_sections )
{
if( d_absorption_reactions.size() > 0 )
{
ElectroatomCore::createProcessedTotalAbsorptionReaction<InterpPolicy>(
energy_grid,
d_absorption_reactions,
total_absorption_reaction );
}
else
{
// Create void absorption reaction
total_absorption_reaction.reset(
new VoidAbsorptionElectroatomicReaction() );
}
d_total_absorption_reaction = total_absorption_reaction;
ElectroatomCore::createProcessedTotalReaction<InterpPolicy>(
energy_grid,
d_scattering_reactions,
d_total_absorption_reaction,
total_reaction );
d_total_reaction = total_reaction;
}
else
{
if( d_absorption_reactions.size() > 0 )
{
ElectroatomCore::createTotalAbsorptionReaction<InterpPolicy>(
energy_grid,
d_absorption_reactions,
total_absorption_reaction );
}
else
{
// Create void absorption reaction
total_absorption_reaction.reset(
new VoidAbsorptionElectroatomicReaction() );
}
d_total_absorption_reaction = total_absorption_reaction;
ElectroatomCore::createTotalReaction<InterpPolicy>(
energy_grid,
d_scattering_reactions,
d_total_absorption_reaction,
total_reaction );
d_total_reaction = total_reaction;
}
// Make sure the reactions have been organized appropriately
testPostcondition( d_scattering_reactions.size() > 0 );
}
// Create the total absorption reaction
template<typename InterpPolicy>
void ElectroatomCore::createTotalAbsorptionReaction(
const Teuchos::ArrayRCP<double>& energy_grid,
const ConstReactionMap& absorption_reactions,
Teuchos::RCP<ElectroatomicReaction>& total_absorption_reaction )
{
// Make sure the absorption cross section is sized correctly
testPrecondition( energy_grid.size() > 1 );
unsigned absorption_threshold_energy_index = 0u;
Teuchos::Array<double> absorption_cross_section;
ConstReactionMap::const_iterator absorption_reaction;
for( unsigned i = 0; i < energy_grid.size(); ++i )
{
double raw_cross_section = 0.0;
absorption_reaction = absorption_reactions.begin();
while( absorption_reaction != absorption_reactions.end() )
{
raw_cross_section +=
absorption_reaction->second->getCrossSection( energy_grid[i] );
++absorption_reaction;
}
if( raw_cross_section > 0.0 )
{
// Process the raw cross section
absorption_cross_section.push_back( raw_cross_section );
}
else
{
// Ignore this data point
++absorption_threshold_energy_index;
}
}
// Make sure the absorption cross section is valid
remember( Teuchos::Array<double>::const_iterator zero_element =
std::find( absorption_cross_section.begin(),
absorption_cross_section.end(),
0.0 ) );
testPostcondition( zero_element == absorption_cross_section.end() );
remember( Teuchos::Array<double>::const_iterator inf_element =
std::find( absorption_cross_section.begin(),
absorption_cross_section.end(),
std::numeric_limits<double>::infinity() ) );
testPostcondition( inf_element == absorption_cross_section.end() );
Teuchos::ArrayRCP<double> absorption_cross_section_copy;
absorption_cross_section_copy.deepCopy( absorption_cross_section() );
total_absorption_reaction.reset(
new AbsorptionElectroatomicReaction<InterpPolicy,false>(
energy_grid,
absorption_cross_section_copy,
absorption_threshold_energy_index,
TOTAL_ABSORPTION_ELECTROATOMIC_REACTION ) );
}
// Create the processed total absorption reaction
template<typename InterpPolicy>
void ElectroatomCore::createProcessedTotalAbsorptionReaction(
const Teuchos::ArrayRCP<double>& energy_grid,
const ConstReactionMap& absorption_reactions,
Teuchos::RCP<ElectroatomicReaction>& total_absorption_reaction )
{
// Make sure the energy grid is valid
testPrecondition( energy_grid.size() > 1 );
Teuchos::Array<double> absorption_cross_section;
unsigned absorption_threshold_energy_index = 0u;
ConstReactionMap::const_iterator absorption_reaction;
for( unsigned i = 0; i < energy_grid.size(); ++i )
{
absorption_reaction = absorption_reactions.begin();
double raw_cross_section = 0.0;
const double raw_energy =
InterpPolicy::recoverProcessedIndepVar( energy_grid[i] );
while( absorption_reaction != absorption_reactions.end() )
{
raw_cross_section +=
absorption_reaction->second->getCrossSection( raw_energy );
++absorption_reaction;
}
if( raw_cross_section > 0.0 )
{
// Process the raw cross section
absorption_cross_section.push_back(
InterpPolicy::processDepVar( raw_cross_section ) );
}
else
{
// Ignore this data point
++absorption_threshold_energy_index;
}
}
// Make sure the absorption cross section is valid
remember( Teuchos::Array<double>::const_iterator zero_element =
std::find( absorption_cross_section.begin(),
absorption_cross_section.end(),
0.0 ) );
testPostcondition( zero_element == absorption_cross_section.end() );
remember( Teuchos::Array<double>::const_iterator inf_element =
std::find( absorption_cross_section.begin(),
absorption_cross_section.end(),
std::numeric_limits<double>::infinity() ) );
testPostcondition( inf_element == absorption_cross_section.end() );
Teuchos::ArrayRCP<double> absorption_cross_section_copy;
absorption_cross_section_copy.deepCopy( absorption_cross_section() );
total_absorption_reaction.reset(
new AbsorptionElectroatomicReaction<InterpPolicy,true>(
energy_grid,
absorption_cross_section_copy,
absorption_threshold_energy_index,
TOTAL_ABSORPTION_ELECTROATOMIC_REACTION ) );
}
// Create the total reaction
template<typename InterpPolicy>
void ElectroatomCore::createTotalReaction(
const Teuchos::ArrayRCP<double>& energy_grid,
const ConstReactionMap& scattering_reactions,
const Teuchos::RCP<const ElectroatomicReaction>& total_absorption_reaction,
Teuchos::RCP<ElectroatomicReaction>& total_reaction )
{
// Make sure the energy grid is valid
testPrecondition( energy_grid.size() > 1 );
// Make sure the absorption reaction has been created
testPrecondition( !total_absorption_reaction.is_null() );
Teuchos::Array<double> total_cross_section;
unsigned total_threshold_energy_index = 0u;
ConstReactionMap::const_iterator scattering_reaction;
for( unsigned i = 0; i < energy_grid.size(); ++i )
{
scattering_reaction = scattering_reactions.begin();
double raw_cross_section =
total_absorption_reaction->getCrossSection( energy_grid[i] );
while( scattering_reaction != scattering_reactions.end() )
{
raw_cross_section +=
scattering_reaction->second->getCrossSection( energy_grid[i] );
++scattering_reaction;
}
if( raw_cross_section > 0.0 )
{
// Process the raw cross section
total_cross_section.push_back( raw_cross_section );
}
else
{
// Ignore this data point
++total_threshold_energy_index;
}
}
// Make sure the absorption cross section is valid
remember( Teuchos::Array<double>::const_iterator zero_element =
std::find( total_cross_section.begin(),
total_cross_section.end(),
0.0 ) );
testPostcondition( zero_element == total_cross_section.end() );
remember( Teuchos::Array<double>::const_iterator inf_element =
std::find( total_cross_section.begin(),
total_cross_section.end(),
std::numeric_limits<double>::infinity() ) );
testPostcondition( inf_element == total_cross_section.end() );
Teuchos::ArrayRCP<double> total_cross_section_copy;
total_cross_section_copy.deepCopy( total_cross_section() );
total_reaction.reset(
new AbsorptionElectroatomicReaction<InterpPolicy,false>(
energy_grid,
total_cross_section_copy,
total_threshold_energy_index,
TOTAL_ELECTROATOMIC_REACTION ) );
}
// Calculate the processed total absorption cross section
template<typename InterpPolicy>
void ElectroatomCore::createProcessedTotalReaction(
const Teuchos::ArrayRCP<double>& energy_grid,
const ConstReactionMap& scattering_reactions,
const Teuchos::RCP<const ElectroatomicReaction>& total_absorption_reaction,
Teuchos::RCP<ElectroatomicReaction>& total_reaction )
{
// Make sure the energy grid is valid
testPrecondition( energy_grid.size() > 1 );
// Make sure the absorption reaction has been created
testPrecondition( !total_absorption_reaction.is_null() );
Teuchos::Array<double> total_cross_section;
unsigned total_threshold_energy_index = 0u;
ConstReactionMap::const_iterator scattering_reaction;
for( unsigned i = 0; i < energy_grid.size(); ++i )
{
scattering_reaction = scattering_reactions.begin();
const double raw_energy =
InterpPolicy::recoverProcessedIndepVar( energy_grid[i] );
double raw_cross_section =
total_absorption_reaction->getCrossSection( raw_energy );
while( scattering_reaction != scattering_reactions.end() )
{
raw_cross_section +=
scattering_reaction->second->getCrossSection( raw_energy );
++scattering_reaction;
}
if( raw_cross_section > 0.0 )
{
// Process the raw cross section
total_cross_section.push_back(
InterpPolicy::processDepVar( raw_cross_section ) );
}
else
{
// Ignore this data point
++total_threshold_energy_index;
}
}
// Make sure the absorption cross section is valid
remember( Teuchos::Array<double>::const_iterator zero_element =
std::find( total_cross_section.begin(),
total_cross_section.end(),
0.0 ) );
testPostcondition( zero_element == total_cross_section.end() );
remember( Teuchos::Array<double>::const_iterator inf_element =
std::find( total_cross_section.begin(),
total_cross_section.end(),
std::numeric_limits<double>::infinity() ) );
testPostcondition( inf_element == total_cross_section.end() );
Teuchos::ArrayRCP<double> total_cross_section_copy;
total_cross_section_copy.deepCopy( total_cross_section() );
total_reaction.reset(
new AbsorptionElectroatomicReaction<InterpPolicy,true>(
energy_grid,
total_cross_section_copy,
total_threshold_energy_index,
TOTAL_ELECTROATOMIC_REACTION ) );
}
} // end MonteCarlo namespace
#endif // end MONTE_CARLO_ELECTROATOM_CORE_DEF_HPP
//---------------------------------------------------------------------------//
// end MonteCarlo_ElectroatomCore_def.hpp
//---------------------------------------------------------------------------//
| lkersting/SCR-2123 | packages/monte_carlo/collision/native/src/MonteCarlo_ElectroatomCore_def.hpp | C++ | bsd-3-clause | 14,101 | [
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... |
#### Requirements
* Filling out the below template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
### Description of the Change
<!-- We must be able to understand the design of your change from this description. -->
### Benefits
<!-- What benefits will be realized by the code change? -->
### Possible Drawbacks
<!-- What are the possible side-effects or negative impacts of the code change? -->
### Applicable Issues
<!-- Enter any applicable Issues (link them or reference their ID) here -->
> Note:
> Please be aware that we may require changes if we
> believe they are required to meet the vision and standards of Elixr.
> Don't take suggestions for tweaks personally, we are all simply trying to make Elixr
> the best that it can be :)
| ebiggz/MixrElixr | .github/PULL_REQUEST_TEMPLATE.md | Markdown | gpl-3.0 | 860 | [
30522,
1001,
1001,
1001,
1001,
5918,
1008,
8110,
2041,
1996,
2917,
23561,
2003,
3223,
1012,
2151,
4139,
5227,
2008,
2515,
2025,
2421,
2438,
2592,
2000,
2022,
8182,
1999,
1037,
23259,
5450,
2089,
2022,
2701,
2012,
1996,
5441,
2545,
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... |
{% extends "layout.html" %}
{% block page_title %}
Fit note
{% endblock %}
{% block content %}
<main id="content" role="main">
{% include "../includes/phase_banner_alpha.html" %}
<form action="pensions" method="#" class="form">
<div class="grid-row">
<div class="column-two-thirds">
<header>
<h1 class="form-title heading-large">
<!-- <span class="heading-secondary">Section 13 of 23</span> -->
Fit note
</h1>
</header>
<div class="form-group">
<fieldset class="inline">
<legend class="heading-medium" for="partner">Do you have a fit note? </legend>
<label class="block-label" data-target="fitnote" for="radio-inline-1">
<input id="radio-inline-1" type="radio" name="partner" value="Yes">
Yes
</label>
<label class="block-label" data-target="no-fitnote" for="radio-inline-2">
<input id="radio-inline-2" type="radio" name="partner" value="No">
No
</label>
</fieldset>
</div>
<div class="panel-indent js-hidden" id="fitnote">
<div class="form-group">
<fieldset>
<legend class="form-label-bold">Fit note start date</legend>
<div class="form-date">
<p class="form-hint">DD MM YYYY</p>
<div class="form-group form-group-day">
<label for="dob-day">Day</label>
<input type="text" class="form-control" id="dob-day" maxlength="2" name="dob-day">
</div>
<div class="form-group form-group-month">
<label for="dob-month">Month</label>
<input type="text" class="form-control" id="dob-month" maxlength="2" name="dob-month">
</div>
<div class="form-group form-group-year">
<label for="dob-year">Year</label>
<input type="text" class="form-control" id="dob-year" maxlength="4" name="dob-year">
</div>
</div>
</fieldset>
</div>
<div class="form-group">
<fieldset>
<legend class="form-label-bold">Fit note end date</legend>
<div class="form-date">
<p class="form-hint">DD MM YYYY</p>
<div class="form-group form-group-day">
<label for="end-day">Day</label>
<input type="text" class="form-control" id="end-day" maxlength="2" name="end-day">
</div>
<div class="form-group form-group-month">
<label for="end-month">Month</label>
<input type="text" class="form-control" id="end-month" maxlength="2" name="end-month">
</div>
<div class="form-group form-group-year">
<label for="end-year">Year</label>
<input type="text" class="form-control" id="end-year" maxlength="4" name="end-year">
</div>
</div>
</fieldset>
</div>
</div>
<div class="panel panel-border-narrow js-hidden" id="no-fitnote">
<p>You must have a fit note in order to claim Employment and Support Allowance. You have 7 days to get one.</p>
</div>
<!-- Primary buttons, secondary links -->
<div class="form-group">
<input type="submit" class="button" value="Continue"> <!--a href="overview">I do not agree - leave now</a-->
</div>
</div>
<div class="column-one-third">
<p> </p>
</div>
</div>
</form>
</main>
{% endblock %} | ballzy/apply-for-esa | app/views/alpha01/fit-note.html | HTML | mit | 3,633 | [
30522,
1063,
1003,
8908,
1000,
9621,
1012,
16129,
1000,
1003,
1065,
1063,
1003,
3796,
3931,
1035,
2516,
1003,
1065,
4906,
3602,
1063,
1003,
2203,
23467,
1003,
1065,
1063,
1003,
3796,
4180,
1003,
1065,
1026,
2364,
8909,
1027,
1000,
4180,
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... |
/*
This is a File System Recognizer for IRIG 106 Ch10 Filesystem
Copyright (C) 2014 Arthur Walton.
Heavily derived from the File System Recognizer for RomFs
Copyright (C) 2001 Bo Brantén.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _ROM_FS_
#define _ROM_FS_
#define SECTOR_SIZE 512
#define CH10_MAGIC "FORTYtwo"
#define CH10_MAGIC_OFFSET 512
//
// Types used by Linux
//
#include "ltypes.h"
//
// Use 1 byte packing of on-disk structures
//
#include <pshpack1.h>
//
// The following is a subset of linux/include/linux/ch10fs_fs.h from
// version 2.2.14
//
/* The basic structures of the ch10fs filesystem */
#define CH10_BLOCK_SIZE 512
#define CH10_MAXFN 48
#define MAX_FILES_PER_DIR 4
#define CH10_MAX_DIR_BLOCKS 64
/*
* Ch10 Directory Entry
*/
struct ch10_dir_entry {
__u8 name[56]; // name of the directory entry
__u64 blockNum; // block number that the entry starts at
__u64 numBlocks; // length of the entry in blocks
__u64 size; // length of the entry in bytes
__u8 createDate[8]; // date entry was created
__u8 createTime[8]; // time entry was created
__u8 timeType; // time system the previous date and time were stored in
__u8 reserved[7]; // currently unused, reserved for future use
__u8 closeTime[8]; // time this entry was finished being written
};
/*
* Ch10 Directory Block
*/
struct ch10_dir_block {
__u8 magicNumAscii[8]; // Identifies this as being a directory block, always set to FORTYtwo
__u8 revNum; // revision number of the data recording standard in use
__u8 shutdown; // flag to indicate filesystem was not properly shutdown while writing to this directory
__u16 numEntries; // number of directory entries/files that are in this block
__u32 bytesPerBlock; // number of bytes per block
__u8 volName[32]; // name of this directory block
__u64 forwardLink:64; // block address of next directory block
__u64 reverseLink:64; // block address of previous directory block
struct ch10_dir_entry dirEntries[MAX_FILES_PER_DIR]; // all entries/files in the block
};
#include <poppack.h>
#endif
| ArthurWalton/windows-ch10-fs | ch10fsrec/inc/ch10_fs.h | C | gpl-2.0 | 2,857 | [
30522,
1013,
1008,
2023,
2003,
1037,
5371,
2291,
6807,
2099,
2005,
20868,
8004,
10114,
10381,
10790,
6764,
27268,
6633,
9385,
1006,
1039,
1007,
2297,
4300,
14290,
1012,
4600,
5173,
2013,
1996,
5371,
2291,
6807,
2099,
2005,
17083,
10343,
938... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 Login_Attempts extends CI_Model
{
function __construct()
{
parent::__construct();
// Other stuff
$this->_prefix = $this->config->item('DX_table_prefix');
$this->_table = $this->_prefix.$this->config->item('DX_login_attempts_table');
}
function check_attempts($ip_address)
{
$this->db->select('1', FALSE);
$this->db->where('ip_address', $ip_address);
return $this->db->get($this->_table);
}
// Increase attempts count
function increase_attempt($ip_address)
{
// Insert new record
$data = array(
'ip_address' => $ip_address
);
$this->db->insert($this->_table, $data);
}
function clear_attempts($ip_address)
{
$this->db->where('ip_address', $ip_address);
$this->db->delete($this->_table);
}
}
?> | marjomlg/AdminTool | phpmongodb/inventory/third-party/DX-Auth-master/DX-Auth-master/application/models/dx_auth/login_attempts.php | PHP | mit | 760 | [
30522,
1026,
1029,
25718,
2465,
8833,
2378,
1035,
4740,
8908,
25022,
1035,
2944,
1063,
3853,
1035,
1035,
9570,
1006,
1007,
1063,
6687,
1024,
1024,
1035,
1035,
9570,
1006,
1007,
1025,
1013,
1013,
2060,
4933,
1002,
2023,
1011,
1028,
1035,
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... |
<?php
namespace iamsalnikov\ConfigBuilder\Cli;
use iamsalnikov\ConfigBuilder\Cli\Commands\BuildConfigCommand;
/**
* Class Application
* @package iamsalnikov\ConfigBuilder\Cli
*/
class Application
{
public static function run()
{
$app = new \Symfony\Component\Console\Application();
$app->addCommands([new BuildConfigCommand()]);
$app->setDefaultCommand('build', true);
$app->run();
}
}
| iamsalnikov/config-builder | src/Cli/Application.php | PHP | mit | 437 | [
30522,
1026,
1029,
25718,
3415,
15327,
24264,
5244,
2389,
22576,
1032,
9530,
8873,
18259,
19231,
4063,
1032,
18856,
2072,
1025,
2224,
24264,
5244,
2389,
22576,
1032,
9530,
8873,
18259,
19231,
4063,
1032,
18856,
2072,
1032,
10954,
1032,
3857,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
## CityScape Data File Parser: Quick Start
1.Make sure that the dependencies are met. Dependencies:
-Python 2.7
-Protobuf Python binding (python-protobuf)
-MatPlotLib
-NumPy
-SciPy
2.Download the files ("python" directory).
3.Launch a terminal (command prompt), and cd to the python directory.
4.To dump data into Matlab-supported format (.mat), run (from where the downloaded Python files are located):
python rawIQ_process.py -m0 extracted_file_path
(for Raw I-Q data), or
python psdFile_process.py -m0 extracted_file_path
(for PSD data).
Note that this may take up to several minutes (for large files).
This will convert the extracted data into Matlab-decodable (.mat) format. There are other options as well: you can type 'python rawIQ_process.py --help' or 'python psdFile_process.py --help' to see list of available options.
## List of Files
* "dsor or dsox to protobuf decompressor"/decompress.exe : Decompresses dsox or dsor files into uncompressed Protobuffer files. Requires .NET or Mono runtime.
* "dsor or dsox to protobuf decompressor"/decompress.cs : source code of decompress.exe.
* "dsor or dsox to protobuf decompressor"/decompress.py : Python equivalent of decompress.exe (if you prefer Python).
* "Protobuf Binaries & .proto files"/protobuf-windows-build(full).zip: protobuf binary, with max file size = 512M, for Windows 7 or higher.
* "Protobuf Binaries & .proto files"/protoc.exe : protobuffer compiler (for Windows). Can be used to decode a protobuffer database file and generate a human-readable text file. Max file size = 512MB (Use Python based parser for larger files).
* "Protobuf Binaries & .proto files"/psdFile.proto : Protobuf definition file for the aggregated PSD files (used by the CityScape project). Protobuf libraries and binaries need this file to correctly decode (or encode) the downloaded PSD files.
* "Protobuf Binaries & .proto files"/rawIQ.proto : psdFile.proto : Protobuf definition file for the Raw I-Q files (used by the CityScape project). Protobuf libraries and binaries need this file to correctly decode (or encode) the downloaded files.
* Python/psdFile_pb2.py : Protobuf "data access code" for PSD scan file, for Python 2.7. Required to encode or decode CityScape PSD data files with Python; can be generated from psdFile.proto if necessary.
* Python/rawIQ_pb2.py : Protobuf "data access code" for RAW IQ file, for Python 2.7. Required to encode or decode CityScape I-Q data files with Python; can be generated from psdFile.proto if necessary.
* Python/psdFile_process.py : A sample Python program to read and process CityScape PSD scan files. Provides a simple CLI interface to plot or dump the data.
* Python/rawIQ_process.py : A sample Python program to read and process CityScape RAW IQ files. Provides a simple CLI interface to plot or dump the data.
* Python/CityScapePSDPlotter.py : A sample Python program to read and plot PSD scan files. GUI-Based.
## Usage
### Decompressing Files (Optional if using the Python-based Parser)
Decompress(uncompress) dsor or dsox files into an uncompressed Protobuf files:
Windows with .NET runtime:
decompress.exe source_path output_path
Mono runtime:
mono decompress.exe source_path output_path
### Parsing, with "protoc"
An uncompressed protobuf file to a human-readable text file, using protoc:
Command to convert RAW IQ files (assuming that rawIQ.proto file is located in current directory. Also assuming UNIX-like Shell style syntax):
protoc -I=./ --decode=MSSO_RawIQ.RawIqFile ./rawIQ.proto < input_path > output_path
Command to convert PSD files (same assumptions as above):
protoc -I=./ --decode=MSSO_PSD.ScanFile ./psdFile.proto < input_path > output_path
*"protoc" must be installed. (see below for "protoc" installation.)
*May not be able to process large files (protoc may reject files larger than 64MBytes).
### Decoding, with Python-based Parser (Recommended)
Dependency :
-Python 2.7
-Protobuf Python binding (python-protobuf)
-MatPlotLib
-NumPy
-SciPy
example, for extracting data into matlab (mat) files:
python/rawIQ_process.py -m0 RAW_IQ.bin #Process the uncompressed file. Dump all data into Matlab (.mat) files.
To see list other optional arguments, run:
python/rawIQ_process.py --help
or
python/psdFile_process.py --help
*Maximum processible file size does not apply to the Python-based parser (Only applies to protoc).
## Misc.
### Protobuf Installation
GitHub URL for protobuf: https://github.com/google/protobuf . Download the project. Update CodedInputStream::SetTotalBytesLimit() of google/protobuf/io/coded_stream.h appropriately to adjust the maximum allowable input file size (our RAW IQ files and PSD files can grow much larger than the typical value - 512MB or 1GB would be a good estimate) and build the project.
If you are using Windows 7 or higher, or using GNU/Linux with Wine installed, you can use the protobuf build uploaded. Max input file size for protoc: 512Mbyte.
In Debian-based Linux distros, you can simply download protobuf by running sudo apt-get protobuf-compiler. However, the maximum input file size for this protoc build can be smaller than what you want. You can still use the Python-based parser, as that limit does not apply to the Python-base parser.
### Understanding CityScape PSD / RAW IQ File Data Structure
* *.proto files serve as documentation of the RAW IQ / PSD protobuf file structures. We recommend reading those files in order to understand what kind of metadata can be stored in these data files.
* To convert a timestamp with "scale: TICKS" into a UNIX timestamp, simply divide it by 10000000. (Note that this is a special case. The timestamp stored in protobuf-net format is already adjusted to start at 1970/01/01 00:00AM.)
* Power in the PSD files are represented in a fixed-point format ( https://en.wikipedia.org/wiki/Q_(number_format) ), which are then stored as signed int16 numbers.
### Units of the I-Q Data and PSD Estimates
* If your station is amplitude-calibrated, generated I-Q Data are normalized in a such way that the periodogram of the I-Q data will generate power spectral densitiy estimates in a dBm scale (instead of in arbitrary scale). This is done by applying a software-level amplification (or attenuation) to the received I-Q data. If the station is not calibrated, it will generate data in an arbitrary scale.
Currently (Jul 07, 2017), every station hosted at cityscape.cloudapp.net are amplitude-calibrated.
* Similarly, PSD estimate data are in dBm/(FFT Bin Size) if the station is amplitude-calibrated. If not, it is in an arbitrary scale.
### Troubleshoot
**Exception thrown by the Python script:**
* Supplied *_pb2.py files may not work correctly with some versions of Python-Protobuf library. You can re-build *_pb2.py files with your own Protobuf library. Alternatively, you can try different versions of Python-Protobuf library. *_pb2.py rebuild Guide : https://developers.google.com/protocol-buffers/docs/pythontutorial .
**Decompress.exe won't run:**
* Try installing recent version of .NET Framework (Windows) or Mono (Linux).
**Decoded data look incorrect.**
* Check if you used the correct parser script - psdFile_process.py for aggregated PSD files, rawIQ_process.py for raw I-Q data files.
* If you suspect that the data generated from the station is incorrect (=fault of the station, not the parser), try contacting the station administrator.
**It takes very long (several minutes) to parse data.**
Yes. This is because your Python-Protobuf is not built to handle large data files. Some versions of Python-Protobuf (ex: Python-Protobuf from Ubuntu 16.04 repo) run much faster.
| cityscapesc/specobs | main/tools/RAW_IQ_or_PSD_Data_Parser/Python_Based_Parser(Recommended)/README.md | Markdown | apache-2.0 | 7,906 | [
30522,
1001,
1001,
30524,
1024,
1011,
18750,
1016,
1012,
1021,
1011,
15053,
8569,
2546,
18750,
8031,
1006,
18750,
1011,
15053,
8569,
2546,
1007,
1011,
13523,
24759,
4140,
29521,
1011,
16371,
8737,
2100,
1011,
16596,
7685,
1016,
1012,
8816,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/*
* syslog.js: Transport for logging to a remote syslog consumer
*
* (C) 2011 Squeeks and Charlie Robbins
* MIT LICENCE
*
*/
var dgram = require('dgram'),
net = require('net'),
util = require('util'),
glossy = require('glossy'),
winston = require('winston'),
unix = require('unix-dgram'),
os = require('os');
var levels = Object.keys({
debug: 0,
info: 1,
notice: 2,
warning: 3,
error: 4,
crit: 5,
alert: 6,
emerg: 7
});
//
// ### function Syslog (options)
// #### @options {Object} Options for this instance.
// Constructor function for the Syslog Transport capable of sending
// RFC 3164 and RFC 5424 compliant messages.
//
var Syslog = exports.Syslog = function (options) {
winston.Transport.call(this, options);
options = options || {};
// Set transport name
this.name = 'syslog';
//
// Setup connection state
//
this.connected = false;
this.retries = 0;
this.queue = [];
//
// Merge the options for the target Syslog server.
//
this.host = options.host || 'localhost';
this.port = options.port || 514;
this.path = options.path || null;
this.protocol = options.protocol || 'udp4';
this.isDgram = /^udp|unix/.test(this.protocol);
if (!/^udp|unix|tcp/.test(this.protocol)) {
throw new Error('Invalid syslog protocol: ' + this.protocol);
}
if (/^unix/.test(this.protocol) && !this.path) {
throw new Error('`options.path` is required on unix dgram sockets.');
}
//
// Merge the default message options.
//
this.localhost = options.localhost || os.hostname();
this.type = options.type || 'BSD';
this.facility = options.facility || 'local0';
this.pid = options.pid || process.pid;
this.app_name = options.app_name || process.title;
//
// Setup our Syslog and network members for later use.
//
this.socket = null;
this.producer = new glossy.Produce({
type: this.type,
appName: this.app_name,
pid: this.pid,
facility: this.facility
});
};
//
// Inherit from `winston.Transport`.
//
util.inherits(Syslog, winston.Transport);
//
// Define a getter so that `winston.transports.Syslog`
// is available and thus backwards compatible.
//
winston.transports.Syslog = Syslog;
//
// ### function log (level, msg, [meta], callback)
// #### @level {string} Target level to log to
// #### @msg {string} Message to log
// #### @meta {Object} **Optional** Additional metadata to log.
// #### @callback {function} Continuation to respond to when complete.
// Core logging method exposed to Winston. Logs the `msg` and optional
// metadata, `meta`, to the specified `level`.
//
Syslog.prototype.log = function (level, msg, meta, callback) {
var self = this,
data = meta ? winston.clone(meta) : {},
syslogMsg,
buffer;
if (!~levels.indexOf(level)) {
return callback(new Error('Cannot log unknown syslog level: ' + level));
}
data.message = msg;
syslogMsg = this.producer.produce({
severity: level,
host: this.localhost,
date: new Date(),
message: meta ? JSON.stringify(data) : msg
});
//
// Attempt to connect to the socket
//
this.connect(function (err) {
if (err) {
//
// If there was an error enqueue the message
//
return self.queue.push(syslogMsg);
}
//
// On any error writing to the socket, enqueue the message
//
function onError (logErr) {
if (logErr) { self.queue.push(syslogMsg) }
self.emit('logged');
}
//
// Write to the `tcp*`, `udp*`, or `unix` socket.
//
if (self.isDgram) {
buffer = new Buffer(syslogMsg);
if (self.protocol.match(/^udp/)) {
self.socket.send(buffer, 0, buffer.length, self.port, self.host, onError);
}
else {
self.socket.send(buffer, 0, buffer.length, self.path, onError);
}
}
else {
self.socket.write(syslogMsg, 'utf8', onError);
}
});
callback(null, true);
};
//
// ### function connect (callback)
// #### @callback {function} Continuation to respond to when complete.
// Connects to the remote syslog server using `dgram` or `net` depending
// on the `protocol` for this instance.
//
Syslog.prototype.connect = function (callback) {
var self = this, readyEvent;
//
// If the socket already exists then respond
//
if (this.socket) {
return (!this.socket.readyState) || (this.socket.readyState === 'open')
? callback(null)
: callback(true);
}
//
// Create the appropriate socket type.
//
if (this.isDgram) {
if (self.protocol.match(/^udp/)) {
this.socket = new dgram.Socket(this.protocol);
}
else {
this.socket = new unix.createSocket('unix_dgram');
}
return callback(null);
}
else {
this.socket = new net.Socket({ type: this.protocol });
this.socket.setKeepAlive(true);
this.socket.setNoDelay();
readyEvent = 'connect';
}
//
// On any error writing to the socket, emit the `logged` event
// and the `error` event.
//
function onError (logErr) {
if (logErr) { self.emit('error', logErr) }
self.emit('logged');
}
//
// Indicate to the callee that the socket is not ready. This
// will enqueue the current message for later.
//
callback(true);
//
// Listen to the appropriate events on the socket that
// was just created.
//
this.socket.on(readyEvent, function () {
//
// When the socket is ready, write the current queue
// to it.
//
self.socket.write(self.queue.join(''), 'utf8', onError);
self.emit('logged');
self.queue = [];
self.retries = 0;
self.connected = true;
}).on('error', function (ex) {
//
// TODO: Pass this error back up
//
}).on('end', function (ex) {
//
// Nothing needs to be done here.
//
}).on('close', function (ex) {
//
// Attempt to reconnect on lost connection(s), progressively
// increasing the amount of time between each try.
//
var interval = Math.pow(2, self.retries);
self.connected = false;
setTimeout(function () {
self.retries++;
self.socket.connect(self.port, self.host);
}, interval * 1000);
}).on('timeout', function () {
if (self.socket.readyState !== 'open') {
self.socket.destroy();
}
});
this.socket.connect(this.port, this.host);
};
| mixdown/postmark | node_modules/mixdown-server/node_modules/winston-syslog/lib/winston-syslog.js | JavaScript | mit | 6,457 | [
30522,
1013,
1008,
1008,
25353,
14540,
8649,
1012,
1046,
2015,
1024,
3665,
2005,
15899,
2000,
1037,
6556,
25353,
14540,
8649,
7325,
1008,
1008,
1006,
1039,
1007,
2249,
5490,
5657,
5937,
2015,
1998,
4918,
18091,
1008,
10210,
11172,
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... |
// Generated by CoffeeScript 1.4.0
/* 2D Vector
*/
var Vector;
Vector = (function() {
/* Adds two vectors and returns the product.
*/
Vector.add = function(v1, v2) {
return new Vector(v1.x + v2.x, v1.y + v2.y);
};
/* Subtracts v2 from v1 and returns the product.
*/
Vector.sub = function(v1, v2) {
return new Vector(v1.x - v2.x, v1.y - v2.y);
};
/* Projects one vector (v1) onto another (v2)
*/
Vector.project = function(v1, v2) {
return v1.clone().scale((v1.dot(v2)) / v1.magSq());
};
/* Creates a new Vector instance.
*/
function Vector(x, y) {
this.x = x != null ? x : 0.0;
this.y = y != null ? y : 0.0;
}
/* Sets the components of this vector.
*/
Vector.prototype.set = function(x, y) {
this.x = x;
this.y = y;
return this;
};
/* Add a vector to this one.
*/
Vector.prototype.add = function(v) {
this.x += v.x;
this.y += v.y;
return this;
};
/* Subtracts a vector from this one.
*/
Vector.prototype.sub = function(v) {
this.x -= v.x;
this.y -= v.y;
return this;
};
/* Scales this vector by a value.
*/
Vector.prototype.scale = function(f) {
this.x *= f;
this.y *= f;
return this;
};
/* Computes the dot product between vectors.
*/
Vector.prototype.dot = function(v) {
return this.x * v.x + this.y * v.y;
};
/* Computes the cross product between vectors.
*/
Vector.prototype.cross = function(v) {
return (this.x * v.y) - (this.y * v.x);
};
/* Computes the magnitude (length).
*/
Vector.prototype.mag = function() {
return Math.sqrt(this.x * this.x + this.y * this.y);
};
/* Computes the squared magnitude (length).
*/
Vector.prototype.magSq = function() {
return this.x * this.x + this.y * this.y;
};
/* Computes the distance to another vector.
*/
Vector.prototype.dist = function(v) {
var dx, dy;
dx = v.x - this.x;
dy = v.y - this.y;
return Math.sqrt(dx * dx + dy * dy);
};
/* Computes the squared distance to another vector.
*/
Vector.prototype.distSq = function(v) {
var dx, dy;
dx = v.x - this.x;
dy = v.y - this.y;
return dx * dx + dy * dy;
};
/* Normalises the vector, making it a unit vector (of length 1).
*/
Vector.prototype.norm = function() {
var m;
m = Math.sqrt(this.x * this.x + this.y * this.y);
this.x /= m;
this.y /= m;
return this;
};
/* Limits the vector length to a given amount.
*/
Vector.prototype.limit = function(l) {
var m, mSq;
mSq = this.x * this.x + this.y * this.y;
if (mSq > l * l) {
m = Math.sqrt(mSq);
this.x /= m;
this.y /= m;
this.x *= l;
this.y *= l;
return this;
}
};
/* Copies components from another vector.
*/
Vector.prototype.copy = function(v) {
this.x = v.x;
this.y = v.y;
return this;
};
/* Clones this vector to a new itentical one.
*/
Vector.prototype.clone = function() {
return new Vector(this.x, this.y);
};
/* Resets the vector to zero.
*/
Vector.prototype.clear = function() {
this.x = 0.0;
this.y = 0.0;
return this;
};
return Vector;
})();
| hems/-labs | compiled/math/Vector.js | JavaScript | mit | 3,225 | [
30522,
1013,
1013,
7013,
2011,
4157,
22483,
1015,
1012,
1018,
1012,
1014,
1013,
1008,
14134,
9207,
1008,
1013,
13075,
9207,
1025,
9207,
1027,
1006,
3853,
1006,
1007,
1063,
1013,
1008,
9909,
2048,
19019,
1998,
5651,
1996,
4031,
1012,
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... |
if (bytes >= 512) {
__m256i y0, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14,
y15;
/* the naive way seems as fast (if not a bit faster) than the vector way */
__m256i z0 = _mm256_set1_epi32(x[0]);
__m256i z5 = _mm256_set1_epi32(x[1]);
__m256i z10 = _mm256_set1_epi32(x[2]);
__m256i z15 = _mm256_set1_epi32(x[3]);
__m256i z12 = _mm256_set1_epi32(x[4]);
__m256i z1 = _mm256_set1_epi32(x[5]);
__m256i z6 = _mm256_set1_epi32(x[6]);
__m256i z11 = _mm256_set1_epi32(x[7]);
__m256i z8; /* useless */
__m256i z13 = _mm256_set1_epi32(x[9]);
__m256i z2 = _mm256_set1_epi32(x[10]);
__m256i z7 = _mm256_set1_epi32(x[11]);
__m256i z4 = _mm256_set1_epi32(x[12]);
__m256i z9; /* useless */
__m256i z14 = _mm256_set1_epi32(x[14]);
__m256i z3 = _mm256_set1_epi32(x[15]);
__m256i orig0 = z0;
__m256i orig1 = z1;
__m256i orig2 = z2;
__m256i orig3 = z3;
__m256i orig4 = z4;
__m256i orig5 = z5;
__m256i orig6 = z6;
__m256i orig7 = z7;
__m256i orig8;
__m256i orig9;
__m256i orig10 = z10;
__m256i orig11 = z11;
__m256i orig12 = z12;
__m256i orig13 = z13;
__m256i orig14 = z14;
__m256i orig15 = z15;
uint32_t in8;
uint32_t in9;
int i;
while (bytes >= 512) {
/* vector implementation for z8 and z9 */
/* faster than the naive version for 8 blocks */
const __m256i addv8 = _mm256_set_epi64x(3, 2, 1, 0);
const __m256i addv9 = _mm256_set_epi64x(7, 6, 5, 4);
const __m256i permute = _mm256_set_epi32(7, 6, 3, 2, 5, 4, 1, 0);
__m256i t8, t9;
uint64_t in89;
in8 = x[8];
in9 = x[13]; /* see arrays above for the address translation */
in89 = ((uint64_t) in8) | (((uint64_t) in9) << 32);
z8 = z9 = _mm256_broadcastq_epi64(_mm_cvtsi64_si128(in89));
t8 = _mm256_add_epi64(addv8, z8);
t9 = _mm256_add_epi64(addv9, z9);
z8 = _mm256_unpacklo_epi32(t8, t9);
z9 = _mm256_unpackhi_epi32(t8, t9);
t8 = _mm256_unpacklo_epi32(z8, z9);
t9 = _mm256_unpackhi_epi32(z8, z9);
/* required because unpack* are intra-lane */
z8 = _mm256_permutevar8x32_epi32(t8, permute);
z9 = _mm256_permutevar8x32_epi32(t9, permute);
orig8 = z8;
orig9 = z9;
in89 += 8;
x[8] = in89 & 0xFFFFFFFF;
x[13] = (in89 >> 32) & 0xFFFFFFFF;
z5 = orig5;
z10 = orig10;
z15 = orig15;
z14 = orig14;
z3 = orig3;
z6 = orig6;
z11 = orig11;
z1 = orig1;
z7 = orig7;
z13 = orig13;
z2 = orig2;
z9 = orig9;
z0 = orig0;
z12 = orig12;
z4 = orig4;
z8 = orig8;
for (i = 0; i < ROUNDS; i += 2) {
/* the inner loop is a direct translation (regexp search/replace)
* from the amd64-xmm6 ASM */
__m256i r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13,
r14, r15;
y4 = z12;
y4 = _mm256_add_epi32(y4, z0);
r4 = y4;
y4 = _mm256_slli_epi32(y4, 7);
z4 = _mm256_xor_si256(z4, y4);
r4 = _mm256_srli_epi32(r4, 25);
z4 = _mm256_xor_si256(z4, r4);
y9 = z1;
y9 = _mm256_add_epi32(y9, z5);
r9 = y9;
y9 = _mm256_slli_epi32(y9, 7);
z9 = _mm256_xor_si256(z9, y9);
r9 = _mm256_srli_epi32(r9, 25);
z9 = _mm256_xor_si256(z9, r9);
y8 = z0;
y8 = _mm256_add_epi32(y8, z4);
r8 = y8;
y8 = _mm256_slli_epi32(y8, 9);
z8 = _mm256_xor_si256(z8, y8);
r8 = _mm256_srli_epi32(r8, 23);
z8 = _mm256_xor_si256(z8, r8);
y13 = z5;
y13 = _mm256_add_epi32(y13, z9);
r13 = y13;
y13 = _mm256_slli_epi32(y13, 9);
z13 = _mm256_xor_si256(z13, y13);
r13 = _mm256_srli_epi32(r13, 23);
z13 = _mm256_xor_si256(z13, r13);
y12 = z4;
y12 = _mm256_add_epi32(y12, z8);
r12 = y12;
y12 = _mm256_slli_epi32(y12, 13);
z12 = _mm256_xor_si256(z12, y12);
r12 = _mm256_srli_epi32(r12, 19);
z12 = _mm256_xor_si256(z12, r12);
y1 = z9;
y1 = _mm256_add_epi32(y1, z13);
r1 = y1;
y1 = _mm256_slli_epi32(y1, 13);
z1 = _mm256_xor_si256(z1, y1);
r1 = _mm256_srli_epi32(r1, 19);
z1 = _mm256_xor_si256(z1, r1);
y0 = z8;
y0 = _mm256_add_epi32(y0, z12);
r0 = y0;
y0 = _mm256_slli_epi32(y0, 18);
z0 = _mm256_xor_si256(z0, y0);
r0 = _mm256_srli_epi32(r0, 14);
z0 = _mm256_xor_si256(z0, r0);
y5 = z13;
y5 = _mm256_add_epi32(y5, z1);
r5 = y5;
y5 = _mm256_slli_epi32(y5, 18);
z5 = _mm256_xor_si256(z5, y5);
r5 = _mm256_srli_epi32(r5, 14);
z5 = _mm256_xor_si256(z5, r5);
y14 = z6;
y14 = _mm256_add_epi32(y14, z10);
r14 = y14;
y14 = _mm256_slli_epi32(y14, 7);
z14 = _mm256_xor_si256(z14, y14);
r14 = _mm256_srli_epi32(r14, 25);
z14 = _mm256_xor_si256(z14, r14);
y3 = z11;
y3 = _mm256_add_epi32(y3, z15);
r3 = y3;
y3 = _mm256_slli_epi32(y3, 7);
z3 = _mm256_xor_si256(z3, y3);
r3 = _mm256_srli_epi32(r3, 25);
z3 = _mm256_xor_si256(z3, r3);
y2 = z10;
y2 = _mm256_add_epi32(y2, z14);
r2 = y2;
y2 = _mm256_slli_epi32(y2, 9);
z2 = _mm256_xor_si256(z2, y2);
r2 = _mm256_srli_epi32(r2, 23);
z2 = _mm256_xor_si256(z2, r2);
y7 = z15;
y7 = _mm256_add_epi32(y7, z3);
r7 = y7;
y7 = _mm256_slli_epi32(y7, 9);
z7 = _mm256_xor_si256(z7, y7);
r7 = _mm256_srli_epi32(r7, 23);
z7 = _mm256_xor_si256(z7, r7);
y6 = z14;
y6 = _mm256_add_epi32(y6, z2);
r6 = y6;
y6 = _mm256_slli_epi32(y6, 13);
z6 = _mm256_xor_si256(z6, y6);
r6 = _mm256_srli_epi32(r6, 19);
z6 = _mm256_xor_si256(z6, r6);
y11 = z3;
y11 = _mm256_add_epi32(y11, z7);
r11 = y11;
y11 = _mm256_slli_epi32(y11, 13);
z11 = _mm256_xor_si256(z11, y11);
r11 = _mm256_srli_epi32(r11, 19);
z11 = _mm256_xor_si256(z11, r11);
y10 = z2;
y10 = _mm256_add_epi32(y10, z6);
r10 = y10;
y10 = _mm256_slli_epi32(y10, 18);
z10 = _mm256_xor_si256(z10, y10);
r10 = _mm256_srli_epi32(r10, 14);
z10 = _mm256_xor_si256(z10, r10);
y1 = z3;
y1 = _mm256_add_epi32(y1, z0);
r1 = y1;
y1 = _mm256_slli_epi32(y1, 7);
z1 = _mm256_xor_si256(z1, y1);
r1 = _mm256_srli_epi32(r1, 25);
z1 = _mm256_xor_si256(z1, r1);
y15 = z7;
y15 = _mm256_add_epi32(y15, z11);
r15 = y15;
y15 = _mm256_slli_epi32(y15, 18);
z15 = _mm256_xor_si256(z15, y15);
r15 = _mm256_srli_epi32(r15, 14);
z15 = _mm256_xor_si256(z15, r15);
y6 = z4;
y6 = _mm256_add_epi32(y6, z5);
r6 = y6;
y6 = _mm256_slli_epi32(y6, 7);
z6 = _mm256_xor_si256(z6, y6);
r6 = _mm256_srli_epi32(r6, 25);
z6 = _mm256_xor_si256(z6, r6);
y2 = z0;
y2 = _mm256_add_epi32(y2, z1);
r2 = y2;
y2 = _mm256_slli_epi32(y2, 9);
z2 = _mm256_xor_si256(z2, y2);
r2 = _mm256_srli_epi32(r2, 23);
z2 = _mm256_xor_si256(z2, r2);
y7 = z5;
y7 = _mm256_add_epi32(y7, z6);
r7 = y7;
y7 = _mm256_slli_epi32(y7, 9);
z7 = _mm256_xor_si256(z7, y7);
r7 = _mm256_srli_epi32(r7, 23);
z7 = _mm256_xor_si256(z7, r7);
y3 = z1;
y3 = _mm256_add_epi32(y3, z2);
r3 = y3;
y3 = _mm256_slli_epi32(y3, 13);
z3 = _mm256_xor_si256(z3, y3);
r3 = _mm256_srli_epi32(r3, 19);
z3 = _mm256_xor_si256(z3, r3);
y4 = z6;
y4 = _mm256_add_epi32(y4, z7);
r4 = y4;
y4 = _mm256_slli_epi32(y4, 13);
z4 = _mm256_xor_si256(z4, y4);
r4 = _mm256_srli_epi32(r4, 19);
z4 = _mm256_xor_si256(z4, r4);
y0 = z2;
y0 = _mm256_add_epi32(y0, z3);
r0 = y0;
y0 = _mm256_slli_epi32(y0, 18);
z0 = _mm256_xor_si256(z0, y0);
r0 = _mm256_srli_epi32(r0, 14);
z0 = _mm256_xor_si256(z0, r0);
y5 = z7;
y5 = _mm256_add_epi32(y5, z4);
r5 = y5;
y5 = _mm256_slli_epi32(y5, 18);
z5 = _mm256_xor_si256(z5, y5);
r5 = _mm256_srli_epi32(r5, 14);
z5 = _mm256_xor_si256(z5, r5);
y11 = z9;
y11 = _mm256_add_epi32(y11, z10);
r11 = y11;
y11 = _mm256_slli_epi32(y11, 7);
z11 = _mm256_xor_si256(z11, y11);
r11 = _mm256_srli_epi32(r11, 25);
z11 = _mm256_xor_si256(z11, r11);
y12 = z14;
y12 = _mm256_add_epi32(y12, z15);
r12 = y12;
y12 = _mm256_slli_epi32(y12, 7);
z12 = _mm256_xor_si256(z12, y12);
r12 = _mm256_srli_epi32(r12, 25);
z12 = _mm256_xor_si256(z12, r12);
y8 = z10;
y8 = _mm256_add_epi32(y8, z11);
r8 = y8;
y8 = _mm256_slli_epi32(y8, 9);
z8 = _mm256_xor_si256(z8, y8);
r8 = _mm256_srli_epi32(r8, 23);
z8 = _mm256_xor_si256(z8, r8);
y13 = z15;
y13 = _mm256_add_epi32(y13, z12);
r13 = y13;
y13 = _mm256_slli_epi32(y13, 9);
z13 = _mm256_xor_si256(z13, y13);
r13 = _mm256_srli_epi32(r13, 23);
z13 = _mm256_xor_si256(z13, r13);
y9 = z11;
y9 = _mm256_add_epi32(y9, z8);
r9 = y9;
y9 = _mm256_slli_epi32(y9, 13);
z9 = _mm256_xor_si256(z9, y9);
r9 = _mm256_srli_epi32(r9, 19);
z9 = _mm256_xor_si256(z9, r9);
y14 = z12;
y14 = _mm256_add_epi32(y14, z13);
r14 = y14;
y14 = _mm256_slli_epi32(y14, 13);
z14 = _mm256_xor_si256(z14, y14);
r14 = _mm256_srli_epi32(r14, 19);
z14 = _mm256_xor_si256(z14, r14);
y10 = z8;
y10 = _mm256_add_epi32(y10, z9);
r10 = y10;
y10 = _mm256_slli_epi32(y10, 18);
z10 = _mm256_xor_si256(z10, y10);
r10 = _mm256_srli_epi32(r10, 14);
z10 = _mm256_xor_si256(z10, r10);
y15 = z13;
y15 = _mm256_add_epi32(y15, z14);
r15 = y15;
y15 = _mm256_slli_epi32(y15, 18);
z15 = _mm256_xor_si256(z15, y15);
r15 = _mm256_srli_epi32(r15, 14);
z15 = _mm256_xor_si256(z15, r15);
}
/* store data ; this macro first transpose data in-registers, and then store
* them in memory. much faster with icc. */
#define ONEQUAD_TRANSPOSE(A, B, C, D) \
{ \
__m128i t0, t1, t2, t3; \
z##A = _mm256_add_epi32(z##A, orig##A); \
z##B = _mm256_add_epi32(z##B, orig##B); \
z##C = _mm256_add_epi32(z##C, orig##C); \
z##D = _mm256_add_epi32(z##D, orig##D); \
y##A = _mm256_unpacklo_epi32(z##A, z##B); \
y##B = _mm256_unpacklo_epi32(z##C, z##D); \
y##C = _mm256_unpackhi_epi32(z##A, z##B); \
y##D = _mm256_unpackhi_epi32(z##C, z##D); \
z##A = _mm256_unpacklo_epi64(y##A, y##B); \
z##B = _mm256_unpackhi_epi64(y##A, y##B); \
z##C = _mm256_unpacklo_epi64(y##C, y##D); \
z##D = _mm256_unpackhi_epi64(y##C, y##D); \
t0 = _mm_xor_si128(_mm256_extracti128_si256(z##A, 0), \
_mm_loadu_si128((__m128i*) (m + 0))); \
_mm_storeu_si128((__m128i*) (c + 0), t0); \
t1 = _mm_xor_si128(_mm256_extracti128_si256(z##B, 0), \
_mm_loadu_si128((__m128i*) (m + 64))); \
_mm_storeu_si128((__m128i*) (c + 64), t1); \
t2 = _mm_xor_si128(_mm256_extracti128_si256(z##C, 0), \
_mm_loadu_si128((__m128i*) (m + 128))); \
_mm_storeu_si128((__m128i*) (c + 128), t2); \
t3 = _mm_xor_si128(_mm256_extracti128_si256(z##D, 0), \
_mm_loadu_si128((__m128i*) (m + 192))); \
_mm_storeu_si128((__m128i*) (c + 192), t3); \
t0 = _mm_xor_si128(_mm256_extracti128_si256(z##A, 1), \
_mm_loadu_si128((__m128i*) (m + 256))); \
_mm_storeu_si128((__m128i*) (c + 256), t0); \
t1 = _mm_xor_si128(_mm256_extracti128_si256(z##B, 1), \
_mm_loadu_si128((__m128i*) (m + 320))); \
_mm_storeu_si128((__m128i*) (c + 320), t1); \
t2 = _mm_xor_si128(_mm256_extracti128_si256(z##C, 1), \
_mm_loadu_si128((__m128i*) (m + 384))); \
_mm_storeu_si128((__m128i*) (c + 384), t2); \
t3 = _mm_xor_si128(_mm256_extracti128_si256(z##D, 1), \
_mm_loadu_si128((__m128i*) (m + 448))); \
_mm_storeu_si128((__m128i*) (c + 448), t3); \
}
#define ONEQUAD(A, B, C, D) ONEQUAD_TRANSPOSE(A, B, C, D)
#define ONEQUAD_UNPCK(A, B, C, D) \
{ \
z##A = _mm256_add_epi32(z##A, orig##A); \
z##B = _mm256_add_epi32(z##B, orig##B); \
z##C = _mm256_add_epi32(z##C, orig##C); \
z##D = _mm256_add_epi32(z##D, orig##D); \
y##A = _mm256_unpacklo_epi32(z##A, z##B); \
y##B = _mm256_unpacklo_epi32(z##C, z##D); \
y##C = _mm256_unpackhi_epi32(z##A, z##B); \
y##D = _mm256_unpackhi_epi32(z##C, z##D); \
z##A = _mm256_unpacklo_epi64(y##A, y##B); \
z##B = _mm256_unpackhi_epi64(y##A, y##B); \
z##C = _mm256_unpacklo_epi64(y##C, y##D); \
z##D = _mm256_unpackhi_epi64(y##C, y##D); \
}
#define ONEOCTO(A, B, C, D, A2, B2, C2, D2) \
{ \
ONEQUAD_UNPCK(A, B, C, D); \
ONEQUAD_UNPCK(A2, B2, C2, D2); \
y##A = _mm256_permute2x128_si256(z##A, z##A2, 0x20); \
y##A2 = _mm256_permute2x128_si256(z##A, z##A2, 0x31); \
y##B = _mm256_permute2x128_si256(z##B, z##B2, 0x20); \
y##B2 = _mm256_permute2x128_si256(z##B, z##B2, 0x31); \
y##C = _mm256_permute2x128_si256(z##C, z##C2, 0x20); \
y##C2 = _mm256_permute2x128_si256(z##C, z##C2, 0x31); \
y##D = _mm256_permute2x128_si256(z##D, z##D2, 0x20); \
y##D2 = _mm256_permute2x128_si256(z##D, z##D2, 0x31); \
y##A = _mm256_xor_si256(y##A, _mm256_loadu_si256((__m256i*) (m + 0))); \
y##B = \
_mm256_xor_si256(y##B, _mm256_loadu_si256((__m256i*) (m + 64))); \
y##C = \
_mm256_xor_si256(y##C, _mm256_loadu_si256((__m256i*) (m + 128))); \
y##D = \
_mm256_xor_si256(y##D, _mm256_loadu_si256((__m256i*) (m + 192))); \
y##A2 = \
_mm256_xor_si256(y##A2, _mm256_loadu_si256((__m256i*) (m + 256))); \
y##B2 = \
_mm256_xor_si256(y##B2, _mm256_loadu_si256((__m256i*) (m + 320))); \
y##C2 = \
_mm256_xor_si256(y##C2, _mm256_loadu_si256((__m256i*) (m + 384))); \
y##D2 = \
_mm256_xor_si256(y##D2, _mm256_loadu_si256((__m256i*) (m + 448))); \
_mm256_storeu_si256((__m256i*) (c + 0), y##A); \
_mm256_storeu_si256((__m256i*) (c + 64), y##B); \
_mm256_storeu_si256((__m256i*) (c + 128), y##C); \
_mm256_storeu_si256((__m256i*) (c + 192), y##D); \
_mm256_storeu_si256((__m256i*) (c + 256), y##A2); \
_mm256_storeu_si256((__m256i*) (c + 320), y##B2); \
_mm256_storeu_si256((__m256i*) (c + 384), y##C2); \
_mm256_storeu_si256((__m256i*) (c + 448), y##D2); \
}
ONEOCTO(0, 1, 2, 3, 4, 5, 6, 7);
m += 32;
c += 32;
ONEOCTO(8, 9, 10, 11, 12, 13, 14, 15);
m -= 32;
c -= 32;
#undef ONEQUAD
#undef ONEQUAD_TRANSPOSE
#undef ONEQUAD_UNPCK
#undef ONEOCTO
bytes -= 512;
c += 512;
m += 512;
}
}
| Jigsaw-Code/outline-client | third_party/sodium/src/libsodium/crypto_stream/salsa20/xmm6int/u8.h | C | apache-2.0 | 18,396 | [
30522,
2065,
1006,
27507,
1028,
1027,
24406,
1007,
1063,
1035,
1035,
25525,
26976,
2072,
1061,
2692,
1010,
1061,
2487,
1010,
1061,
2475,
1010,
1061,
2509,
1010,
1061,
2549,
1010,
1061,
2629,
1010,
1061,
2575,
1010,
1061,
2581,
1010,
1061,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/*Owner & Copyrights: Vance King Saxbe. A.*//*Copyright (c) <2014> Author Vance King Saxbe. A, and contributors Power Dominion Enterprise, Precieux Consulting and other contributors. Modelled, Architected and designed by Vance King Saxbe. A. with the geeks from GoldSax Consulting and GoldSax Technologies email @vsaxbe@yahoo.com. Development teams from Power Dominion Enterprise, Precieux Consulting. Project sponsored by GoldSax Foundation, GoldSax Group and executed by GoldSax Manager.*/
$stream = file_get_contents('HITEJINROLAST.txt');
$avgp = "21500.00";
$high = "21750.00";
$low = "21250.00";
echo "&L=".$stream."&N=HITEJINRO&";
$temp = file_get_contents("HITEJINROTEMP.txt", "r");
if ($stream != $temp ) {
$mhigh = ($avgp + $high)/2;
$mlow = ($avgp + $low)/2;
$llow = ($low - (($avgp - $low)/2));
$hhigh = ($high + (($high - $avgp)/2));
$diff = $stream - $temp;
$diff = number_format($diff, 2, '.', '');
$avgp = number_format($avgp, 2, '.', '');
if ( $stream > $temp ) {
if ( ($stream > $mhigh ) && ($stream < $high)) { echo "&sign=au" ; }
if ( ($stream < $mlow ) && ($stream > $low)) { echo "&sign=ad" ; }
if ( $stream < $llow ) { echo "&sign=as" ; }
if ( $stream > $hhigh ) { echo "&sign=al" ; }
if ( ($stream < $hhigh) && ($stream > $high)) { echo "&sign=auu" ; }
if ( ($stream > $llow) && ($stream < $low)) { echo "&sign=add" ; }
//else { echo "&sign=a" ; }
$filedish = fopen("C:\wamp\www\malert.txt", "a+");
$write = fputs($filedish, "HITEJINRO:".$stream. ":Moving up:".$diff.":".$high.":".$low.":".$avgp."\r\n");
fclose( $filedish );}
if ( $stream < $temp ) {
if ( ($stream >$mhigh) && ($stream < $high)) { echo "&sign=bu" ; }
if ( ($stream < $mlow) && ($stream > $low)) { echo "&sign=bd" ; }
if ( $stream < $llow ) { echo "&sign=bs" ; }
if ( $stream > $hhigh ) { echo "&sign=bl" ; }
if ( ($stream < $hhigh) && ($stream > $high)) { echo "&sign=buu" ; }
if ( ($stream > $llow) && ($stream < $low)) { echo "&sign=bdd" ; }
// else { echo "&sign=b" ; }
$filedish = fopen("C:\wamp\www\malert.txt", "a+");
$write = fputs($filedish, "HITEJINRO:".$stream. ":Moving down:".$diff.":".$high.":".$low.":".$avgp."\r\n");
fclose( $filedish );}
$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filename= 'HITEJINRO.txt';
$file = fopen($filename, "a+" );
fwrite( $file, $stream.":".$time."\r\n" );
fclose( $file );
if (($stream > $mhigh ) && ($temp<= $mhigh ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$risk = ($stream - $low) * (200000/$stream);
$risk = (int)$risk;
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:".$stream. ":Approaching:PHIGH:".$high.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream < $mhigh ) && ($temp>= $mhigh ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $stream) * (200000/$stream);
$risk = (int)$risk;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:". $stream.":Moving Down:PHIGH:".$high.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream > $mlow ) && ($temp<= $mlow ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$risk = ($stream - $low) * (200000/$stream);
$risk = (int)$risk;
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:".$stream. ":Moving Up:PLOW:".$low.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream < $mlow ) && ($temp>= $mlow ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $stream) * (200000/$stream);
$risk = (int)$risk;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:". $stream.":Approaching:PLOW:".$low.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream > $high ) && ($temp<= $high ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$risk = ($stream - $low) * (200000/$stream);
$risk = (int)$risk;
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:".$stream. ":Breaking:PHIGH:".$high.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream > $hhigh ) && ($temp<= $hhigh ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$risk = ($stream - $low) * (200000/$stream);
$risk = (int)$risk;
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:".$stream. ":Moving Beyond:PHIGH:".$high.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream < $hhigh ) && ($temp>= $hhigh ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:". $stream. ":Coming near:PHIGH:".$high.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream < $high ) && ($temp>= $high ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:". $stream. ":Retracing:PHIGH:".$high."\r\n");
fclose( $filedash );
}
if (($stream < $llow ) && ($temp>= $llow ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $stream) * (200000/$stream);
$risk = (int)$risk;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:". $stream.":Breaking Beyond:PLOW:".$low.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream < $low ) && ($temp>= $low ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $stream) * (200000/$stream);
$risk = (int)$risk;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:". $stream.":Breaking:PLOW:".$low.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream > $llow ) && ($temp<= $llow ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:". $stream.":Coming near:PLOW:".$low.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream > $low ) && ($temp<= $low ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:". $stream.":Retracing:PLOW:".$low."\r\n");
fclose( $filedash );
}
if (($stream > $avgp ) && ($temp<= $avgp ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($stream - $low) * (200000/$stream);
$risk = (int)$risk;
$avgp = number_format($avgp, 2, '.', '');
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:".$stream. ":Sliding up:PAVG:".$avgp.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream < $avgp ) && ($temp>= $avgp ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $stream) * (200000/$stream);
$risk = (int)$risk;
$avgp = number_format($avgp, 2, '.', '');
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "HITEJINRO:".$stream. ":Sliding down:PAVG:".$avgp.":Short Cost:".$risk."\r\n");
fclose( $filedash );
}
}
$filedash = fopen("HITEJINROTEMP.txt", "w");
$wrote = fputs($filedash, $stream);
fclose( $filedash );
//echo "&chg=".$json_output['cp']."&";
?>
/*email to provide support at vancekingsaxbe@powerdominionenterprise.com, businessaffairs@powerdominionenterprise.com, For donations please write to fundraising@powerdominionenterprise.com*/ | VanceKingSaxbeA/KOSPI-Engine | App/HITEJINRO.php | PHP | mit | 9,175 | [
30522,
1013,
1008,
3954,
1004,
9385,
2015,
1024,
16672,
2332,
19656,
4783,
1012,
1037,
1012,
1008,
1013,
1013,
1008,
9385,
1006,
1039,
1007,
1026,
2297,
1028,
3166,
16672,
2332,
19656,
4783,
1012,
1037,
1010,
1998,
16884,
2373,
13738,
6960,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.baobaotao.transaction.nestcall;
public class BaseService {
}
| puliuyinyi/test | src/main/java/com/baobaotao/transaction/nestcall/BaseService.java | Java | gpl-3.0 | 75 | [
30522,
7427,
4012,
1012,
25945,
3676,
17287,
2080,
1012,
12598,
1012,
9089,
9289,
2140,
1025,
2270,
2465,
7888,
2121,
7903,
2063,
1063,
1065,
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,
0,
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... |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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.
#
from .client import SearchServiceClient
from .async_client import SearchServiceAsyncClient
__all__ = (
"SearchServiceClient",
"SearchServiceAsyncClient",
)
| googleapis/python-retail | google/cloud/retail_v2/services/search_service/__init__.py | Python | apache-2.0 | 765 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
9385,
16798,
2475,
8224,
11775,
1001,
1001,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
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... |
public class Grid {
public Tile array[][] = new Tile[10][8];
public Grid() {
//
for(int y = 0; y < getHeight(); y++) {
for(int x = 0; x < getWidth(); x++) {
array[x][y] = new Tile();
}
}
}
public int getWidth() { return 9; }
public int getHeight() { return 7; }
public Tile getTile(int x, int y) {
Tile mytile = new Tile();
try {
//System.out.println("Actual tile returned");
mytile = array[x][y];
}
catch(ArrayIndexOutOfBoundsException e) {
//System.out.println("Out of bounds tile");
}
finally {
//System.out.println("Returning false tile");
return mytile;
}
}
public void makeHole() {
for(int y = 0; y < getHeight(); y++) {
for(int x = 0; x < getWidth(); x++) {
if(((y == 1) || (y == 5)) && (x>=3) && (x<=6)) {
array[x][y].visible = false;
}
if(((y == 2) || (y == 4)) && (x>=2) && (x<=6)) {
array[x][y].visible = false;
}
if((y == 3) && (x>=2) && (x<=7)) {
array[x][y].visible = false;
}
}
}
}
public void makeHolierHole() {
for(int y = 0; y < getHeight(); y++) {
for(int x = 0; x < getWidth(); x++) {
if((x >= 1+y%2) && (x <= 5+y%2)) {
array[x][y].visible = false;
}
}
}
}
} | Caaz/danmaku-class-project | Grid.java | Java | mit | 1,391 | [
30522,
2270,
2465,
8370,
1063,
2270,
14090,
9140,
1031,
1033,
1031,
1033,
1027,
2047,
14090,
1031,
2184,
1033,
1031,
1022,
1033,
1025,
2270,
8370,
1006,
1007,
1063,
1013,
1013,
2005,
1006,
20014,
1061,
1027,
1014,
1025,
1061,
1026,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 - 2022 Green River Data Analysis, LLC
#
# License detail: https://github.com/greenriver/hmis-warehouse/blob/production/LICENSE.md
###
class HmisCsvImporter::HmisCsvValidation::ValidFormat < HmisCsvImporter::HmisCsvValidation::Validation
def self.check_validity!(item, column, regex: nil)
value = item[column]
return if value.blank? || regex.blank? || value.to_s.match?(regex)
new(
importer_log_id: item['importer_log_id'],
source_id: item['source_id'],
source_type: item['source_type'],
status: "Expected #{value} to match regular expression #{regex} for #{column}",
validated_column: column,
)
end
def self.title
'Expected pattern was not found'
end
end
| greenriver/hmis-warehouse | drivers/hmis_csv_importer/app/models/hmis_csv_importer/hmis_csv_validation/valid_format.rb | Ruby | gpl-3.0 | 737 | [
30522,
1001,
1001,
1001,
1001,
9385,
2355,
1011,
16798,
2475,
2665,
2314,
2951,
4106,
1010,
11775,
1001,
1001,
6105,
6987,
1024,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
2665,
24352,
1013,
20287,
2483,
1011,
9746,
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... |
<?php
namespace Mopa\Bundle\BootstrapBundle\Navbar\Twig;
use Knp\Menu\Twig\Helper;
class MenuExtension extends \Twig_Extension
{
protected $helper;
/**
* @param \Knp\Menu\Twig\Helper $helper
*/
public function __construct(Helper $helper)
{
$this->helper = $helper;
}
public function getFunctions()
{
return array(
'mopa_bootstrap_menu' => new \Twig_Function_Method($this, 'renderMenu', array('is_safe' => array('html'))),
);
}
/**
* Renders the whole Navbar with the specified renderer.
*
* @param \Knp\Menu\ItemInterface|string|array $menu
* @param array $options
* @param string $renderer
* @return string
*/
public function renderMenu($menu, array $options = array(), $renderer = null)
{
$options = array_merge(array(
'template' => 'MopaBootstrapBundle:Menu:menu.html.twig',
'currentClass' => 'active',
'ancestorClass' => 'active',
'allow_safe_labels' => true,
), $options);
return $this->helper->render($menu, $options, $renderer);
}
/**
* @return string
*/
public function getName()
{
return 'mopa_bootstrap_navbar';
}
}
| RonaldKlaus/kubus2 | vendor/mopa/bootstrap-bundle/Mopa/Bundle/BootstrapBundle/Navbar/Twig/MenuExtension.php | PHP | mit | 1,333 | [
30522,
1026,
1029,
25718,
3415,
15327,
9587,
4502,
1032,
14012,
1032,
6879,
6494,
2361,
27265,
2571,
1032,
6583,
26493,
2906,
1032,
1056,
16279,
1025,
2224,
14161,
2361,
1032,
12183,
1032,
1056,
16279,
1032,
2393,
2121,
1025,
2465,
12183,
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... |
<div class="direction-title">
<span>当前位置>实时监控><span style="color:#e4393c;">智能电动窗帘系统</span></span>
<span class="hidden-angle"></span>
</div>
<div ng-repeat="item in PointItems" on-finish-render-filters>
<img src="../../Images/monitor/{{item.Type}}.png" width="40" height="40" id="{{item.ID}}" title="类型:{{item.Type}} ItemID:{{item.ItemID}}"
ng-style="setPosition(item.TopPos,item.LeftPos)" ip="{{item.ItemID}}" draggable="true" ondragstart="dragStart(event)"
ondragend="dragEnd(event)" ondblclick="popVideoWnd(this.id, '视频播放器', 'app/video/pop.html', '1005', '600')" />
</div>
| chengliangkaka/HuaGong | HuaGong/App/Monitor/Curtain/list.html | HTML | apache-2.0 | 658 | [
30522,
1026,
4487,
2615,
2465,
1027,
1000,
3257,
1011,
2516,
1000,
1028,
1026,
8487,
1028,
100,
1776,
100,
100,
1028,
100,
100,
100,
100,
1028,
1026,
8487,
2806,
1027,
1000,
3609,
1024,
1001,
1041,
23777,
2683,
2509,
2278,
1025,
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... |
#
# This file is part of MCUSim, an XSPICE library with microcontrollers.
#
# Copyright (C) 2017-2019 MCUSim Developers, see AUTHORS.txt for contributors.
#
# MCUSim 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.
#
# MCUSim 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 <https://www.gnu.org/licenses/>.
#
# - Try to find readline include dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Readline)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Readline_ROOT_DIR Set this variable to the root installation of
# readline if the module has problems finding the
# proper installation path.
#
# Variables defined by this module:
#
# READLINE_FOUND System has readline, include and lib dirs found
# Readline_INCLUDE_DIR The readline include directories.
# Readline_LIBRARY The readline library.
find_path(Readline_ROOT_DIR
NAMES include/readline/readline.h
)
find_path(Readline_INCLUDE_DIR
NAMES readline/readline.h
HINTS ${Readline_ROOT_DIR}/include
)
find_library(Readline_LIBRARY
NAMES readline
HINTS ${Readline_ROOT_DIR}/lib
)
if(Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY)
set(READLINE_FOUND TRUE)
else(Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY)
FIND_LIBRARY(Readline_LIBRARY NAMES readline)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG Readline_INCLUDE_DIR Readline_LIBRARY)
MARK_AS_ADVANCED(Readline_INCLUDE_DIR Readline_LIBRARY)
endif(Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY)
mark_as_advanced(
Readline_ROOT_DIR
Readline_INCLUDE_DIR
Readline_LIBRARY
)
| dsalychev/mcusim | cmake/FindReadline.cmake | CMake | gpl-3.0 | 2,257 | [
30522,
1001,
1001,
2023,
5371,
2003,
2112,
1997,
11338,
2271,
5714,
1010,
2019,
1060,
13102,
6610,
3075,
2007,
12702,
8663,
13181,
10820,
2015,
1012,
1001,
1001,
9385,
1006,
1039,
1007,
2418,
1011,
10476,
11338,
2271,
5714,
9797,
1010,
2156... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 "FOXMacros.h"
@class FOXRoseTree;
@protocol FOXGenerator;
@protocol FOXRandom;
typedef struct {
NSInteger start;
NSInteger end;
} FOXRange;
/*! Creates a generator with a -[description] to help debugging.
*/
FOX_EXPORT id<FOXGenerator> FOXWithName(NSString *name, id<FOXGenerator> generator);
/*! Creates a generator that conforms to the FOXGenerator protocol.
*/
FOX_EXPORT id<FOXGenerator> FOXGenerate(FOXRoseTree *(^generator)(id<FOXRandom> random, NSUInteger size));
/*! Creates a generator that always returns the given rose tree.
*/
FOX_EXPORT id<FOXGenerator> FOXGenPure(FOXRoseTree *tree);
/*! Creates a generator that applies the given block to another generator.
* This effectively "chains" operations on existing generators.
*
* @param generator The generator whose rose tree is modified post-generation.
* @param mapfn The block that transforms the rose tree of the given generator
* produced into the resulting rose tree that is returned by the
* generator that FOXGenMap creates.
* @returns a generator that applies the given block to the rose tree of the
* given generator.
*/
FOX_EXPORT id<FOXGenerator> FOXGenMap(
id<FOXGenerator> generator,
FOXRoseTree *(^mapfn)(FOXRoseTree *generatedTree));
/*! Creates a generator that takes the rose tree of another generator as input.
*
* @param generator The generator whose rose tree is used as input.
* @param generatorFactory The factory that produces a generator given the
* rose tree of the given generator.
* @returns the generator created by the generatorFactory block.
*/
FOX_EXPORT id<FOXGenerator> FOXGenBind(
id<FOXGenerator> generator,
id<FOXGenerator> (^generatorFactory)(FOXRoseTree *generatedTree));
/*! Creates a generator by applying the block to each value produced by the
* given generator. This is a higher abstraction than FOXGenMap.
*
* @param generator The generator whose values will be transformed.
* @param fn The block that transforms values generated.
* @returns a generator that produces rose trees with fn applied.
*/
FOX_EXPORT id<FOXGenerator> FOXMap(id<FOXGenerator> generator, id(^fn)(id generatedValue));
/*! Creates a generator that takes another generator's generated values as
* input. This is a higher abstraction than FOXGenBind
*
* @param generator The generator whose values will be used as input.
* @param fn The factory block that produces a new generator given the other
* generator's values as input.
* @returns the generator produced by fn.
*/
FOX_EXPORT id<FOXGenerator> FOXBind(id<FOXGenerator> generator, id<FOXGenerator> (^fn)(id generatedValue));
/*! Creates a generator that randomly picks numbers within the given range
* (inclusive). Shrinks towards the lower-bound number.
*
* @param lower The lower bound integer that can be generated (inclusive).
* @param upper The upper bound integer that can be generated (inclusive).
* @returns a generator that produces integers (boxed as NSNumber *)
*/
FOX_EXPORT id<FOXGenerator> FOXChoose(NSNumber *lower, NSNumber *upper);
/*! Creates a generator that takes the size hint as input. This is useful
* when the generator creation relies in the size parameter.
*
* @param fn The factory block that produces the generator with the intended
* size hint as its parameter.
* @returns the generator produced by fn.
*/
FOX_EXPORT id<FOXGenerator> FOXSized(id<FOXGenerator> (^fn)(NSUInteger size));
/*! Creates a generator that always returns the given value. This is a higher
* abstraction than FOXGenPure. This generator does not support shrinking.
*
* @param value The value that is always returned.
* @returns a generator that always returns value and never shrinks.
*/
FOX_EXPORT id<FOXGenerator> FOXReturn(id value);
/*! Creates a generator that produces values of the given generator, but
* filters out values that do not satisfy a predicate block.
*
* This function will raise an exception if 10 values are filtered in a row.
* @see FoxSuchThatWithMaxTries to increase this if needed.
*
* @warning This is inefficient and tosses away generated data. Avoid using
* this when possible.
*
* @param generator The generator whose values will be filtered.
* @param predicate The block that indicates if values are dropped by returning
* NO.
* @returns a generator that produces values of the original generator filtered
* by predicate.
*/
FOX_EXPORT id<FOXGenerator> FOXSuchThat(id<FOXGenerator> generator, BOOL(^predicate)(id generatedValue));
/*! Creates a generator that produces values of the given generator, but
* filters out values that do not satisfy a predicate block.
*
* This function will raise an exception if more values are filtered in a row
* than maxTries.
*
* @warning This is inefficient and tosses away generated data. Avoid using
* this when possible.
*
* @param generator The generator whose values will be filtered.
* @param predicate The block that indicates if values are dropped by returning
* NO.
* @param maxTries The maximum number of values to be dropped in a row before
* aborting by raising an exception.
* @returns a generator that produces values of the original generator filtered
* by predicate.
*/
FOX_EXPORT id<FOXGenerator> FOXSuchThatWithMaxTries(id<FOXGenerator> generator, BOOL(^predicate)(id generatedValue), NSUInteger maxTries);
/*! Creates a generator that randomly picks one of the given generators.
* Shrinking is dependent on the given generator. FOXOneOf will not switch the
* generator that caused the failued during shrinking.
*
* Generators are picked evenly.
* @see FOXFrequency if you want to pick generators unevenly.
*
* @param generators An array of generators to select from.
* @returns a generator that randomly uses one of the generators its provided.
*/
FOX_EXPORT id<FOXGenerator> FOXOneOf(NSArray *generators);
/*! Creates a generator that randomly picks one of the given elements in the
* provided array. The generator will shrink to elements with a lower index
* in the array.
*
* @param elements An array of objects to pick from when generating values.
* @returns a generator that randomly returns one of the values in elements.
*/
FOX_EXPORT id<FOXGenerator> FOXElements(NSArray *elements);
/*! Creates a generator that radomly picks one of the given generators based on
* weighted frequencies.
*
* The percent chance of selecting an element is based on the sum of all the
* weights.
*
* @param An array of 2-element arrays: [(NSNumber, id<FOXGenerator>)] where
* the number is an unsigned integer indicating the likelihood of
* being selected.
* @returns a generator that randomly uses a given generator based on weighted
* frequencies.
*/
FOX_EXPORT id<FOXGenerator> FOXFrequency(NSArray *tuples);
/*! Creates a generator that overrides the runtime size for the given generator.
* This can prevent shrinking for the given generator.
*
* @param generator The generator that will use the newSize when producing
* values.
* @param newSize the new size to provide to the given generator.
* @returns a new generator that produces values from the given generator at
* the specified size.
*/
FOX_EXPORT id<FOXGenerator> FOXResize(id<FOXGenerator> generator, NSUInteger newSize);
/*! Creates a generator that overrides the runtime size for the given generator.
* This generator will shrink to the lower bound size specified, but can still
* restrict the shrinking capabilities of the given generator.
*
* @param generator The generator that will use the a size in the given range
* when generating values.
* @param minimumRange The minimum size that can be used for the given
* generator (inclusive).
* @param maximumRange The maximum size that can be used for the given
* generator (inclusive).
* @returns a generor that produces values from the given genrator within the
* given size range.
*/
FOX_EXPORT id<FOXGenerator> FOXResizeRange(id<FOXGenerator> generator, NSUInteger minimumRange, NSUInteger maximumRange);
| bgerstle/HomeFries | Pods/Fox/Fox/Public/Generators/FOXCoreGenerators.h | C | mit | 8,371 | [
30522,
1001,
12324,
1000,
4419,
22911,
7352,
1012,
1044,
1000,
1030,
2465,
4419,
13278,
13334,
1025,
1030,
8778,
4419,
6914,
6906,
4263,
1025,
1030,
8778,
4419,
13033,
5358,
1025,
21189,
12879,
2358,
6820,
6593,
1063,
24978,
18447,
26320,
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... |
/**
* @license angular-sortable-column
* (c) 2013 Knight Rider Consulting, Inc. http://www.knightrider.com
* License: MIT
*/
/**
*
* @author Dale "Ducky" Lotts
* @since 7/21/13
*/
basePath = '..';
files = [
JASMINE,
JASMINE_ADAPTER,
'bower_components/jquery/dist/jquery.js',
'bower_components/angular/angular.js',
'bower_components/angular-route/angular-route.js',
'bower_components/angular-mocks/angular-mocks.js',
'src/js/sortableColumn.js',
'test/*.spec.js'
];
// list of files to exclude
exclude = [
];
preprocessors = {
'**/src/js/*.js': 'coverage'
};
// test results reporter to use
// possible values: 'dots', 'progress', 'junit'
reporters = ['progress', 'coverage'];
// web server port
port = 9876;
// cli runner port
runnerPort = 9100;
// enable / disable colors in the output (reporters and logs)
colors = true;
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel = LOG_INFO;
// enable / disable watching file and executing tests whenever any file changes
autoWatch = false;
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers = ['Chrome'];
// If browser does not capture in given timeout [ms], kill it
captureTimeout = 60000;
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun = true; | dalelotts/angular-sortable-column | test/test.conf.js | JavaScript | mit | 1,481 | [
30522,
1013,
1008,
1008,
1008,
1030,
6105,
16108,
1011,
4066,
3085,
1011,
5930,
1008,
1006,
1039,
1007,
2286,
5000,
7945,
10552,
1010,
4297,
1012,
8299,
1024,
1013,
1013,
7479,
1012,
5000,
15637,
2099,
1012,
4012,
1008,
6105,
1024,
10210,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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;
namespace Consumentor.ShopGun
{
public class ActionStartEventArgs : EventArgs
{
public DateTime DateTime { get; private set; }
public ActionStartEventArgs()
{
DateTime = ShopGunTime.Now;
}
}
} | consumentor/Server | trunk/src/Infrastructure/ActionStartEventArgs.cs | C# | lgpl-3.0 | 277 | [
30522,
2478,
2291,
1025,
3415,
15327,
16678,
13663,
2099,
1012,
4497,
12734,
1063,
2270,
2465,
4506,
7559,
2618,
15338,
2906,
5620,
1024,
2724,
2906,
5620,
1063,
2270,
3058,
7292,
3058,
7292,
1063,
2131,
1025,
2797,
2275,
1025,
1065,
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... |
package com.deleidos.framework.monitoring.response;
public class InfoResponse {
public static final String PATH = "/proxy/${APP_ID}/ws/v2/stram/info";
public static class Stats {
public int allocatedContainers;
public int plannedContainers;
public int totalVCoresAllocated;
public int vcoresRequired;
public int memoryRequired;
public int tuplesProcessedPSMA;
public long totalTuplesProcessed;
public int tuplesEmittedPSMA;
public long totalTuplesEmitted;
public int totalMemoryAllocated;
public int totalBufferServerReadBytesPSMA;
public int totalBufferServerWriteBytesPSMA;
public int[] criticalPath;
public int latency;
public long windowStartMillis;
public int numOperators;
public int failedContainers;
public long currentWindowId;
public long recoveryWindowId;
}
public String name;
public String user;
public long startTime;
public long elapsedTime;
public String appPath;
public String gatewayAddress;
public boolean gatewayConnected;
public Object[] appDataSources;
public Object metrics;
public Object attributes;
public String appMasterTrackingUrl;
public String version;
public Stats stats;
public String id;
//public String state; // Can't get this from this request
}
| deleidos/de-pipeline-tool | de-framework-monitoring/src/main/java/com/deleidos/framework/monitoring/response/InfoResponse.java | Java | apache-2.0 | 1,247 | [
30522,
7427,
4012,
1012,
3972,
7416,
12269,
1012,
7705,
1012,
8822,
1012,
3433,
1025,
2270,
2465,
18558,
6072,
26029,
3366,
1063,
2270,
10763,
2345,
5164,
4130,
1027,
1000,
1013,
24540,
1013,
1002,
1063,
10439,
1035,
8909,
1065,
1013,
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... |
'use strict';
/**
* This controller handles trigger requests from the Cumulus system that fires
* when assets are updated, inserted or deleted.
*
* An example request is:
*
* req.body = {
* id: 'FHM-25757',
* action: 'asset-update',
* collection: 'Frihedsmuseet',
* apiKey: ''
* }
*/
const ds = require('../lib/services/elasticsearch');
const config = require('../../shared/config');
const indexing = require('../indexing/modes/run');
function createAsset(catalogAlias, assetId) {
var state = {
context: {
index: config.es.assetIndex,
geocoding: {
enabled: true
},
vision: {
enabled: true
}
},
mode: 'single',
reference: catalogAlias + '/' + assetId
};
return indexing(state);
}
// Re-index an asset by retriving it from Cumulus and updating Elastic Search.
function updateAsset(catalogAlias, assetId) {
var state = {
context: {
index: config.es.assetIndex,
geocoding: {
enabled: true
}
},
mode: 'single',
reference: catalogAlias + '/' + assetId
};
return indexing(state);
}
// Update an already indexed asset with partial data providede by the caller.
function updateAssetsFromData(partials) {
// Support both a single document and a list.
if (!Array.isArray(partials)) {
partials = [partials];
}
// Construct an array of bulk-updates. Each document update is prefixed with
// an update action object.
let items = [];
partials.forEach((partial) => {
const updateAction = {
'update': {
_index: config.es.assetIndex,
'_id': partial.collection + '-' + partial.id
}
};
items.push(updateAction);
items.push({doc: partial});
});
const query = {
body: items,
};
return ds.bulk(query).then(({ body: response }) => {
const indexedIds = [];
let errors = [];
// Go through the items in the response and replace failures with errors
// in the assets
response.items.forEach(item => {
if (item.update.status >= 200 && item.update.status < 300) {
indexedIds.push(item.update._id);
} else {
// TODO: Consider using the AssetIndexingError instead
errors.push({
trace: new Error('Failed update ' + item.update._id),
item,
});
}
});
console.log('Updated ', indexedIds.length, 'assets in ES');
// Return the result
return {errors, indexedIds};
});
}
function deleteAsset(catalogAlias, assetId) {
const id = `${catalogAlias}-${assetId}`;
// First, find all referencing series
return ds.search({
index: config.es.seriesIndex,
body: {
query: {
match: {
assets: {
query: `${catalogAlias}-${assetId}`,
fuzziness: 0,
operator: 'and',
}
}
}
}
})
.then(({body: response}) => {
const bulkOperations = [];
response.hits.hits.forEach(({ _id: seriesId, _source: series }) => {
const assetIndex = series.assets.findIndex((assetId) => assetId === id);
series.assets.splice(assetIndex, 1);
const previewAssetIndex = series.previewAssets.findIndex((previewAsset) => `${previewAsset.collection}-${previewAsset.id}` === id);
if(previewAssetIndex !== -1) {
//TODO: Replace preview asset -- we need to look up a full new asset
// For now, we just remove the preview asset - editing any other asset should
// result in it being added here.
series.previewAssets.splice(previewAssetIndex, 1);
}
if(series.assets.length > 0) {
// If at least one asset remains in series, update it
bulkOperations.push({
'index' : {
'_index': config.es.seriesIndex,
'_id': seriesId
}
});
bulkOperations.push({...series});
}
else {
// If the serie is now empty, delete it
bulkOperations.push({delete: {_index: config.es.seriesIndex, _id: seriesId}});
}
});
bulkOperations.push({delete: {_index: config.es.assetIndex, _id: id}});
return ds.bulk({
body: bulkOperations,
}).then(({body: response}) => response);
});
}
module.exports.asset = function(req, res, next) {
if(req.body.apiKey !== config.kbhAccessKey) {
return res.sendStatus(401);
}
const action = req.body.action || null;
const catalogName = req.body.collection || null;
let id = req.body.id || '';
let catalogAlias = null;
console.log('Index asset called with body: ', JSON.stringify(req.body));
// If the catalog alias is not sat in the ID
if(id.indexOf('-') > -1) {
[catalogAlias, id] = id.split('-');
} else if(catalogName) {
// No slash in the id - the catalog should be read from .collection
catalogAlias = Object.keys(config.cip.catalogs)
.find((alias) => catalogName === config.cip.catalogs[alias]);
}
if (!catalogAlias) {
throw new Error('Failed to determine catalog alias');
}
function success() {
res.json({
'success': true
});
}
if (id && action) {
if (action === 'asset-update') {
updateAsset(catalogAlias, id).then(success, next);
} else if (action === 'asset-create') {
createAsset(catalogAlias, id).then(success, next);
} else if (action === 'asset-delete') {
deleteAsset(catalogAlias, id).then(success, next);
} else {
next(new Error('Unexpected action from Cumulus: ' + action));
}
} else {
var requestBody = JSON.stringify(req.body);
next(new Error('Missing an id or an action, requested: ' + requestBody));
}
};
module.exports.createAsset = createAsset;
module.exports.updateAsset = updateAsset;
module.exports.updateAssetsFromData = updateAssetsFromData;
module.exports.deleteAsset = deleteAsset;
| CopenhagenCityArchives/kbh-billeder | webapplication/controllers/indexing.js | JavaScript | mit | 5,865 | [
30522,
1005,
2224,
9384,
1005,
1025,
1013,
1008,
1008,
1008,
2023,
11486,
16024,
9495,
11186,
2013,
1996,
13988,
11627,
2291,
2008,
8769,
1008,
2043,
7045,
2024,
7172,
1010,
12889,
2030,
17159,
1012,
1008,
1008,
2019,
2742,
5227,
2003,
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... |
/* Test for ICEs on invalid transparent unions (empty or no named
members). Bug 21213. */
/* Origin: Joseph Myers <joseph@codesourcery.com> */
/* { dg-do compile } */
/* { dg-options "" } */
enum e { A };
union __attribute__((__transparent_union__)) ue1 { enum e; }; /* { dg-warning "declaration does not declare anything" "not anything" } */
/* { dg-warning "union cannot be made transparent" "cannot" { target *-*-* } .-1 } */
union ue2 { enum e; } __attribute__((__transparent_union__)); /* { dg-warning "declaration does not declare anything" "not anything" } */
/* { dg-warning "union cannot be made transparent" "cannot" { target *-*-* } .-1 } */
union __attribute__((__transparent_union__)) ui1 { int; }; /* { dg-warning "declaration does not declare anything" "not anything" } */
/* { dg-warning "union cannot be made transparent" "cannot" { target *-*-* } .-1 } */
union ui2 { int; } __attribute__((__transparent_union__)); /* { dg-warning "declaration does not declare anything" "no anything" } */
/* { dg-warning "union cannot be made transparent" "cannot" { target *-*-* } .-1 } */
union __attribute__((__transparent_union__)) u1 { };
/* { dg-warning "union cannot be made transparent" "" { target *-*-* } .-1 } */
union u2 { } __attribute__((__transparent_union__));
/* { dg-warning "union cannot be made transparent" "" { target *-*-* } .-1 } */
| itsimbal/gcc.cet | gcc/testsuite/gcc.dg/transparent-union-3.c | C | gpl-2.0 | 1,369 | [
30522,
1013,
1008,
3231,
2005,
3256,
2015,
2006,
19528,
13338,
9209,
1006,
4064,
2030,
2053,
2315,
2372,
1007,
1012,
11829,
18164,
17134,
1012,
1008,
1013,
1013,
1008,
4761,
1024,
3312,
13854,
1026,
3312,
1030,
9537,
8162,
17119,
2100,
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... |
package edu.stanford.nlp.trees;
import edu.stanford.nlp.process.TokenizerFactory;
import java.util.function.Function;
import java.util.function.Predicate;
import edu.stanford.nlp.international.morph.MorphoFeatureSpecification;
import edu.stanford.nlp.ling.HasWord;
import java.io.Serializable;
/**
* This interface specifies language/treebank specific information for a
* Treebank, which a parser or other treebank user might need to know.
*
* Some of this is fixed for a (treebank,language) pair, but some of it
* reflects feature extraction decisions, so it can be sensible to have
* multiple implementations of this interface for the same
* (treebank,language) pair.
*
* So far this covers punctuation, character encodings, and characters
* reserved for label annotations. It should probably be expanded to
* cover other stuff (unknown words?).
*
* Various methods in this class return arrays. You should treat them
* as read-only, even though one cannot enforce that in Java.
*
* Implementations in this class do not call basicCategory() on arguments
* before testing them, so if needed, you should explicitly call
* basicCategory() yourself before passing arguments to these routines for
* testing.
*
* This class should be able to be an immutable singleton. It contains
* data on various things, but no state. At some point we should make it
* a real immutable singleton.
*
* @author Christopher Manning
* @version 1.1, Mar 2003
*/
public interface TreebankLanguagePack extends Serializable {
/**
* Use this as the default encoding for Readers and Writers of
* Treebank data.
*/
String DEFAULT_ENCODING = "UTF-8";
/**
* Accepts a String that is a punctuation
* tag name, and rejects everything else.
*
* @param str The string to check
* @return Whether this is a punctuation tag
*/
boolean isPunctuationTag(String str);
/**
* Accepts a String that is a punctuation
* word, and rejects everything else.
* If one can't tell for sure (as for ' in the Penn Treebank), it
* maks the best guess that it can.
*
* @param str The string to check
* @return Whether this is a punctuation word
*/
boolean isPunctuationWord(String str);
/**
* Accepts a String that is a sentence end
* punctuation tag, and rejects everything else.
*
* @param str The string to check
* @return Whether this is a sentence final punctuation tag
*/
boolean isSentenceFinalPunctuationTag(String str);
/**
* Accepts a String that is a punctuation
* tag that should be ignored by EVALB-style evaluation,
* and rejects everything else.
* Traditionally, EVALB has ignored a subset of the total set of
* punctuation tags in the English Penn Treebank (quotes and
* period, comma, colon, etc., but not brackets)
*
* @param str The string to check
* @return Whether this is a EVALB-ignored punctuation tag
*/
boolean isEvalBIgnoredPunctuationTag(String str);
/**
* Return a filter that accepts a String that is a punctuation
* tag name, and rejects everything else.
*
* @return The filter
*/
Predicate<String> punctuationTagAcceptFilter();
/**
* Return a filter that rejects a String that is a punctuation
* tag name, and accepts everything else.
*
* @return The filter
*/
Predicate<String> punctuationTagRejectFilter();
/**
* Returns a filter that accepts a String that is a punctuation
* word, and rejects everything else.
* If one can't tell for sure (as for ' in the Penn Treebank), it
* maks the best guess that it can.
*
* @return The Filter
*/
Predicate<String> punctuationWordAcceptFilter();
/**
* Returns a filter that accepts a String that is not a punctuation
* word, and rejects punctuation.
* If one can't tell for sure (as for ' in the Penn Treebank), it
* makes the best guess that it can.
*
* @return The Filter
*/
Predicate<String> punctuationWordRejectFilter();
/**
* Returns a filter that accepts a String that is a sentence end
* punctuation tag, and rejects everything else.
*
* @return The Filter
*/
Predicate<String> sentenceFinalPunctuationTagAcceptFilter();
/**
* Returns a filter that accepts a String that is a punctuation
* tag that should be ignored by EVALB-style evaluation,
* and rejects everything else.
* Traditionally, EVALB has ignored a subset of the total set of
* punctuation tags in the English Penn Treebank (quotes and
* period, comma, colon, etc., but not brackets)
*
* @return The Filter
*/
Predicate<String> evalBIgnoredPunctuationTagAcceptFilter();
/**
* Returns a filter that accepts everything except a String that is a
* punctuation tag that should be ignored by EVALB-style evaluation.
* Traditionally, EVALB has ignored a subset of the total set of
* punctuation tags in the English Penn Treebank (quotes and
* period, comma, colon, etc., but not brackets)
*
* @return The Filter
*/
Predicate<String> evalBIgnoredPunctuationTagRejectFilter();
/**
* Returns a String array of punctuation tags for this treebank/language.
*
* @return The punctuation tags
*/
String[] punctuationTags();
/**
* Returns a String array of punctuation words for this treebank/language.
*
* @return The punctuation words
*/
String[] punctuationWords();
/**
* Returns a String array of sentence final punctuation tags for this
* treebank/language. The first in the list is assumed to be the most
* basic one.
*
* @return The sentence final punctuation tags
*/
String[] sentenceFinalPunctuationTags();
/**
* Returns a String array of sentence final punctuation words for
* this treebank/language.
*
* @return The punctuation words
*/
String[] sentenceFinalPunctuationWords();
/**
* Returns a String array of punctuation tags that EVALB-style evaluation
* should ignore for this treebank/language.
* Traditionally, EVALB has ignored a subset of the total set of
* punctuation tags in the English Penn Treebank (quotes and
* period, comma, colon, etc., but not brackets)
*
* @return Whether this is a EVALB-ignored punctuation tag
*/
String[] evalBIgnoredPunctuationTags();
/**
* Return a GrammaticalStructureFactory suitable for this language/treebank.
*
* @return A GrammaticalStructureFactory suitable for this language/treebank
*/
GrammaticalStructureFactory grammaticalStructureFactory();
/**
* Return a GrammaticalStructureFactory suitable for this language/treebank.
*
* @param puncFilter A filter which should reject punctuation words (as Strings)
* @return A GrammaticalStructureFactory suitable for this language/treebank
*/
GrammaticalStructureFactory grammaticalStructureFactory(Predicate<String> puncFilter);
/**
* Return a GrammaticalStructureFactory suitable for this language/treebank.
*
* @param puncFilter A filter which should reject punctuation words (as Strings)
* @param typedDependencyHF A HeadFinder which finds heads for typed dependencies
* @return A GrammaticalStructureFactory suitable for this language/treebank
*/
GrammaticalStructureFactory grammaticalStructureFactory(Predicate<String> puncFilter, HeadFinder typedDependencyHF);
/**
* Whether or not we have typed dependencies for this language. If
* this method returns false, a call to grammaticalStructureFactory
* will cause an exception.
*/
boolean supportsGrammaticalStructures();
/**
* Return the charset encoding of the Treebank. See
* documentation for the <code>Charset</code> class.
*
* @return Name of Charset
*/
String getEncoding();
/**
* Return a tokenizer factory which might be suitable for tokenizing text
* that will be used with this Treebank/Language pair. This is for
* real text of this language pair, not for reading stuff inside the
* treebank files.
*
* @return A tokenizer
*/
TokenizerFactory<? extends HasWord> getTokenizerFactory();
/**
* Return an array of characters at which a String should be
* truncated to give the basic syntactic category of a label.
* The idea here is that Penn treebank style labels follow a syntactic
* category with various functional and crossreferencing information
* introduced by special characters (such as "NP-SBJ=1"). This would
* be truncated to "NP" by the array containing '-' and "=". <br>
* Note that these are never deleted as the first character as a label
* (so they are okay as one character tags, etc.), but only when
* subsequent characters.
*
* @return An array of characters that set off label name suffixes
*/
char[] labelAnnotationIntroducingCharacters();
/**
* Say whether this character is an annotation introducing
* character.
*
* @param ch A char
* @return Whether this char introduces functional annotations
*/
boolean isLabelAnnotationIntroducingCharacter(char ch);
/**
* Returns the basic syntactic category of a String by truncating
* stuff after a (non-word-initial) occurrence of one of the
* <code>labelAnnotationIntroducingCharacters()</code>. This
* function should work on phrasal category and POS tag labels,
* but needn't (and couldn't be expected to) work on arbitrary
* Word strings.
*
* @param category The whole String name of the label
* @return The basic category of the String
*/
String basicCategory(String category);
/**
* Returns the category for a String with everything following
* the gf character (which may be language specific) stripped.
*
* @param category The String name of the label (may previously have had basic category called on it)
* @return The String stripped of grammatical functions
*/
String stripGF(String category);
/**
* Returns a {@link Function Function} object that maps Strings to Strings according
* to this TreebankLanguagePack's basicCategory method.
*
* @return the String->String Function object
*/
Function<String,String> getBasicCategoryFunction();
/**
* Returns the syntactic category and 'function' of a String.
* This normally involves truncating numerical coindexation
* showing coreference, etc. By 'function', this means
* keeping, say, Penn Treebank functional tags or ICE phrasal functions,
* perhaps returning them as <code>category-function</code>.
*
* @param category The whole String name of the label
* @return A String giving the category and function
*/
String categoryAndFunction(String category);
/**
* Returns a {@link Function Function} object that maps Strings to Strings according
* to this TreebankLanguagePack's categoryAndFunction method.
*
* @return the String->String Function object
*/
Function<String,String> getCategoryAndFunctionFunction();
/**
* Accepts a String that is a start symbol of the treebank.
*
* @param str The str to test
* @return Whether this is a start symbol
*/
boolean isStartSymbol(String str);
/**
* Return a filter that accepts a String that is a start symbol
* of the treebank, and rejects everything else.
*
* @return The filter
*/
Predicate<String> startSymbolAcceptFilter();
/**
* Returns a String array of treebank start symbols.
*
* @return The start symbols
*/
String[] startSymbols();
/**
* Returns a String which is the first (perhaps unique) start symbol
* of the treebank, or null if none is defined.
*
* @return The start symbol
*/
String startSymbol();
/**
* Returns the extension of treebank files for this treebank.
* This should be passed as an argument to Treebank loading classes.
* It might be "mrg" or "fid" or whatever. Don't include the period.
*
* @return the extension on files for this treebank
*/
String treebankFileExtension();
/**
* Sets the grammatical function indicating character to gfCharacter.
*
* @param gfCharacter Sets the character in label names that sets of
* grammatical function marking (from the phrase label).
*/
void setGfCharacter(char gfCharacter);
/** Returns a TreeReaderFactory suitable for general purpose use
* with this language/treebank.
*
* @return A TreeReaderFactory suitable for general purpose use
* with this language/treebank.
*/
TreeReaderFactory treeReaderFactory();
/** Return a TokenizerFactory for Trees of this language/treebank.
*
* @return A TokenizerFactory for Trees of this language/treebank.
*/
TokenizerFactory<Tree> treeTokenizerFactory();
/**
* The HeadFinder to use for your treebank.
*
* @return A suitable HeadFinder
*/
HeadFinder headFinder();
/**
* The HeadFinder to use when making typed dependencies.
*
* @return A suitable HeadFinder
*/
HeadFinder typedDependencyHeadFinder();
/**
* The morphological feature specification for the language.
*
* @return A language-specific MorphoFeatureSpecification
*/
MorphoFeatureSpecification morphFeatureSpec();
/**
* Used for languages where an original Stanford Dependency
* converter and a Universal Dependency converter exists.
*/
void setGenerateOriginalDependencies(boolean generateOriginalDependencies);
/**
* Used for languages where an original Stanford Dependency
* converter and a Universal Dependency converter exists.
*/
boolean generateOriginalDependencies();
}
| intfloat/CoreNLP | src/edu/stanford/nlp/trees/TreebankLanguagePack.java | Java | gpl-2.0 | 13,596 | [
30522,
7427,
3968,
2226,
1012,
8422,
1012,
17953,
2361,
1012,
3628,
1025,
12324,
3968,
2226,
1012,
8422,
1012,
17953,
2361,
1012,
2832,
1012,
19204,
17629,
21450,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
3853,
1012,
3853,
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... |
package org.nutz.dao.impl.sql;
import java.lang.reflect.Array;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.nutz.castor.Castors;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Entity;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.sql.SqlCallback;
import org.nutz.lang.Lang;
/**
* 仿照Spring JdbcTemplate实现nutz的SqlTemplate,方便sql的调用
*
* @author hzl7652(hzl7652@sina.com)
*/
public class SqlTemplate {
private Dao dao;
public SqlTemplate() {}
public SqlTemplate(Dao dao) {
setDao(dao);
}
public void setDao(Dao dao) {
this.dao = dao;
}
public Dao dao() {
return this.dao;
}
/**
* 执行一个SQL更新操作(如插入,更新或删除语句)。
*
* @param sql
* 包含变量占位符的SQL
* @param params
* 参数map,无参数时,可为null
*
* @return SQL 语句所影响的行数
*/
public int update(String sql, Map<String, Object> params) {
return update(sql, null, params);
}
/**
* 执行一个SQL更新操作(如插入,更新或删除语句)。
*
* @param sql
* 包含变量占位符的SQL
* @param vars
* 变量map,无参数时,可为null
* @param params
* 参数map,无参数时,可为null
*
* @return SQL 语句所影响的行数
*/
public int update(String sql, Map<String, Object> vars, Map<String, Object> params) {
Sql sqlObj = createSqlObj(sql, params);
execute(sqlObj, vars, params);
return sqlObj.getUpdateCount();
}
/**
* 执行SQL批量更新操作(如插入,更新或删除语句)。
*
* @param sql
* 包含变量占位符的SQL
* @param batchValues
* 批量更新参数集合
*
* @return SQL 语句所影响的行数
*/
public int batchUpdate(String sql, List<Map<String, Object>> batchValues) {
return batchUpdate(sql, null, batchValues);
}
/**
* 执行SQL批量更新操作(如插入,更新或删除语句)。
*
* @param sql
* 包含变量占位符的SQL
* @param vars
* 变量map,无参数时,可为null
* @param batchValues
* 批量更新参数集合
*
* @return SQL 语句所影响的行数
*/
public int batchUpdate(String sql,
Map<String, Object> vars,
List<Map<String, Object>> batchValues) {
Sql sqlObj = null;
if (batchValues != null && batchValues.size() > 0) {
sqlObj = createSqlObj(sql, batchValues.get(0));
for (Map<String, Object> params : batchValues) {
Map<String, Object> newParams = paramProcess(params);
sqlObj.params().putAll(newParams);
sqlObj.addBatch();
}
dao.execute(sqlObj);
} else {
sqlObj = createSqlObj(sql, null);
execute(sqlObj, vars, null);
}
return sqlObj.getUpdateCount();
}
/**
* 执行一个SQL查询操作,结果为一个int形数值。
* <p>
*
* @param sql
* 包含变量占位符的SQL
* @param params
* 参数map,无参数时,可为null
*
* @return int数值,当查询为null时返回0
*/
public int queryForInt(String sql, Map<String, Object> params) {
return queryForInt(sql, null, params);
}
/**
* 执行一个SQL查询操作,结果为一个int形数值。
*
* @param sql
* 包含变量占位符的SQL
* @param vars
* 变量map,无参数时,可为null
* @param params
* 参数map,无参数时,可为null
*
* @return int数值,当查询为null时返回0
*/
public int queryForInt(String sql, Map<String, Object> vars, Map<String, Object> params) {
Sql sqlObj = createSqlObj(sql, params);
sqlObj.setCallback(Sqls.callback.integer());
execute(sqlObj, vars, params);
return sqlObj.getInt();
}
/**
* 执行一个SQL查询操作,结果为一个long形数值。
*
* @param sql
* 包含变量占位符的SQL
* @param params
* 参数map,无参数时,可为null
*
* @return long数值,当查询为null时返回0
*/
public long queryForLong(String sql, Map<String, Object> params) {
return queryForLong(sql, null, params);
}
/**
* 执行一个SQL查询操作,结果为一个long形数值。
*
* @param sql
* 包含变量占位符的SQL
* @param vars
* 变量map,无参数时,可为null
* @param params
* 参数map,无参数时,可为null
*
* @return long数值,当查询为null时返回0
*/
public long queryForLong(String sql, Map<String, Object> vars, Map<String, Object> params) {
Sql sqlObj = createSqlObj(sql, params);
sqlObj.setCallback(Sqls.callback.longValue());
execute(sqlObj, vars, params);
Long result = sqlObj.getObject(Long.class);
return result == null ? 0 : result;
}
/**
* 执行一个SQL查询操作,结果为给定对象类型的对象,适用于明确SQL查询结果的类型。
*
* @param sql
* 包含变量占位符的SQL
* @param params
* 参数map 无参数时,可为null
* @param classOfT
* 对象类型,SQL查询结果所对应的类型,如Date.class等
*
* @return 对象,无查询结果时返回null
*/
public <T> T queryForObject(String sql, Map<String, Object> params, Class<T> classOfT) {
return queryForObject(sql, null, params, classOfT);
}
/**
* 执行一个SQL查询操作,结果为给定对象类型的对象,适用于明确SQL查询结果的类型。
*
* @param sql
* 包含变量占位符的SQL
* @param vars
* 变量map,无参数时,可为null
* @param params
* 参数map,无参数时,可为null
* @param classOfT
* 对象类型,SQL查询结果所对应的类型,如Date.class等
*
* @return 对象,无查询结果时返回null
*/
public <T> T queryForObject(String sql,
Map<String, Object> vars,
Map<String, Object> params,
Class<T> classOfT) {
Sql sqlObj = createSqlObj(sql, params);
sqlObj.setCallback(new SqlCallback() {
public Object invoke(Connection conn, ResultSet rs, Sql sql) throws SQLException {
if (null != rs && rs.next())
return rs.getObject(1);
return null;
}
});
execute(sqlObj, vars, params);
return sqlObj.getObject(classOfT);
}
/**
* 执行一个SQL查询操作,结果为给定实体的对象。
*
* @param sql
* 包含变量占位符的SQL
* @param params
* 参数map,无参数时,可为null
* @param entity
* 实体类型,无参数时,可为null
*
* @return 对象,无查询结果时返回null
*/
public <T> T queryForObject(String sql, Map<String, Object> params, Entity<T> entity) {
return queryForObject(sql, null, params, entity);
}
/**
* 执行一个SQL查询操作,结果为给定实体的对象。
*
* @param sql
* 包含变量占位符的SQL
* @param vars
* 变量map,无参数时,可为null
* @param params
* 参数map,无参数时,可为null
* @param entity
* 实体类型
*
* @return 对象,无查询结果时返回null
*/
public <T> T queryForObject(String sql,
Map<String, Object> vars,
Map<String, Object> params,
Entity<T> entity) {
Sql sqlObj = createSqlObj(sql, params);
sqlObj.setCallback(Sqls.callback.entity());
sqlObj.setEntity(entity);
execute(sqlObj, vars, params);
return sqlObj.getObject(entity.getType());
}
/**
* 执行一个SQL查询操作,结果为Record的对象。
*
* @param sql
* 包含变量占位符的SQL
* @param params
* 参数map,无参数时,可为null
*
* @return Record对象,无查询结果时返回null
*/
public Record queryForRecord(String sql, Map<String, Object> params) {
return queryForRecord(sql, null, params);
}
/**
* 执行一个SQL查询操作,结果为Record的对象。
*
* @param sql
* 包含变量占位符的SQL
* @param vars
* 变量map,无参数时,可为null
* @param params
* 参数map,无参数时,可为null
* @return Record对象,无查询结果时返回null
*/
public Record queryForRecord(String sql, Map<String, Object> vars, Map<String, Object> params) {
Sql sqlObj = createSqlObj(sql, params);
sqlObj.setCallback(Sqls.callback.record());
execute(sqlObj, vars, params);
return sqlObj.getObject(Record.class);
}
/**
* 执行一个SQL查询操作,结果为一组对象。
*
* @param sql
* 包含变量占位符的SQL
* @param params
* 参数map,无参数时,可为null
* @param entity
* 对象类型,无参数时,可为null
*
* @return 对象列表,无查询结果时返回长度为0的List对象
*/
public <T> List<T> query(String sql, Map<String, Object> params, Entity<T> entity) {
return query(sql, null, params, entity);
}
/**
* 执行一个SQL查询操作,结果为一组对象。
*
* @param sql
* 包含变量占位符的SQL
* @param params
* 参数map,无参数时,可为null
* @param classOfT
* 对象类类
*
* @return 对象列表,无查询结果时返回长度为0的List对象
*/
public <T> List<T> query(String sql,
Map<String, Object> params,
Class<T> classOfT) {
return query(sql, null, params, dao.getEntity(classOfT));
}
/**
* 执行一个SQL查询操作,结果为一组对象。
*
* @param sql
* 包含变量占位符的SQL
* @param vars
* 变量map,无参数时,可为null
* @param params
* 参数map,无参数时,可为null
* @param entity
* 对象类型
*
* @return 对象列表,无查询结果时返回长度为0的List对象
*/
public <T> List<T> query(String sql,
Map<String, Object> vars,
Map<String, Object> params,
Entity<T> entity) {
Sql sqlObj = createSqlObj(sql, params);
sqlObj.setCallback(Sqls.callback.entities());
sqlObj.setEntity(entity);
execute(sqlObj, vars, params);
return sqlObj.getList(entity.getType());
}
/**
* 执行一个SQL查询操作,结果为一组对象。
*
* @param sql
* 包含变量占位符的SQL
* @param vars
* 变量map,无参数时,可为null
* @param params
* 参数map,无参数时,可为null
* @param classOfT
* 对象类型
*
* @return 对象列表,无查询结果时返回长度为0的List对象
*/
public <T> List<T> queryForList(String sql,
Map<String, Object> vars,
Map<String, Object> params,
final Class<T> classOfT) {
Sql sqlObj = createSqlObj(sql, params);
sqlObj.setCallback(new SqlCallback() {
public Object invoke(Connection conn, ResultSet rs, Sql sql) throws SQLException {
List<T> list = new ArrayList<T>();
while (rs.next()) {
T result = Castors.me().castTo(rs.getObject(1), classOfT);
list.add(result);
}
return list;
}
});
execute(sqlObj, vars, params);
return sqlObj.getList(classOfT);
}
/**
* 执行一个SQL查询操作,结果为Record对象列表。
*
* @param sql
* 包含变量占位符的SQL
* @param vars
* 变量map,无参数时,可为null
* @param params
* 参数map,无参数时,可为null
*
* @return Record列表,无查询结果时返回长度为0的List对象
*/
public List<Record> queryRecords(String sql,
Map<String, Object> vars,
Map<String, Object> params) {
Sql sqlObj = createSqlObj(sql, params);
sqlObj.setCallback(Sqls.callback.records());
execute(sqlObj, vars, params);
return sqlObj.getList(Record.class);
}
/**
* 设置sql参数并执行sql。
*/
private void execute(Sql sqlObj, Map<String, Object> vars, Map<String, Object> params) {
if (vars != null)
sqlObj.vars().putAll(vars);
if (params != null) {
Map<String, Object> newParams = paramProcess(params);
sqlObj.params().putAll(newParams);
}
dao().execute(sqlObj);
}
/**
* 创建Sql对象。
* <p>
* 在这里处理Array Collection类型参数,方便SQL IN 表达式的设置
*
* @param sql
* 包含变量占位符的SQL
* @param params
* 参数map,无参数时,可为null
*
* @return Sql对象
*/
private Sql createSqlObj(String sql, Map<String, Object> params) {
if (params == null)
return Sqls.create(sql);
String newSql = sqlProcess(sql, params);
return Sqls.create(newSql);
}
/**
* 将Array Collection类型参数对应的sql占位符进行处理
*
* @param originSql
* 原包含变量占位符的SQL
* @param params
* 参数map,无参数时,可为null
*
* @return 包含处理IN表达式的sql
*/
private String sqlProcess(String originSql, Map<String, Object> params) {
if (params == null || params.size() == 0)
return originSql;
String newSql = originSql;
for (Entry<String, Object> entry : params.entrySet()) {
String paramName = entry.getKey();
Object paramObj = entry.getValue();
if (paramObj.getClass().isArray()) {
String inSqlExp = inSqlProcess(paramName, paramObj);
newSql = newSql.replaceAll("@" + paramName, inSqlExp);
}
if (paramObj instanceof Collection) {
Collection<?> collection = (Collection<?>) paramObj;
Object[] paramVals = Lang.collection2array(collection);
String inSqlExp = inSqlProcess(paramName, paramVals);
newSql = newSql.replaceAll("@" + paramName, inSqlExp);
}
}
return newSql;
}
/**
* sql参数处理,在这里处理Array Collection类型参数,方便SQL IN 表达式的设置
*
* @param params
* 参数map,无参数时,可为null
*
* @return 包含处理IN表达式的sql
*/
private Map<String, Object> paramProcess(Map<String, Object> params) {
if (params == null || params.size() == 0)
return null;
Map<String, Object> newParams = new HashMap<String, Object>(params);
for (Entry<String, Object> entry : params.entrySet()) {
String paramName = entry.getKey();
Object paramObj = entry.getValue();
if (paramObj.getClass().isArray()) {
inParamProcess(paramName, paramObj, newParams);
newParams.remove(paramName);
}
if (paramObj instanceof Collection) {
Collection<?> collection = (Collection<?>) paramObj;
Object[] paramVals = Lang.collection2array(collection);
inParamProcess(paramName, paramVals, newParams);
newParams.remove(paramName);
}
}
return newParams;
}
private static String inSqlProcess(String paramName, Object paramObj) {
int len = Array.getLength(paramObj);
StringBuilder inSqlExp = new StringBuilder();
for (int i = 0; i < len; i++) {
inSqlExp.append("@").append(paramName).append(i).append(",");
}
inSqlExp.deleteCharAt(inSqlExp.length() - 1);
return inSqlExp.toString();
}
private static void inParamProcess(String paramName, Object paramObj, Map<String, Object> newParams) {
int len = Array.getLength(paramObj);
for (int i = 0; i < len; i++) {
String inParamName = paramName + i;
newParams.put(inParamName, Array.get(paramObj, i));
}
}
}
| nutzam/nutz | src/org/nutz/dao/impl/sql/SqlTemplate.java | Java | apache-2.0 | 18,043 | [
30522,
7427,
8917,
1012,
17490,
2480,
1012,
4830,
2080,
1012,
17727,
2140,
1012,
29296,
1025,
12324,
9262,
1012,
11374,
1012,
8339,
1012,
9140,
1025,
12324,
9262,
1012,
29296,
1012,
4434,
1025,
12324,
30524,
23325,
2863,
2361,
1025,
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... |
/* $NetBSD: ucdata.c,v 1.1.1.4 2014/05/28 09:58:44 tron Exp $ */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2014 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted only as authorized by the OpenLDAP
* Public License.
*
* A copy of this license is available in file LICENSE in the
* top-level directory of the distribution or, alternatively, at
* <http://www.OpenLDAP.org/license.html>.
*/
/* Copyright 2001 Computing Research Labs, New Mexico State University
*
* 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:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* Id: ucdata.c,v 1.4 2001/01/02 18:46:20 mleisher Exp " */
#include "portable.h"
#include "ldap_config.h"
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/string.h>
#include <ac/unistd.h>
#include <ac/bytes.h>
#include "lber_pvt.h"
#include "ucdata.h"
#ifndef HARDCODE_DATA
#define HARDCODE_DATA 1
#endif
#if HARDCODE_DATA
#include "uctable.h"
#endif
/**************************************************************************
*
* Miscellaneous types, data, and support functions.
*
**************************************************************************/
typedef struct {
ac_uint2 bom;
ac_uint2 cnt;
union {
ac_uint4 bytes;
ac_uint2 len[2];
} size;
} _ucheader_t;
/*
* A simple array of 32-bit masks for lookup.
*/
static ac_uint4 masks32[32] = {
0x00000001UL, 0x00000002UL, 0x00000004UL, 0x00000008UL,
0x00000010UL, 0x00000020UL, 0x00000040UL, 0x00000080UL,
0x00000100UL, 0x00000200UL, 0x00000400UL, 0x00000800UL,
0x00001000UL, 0x00002000UL, 0x00004000UL, 0x00008000UL,
0x00010000UL, 0x00020000UL, 0x00040000UL, 0x00080000UL,
0x00100000UL, 0x00200000UL, 0x00400000UL, 0x00800000UL,
0x01000000UL, 0x02000000UL, 0x04000000UL, 0x08000000UL,
0x10000000UL, 0x20000000UL, 0x40000000UL, 0x80000000UL
};
#define endian_short(cc) (((cc) >> 8) | (((cc) & 0xff) << 8))
#define endian_long(cc) ((((cc) & 0xff) << 24)|((((cc) >> 8) & 0xff) << 16)|\
((((cc) >> 16) & 0xff) << 8)|((cc) >> 24))
#if !HARDCODE_DATA
static FILE *
_ucopenfile(char *paths, char *filename, char *mode)
{
FILE *f;
char *fp, *dp, *pp, path[BUFSIZ];
if (filename == 0 || *filename == 0)
return 0;
dp = paths;
while (dp && *dp) {
pp = path;
while (*dp && *dp != ':')
*pp++ = *dp++;
*pp++ = *LDAP_DIRSEP;
fp = filename;
while (*fp)
*pp++ = *fp++;
*pp = 0;
if ((f = fopen(path, mode)) != 0)
return f;
if (*dp == ':')
dp++;
}
return 0;
}
#endif
/**************************************************************************
*
* Support for the character properties.
*
**************************************************************************/
#if !HARDCODE_DATA
static ac_uint4 _ucprop_size;
static ac_uint2 *_ucprop_offsets;
static ac_uint4 *_ucprop_ranges;
/*
* Return -1 on error, 0 if okay
*/
static int
_ucprop_load(char *paths, int reload)
{
FILE *in;
ac_uint4 size, i;
_ucheader_t hdr;
if (_ucprop_size > 0) {
if (!reload)
/*
* The character properties have already been loaded.
*/
return 0;
/*
* Unload the current character property data in preparation for
* loading a new copy. Only the first array has to be deallocated
* because all the memory for the arrays is allocated as a single
* block.
*/
free((char *) _ucprop_offsets);
_ucprop_size = 0;
}
if ((in = _ucopenfile(paths, "ctype.dat", "rb")) == 0)
return -1;
/*
* Load the header.
*/
fread((char *) &hdr, sizeof(_ucheader_t), 1, in);
if (hdr.bom == 0xfffe) {
hdr.cnt = endian_short(hdr.cnt);
hdr.size.bytes = endian_long(hdr.size.bytes);
}
if ((_ucprop_size = hdr.cnt) == 0) {
fclose(in);
return -1;
}
/*
* Allocate all the storage needed for the lookup table.
*/
_ucprop_offsets = (ac_uint2 *) malloc(hdr.size.bytes);
/*
* Calculate the offset into the storage for the ranges. The offsets
* array is on a 4-byte boundary and one larger than the value provided in
* the header count field. This means the offset to the ranges must be
* calculated after aligning the count to a 4-byte boundary.
*/
if ((size = ((hdr.cnt + 1) * sizeof(ac_uint2))) & 3)
size += 4 - (size & 3);
size >>= 1;
_ucprop_ranges = (ac_uint4 *) (_ucprop_offsets + size);
/*
* Load the offset array.
*/
fread((char *) _ucprop_offsets, sizeof(ac_uint2), size, in);
/*
* Do an endian swap if necessary. Don't forget there is an extra node on
* the end with the final index.
*/
if (hdr.bom == 0xfffe) {
for (i = 0; i <= _ucprop_size; i++)
_ucprop_offsets[i] = endian_short(_ucprop_offsets[i]);
}
/*
* Load the ranges. The number of elements is in the last array position
* of the offsets.
*/
fread((char *) _ucprop_ranges, sizeof(ac_uint4),
_ucprop_offsets[_ucprop_size], in);
fclose(in);
/*
* Do an endian swap if necessary.
*/
if (hdr.bom == 0xfffe) {
for (i = 0; i < _ucprop_offsets[_ucprop_size]; i++)
_ucprop_ranges[i] = endian_long(_ucprop_ranges[i]);
}
return 0;
}
static void
_ucprop_unload(void)
{
if (_ucprop_size == 0)
return;
/*
* Only need to free the offsets because the memory is allocated as a
* single block.
*/
free((char *) _ucprop_offsets);
_ucprop_size = 0;
}
#endif
static int
_ucprop_lookup(ac_uint4 code, ac_uint4 n)
{
long l, r, m;
if (_ucprop_size == 0)
return 0;
/*
* There is an extra node on the end of the offsets to allow this routine
* to work right. If the index is 0xffff, then there are no nodes for the
* property.
*/
if ((l = _ucprop_offsets[n]) == 0xffff)
return 0;
/*
* Locate the next offset that is not 0xffff. The sentinel at the end of
* the array is the max index value.
*/
for (m = 1;
n + m < _ucprop_size && _ucprop_offsets[n + m] == 0xffff; m++) ;
r = _ucprop_offsets[n + m] - 1;
while (l <= r) {
/*
* Determine a "mid" point and adjust to make sure the mid point is at
* the beginning of a range pair.
*/
m = (l + r) >> 1;
m -= (m & 1);
if (code > _ucprop_ranges[m + 1])
l = m + 2;
else if (code < _ucprop_ranges[m])
r = m - 2;
else if (code >= _ucprop_ranges[m] && code <= _ucprop_ranges[m + 1])
return 1;
}
return 0;
}
int
ucisprop(ac_uint4 code, ac_uint4 mask1, ac_uint4 mask2)
{
ac_uint4 i;
if (mask1 == 0 && mask2 == 0)
return 0;
for (i = 0; mask1 && i < 32; i++) {
if ((mask1 & masks32[i]) && _ucprop_lookup(code, i))
return 1;
}
for (i = 32; mask2 && i < _ucprop_size; i++) {
if ((mask2 & masks32[i & 31]) && _ucprop_lookup(code, i))
return 1;
}
return 0;
}
/**************************************************************************
*
* Support for case mapping.
*
**************************************************************************/
#if !HARDCODE_DATA
/* These record the number of slots in the map.
* There are 3 words per slot.
*/
static ac_uint4 _uccase_size;
static ac_uint2 _uccase_len[2];
static ac_uint4 *_uccase_map;
/*
* Return -1 on error, 0 if okay
*/
static int
_uccase_load(char *paths, int reload)
{
FILE *in;
ac_uint4 i;
_ucheader_t hdr;
if (_uccase_size > 0) {
if (!reload)
/*
* The case mappings have already been loaded.
*/
return 0;
free((char *) _uccase_map);
_uccase_size = 0;
}
if ((in = _ucopenfile(paths, "case.dat", "rb")) == 0)
return -1;
/*
* Load the header.
*/
fread((char *) &hdr, sizeof(_ucheader_t), 1, in);
if (hdr.bom == 0xfffe) {
hdr.cnt = endian_short(hdr.cnt);
hdr.size.len[0] = endian_short(hdr.size.len[0]);
hdr.size.len[1] = endian_short(hdr.size.len[1]);
}
/*
* Set the node count and lengths of the upper and lower case mapping
* tables.
*/
_uccase_size = hdr.cnt;
_uccase_len[0] = hdr.size.len[0];
_uccase_len[1] = hdr.size.len[1];
_uccase_map = (ac_uint4 *)
malloc(_uccase_size * 3 * sizeof(ac_uint4));
/*
* Load the case mapping table.
*/
fread((char *) _uccase_map, sizeof(ac_uint4), _uccase_size * 3, in);
/*
* Do an endian swap if necessary.
*/
if (hdr.bom == 0xfffe) {
for (i = 0; i < _uccase_size * 3; i++)
_uccase_map[i] = endian_long(_uccase_map[i]);
}
fclose(in);
return 0;
}
static void
_uccase_unload(void)
{
if (_uccase_size == 0)
return;
free((char *) _uccase_map);
_uccase_size = 0;
}
#endif
static ac_uint4
_uccase_lookup(ac_uint4 code, long l, long r, int field)
{
long m;
const ac_uint4 *tmp;
/*
* Do the binary search.
*/
while (l <= r) {
/*
* Determine a "mid" point and adjust to make sure the mid point is at
* the beginning of a case mapping triple.
*/
m = (l + r) >> 1;
tmp = &_uccase_map[m*3];
if (code > *tmp)
l = m + 1;
else if (code < *tmp)
r = m - 1;
else if (code == *tmp)
return tmp[field];
}
return code;
}
ac_uint4
uctoupper(ac_uint4 code)
{
int field;
long l, r;
if (ucisupper(code))
return code;
if (ucislower(code)) {
/*
* The character is lower case.
*/
field = 2;
l = _uccase_len[0];
r = (l + _uccase_len[1]) - 1;
} else {
/*
* The character is title case.
*/
field = 1;
l = _uccase_len[0] + _uccase_len[1];
r = _uccase_size - 1;
}
return _uccase_lookup(code, l, r, field);
}
ac_uint4
uctolower(ac_uint4 code)
{
int field;
long l, r;
if (ucislower(code))
return code;
if (ucisupper(code)) {
/*
* The character is upper case.
*/
field = 1;
l = 0;
r = _uccase_len[0] - 1;
} else {
/*
* The character is title case.
*/
field = 2;
l = _uccase_len[0] + _uccase_len[1];
r = _uccase_size - 1;
}
return _uccase_lookup(code, l, r, field);
}
ac_uint4
uctotitle(ac_uint4 code)
{
int field;
long l, r;
if (ucistitle(code))
return code;
/*
* The offset will always be the same for converting to title case.
*/
field = 2;
if (ucisupper(code)) {
/*
* The character is upper case.
*/
l = 0;
r = _uccase_len[0] - 1;
} else {
/*
* The character is lower case.
*/
l = _uccase_len[0];
r = (l + _uccase_len[1]) - 1;
}
return _uccase_lookup(code, l, r, field);
}
/**************************************************************************
*
* Support for compositions.
*
**************************************************************************/
#if !HARDCODE_DATA
static ac_uint4 _uccomp_size;
static ac_uint4 *_uccomp_data;
/*
* Return -1 on error, 0 if okay
*/
static int
_uccomp_load(char *paths, int reload)
{
FILE *in;
ac_uint4 size, i;
_ucheader_t hdr;
if (_uccomp_size > 0) {
if (!reload)
/*
* The compositions have already been loaded.
*/
return 0;
free((char *) _uccomp_data);
_uccomp_size = 0;
}
if ((in = _ucopenfile(paths, "comp.dat", "rb")) == 0)
return -1;
/*
* Load the header.
*/
fread((char *) &hdr, sizeof(_ucheader_t), 1, in);
if (hdr.bom == 0xfffe) {
hdr.cnt = endian_short(hdr.cnt);
hdr.size.bytes = endian_long(hdr.size.bytes);
}
_uccomp_size = hdr.cnt;
_uccomp_data = (ac_uint4 *) malloc(hdr.size.bytes);
/*
* Read the composition data in.
*/
size = hdr.size.bytes / sizeof(ac_uint4);
fread((char *) _uccomp_data, sizeof(ac_uint4), size, in);
/*
* Do an endian swap if necessary.
*/
if (hdr.bom == 0xfffe) {
for (i = 0; i < size; i++)
_uccomp_data[i] = endian_long(_uccomp_data[i]);
}
/*
* Assume that the data is ordered on count, so that all compositions
* of length 2 come first. Only handling length 2 for now.
*/
for (i = 1; i < size; i += 4)
if (_uccomp_data[i] != 2)
break;
_uccomp_size = i - 1;
fclose(in);
return 0;
}
static void
_uccomp_unload(void)
{
if (_uccomp_size == 0)
return;
free((char *) _uccomp_data);
_uccomp_size = 0;
}
#endif
int
uccomp(ac_uint4 node1, ac_uint4 node2, ac_uint4 *comp)
{
int l, r, m;
l = 0;
r = _uccomp_size - 1;
while (l <= r) {
m = ((r + l) >> 1);
m -= m & 3;
if (node1 > _uccomp_data[m+2])
l = m + 4;
else if (node1 < _uccomp_data[m+2])
r = m - 4;
else if (node2 > _uccomp_data[m+3])
l = m + 4;
else if (node2 < _uccomp_data[m+3])
r = m - 4;
else {
*comp = _uccomp_data[m];
return 1;
}
}
return 0;
}
int
uccomp_hangul(ac_uint4 *str, int len)
{
const int SBase = 0xAC00, LBase = 0x1100,
VBase = 0x1161, TBase = 0x11A7,
LCount = 19, VCount = 21, TCount = 28,
NCount = VCount * TCount, /* 588 */
SCount = LCount * NCount; /* 11172 */
int i, rlen;
ac_uint4 ch, last, lindex, sindex;
last = str[0];
rlen = 1;
for ( i = 1; i < len; i++ ) {
ch = str[i];
/* check if two current characters are L and V */
lindex = last - LBase;
if (lindex < (ac_uint4) LCount) {
ac_uint4 vindex = ch - VBase;
if (vindex < (ac_uint4) VCount) {
/* make syllable of form LV */
last = SBase + (lindex * VCount + vindex) * TCount;
str[rlen-1] = last; /* reset last */
continue;
}
}
/* check if two current characters are LV and T */
sindex = last - SBase;
if (sindex < (ac_uint4) SCount
&& (sindex % TCount) == 0)
{
ac_uint4 tindex = ch - TBase;
if (tindex <= (ac_uint4) TCount) {
/* make syllable of form LVT */
last += tindex;
str[rlen-1] = last; /* reset last */
continue;
}
}
/* if neither case was true, just add the character */
last = ch;
str[rlen] = ch;
rlen++;
}
return rlen;
}
int
uccanoncomp(ac_uint4 *str, int len)
{
int i, stpos, copos;
ac_uint4 cl, prevcl, st, ch, co;
st = str[0];
stpos = 0;
copos = 1;
prevcl = uccombining_class(st) == 0 ? 0 : 256;
for (i = 1; i < len; i++) {
ch = str[i];
cl = uccombining_class(ch);
if (uccomp(st, ch, &co) && (prevcl < cl || prevcl == 0))
st = str[stpos] = co;
else {
if (cl == 0) {
stpos = copos;
st = ch;
}
prevcl = cl;
str[copos++] = ch;
}
}
return uccomp_hangul(str, copos);
}
/**************************************************************************
*
* Support for decompositions.
*
**************************************************************************/
#if !HARDCODE_DATA
static ac_uint4 _ucdcmp_size;
static ac_uint4 *_ucdcmp_nodes;
static ac_uint4 *_ucdcmp_decomp;
static ac_uint4 _uckdcmp_size;
static ac_uint4 *_uckdcmp_nodes;
static ac_uint4 *_uckdcmp_decomp;
/*
* Return -1 on error, 0 if okay
*/
static int
_ucdcmp_load(char *paths, int reload)
{
FILE *in;
ac_uint4 size, i;
_ucheader_t hdr;
if (_ucdcmp_size > 0) {
if (!reload)
/*
* The decompositions have already been loaded.
*/
return 0;
free((char *) _ucdcmp_nodes);
_ucdcmp_size = 0;
}
if ((in = _ucopenfile(paths, "decomp.dat", "rb")) == 0)
return -1;
/*
* Load the header.
*/
fread((char *) &hdr, sizeof(_ucheader_t), 1, in);
if (hdr.bom == 0xfffe) {
hdr.cnt = endian_short(hdr.cnt);
hdr.size.bytes = endian_long(hdr.size.bytes);
}
_ucdcmp_size = hdr.cnt << 1;
_ucdcmp_nodes = (ac_uint4 *) malloc(hdr.size.bytes);
_ucdcmp_decomp = _ucdcmp_nodes + (_ucdcmp_size + 1);
/*
* Read the decomposition data in.
*/
size = hdr.size.bytes / sizeof(ac_uint4);
fread((char *) _ucdcmp_nodes, sizeof(ac_uint4), size, in);
/*
* Do an endian swap if necessary.
*/
if (hdr.bom == 0xfffe) {
for (i = 0; i < size; i++)
_ucdcmp_nodes[i] = endian_long(_ucdcmp_nodes[i]);
}
fclose(in);
return 0;
}
/*
* Return -1 on error, 0 if okay
*/
static int
_uckdcmp_load(char *paths, int reload)
{
FILE *in;
ac_uint4 size, i;
_ucheader_t hdr;
if (_uckdcmp_size > 0) {
if (!reload)
/*
* The decompositions have already been loaded.
*/
return 0;
free((char *) _uckdcmp_nodes);
_uckdcmp_size = 0;
}
if ((in = _ucopenfile(paths, "kdecomp.dat", "rb")) == 0)
return -1;
/*
* Load the header.
*/
fread((char *) &hdr, sizeof(_ucheader_t), 1, in);
if (hdr.bom == 0xfffe) {
hdr.cnt = endian_short(hdr.cnt);
hdr.size.bytes = endian_long(hdr.size.bytes);
}
_uckdcmp_size = hdr.cnt << 1;
_uckdcmp_nodes = (ac_uint4 *) malloc(hdr.size.bytes);
_uckdcmp_decomp = _uckdcmp_nodes + (_uckdcmp_size + 1);
/*
* Read the decomposition data in.
*/
size = hdr.size.bytes / sizeof(ac_uint4);
fread((char *) _uckdcmp_nodes, sizeof(ac_uint4), size, in);
/*
* Do an endian swap if necessary.
*/
if (hdr.bom == 0xfffe) {
for (i = 0; i < size; i++)
_uckdcmp_nodes[i] = endian_long(_uckdcmp_nodes[i]);
}
fclose(in);
return 0;
}
static void
_ucdcmp_unload(void)
{
if (_ucdcmp_size == 0)
return;
/*
* Only need to free the offsets because the memory is allocated as a
* single block.
*/
free((char *) _ucdcmp_nodes);
_ucdcmp_size = 0;
}
static void
_uckdcmp_unload(void)
{
if (_uckdcmp_size == 0)
return;
/*
* Only need to free the offsets because the memory is allocated as a
* single block.
*/
free((char *) _uckdcmp_nodes);
_uckdcmp_size = 0;
}
#endif
int
ucdecomp(ac_uint4 code, ac_uint4 *num, ac_uint4 **decomp)
{
long l, r, m;
if (code < _ucdcmp_nodes[0]) {
return 0;
}
l = 0;
r = _ucdcmp_nodes[_ucdcmp_size] - 1;
while (l <= r) {
/*
* Determine a "mid" point and adjust to make sure the mid point is at
* the beginning of a code+offset pair.
*/
m = (l + r) >> 1;
m -= (m & 1);
if (code > _ucdcmp_nodes[m])
l = m + 2;
else if (code < _ucdcmp_nodes[m])
r = m - 2;
else if (code == _ucdcmp_nodes[m]) {
*num = _ucdcmp_nodes[m + 3] - _ucdcmp_nodes[m + 1];
*decomp = (ac_uint4*)&_ucdcmp_decomp[_ucdcmp_nodes[m + 1]];
return 1;
}
}
return 0;
}
int
uckdecomp(ac_uint4 code, ac_uint4 *num, ac_uint4 **decomp)
{
long l, r, m;
if (code < _uckdcmp_nodes[0]) {
return 0;
}
l = 0;
r = _uckdcmp_nodes[_uckdcmp_size] - 1;
while (l <= r) {
/*
* Determine a "mid" point and adjust to make sure the mid point is at
* the beginning of a code+offset pair.
*/
m = (l + r) >> 1;
m -= (m & 1);
if (code > _uckdcmp_nodes[m])
l = m + 2;
else if (code < _uckdcmp_nodes[m])
r = m - 2;
else if (code == _uckdcmp_nodes[m]) {
*num = _uckdcmp_nodes[m + 3] - _uckdcmp_nodes[m + 1];
*decomp = (ac_uint4*)&_uckdcmp_decomp[_uckdcmp_nodes[m + 1]];
return 1;
}
}
return 0;
}
int
ucdecomp_hangul(ac_uint4 code, ac_uint4 *num, ac_uint4 decomp[])
{
if (!ucishangul(code))
return 0;
code -= 0xac00;
decomp[0] = 0x1100 + (ac_uint4) (code / 588);
decomp[1] = 0x1161 + (ac_uint4) ((code % 588) / 28);
decomp[2] = 0x11a7 + (ac_uint4) (code % 28);
*num = (decomp[2] != 0x11a7) ? 3 : 2;
return 1;
}
/* mode == 0 for canonical, mode == 1 for compatibility */
static int
uccanoncompatdecomp(const ac_uint4 *in, int inlen,
ac_uint4 **out, int *outlen, short mode, void *ctx)
{
int l, size;
unsigned i, j, k;
ac_uint4 num, class, *decomp, hangdecomp[3];
size = inlen * 2;
*out = (ac_uint4 *) ber_memalloc_x(size * sizeof(**out), ctx);
if (*out == NULL)
return *outlen = -1;
i = 0;
for (j = 0; j < (unsigned) inlen; j++) {
if (mode ? uckdecomp(in[j], &num, &decomp) : ucdecomp(in[j], &num, &decomp)) {
if ( size - i < num) {
size = inlen + i - j + num - 1;
*out = (ac_uint4 *) ber_memrealloc_x(*out, size * sizeof(**out), ctx );
if (*out == NULL)
return *outlen = -1;
}
for (k = 0; k < num; k++) {
class = uccombining_class(decomp[k]);
if (class == 0) {
(*out)[i] = decomp[k];
} else {
for (l = i; l > 0; l--)
if (class >= uccombining_class((*out)[l-1]))
break;
AC_MEMCPY(*out + l + 1, *out + l, (i - l) * sizeof(**out));
(*out)[l] = decomp[k];
}
i++;
}
} else if (ucdecomp_hangul(in[j], &num, hangdecomp)) {
if (size - i < num) {
size = inlen + i - j + num - 1;
*out = (ac_uint4 *) ber_memrealloc_x(*out, size * sizeof(**out), ctx);
if (*out == NULL)
return *outlen = -1;
}
for (k = 0; k < num; k++) {
(*out)[i] = hangdecomp[k];
i++;
}
} else {
if (size - i < 1) {
size = inlen + i - j;
*out = (ac_uint4 *) ber_memrealloc_x(*out, size * sizeof(**out), ctx);
if (*out == NULL)
return *outlen = -1;
}
class = uccombining_class(in[j]);
if (class == 0) {
(*out)[i] = in[j];
} else {
for (l = i; l > 0; l--)
if (class >= uccombining_class((*out)[l-1]))
break;
AC_MEMCPY(*out + l + 1, *out + l, (i - l) * sizeof(**out));
(*out)[l] = in[j];
}
i++;
}
}
return *outlen = i;
}
int
uccanondecomp(const ac_uint4 *in, int inlen,
ac_uint4 **out, int *outlen, void *ctx)
{
return uccanoncompatdecomp(in, inlen, out, outlen, 0, ctx);
}
int
uccompatdecomp(const ac_uint4 *in, int inlen,
ac_uint4 **out, int *outlen, void *ctx)
{
return uccanoncompatdecomp(in, inlen, out, outlen, 1, ctx);
}
/**************************************************************************
*
* Support for combining classes.
*
**************************************************************************/
#if !HARDCODE_DATA
static ac_uint4 _uccmcl_size;
static ac_uint4 *_uccmcl_nodes;
/*
* Return -1 on error, 0 if okay
*/
static int
_uccmcl_load(char *paths, int reload)
{
FILE *in;
ac_uint4 i;
_ucheader_t hdr;
if (_uccmcl_size > 0) {
if (!reload)
/*
* The combining classes have already been loaded.
*/
return 0;
free((char *) _uccmcl_nodes);
_uccmcl_size = 0;
}
if ((in = _ucopenfile(paths, "cmbcl.dat", "rb")) == 0)
return -1;
/*
* Load the header.
*/
fread((char *) &hdr, sizeof(_ucheader_t), 1, in);
if (hdr.bom == 0xfffe) {
hdr.cnt = endian_short(hdr.cnt);
hdr.size.bytes = endian_long(hdr.size.bytes);
}
_uccmcl_size = hdr.cnt * 3;
_uccmcl_nodes = (ac_uint4 *) malloc(hdr.size.bytes);
/*
* Read the combining classes in.
*/
fread((char *) _uccmcl_nodes, sizeof(ac_uint4), _uccmcl_size, in);
/*
* Do an endian swap if necessary.
*/
if (hdr.bom == 0xfffe) {
for (i = 0; i < _uccmcl_size; i++)
_uccmcl_nodes[i] = endian_long(_uccmcl_nodes[i]);
}
fclose(in);
return 0;
}
static void
_uccmcl_unload(void)
{
if (_uccmcl_size == 0)
return;
free((char *) _uccmcl_nodes);
_uccmcl_size = 0;
}
#endif
ac_uint4
uccombining_class(ac_uint4 code)
{
long l, r, m;
l = 0;
r = _uccmcl_size - 1;
while (l <= r) {
m = (l + r) >> 1;
m -= (m % 3);
if (code > _uccmcl_nodes[m + 1])
l = m + 3;
else if (code < _uccmcl_nodes[m])
r = m - 3;
else if (code >= _uccmcl_nodes[m] && code <= _uccmcl_nodes[m + 1])
return _uccmcl_nodes[m + 2];
}
return 0;
}
/**************************************************************************
*
* Support for numeric values.
*
**************************************************************************/
#if !HARDCODE_DATA
static ac_uint4 *_ucnum_nodes;
static ac_uint4 _ucnum_size;
static short *_ucnum_vals;
/*
* Return -1 on error, 0 if okay
*/
static int
_ucnumb_load(char *paths, int reload)
{
FILE *in;
ac_uint4 size, i;
_ucheader_t hdr;
if (_ucnum_size > 0) {
if (!reload)
/*
* The numbers have already been loaded.
*/
return 0;
free((char *) _ucnum_nodes);
_ucnum_size = 0;
}
if ((in = _ucopenfile(paths, "num.dat", "rb")) == 0)
return -1;
/*
* Load the header.
*/
fread((char *) &hdr, sizeof(_ucheader_t), 1, in);
if (hdr.bom == 0xfffe) {
hdr.cnt = endian_short(hdr.cnt);
hdr.size.bytes = endian_long(hdr.size.bytes);
}
_ucnum_size = hdr.cnt;
_ucnum_nodes = (ac_uint4 *) malloc(hdr.size.bytes);
_ucnum_vals = (short *) (_ucnum_nodes + _ucnum_size);
/*
* Read the combining classes in.
*/
fread((char *) _ucnum_nodes, sizeof(unsigned char), hdr.size.bytes, in);
/*
* Do an endian swap if necessary.
*/
if (hdr.bom == 0xfffe) {
for (i = 0; i < _ucnum_size; i++)
_ucnum_nodes[i] = endian_long(_ucnum_nodes[i]);
/*
* Determine the number of values that have to be adjusted.
*/
size = (hdr.size.bytes -
(_ucnum_size * (sizeof(ac_uint4) << 1))) /
sizeof(short);
for (i = 0; i < size; i++)
_ucnum_vals[i] = endian_short(_ucnum_vals[i]);
}
fclose(in);
return 0;
}
static void
_ucnumb_unload(void)
{
if (_ucnum_size == 0)
return;
free((char *) _ucnum_nodes);
_ucnum_size = 0;
}
#endif
int
ucnumber_lookup(ac_uint4 code, struct ucnumber *num)
{
long l, r, m;
short *vp;
l = 0;
r = _ucnum_size - 1;
while (l <= r) {
/*
* Determine a "mid" point and adjust to make sure the mid point is at
* the beginning of a code+offset pair.
*/
m = (l + r) >> 1;
m -= (m & 1);
if (code > _ucnum_nodes[m])
l = m + 2;
else if (code < _ucnum_nodes[m])
r = m - 2;
else {
vp = (short *)_ucnum_vals + _ucnum_nodes[m + 1];
num->numerator = (int) *vp++;
num->denominator = (int) *vp;
return 1;
}
}
return 0;
}
int
ucdigit_lookup(ac_uint4 code, int *digit)
{
long l, r, m;
short *vp;
l = 0;
r = _ucnum_size - 1;
while (l <= r) {
/*
* Determine a "mid" point and adjust to make sure the mid point is at
* the beginning of a code+offset pair.
*/
m = (l + r) >> 1;
m -= (m & 1);
if (code > _ucnum_nodes[m])
l = m + 2;
else if (code < _ucnum_nodes[m])
r = m - 2;
else {
vp = (short *)_ucnum_vals + _ucnum_nodes[m + 1];
if (*vp == *(vp + 1)) {
*digit = *vp;
return 1;
}
return 0;
}
}
return 0;
}
struct ucnumber
ucgetnumber(ac_uint4 code)
{
struct ucnumber num;
/*
* Initialize with some arbitrary value, because the caller simply cannot
* tell for sure if the code is a number without calling the ucisnumber()
* macro before calling this function.
*/
num.numerator = num.denominator = -111;
(void) ucnumber_lookup(code, &num);
return num;
}
int
ucgetdigit(ac_uint4 code)
{
int dig;
/*
* Initialize with some arbitrary value, because the caller simply cannot
* tell for sure if the code is a number without calling the ucisdigit()
* macro before calling this function.
*/
dig = -111;
(void) ucdigit_lookup(code, &dig);
return dig;
}
/**************************************************************************
*
* Setup and cleanup routines.
*
**************************************************************************/
#if HARDCODE_DATA
int ucdata_load(char *paths, int masks) { return 0; }
void ucdata_unload(int masks) { }
int ucdata_reload(char *paths, int masks) { return 0; }
#else
/*
* Return 0 if okay, negative on error
*/
int
ucdata_load(char *paths, int masks)
{
int error = 0;
if (masks & UCDATA_CTYPE)
error |= _ucprop_load(paths, 0) < 0 ? UCDATA_CTYPE : 0;
if (masks & UCDATA_CASE)
error |= _uccase_load(paths, 0) < 0 ? UCDATA_CASE : 0;
if (masks & UCDATA_DECOMP)
error |= _ucdcmp_load(paths, 0) < 0 ? UCDATA_DECOMP : 0;
if (masks & UCDATA_CMBCL)
error |= _uccmcl_load(paths, 0) < 0 ? UCDATA_CMBCL : 0;
if (masks & UCDATA_NUM)
error |= _ucnumb_load(paths, 0) < 0 ? UCDATA_NUM : 0;
if (masks & UCDATA_COMP)
error |= _uccomp_load(paths, 0) < 0 ? UCDATA_COMP : 0;
if (masks & UCDATA_KDECOMP)
error |= _uckdcmp_load(paths, 0) < 0 ? UCDATA_KDECOMP : 0;
return -error;
}
void
ucdata_unload(int masks)
{
if (masks & UCDATA_CTYPE)
_ucprop_unload();
if (masks & UCDATA_CASE)
_uccase_unload();
if (masks & UCDATA_DECOMP)
_ucdcmp_unload();
if (masks & UCDATA_CMBCL)
_uccmcl_unload();
if (masks & UCDATA_NUM)
_ucnumb_unload();
if (masks & UCDATA_COMP)
_uccomp_unload();
if (masks & UCDATA_KDECOMP)
_uckdcmp_unload();
}
/*
* Return 0 if okay, negative on error
*/
int
ucdata_reload(char *paths, int masks)
{
int error = 0;
if (masks & UCDATA_CTYPE)
error |= _ucprop_load(paths, 1) < 0 ? UCDATA_CTYPE : 0;
if (masks & UCDATA_CASE)
error |= _uccase_load(paths, 1) < 0 ? UCDATA_CASE : 0;
if (masks & UCDATA_DECOMP)
error |= _ucdcmp_load(paths, 1) < 0 ? UCDATA_DECOMP : 0;
if (masks & UCDATA_CMBCL)
error |= _uccmcl_load(paths, 1) < 0 ? UCDATA_CMBCL : 0;
if (masks & UCDATA_NUM)
error |= _ucnumb_load(paths, 1) < 0 ? UCDATA_NUM : 0;
if (masks & UCDATA_COMP)
error |= _uccomp_load(paths, 1) < 0 ? UCDATA_COMP : 0;
if (masks & UCDATA_KDECOMP)
error |= _uckdcmp_load(paths, 1) < 0 ? UCDATA_KDECOMP : 0;
return -error;
}
#endif
#ifdef TEST
void
main(void)
{
int dig;
ac_uint4 i, lo, *dec;
struct ucnumber num;
/* ucdata_setup("."); */
if (ucisweak(0x30))
printf("WEAK\n");
else
printf("NOT WEAK\n");
printf("LOWER 0x%04lX\n", uctolower(0xff3a));
printf("UPPER 0x%04lX\n", uctoupper(0xff5a));
if (ucisalpha(0x1d5))
printf("ALPHA\n");
else
printf("NOT ALPHA\n");
if (ucisupper(0x1d5)) {
printf("UPPER\n");
lo = uctolower(0x1d5);
printf("0x%04lx\n", lo);
lo = uctotitle(0x1d5);
printf("0x%04lx\n", lo);
} else
printf("NOT UPPER\n");
if (ucistitle(0x1d5))
printf("TITLE\n");
else
printf("NOT TITLE\n");
if (uciscomposite(0x1d5))
printf("COMPOSITE\n");
else
printf("NOT COMPOSITE\n");
if (ucdecomp(0x1d5, &lo, &dec)) {
for (i = 0; i < lo; i++)
printf("0x%04lx ", dec[i]);
putchar('\n');
}
if ((lo = uccombining_class(0x41)) != 0)
printf("0x41 CCL %ld\n", lo);
if (ucisxdigit(0xfeff))
printf("0xFEFF HEX DIGIT\n");
else
printf("0xFEFF NOT HEX DIGIT\n");
if (ucisdefined(0x10000))
printf("0x10000 DEFINED\n");
else
printf("0x10000 NOT DEFINED\n");
if (ucnumber_lookup(0x30, &num)) {
if (num.denominator != 1)
printf("UCNUMBER: 0x30 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCNUMBER: 0x30 = %d\n", num.numerator);
} else
printf("UCNUMBER: 0x30 NOT A NUMBER\n");
if (ucnumber_lookup(0xbc, &num)) {
if (num.denominator != 1)
printf("UCNUMBER: 0xbc = %d/%d\n", num.numerator, num.denominator);
else
printf("UCNUMBER: 0xbc = %d\n", num.numerator);
} else
printf("UCNUMBER: 0xbc NOT A NUMBER\n");
if (ucnumber_lookup(0xff19, &num)) {
if (num.denominator != 1)
printf("UCNUMBER: 0xff19 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCNUMBER: 0xff19 = %d\n", num.numerator);
} else
printf("UCNUMBER: 0xff19 NOT A NUMBER\n");
if (ucnumber_lookup(0x4e00, &num)) {
if (num.denominator != 1)
printf("UCNUMBER: 0x4e00 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCNUMBER: 0x4e00 = %d\n", num.numerator);
} else
printf("UCNUMBER: 0x4e00 NOT A NUMBER\n");
if (ucdigit_lookup(0x06f9, &dig))
printf("UCDIGIT: 0x6f9 = %d\n", dig);
else
printf("UCDIGIT: 0x6f9 NOT A NUMBER\n");
dig = ucgetdigit(0x0969);
printf("UCGETDIGIT: 0x969 = %d\n", dig);
num = ucgetnumber(0x30);
if (num.denominator != 1)
printf("UCGETNUMBER: 0x30 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCGETNUMBER: 0x30 = %d\n", num.numerator);
num = ucgetnumber(0xbc);
if (num.denominator != 1)
printf("UCGETNUMBER: 0xbc = %d/%d\n", num.numerator, num.denominator);
else
printf("UCGETNUMBER: 0xbc = %d\n", num.numerator);
num = ucgetnumber(0xff19);
if (num.denominator != 1)
printf("UCGETNUMBER: 0xff19 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCGETNUMBER: 0xff19 = %d\n", num.numerator);
/* ucdata_cleanup(); */
exit(0);
}
#endif /* TEST */
| execunix/vinos | external/bsd/openldap/dist/libraries/liblunicode/ucdata/ucdata.c | C | apache-2.0 | 36,507 | [
30522,
1013,
1008,
1002,
5658,
5910,
2094,
1024,
15384,
2850,
2696,
1012,
1039,
1010,
1058,
1015,
1012,
1015,
1012,
1015,
1012,
1018,
2297,
1013,
5709,
1013,
2654,
5641,
1024,
5388,
1024,
4008,
19817,
2239,
4654,
2361,
1002,
1008,
1013,
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... |
<?php
/* -----------------------------------------------------------------
* $Id: create_pdf.php 1457 2015-04-21 09:38:44Z akausch $
* Copyright (c) 2011-2021 commerce:SEO by Webdesign Erfurt
* http://www.commerce-seo.de
* ------------------------------------------------------------------
* based on:
* (c) 2000-2001 The Exchange Project (earlier name of osCommerce)
* (c) 2002-2003 osCommerce - www.oscommerce.com
* (c) 2003 nextcommerce - www.nextcommerce.org
* (c) 2005 xt:Commerce - www.xt-commerce.com
* Released under the GNU General Public License
* --------------------------------------------------------------- */
defined("_VALID_XTC") or die("Direct access to this location isn't allowed.");
require_once('includes/application_top.php');
define('FPDF_FONTPATH', DIR_FS_ADMIN . 'pdf/font/');
$pdf_query = xtc_db_query("SELECT pdf_key, pdf_value FROM orders_pdf_profile WHERE languages_id = '0';");
while ($pdf = xtc_db_fetch_array($pdf_query)) {
define($pdf['pdf_key'], $pdf['pdf_value']);
}
require_once(DIR_FS_INC . 'xtc_get_order_data.inc.php');
require_once(DIR_FS_INC . 'xtc_get_attributes_model.inc.php');
require_once(DIR_FS_INC . 'xtc_not_null.inc.php');
require_once(DIR_FS_INC . 'xtc_format_price_order.inc.php');
include_once(DIR_WS_CLASSES . 'class.order.php');
$order = new order($_GET['oID']);
$type = $_POST['type'];
$type = $_GET['type'];
$sprach_id = $_POST['pdf_language_id'];
$sprache = $order->info['language'];
require_once('pdf/pdf_bill.php');
$pdf = new PDF_Bill();
$pdf->Init(($type == 'rechnung' ? FILENAME_BILL : FILENAME_PACKINSLIP));
if (PDF_LIEFERSCHEIN) {
$kundenadresse = xtc_address_format($order->customer['format_id'], $order->delivery, 1, '', '<br>');
} else {
$kundenadresse = xtc_address_format($order->customer['format_id'], $order->billing, 1, '', '<br>');
}
$pdf->Adresse(utf8_decode(str_replace("<br>", "\n", $kundenadresse)), TEXT_PDF_SHOPADRESSEKLEIN);
$logo = DIR_FS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/img/' . LAYOUT_LOGO_FILE;
if (file_exists($logo) && LAYOUT_LOGO_FILE != '') {
$pdf->Logo($logo);
}
if (PDF_RECHNUNG_DATE_ACT == 'true' && $_POST['pdf_bill_versandzusatzdate'] == '') {
$date_purchased = time();
$date_purchased = date("d.m.Y", $date_purchased);
} elseif ($_POST['pdf_bill_versandzusatzdate'] == '') {
$date_purchased = xtc_date_short($order->info['date_purchased']);
} else {
$date_purchased = $_POST['pdf_bill_versandzusatzdate'];
}
if ($order->info['payment_method'] != '' && $order->info['payment_method'] != 'no_payment') {
include(DIR_FS_CATALOG . 'lang/' . $sprache . '/modules/payment/' . $order->info['payment_method'] . '.php');
$payment_method = constant(strtoupper('MODULE_PAYMENT_' . $order->info['payment_method'] . '_TEXT_TITLE'));
$payment_method = strip_tags($payment_method);
$payment_method = html_entity_decode($payment_method);
$payment_method = utf8_decode($payment_method);
} else {
$payment_method = '';
}
if (PDF_RECHNUNG_OID == 'true') {
$pdf_re_id = (int) $_GET['oID'];
} else {
$pdf_re_id = $_POST['pdf_bill_nr'];
}
// Kunden ID abfragen
$order_check = xtc_db_fetch_array(xtc_db_query("SELECT customers_id FROM " . TABLE_ORDERS . " WHERE orders_id = '" . (int) $_GET['oID'] . "' LIMIT 1;"));
$customer_gender = xtc_db_fetch_array(xtc_db_query("SELECT customers_gender FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . (int) $order_check['customers_id'] . "' LIMIT 1;"));
$pdf->Rechnungsdaten($order->customer['csID'], $_GET['oID'], $order->customer['vat_id'], $pdf_re_id, $date_purchased, $payment_method, PDF_LIEFERSCHEIN);
$pdf->RechnungStart($pdf_re_id, $_GET['oID'], utf8_decode($order->customer['lastname']), $customer_gender['customers_gender'], PDF_LIEFERSCHEIN);
$pdf->ListeKopf(PDF_LIEFERSCHEIN);
// Produktinfos
$order_query = xtc_db_query("SELECT * FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id='" . (int) $_GET['oID'] . "'");
$order_data = array();
// Ausgabe der Produkte
while ($order_data_values = xtc_db_fetch_array($order_query)) {
$attributes_query = xtc_db_query("SELECT * FROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " WHERE orders_products_id='" . $order_data_values['orders_products_id'] . "' ORDER BY orders_products_attributes_id ASC");
$attributes_data = '';
$attributes_model = '';
while ($attributes_data_values = xtc_db_fetch_array($attributes_query)) {
$attributes_data .= $attributes_data_values['products_options'] . ': ' . $attributes_data_values['products_options_values'] . "\n";
$attributes_model .= xtc_get_attributes_model($order_data_values['products_id'], $attributes_data_values['products_options_values'], $attributes_data_values['products_options']) . "\n";
}
$orderinfosingleprice = str_replace('€', 'EUR', xtc_format_price_order($order_data_values['products_price'], 1, $order->info['currency']));
$orderinfosingleprice = str_replace('€', 'EUR', $orderinfosingleprice);
$orderinfosumleprice = str_replace('€', 'EUR', xtc_format_price_order($order_data_values['final_price'], 1, $order->info['currency']));
$orderinfosumleprice = str_replace('€', 'EUR', $orderinfosumleprice);
$orderinfocurreny = str_replace('€', 'EUR', $orderinfocurreny);
$pdf->ListeProduktHinzu($order_data_values['products_quantity'], utf8_decode(strip_tags($order_data_values['products_name'])), utf8_decode(trim($attributes_data)), $order_data_values['products_model'], trim($attributes_model, $type), $orderinfosingleprice, $orderinfosumleprice, $type);
}
if (!PDF_LIEFERSCHEIN) {
$oder_total_query = xtc_db_query("SELECT
title,
text,
class,
value,
sort_order
FROM
" . TABLE_ORDERS_TOTAL . "
WHERE
orders_id='" . $_GET['oID'] . "'
ORDER BY
sort_order ASC");
$order_data = array();
while ($oder_total_values = xtc_db_fetch_array($oder_total_query)) {
$ordervaluetext = str_replace('€', 'EUR', $oder_total_values['text']);
$ordervaluetext = str_replace('€', 'EUR', $ordervaluetext);
$order_data[] = array('title' => utf8_decode(html_entity_decode($oder_total_values['title'])), 'class' => $oder_total_values['class'], 'value' => $oder_total_values['value'], 'text' => $ordervaluetext);
}
$pdf->Betrag($order_data, PDF_LIEFERSCHEIN);
}
/** BEGIN BILLPAY CHANGED * */
if ($order->info['payment_method'] == 'billpay' || $order->info['payment_method'] == 'billpaydebit' || $order->info['payment_method'] == 'billpaytransactioncredit') {
require_once(DIR_FS_CATALOG . DIR_WS_INCLUDES . '/billpay/utils/billpay_display_pdf_data.php');
}
/** EOF BILLPAY CHANGED * */
$pdf->RechnungEnde($order->customer['vat_id'], $order->info['shipping_method'], PDF_LIEFERSCHEIN);
if ($_POST['pdf_bill_versandzusatz'] != '') {
$pdf_zusatz = strip_tags($_POST['pdf_bill_versandzusatz']);
$pdf->Kommentar($pdf_zusatz, $order->info['shipping_method'], PDF_LIEFERSCHEIN);
} elseif (MODULE_CUSTOMERS_PDF_INVOICE_PRINT_COMMENT == 'true') {
$pdf->Kommentar($order->info['comments'], $order->info['shipping_method'], PDF_LIEFERSCHEIN);
}
if ($order->info['payment_method'] == 'invoice' || $order->info['payment_method'] == 'moneyorder') {
$invoiceinfo = TEXT_PDF_INVOICE_TEXT;
$pdf->Invoice($invoiceinfo);
}
$lieferadresse = xtc_address_format($order->customer['format_id'], $order->delivery, 1, '', ', ');
$pdf->LieferAdresse(utf8_decode($lieferadresse));
if (!PDF_LIEFERSCHEIN) {
$pdf_name = cseo_get_pdf($_POST['oID'], true) . '.pdf';
$pdf->Output($pdf_name, 'F');
$check_pdf = xtc_db_query("SELECT bill_name FROM orders_pdf WHERE order_id = '" . $_POST['oID'] . "'");
if (xtc_db_num_rows($check_pdf, true) > 1) {
xtc_db_query("UPDATE orders_pdf SET bill_name = '" . $pdf_name . "', pdf_bill_nr = '" . $pdf_re_id . "', pdf_generate_date = NOW() WHERE order_id = '" . $_POST['oID'] . "' ");
} else {
xtc_db_query("INSERT INTO orders_pdf (order_id, bill_name, pdf_bill_nr, pdf_generate_date) VALUES ('" . $_POST['oID'] . "', '" . $pdf_name . "', '" . $pdf_re_id . "', NOW());");
}
$_SESSION['msg']['gp'] = '<div id="success_msg">' . SUCCESS_ORDER_GENEREATE . '</div>';
if ($_POST['pdf_rechnung_senden'] != '1') {
xtc_redirect(xtc_href_link(FILENAME_ORDERS, 'page=' . $_POST['page'] . '&action=edit&oID=' . $_POST['oID'] . '#pdf'));
}
} else {
$pdf_name = cseo_get_pdf_delivery($_POST['oID'], true) . '.pdf';
$pdf->Output($pdf_name, 'F');
$check_pdf = xtc_db_query("SELECT delivery_name FROM orders_pdf_delivery WHERE order_id = '" . $_POST['oID'] . "'");
if (xtc_db_num_rows($check_pdf, true) > 1) {
xtc_db_query("UPDATE orders_pdf_delivery SET delivery_name = '" . $pdf_name . "', pdf_delivery_nr = '" . $pdf_re_id . "', pdf_generate_date = NOW() WHERE order_id = '" . $_POST['oID'] . "' ");
} else {
xtc_db_query("INSERT INTO orders_pdf_delivery (order_id, delivery_name, pdf_delivery_nr, pdf_generate_date) VALUES ('" . $_POST['oID'] . "', '" . $pdf_name . "', '" . $pdf_re_id . "', NOW());");
}
$_SESSION['msg']['gp'] = '<div id="success_msg">' . SUCCESS_ORDER_GENEREATE . '</div>';
}
| commerceseo/v2next | admin/create_pdf.php | PHP | gpl-2.0 | 9,473 | [
30522,
1026,
1029,
25718,
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,
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... |
# Globals for the directions
# Change the values as you see fit
EAST = None
NORTH = None
WEST = None
SOUTH = None
class Robot:
def __init__(self, direction=NORTH, x_pos=0, y_pos=0):
pass
| jmluy/xpython | exercises/practice/robot-simulator/robot_simulator.py | Python | mit | 201 | [
30522,
1001,
3795,
2015,
2005,
1996,
7826,
1001,
2689,
1996,
5300,
2004,
2017,
2156,
4906,
2264,
1027,
3904,
2167,
1027,
3904,
2225,
1027,
3904,
2148,
1027,
3904,
2465,
8957,
1024,
13366,
1035,
1035,
1999,
4183,
1035,
1035,
1006,
2969,
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... |
/*******************************************************************************
* Copyright (c) 2015 Sierra Wireless and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.html.
*
* Contributors:
* Sierra Wireless - initial API and implementation
*******************************************************************************/
package org.eclipse.leshan.server.model;
import org.eclipse.leshan.core.model.LwM2mModel;
import org.eclipse.leshan.core.node.codec.LwM2mNodeDecoder;
import org.eclipse.leshan.core.node.codec.LwM2mNodeEncoder;
import org.eclipse.leshan.server.client.Client;
/**
* A <code>LwM2mModelProvider</code> implementation is in charge of returning the description of the LWM2M objects for
* each registered client.
* <p>
* The description of each object is mainly used by the {@link LwM2mNodeEncoder}/{@link LwM2mNodeDecoder} to
* encode/decode the requests/responses payload.
* </p>
* <p>
* A typical use case to implement a custom provider is the need to support several version of the specification.
* </p>
*/
public interface LwM2mModelProvider {
/**
* Returns the description of the objects supported by the given client.
*
* @param client the registered client
* @return the list of object descriptions
*/
LwM2mModel getObjectModel(Client client);
}
| iotoasis/SI | si-modules/LWM2M_IPE_Server/leshan-server-core/src/main/java/org/eclipse/leshan/server/model/LwM2mModelProvider.java | Java | bsd-2-clause | 1,717 | [
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... |
/* app/ui/map/svg */
define(
[
'jquery',
'raphael',
'app/ui/map/data',
'app/ui/map/util',
'util/detector',
'pubsub'
],
function ($, Raphael, MapData, MapUtil, Detector) {
'use strict';
var SVG;
return {
nzte: {},
markers: [],
exports: {},
countryText: {},
sets: {},
continentSets: {},
text: {},
raphael: null,
_$container: null,
_isExportsMap: false,
init: function () {
SVG = this;
this._$container = $('.js-map-container');
this._isExportsMap = $('#js-map-nzte').length ? false : true;
//If already setup just show the map again
if (this._$container.is('.is-loaded')) {
this._$container.show();
return;
}
if (this._isExportsMap) {
this._initInteractiveMap();
return;
}
this._initRegularMap();
},
_initInteractiveMap: function () {
this._setUpMap();
this._drawMap();
this._createContinentSets();
this._initInteractiveMapEvents();
this._setLoaded();
this._hideLoader();
},
_initRegularMap: function () {
this._setUpMap();
this._drawMap();
this._createSets();
this._initRegularMapEvents();
this._setLoaded();
this._hideLoader();
},
_setLoaded: function () {
this._$container.addClass('is-loaded');
},
_hideLoader: function () {
$.publish('/loader/hide');
},
_setUpMap: function () {
var id = this._isExportsMap ? 'js-map-exports' : 'js-map-nzte';
this._$container.show();
this.raphael = Raphael(id, '100%', '100%');
this.raphael.setViewBox(0, 0, 841, 407, true);
this.raphael.canvas.setAttribute('preserveAspectRatio', 'xMinYMin meet');
},
_drawMap: function () {
this._addMainMap();
this._addContinentMarkers();
this._addContinentMarkerText();
if (this._isExportsMap) {
this._addCountryMarkers();
}
},
_addMainMap: function () {
var mainAttr = {
stroke: 'none',
fill: '#dededd',
'fill-rule': 'evenodd',
'stroke-linejoin': 'round'
};
this.nzte.main = this.raphael.path(MapData.main).attr(mainAttr);
},
_addContinentMarkers: function () {
var markerAttr = {
stroke: 'none',
fill: '#f79432',
'stroke-linejoin': 'round',
cursor: 'pointer'
};
var markerPaths = MapData.markers[0];
for (var continent in markerPaths) {
if (!this._isExportsMap || this._isExportsMap && continent !== 'new-zealand') {
this.markers[continent] = this.raphael.path(markerPaths[continent]).attr(markerAttr);
}
}
},
_addContinentMarkerText: function () {
var textAttr = {
stroke: 'none',
fill: '#ffffff',
'fill-rule': 'evenodd',
'stroke-linejoin': 'round',
cursor: 'pointer'
};
var textPaths = MapData.text[0];
for (var continent in textPaths) {
if (!this._isExportsMap || this._isExportsMap && continent !== 'new-zealand') {
this.text[continent] = this.raphael.path(textPaths[continent]).attr(textAttr);
}
}
},
_addCountryMarkers: function () {
var marker;
for (var region in this.markers) {
marker = this.markers[region];
this._createHoverBox(region, marker);
}
},
_createHoverBox: function (region, marker) {
var set;
var markerAttr = {
stroke: 'none',
fill: '#116697',
opacity: 0,
'stroke-linejoin': 'round'
};
var markerPaths = MapData.exportsText[0];
var country = markerPaths[region];
if (!country) {
return;
}
var countryText = markerPaths[region][0];
var numberOfCountries = Object.keys(countryText).length;
var markerBox = marker.getBBox();
var topX = markerBox.x;
var bottomY = markerBox.y2;
var width = region !== 'india-middle-east-and-africa' ? 150 : 200;
//Add the rectangle
this.exports[region] = this.raphael.rect(topX + 28, bottomY - 1, width, (21 * numberOfCountries) + 5).toBack().attr(markerAttr);
//Create a set to combine countries, hover box and region icon/text
set = this.raphael.set();
set.push(
this.exports[region]
);
//Add the country Text
this._addCountryText(markerBox, countryText, topX + 28, bottomY - 1, 21, region, set);
},
_addCountryText: function (markerBox, countryText, x, y, height, region, set) {
var updatedX = x + 10;
var updatedY = y + 10;
var textAttr = {
font: '13px Arial',
textAlign: 'left',
fill: "#ffffff",
cursor: 'pointer',
'text-decoration': 'underline',
'text-anchor': 'start',
opacity: 0
};
for (var country in countryText) {
var text = countryText[country].toUpperCase();
this.countryText[country] = this.raphael.text(updatedX, updatedY, text).toBack().attr(textAttr);
updatedY += height;
set.push(
this.countryText[country]
);
}
this.continentSets[region] = set.hide();
},
_createSets: function () {
for (var region in this.markers) {
var set = this.raphael.set();
set.push(
this.markers[region],
this.text[region]
);
this.sets[region] = set;
}
},
_createContinentSets: function () {
for (var region in this.markers) {
var set = this.raphael.set();
set.push(
this.markers[region],
this.text[region],
this.continentSets[region]
);
this.sets[region] = set;
}
},
_initInteractiveMapEvents: function () {
this._initCountryTextEvents();
this._initCountryHoverEvents();
},
_initRegularMapEvents: function () {
var bounceEasing = 'cubic-bezier(0.680, -0.550, 0.265, 1.550)';
var mouseOverMarkerBounce = {
transform: 's1.1'
};
var mouseOverMarkerBounceWithTranslate = {
transform: 's1.1t5,0'
};
var mouseOutMarkerBounce = {
transform: 's1'
};
var mouseOverMarker = {
fill: '#116697'
};
var mouseOutMarker = {
fill: '#f79432'
};
for (var region in this.sets) {
var set = this.sets[region];
var marker = this.markers[region];
var text = this.text[region];
(function (savedSet, savedRegion, savedMarker, savedText) {
savedSet.attr({
cursor: 'pointer'
});
savedSet.hover(function () {
//A slight translation is needed for 'india-middle-east-and-africa' so when hovered it isn't clipped by container
var transformAttr = savedRegion !== 'india-middle-east-and-africa' ? mouseOverMarkerBounce : mouseOverMarkerBounceWithTranslate;
savedMarker.animate(transformAttr, 250, bounceEasing);
savedMarker.animate(mouseOverMarker, 250, 'easeInOutExpo');
savedText.animate(transformAttr, 250, bounceEasing);
}, function () {
savedMarker.animate(mouseOutMarkerBounce, 250, bounceEasing);
savedMarker.animate(mouseOutMarker, 250, 'easeInOutSine');
savedText.animate(mouseOutMarkerBounce, 250, bounceEasing);
});
savedSet.click(function () {
MapUtil.goToUrl(savedRegion, false);
});
})(set, region, marker, text);
}
},
_initCountryHoverEvents: function () {
var noHover = Detector.noSvgHover();
var mouseOverMarker = {
fill: '#116697'
};
var mouseOutMarker = {
fill: '#f79432'
};
for (var region in this.sets) {
var set = this.sets[region];
var continentSet = this.continentSets[region];
var marker = this.markers[region];
var text = this.text[region];
var hoverBox = this.exports[region];
(function (savedSet, savedContinentSet, savedRegion, savedMarker, savedText, savedBox) {
savedSet.attr({
cursor: 'pointer'
});
if (noHover) {
savedMarker.data('open', false);
savedSet.click(function () {
if (savedMarker.data('open') === false) {
SVG._closeAllContinents();
savedMarker.data('open', true);
savedMarker.animate(mouseOverMarker, 250, 'easeInOutExpo');
savedContinentSet.show().toFront().animate({ opacity: 1 }, 250, 'easeInOutExpo');
} else {
savedMarker.data('open', false);
savedMarker.animate(mouseOutMarker, 250, 'easeInOutSine');
savedContinentSet.animate({ opacity: 0 }, 250, 'easeInOutSine').hide().toBack();
}
});
savedSet.hover(function () {
savedMarker.animate(mouseOverMarker, 250, 'easeInOutExpo');
}, function () {
savedMarker.data('open') === false && savedMarker.animate(mouseOutMarker, 250, 'easeInOutSine');
});
} else {
savedSet.hover(function () {
savedMarker.animate(mouseOverMarker, 250, 'easeInOutExpo');
savedContinentSet.show().toFront().animate({ opacity: 1 }, 250, 'easeInOutExpo');
}, function () {
savedMarker.animate(mouseOutMarker, 250, 'easeInOutSine');
savedContinentSet.animate({ opacity: 0 }, 250, 'easeInOutSine').hide().toBack();
});
}
})(set, continentSet, region, marker, text, hoverBox);
}
},
_closeAllContinents: function () {
for (var region in this.sets) {
var continentSet = this.continentSets[region];
var marker = this.markers[region];
var mouseOutMarker = {
fill: '#f79432'
};
marker.data('open', false);
marker.animate(mouseOutMarker, 250, 'easeInOutSine');
continentSet.animate({ opacity: 0 }, 250, 'easeInOutSine').hide().toBack();
}
},
_initCountryTextEvents: function () {
for (var country in this.countryText) {
var text = this.countryText[country];
(function (savedText, savedCountry) {
savedText.click(function () {
MapUtil.goToUrl(savedCountry, true);
});
savedText.hover(function () {
savedText.animate({ 'fill-opacity': 0.6 }, 250, 'easeInOutSine');
}, function () {
savedText.animate({ 'fill-opacity': 1 }, 250, 'easeInOutSine');
});
})(text, country);
}
}
};
}
); | patocallaghan/questionnaire-js | original/assets/scripts/src/app/ui/map/svg.js | JavaScript | mit | 9,939 | [
30522,
1013,
1008,
10439,
1013,
21318,
1013,
4949,
1013,
17917,
2290,
1008,
1013,
9375,
1006,
1031,
1005,
1046,
4226,
2854,
1005,
1010,
1005,
12551,
1005,
1010,
1005,
10439,
1013,
21318,
1013,
4949,
1013,
2951,
1005,
1010,
1005,
10439,
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 2011 Intel Corporation
*
* 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:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef DRM_FOURCC_H
#define DRM_FOURCC_H
#include "drm.h"
#if defined(__cplusplus)
extern "C"
{
#endif
/**
* DOC: overview
*
* In the DRM subsystem, framebuffer pixel formats are described using the
* fourcc codes defined in `include/uapi/drm/drm_fourcc.h`. In addition to
* the fourcc code, a Format Modifier may optionally be provided, in order
* to further describe the buffer's format - for example tiling or
* compression.
*
* Format Modifiers
* ----------------
*
* Format modifiers are used in conjunction with a fourcc code, forming a
* unique fourcc:modifier pair. This format:modifier pair must fully define
* the format and data layout of the buffer, and should be the only way to
* describe that particular buffer.
*
* Having multiple fourcc:modifier pairs which describe the same layout
* should be avoided, as such aliases run the risk of different drivers
* exposing different names for the same data format, forcing userspace to
* understand that they are aliases.
*
* Format modifiers may change any property of the buffer, including the
* number of planes and/or the required allocation size. Format modifiers
* are vendor-namespaced, and as such the relationship between a fourcc code
* and a modifier is specific to the modifer being used. For example, some
* modifiers may preserve meaning - such as number of planes - from the
* fourcc code, whereas others may not.
*
* Vendors should document their modifier usage in as much detail as
* possible, to ensure maximum compatibility across devices, drivers and
* applications.
*
* The authoritative list of format modifier codes is found in
* `include/uapi/drm/drm_fourcc.h`
*/
#define fourcc_code(a, b, c, d) \
((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
#define DRM_FORMAT_BIG_ENDIAN \
(1U << 31) /* format is big endian instead of little endian */
/* Reserve 0 for the invalid format specifier */
#define DRM_FORMAT_INVALID 0
/* color index */
#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */
/* 8 bpp Red */
#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */
/* 16 bpp Red */
#define DRM_FORMAT_R16 \
fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */
/* 16 bpp RG */
#define DRM_FORMAT_RG88 \
fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */
#define DRM_FORMAT_GR88 \
fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */
/* 32 bpp RG */
#define DRM_FORMAT_RG1616 \
fourcc_code('R', 'G', '3', '2') /* [31:0] R:G 16:16 little endian */
#define DRM_FORMAT_GR1616 \
fourcc_code('G', 'R', '3', '2') /* [31:0] G:R 16:16 little endian */
/* 8 bpp RGB */
#define DRM_FORMAT_RGB332 \
fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */
#define DRM_FORMAT_BGR233 \
fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */
/* 16 bpp RGB */
#define DRM_FORMAT_XRGB4444 \
fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */
#define DRM_FORMAT_XBGR4444 \
fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */
#define DRM_FORMAT_RGBX4444 \
fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */
#define DRM_FORMAT_BGRX4444 \
fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */
#define DRM_FORMAT_ARGB4444 \
fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */
#define DRM_FORMAT_ABGR4444 \
fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */
#define DRM_FORMAT_RGBA4444 \
fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */
#define DRM_FORMAT_BGRA4444 \
fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */
#define DRM_FORMAT_XRGB1555 \
fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */
#define DRM_FORMAT_XBGR1555 \
fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */
#define DRM_FORMAT_RGBX5551 \
fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */
#define DRM_FORMAT_BGRX5551 \
fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */
#define DRM_FORMAT_ARGB1555 \
fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */
#define DRM_FORMAT_ABGR1555 \
fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */
#define DRM_FORMAT_RGBA5551 \
fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */
#define DRM_FORMAT_BGRA5551 \
fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */
#define DRM_FORMAT_RGB565 \
fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */
#define DRM_FORMAT_BGR565 \
fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */
/* 24 bpp RGB */
#define DRM_FORMAT_RGB888 \
fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */
#define DRM_FORMAT_BGR888 \
fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */
/* 32 bpp RGB */
#define DRM_FORMAT_XRGB8888 \
fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */
#define DRM_FORMAT_XBGR8888 \
fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */
#define DRM_FORMAT_RGBX8888 \
fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */
#define DRM_FORMAT_BGRX8888 \
fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */
#define DRM_FORMAT_ARGB8888 \
fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */
#define DRM_FORMAT_ABGR8888 \
fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */
#define DRM_FORMAT_RGBA8888 \
fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */
#define DRM_FORMAT_BGRA8888 \
fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */
#define DRM_FORMAT_XRGB2101010 \
fourcc_code('X', 'R', '3', \
'0') /* [31:0] x:R:G:B 2:10:10:10 little endian */
#define DRM_FORMAT_XBGR2101010 \
fourcc_code('X', 'B', '3', \
'0') /* [31:0] x:B:G:R 2:10:10:10 little endian */
#define DRM_FORMAT_RGBX1010102 \
fourcc_code('R', 'X', '3', \
'0') /* [31:0] R:G:B:x 10:10:10:2 little endian */
#define DRM_FORMAT_BGRX1010102 \
fourcc_code('B', 'X', '3', \
'0') /* [31:0] B:G:R:x 10:10:10:2 little endian */
#define DRM_FORMAT_ARGB2101010 \
fourcc_code('A', 'R', '3', \
'0') /* [31:0] A:R:G:B 2:10:10:10 little endian */
#define DRM_FORMAT_ABGR2101010 \
fourcc_code('A', 'B', '3', \
'0') /* [31:0] A:B:G:R 2:10:10:10 little endian */
#define DRM_FORMAT_RGBA1010102 \
fourcc_code('R', 'A', '3', \
'0') /* [31:0] R:G:B:A 10:10:10:2 little endian */
#define DRM_FORMAT_BGRA1010102 \
fourcc_code('B', 'A', '3', \
'0') /* [31:0] B:G:R:A 10:10:10:2 little endian */
/*
* Floating point 64bpp RGB
* IEEE 754-2008 binary16 half-precision float
* [15:0] sign:exponent:mantissa 1:5:10
*/
#define DRM_FORMAT_XRGB16161616F \
fourcc_code('X', 'R', '4', \
'H') /* [63:0] x:R:G:B 16:16:16:16 little endian */
#define DRM_FORMAT_XBGR16161616F \
fourcc_code('X', 'B', '4', \
'H') /* [63:0] x:B:G:R 16:16:16:16 little endian */
#define DRM_FORMAT_ARGB16161616F \
fourcc_code('A', 'R', '4', \
'H') /* [63:0] A:R:G:B 16:16:16:16 little endian */
#define DRM_FORMAT_ABGR16161616F \
fourcc_code('A', 'B', '4', \
'H') /* [63:0] A:B:G:R 16:16:16:16 little endian */
/* packed YCbCr */
#define DRM_FORMAT_YUYV \
fourcc_code('Y', 'U', 'Y', \
'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
#define DRM_FORMAT_YVYU \
fourcc_code('Y', 'V', 'Y', \
'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */
#define DRM_FORMAT_UYVY \
fourcc_code('U', 'Y', 'V', \
'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */
#define DRM_FORMAT_VYUY \
fourcc_code('V', 'Y', 'U', \
'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
#define DRM_FORMAT_AYUV \
fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian \
*/
#define DRM_FORMAT_XYUV8888 \
fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian \
*/
#define DRM_FORMAT_VUY888 \
fourcc_code('V', 'U', '2', '4') /* [23:0] Cr:Cb:Y 8:8:8 little endian */
#define DRM_FORMAT_VUY101010 \
fourcc_code( \
'V', 'U', '3', \
'0') /* Y followed by U then V, 10:10:10. Non-linear modifier only */
/*
* packed Y2xx indicate for each component, xx valid data occupy msb
* 16-xx padding occupy lsb
*/
#define DRM_FORMAT_Y210 \
fourcc_code('Y', '2', '1', \
'0') /* [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 \
little endian per 2 Y pixels */
#define DRM_FORMAT_Y212 \
fourcc_code('Y', '2', '1', \
'2') /* [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 12:4:12:4:12:4:12:4 \
little endian per 2 Y pixels */
#define DRM_FORMAT_Y216 \
fourcc_code('Y', '2', '1', '6') /* [63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little \
endian per 2 Y pixels */
/*
* packed Y4xx indicate for each component, xx valid data occupy msb
* 16-xx padding occupy lsb except Y410
*/
#define DRM_FORMAT_Y410 \
fourcc_code('Y', '4', '1', \
'0') /* [31:0] A:Cr:Y:Cb 2:10:10:10 little endian */
#define DRM_FORMAT_Y412 \
fourcc_code( \
'Y', '4', '1', \
'2') /* [63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian */
#define DRM_FORMAT_Y416 \
fourcc_code('Y', '4', '1', \
'6') /* [63:0] A:Cr:Y:Cb 16:16:16:16 little endian */
#define DRM_FORMAT_XVYU2101010 \
fourcc_code('X', 'V', '3', \
'0') /* [31:0] X:Cr:Y:Cb 2:10:10:10 little endian */
#define DRM_FORMAT_XVYU12_16161616 \
fourcc_code( \
'X', 'V', '3', \
'6') /* [63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian */
#define DRM_FORMAT_XVYU16161616 \
fourcc_code('X', 'V', '4', \
'8') /* [63:0] X:Cr:Y:Cb 16:16:16:16 little endian */
/*
* packed YCbCr420 2x2 tiled formats
* first 64 bits will contain Y,Cb,Cr components for a 2x2 tile
*/
/* [63:0] A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0
* 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */
#define DRM_FORMAT_Y0L0 fourcc_code('Y', '0', 'L', '0')
/* [63:0] X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0
* 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */
#define DRM_FORMAT_X0L0 fourcc_code('X', '0', 'L', '0')
/* [63:0] A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little
* endian */
#define DRM_FORMAT_Y0L2 fourcc_code('Y', '0', 'L', '2')
/* [63:0] X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little
* endian */
#define DRM_FORMAT_X0L2 fourcc_code('X', '0', 'L', '2')
/*
* 1-plane YUV 4:2:0
* In these formats, the component ordering is specified (Y, followed by U
* then V), but the exact Linear layout is undefined.
* These formats can only be used with a non-Linear modifier.
*/
#define DRM_FORMAT_YUV420_8BIT fourcc_code('Y', 'U', '0', '8')
#define DRM_FORMAT_YUV420_10BIT fourcc_code('Y', 'U', '1', '0')
/*
* 2 plane RGB + A
* index 0 = RGB plane, same format as the corresponding non _A8 format has
* index 1 = A plane, [7:0] A
*/
#define DRM_FORMAT_XRGB8888_A8 fourcc_code('X', 'R', 'A', '8')
#define DRM_FORMAT_XBGR8888_A8 fourcc_code('X', 'B', 'A', '8')
#define DRM_FORMAT_RGBX8888_A8 fourcc_code('R', 'X', 'A', '8')
#define DRM_FORMAT_BGRX8888_A8 fourcc_code('B', 'X', 'A', '8')
#define DRM_FORMAT_RGB888_A8 fourcc_code('R', '8', 'A', '8')
#define DRM_FORMAT_BGR888_A8 fourcc_code('B', '8', 'A', '8')
#define DRM_FORMAT_RGB565_A8 fourcc_code('R', '5', 'A', '8')
#define DRM_FORMAT_BGR565_A8 fourcc_code('B', '5', 'A', '8')
/*
* 2 plane YCbCr
* index 0 = Y plane, [7:0] Y
* index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
* or
* index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
*/
#define DRM_FORMAT_NV12 \
fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */
#define DRM_FORMAT_NV21 \
fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */
#define DRM_FORMAT_NV16 \
fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */
#define DRM_FORMAT_NV61 \
fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */
#define DRM_FORMAT_NV24 \
fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */
#define DRM_FORMAT_NV42 \
fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
/*
* 2 plane YCbCr MSB aligned
* index 0 = Y plane, [15:0] Y:x [10:6] little endian
* index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian
*/
#define DRM_FORMAT_P210 \
fourcc_code('P', '2', '1', \
'0') /* 2x1 subsampled Cr:Cb plane, 10 bit per channel */
/*
* 2 plane YCbCr MSB aligned
* index 0 = Y plane, [15:0] Y:x [10:6] little endian
* index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian
*/
#define DRM_FORMAT_P010 \
fourcc_code('P', '0', '1', \
'0') /* 2x2 subsampled Cr:Cb plane 10 bits per channel */
/*
* 2 plane YCbCr MSB aligned
* index 0 = Y plane, [15:0] Y:x [12:4] little endian
* index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [12:4:12:4] little endian
*/
#define DRM_FORMAT_P012 \
fourcc_code('P', '0', '1', \
'2') /* 2x2 subsampled Cr:Cb plane 12 bits per channel */
/*
* 2 plane YCbCr MSB aligned
* index 0 = Y plane, [15:0] Y little endian
* index 1 = Cr:Cb plane, [31:0] Cr:Cb [16:16] little endian
*/
#define DRM_FORMAT_P016 \
fourcc_code('P', '0', '1', \
'6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
/*
* 3 plane YCbCr
* index 0: Y plane, [7:0] Y
* index 1: Cb plane, [7:0] Cb
* index 2: Cr plane, [7:0] Cr
* or
* index 1: Cr plane, [7:0] Cr
* index 2: Cb plane, [7:0] Cb
*/
#define DRM_FORMAT_YUV410 \
fourcc_code('Y', 'U', 'V', \
'9') /* 4x4 subsampled Cb (1) and Cr (2) planes */
#define DRM_FORMAT_YVU410 \
fourcc_code('Y', 'V', 'U', \
'9') /* 4x4 subsampled Cr (1) and Cb (2) planes */
#define DRM_FORMAT_YUV411 \
fourcc_code('Y', 'U', '1', \
'1') /* 4x1 subsampled Cb (1) and Cr (2) planes */
#define DRM_FORMAT_YVU411 \
fourcc_code('Y', 'V', '1', \
'1') /* 4x1 subsampled Cr (1) and Cb (2) planes */
#define DRM_FORMAT_YUV420 \
fourcc_code('Y', 'U', '1', \
'2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
#define DRM_FORMAT_YVU420 \
fourcc_code('Y', 'V', '1', \
'2') /* 2x2 subsampled Cr (1) and Cb (2) planes */
#define DRM_FORMAT_YUV422 \
fourcc_code('Y', 'U', '1', \
'6') /* 2x1 subsampled Cb (1) and Cr (2) planes */
#define DRM_FORMAT_YVU422 \
fourcc_code('Y', 'V', '1', \
'6') /* 2x1 subsampled Cr (1) and Cb (2) planes */
#define DRM_FORMAT_YUV444 \
fourcc_code('Y', 'U', '2', \
'4') /* non-subsampled Cb (1) and Cr (2) planes */
#define DRM_FORMAT_YVU444 \
fourcc_code('Y', 'V', '2', \
'4') /* non-subsampled Cr (1) and Cb (2) planes */
/*
* Format Modifiers:
*
* Format modifiers describe, typically, a re-ordering or modification
* of the data in a plane of an FB. This can be used to express tiled/
* swizzled formats, or compression, or a combination of the two.
*
* The upper 8 bits of the format modifier are a vendor-id as assigned
* below. The lower 56 bits are assigned as vendor sees fit.
*/
/* Vendor Ids: */
#define DRM_FORMAT_MOD_NONE 0
#define DRM_FORMAT_MOD_VENDOR_NONE 0
#define DRM_FORMAT_MOD_VENDOR_INTEL 0x01
#define DRM_FORMAT_MOD_VENDOR_AMD 0x02
#define DRM_FORMAT_MOD_VENDOR_NVIDIA 0x03
#define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04
#define DRM_FORMAT_MOD_VENDOR_QCOM 0x05
#define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06
#define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07
#define DRM_FORMAT_MOD_VENDOR_ARM 0x08
#define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09
/* add more to the end as needed */
#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1)
#define fourcc_mod_code(vendor, val) \
((((__u64)DRM_FORMAT_MOD_VENDOR_##vendor) << 56) | \
((val)&0x00ffffffffffffffULL))
/*
* Format Modifier tokens:
*
* When adding a new token please document the layout with a code comment,
* similar to the fourcc codes above. drm_fourcc.h is considered the
* authoritative source for all of these.
*/
/*
* Invalid Modifier
*
* This modifier can be used as a sentinel to terminate the format modifiers
* list, or to initialize a variable with an invalid modifier. It might also be
* used to report an error back to userspace for certain APIs.
*/
#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED)
/*
* Linear Layout
*
* Just plain linear layout. Note that this is different from no specifying any
* modifier (e.g. not setting DRM_MODE_FB_MODIFIERS in the DRM_ADDFB2 ioctl),
* which tells the driver to also take driver-internal information into account
* and so might actually result in a tiled framebuffer.
*/
#define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0)
/* Intel framebuffer modifiers */
/*
* Intel X-tiling layout
*
* This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb)
* in row-major layout. Within the tile bytes are laid out row-major, with
* a platform-dependent stride. On top of that the memory can apply
* platform-depending swizzling of some higher address bits into bit6.
*
* This format is highly platforms specific and not useful for cross-driver
* sharing. It exists since on a given platform it does uniquely identify the
* layout in a simple way for i915-specific userspace.
*/
#define I915_FORMAT_MOD_X_TILED fourcc_mod_code(INTEL, 1)
/*
* Intel Y-tiling layout
*
* This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb)
* in row-major layout. Within the tile bytes are laid out in OWORD (16 bytes)
* chunks column-major, with a platform-dependent height. On top of that the
* memory can apply platform-depending swizzling of some higher address bits
* into bit6.
*
* This format is highly platforms specific and not useful for cross-driver
* sharing. It exists since on a given platform it does uniquely identify the
* layout in a simple way for i915-specific userspace.
*/
#define I915_FORMAT_MOD_Y_TILED fourcc_mod_code(INTEL, 2)
/*
* Intel Yf-tiling layout
*
* This is a tiled layout using 4Kb tiles in row-major layout.
* Within the tile pixels are laid out in 16 256 byte units / sub-tiles which
* are arranged in four groups (two wide, two high) with column-major layout.
* Each group therefore consits out of four 256 byte units, which are also laid
* out as 2x2 column-major.
* 256 byte units are made out of four 64 byte blocks of pixels, producing
* either a square block or a 2:1 unit.
* 64 byte blocks of pixels contain four pixel rows of 16 bytes, where the width
* in pixel depends on the pixel depth.
*/
#define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3)
/*
* Intel color control surface (CCS) for render compression
*
* The framebuffer format must be one of the 8:8:8:8 RGB formats.
* The main surface will be plane index 0 and must be Y/Yf-tiled,
* the CCS will be plane index 1.
*
* Each CCS tile matches a 1024x512 pixel area of the main surface.
* To match certain aspects of the 3D hardware the CCS is
* considered to be made up of normal 128Bx32 Y tiles, Thus
* the CCS pitch must be specified in multiples of 128 bytes.
*
* In reality the CCS tile appears to be a 64Bx64 Y tile, composed
* of QWORD (8 bytes) chunks instead of OWORD (16 bytes) chunks.
* But that fact is not relevant unless the memory is accessed
* directly.
*/
#define I915_FORMAT_MOD_Y_TILED_CCS fourcc_mod_code(INTEL, 4)
#define I915_FORMAT_MOD_Yf_TILED_CCS fourcc_mod_code(INTEL, 5)
/*
* Intel color control surfaces (CCS) for Gen-12 render compression.
*
* The main surface is Y-tiled and at plane index 0, the CCS is linear and
* at index 1. A 64B CCS cache line corresponds to an area of 4x1 tiles in
* main surface. In other words, 4 bits in CCS map to a main surface cache
* line pair. The main surface pitch is required to be a multiple of four
* Y-tile widths.
*/
#define I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS fourcc_mod_code(INTEL, 6)
/*
* Intel color control surfaces (CCS) for Gen-12 media compression
*
* The main surface is Y-tiled and at plane index 0, the CCS is linear and
* at index 1. A 64B CCS cache line corresponds to an area of 4x1 tiles in
* main surface. In other words, 4 bits in CCS map to a main surface cache
* line pair. The main surface pitch is required to be a multiple of four
* Y-tile widths. For semi-planar formats like NV12, CCS planes follow the
* Y and UV planes i.e., planes 0 and 1 are used for Y and UV surfaces,
* planes 2 and 3 for the respective CCS.
*/
#define I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS fourcc_mod_code(INTEL, 7)
/*
* Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks
*
* Macroblocks are laid in a Z-shape, and each pixel data is following the
* standard NV12 style.
* As for NV12, an image is the result of two frame buffers: one for Y,
* one for the interleaved Cb/Cr components (1/2 the height of the Y buffer).
* Alignment requirements are (for each buffer):
* - multiple of 128 pixels for the width
* - multiple of 32 pixels for the height
*
* For more information: see
* https://linuxtv.org/downloads/v4l-dvb-apis/re32.html
*/
#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
/*
* Tiled, 16 (pixels) x 16 (lines) - sized macroblocks
*
* This is a simple tiled layout using tiles of 16x16 pixels in a row-major
* layout. For YCbCr formats Cb/Cr components are taken in such a way that
* they correspond to their 16x16 luma block.
*/
#define DRM_FORMAT_MOD_SAMSUNG_16_16_TILE fourcc_mod_code(SAMSUNG, 2)
/*
* Qualcomm Compressed Format
*
* Refers to a compressed variant of the base format that is compressed.
* Implementation may be platform and base-format specific.
*
* Each macrotile consists of m x n (mostly 4 x 4) tiles.
* Pixel data pitch/stride is aligned with macrotile width.
* Pixel data height is aligned with macrotile height.
* Entire pixel data buffer is aligned with 4k(bytes).
*/
#define DRM_FORMAT_MOD_QCOM_COMPRESSED fourcc_mod_code(QCOM, 1)
/* Vivante framebuffer modifiers */
/*
* Vivante 4x4 tiling layout
*
* This is a simple tiled layout using tiles of 4x4 pixels in a row-major
* layout.
*/
#define DRM_FORMAT_MOD_VIVANTE_TILED fourcc_mod_code(VIVANTE, 1)
/*
* Vivante 64x64 super-tiling layout
*
* This is a tiled layout using 64x64 pixel super-tiles, where each super-tile
* contains 8x4 groups of 2x4 tiles of 4x4 pixels (like above) each, all in row-
* major layout.
*
* For more information: see
* https://github.com/etnaviv/etna_viv/blob/master/doc/hardware.md#texture-tiling
*/
#define DRM_FORMAT_MOD_VIVANTE_SUPER_TILED fourcc_mod_code(VIVANTE, 2)
/*
* Vivante 4x4 tiling layout for dual-pipe
*
* Same as the 4x4 tiling layout, except every second 4x4 pixel tile starts at a
* different base address. Offsets from the base addresses are therefore halved
* compared to the non-split tiled layout.
*/
#define DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED fourcc_mod_code(VIVANTE, 3)
/*
* Vivante 64x64 super-tiling layout for dual-pipe
*
* Same as the 64x64 super-tiling layout, except every second 4x4 pixel tile
* starts at a different base address. Offsets from the base addresses are
* therefore halved compared to the non-split super-tiled layout.
*/
#define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4)
/* NVIDIA frame buffer modifiers */
/*
* Tegra Tiled Layout, used by Tegra 2, 3 and 4.
*
* Pixels are arranged in simple tiles of 16 x 16 bytes.
*/
#define DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED fourcc_mod_code(NVIDIA, 1)
/*
* 16Bx2 Block Linear layout, used by desktop GPUs, and Tegra K1 and later
*
* Pixels are arranged in 64x8 Groups Of Bytes (GOBs). GOBs are then stacked
* vertically by a power of 2 (1 to 32 GOBs) to form a block.
*
* Within a GOB, data is ordered as 16B x 2 lines sectors laid in Z-shape.
*
* Parameter 'v' is the log2 encoding of the number of GOBs stacked vertically.
* Valid values are:
*
* 0 == ONE_GOB
* 1 == TWO_GOBS
* 2 == FOUR_GOBS
* 3 == EIGHT_GOBS
* 4 == SIXTEEN_GOBS
* 5 == THIRTYTWO_GOBS
*
* Chapter 20 "Pixel Memory Formats" of the Tegra X1 TRM describes this format
* in full detail.
*/
#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(v) \
fourcc_mod_code(NVIDIA, 0x10 | ((v)&0xf))
#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB fourcc_mod_code(NVIDIA, 0x10)
#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB fourcc_mod_code(NVIDIA, 0x11)
#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB fourcc_mod_code(NVIDIA, 0x12)
#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB \
fourcc_mod_code(NVIDIA, 0x13)
#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB \
fourcc_mod_code(NVIDIA, 0x14)
#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB \
fourcc_mod_code(NVIDIA, 0x15)
/*
* Some Broadcom modifiers take parameters, for example the number of
* vertical lines in the image. Reserve the lower 32 bits for modifier
* type, and the next 24 bits for parameters. Top 8 bits are the
* vendor code.
*/
#define __fourcc_mod_broadcom_param_shift 8
#define __fourcc_mod_broadcom_param_bits 48
#define fourcc_mod_broadcom_code(val, params) \
fourcc_mod_code( \
BROADCOM, \
((((__u64)params) << __fourcc_mod_broadcom_param_shift) | val))
#define fourcc_mod_broadcom_param(m) \
((int)(((m) >> __fourcc_mod_broadcom_param_shift) & \
((1ULL << __fourcc_mod_broadcom_param_bits) - 1)))
#define fourcc_mod_broadcom_mod(m) \
((m) & ~(((1ULL << __fourcc_mod_broadcom_param_bits) - 1) \
<< __fourcc_mod_broadcom_param_shift))
/*
* Broadcom VC4 "T" format
*
* This is the primary layout that the V3D GPU can texture from (it
* can't do linear). The T format has:
*
* - 64b utiles of pixels in a raster-order grid according to cpp. It's 4x4
* pixels at 32 bit depth.
*
* - 1k subtiles made of a 4x4 raster-order grid of 64b utiles (so usually
* 16x16 pixels).
*
* - 4k tiles made of a 2x2 grid of 1k subtiles (so usually 32x32 pixels). On
* even 4k tile rows, they're arranged as (BL, TL, TR, BR), and on odd rows
* they're (TR, BR, BL, TL), where bottom left is start of memory.
*
* - an image made of 4k tiles in rows either left-to-right (even rows of 4k
* tiles) or right-to-left (odd rows of 4k tiles).
*/
#define DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED fourcc_mod_code(BROADCOM, 1)
/*
* Broadcom SAND format
*
* This is the native format that the H.264 codec block uses. For VC4
* HVS, it is only valid for H.264 (NV12/21) and RGBA modes.
*
* The image can be considered to be split into columns, and the
* columns are placed consecutively into memory. The width of those
* columns can be either 32, 64, 128, or 256 pixels, but in practice
* only 128 pixel columns are used.
*
* The pitch between the start of each column is set to optimally
* switch between SDRAM banks. This is passed as the number of lines
* of column width in the modifier (we can't use the stride value due
* to various core checks that look at it , so you should set the
* stride to width*cpp).
*
* Note that the column height for this format modifier is the same
* for all of the planes, assuming that each column contains both Y
* and UV. Some SAND-using hardware stores UV in a separate tiled
* image from Y to reduce the column height, which is not supported
* with these modifiers.
*/
#define DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT(v) \
fourcc_mod_broadcom_code(2, v)
#define DRM_FORMAT_MOD_BROADCOM_SAND64_COL_HEIGHT(v) \
fourcc_mod_broadcom_code(3, v)
#define DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(v) \
fourcc_mod_broadcom_code(4, v)
#define DRM_FORMAT_MOD_BROADCOM_SAND256_COL_HEIGHT(v) \
fourcc_mod_broadcom_code(5, v)
#define DRM_FORMAT_MOD_BROADCOM_SAND32 \
DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT(0)
#define DRM_FORMAT_MOD_BROADCOM_SAND64 \
DRM_FORMAT_MOD_BROADCOM_SAND64_COL_HEIGHT(0)
#define DRM_FORMAT_MOD_BROADCOM_SAND128 \
DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(0)
#define DRM_FORMAT_MOD_BROADCOM_SAND256 \
DRM_FORMAT_MOD_BROADCOM_SAND256_COL_HEIGHT(0)
/* Broadcom UIF format
*
* This is the common format for the current Broadcom multimedia
* blocks, including V3D 3.x and newer, newer video codecs, and
* displays.
*
* The image consists of utiles (64b blocks), UIF blocks (2x2 utiles),
* and macroblocks (4x4 UIF blocks). Those 4x4 UIF block groups are
* stored in columns, with padding between the columns to ensure that
* moving from one column to the next doesn't hit the same SDRAM page
* bank.
*
* To calculate the padding, it is assumed that each hardware block
* and the software driving it knows the platform's SDRAM page size,
* number of banks, and XOR address, and that it's identical between
* all blocks using the format. This tiling modifier will use XOR as
* necessary to reduce the padding. If a hardware block can't do XOR,
* the assumption is that a no-XOR tiling modifier will be created.
*/
#define DRM_FORMAT_MOD_BROADCOM_UIF fourcc_mod_code(BROADCOM, 6)
/*
* Arm Framebuffer Compression (AFBC) modifiers
*
* AFBC is a proprietary lossless image compression protocol and format.
* It provides fine-grained random access and minimizes the amount of data
* transferred between IP blocks.
*
* AFBC has several features which may be supported and/or used, which are
* represented using bits in the modifier. Not all combinations are valid,
* and different devices or use-cases may support different combinations.
*
* Further information on the use of AFBC modifiers can be found in
* Documentation/gpu/afbc.rst
*/
/*
* The top 4 bits (out of the 56 bits alloted for specifying vendor specific
* modifiers) denote the category for modifiers. Currently we have only two
* categories of modifiers ie AFBC and MISC. We can have a maximum of sixteen
* different categories.
*/
#define DRM_FORMAT_MOD_ARM_CODE(__type, __val) \
fourcc_mod_code(ARM, \
((__u64)(__type) << 52) | ((__val)&0x000fffffffffffffULL))
#define DRM_FORMAT_MOD_ARM_TYPE_AFBC 0x00
#define DRM_FORMAT_MOD_ARM_TYPE_MISC 0x01
#define DRM_FORMAT_MOD_ARM_AFBC(__afbc_mode) \
DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_AFBC, __afbc_mode)
/*
* AFBC superblock size
*
* Indicates the superblock size(s) used for the AFBC buffer. The buffer
* size (in pixels) must be aligned to a multiple of the superblock size.
* Four lowest significant bits(LSBs) are reserved for block size.
*
* Where one superblock size is specified, it applies to all planes of the
* buffer (e.g. 16x16, 32x8). When multiple superblock sizes are specified,
* the first applies to the Luma plane and the second applies to the Chroma
* plane(s). e.g. (32x8_64x4 means 32x8 Luma, with 64x4 Chroma).
* Multiple superblock sizes are only valid for multi-plane YCbCr formats.
*/
#define AFBC_FORMAT_MOD_BLOCK_SIZE_MASK 0xf
#define AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 (1ULL)
#define AFBC_FORMAT_MOD_BLOCK_SIZE_32x8 (2ULL)
#define AFBC_FORMAT_MOD_BLOCK_SIZE_64x4 (3ULL)
#define AFBC_FORMAT_MOD_BLOCK_SIZE_32x8_64x4 (4ULL)
/*
* AFBC lossless colorspace transform
*
* Indicates that the buffer makes use of the AFBC lossless colorspace
* transform.
*/
#define AFBC_FORMAT_MOD_YTR (1ULL << 4)
/*
* AFBC block-split
*
* Indicates that the payload of each superblock is split. The second
* half of the payload is positioned at a predefined offset from the start
* of the superblock payload.
*/
#define AFBC_FORMAT_MOD_SPLIT (1ULL << 5)
/*
* AFBC sparse layout
*
* This flag indicates that the payload of each superblock must be stored at a
* predefined position relative to the other superblocks in the same AFBC
* buffer. This order is the same order used by the header buffer. In this mode
* each superblock is given the same amount of space as an uncompressed
* superblock of the particular format would require, rounding up to the next
* multiple of 128 bytes in size.
*/
#define AFBC_FORMAT_MOD_SPARSE (1ULL << 6)
/*
* AFBC copy-block restrict
*
* Buffers with this flag must obey the copy-block restriction. The restriction
* is such that there are no copy-blocks referring across the border of 8x8
* blocks. For the subsampled data the 8x8 limitation is also subsampled.
*/
#define AFBC_FORMAT_MOD_CBR (1ULL << 7)
/*
* AFBC tiled layout
*
* The tiled layout groups superblocks in 8x8 or 4x4 tiles, where all
* superblocks inside a tile are stored together in memory. 8x8 tiles are used
* for pixel formats up to and including 32 bpp while 4x4 tiles are used for
* larger bpp formats. The order between the tiles is scan line.
* When the tiled layout is used, the buffer size (in pixels) must be aligned
* to the tile size.
*/
#define AFBC_FORMAT_MOD_TILED (1ULL << 8)
/*
* AFBC solid color blocks
*
* Indicates that the buffer makes use of solid-color blocks, whereby bandwidth
* can be reduced if a whole superblock is a single color.
*/
#define AFBC_FORMAT_MOD_SC (1ULL << 9)
/*
* AFBC double-buffer
*
* Indicates that the buffer is allocated in a layout safe for front-buffer
* rendering.
*/
#define AFBC_FORMAT_MOD_DB (1ULL << 10)
/*
* AFBC buffer content hints
*
* Indicates that the buffer includes per-superblock content hints.
*/
#define AFBC_FORMAT_MOD_BCH (1ULL << 11)
/*
* Arm 16x16 Block U-Interleaved modifier
*
* This is used by Arm Mali Utgard and Midgard GPUs. It divides the image
* into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels
* in the block are reordered.
*/
#define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \
DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 1ULL)
/*
* Allwinner tiled modifier
*
* This tiling mode is implemented by the VPU found on all Allwinner platforms,
* codenamed sunxi. It is associated with a YUV format that uses either 2 or 3
* planes.
*
* With this tiling, the luminance samples are disposed in tiles representing
* 32x32 pixels and the chrominance samples in tiles representing 32x64 pixels.
* The pixel order in each tile is linear and the tiles are disposed linearly,
* both in row-major order.
*/
#define DRM_FORMAT_MOD_ALLWINNER_TILED fourcc_mod_code(ALLWINNER, 1)
#if defined(__cplusplus)
}
#endif
#endif /* DRM_FOURCC_H */
| Jimx-/lyos | include/uapi/drm/drm_fourcc.h | C | gpl-3.0 | 37,128 | [
30522,
1013,
1008,
1008,
9385,
2249,
13420,
3840,
1008,
1008,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
1010,
2000,
2151,
2711,
11381,
1037,
1008,
6100,
1997,
2023,
4007,
1998,
3378,
12653,
6764,
1006,
1996,
1000,
4007,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.