text
stringlengths 2
100k
| meta
dict |
---|---|
<Scene xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="WaveEngine.Framework.Models">
<Id>ca1e2372-d6d6-46d2-b894-6ae25ffff02f</Id>
<Entities xmlns:d2p1="WaveEngine.Framework.Models.Entities">
<d2p1:BaseEntityModel i:type="d2p1:EntityModel">
<d2p1:SerializeChildrens />
<d2p1:isDisabled>false</d2p1:isDisabled>
<d2p1:isStatic>false</d2p1:isStatic>
<d2p1:isVisible>true</d2p1:isVisible>
<d2p1:name>defaultCamera3D</d2p1:name>
<d2p1:tag></d2p1:tag>
<d2p1:SerializeComponents xmlns:d4p1="WaveEngine.Framework">
<d4p1:Component xmlns:d5p1="WaveEngine.Framework.Graphics" i:type="d5p1:Transform3D">
<d5p1:LocalOrientation xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:W>-4.1827672E-08</d6p1:W>
<d6p1:X>3.85388965E-08</d6p1:X>
<d6p1:Y>-0.9894616</d6p1:Y>
<d6p1:Z>-0.144802615</d6p1:Z>
</d5p1:LocalOrientation>
<d5p1:LocalPosition xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>0</d6p1:X>
<d6p1:Y>0.3207251</d6p1:Y>
<d6p1:Z>-0.6386699</d6p1:Z>
</d5p1:LocalPosition>
<d5p1:LocalScale xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>1</d6p1:X>
<d6p1:Y>1</d6p1:Y>
<d6p1:Z>1</d6p1:Z>
</d5p1:LocalScale>
</d4p1:Component>
<d4p1:Component xmlns:d5p1="WaveEngine.Framework.Graphics" i:type="d5p1:Camera3D">
<d5p1:BackgroundColor xmlns:d6p1="WaveEngine.Common.Graphics">
<d6p1:A>255</d6p1:A>
<d6p1:B>210</d6p1:B>
<d6p1:G>203</d6p1:G>
<d6p1:R>199</d6p1:R>
</d5p1:BackgroundColor>
<d5p1:CameraOrder>0</d5p1:CameraOrder>
<d5p1:ClearFlags>All</d5p1:ClearFlags>
<d5p1:FarPlane>1000</d5p1:FarPlane>
<d5p1:FieldOfView>0.7853982</d5p1:FieldOfView>
<d5p1:IsActive>true</d5p1:IsActive>
<d5p1:LayerMaskDefaultValue>true</d5p1:LayerMaskDefaultValue>
<d5p1:NearPlane>0.1</d5p1:NearPlane>
<d5p1:UpVector xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>0</d6p1:X>
<d6p1:Y>1</d6p1:Y>
<d6p1:Z>0</d6p1:Z>
</d5p1:UpVector>
<d5p1:Viewport xmlns:d6p1="WaveEngine.Common.Graphics">
<d6p1:Height>1</d6p1:Height>
<d6p1:MaxDepth>1</d6p1:MaxDepth>
<d6p1:MinDepth>0</d6p1:MinDepth>
<d6p1:Width>1</d6p1:Width>
<d6p1:X>0</d6p1:X>
<d6p1:Y>0</d6p1:Y>
</d5p1:Viewport>
<d5p1:AspectRatio>1.66557372</d5p1:AspectRatio>
</d4p1:Component>
<d4p1:Component xmlns:d5p1="WaveEngine.Framework.Sound" i:type="d5p1:SoundListener3D">
<d4p1:UpdateOrder>0.5</d4p1:UpdateOrder>
<d4p1:isDisabled>false</d4p1:isDisabled>
</d4p1:Component>
</d2p1:SerializeComponents>
</d2p1:BaseEntityModel>
<d2p1:BaseEntityModel i:type="d2p1:EntityModel">
<d2p1:SerializeChildrens />
<d2p1:isDisabled>false</d2p1:isDisabled>
<d2p1:isStatic>false</d2p1:isStatic>
<d2p1:isVisible>true</d2p1:isVisible>
<d2p1:name>defaultLight</d2p1:name>
<d2p1:tag></d2p1:tag>
<d2p1:SerializeComponents xmlns:d4p1="WaveEngine.Framework">
<d4p1:Component xmlns:d5p1="WaveEngine.Framework.Graphics" i:type="d5p1:Transform3D">
<d5p1:LocalOrientation xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:W>0.479743779</d6p1:W>
<d6p1:X>-0.30187723</d6p1:X>
<d6p1:Y>-0.805398345</d6p1:Y>
<d6p1:Z>0.173349857</d6p1:Z>
</d5p1:LocalOrientation>
<d5p1:LocalPosition xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>1.44802308</d6p1:X>
<d6p1:Y>1.30088139</d6p1:Y>
<d6p1:Z>-1.29457772</d6p1:Z>
</d5p1:LocalPosition>
<d5p1:LocalScale xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>1</d6p1:X>
<d6p1:Y>1</d6p1:Y>
<d6p1:Z>1</d6p1:Z>
</d5p1:LocalScale>
</d4p1:Component>
<d4p1:Component xmlns:d5p1="WaveEngine.Framework.Graphics" i:type="d5p1:DirectionalLightProperties">
<d5p1:Color xmlns:d6p1="WaveEngine.Common.Graphics">
<d6p1:A>255</d6p1:A>
<d6p1:B>255</d6p1:B>
<d6p1:G>255</d6p1:G>
<d6p1:R>255</d6p1:R>
</d5p1:Color>
<d5p1:Intensity>0.7</d5p1:Intensity>
<d5p1:isLightDisabled>false</d5p1:isLightDisabled>
</d4p1:Component>
<d4p1:Component xmlns:d5p1="WaveEngine.Framework.Graphics" i:type="d5p1:DirectionalLightRenderer">
<d4p1:IsVisible>true</d4p1:IsVisible>
<d5p1:FrustumCullingEnabled>true</d5p1:FrustumCullingEnabled>
</d4p1:Component>
</d2p1:SerializeComponents>
</d2p1:BaseEntityModel>
<d2p1:BaseEntityModel i:type="d2p1:EntityModel">
<d2p1:SerializeChildrens />
<d2p1:isDisabled>false</d2p1:isDisabled>
<d2p1:isStatic>false</d2p1:isStatic>
<d2p1:isVisible>true</d2p1:isVisible>
<d2p1:name>LeapMotion</d2p1:name>
<d2p1:tag></d2p1:tag>
<d2p1:SerializeComponents xmlns:d4p1="WaveEngine.Framework">
<d4p1:Component xmlns:d5p1="WaveEngine.Framework.Graphics" i:type="d5p1:Transform3D">
<d5p1:LocalOrientation xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:W>1</d6p1:W>
<d6p1:X>0</d6p1:X>
<d6p1:Y>0</d6p1:Y>
<d6p1:Z>0</d6p1:Z>
</d5p1:LocalOrientation>
<d5p1:LocalPosition xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>1.80137444</d6p1:X>
<d6p1:Y>1.41281557</d6p1:Y>
<d6p1:Z>-1.57508862</d6p1:Z>
</d5p1:LocalPosition>
<d5p1:LocalScale xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>1</d6p1:X>
<d6p1:Y>1</d6p1:Y>
<d6p1:Z>1</d6p1:Z>
</d5p1:LocalScale>
</d4p1:Component>
<d4p1:Component xmlns:d5p1="http://schemas.datacontract.org/2004/07/LeapMotionSample" i:type="d5p1:LeapMotionDrawable">
<d4p1:IsVisible>true</d4p1:IsVisible>
<FrustumCullingEnabled xmlns="WaveEngine.Framework.Graphics">true</FrustumCullingEnabled>
</d4p1:Component>
</d2p1:SerializeComponents>
</d2p1:BaseEntityModel>
<d2p1:BaseEntityModel i:type="d2p1:EntityModel">
<d2p1:SerializeChildrens />
<d2p1:isDisabled>false</d2p1:isDisabled>
<d2p1:isStatic>false</d2p1:isStatic>
<d2p1:isVisible>true</d2p1:isVisible>
<d2p1:name>defaultCamera2D</d2p1:name>
<d2p1:tag></d2p1:tag>
<d2p1:SerializeComponents xmlns:d4p1="WaveEngine.Framework">
<d4p1:Component xmlns:d5p1="WaveEngine.Framework.Graphics" i:type="d5p1:Transform2D">
<d5p1:LocalOrientation xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:W>1</d6p1:W>
<d6p1:X>0</d6p1:X>
<d6p1:Y>0</d6p1:Y>
<d6p1:Z>0</d6p1:Z>
</d5p1:LocalOrientation>
<d5p1:LocalPosition xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>640</d6p1:X>
<d6p1:Y>360</d6p1:Y>
<d6p1:Z>10</d6p1:Z>
</d5p1:LocalPosition>
<d5p1:LocalScale xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>1</d6p1:X>
<d6p1:Y>1</d6p1:Y>
<d6p1:Z>1</d6p1:Z>
</d5p1:LocalScale>
<d5p1:Opacity>1</d5p1:Opacity>
<d5p1:Rectangle xmlns:d6p1="http://schemas.datacontract.org/2004/07/WaveEngine.Common.Math">
<d6p1:Height>0</d6p1:Height>
<d6p1:Width>0</d6p1:Width>
<d6p1:X>0</d6p1:X>
<d6p1:Y>0</d6p1:Y>
</d5p1:Rectangle>
<d5p1:effect>None</d5p1:effect>
<d5p1:origin xmlns:d6p1="http://schemas.datacontract.org/2004/07/WaveEngine.Common.Math">
<d6p1:X>0</d6p1:X>
<d6p1:Y>0</d6p1:Y>
</d5p1:origin>
<d5p1:screenPosition xmlns:d6p1="http://schemas.datacontract.org/2004/07/WaveEngine.Common.Math">
<d6p1:X>0</d6p1:X>
<d6p1:Y>0</d6p1:Y>
</d5p1:screenPosition>
<d5p1:transformMode>Standard</d5p1:transformMode>
</d4p1:Component>
<d4p1:Component xmlns:d5p1="WaveEngine.Framework.Graphics" i:type="d5p1:Camera2D">
<d5p1:BackgroundColor xmlns:d6p1="WaveEngine.Common.Graphics">
<d6p1:A>255</d6p1:A>
<d6p1:B>237</d6p1:B>
<d6p1:G>149</d6p1:G>
<d6p1:R>100</d6p1:R>
</d5p1:BackgroundColor>
<d5p1:CameraOrder>0</d5p1:CameraOrder>
<d5p1:ClearFlags>DepthAndStencil</d5p1:ClearFlags>
<d5p1:FarPlane>1000</d5p1:FarPlane>
<d5p1:FieldOfView>0</d5p1:FieldOfView>
<d5p1:IsActive>true</d5p1:IsActive>
<d5p1:LayerMaskDefaultValue>true</d5p1:LayerMaskDefaultValue>
<d5p1:NearPlane>-1000</d5p1:NearPlane>
<d5p1:UpVector xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>0</d6p1:X>
<d6p1:Y>1</d6p1:Y>
<d6p1:Z>0</d6p1:Z>
</d5p1:UpVector>
<d5p1:Viewport xmlns:d6p1="WaveEngine.Common.Graphics">
<d6p1:Height>1</d6p1:Height>
<d6p1:MaxDepth>1</d6p1:MaxDepth>
<d6p1:MinDepth>0</d6p1:MinDepth>
<d6p1:Width>1</d6p1:Width>
<d6p1:X>0</d6p1:X>
<d6p1:Y>0</d6p1:Y>
</d5p1:Viewport>
<d5p1:customVirtualScreen xmlns:d6p1="WaveEngine.Framework.Managers" i:nil="true" />
<d5p1:distance>0</d5p1:distance>
<d5p1:rotation>0</d5p1:rotation>
<d5p1:vanishingPoint xmlns:d6p1="http://schemas.datacontract.org/2004/07/WaveEngine.Common.Math">
<d6p1:X>0.5</d6p1:X>
<d6p1:Y>0.5</d6p1:Y>
</d5p1:vanishingPoint>
<d5p1:zoom xmlns:d6p1="http://schemas.datacontract.org/2004/07/WaveEngine.Common.Math">
<d6p1:X>1</d6p1:X>
<d6p1:Y>1</d6p1:Y>
</d5p1:zoom>
</d4p1:Component>
</d2p1:SerializeComponents>
</d2p1:BaseEntityModel>
<d2p1:BaseEntityModel i:type="d2p1:EntityModel">
<d2p1:SerializeChildrens />
<d2p1:isDisabled>false</d2p1:isDisabled>
<d2p1:isStatic>false</d2p1:isStatic>
<d2p1:isVisible>true</d2p1:isVisible>
<d2p1:name>floor</d2p1:name>
<d2p1:tag i:nil="true" />
<d2p1:SerializeComponents xmlns:d4p1="WaveEngine.Framework">
<d4p1:Component xmlns:d5p1="WaveEngine.Framework.Graphics" i:type="d5p1:Transform3D">
<d5p1:LocalOrientation xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:W>1</d6p1:W>
<d6p1:X>0</d6p1:X>
<d6p1:Y>0</d6p1:Y>
<d6p1:Z>0</d6p1:Z>
</d5p1:LocalOrientation>
<d5p1:LocalPosition xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>0</d6p1:X>
<d6p1:Y>0</d6p1:Y>
<d6p1:Z>0</d6p1:Z>
</d5p1:LocalPosition>
<d5p1:LocalScale xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>1</d6p1:X>
<d6p1:Y>1</d6p1:Y>
<d6p1:Z>1</d6p1:Z>
</d5p1:LocalScale>
</d4p1:Component>
<d4p1:Component xmlns:d5p1="http://schemas.datacontract.org/2004/07/WaveEngine.Components.Graphics3D" i:type="d5p1:MaterialComponent">
<d5p1:AsignedTo i:nil="true" />
<d5p1:MaterialPath>Content/Assets/BasicMat.wmat</d5p1:MaterialPath>
<d5p1:UseCopy>false</d5p1:UseCopy>
<d5p1:useDummyMaterial>false</d5p1:useDummyMaterial>
</d4p1:Component>
<d4p1:Component xmlns:d5p1="http://schemas.datacontract.org/2004/07/WaveEngine.Components.Graphics3D" i:type="d5p1:PlaneMesh">
<ModelMeshName xmlns="WaveEngine.Components.Graphics3D">Primitive</ModelMeshName>
<d5p1:Height>1</d5p1:Height>
<d5p1:Normal xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>0</d6p1:X>
<d6p1:Y>1</d6p1:Y>
<d6p1:Z>0</d6p1:Z>
</d5p1:Normal>
<d5p1:TwoSides>false</d5p1:TwoSides>
<d5p1:UVHorizontalFlip>false</d5p1:UVHorizontalFlip>
<d5p1:UVVerticalFlip>false</d5p1:UVVerticalFlip>
<d5p1:Width>1</d5p1:Width>
</d4p1:Component>
<d4p1:Component xmlns:d5p1="WaveEngine.Components.Graphics3D" i:type="d5p1:MeshRenderer">
<d4p1:IsVisible>true</d4p1:IsVisible>
<FrustumCullingEnabled xmlns="WaveEngine.Framework.Graphics">true</FrustumCullingEnabled>
</d4p1:Component>
</d2p1:SerializeComponents>
</d2p1:BaseEntityModel>
</Entities>
<EntityPointers xmlns:d2p1="http://schemas.datacontract.org/2004/07/WaveEngine.Framework.Models.Entities" />
<Settings xmlns:d2p1="WaveEngine.Framework.Models.Settings">
<d2p1:Categories xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfstringanyType>
<d3p1:Key>Physics</d3p1:Key>
<d3p1:Value xmlns:d5p1="WaveEngine.Framework.Models.Settings.Categories" i:type="d5p1:PhysicCategory">
<d5p1:AllowSleep>true</d5p1:AllowSleep>
<d5p1:Gravity2D xmlns:d6p1="http://schemas.datacontract.org/2004/07/WaveEngine.Common.Math">
<d6p1:X>0</d6p1:X>
<d6p1:Y>9.8</d6p1:Y>
</d5p1:Gravity2D>
<d5p1:Gravity3D xmlns:d6p1="WaveEngine.Common.Math">
<d6p1:X>0</d6p1:X>
<d6p1:Y>0</d6p1:Y>
<d6p1:Z>9.8</d6p1:Z>
</d5p1:Gravity3D>
</d3p1:Value>
</d3p1:KeyValueOfstringanyType>
<d3p1:KeyValueOfstringanyType>
<d3p1:Key>VirtualScreen</d3p1:Key>
<d3p1:Value xmlns:d5p1="WaveEngine.Framework.Managers" i:type="d5p1:VirtualScreenManager">
<d5p1:Enabled>false</d5p1:Enabled>
<d5p1:Expand>true</d5p1:Expand>
<d5p1:Stretch>Uniform</d5p1:Stretch>
<d5p1:VirtualHeight>610</d5p1:VirtualHeight>
<d5p1:VirtualWidth>1016</d5p1:VirtualWidth>
</d3p1:Value>
</d3p1:KeyValueOfstringanyType>
</d2p1:Categories>
</Settings>
</Scene>
|
{
"pile_set_name": "Github"
}
|
package com.alibaba.arthas.spring.endpoints;
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
/**
*
* @author hengyunabc 2020-06-24
*
*/
@ConditionalOnProperty(name = "spring.arthas.enabled", matchIfMissing = true)
public class ArthasEndPointAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@ConditionalOnAvailableEndpoint
public ArthasEndPoint arthasEndPoint() {
return new ArthasEndPoint();
}
}
|
{
"pile_set_name": "Github"
}
|
/*
Copyright The Kubernetes Authors.
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.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1beta1
|
{
"pile_set_name": "Github"
}
|
;
; File 'topol.top' was generated
; By user: carlo (501)
; On host: CarloMB
; At date: Sun May 14 17:04:23 2017
;
; This is a standalone topology file
;
; Created by:
; :-) GROMACS - gmx pdb2gmx, 2016.3 (-:
;
; Executable: /Users/carlo/Codes/gromacs-2016.3/exe/bin/gmx_mpi
; Data prefix: /Users/carlo/Codes/gromacs-2016.3/exe
; Working dir: /Users/carlo/Projects/Tests/tutorial
; Command line:
; gmx_mpi pdb2gmx -f spc216.gro
; Force field was read from the standard GROMACS share directory.
;
; Include forcefield parameters
#include "amber03.ff/forcefield.itp"
; Include water topology
#include "amber03.ff/tip3p.itp"
#ifdef POSRES_WATER
; Position restraint for each water oxygen
[ position_restraints ]
; i funct fcx fcy fcz
1 1 1000 1000 1000
#endif
; Include topology for ions
#include "amber03.ff/ions.itp"
[ system ]
; Name
TIP3PDIMER
[ molecules ]
; Compound #mols
SOL 2
|
{
"pile_set_name": "Github"
}
|
// Boost.Range library
//
// Copyright Neil Groves 2007. Use, modification and
// distribution is subject to 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)
//
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_ADAPTOR_STRIDED_HPP_INCLUDED
#define BOOST_RANGE_ADAPTOR_STRIDED_HPP_INCLUDED
#include <boost/range/adaptor/argument_fwd.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <iterator>
namespace boost
{
namespace range_detail
{
// strided_iterator for wrapping a forward traversal iterator
template<class BaseIterator, class Category>
class strided_iterator
: public iterator_adaptor<
strided_iterator<BaseIterator, Category>
, BaseIterator
, use_default
, boost::forward_traversal_tag
>
{
friend class ::boost::iterator_core_access;
typedef iterator_adaptor<
strided_iterator<BaseIterator, Category>
, BaseIterator
, use_default
, boost::forward_traversal_tag
> super_t;
public:
typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<BaseIterator>::difference_type difference_type;
typedef BaseIterator base_iterator;
strided_iterator()
: m_last()
, m_stride()
{
}
strided_iterator(base_iterator first, base_iterator it, base_iterator last, difference_type stride)
: super_t(it)
, m_last(last)
, m_stride(stride)
{
}
template<class OtherIterator>
strided_iterator(const strided_iterator<OtherIterator, Category>& other,
BOOST_DEDUCED_TYPENAME enable_if_convertible<OtherIterator, base_iterator>::type* = 0)
: super_t(other)
, m_last(other.base_end())
, m_stride(other.get_stride())
{
}
base_iterator base_end() const { return m_last; }
difference_type get_stride() const { return m_stride; }
private:
void increment()
{
base_iterator& it = this->base_reference();
for (difference_type i = 0; (it != m_last) && (i < m_stride); ++i)
++it;
}
base_iterator m_last;
difference_type m_stride;
};
// strided_iterator for wrapping a bidirectional iterator
template<class BaseIterator>
class strided_iterator<BaseIterator, bidirectional_traversal_tag>
: public iterator_adaptor<
strided_iterator<BaseIterator, bidirectional_traversal_tag>
, BaseIterator
, use_default
, bidirectional_traversal_tag
>
{
friend class ::boost::iterator_core_access;
typedef iterator_adaptor<
strided_iterator<BaseIterator, bidirectional_traversal_tag>
, BaseIterator
, use_default
, bidirectional_traversal_tag
> super_t;
public:
typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<BaseIterator>::difference_type difference_type;
typedef BaseIterator base_iterator;
strided_iterator()
: m_first()
, m_last()
, m_stride()
{
}
strided_iterator(base_iterator first, base_iterator it, base_iterator last, difference_type stride)
: super_t(it)
, m_first(first)
, m_last(last)
, m_stride(stride)
{
}
template<class OtherIterator>
strided_iterator(const strided_iterator<OtherIterator, bidirectional_traversal_tag>& other,
BOOST_DEDUCED_TYPENAME enable_if_convertible<OtherIterator, base_iterator>::type* = 0)
: super_t(other.base())
, m_first(other.base_begin())
, m_last(other.base_end())
, m_stride(other.get_stride())
{
}
base_iterator base_begin() const { return m_first; }
base_iterator base_end() const { return m_last; }
difference_type get_stride() const { return m_stride; }
private:
void increment()
{
base_iterator& it = this->base_reference();
for (difference_type i = 0; (it != m_last) && (i < m_stride); ++i)
++it;
}
void decrement()
{
base_iterator& it = this->base_reference();
for (difference_type i = 0; (it != m_first) && (i < m_stride); ++i)
--it;
}
base_iterator m_first;
base_iterator m_last;
difference_type m_stride;
};
// strided_iterator implementation for wrapping a random access iterator
template<class BaseIterator>
class strided_iterator<BaseIterator, random_access_traversal_tag>
: public iterator_adaptor<
strided_iterator<BaseIterator, random_access_traversal_tag>
, BaseIterator
, use_default
, random_access_traversal_tag
>
{
friend class ::boost::iterator_core_access;
typedef iterator_adaptor<
strided_iterator<BaseIterator, random_access_traversal_tag>
, BaseIterator
, use_default
, random_access_traversal_tag
> super_t;
public:
typedef BOOST_DEDUCED_TYPENAME super_t::difference_type difference_type;
typedef BaseIterator base_iterator;
strided_iterator()
: m_first()
, m_last()
, m_index(0)
, m_stride()
{
}
strided_iterator(BaseIterator first, BaseIterator it, BaseIterator last, difference_type stride)
: super_t(it)
, m_first(first)
, m_last(last)
, m_index(stride ? (it - first) / stride : 0)
, m_stride(stride)
{
}
template<class OtherIterator>
strided_iterator(const strided_iterator<OtherIterator, random_access_traversal_tag>& other,
BOOST_DEDUCED_TYPENAME enable_if_convertible<OtherIterator, BaseIterator>::type* = 0)
: super_t(other.base())
, m_first(other.base_begin())
, m_last(other.base_end())
, m_index(other.get_index())
, m_stride(other.get_stride())
{
}
base_iterator base_begin() const { return m_first; }
base_iterator base_end() const { return m_last; }
difference_type get_stride() const { return m_stride; }
difference_type get_index() const { return m_index; }
private:
void increment()
{
m_index += m_stride;
if (m_index < (m_last - m_first))
this->base_reference() = m_first + m_index;
else
this->base_reference() = m_last;
}
void decrement()
{
m_index -= m_stride;
if (m_index >= 0)
this->base_reference() = m_first + m_index;
else
this->base_reference() = m_first;
}
void advance(difference_type offset)
{
offset *= m_stride;
m_index += offset;
if (m_index < 0)
this->base_reference() = m_first;
else if (m_index > (m_last - m_first))
this->base_reference() = m_last;
else
this->base_reference() = m_first + m_index;
}
template<class OtherIterator>
difference_type distance_to(const strided_iterator<OtherIterator, random_access_traversal_tag>& other,
BOOST_DEDUCED_TYPENAME enable_if_convertible<OtherIterator, BaseIterator>::type* = 0) const
{
if (other.base() >= this->base())
return (other.base() - this->base() + (m_stride - 1)) / m_stride;
return (other.base() - this->base() - (m_stride - 1)) / m_stride;
}
bool equal(const strided_iterator& other) const
{
return this->base() == other.base();
}
private:
base_iterator m_first;
base_iterator m_last;
difference_type m_index;
difference_type m_stride;
};
template<class BaseIterator, class Difference> inline
strided_iterator<BaseIterator, BOOST_DEDUCED_TYPENAME iterator_traversal<BaseIterator>::type>
make_strided_iterator(BaseIterator first, BaseIterator it,
BaseIterator last, Difference stride)
{
BOOST_ASSERT( stride >= 0 );
typedef BOOST_DEDUCED_TYPENAME iterator_traversal<BaseIterator>::type traversal_tag;
return strided_iterator<BaseIterator, traversal_tag>(first, it, last, stride);
}
template< class Rng
, class Category = BOOST_DEDUCED_TYPENAME iterator_traversal<
BOOST_DEDUCED_TYPENAME range_iterator<Rng>::type
>::type
>
class strided_range
: public iterator_range<
range_detail::strided_iterator<
BOOST_DEDUCED_TYPENAME range_iterator<Rng>::type,
Category
>
>
{
typedef range_detail::strided_iterator<
BOOST_DEDUCED_TYPENAME range_iterator<Rng>::type,
Category
> iter_type;
typedef iterator_range<iter_type> super_t;
public:
template<class Difference>
strided_range(Difference stride, Rng& rng)
: super_t(make_strided_iterator(boost::begin(rng), boost::begin(rng), boost::end(rng), stride),
make_strided_iterator(boost::begin(rng), boost::end(rng), boost::end(rng), stride))
{
BOOST_ASSERT( stride >= 0 );
}
};
template<class Difference>
class strided_holder : public holder<Difference>
{
public:
explicit strided_holder(Difference value) : holder<Difference>(value) {}
};
template<class Rng, class Difference>
inline strided_range<Rng>
operator|(Rng& rng, const strided_holder<Difference>& stride)
{
return strided_range<Rng>(stride.val, rng);
}
template<class Rng, class Difference>
inline strided_range<const Rng>
operator|(const Rng& rng, const strided_holder<Difference>& stride)
{
return strided_range<const Rng>(stride.val, rng);
}
} // namespace range_detail
using range_detail::strided_range;
namespace adaptors
{
namespace
{
const range_detail::forwarder<range_detail::strided_holder>
strided = range_detail::forwarder<range_detail::strided_holder>();
}
template<class Range, class Difference>
inline strided_range<Range>
stride(Range& rng, Difference step)
{
return strided_range<Range>(step, rng);
}
template<class Range, class Difference>
inline strided_range<const Range>
stride(const Range& rng, Difference step)
{
return strided_range<const Range>(step, rng);
}
} // namespace 'adaptors'
} // namespace 'boost'
#endif
|
{
"pile_set_name": "Github"
}
|
snd-pcxhr-objs := pcxhr.o pcxhr_hwdep.o pcxhr_mixer.o pcxhr_core.o pcxhr_mix22.o
obj-$(CONFIG_SND_PCXHR) += snd-pcxhr.o
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2010-2011 Freescale Semiconductor, Inc.
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef __FSL_SECURE_BOOT_H
#define __FSL_SECURE_BOOT_H
#ifdef CONFIG_SECURE_BOOT
#if defined(CONFIG_FSL_CORENET)
#define CONFIG_SYS_PBI_FLASH_BASE 0xc0000000
#elif defined(CONFIG_BSC9132QDS)
#define CONFIG_SYS_PBI_FLASH_BASE 0xc8000000
#else
#define CONFIG_SYS_PBI_FLASH_BASE 0xce000000
#endif
#define CONFIG_SYS_PBI_FLASH_WINDOW 0xcff80000
#if defined(CONFIG_B4860QDS) || \
defined(CONFIG_T4240QDS) || \
defined(CONFIG_T2080QDS) || \
defined(CONFIG_T2080RDB) || \
defined(CONFIG_T1040QDS) || \
defined(CONFIG_T104xRDB) || \
defined(CONFIG_PPC_T1023) || \
defined(CONFIG_PPC_T1024)
#define CONFIG_SYS_CPC_REINIT_F
#undef CONFIG_SYS_INIT_L3_ADDR
#define CONFIG_SYS_INIT_L3_ADDR 0xbff00000
#endif
#endif
#endif
|
{
"pile_set_name": "Github"
}
|
// This source file is part of the Swift.org open source project
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
// RUN: not %target-swift-frontend %s -typecheck
struct d<T where g:d{enum b{
struct S
var:{{
)}
{
}
{struct Q{
var f=a{
{{
{}
{
d<a{
struct B{
struct S{
struct d{
func i{
{
{
}
{
b
d{
class A{
func d{
protocol c{
class a{class A{
protocol a{
var T
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<ThingCategoryDef>
<defName>Ammo20mmFliegerfaust</defName>
<label></label>
<parent>AmmoRockets</parent>
<iconPath>UI/Icons/ThingCategories/CaliberRocket</iconPath>
</ThingCategoryDef>
<!-- ==================== AmmoSet ========================== -->
<CombatExtended.AmmoSetDef>
<defName>AmmoSet_20mmFliegerfaust</defName>
<label>20mm Fliegerfaust</label>
<ammoTypes>
<Ammo_20mmFliegerfaust_HE>Bullet_20mmFliegerfaust_HE</Ammo_20mmFliegerfaust_HE>
</ammoTypes>
</CombatExtended.AmmoSetDef>
<!-- ==================== Ammo ========================== -->
<ThingDef Class="CombatExtended.AmmoDef" Name="20mmFliegerfaustBase" ParentName="AmmoBase" Abstract="True">
<description>Outdated 20mm rocket designed to be fired in volleys at airplanes.</description>
<statBases>
<MaxHitPoints>150</MaxHitPoints>
</statBases>
<tradeTags>
<li>CE_AutoEnableTrade</li>
<li>CE_AutoEnableCrafting_TableMachining</li>
</tradeTags>
<thingCategories>
<li>Ammo20mmFliegerfaust</li>
</thingCategories>
<stackLimit>4000</stackLimit>
<cookOffFlashScale>25</cookOffFlashScale>
<cookOffSound>MortarBomb_Explode</cookOffSound>
</ThingDef>
<ThingDef Class="CombatExtended.AmmoDef" ParentName="20mmFliegerfaustBase">
<defName>Ammo_20mmFliegerfaust_HE</defName>
<label>20mm Fliegerfaust (HE)</label>
<graphicData>
<texPath>Things/Ammo/RPG/Frag</texPath>
<graphicClass>Graphic_StackCount</graphicClass>
</graphicData>
<statBases>
<MarketValue>14.83</MarketValue>
<Mass>0.12</Mass>
<Bulk>0.16</Bulk>
</statBases>
<ammoClass>GrenadeHE</ammoClass>
<detonateProjectile>Bullet_20mmFliegerfaust_HE</detonateProjectile>
</ThingDef>
<!-- ================== Projectiles ================== -->
<ThingDef Class="CombatExtended.AmmoDef" Name="Base20mmFliegerfaust" ParentName="BaseBullet" Abstract="true">
<graphicData>
<shaderType>TransparentPostLight</shaderType>
</graphicData>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<speed>70</speed>
<soundAmbient>RocketPropelledLoop_Small</soundAmbient>
</projectile>
</ThingDef>
<ThingDef Class="CombatExtended.AmmoDef" ParentName="Base20mmFliegerfaust">
<defName>Bullet_20mmFliegerfaust_HE</defName>
<thingClass>CombatExtended.ProjectileCE_Explosive</thingClass>
<label>20mm Fliegerfaust rocket (HE)</label>
<graphicData>
<texPath>Things/Projectile/RPG/Frag</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<damageDef>Bomb</damageDef>
<damageAmountBase>16</damageAmountBase>
<explosionRadius>0.5</explosionRadius>
</projectile>
<comps>
<li Class="CombatExtended.CompProperties_Fragments">
<fragments>
<Fragment_Large>1</Fragment_Large>
<Fragment_Small>3</Fragment_Small>
</fragments>
</li>
</comps>
</ThingDef>
<!-- ==================== Recipes ========================== -->
<RecipeDef ParentName="AmmoRecipeBase">
<defName>MakeAmmo_20mmFliegerfaust_HE</defName>
<label>make 20mmFliegerfaust HE rockets x10</label>
<description>Craft 10 20mmFliegerfaust HE rockets.</description>
<jobString>Making 20mmFliegerfaust HE rockets.</jobString>
<workAmount>3200</workAmount>
<ingredients>
<li>
<filter>
<thingDefs>
<li>Steel</li>
</thingDefs>
</filter>
<count>4</count>
</li>
<li>
<filter>
<thingDefs>
<li>FSX</li>
</thingDefs>
</filter>
<count>1</count>
</li>
<li>
<filter>
<thingDefs>
<li>ComponentIndustrial</li>
</thingDefs>
</filter>
<count>4</count>
</li>
</ingredients>
<fixedIngredientFilter>
<thingDefs>
<li>Steel</li>
<li>FSX</li>
<li>ComponentIndustrial</li>
</thingDefs>
</fixedIngredientFilter>
<products>
<Ammo_20mmFliegerfaust_HE>10</Ammo_20mmFliegerfaust_HE>
</products>
</RecipeDef>
</Defs>
|
{
"pile_set_name": "Github"
}
|
/*********************************************************
*
* Multi Theft Auto: San Andreas - Deathmatch
*
* ml_base, External lua add-on module
*
* Copyright © 2003-2018 MTA. All Rights Reserved.
*
* Grand Theft Auto is © 2002-2018 Rockstar North
*
* THE FOLLOWING SOURCES ARE PART OF THE MULTI THEFT
* AUTO SOFTWARE DEVELOPMENT KIT AND ARE RELEASED AS
* OPEN SOURCE FILES. THESE FILES MAY BE USED AS LONG
* AS THE DEVELOPER AGREES TO THE LICENSE THAT IS
* PROVIDED WITH THIS PACKAGE.
*
*********************************************************/
#include "CLuaArgument.h"
#include <assert.h>
#include <cstring>
using namespace std;
CLuaArgument::CLuaArgument()
{
m_szString = NULL;
m_iType = LUA_TNIL;
}
CLuaArgument::CLuaArgument(bool bBool)
{
m_szString = NULL;
m_iType = LUA_TBOOLEAN;
m_bBoolean = bBool;
}
CLuaArgument::CLuaArgument(double dNumber)
{
m_szString = NULL;
m_iType = LUA_TNUMBER;
m_Number = dNumber;
}
CLuaArgument::CLuaArgument(const char* szString)
{
assert(szString);
m_iType = LUA_TSTRING;
m_szString = new char[strlen(szString) + 1];
strcpy(m_szString, szString);
}
CLuaArgument::CLuaArgument(void* pUserData)
{
m_szString = NULL;
m_iType = LUA_TLIGHTUSERDATA;
m_pLightUserData = pUserData;
}
CLuaArgument::CLuaArgument(const CLuaArgument& Argument)
{
// Initialize and call our = on the argument
m_szString = NULL;
operator=(Argument);
}
CLuaArgument::CLuaArgument(lua_State* luaVM, unsigned int uiArgument)
{
// Read the argument out of the lua VM
m_szString = NULL;
Read(luaVM, uiArgument);
}
CLuaArgument::~CLuaArgument()
{
// Eventually destroy our string
if (m_szString)
{
delete[] m_szString;
}
}
const CLuaArgument& CLuaArgument::operator=(const CLuaArgument& Argument)
{
// Destroy our old string if neccessary
if (m_szString)
{
delete[] m_szString;
m_szString = NULL;
}
// Set our variable equally to the copy class
m_iType = Argument.m_iType;
switch (m_iType)
{
case LUA_TBOOLEAN:
{
m_bBoolean = Argument.m_bBoolean;
break;
}
case LUA_TLIGHTUSERDATA:
{
m_pLightUserData = Argument.m_pLightUserData;
break;
}
case LUA_TNUMBER:
{
m_Number = Argument.m_Number;
break;
}
case LUA_TSTRING:
{
if (Argument.m_szString)
{
m_szString = new char[strlen(Argument.m_szString) + 1];
strcpy(m_szString, Argument.m_szString);
}
break;
}
default:
break;
}
// Return the given class allowing for chaining
return Argument;
}
bool CLuaArgument::operator==(const CLuaArgument& Argument)
{
// If the types differ, they're not matching
if (Argument.m_iType != m_iType)
return false;
// Compare the variables depending on the type
switch (m_iType)
{
case LUA_TBOOLEAN:
{
return m_bBoolean == Argument.m_bBoolean;
}
case LUA_TLIGHTUSERDATA:
{
return m_pLightUserData == Argument.m_pLightUserData;
}
case LUA_TNUMBER:
{
return m_Number == Argument.m_Number;
}
case LUA_TSTRING:
{
if (m_szString)
{
if (Argument.m_szString)
return strcmp(m_szString, Argument.m_szString) == 0;
else
return false;
}
else
{
return Argument.m_szString == NULL;
}
}
}
return true;
}
bool CLuaArgument::operator!=(const CLuaArgument& Argument)
{
return !(operator==(Argument));
}
void CLuaArgument::Read(lua_State* luaVM, unsigned int uiArgument)
{
// Eventually delete our previous string
if (m_szString)
{
delete[] m_szString;
m_szString = NULL;
}
// Grab the argument type
m_iType = lua_type(luaVM, uiArgument);
if (m_iType != LUA_TNONE)
{
// Read out the content depending on the type
switch (m_iType)
{
case LUA_TNIL:
break;
case LUA_TBOOLEAN:
{
m_bBoolean = lua_toboolean(luaVM, uiArgument) ? true : false;
break;
}
case LUA_TLIGHTUSERDATA:
{
m_pLightUserData = lua_touserdata(luaVM, uiArgument);
break;
}
case LUA_TNUMBER:
{
m_Number = lua_tonumber(luaVM, uiArgument);
break;
}
case LUA_TSTRING:
{
// Grab the lua string and its size
const char* szLuaString = lua_tostring(luaVM, uiArgument);
size_t sizeLuaString = strlen(szLuaString);
// Allocate our buffer
m_szString = new char[sizeLuaString + 1];
strcpy(m_szString, szLuaString);
break;
}
default:
{
m_iType = LUA_TNONE;
break;
}
}
}
}
void CLuaArgument::Push(lua_State* luaVM) const
{
// Got any type?
if (m_iType != LUA_TNONE)
{
// Push it depending on the type
switch (m_iType)
{
case LUA_TNIL:
{
lua_pushnil(luaVM);
break;
}
case LUA_TBOOLEAN:
{
lua_pushboolean(luaVM, m_bBoolean);
break;
}
case LUA_TLIGHTUSERDATA:
{
lua_pushlightuserdata(luaVM, m_pLightUserData);
break;
}
case LUA_TNUMBER:
{
lua_pushnumber(luaVM, m_Number);
break;
}
case LUA_TSTRING:
{
// Push the string if we got any
if (m_szString)
{
lua_pushstring(luaVM, m_szString);
}
else
{
lua_pushstring(luaVM, "");
}
break;
}
}
}
}
|
{
"pile_set_name": "Github"
}
|
package cli
import (
"flag"
"strconv"
"time"
)
// WARNING: This file is generated!
// BoolFlag is a flag with type bool
type BoolFlag struct {
Name string
Usage string
EnvVar string
FilePath string
Required bool
Hidden bool
Destination *bool
}
// String returns a readable representation of this value
// (for usage defaults)
func (f BoolFlag) String() string {
return FlagStringer(f)
}
// GetName returns the name of the flag
func (f BoolFlag) GetName() string {
return f.Name
}
// IsRequired returns the whether or not the flag is required
func (f BoolFlag) IsRequired() bool {
return f.Required
}
// Bool looks up the value of a local BoolFlag, returns
// false if not found
func (c *Context) Bool(name string) bool {
return lookupBool(name, c.flagSet)
}
// GlobalBool looks up the value of a global BoolFlag, returns
// false if not found
func (c *Context) GlobalBool(name string) bool {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupBool(name, fs)
}
return false
}
func lookupBool(name string, set *flag.FlagSet) bool {
f := set.Lookup(name)
if f != nil {
parsed, err := strconv.ParseBool(f.Value.String())
if err != nil {
return false
}
return parsed
}
return false
}
// BoolTFlag is a flag with type bool that is true by default
type BoolTFlag struct {
Name string
Usage string
EnvVar string
FilePath string
Required bool
Hidden bool
Destination *bool
}
// String returns a readable representation of this value
// (for usage defaults)
func (f BoolTFlag) String() string {
return FlagStringer(f)
}
// GetName returns the name of the flag
func (f BoolTFlag) GetName() string {
return f.Name
}
// IsRequired returns the whether or not the flag is required
func (f BoolTFlag) IsRequired() bool {
return f.Required
}
// BoolT looks up the value of a local BoolTFlag, returns
// false if not found
func (c *Context) BoolT(name string) bool {
return lookupBoolT(name, c.flagSet)
}
// GlobalBoolT looks up the value of a global BoolTFlag, returns
// false if not found
func (c *Context) GlobalBoolT(name string) bool {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupBoolT(name, fs)
}
return false
}
func lookupBoolT(name string, set *flag.FlagSet) bool {
f := set.Lookup(name)
if f != nil {
parsed, err := strconv.ParseBool(f.Value.String())
if err != nil {
return false
}
return parsed
}
return false
}
// DurationFlag is a flag with type time.Duration (see https://golang.org/pkg/time/#ParseDuration)
type DurationFlag struct {
Name string
Usage string
EnvVar string
FilePath string
Required bool
Hidden bool
Value time.Duration
Destination *time.Duration
}
// String returns a readable representation of this value
// (for usage defaults)
func (f DurationFlag) String() string {
return FlagStringer(f)
}
// GetName returns the name of the flag
func (f DurationFlag) GetName() string {
return f.Name
}
// IsRequired returns the whether or not the flag is required
func (f DurationFlag) IsRequired() bool {
return f.Required
}
// Duration looks up the value of a local DurationFlag, returns
// 0 if not found
func (c *Context) Duration(name string) time.Duration {
return lookupDuration(name, c.flagSet)
}
// GlobalDuration looks up the value of a global DurationFlag, returns
// 0 if not found
func (c *Context) GlobalDuration(name string) time.Duration {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupDuration(name, fs)
}
return 0
}
func lookupDuration(name string, set *flag.FlagSet) time.Duration {
f := set.Lookup(name)
if f != nil {
parsed, err := time.ParseDuration(f.Value.String())
if err != nil {
return 0
}
return parsed
}
return 0
}
// Float64Flag is a flag with type float64
type Float64Flag struct {
Name string
Usage string
EnvVar string
FilePath string
Required bool
Hidden bool
Value float64
Destination *float64
}
// String returns a readable representation of this value
// (for usage defaults)
func (f Float64Flag) String() string {
return FlagStringer(f)
}
// GetName returns the name of the flag
func (f Float64Flag) GetName() string {
return f.Name
}
// IsRequired returns the whether or not the flag is required
func (f Float64Flag) IsRequired() bool {
return f.Required
}
// Float64 looks up the value of a local Float64Flag, returns
// 0 if not found
func (c *Context) Float64(name string) float64 {
return lookupFloat64(name, c.flagSet)
}
// GlobalFloat64 looks up the value of a global Float64Flag, returns
// 0 if not found
func (c *Context) GlobalFloat64(name string) float64 {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupFloat64(name, fs)
}
return 0
}
func lookupFloat64(name string, set *flag.FlagSet) float64 {
f := set.Lookup(name)
if f != nil {
parsed, err := strconv.ParseFloat(f.Value.String(), 64)
if err != nil {
return 0
}
return parsed
}
return 0
}
// GenericFlag is a flag with type Generic
type GenericFlag struct {
Name string
Usage string
EnvVar string
FilePath string
Required bool
Hidden bool
Value Generic
}
// String returns a readable representation of this value
// (for usage defaults)
func (f GenericFlag) String() string {
return FlagStringer(f)
}
// GetName returns the name of the flag
func (f GenericFlag) GetName() string {
return f.Name
}
// IsRequired returns the whether or not the flag is required
func (f GenericFlag) IsRequired() bool {
return f.Required
}
// Generic looks up the value of a local GenericFlag, returns
// nil if not found
func (c *Context) Generic(name string) interface{} {
return lookupGeneric(name, c.flagSet)
}
// GlobalGeneric looks up the value of a global GenericFlag, returns
// nil if not found
func (c *Context) GlobalGeneric(name string) interface{} {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupGeneric(name, fs)
}
return nil
}
func lookupGeneric(name string, set *flag.FlagSet) interface{} {
f := set.Lookup(name)
if f != nil {
parsed, err := f.Value, error(nil)
if err != nil {
return nil
}
return parsed
}
return nil
}
// Int64Flag is a flag with type int64
type Int64Flag struct {
Name string
Usage string
EnvVar string
FilePath string
Required bool
Hidden bool
Value int64
Destination *int64
}
// String returns a readable representation of this value
// (for usage defaults)
func (f Int64Flag) String() string {
return FlagStringer(f)
}
// GetName returns the name of the flag
func (f Int64Flag) GetName() string {
return f.Name
}
// IsRequired returns the whether or not the flag is required
func (f Int64Flag) IsRequired() bool {
return f.Required
}
// Int64 looks up the value of a local Int64Flag, returns
// 0 if not found
func (c *Context) Int64(name string) int64 {
return lookupInt64(name, c.flagSet)
}
// GlobalInt64 looks up the value of a global Int64Flag, returns
// 0 if not found
func (c *Context) GlobalInt64(name string) int64 {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupInt64(name, fs)
}
return 0
}
func lookupInt64(name string, set *flag.FlagSet) int64 {
f := set.Lookup(name)
if f != nil {
parsed, err := strconv.ParseInt(f.Value.String(), 0, 64)
if err != nil {
return 0
}
return parsed
}
return 0
}
// IntFlag is a flag with type int
type IntFlag struct {
Name string
Usage string
EnvVar string
FilePath string
Required bool
Hidden bool
Value int
Destination *int
}
// String returns a readable representation of this value
// (for usage defaults)
func (f IntFlag) String() string {
return FlagStringer(f)
}
// GetName returns the name of the flag
func (f IntFlag) GetName() string {
return f.Name
}
// IsRequired returns the whether or not the flag is required
func (f IntFlag) IsRequired() bool {
return f.Required
}
// Int looks up the value of a local IntFlag, returns
// 0 if not found
func (c *Context) Int(name string) int {
return lookupInt(name, c.flagSet)
}
// GlobalInt looks up the value of a global IntFlag, returns
// 0 if not found
func (c *Context) GlobalInt(name string) int {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupInt(name, fs)
}
return 0
}
func lookupInt(name string, set *flag.FlagSet) int {
f := set.Lookup(name)
if f != nil {
parsed, err := strconv.ParseInt(f.Value.String(), 0, 64)
if err != nil {
return 0
}
return int(parsed)
}
return 0
}
// IntSliceFlag is a flag with type *IntSlice
type IntSliceFlag struct {
Name string
Usage string
EnvVar string
FilePath string
Required bool
Hidden bool
Value *IntSlice
}
// String returns a readable representation of this value
// (for usage defaults)
func (f IntSliceFlag) String() string {
return FlagStringer(f)
}
// GetName returns the name of the flag
func (f IntSliceFlag) GetName() string {
return f.Name
}
// IsRequired returns the whether or not the flag is required
func (f IntSliceFlag) IsRequired() bool {
return f.Required
}
// IntSlice looks up the value of a local IntSliceFlag, returns
// nil if not found
func (c *Context) IntSlice(name string) []int {
return lookupIntSlice(name, c.flagSet)
}
// GlobalIntSlice looks up the value of a global IntSliceFlag, returns
// nil if not found
func (c *Context) GlobalIntSlice(name string) []int {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupIntSlice(name, fs)
}
return nil
}
func lookupIntSlice(name string, set *flag.FlagSet) []int {
f := set.Lookup(name)
if f != nil {
parsed, err := (f.Value.(*IntSlice)).Value(), error(nil)
if err != nil {
return nil
}
return parsed
}
return nil
}
// Int64SliceFlag is a flag with type *Int64Slice
type Int64SliceFlag struct {
Name string
Usage string
EnvVar string
FilePath string
Required bool
Hidden bool
Value *Int64Slice
}
// String returns a readable representation of this value
// (for usage defaults)
func (f Int64SliceFlag) String() string {
return FlagStringer(f)
}
// GetName returns the name of the flag
func (f Int64SliceFlag) GetName() string {
return f.Name
}
// IsRequired returns the whether or not the flag is required
func (f Int64SliceFlag) IsRequired() bool {
return f.Required
}
// Int64Slice looks up the value of a local Int64SliceFlag, returns
// nil if not found
func (c *Context) Int64Slice(name string) []int64 {
return lookupInt64Slice(name, c.flagSet)
}
// GlobalInt64Slice looks up the value of a global Int64SliceFlag, returns
// nil if not found
func (c *Context) GlobalInt64Slice(name string) []int64 {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupInt64Slice(name, fs)
}
return nil
}
func lookupInt64Slice(name string, set *flag.FlagSet) []int64 {
f := set.Lookup(name)
if f != nil {
parsed, err := (f.Value.(*Int64Slice)).Value(), error(nil)
if err != nil {
return nil
}
return parsed
}
return nil
}
// StringFlag is a flag with type string
type StringFlag struct {
Name string
Usage string
EnvVar string
FilePath string
Required bool
Hidden bool
Value string
Destination *string
}
// String returns a readable representation of this value
// (for usage defaults)
func (f StringFlag) String() string {
return FlagStringer(f)
}
// GetName returns the name of the flag
func (f StringFlag) GetName() string {
return f.Name
}
// IsRequired returns the whether or not the flag is required
func (f StringFlag) IsRequired() bool {
return f.Required
}
// String looks up the value of a local StringFlag, returns
// "" if not found
func (c *Context) String(name string) string {
return lookupString(name, c.flagSet)
}
// GlobalString looks up the value of a global StringFlag, returns
// "" if not found
func (c *Context) GlobalString(name string) string {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupString(name, fs)
}
return ""
}
func lookupString(name string, set *flag.FlagSet) string {
f := set.Lookup(name)
if f != nil {
parsed, err := f.Value.String(), error(nil)
if err != nil {
return ""
}
return parsed
}
return ""
}
// StringSliceFlag is a flag with type *StringSlice
type StringSliceFlag struct {
Name string
Usage string
EnvVar string
FilePath string
Required bool
Hidden bool
Value *StringSlice
}
// String returns a readable representation of this value
// (for usage defaults)
func (f StringSliceFlag) String() string {
return FlagStringer(f)
}
// GetName returns the name of the flag
func (f StringSliceFlag) GetName() string {
return f.Name
}
// IsRequired returns the whether or not the flag is required
func (f StringSliceFlag) IsRequired() bool {
return f.Required
}
// StringSlice looks up the value of a local StringSliceFlag, returns
// nil if not found
func (c *Context) StringSlice(name string) []string {
return lookupStringSlice(name, c.flagSet)
}
// GlobalStringSlice looks up the value of a global StringSliceFlag, returns
// nil if not found
func (c *Context) GlobalStringSlice(name string) []string {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupStringSlice(name, fs)
}
return nil
}
func lookupStringSlice(name string, set *flag.FlagSet) []string {
f := set.Lookup(name)
if f != nil {
parsed, err := (f.Value.(*StringSlice)).Value(), error(nil)
if err != nil {
return nil
}
return parsed
}
return nil
}
// Uint64Flag is a flag with type uint64
type Uint64Flag struct {
Name string
Usage string
EnvVar string
FilePath string
Required bool
Hidden bool
Value uint64
Destination *uint64
}
// String returns a readable representation of this value
// (for usage defaults)
func (f Uint64Flag) String() string {
return FlagStringer(f)
}
// GetName returns the name of the flag
func (f Uint64Flag) GetName() string {
return f.Name
}
// IsRequired returns the whether or not the flag is required
func (f Uint64Flag) IsRequired() bool {
return f.Required
}
// Uint64 looks up the value of a local Uint64Flag, returns
// 0 if not found
func (c *Context) Uint64(name string) uint64 {
return lookupUint64(name, c.flagSet)
}
// GlobalUint64 looks up the value of a global Uint64Flag, returns
// 0 if not found
func (c *Context) GlobalUint64(name string) uint64 {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupUint64(name, fs)
}
return 0
}
func lookupUint64(name string, set *flag.FlagSet) uint64 {
f := set.Lookup(name)
if f != nil {
parsed, err := strconv.ParseUint(f.Value.String(), 0, 64)
if err != nil {
return 0
}
return parsed
}
return 0
}
// UintFlag is a flag with type uint
type UintFlag struct {
Name string
Usage string
EnvVar string
FilePath string
Required bool
Hidden bool
Value uint
Destination *uint
}
// String returns a readable representation of this value
// (for usage defaults)
func (f UintFlag) String() string {
return FlagStringer(f)
}
// GetName returns the name of the flag
func (f UintFlag) GetName() string {
return f.Name
}
// IsRequired returns the whether or not the flag is required
func (f UintFlag) IsRequired() bool {
return f.Required
}
// Uint looks up the value of a local UintFlag, returns
// 0 if not found
func (c *Context) Uint(name string) uint {
return lookupUint(name, c.flagSet)
}
// GlobalUint looks up the value of a global UintFlag, returns
// 0 if not found
func (c *Context) GlobalUint(name string) uint {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupUint(name, fs)
}
return 0
}
func lookupUint(name string, set *flag.FlagSet) uint {
f := set.Lookup(name)
if f != nil {
parsed, err := strconv.ParseUint(f.Value.String(), 0, 64)
if err != nil {
return 0
}
return uint(parsed)
}
return 0
}
|
{
"pile_set_name": "Github"
}
|
authorName: default
experimentName: example_mnist_pytorch
trialConcurrency: 1
maxExecDuration: 1h
maxTrialNum: 10
#choice: local, remote, pai
trainingServicePlatform: local
searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs:
#choice: maximize, minimize
optimize_mode: maximize
trial:
command: python3 mnist.py
codeDir: .
gpuNum: 0
|
{
"pile_set_name": "Github"
}
|
/*
* linux/net/sunrpc/gss_krb5_seal.c
*
* Adapted from MIT Kerberos 5-1.2.1 lib/gssapi/krb5/k5seal.c
*
* Copyright (c) 2000 The Regents of the University of Michigan.
* All rights reserved.
*
* Andy Adamson <[email protected]>
* J. Bruce Fields <[email protected]>
*/
/*
* Copyright 1993 by OpenVision Technologies, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appears in all copies and
* that both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of OpenVision not be used
* in advertising or publicity pertaining to distribution of the software
* without specific, written prior permission. OpenVision makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
* OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Copyright (C) 1998 by the FundsXpress, INC.
*
* All rights reserved.
*
* Export of this software from the United States of America may require
* a specific license from the United States Government. It is the
* responsibility of any person or organization contemplating export to
* obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of FundsXpress. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. FundsXpress makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/sunrpc/gss_krb5.h>
#include <linux/random.h>
#include <linux/crypto.h>
#ifdef RPC_DEBUG
# define RPCDBG_FACILITY RPCDBG_AUTH
#endif
DEFINE_SPINLOCK(krb5_seq_lock);
u32
gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,
struct xdr_netobj *token)
{
struct krb5_ctx *ctx = gss_ctx->internal_ctx_id;
char cksumdata[16];
struct xdr_netobj md5cksum = {.len = 0, .data = cksumdata};
unsigned char *ptr, *msg_start;
s32 now;
u32 seq_send;
dprintk("RPC: gss_krb5_seal\n");
BUG_ON(ctx == NULL);
now = get_seconds();
token->len = g_token_size(&ctx->mech_used, GSS_KRB5_TOK_HDR_LEN + 8);
ptr = token->data;
g_make_token_header(&ctx->mech_used, GSS_KRB5_TOK_HDR_LEN + 8, &ptr);
/* ptr now at header described in rfc 1964, section 1.2.1: */
ptr[0] = (unsigned char) ((KG_TOK_MIC_MSG >> 8) & 0xff);
ptr[1] = (unsigned char) (KG_TOK_MIC_MSG & 0xff);
msg_start = ptr + GSS_KRB5_TOK_HDR_LEN + 8;
*(__be16 *)(ptr + 2) = htons(SGN_ALG_DES_MAC_MD5);
memset(ptr + 4, 0xff, 4);
if (make_checksum("md5", ptr, 8, text, 0, &md5cksum))
return GSS_S_FAILURE;
if (krb5_encrypt(ctx->seq, NULL, md5cksum.data,
md5cksum.data, md5cksum.len))
return GSS_S_FAILURE;
memcpy(ptr + GSS_KRB5_TOK_HDR_LEN, md5cksum.data + md5cksum.len - 8, 8);
spin_lock(&krb5_seq_lock);
seq_send = ctx->seq_send++;
spin_unlock(&krb5_seq_lock);
if (krb5_make_seq_num(ctx->seq, ctx->initiate ? 0 : 0xff,
seq_send, ptr + GSS_KRB5_TOK_HDR_LEN,
ptr + 8))
return GSS_S_FAILURE;
return (ctx->endtime < now) ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE;
}
|
{
"pile_set_name": "Github"
}
|
/* eslint-env jest */
import 'intersection-observer';
import React from 'react';
import renderer from 'react-test-renderer';
import List from '../';
import { getItemCount } from '../utils';
import mockSentinel, { mockCallback } from './mockSentinel';
jest.mock('../Sentinel', () => (props) => {
if (props.setRef) {
props.setRef(mockCallback);
}
return mockSentinel;
});
const target = { nodeType: 1 };
const createTree = (props = {}) =>
renderer.create(<List {...props} />, { createNodeMock: () => target });
beforeEach(() => {
jest.clearAllMocks();
window.getComputedStyle = jest.fn(() => ({
overflowX: 'auto',
overflowY: 'auto',
}));
});
test('renders without crashing', () => {
createTree();
});
test('pure component avoids unnecessary re-rendering', () => {
const props = { pageSize: 5, itemCount: 25 };
const tree = createTree(props);
const spy = jest.spyOn(tree.getInstance(), 'render');
tree.update(<List {...props} />);
expect(spy).not.toHaveBeenCalled();
});
test('throws with two different render function props', () => {
const spy = global.spyOn(console, 'error');
createTree({ children() {}, renderItem() {}, itemCount: 2 });
expect(spy.calls.mostRecent().args[0]).toMatchSnapshot();
});
test('render children function', () => {
const props = { children() {}, itemCount: 2 };
const spy = jest.spyOn(props, 'children');
createTree(props);
expect(spy).toHaveBeenCalledTimes(2);
});
test('render prop function', () => {
const props = { renderItem() {}, itemCount: 2 };
const spy = jest.spyOn(props, 'renderItem');
createTree(props);
expect(spy).toHaveBeenCalledTimes(2);
});
test('throws with both itemCount and items props set', () => {
const spy = global.spyOn(console, 'error');
createTree({ items: 666 });
expect(spy.calls.mostRecent().args[0]).toMatchSnapshot();
});
test('render with items instead of itemCount', () => {
const json = createTree({ items: [1, 2] }).toJSON();
const children = json.children;
expect(children.length).toBe(2);
});
test('render zero items if no props are given for count calculation', () => {
expect(getItemCount({})).toBe(0);
});
test('render with iterable Set', () => {
const items = new Set([1, 2, 3]);
const json = createTree({ items }).toJSON();
const children = json.children;
expect(children.length).toBe(3);
});
describe('renderItem', () => {
test('renderItem given default props', () => {
const spy = jest.fn();
createTree({ itemCount: 10, renderItem: spy });
expect(spy).toHaveBeenCalledTimes(10);
expect(spy).lastCalledWith(9, 9);
});
test('renderItem given `pageSize` and `initialIndex` props', () => {
const spy = jest.fn();
createTree({
initialIndex: 10,
itemCount: 30,
pageSize: 15,
renderItem: spy,
});
expect(spy).toHaveBeenCalledTimes(15);
expect(spy).lastCalledWith(24, 14);
});
});
describe('sentinel', () => {
test('sentinel present if items are available in view', () => {
const json = createTree({ itemCount: 10, pageSize: 5 }).toJSON();
const children = json.children;
expect(children.length).toBe(6);
expect(children[children.length - 1].type).toBe('span');
});
test('sentinel not present if no items are available in view', () => {
const json = createTree({ itemCount: 5, pageSize: 5 }).toJSON();
const children = json.children;
expect(children.length).toBe(5);
expect(children[children.length - 1].type).toBe('div');
});
test('sentinel present again if `itemCount` is increased', () => {
const tree = createTree({ itemCount: 5, pageSize: 5 });
expect(tree.toJSON().children.length).toBe(5);
tree.update(<List pageSize={5} itemCount={20} />);
expect(tree.toJSON().children.length).toBe(11);
});
test('sentinel present again if `pageSize` is increased', () => {
const tree = createTree({ itemCount: 100, pageSize: 10 });
expect(tree.toJSON().children.length).toBe(11);
tree.update(<List itemCount={100} pageSize={20} />);
expect(tree.toJSON().children.length).toBe(21);
});
test('sentinel not present if `itemCount` is lower than `pageSize`', () => {
const tree = createTree({ itemCount: 0 });
const children = tree.toJSON().children;
expect(children).toBeNull();
tree.update(<List itemCount={8} />);
const newChildren = tree.toJSON().children;
expect(newChildren.length).toBe(8);
expect(newChildren[newChildren.length - 1].type).toBe('div');
});
test('sentinel observes with `awaitMore` bypassing the `itemCount` check', () => {
const tree = createTree({ itemCount: 5 });
const children = tree.toJSON().children;
expect(children.length).toBe(5);
tree.update(<List itemCount={5} awaitMore={true} />);
const newChildren = tree.toJSON().children;
expect(newChildren.length).toBe(6);
expect(newChildren[newChildren.length - 1].type).toBe('span');
});
});
describe('root node', () => {
test('ref callback sets root node', () => {
createTree({ itemCount: 20 });
expect(mockCallback).toBeCalledWith(target);
});
test('ref callback does sets root node if unmounting', () => {
renderer.create(<List itemCount={20} />, {
createNodeMock: () => undefined,
});
expect(mockCallback).not.toBeCalled();
});
test('ref callback does sets root node without sentinel', () => {
const tree = createTree({ itemCount: 10 });
expect(tree.getInstance().setRootNode).toBeUndefined();
});
test('ref callback sets a null root if it does not have overflow', () => {
window.getComputedStyle = jest.fn(() => ({
overflowY: 'visible',
}));
createTree({ itemCount: 20 });
expect(mockCallback).toBeCalledWith(null);
});
test('having same root node prevents call getComputedStyle', () => {
const tree = createTree({ itemCount: 20 });
tree.getInstance().setRootNode(target);
expect(window.getComputedStyle).toHaveBeenCalledTimes(1);
});
});
describe('intersection', () => {
test('does not throw if sentinel intersects with zero items on mount', () => {
const spy = global.spyOn(console, 'error');
const instance = createTree({ itemCount: 0 }).getInstance();
instance.handleUpdate({ isIntersecting: true });
expect(spy.calls.count()).toBe(0);
});
test('throws once if sentinel intersects with items on mount', () => {
const spy = global.spyOn(console, 'error');
const instance = createTree({ itemCount: 10 }).getInstance();
instance.handleUpdate({ isIntersecting: true });
expect(spy.calls.mostRecent().args[0]).toMatchSnapshot();
instance.handleUpdate({ isIntersecting: true });
expect(spy.calls.count()).toBe(1);
createTree({ itemCount: 0 })
.getInstance()
.handleUpdate({ isIntersecting: true });
expect(spy.calls.count()).toBe(1);
});
test('sets next size value computed into `pageSize`', () => {
const instance = createTree({ itemCount: 20 }).getInstance();
instance.handleUpdate({ isIntersecting: false });
instance.handleUpdate({ isIntersecting: true });
expect(instance.state.size).toBe(20);
});
test('sets next size value computed into `itemCount`', () => {
const instance = createTree({ itemCount: 15 }).getInstance();
instance.handleUpdate({ isIntersecting: false });
instance.handleUpdate({ isIntersecting: true });
expect(instance.state.size).toBe(15);
});
test('invokes `onIntersection` each time when it is not awaiting intersection', () => {
const spy = jest.fn();
const instance = createTree({
itemCount: 30,
onIntersection: spy,
}).getInstance();
instance.handleUpdate({ isIntersecting: false });
instance.handleUpdate({ isIntersecting: true });
instance.handleUpdate({ isIntersecting: true });
expect(instance.state.size).toBe(30);
expect(spy).toHaveBeenCalledTimes(2);
});
test('invokes `onIntersection` only once when it is awaiting intersection', () => {
const spy = jest.fn();
const props = {
awaitMore: true,
itemCount: 10,
onIntersection: spy,
};
const tree = createTree(props);
tree.getInstance().handleUpdate({ isIntersecting: false });
tree.getInstance().handleUpdate({ isIntersecting: true });
tree.getInstance().handleUpdate({ isIntersecting: true });
expect(tree.getInstance().state.size).toBe(10);
tree.update(<List {...props} itemCount={20} />);
tree.getInstance().handleUpdate({ isIntersecting: true });
expect(spy).toHaveBeenCalledTimes(2);
});
});
describe('getDerivedStateFromProps', () => {
test('pageSize increases', () => {
const tree = createTree({ itemCount: 40 });
tree.update(<List itemCount={40} pageSize={20} />);
expect(tree.getInstance().state.size).toBe(20);
});
test('pageSize decreases', () => {
const tree = createTree({ itemCount: 40 });
tree.update(<List itemCount={40} pageSize={5} />);
expect(tree.getInstance().state.size).toBe(5);
});
test('itemCount increases', () => {
const tree = createTree({ itemCount: 20 });
tree.update(<List itemCount={40} pageSize={10} />);
expect(tree.getInstance().state.size).toBe(20);
});
test('itemCount decreases', () => {
const tree = createTree({ itemCount: 20 });
tree.update(<List itemCount={5} pageSize={10} />);
expect(tree.getInstance().state.size).toBe(5);
});
test('both pageSize and itemCount update', () => {
const tree = createTree({ itemCount: 20 });
tree.update(<List itemCount={30} pageSize={15} />);
expect(tree.getInstance().state.size).toBe(25);
tree.update(<List itemCount={20} pageSize={15} />);
expect(tree.getInstance().state.size).toBe(20);
tree.update(<List itemCount={30} pageSize={5} />);
expect(tree.getInstance().state.size).toBe(25);
tree.update(<List itemCount={40} pageSize={10} />);
expect(tree.getInstance().state.size).toBe(35);
});
});
|
{
"pile_set_name": "Github"
}
|
grammar CompilerAst;
//php5
options {
output = AST;
ASTLabelType = SLAST;
language = Java;
}
tokens {
ModuleDeclaration;
ClassDeclaration;
PROG; // Main program: statements
CLASS_BODY;
FIELD_DECL;
METHOD_DECL; // function definition
TYPE;
PARAMETER; // parameter
BLOCK;
VAR_DECL;
STATEMENT;
CONDITION;
LIST; // list literal
INDEX; // a[i]
MEMBERACCESS;
CALL;
ELIST; // expression list
EXPR;
ASSIGN;
LIST_DECL;
SCALAR_ELEMENT;
SCALAR_VAR;
CAST;
LABEL;
ITERATE;
USE_DECL;
ARGU;
CALLED_OBJ;
PREFIX;
POSTFIX;
STATEMENT;
NAMESPACE;
EMPTYSTATEMENT;
SCALAR;
ARRAY_DECL;
PREFIX_EXPR;
POSTFIX_EXPR;
CAST_EXPR;
UNARY_EXPR;
VAR;
HASH_INDEX;
USE_PARETHESIS_T;
ERROR_TOKEN;
VAR_ATOM;
CASE_LIST;
}
@header {
package org.eclipse.php.internal.core.compiler.ast.parser.php5;
import org.antlr.runtime.*;
import org.antlr.runtime.tree.*;
import org.antlr.runtime.BitSet;
import java.util.*;
import org.eclipse.dltk.ast.*;
import org.eclipse.dltk.ast.declarations.*;
import org.eclipse.dltk.ast.expressions.*;
import org.eclipse.dltk.ast.references.*;
import org.eclipse.dltk.ast.statements.*;
import org.eclipse.php.internal.core.compiler.ast.nodes.*;
import org.eclipse.php.internal.core.compiler.ast.parser.*;
import org.eclipse.php.internal.core.ast.scanner.php5.*;
}
@lexer::header {
package org.eclipse.php.internal.core.compiler.ast.parser.php5;
import org.antlr.runtime.*;
import org.antlr.runtime.tree.*;
}
@members {
// private IErrorReporter errorReporter = null;
// public void setErrorReporter(IErrorReporter errorReporter) {
// this.errorReporter = errorReporter;
// }
//// public void emitErrorMessage(String msg) {
//// errorReporter.reportError(msg);
//// }
//
private List errors = new LinkedList();
public void displayRecognitionError(String[] tokenNames,
RecognitionException e) {
String hdr = getErrorHeader(e);
String msg = getErrorMessage(e, tokenNames);
errors.add(hdr + " " + msg);
}
public List getErrors() {
return errors;
}
ErrorNode nodeInfo;
public CompilerAstParser(TokenStream input, ErrorNode currentNode) {
this(input);
this.nodeInfo = currentNode;
}
}
php_source
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST phpSourceToken = retval.tree;
phpSourceToken.setIndex(startIndex, endIndex);
}
: (SOC_T
{
token = (CommonToken)$SOC_T;
startIndex = token.getStartIndex();
}
| SOC_PHP_T
{
token = (CommonToken)$SOC_PHP_T;
startIndex = token.getStartIndex();
})
top_statement_list?
EOC_T
{
token = (CommonToken)$EOC_T;
endIndex = token.getStopIndex();
}
-> ^(ModuleDeclaration top_statement_list?)
;
top_statement_list
: top_statement+
;
top_statement
: statement
| function_declaration_statement
| class_declaration_statement
| halt_compiler_statement
;
inner_statement_list
: (inner_statement)+
;
inner_statement
: statement
| function_declaration_statement
| class_declaration_statement
| halt_compiler_statement
;
halt_compiler_statement
: '__halt_compiler' LEFT_PARETHESIS RIGHT_PARETHESIS SEMI_COLON -> '__halt_compiler'
;
class_declaration_statement
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: ( class_entr_type? CLASS_T IDENTIFIER
{
nodeInfo.nodeName = $IDENTIFIER.text;
nodeInfo.specificType = CLASS_T;
}
(EXTENDS_T
{
nodeInfo.specificType = EXTENDS_T;
}
fully_qualified_class_name)? (IMPLEMENTS_T
{
nodeInfo.specificType = IMPLEMENTS_T;
}
fully_qualified_class_name_list)?
{
nodeInfo.specificType = CLASS_BODY;
}
LEFT_BRACKET class_statement* RIGHT_BRACKET
{
startIndex = ((CommonToken)$CLASS_T).getStartIndex();
if ($class_entr_type.text != null) {
token = (CommonToken)$class_entr_type.start;
if (token != null) startIndex = token.getStartIndex();
}
token = (CommonToken)$RIGHT_BRACKET;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(CLASS_T class_entr_type? IDENTIFIER ^(EXTENDS_T fully_qualified_class_name)? ^(IMPLEMENTS_T fully_qualified_class_name_list)?
^(CLASS_BODY class_statement*)?)
)
| (INTERFACE_T
{
nodeInfo.nodeName = $INTERFACE_T.text;
nodeInfo.specificType = INTERFACE_T;
}
IDENTIFIER (EXTENDS_T fully_qualified_class_name_list)? (IMPLEMENTS_T fully_qualified_class_name_list)?
LEFT_BRACKET class_statement* RIGHT_BRACKET
{
startIndex = ((CommonToken)$INTERFACE_T).getStartIndex();
endIndex = ((CommonToken)$RIGHT_BRACKET).getStopIndex();
}
-> ^(INTERFACE_T IDENTIFIER ^(EXTENDS_T fully_qualified_class_name_list)?
^(CLASS_BODY class_statement*)?)
)
;
class_entr_type
: 'abstract'
| 'final'
;
class_statement
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: variable_modifiers static_var_list SEMI_COLON
{
token = (CommonToken)$variable_modifiers.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$SEMI_COLON;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(FIELD_DECL variable_modifiers static_var_list)
| modifier? FUNCTION_T REF_T? IDENTIFIER
{
nodeInfo.nodeName = $IDENTIFIER.text;
nodeInfo.specificType = FUNCTION_T;
}
LEFT_PARETHESIS parameter_list? RIGHT_PARETHESIS SEMI_COLON
{
if ($modifier.text != null) {
token = (CommonToken)$modifier.start;
}
else {
token = (CommonToken)$FUNCTION_T;
}
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$SEMI_COLON;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(METHOD_DECL modifier? REF_T? IDENTIFIER parameter_list? EMPTYSTATEMENT)
| modifier? FUNCTION_T REF_T? IDENTIFIER
{
nodeInfo.nodeName = $IDENTIFIER.text;
nodeInfo.specificType = FUNCTION_T;
}
LEFT_PARETHESIS parameter_list? RIGHT_PARETHESIS block
{
if ($modifier.text != null) {
token = (CommonToken)$modifier.start;
}
else {
token = (CommonToken)$FUNCTION_T;
}
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$block.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(METHOD_DECL modifier? REF_T? IDENTIFIER parameter_list? block)
| CONST_T directive SEMI_COLON
{
token = (CommonToken)$CONST_T;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$SEMI_COLON;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(FIELD_DECL CONST_T directive)
;
function_declaration_statement
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: FUNCTION_T REF_T? IDENTIFIER
{
nodeInfo.nodeName = $IDENTIFIER.text;
nodeInfo.specificType = FUNCTION_T;
}
LEFT_PARETHESIS parameter_list? RIGHT_PARETHESIS
block
{
token = (CommonToken)$FUNCTION_T;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$block.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(METHOD_DECL REF_T? IDENTIFIER parameter_list? block)
;
block
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
:
{
nodeInfo.nodeName = "BLOCK";
nodeInfo.specificType = BLOCK;
}
LEFT_BRACKET inner_statement_list? RIGHT_BRACKET
{
token = (CommonToken)$LEFT_BRACKET;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$RIGHT_BRACKET;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(BLOCK inner_statement_list?)
;
statement
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST exprToken = retval.tree;
exprToken.setIndex(startIndex, endIndex);
}
: topStatement
{
startIndex = $topStatement.tree.startIndex;
endIndex = $topStatement.tree.endIndex;
}
-> ^(STATEMENT topStatement)
;
topStatement
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
if (ast != null) {
ast.setIndex(startIndex, endIndex);
}
}
: block
{
startIndex = $block.tree.startIndex;
endIndex = $block.tree.endIndex;
}
| if_stat
{
startIndex = $if_stat.tree.startIndex;
endIndex = $if_stat.tree.endIndex;
}
| WHILE_T
{
nodeInfo.nodeName = $WHILE_T.text;
nodeInfo.specificType = WHILE_T;
}
LEFT_PARETHESIS expression RIGHT_PARETHESIS while_statement
{
startIndex = ((CommonToken)$WHILE_T).getStartIndex();
token = (CommonToken)$while_statement.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(WHILE_T ^(CONDITION expression) while_statement)
| DO_T
{
nodeInfo.nodeName = $DO_T.text;
nodeInfo.specificType = DO_T;
}
statement WHILE_T LEFT_PARETHESIS expression RIGHT_PARETHESIS SEMI_COLON
{
startIndex = ((CommonToken)$DO_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(DO_T ^(CONDITION expression) statement)
| FOR_T
{
nodeInfo.nodeName = $FOR_T.text;
nodeInfo.specificType = FOR_T;
}
LEFT_PARETHESIS e1=expr_list? SEMI_COLON e2=expr_list? SEMI_COLON e3=expr_list? RIGHT_PARETHESIS for_statement
{
startIndex = ((CommonToken)$FOR_T).getStartIndex();
endIndex = ((CommonToken)$RIGHT_PARETHESIS).getStopIndex();
if ($for_statement.text != null) {
token = (CommonToken)$for_statement.stop;
if (token != null) endIndex = token.getStopIndex();
}
}
-> ^(FOR_T $e1? ^(CONDITION $e2?) ^(ITERATE $e3?) for_statement?)
| SWITCH_T
{
nodeInfo.nodeName = $SWITCH_T.text;
nodeInfo.specificType = SWITCH_T;
}
LEFT_PARETHESIS expression RIGHT_PARETHESIS switch_case_list
{
startIndex = ((CommonToken)$SWITCH_T).getStartIndex();
token = (CommonToken)$switch_case_list.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(SWITCH_T ^(CONDITION expression) switch_case_list)
| BREAK_T
{
nodeInfo.nodeName = $BREAK_T.text;
nodeInfo.specificType = BREAK_T;
}
expression? SEMI_COLON
{
startIndex = ((CommonToken)$BREAK_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(BREAK_T expression?)
| CONTINUE_T
{
nodeInfo.nodeName = $CONTINUE_T.text;
nodeInfo.specificType = CONTINUE_T;
}
expression? SEMI_COLON
{
startIndex = ((CommonToken)$CONTINUE_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(CONTINUE_T expression?)
| RETURN_T
{
nodeInfo.nodeName = $RETURN_T.text;
nodeInfo.specificType = RETURN_T;
}
expression? SEMI_COLON
{
startIndex = ((CommonToken)$RETURN_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(RETURN_T expression?)
| GLOBAL_T
{
nodeInfo.nodeName = $GLOBAL_T.text;
nodeInfo.specificType = GLOBAL_T;
}
variable_list SEMI_COLON
{
startIndex = ((CommonToken)$GLOBAL_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(GLOBAL_T variable_list)
| STATIC_T
{
nodeInfo.nodeName = $STATIC_T.text;
nodeInfo.specificType = STATIC_T;
}
static_var_list SEMI_COLON
{
startIndex = ((CommonToken)$STATIC_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(STATIC_T static_var_list)
| ECHO_T
{
nodeInfo.nodeName = $ECHO_T.text;
nodeInfo.specificType = ECHO_T;
}
expr_list SEMI_COLON
{
startIndex = ((CommonToken)$ECHO_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(ECHO_T expr_list)
| expression SEMI_COLON!
{
startIndex = $expression.tree.startIndex;
endIndex = $expression.tree.endIndex;
if (((CommonToken)$SEMI_COLON).getStopIndex() != 0) {
endIndex = ((CommonToken)$SEMI_COLON).getStopIndex();
}
}
| FOREACH_T
{
nodeInfo.nodeName = $FOREACH_T.text;
nodeInfo.specificType = FOREACH_T;
}
LEFT_PARETHESIS expression AS_T foreach_variable (ARROW_T foreach_variable)? RIGHT_PARETHESIS
foreach_statement
{
startIndex = ((CommonToken)$FOREACH_T).getStartIndex();
token = (CommonToken)$foreach_statement.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(FOREACH_T ^(AS_T expression foreach_variable foreach_variable?) foreach_statement)
| DECLARE_T
{
nodeInfo.nodeName = $DECLARE_T.text;
nodeInfo.specificType = DECLARE_T;
}
LEFT_PARETHESIS directive RIGHT_PARETHESIS declare_statement
{
startIndex = ((CommonToken)$DECLARE_T).getStartIndex();
token = (CommonToken)$declare_statement.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(DECLARE_T directive declare_statement?)
| SEMI_COLON
{
startIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStopIndex();
}
-> ^(EMPTYSTATEMENT SEMI_COLON)
| TRY_T
{
nodeInfo.nodeName = $TRY_T.text;
nodeInfo.specificType = TRY_T;
}
block catch_branch+
{
startIndex = ((CommonToken)$TRY_T).getStartIndex();
token = (CommonToken)$catch_branch.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(TRY_T block catch_branch+)
| THROW_T
{
nodeInfo.nodeName = $THROW_T.text;
nodeInfo.specificType = THROW_T;
}
expression SEMI_COLON
{
startIndex = ((CommonToken)$THROW_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(THROW_T expression)
| USE_T
{
nodeInfo.nodeName = $USE_T.text;
nodeInfo.specificType = USE_T;
}
scalar SEMI_COLON
{
startIndex = ((CommonToken)$USE_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(USE_T scalar)
| USE_T
{
nodeInfo.nodeName = $USE_T.text;
nodeInfo.specificType = USE_T;
}
LEFT_PARETHESIS scalar RIGHT_PARETHESIS SEMI_COLON
{
startIndex = ((CommonToken)$USE_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(USE_PARETHESIS_T scalar)
| INCLUDE_T
{
nodeInfo.nodeName = $INCLUDE_T.text;
nodeInfo.specificType = INCLUDE_T;
}
LEFT_PARETHESIS expression RIGHT_PARETHESIS SEMI_COLON
{
startIndex = ((CommonToken)$INCLUDE_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(INCLUDE_T expression)
| INCLUDE_ONCE_T
{
nodeInfo.nodeName = $INCLUDE_ONCE_T.text;
nodeInfo.specificType = INCLUDE_ONCE_T;
}
LEFT_PARETHESIS expression RIGHT_PARETHESIS SEMI_COLON
{
startIndex = ((CommonToken)$INCLUDE_ONCE_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(INCLUDE_ONCE_T expression)
| REQUIRE_T
{
nodeInfo.nodeName = $REQUIRE_T.text;
nodeInfo.specificType = REQUIRE_T;
}
LEFT_PARETHESIS expression RIGHT_PARETHESIS SEMI_COLON
{
startIndex = ((CommonToken)$REQUIRE_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(REQUIRE_T expression)
| REQUIRE_ONCE_T
{
nodeInfo.nodeName = $REQUIRE_ONCE_T.text;
nodeInfo.specificType = REQUIRE_ONCE_T;
}
LEFT_PARETHESIS expression RIGHT_PARETHESIS SEMI_COLON
{
startIndex = ((CommonToken)$REQUIRE_ONCE_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStartIndex();
}
-> ^(REQUIRE_ONCE_T expression)
;
foreach_variable
: REF_T? variable
;
use_filename
: STRINGLITERAL
| LEFT_PARETHESIS! STRINGLITERAL RIGHT_PARETHESIS!
;
fully_qualified_class_name_list
: fully_qualified_class_name (',' fully_qualified_class_name)* -> fully_qualified_class_name+
;
fully_qualified_class_name
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: id1=IDENTIFIER (DOMAIN_T^ id2=IDENTIFIER)* d2=DOMAIN_T?
{
token = (CommonToken)$id1;
startIndex = token.getStartIndex();
endIndex = token.getStopIndex();
if ($d2.text != null) {
endIndex = ((CommonToken)$d2).getStopIndex();
}
else if ($id2.text != null) {
endIndex = ((CommonToken)$id2).getStopIndex();
}
}
;
static_var_list
: static_var_element (COMMA_T static_var_element)* -> static_var_element+
;
static_var_element
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: pure_variable (EQUAL_T^ scalar)?
{
token = (CommonToken)$pure_variable.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$pure_variable.stop;
if ($scalar.text != null) {
token = (CommonToken)$scalar.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
if_stat
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: IF_T
{
nodeInfo.nodeName = $IF_T.text;
nodeInfo.specificType = IF_T;
}
LEFT_PARETHESIS eIfCond=expression RIGHT_PARETHESIS
(
s1=statement (options {k=1; backtrack=true;}:
ELSEIF_T LEFT_PARETHESIS eElseCond=expression RIGHT_PARETHESIS s2=statement)*
(options {k=1;backtrack = true;}: else1=ELSE_T s3=statement)?
{
startIndex = ((CommonToken)$IF_T).getStartIndex();
token = (CommonToken)$s1.stop;
if ($s2.text != null) {
token = (CommonToken)$s2.stop;
}
if ($s3.text != null) {
token = (CommonToken)$s3.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
-> ^(IF_T ^(CONDITION $eIfCond) $s1 ^(ELSEIF_T ^(CONDITION $eElseCond) $s2)* ^(ELSE_T $s3)?)
| COLON_T inner_statement_list? new_elseif_branch* (options {k=1;backtrack = true;}:
else2=ELSE_T COLON_T s4=statement)? ENDIF_T SEMI_COLON
{
startIndex = ((CommonToken)$IF_T).getStartIndex();
endIndex = ((CommonToken)$ENDIF_T).getStartIndex() - 2;
}
-> ^(IF_T ^(CONDITION $eIfCond) inner_statement_list? new_elseif_branch* ^(ELSE_T $s4)?)
)
;
new_elseif_branch
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: ELSEIF_T LEFT_PARETHESIS expression RIGHT_PARETHESIS COLON_T inner_statement_list?
{
token = (CommonToken)$ELSEIF_T;
startIndex = token.getStartIndex();
token = (CommonToken)$COLON_T;
if ($inner_statement_list.text != null) {
token = (CommonToken)$inner_statement_list.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
-> ^(ELSEIF_T ^(CONDITION expression) inner_statement_list?)
;
switch_case_list
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: LEFT_BRACKET SEMI_COLON? case_list+ RIGHT_BRACKET
{
token = (CommonToken)$LEFT_BRACKET;
startIndex = token.getStartIndex();
token = (CommonToken)$RIGHT_BRACKET;
endIndex = token.getStopIndex();
}
-> ^(CASE_LIST case_list+)
| COLON_T SEMI_COLON? case_list+ ENDSWITCH_T secSemi=SEMI_COLON
{
token = (CommonToken)$COLON_T;
startIndex = token.getStartIndex();
token = (CommonToken)$secSemi;
endIndex = token.getStopIndex();
}
-> ^(CASE_LIST case_list+)
;
case_list
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: CASE_T
{
nodeInfo.nodeName = $CASE_T.text;
nodeInfo.specificType = CASE_T;
}
expression (COLON_T | SEMI_COLON) inner_statement_list?
{
token = (CommonToken)$CASE_T;
startIndex = token.getStartIndex();
token = (CommonToken)$COLON_T;
if ($SEMI_COLON.text != null) {
token = (CommonToken)$SEMI_COLON;
}
if ($inner_statement_list.text != null) {
token = (CommonToken)$inner_statement_list.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
-> ^(CASE_T expression inner_statement_list?)
| DEFAULT_T
{
nodeInfo.nodeName = $DEFAULT_T.text;
nodeInfo.specificType = DEFAULT_T;
}
(COLON_T | SEMI_COLON) inner_statement_list?
{
token = (CommonToken)$DEFAULT_T;
startIndex = token.getStartIndex();
token = (CommonToken)$COLON_T;
if ($SEMI_COLON.text != null) {
token = (CommonToken)$SEMI_COLON;
}
if ($inner_statement_list.text != null) {
token = (CommonToken)$inner_statement_list.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
-> ^(DEFAULT_T inner_statement_list?)
;
catch_branch
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: CATCH_T
{
nodeInfo.nodeName = $CATCH_T.text;
nodeInfo.specificType = CATCH_T;
}
LEFT_PARETHESIS fully_qualified_class_name variable RIGHT_PARETHESIS
block
{
token = (CommonToken)$CATCH_T;
startIndex = token.getStartIndex();
token = (CommonToken)$block.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(CATCH_T fully_qualified_class_name variable block)
;
for_statement
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: statement
{
token = (CommonToken)$statement.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$statement.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> statement
| COLON_T inner_statement_list? ENDFOR_T SEMI_COLON
{
startIndex = ((CommonToken)$COLON_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStopIndex();
}
-> inner_statement_list?
;
while_statement
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: statement
{
token = (CommonToken)$statement.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$statement.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> statement
| COLON_T inner_statement_list? ENDWHILE_T SEMI_COLON
{
startIndex = ((CommonToken)$COLON_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStopIndex();
}
-> inner_statement_list?
;
foreach_statement
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: statement
{
token = (CommonToken)$statement.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$statement.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> statement
| COLON_T inner_statement_list? ENDFOREACH_T SEMI_COLON
{
startIndex = ((CommonToken)$COLON_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStopIndex();
}
-> inner_statement_list?
;
declare_statement
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
if (ast != null) {
ast.setIndex(startIndex, endIndex);
}
}
: statement
{
token = (CommonToken)$statement.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$statement.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(BLOCK statement)
| COLON_T inner_statement_list? ENDDECLARE_T SEMI_COLON
{
startIndex = ((CommonToken)$COLON_T).getStartIndex();
endIndex = ((CommonToken)$SEMI_COLON).getStopIndex();
}
-> ^(BLOCK inner_statement_list?)
;
parameter_list
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: p1=parameter (COMMA_T p2=parameter)*
{
token = (CommonToken)$p1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$p1.stop;
if ($p2.text != null) {
token = (CommonToken)$p2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
-> parameter+
;
parameter
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
:
{
nodeInfo.nodeName = "PARAMETER";
nodeInfo.specificType = PARAMETER;
}
parameter_type? CONST_T? pure_variable (options{k=1; backtrack=true;}: EQUAL_T scalar)?
{
token = (CommonToken)$pure_variable.start;
if ($parameter_type.text != null) {
token = (CommonToken)$parameter_type.start;
}
else if ($CONST_T.text != null) {
token = (CommonToken)$CONST_T;
}
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$pure_variable.stop;
if ($scalar.text != null) {
token = (CommonToken)$scalar.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
-> ^(PARAMETER ^(TYPE parameter_type)? CONST_T? pure_variable scalar?)
;
parameter_type
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: fully_qualified_class_name
{
token = (CommonToken)$fully_qualified_class_name.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$fully_qualified_class_name.stop;
if (token != null) endIndex = token.getStopIndex();
}
| cast_option
{
token = (CommonToken)$cast_option.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$cast_option.stop;
if (token != null) endIndex = token.getStopIndex();
}
;
variable_list
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: v1=variable (COMMA_T v2=variable)*
{
token = (CommonToken)$v1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$v1.stop;
if ($v2.text != null) {
token = (CommonToken)$v2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
-> variable+
;
variable_modifiers
: 'var'
| modifier
;
modifier
: ('public'
| 'protected'
| 'private'
| 'static'
| 'abstract'
| 'final')+
;
directive
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: d1=directive_element (COMMA_T d2=directive_element)*
{
token = (CommonToken)$d1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$d1.stop;
if ($d2.text != null) {
token = (CommonToken)$d2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
-> directive_element+
;
directive_element
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: IDENTIFIER EQUAL_T expression
{
token = (CommonToken)$IDENTIFIER;
startIndex = token.getStartIndex();
token = (CommonToken)$expression.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(EQUAL_T IDENTIFIER expression)
;
expr_list
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=expression (COMMA_T e2=expression)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
-> expression+
;
expression
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
:
{
nodeInfo.nodeName = "EXPR";
nodeInfo.specificType = EXPR;
}
logical_text_or_expr
{
token = (CommonToken)$logical_text_or_expr.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$logical_text_or_expr.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(EXPR logical_text_or_expr)
;
logical_text_or_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=logical_text_xor_expr (OR_T^ e2=logical_text_xor_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
logical_text_xor_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=logical_text_and_expr (XOR_T^ e2=logical_text_and_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
logical_text_and_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=assignment_expr (AND_T^ e2=assignment_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
assignment_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=conditional_expr (assignment_operator^ e2=conditional_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
assignment_operator
: EQUAL_T
| PLUS_EQ
| MINUS_EQ
| MUL_EQ
| DIV_EQ
| DOT_EQ
| PERCENT_EQ
| BIT_AND_EQ
| BIT_OR_EQ
| POWER_EQ
| LMOVE_EQ
| RMOVE_EQ
;
conditional_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: (ll=logical_or_expr
{
token = (CommonToken)$ll.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$ll.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> $ll)
(QUESTION_T expression? COLON_T lr=logical_or_expr
{
token = (CommonToken)$lr.stop;
if (token != null) endIndex = token.getStopIndex();
} -> ^(QUESTION_T $ll ^(COLON_T expression? $lr)))?
;
logical_or_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=logical_and_expr (LOGICAL_OR_T^ e2=logical_and_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
logical_and_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=bitwise_or_expr (LOGICAL_AND_T^ e2=bitwise_or_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
bitwise_or_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=bitwise_xor_expr (BIT_OR_T^ e2=bitwise_xor_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
bitwise_xor_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=bitwise_and_expr (POWER_T^ e2=bitwise_and_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
bitwise_and_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=concat_expr (DOT_T^ e2=concat_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
concat_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=equality_expr (REF_T^ e2=equality_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
equality_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=relational_expr ((EQUAL_EQUAL_T | NOT_EQUAL_T | EQUAL_EQUAL_EQUAL_T | NOT_EQUAL_EQUAL_T)^ e2=relational_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
relational_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=shift_expr ((LT_T | MT_T | LE_T | ME_T)^ e2=shift_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
shift_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=additive_expr ((LSHIFT_T | RSHIFT_T)^ e2=additive_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
additive_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=multiplicative_expr ((PLUS_T | MINUS_T)^ e2=multiplicative_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
multiplicative_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=cast_expr ((MUL_T | DIV_T | PERCENT_T)^ e2=cast_expr)*
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
cast_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: unary_expr
{
token = (CommonToken)$unary_expr.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$unary_expr.stop;
if (token != null) endIndex = token.getStopIndex();
}
| (LEFT_PARETHESIS cast_option RIGHT_PARETHESIS)+ unary_expr
{
token = (CommonToken)$LEFT_PARETHESIS;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$unary_expr.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(CAST_EXPR cast_option+ unary_expr)
;
cast_option
: 'bool'
| 'boolean'
| 'int'
| 'float'
| 'double'
| 'real'
| 'string'
| UNSET_T
| CLONE_T
| 'object'
| 'array'
;
unary_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: unary_symbol_list prefix_inc_dec_expr
{
token = (CommonToken)$unary_symbol_list.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$prefix_inc_dec_expr.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(UNARY_EXPR unary_symbol_list prefix_inc_dec_expr)
| prefix_inc_dec_expr
{
token = (CommonToken)$prefix_inc_dec_expr.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$prefix_inc_dec_expr.stop;
if (token != null) endIndex = token.getStopIndex();
}
;
unary_symbol_list
: unary_symbol+
;
unary_symbol
: REF_T | PLUS_T | MINUS_T | TILDA_T | EXC_NOT_T
;
prefix_inc_dec_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: post_inc_dec_expr
{
token = (CommonToken)$post_inc_dec_expr.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$post_inc_dec_expr.stop;
if (token != null) endIndex = token.getStopIndex();
}
| (plus_minus)+ post_inc_dec_expr
{
token = (CommonToken)$plus_minus.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$post_inc_dec_expr.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(PREFIX_EXPR plus_minus+ post_inc_dec_expr)
;
post_inc_dec_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: (instance_expr
{
token = (CommonToken)$instance_expr.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$instance_expr.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> instance_expr)
(plus_minus
{
token = (CommonToken)$plus_minus.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(POSTFIX_EXPR $post_inc_dec_expr plus_minus))*
;
plus_minus
: PLUS_PLUS_T
| MINUS_MINUS_T
;
instance_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: atom_expr (INSTANCEOF_T^ class_name_reference)?
{
token = (CommonToken)$atom_expr.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$atom_expr.stop;
if ($class_name_reference.text != null) {
token = (CommonToken)$class_name_reference.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
;
atom_expr
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: AT_T? variable
{
token = (CommonToken)$variable.start;
if ($AT_T.text != null) {
token = (CommonToken)$AT_T;
}
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$variable.stop;
if (token != null) endIndex = token.getStopIndex();
}
| AT_T? scalar
{
token = (CommonToken)$scalar.start;
if ($AT_T.text != null) {
token = (CommonToken)$AT_T;
}
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$scalar.stop;
if (token != null) endIndex = token.getStopIndex();
}
| LEFT_PARETHESIS expression RIGHT_PARETHESIS
{
token = (CommonToken)$LEFT_PARETHESIS;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$RIGHT_PARETHESIS;
if (token != null) endIndex = token.getStopIndex();
}
| LIST_T LEFT_PARETHESIS assignment_list RIGHT_PARETHESIS
{
token = (CommonToken)$LIST_T;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$RIGHT_PARETHESIS;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(LIST_T assignment_list)
| 'array' LEFT_PARETHESIS array_pair_list? RIGHT_PARETHESIS
{
token = (CommonToken)$LEFT_PARETHESIS;
if (token != null) startIndex = token.getStartIndex() - "array".length();
token = (CommonToken)$RIGHT_PARETHESIS;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(ARRAY_DECL array_pair_list?)
| NEW_T class_name_reference
{
token = (CommonToken)$NEW_T;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$class_name_reference.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(NEW_T class_name_reference)
| CLONE_T variable
{
token = (CommonToken)$CLONE_T;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$variable.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(CLONE_T variable)
// | EXIT_T (LEFT_PARETHESIS expression? RIGHT_PARETHESIS)?
// {
// token = (CommonToken)$EXIT_T;
// startIndex = token.getStartIndex();
// if ($RIGHT_PARETHESIS.text != null) {
// token = (CommonToken)$RIGHT_PARETHESIS;
// }
// endIndex = token.getStopIndex();
// }
// -> ^(EXIT_T expression?)
// | lambda_function_declaration
| UNSET_T LEFT_PARETHESIS variable_list RIGHT_PARETHESIS
{
token = (CommonToken)$UNSET_T;
startIndex = token.getStartIndex();
token = (CommonToken)$RIGHT_PARETHESIS;
endIndex = token.getStopIndex();
}
-> ^(UNSET_T variable_list)
| BACKTRICKLITERAL
{
token = (CommonToken)$BACKTRICKLITERAL;
startIndex = token.getStartIndex();
endIndex = token.getStopIndex();
}
| PRINT_T expression
{
token = (CommonToken)$PRINT_T;
startIndex = token.getStartIndex();
if ($expression.text != null) {
token = (CommonToken)$expression.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
-> ^(PRINT_T expression)
;
//lambda_function_declaration
// : FUNCTION_T REF_T? LEFT_PARETHESIS parameter_list? RIGHT_PARETHESIS (USE_T LEFT_PARETHESIS expr_list? RIGHT_PARETHESIS)?
// block
// -> ^(METHOD_DECL REF_T? parameter_list? ^(USE_T expr_list?)?
// block)
// ;
class_name_reference
: dynamic_name_reference
| fully_qualified_class_name
;
dynamic_name_reference
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
ArrayList endIndexList = new ArrayList();
ArrayList hasArgument = new ArrayList();
ArrayList argumentStartIndex = new ArrayList();
ArrayList argumentEndIndex = new ArrayList();
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
Iterator iter = endIndexList.iterator(),
iterHasArgument = hasArgument.iterator(),
iterArguStart = argumentStartIndex.iterator(),
iterArguEnd = argumentEndIndex.iterator();
int currentEndIndex = endIndex;
boolean hasArgu = false;
SLAST arguAst = null;
while (iter.hasNext()) {
currentEndIndex = (Integer)iter.next();
ast.setIndex(startIndex, currentEndIndex);
hasArgu = (Boolean)iterHasArgument.next();
if (hasArgu) {
arguAst = (SLAST)ast.getChild(2);
arguAst.setIndex((Integer)iterArguStart.next(), (Integer)iterArguEnd.next());
}
ast = (SLAST)ast.getChild(0);
}
}
: (base_variable_with_function_calls
{
startIndex = $base_variable_with_function_calls.tree.startIndex;
endIndex = $base_variable_with_function_calls.tree.endIndex;
}
-> base_variable_with_function_calls)
(SINGLE_ARROW_T object_property ctor_arguments?
{
startIndex = $base_variable_with_function_calls.tree.startIndex;
token = (CommonToken)$object_property.stop;
if (token != null) endIndex = token.getStopIndex();
endIndexList.add(0, endIndex);
if ($ctor_arguments.text != null) {
endIndex = $ctor_arguments.tree.endIndex;
int sid = $ctor_arguments.tree.startIndex;
int eid = $ctor_arguments.tree.endIndex;
hasArgument.add(0, true);
argumentStartIndex.add(sid);
argumentEndIndex.add(eid);
}
else {
hasArgument.add(0, false);
}
}
-> ^(CALL $dynamic_name_reference object_property ctor_arguments?))*
;
assignment_list
: assignment_element? (COMMA_T assignment_element?)* -> assignment_element*
;
assignment_element
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: variable
| LIST_T LEFT_PARETHESIS assignment_list RIGHT_PARETHESIS
{
token = (CommonToken)$LIST_T;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$RIGHT_PARETHESIS;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(LIST_T assignment_list)
;
array_pair_list
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=array_pair_element (COMMA_T e2=array_pair_element)* COMMA_T?
{
token = (CommonToken)$e1.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$e1.stop;
if ($e2.text != null) {
token = (CommonToken)$e2.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
-> array_pair_element+
;
array_pair_element
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: e1=expression (ARROW_T^ e2=expression)?
{
startIndex = $e1.tree.startIndex;
endIndex = $e1.tree.endIndex;
if ($e2.text != null) {
endIndex = $e2.tree.endIndex;
}
}
;
variable
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
ArrayList endIndexList = new ArrayList();
ArrayList hasArgument = new ArrayList();
ArrayList argumentStartIndex = new ArrayList();
ArrayList argumentEndIndex = new ArrayList();
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
System.out.println("variable:" + startIndex + " " + endIndex);
Iterator iter = endIndexList.iterator(),
iterHasArgument = hasArgument.iterator(),
iterArguStart = argumentStartIndex.iterator(),
iterArguEnd = argumentEndIndex.iterator();
int currentEndIndex = endIndex;
boolean hasArgu = false;
SLAST arguAst = null;
while (iter.hasNext()) {
currentEndIndex = (Integer)iter.next();
ast.setIndex(startIndex, currentEndIndex);
hasArgu = (Boolean)iterHasArgument.next();
if (hasArgu) {
arguAst = (SLAST)ast.getChild(2);
arguAst.setIndex((Integer)iterArguStart.next(), (Integer)iterArguEnd.next());
}
ast = (SLAST)ast.getChild(0);
}
}
: (base_variable_with_function_calls
{
startIndex = $base_variable_with_function_calls.tree.startIndex;
endIndex = $base_variable_with_function_calls.tree.endIndex;
}
-> base_variable_with_function_calls)
(SINGLE_ARROW_T object_property ctor_arguments?
{
startIndex = $base_variable_with_function_calls.tree.startIndex;
token = (CommonToken)$object_property.stop;
if (token != null) endIndex = token.getStopIndex();
endIndexList.add(0, endIndex);
if ($ctor_arguments.text != null) {
int sid = $ctor_arguments.tree.startIndex;
int eid = $ctor_arguments.tree.endIndex;
hasArgument.add(0, true);
argumentStartIndex.add(sid);
argumentEndIndex.add(eid);
endIndex = $ctor_arguments.tree.endIndex;
}
else {
hasArgument.add(0, false);
}
}
-> ^(CALL $variable object_property ctor_arguments?))*
;
base_variable_with_function_calls
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
System.out.println("base var: " + startIndex + " " + endIndex);
}
: fully_qualified_class_name? reference_variable ctor_arguments?
{
token = (CommonToken)$reference_variable.start;
if ($fully_qualified_class_name.text != null) {
token = (CommonToken)$fully_qualified_class_name.start;
}
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$reference_variable.stop;
if ($ctor_arguments.text != null) {
token = (CommonToken)$ctor_arguments.stop;
}
if (token != null) endIndex = token.getStopIndex();
}
-> ^(VAR_DECL fully_qualified_class_name? reference_variable ctor_arguments?)
| fully_qualified_class_name ctor_arguments
{
token = (CommonToken)$fully_qualified_class_name.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$ctor_arguments.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(CALL fully_qualified_class_name ctor_arguments)
// | STATIC '::' reference_variable -> ^(VAR_DECL ^('::' STATIC reference_variable))
// | fully_qualified_class_name
;
object_property
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
System.out.println("obj: " + startIndex + " " + endIndex);
}
: reference_variable
{
token = (CommonToken)$reference_variable.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$reference_variable.stop;
if (token != null) endIndex = token.getStopIndex();
}
| reference_variable_without_dollar
{
token = (CommonToken)$reference_variable_without_dollar.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$reference_variable_without_dollar.stop;
if (token != null) endIndex = token.getStopIndex();
}
;
reference_variable
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
ArrayList endIndexList = new ArrayList();
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
System.out.println("ref:" + startIndex + " " + endIndex);
Iterator iter = endIndexList.iterator();
int currentEndIndex = endIndex;
while (iter.hasNext()) {
currentEndIndex = (Integer)iter.next();
ast.setIndex(startIndex, currentEndIndex);
ast = (SLAST)ast.getChild(0);
}
}
:
{
nodeInfo.nodeName = "VAR";
nodeInfo.specificType = VAR;
}
(compound_variable
{
token = (CommonToken)$compound_variable.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$compound_variable.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(VAR compound_variable))
(
LEFT_OPEN_RECT e=expression? RIGHT_OPEN_RECT
{
endIndex = ((CommonToken)$RIGHT_OPEN_RECT).getStopIndex();
endIndexList.add(0, endIndex);
}
-> ^(INDEX $reference_variable $e?)
|
LEFT_BRACKET e=expression RIGHT_BRACKET
{
endIndex = ((CommonToken)$RIGHT_BRACKET).getStopIndex();
endIndexList.add(0, endIndex);
}
-> ^(HASH_INDEX $reference_variable $e)
)*
;
compound_variable
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
nodeInfo.nodeName = "VAR_ATOM";
nodeInfo.specificType = VAR_ATOM;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: dollars IDENTIFIER
{
token = (CommonToken)$dollars.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$IDENTIFIER;
endIndex = token.getStopIndex();
}
-> ^(VAR_ATOM dollars IDENTIFIER)
| dollars LEFT_BRACKET expression RIGHT_BRACKET
{
token = (CommonToken)$dollars.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$RIGHT_BRACKET;
endIndex = token.getStopIndex();
}
-> ^(VAR_ATOM dollars expression)
;
dollars
: DOLLAR_T+
;
reference_variable_without_dollar
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
ArrayList endIndexList = new ArrayList();
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
int currentEndIndex = endIndex;
Iterator iter = endIndexList.iterator();
while (iter.hasNext()) {
currentEndIndex = (Integer)iter.next();
ast.setIndex(startIndex, currentEndIndex);
ast = (SLAST)ast.getChild(0);
}
}
: (compound_variable_without_dollar
{
token = (CommonToken)$compound_variable_without_dollar.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$compound_variable_without_dollar.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(VAR compound_variable_without_dollar))
(
LEFT_OPEN_RECT expression? RIGHT_OPEN_RECT
{
endIndex = ((CommonToken)$RIGHT_OPEN_RECT).getStopIndex();
endIndexList.add(0, endIndex);
}
-> ^(INDEX $reference_variable_without_dollar expression?)
|
LEFT_BRACKET expression RIGHT_BRACKET
{
endIndex = ((CommonToken)$RIGHT_BRACKET).getStopIndex();
endIndexList.add(0, endIndex);
}
-> ^(HASH_INDEX $reference_variable_without_dollar expression)
)*
;
compound_variable_without_dollar
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
System.out.println("com:" + startIndex + " " + endIndex);
}
: IDENTIFIER
{
token = (CommonToken)$IDENTIFIER;
startIndex = token.getStartIndex();
endIndex = token.getStopIndex();
}
-> ^(VAR_ATOM IDENTIFIER)
| LEFT_BRACKET expression RIGHT_BRACKET
{
token = (CommonToken)$LEFT_BRACKET;
startIndex = token.getStartIndex();
token = (CommonToken)$RIGHT_BRACKET;
endIndex = token.getStopIndex();
}
-> ^(VAR_ATOM expression)
;
ctor_arguments
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
System.out.println("argu:" + startIndex + " " + endIndex);
}
: LEFT_PARETHESIS expr_list? RIGHT_PARETHESIS
{
token = (CommonToken)$LEFT_PARETHESIS;
startIndex = token.getStartIndex();
token = (CommonToken)$RIGHT_PARETHESIS;
endIndex = token.getStopIndex();
}
-> ^(ARGU expr_list?)
;
pure_variable
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST ast = retval.tree;
ast.setIndex(startIndex, endIndex);
}
: REF_T? DOLLAR_T+ IDENTIFIER
{
token = (CommonToken)$DOLLAR_T;
if ($REF_T.text != null) {
token = (CommonToken)$REF_T;
}
startIndex = token.getStartIndex();
token = (CommonToken)$IDENTIFIER;
endIndex = token.getStopIndex();
}
-> ^(VAR_DECL REF_T? DOLLAR_T+ IDENTIFIER)
;
scalar
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST exprToken = retval.tree;
exprToken.setIndex(startIndex, endIndex);
}
: constant
{
token = (CommonToken)$constant.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$constant.stop;
if (token != null) endIndex = token.getStopIndex();
}
-> ^(SCALAR constant)
;
constant
@init {
int startIndex = -1;
int endIndex = -1;
CommonToken token;
}
@after {
SLAST exprToken = retval.tree;
exprToken.setIndex(startIndex, endIndex);
}
: INTLITERAL
| FLOATLITERAL
| STRINGLITERAL
// | QUOTE_STRING
| DOUBLELITERRAL
| REALLITERAL
| common_scalar
| fully_qualified_class_name
{
token = (CommonToken)$fully_qualified_class_name.start;
if (token != null) startIndex = token.getStartIndex();
token = (CommonToken)$fully_qualified_class_name.stop;
if (token != null) endIndex = token.getStopIndex();
}
| HERE_DOC
;
common_scalar
: '__CLASS__'
| '__DIR__'
| '__FILE__'
| '__FUNCTION__'
| '__METHOD__'
| '__LINE__'
| '__NAMESPACE__'
;
HEREDOC : '<<<Heredoc';
END_HEREDOC : 'Heredoc;';
SOC_T : '<?';
SOC_PHP_T : '<?php';
EOC_T : '?>';
DOLLAR_T : '$';
LEFT_BRACKET : '{';
RIGHT_BRACKET : '}';
LEFT_PARETHESIS : '(';
RIGHT_PARETHESIS : ')';
LEFT_OPEN_RECT : '[';
RIGHT_OPEN_RECT : ']';
CLASS_T : 'class';
FOR_T: 'for';
BREAK_T: 'break';
EXTENDS_T : 'extends';
IMPLEMENTS_T: 'implements';
INTERFACE_T: 'interface';
FUNCTION_T: 'function';
DO_T: 'do';
WHILE_T : 'while';
SWITCH_T: 'switch';
CONTINUE_T: 'continue';
RETURN_T: 'return';
GLOBAL_T: 'global';
STATIC_T: 'static';
ECHO_T: 'echo';
FOREACH_T: 'foreach';
AS_T: 'as';
DECLARE_T: 'declare';
TRY_T: 'try';
THROW_T: 'throw';
USE_T: 'use';
ELSEIF_T: 'elseif';
ELSE_T: 'else';
ENDIF_T: 'endif';
IF_T: 'if';
ENDSWITCH_T: 'endswitch';
CASE_T: 'case';
DEFAULT_T: 'default';
CATCH_T: 'catch';
ENDFOR_T: 'endfor';
ENDWHILE_T: 'endwhile';
ENDFOREACH_T: 'endforeach';
ENDDECLARE_T: 'enddeclare';
XOR_T: 'XOR';
OR_T: 'OR';
AND_T: 'AND';
INSTANCEOF_T: 'instanceof';
CONST_T: 'const';
LIST_T: 'list';
NEW_T: 'new';
CLONE_T: 'clone';
//EXIT_T: 'exit';
UNSET_T: 'unset';
INCLUDE_T: 'include';
INCLUDE_ONCE_T: 'include_once';
REQUIRE_T: 'require';
REQUIRE_ONCE_T: 'require_once';
PRINT_T: 'print';
AT_T: '@';
PLUS_EQ : '+=';
MINUS_EQ : '-=';
MUL_EQ : '*=';
DIV_EQ : '/=';
DOT_EQ : '.=';
PERCENT_EQ : '%=';
BIT_AND_EQ : '&=';
BIT_OR_EQ : '|=';
POWER_EQ : '^=';
LMOVE_EQ : '<<=';
RMOVE_EQ : '>>=';
ARROW_T: '=>';
SINGLE_ARROW_T: '->';
EQUAL_EQUAL_EQUAL_T: '===';
NOT_EQUAL_EQUAL_T: '!==';
EQUAL_EQUAL_T: '==';
NOT_EQUAL_T: '!=';
EXC_NOT_T: '!';
DOMAIN_T: '::';
COMMA_T: ',';
EQUAL_T: '=';
COLON_T: ':';
QUESTION_T: '?';
LOGICAL_OR_T: '||';
LOGICAL_AND_T: '&&';
POWER_T: '^';
BIT_OR_T: '|';
REF_T: '&';
DOT_T: '.';
LSHIFT_T: '<<';
RSHIFT_T: '>>';
PERCENT_T: '%';
SEMI_COLON: ';';
PLUS_PLUS_T: '++';
MINUS_MINUS_T: '--';
PLUS_T: '+';
MINUS_T: '-';
MUL_T: '*';
DIV_T: '/';
TILDA_T: '~';
LE_T: '<=';
ME_T: '>=';
LT_T: '<';
MT_T: '>';
INTLITERAL
: IntegerNumber LongSuffix?
;
REALLITERAL
: HexPrefix HexDigit+ LongSuffix?
;
fragment
IntegerNumber
: '0'
| '1'..'9' ('0'..'9')*
| '0' ('0'..'7')+
;
fragment
LongSuffix
: 'l' | 'L'
;
fragment
HexPrefix
: '0x' | '0X'
;
fragment
HexDigit
: ('0'..'9'|'a'..'f'|'A'..'F')
;
STATIC
: '__PHP_Incomplete_Class'
;
FLOATLITERAL
: NonIntegerNumber FloatSuffix
;
DOUBLELITERRAL
: NonIntegerNumber DoubleSuffix
;
fragment
NonIntegerNumber
: ('0' .. '9')+ '.' ('0' .. '9')* Exponent?
| '.' ( '0' .. '9' )+ Exponent?
| ('0' .. '9')+ Exponent
| ('0' .. '9')+
|
HexPrefix (HexDigit )*
( ()
| ('.' (HexDigit )* )
)
( 'p' | 'P' )
( '0' .. '9' )+
;
fragment
Exponent
: ( 'e' | 'E' ) ( PLUS_T | MINUS_T )? ( '0' .. '9' )+
;
fragment
FloatSuffix
: 'f' | 'F'
;
fragment
DoubleSuffix
: 'd' | 'D'
;
BACKTRICKLITERAL
: '`'
.*
'`'
;
STRINGLITERAL
: '\''
( .
)*
'\''
|
'"'
( .
)*
'"'
;
//QUOTE_STRING
// : '"'
// ( .
// )*
// '"'
// ;
HERE_DOC
: HEREDOC (.)* END_HEREDOC
;
fragment
EscapeSequence
: '\\' ( 'b'
| 'n'
| 'f'
| 't'
| 'r'
| '\"'
| '\''
| '\\'
| ('0'..'3') ('0'..'7') ('0'..'7')
| ('0'..'7') ('0'..'7')
| ('0'..'7')
)
;
IDENTIFIER
// : IdentifierStart IdentifierPart*
: ('a'..'z'|'A'..'Z'|'_')('a'..'z'|'A'..'Z'|'_'|'0'..'9')*
;
fragment
IdentifierStart
: '\u005c'
| '\u005f'
| '\u0041'..'\u005a'
| '\u0061'..'\u007a'
| '\u00a2'..'\u00a5'
| '\u00aa'
| '\u00b5'
| '\u00ba'
| '\u00c0'..'\u00d6'
| '\u00d8'..'\u00f6'
| '\u00f8'..'\u0236'
| '\u0250'..'\u02c1'
| '\u02c6'..'\u02d1'
| '\u02e0'..'\u02e4'
| '\u02ee'
| '\u037a'
| '\u0386'
| '\u0388'..'\u038a'
| '\u038c'
| '\u038e'..'\u03a1'
| '\u03a3'..'\u03ce'
| '\u03d0'..'\u03f5'
| '\u03f7'..'\u03fb'
| '\u0400'..'\u0481'
| '\u048a'..'\u04ce'
| '\u04d0'..'\u04f5'
| '\u04f8'..'\u04f9'
| '\u0500'..'\u050f'
| '\u0531'..'\u0556'
| '\u0559'
| '\u0561'..'\u0587'
| '\u05d0'..'\u05ea'
| '\u05f0'..'\u05f2'
| '\u0621'..'\u063a'
| '\u0640'..'\u064a'
| '\u066e'..'\u066f'
| '\u0671'..'\u06d3'
| '\u06d5'
| '\u06e5'..'\u06e6'
| '\u06ee'..'\u06ef'
| '\u06fa'..'\u06fc'
| '\u06ff'
| '\u0710'
| '\u0712'..'\u072f'
| '\u074d'..'\u074f'
| '\u0780'..'\u07a5'
| '\u07b1'
| '\u0904'..'\u0939'
| '\u093d'
| '\u0950'
| '\u0958'..'\u0961'
| '\u0985'..'\u098c'
| '\u098f'..'\u0990'
| '\u0993'..'\u09a8'
| '\u09aa'..'\u09b0'
| '\u09b2'
| '\u09b6'..'\u09b9'
| '\u09bd'
| '\u09dc'..'\u09dd'
| '\u09df'..'\u09e1'
| '\u09f0'..'\u09f3'
| '\u0a05'..'\u0a0a'
| '\u0a0f'..'\u0a10'
| '\u0a13'..'\u0a28'
| '\u0a2a'..'\u0a30'
| '\u0a32'..'\u0a33'
| '\u0a35'..'\u0a36'
| '\u0a38'..'\u0a39'
| '\u0a59'..'\u0a5c'
| '\u0a5e'
| '\u0a72'..'\u0a74'
| '\u0a85'..'\u0a8d'
| '\u0a8f'..'\u0a91'
| '\u0a93'..'\u0aa8'
| '\u0aaa'..'\u0ab0'
| '\u0ab2'..'\u0ab3'
| '\u0ab5'..'\u0ab9'
| '\u0abd'
| '\u0ad0'
| '\u0ae0'..'\u0ae1'
| '\u0af1'
| '\u0b05'..'\u0b0c'
| '\u0b0f'..'\u0b10'
| '\u0b13'..'\u0b28'
| '\u0b2a'..'\u0b30'
| '\u0b32'..'\u0b33'
| '\u0b35'..'\u0b39'
| '\u0b3d'
| '\u0b5c'..'\u0b5d'
| '\u0b5f'..'\u0b61'
| '\u0b71'
| '\u0b83'
| '\u0b85'..'\u0b8a'
| '\u0b8e'..'\u0b90'
| '\u0b92'..'\u0b95'
| '\u0b99'..'\u0b9a'
| '\u0b9c'
| '\u0b9e'..'\u0b9f'
| '\u0ba3'..'\u0ba4'
| '\u0ba8'..'\u0baa'
| '\u0bae'..'\u0bb5'
| '\u0bb7'..'\u0bb9'
| '\u0bf9'
| '\u0c05'..'\u0c0c'
| '\u0c0e'..'\u0c10'
| '\u0c12'..'\u0c28'
| '\u0c2a'..'\u0c33'
| '\u0c35'..'\u0c39'
| '\u0c60'..'\u0c61'
| '\u0c85'..'\u0c8c'
| '\u0c8e'..'\u0c90'
| '\u0c92'..'\u0ca8'
| '\u0caa'..'\u0cb3'
| '\u0cb5'..'\u0cb9'
| '\u0cbd'
| '\u0cde'
| '\u0ce0'..'\u0ce1'
| '\u0d05'..'\u0d0c'
| '\u0d0e'..'\u0d10'
| '\u0d12'..'\u0d28'
| '\u0d2a'..'\u0d39'
| '\u0d60'..'\u0d61'
| '\u0d85'..'\u0d96'
| '\u0d9a'..'\u0db1'
| '\u0db3'..'\u0dbb'
| '\u0dbd'
| '\u0dc0'..'\u0dc6'
| '\u0e01'..'\u0e30'
| '\u0e32'..'\u0e33'
| '\u0e3f'..'\u0e46'
| '\u0e81'..'\u0e82'
| '\u0e84'
| '\u0e87'..'\u0e88'
| '\u0e8a'
| '\u0e8d'
| '\u0e94'..'\u0e97'
| '\u0e99'..'\u0e9f'
| '\u0ea1'..'\u0ea3'
| '\u0ea5'
| '\u0ea7'
| '\u0eaa'..'\u0eab'
| '\u0ead'..'\u0eb0'
| '\u0eb2'..'\u0eb3'
| '\u0ebd'
| '\u0ec0'..'\u0ec4'
| '\u0ec6'
| '\u0edc'..'\u0edd'
| '\u0f00'
| '\u0f40'..'\u0f47'
| '\u0f49'..'\u0f6a'
| '\u0f88'..'\u0f8b'
| '\u1000'..'\u1021'
| '\u1023'..'\u1027'
| '\u1029'..'\u102a'
| '\u1050'..'\u1055'
| '\u10a0'..'\u10c5'
| '\u10d0'..'\u10f8'
| '\u1100'..'\u1159'
| '\u115f'..'\u11a2'
| '\u11a8'..'\u11f9'
| '\u1200'..'\u1206'
| '\u1208'..'\u1246'
| '\u1248'
| '\u124a'..'\u124d'
| '\u1250'..'\u1256'
| '\u1258'
| '\u125a'..'\u125d'
| '\u1260'..'\u1286'
| '\u1288'
| '\u128a'..'\u128d'
| '\u1290'..'\u12ae'
| '\u12b0'
| '\u12b2'..'\u12b5'
| '\u12b8'..'\u12be'
| '\u12c0'
| '\u12c2'..'\u12c5'
| '\u12c8'..'\u12ce'
| '\u12d0'..'\u12d6'
| '\u12d8'..'\u12ee'
| '\u12f0'..'\u130e'
| '\u1310'
| '\u1312'..'\u1315'
| '\u1318'..'\u131e'
| '\u1320'..'\u1346'
| '\u1348'..'\u135a'
| '\u13a0'..'\u13f4'
| '\u1401'..'\u166c'
| '\u166f'..'\u1676'
| '\u1681'..'\u169a'
| '\u16a0'..'\u16ea'
| '\u16ee'..'\u16f0'
| '\u1700'..'\u170c'
| '\u170e'..'\u1711'
| '\u1720'..'\u1731'
| '\u1740'..'\u1751'
| '\u1760'..'\u176c'
| '\u176e'..'\u1770'
| '\u1780'..'\u17b3'
| '\u17d7'
| '\u17db'..'\u17dc'
| '\u1820'..'\u1877'
| '\u1880'..'\u18a8'
| '\u1900'..'\u191c'
| '\u1950'..'\u196d'
| '\u1970'..'\u1974'
| '\u1d00'..'\u1d6b'
| '\u1e00'..'\u1e9b'
| '\u1ea0'..'\u1ef9'
| '\u1f00'..'\u1f15'
| '\u1f18'..'\u1f1d'
| '\u1f20'..'\u1f45'
| '\u1f48'..'\u1f4d'
| '\u1f50'..'\u1f57'
| '\u1f59'
| '\u1f5b'
| '\u1f5d'
| '\u1f5f'..'\u1f7d'
| '\u1f80'..'\u1fb4'
| '\u1fb6'..'\u1fbc'
| '\u1fbe'
| '\u1fc2'..'\u1fc4'
| '\u1fc6'..'\u1fcc'
| '\u1fd0'..'\u1fd3'
| '\u1fd6'..'\u1fdb'
| '\u1fe0'..'\u1fec'
| '\u1ff2'..'\u1ff4'
| '\u1ff6'..'\u1ffc'
| '\u203f'..'\u2040'
| '\u2054'
| '\u2071'
| '\u207f'
| '\u20a0'..'\u20b1'
| '\u2102'
| '\u2107'
| '\u210a'..'\u2113'
| '\u2115'
| '\u2119'..'\u211d'
| '\u2124'
| '\u2126'
| '\u2128'
| '\u212a'..'\u212d'
| '\u212f'..'\u2131'
| '\u2133'..'\u2139'
| '\u213d'..'\u213f'
| '\u2145'..'\u2149'
| '\u2160'..'\u2183'
| '\u3005'..'\u3007'
| '\u3021'..'\u3029'
| '\u3031'..'\u3035'
| '\u3038'..'\u303c'
| '\u3041'..'\u3096'
| '\u309d'..'\u309f'
| '\u30a1'..'\u30ff'
| '\u3105'..'\u312c'
| '\u3131'..'\u318e'
| '\u31a0'..'\u31b7'
| '\u31f0'..'\u31ff'
| '\u3400'..'\u4db5'
| '\u4e00'..'\u9fa5'
| '\ua000'..'\ua48c'
| '\uac00'..'\ud7a3'
| '\uf900'..'\ufa2d'
| '\ufa30'..'\ufa6a'
| '\ufb00'..'\ufb06'
| '\ufb13'..'\ufb17'
| '\ufb1d'
| '\ufb1f'..'\ufb28'
| '\ufb2a'..'\ufb36'
| '\ufb38'..'\ufb3c'
| '\ufb3e'
| '\ufb40'..'\ufb41'
| '\ufb43'..'\ufb44'
| '\ufb46'..'\ufbb1'
| '\ufbd3'..'\ufd3d'
| '\ufd50'..'\ufd8f'
| '\ufd92'..'\ufdc7'
| '\ufdf0'..'\ufdfc'
| '\ufe33'..'\ufe34'
| '\ufe4d'..'\ufe4f'
| '\ufe69'
| '\ufe70'..'\ufe74'
| '\ufe76'..'\ufefc'
| '\uff04'
| '\uff21'..'\uff3a'
| '\uff3f'
| '\uff41'..'\uff5a'
| '\uff65'..'\uffbe'
| '\uffc2'..'\uffc7'
| '\uffca'..'\uffcf'
| '\uffd2'..'\uffd7'
| '\uffda'..'\uffdc'
| '\uffe0'..'\uffe1'
| '\uffe5'..'\uffe6'
// | ('\ud800'..'\udbff') ('\udc00'..'\udfff')
;
fragment
IdentifierPart
: '\u0000'..'\u0008'
| '\u000e'..'\u001b'
| '\u0024'
| '\u0030'..'\u0039'
| '\u0041'..'\u005a'
| '\u005c'
| '\u005f'
| '\u0061'..'\u007a'
| '\u007f'..'\u009f'
| '\u00a2'..'\u00a5'
| '\u00aa'
| '\u00ad'
| '\u00b5'
| '\u00ba'
| '\u00c0'..'\u00d6'
| '\u00d8'..'\u00f6'
| '\u00f8'..'\u0236'
| '\u0250'..'\u02c1'
| '\u02c6'..'\u02d1'
| '\u02e0'..'\u02e4'
| '\u02ee'
| '\u0300'..'\u0357'
| '\u035d'..'\u036f'
| '\u037a'
| '\u0386'
| '\u0388'..'\u038a'
| '\u038c'
| '\u038e'..'\u03a1'
| '\u03a3'..'\u03ce'
| '\u03d0'..'\u03f5'
| '\u03f7'..'\u03fb'
| '\u0400'..'\u0481'
| '\u0483'..'\u0486'
| '\u048a'..'\u04ce'
| '\u04d0'..'\u04f5'
| '\u04f8'..'\u04f9'
| '\u0500'..'\u050f'
| '\u0531'..'\u0556'
| '\u0559'
| '\u0561'..'\u0587'
| '\u0591'..'\u05a1'
| '\u05a3'..'\u05b9'
| '\u05bb'..'\u05bd'
| '\u05bf'
| '\u05c1'..'\u05c2'
| '\u05c4'
| '\u05d0'..'\u05ea'
| '\u05f0'..'\u05f2'
| '\u0600'..'\u0603'
| '\u0610'..'\u0615'
| '\u0621'..'\u063a'
| '\u0640'..'\u0658'
| '\u0660'..'\u0669'
| '\u066e'..'\u06d3'
| '\u06d5'..'\u06dd'
| '\u06df'..'\u06e8'
| '\u06ea'..'\u06fc'
| '\u06ff'
| '\u070f'..'\u074a'
| '\u074d'..'\u074f'
| '\u0780'..'\u07b1'
| '\u0901'..'\u0939'
| '\u093c'..'\u094d'
| '\u0950'..'\u0954'
| '\u0958'..'\u0963'
| '\u0966'..'\u096f'
| '\u0981'..'\u0983'
| '\u0985'..'\u098c'
| '\u098f'..'\u0990'
| '\u0993'..'\u09a8'
| '\u09aa'..'\u09b0'
| '\u09b2'
| '\u09b6'..'\u09b9'
| '\u09bc'..'\u09c4'
| '\u09c7'..'\u09c8'
| '\u09cb'..'\u09cd'
| '\u09d7'
| '\u09dc'..'\u09dd'
| '\u09df'..'\u09e3'
| '\u09e6'..'\u09f3'
| '\u0a01'..'\u0a03'
| '\u0a05'..'\u0a0a'
| '\u0a0f'..'\u0a10'
| '\u0a13'..'\u0a28'
| '\u0a2a'..'\u0a30'
| '\u0a32'..'\u0a33'
| '\u0a35'..'\u0a36'
| '\u0a38'..'\u0a39'
| '\u0a3c'
| '\u0a3e'..'\u0a42'
| '\u0a47'..'\u0a48'
| '\u0a4b'..'\u0a4d'
| '\u0a59'..'\u0a5c'
| '\u0a5e'
| '\u0a66'..'\u0a74'
| '\u0a81'..'\u0a83'
| '\u0a85'..'\u0a8d'
| '\u0a8f'..'\u0a91'
| '\u0a93'..'\u0aa8'
| '\u0aaa'..'\u0ab0'
| '\u0ab2'..'\u0ab3'
| '\u0ab5'..'\u0ab9'
| '\u0abc'..'\u0ac5'
| '\u0ac7'..'\u0ac9'
| '\u0acb'..'\u0acd'
| '\u0ad0'
| '\u0ae0'..'\u0ae3'
| '\u0ae6'..'\u0aef'
| '\u0af1'
| '\u0b01'..'\u0b03'
| '\u0b05'..'\u0b0c'
| '\u0b0f'..'\u0b10'
| '\u0b13'..'\u0b28'
| '\u0b2a'..'\u0b30'
| '\u0b32'..'\u0b33'
| '\u0b35'..'\u0b39'
| '\u0b3c'..'\u0b43'
| '\u0b47'..'\u0b48'
| '\u0b4b'..'\u0b4d'
| '\u0b56'..'\u0b57'
| '\u0b5c'..'\u0b5d'
| '\u0b5f'..'\u0b61'
| '\u0b66'..'\u0b6f'
| '\u0b71'
| '\u0b82'..'\u0b83'
| '\u0b85'..'\u0b8a'
| '\u0b8e'..'\u0b90'
| '\u0b92'..'\u0b95'
| '\u0b99'..'\u0b9a'
| '\u0b9c'
| '\u0b9e'..'\u0b9f'
| '\u0ba3'..'\u0ba4'
| '\u0ba8'..'\u0baa'
| '\u0bae'..'\u0bb5'
| '\u0bb7'..'\u0bb9'
| '\u0bbe'..'\u0bc2'
| '\u0bc6'..'\u0bc8'
| '\u0bca'..'\u0bcd'
| '\u0bd7'
| '\u0be7'..'\u0bef'
| '\u0bf9'
| '\u0c01'..'\u0c03'
| '\u0c05'..'\u0c0c'
| '\u0c0e'..'\u0c10'
| '\u0c12'..'\u0c28'
| '\u0c2a'..'\u0c33'
| '\u0c35'..'\u0c39'
| '\u0c3e'..'\u0c44'
| '\u0c46'..'\u0c48'
| '\u0c4a'..'\u0c4d'
| '\u0c55'..'\u0c56'
| '\u0c60'..'\u0c61'
| '\u0c66'..'\u0c6f'
| '\u0c82'..'\u0c83'
| '\u0c85'..'\u0c8c'
| '\u0c8e'..'\u0c90'
| '\u0c92'..'\u0ca8'
| '\u0caa'..'\u0cb3'
| '\u0cb5'..'\u0cb9'
| '\u0cbc'..'\u0cc4'
| '\u0cc6'..'\u0cc8'
| '\u0cca'..'\u0ccd'
| '\u0cd5'..'\u0cd6'
| '\u0cde'
| '\u0ce0'..'\u0ce1'
| '\u0ce6'..'\u0cef'
| '\u0d02'..'\u0d03'
| '\u0d05'..'\u0d0c'
| '\u0d0e'..'\u0d10'
| '\u0d12'..'\u0d28'
| '\u0d2a'..'\u0d39'
| '\u0d3e'..'\u0d43'
| '\u0d46'..'\u0d48'
| '\u0d4a'..'\u0d4d'
| '\u0d57'
| '\u0d60'..'\u0d61'
| '\u0d66'..'\u0d6f'
| '\u0d82'..'\u0d83'
| '\u0d85'..'\u0d96'
| '\u0d9a'..'\u0db1'
| '\u0db3'..'\u0dbb'
| '\u0dbd'
| '\u0dc0'..'\u0dc6'
| '\u0dca'
| '\u0dcf'..'\u0dd4'
| '\u0dd6'
| '\u0dd8'..'\u0ddf'
| '\u0df2'..'\u0df3'
| '\u0e01'..'\u0e3a'
| '\u0e3f'..'\u0e4e'
| '\u0e50'..'\u0e59'
| '\u0e81'..'\u0e82'
| '\u0e84'
| '\u0e87'..'\u0e88'
| '\u0e8a'
| '\u0e8d'
| '\u0e94'..'\u0e97'
| '\u0e99'..'\u0e9f'
| '\u0ea1'..'\u0ea3'
| '\u0ea5'
| '\u0ea7'
| '\u0eaa'..'\u0eab'
| '\u0ead'..'\u0eb9'
| '\u0ebb'..'\u0ebd'
| '\u0ec0'..'\u0ec4'
| '\u0ec6'
| '\u0ec8'..'\u0ecd'
| '\u0ed0'..'\u0ed9'
| '\u0edc'..'\u0edd'
| '\u0f00'
| '\u0f18'..'\u0f19'
| '\u0f20'..'\u0f29'
| '\u0f35'
| '\u0f37'
| '\u0f39'
| '\u0f3e'..'\u0f47'
| '\u0f49'..'\u0f6a'
| '\u0f71'..'\u0f84'
| '\u0f86'..'\u0f8b'
| '\u0f90'..'\u0f97'
| '\u0f99'..'\u0fbc'
| '\u0fc6'
| '\u1000'..'\u1021'
| '\u1023'..'\u1027'
| '\u1029'..'\u102a'
| '\u102c'..'\u1032'
| '\u1036'..'\u1039'
| '\u1040'..'\u1049'
| '\u1050'..'\u1059'
| '\u10a0'..'\u10c5'
| '\u10d0'..'\u10f8'
| '\u1100'..'\u1159'
| '\u115f'..'\u11a2'
| '\u11a8'..'\u11f9'
| '\u1200'..'\u1206'
| '\u1208'..'\u1246'
| '\u1248'
| '\u124a'..'\u124d'
| '\u1250'..'\u1256'
| '\u1258'
| '\u125a'..'\u125d'
| '\u1260'..'\u1286'
| '\u1288'
| '\u128a'..'\u128d'
| '\u1290'..'\u12ae'
| '\u12b0'
| '\u12b2'..'\u12b5'
| '\u12b8'..'\u12be'
| '\u12c0'
| '\u12c2'..'\u12c5'
| '\u12c8'..'\u12ce'
| '\u12d0'..'\u12d6'
| '\u12d8'..'\u12ee'
| '\u12f0'..'\u130e'
| '\u1310'
| '\u1312'..'\u1315'
| '\u1318'..'\u131e'
| '\u1320'..'\u1346'
| '\u1348'..'\u135a'
| '\u1369'..'\u1371'
| '\u13a0'..'\u13f4'
| '\u1401'..'\u166c'
| '\u166f'..'\u1676'
| '\u1681'..'\u169a'
| '\u16a0'..'\u16ea'
| '\u16ee'..'\u16f0'
| '\u1700'..'\u170c'
| '\u170e'..'\u1714'
| '\u1720'..'\u1734'
| '\u1740'..'\u1753'
| '\u1760'..'\u176c'
| '\u176e'..'\u1770'
| '\u1772'..'\u1773'
| '\u1780'..'\u17d3'
| '\u17d7'
| '\u17db'..'\u17dd'
| '\u17e0'..'\u17e9'
| '\u180b'..'\u180d'
| '\u1810'..'\u1819'
| '\u1820'..'\u1877'
| '\u1880'..'\u18a9'
| '\u1900'..'\u191c'
| '\u1920'..'\u192b'
| '\u1930'..'\u193b'
| '\u1946'..'\u196d'
| '\u1970'..'\u1974'
| '\u1d00'..'\u1d6b'
| '\u1e00'..'\u1e9b'
| '\u1ea0'..'\u1ef9'
| '\u1f00'..'\u1f15'
| '\u1f18'..'\u1f1d'
| '\u1f20'..'\u1f45'
| '\u1f48'..'\u1f4d'
| '\u1f50'..'\u1f57'
| '\u1f59'
| '\u1f5b'
| '\u1f5d'
| '\u1f5f'..'\u1f7d'
| '\u1f80'..'\u1fb4'
| '\u1fb6'..'\u1fbc'
| '\u1fbe'
| '\u1fc2'..'\u1fc4'
| '\u1fc6'..'\u1fcc'
| '\u1fd0'..'\u1fd3'
| '\u1fd6'..'\u1fdb'
| '\u1fe0'..'\u1fec'
| '\u1ff2'..'\u1ff4'
| '\u1ff6'..'\u1ffc'
| '\u200c'..'\u200f'
| '\u202a'..'\u202e'
| '\u203f'..'\u2040'
| '\u2054'
| '\u2060'..'\u2063'
| '\u206a'..'\u206f'
| '\u2071'
| '\u207f'
| '\u20a0'..'\u20b1'
| '\u20d0'..'\u20dc'
| '\u20e1'
| '\u20e5'..'\u20ea'
| '\u2102'
| '\u2107'
| '\u210a'..'\u2113'
| '\u2115'
| '\u2119'..'\u211d'
| '\u2124'
| '\u2126'
| '\u2128'
| '\u212a'..'\u212d'
| '\u212f'..'\u2131'
| '\u2133'..'\u2139'
| '\u213d'..'\u213f'
| '\u2145'..'\u2149'
| '\u2160'..'\u2183'
| '\u3005'..'\u3007'
| '\u3021'..'\u302f'
| '\u3031'..'\u3035'
| '\u3038'..'\u303c'
| '\u3041'..'\u3096'
| '\u3099'..'\u309a'
| '\u309d'..'\u309f'
| '\u30a1'..'\u30ff'
| '\u3105'..'\u312c'
| '\u3131'..'\u318e'
| '\u31a0'..'\u31b7'
| '\u31f0'..'\u31ff'
| '\u3400'..'\u4db5'
| '\u4e00'..'\u9fa5'
| '\ua000'..'\ua48c'
| '\uac00'..'\ud7a3'
| '\uf900'..'\ufa2d'
| '\ufa30'..'\ufa6a'
| '\ufb00'..'\ufb06'
| '\ufb13'..'\ufb17'
| '\ufb1d'..'\ufb28'
| '\ufb2a'..'\ufb36'
| '\ufb38'..'\ufb3c'
| '\ufb3e'
| '\ufb40'..'\ufb41'
| '\ufb43'..'\ufb44'
| '\ufb46'..'\ufbb1'
| '\ufbd3'..'\ufd3d'
| '\ufd50'..'\ufd8f'
| '\ufd92'..'\ufdc7'
| '\ufdf0'..'\ufdfc'
| '\ufe00'..'\ufe0f'
| '\ufe20'..'\ufe23'
| '\ufe33'..'\ufe34'
| '\ufe4d'..'\ufe4f'
| '\ufe69'
| '\ufe70'..'\ufe74'
| '\ufe76'..'\ufefc'
| '\ufeff'
| '\uff04'
| '\uff10'..'\uff19'
| '\uff21'..'\uff3a'
| '\uff3f'
| '\uff41'..'\uff5a'
| '\uff65'..'\uffbe'
| '\uffc2'..'\uffc7'
| '\uffca'..'\uffcf'
| '\uffd2'..'\uffd7'
| '\uffda'..'\uffdc'
| '\uffe0'..'\uffe1'
| '\uffe5'..'\uffe6'
| '\ufff9'..'\ufffb'
// | ('\ud800'..'\udbff') ('\udc00'..'\udfff')
;
WS
: (
' '
| '\r'
| '\t'
| '\u000C'
| '\n'
)
{
$channel = HIDDEN;
}
;
COMMENT
@init{
boolean isPHPDoc = false;
}
: '/*'
{
if((char)input.LA(1) == '*'){
isPHPDoc = true;
}
}
(options {greedy=false;} : . )*
'*/'
{
if(isPHPDoc==true){
$channel = COMMENT;
}else{
$channel = COMMENT;
}
}
;
LINE_COMMENT
: '#' ~('\n'|'\r')* ('\r\n' | '\r' | '\n') {skip();}
| '#' ~('\n'|'\r')*
{
$channel = COMMENT;
}
| '//' ~('\n'|'\r')* ('\r\n' | '\r' | '\n') {skip();}
| '//' ~('\n'|'\r')* // a line comment could appear at the end of the file without CR/LF
{
$channel = COMMENT;
}
;
|
{
"pile_set_name": "Github"
}
|
//////////////////////////////
// Import Pieces
//////////////////////////////
@import "single/default";
@function breakpoint-parse-single($feature, $empty-media, $first) {
$parsed: '';
$leader: '';
// If we're forcing
@if not ($empty-media) or not ($first) {
$leader: 'and ';
}
// If it's a single feature that can stand alone, we let it
@if (breakpoint-single-string($feature)) {
$parsed: $feature;
// Set Context
$context-setter: private-breakpoint-set-context($feature, $feature);
}
// If it's not a stand alone feature, we pass it off to the default handler.
@else {
$parsed: breakpoint-parse-default($feature);
}
@return $leader + '(' + $parsed + ')';
}
|
{
"pile_set_name": "Github"
}
|
import sys
if sys.version_info < (3, 7):
from ._zsrc import ZsrcValidator
from ._z import ZValidator
from ._ysrc import YsrcValidator
from ._y import YValidator
from ._xsrc import XsrcValidator
from ._x import XValidator
from ._visible import VisibleValidator
from ._valuesrc import ValuesrcValidator
from ._value import ValueValidator
from ._uirevision import UirevisionValidator
from ._uid import UidValidator
from ._textsrc import TextsrcValidator
from ._text import TextValidator
from ._surface import SurfaceValidator
from ._stream import StreamValidator
from ._spaceframe import SpaceframeValidator
from ._slices import SlicesValidator
from ._showscale import ShowscaleValidator
from ._showlegend import ShowlegendValidator
from ._scene import SceneValidator
from ._reversescale import ReversescaleValidator
from ._opacityscale import OpacityscaleValidator
from ._opacity import OpacityValidator
from ._name import NameValidator
from ._metasrc import MetasrcValidator
from ._meta import MetaValidator
from ._lightposition import LightpositionValidator
from ._lighting import LightingValidator
from ._legendgroup import LegendgroupValidator
from ._isomin import IsominValidator
from ._isomax import IsomaxValidator
from ._idssrc import IdssrcValidator
from ._ids import IdsValidator
from ._hovertextsrc import HovertextsrcValidator
from ._hovertext import HovertextValidator
from ._hovertemplatesrc import HovertemplatesrcValidator
from ._hovertemplate import HovertemplateValidator
from ._hoverlabel import HoverlabelValidator
from ._hoverinfosrc import HoverinfosrcValidator
from ._hoverinfo import HoverinfoValidator
from ._flatshading import FlatshadingValidator
from ._customdatasrc import CustomdatasrcValidator
from ._customdata import CustomdataValidator
from ._contour import ContourValidator
from ._colorscale import ColorscaleValidator
from ._colorbar import ColorbarValidator
from ._coloraxis import ColoraxisValidator
from ._cmin import CminValidator
from ._cmid import CmidValidator
from ._cmax import CmaxValidator
from ._cauto import CautoValidator
from ._caps import CapsValidator
from ._autocolorscale import AutocolorscaleValidator
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__,
[],
[
"._zsrc.ZsrcValidator",
"._z.ZValidator",
"._ysrc.YsrcValidator",
"._y.YValidator",
"._xsrc.XsrcValidator",
"._x.XValidator",
"._visible.VisibleValidator",
"._valuesrc.ValuesrcValidator",
"._value.ValueValidator",
"._uirevision.UirevisionValidator",
"._uid.UidValidator",
"._textsrc.TextsrcValidator",
"._text.TextValidator",
"._surface.SurfaceValidator",
"._stream.StreamValidator",
"._spaceframe.SpaceframeValidator",
"._slices.SlicesValidator",
"._showscale.ShowscaleValidator",
"._showlegend.ShowlegendValidator",
"._scene.SceneValidator",
"._reversescale.ReversescaleValidator",
"._opacityscale.OpacityscaleValidator",
"._opacity.OpacityValidator",
"._name.NameValidator",
"._metasrc.MetasrcValidator",
"._meta.MetaValidator",
"._lightposition.LightpositionValidator",
"._lighting.LightingValidator",
"._legendgroup.LegendgroupValidator",
"._isomin.IsominValidator",
"._isomax.IsomaxValidator",
"._idssrc.IdssrcValidator",
"._ids.IdsValidator",
"._hovertextsrc.HovertextsrcValidator",
"._hovertext.HovertextValidator",
"._hovertemplatesrc.HovertemplatesrcValidator",
"._hovertemplate.HovertemplateValidator",
"._hoverlabel.HoverlabelValidator",
"._hoverinfosrc.HoverinfosrcValidator",
"._hoverinfo.HoverinfoValidator",
"._flatshading.FlatshadingValidator",
"._customdatasrc.CustomdatasrcValidator",
"._customdata.CustomdataValidator",
"._contour.ContourValidator",
"._colorscale.ColorscaleValidator",
"._colorbar.ColorbarValidator",
"._coloraxis.ColoraxisValidator",
"._cmin.CminValidator",
"._cmid.CmidValidator",
"._cmax.CmaxValidator",
"._cauto.CautoValidator",
"._caps.CapsValidator",
"._autocolorscale.AutocolorscaleValidator",
],
)
|
{
"pile_set_name": "Github"
}
|
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AggregateSource.Reactive", "AggregateSource.Reactive\AggregateSource.Reactive.csproj", "{37CF3852-C21E-465C-97B9-CC21298E3A40}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AggregateSource.Reactive.Tests", "AggregateSource.Reactive.Tests\AggregateSource.Reactive.Tests.csproj", "{1D472BCC-306A-45C1-9B4E-4F32B0C47232}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AggregateSource", "..\Core\AggregateSource\AggregateSource.csproj", "{CC3FCC99-9E18-45DE-9B39-76031D45624D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release 4.0|Any CPU = Release 4.0|Any CPU
Release 4.5|Any CPU = Release 4.5|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{37CF3852-C21E-465C-97B9-CC21298E3A40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37CF3852-C21E-465C-97B9-CC21298E3A40}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37CF3852-C21E-465C-97B9-CC21298E3A40}.Release 4.0|Any CPU.ActiveCfg = Release 4.0|Any CPU
{37CF3852-C21E-465C-97B9-CC21298E3A40}.Release 4.0|Any CPU.Build.0 = Release 4.0|Any CPU
{37CF3852-C21E-465C-97B9-CC21298E3A40}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU
{37CF3852-C21E-465C-97B9-CC21298E3A40}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU
{37CF3852-C21E-465C-97B9-CC21298E3A40}.Release|Any CPU.ActiveCfg = Release|Any CPU
{37CF3852-C21E-465C-97B9-CC21298E3A40}.Release|Any CPU.Build.0 = Release|Any CPU
{1D472BCC-306A-45C1-9B4E-4F32B0C47232}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D472BCC-306A-45C1-9B4E-4F32B0C47232}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D472BCC-306A-45C1-9B4E-4F32B0C47232}.Release 4.0|Any CPU.ActiveCfg = Release 4.0|Any CPU
{1D472BCC-306A-45C1-9B4E-4F32B0C47232}.Release 4.0|Any CPU.Build.0 = Release 4.0|Any CPU
{1D472BCC-306A-45C1-9B4E-4F32B0C47232}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU
{1D472BCC-306A-45C1-9B4E-4F32B0C47232}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU
{1D472BCC-306A-45C1-9B4E-4F32B0C47232}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D472BCC-306A-45C1-9B4E-4F32B0C47232}.Release|Any CPU.Build.0 = Release|Any CPU
{CC3FCC99-9E18-45DE-9B39-76031D45624D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC3FCC99-9E18-45DE-9B39-76031D45624D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC3FCC99-9E18-45DE-9B39-76031D45624D}.Release 4.0|Any CPU.ActiveCfg = Release|Any CPU
{CC3FCC99-9E18-45DE-9B39-76031D45624D}.Release 4.0|Any CPU.Build.0 = Release|Any CPU
{CC3FCC99-9E18-45DE-9B39-76031D45624D}.Release 4.5|Any CPU.ActiveCfg = Release|Any CPU
{CC3FCC99-9E18-45DE-9B39-76031D45624D}.Release 4.5|Any CPU.Build.0 = Release|Any CPU
{CC3FCC99-9E18-45DE-9B39-76031D45624D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC3FCC99-9E18-45DE-9B39-76031D45624D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
|
{
"pile_set_name": "Github"
}
|
#include "preview_box.hpp"
#include "canvas/canvas_gl.hpp"
#include "pool/symbol.hpp"
#include <sstream>
namespace horizon {
SymbolPreviewBox::SymbolPreviewBox(const std::pair<int, bool> &v)
: Gtk::Box(Gtk::ORIENTATION_VERTICAL, 5), view(v), symbol(UUID::random())
{
auto tbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 5));
auto la = Gtk::manage(new Gtk::Label());
std::stringstream ss;
ss << "<b>";
ss << view.first << "°";
if (view.second) {
ss << " mirrored";
}
ss << "</b>";
la->set_markup(ss.str());
la->set_xalign(0);
tbox->pack_start(*la, true, true, 0);
load_button = Gtk::manage(new Gtk::Button("Load"));
tbox->pack_start(*load_button, false, false, 0);
load_button->signal_clicked().connect([this] { s_signal_load.emit(view.first, view.second); });
set_button = Gtk::manage(new Gtk::Button("Set"));
tbox->pack_start(*set_button, false, false, 0);
set_button->signal_clicked().connect([this] {
if (text_placements.size()) {
set_button->set_label("Set");
clear_placements();
}
else {
set_button->set_label("Clear");
set_placements();
}
});
pack_start(*tbox, false, false, 0);
tbox->show_all();
canvas = Gtk::manage(new CanvasGL());
canvas->set_selection_allowed(false);
pack_start(*canvas, true, true, 0);
canvas->show();
}
void SymbolPreviewBox::update(const Symbol &sym)
{
for (const auto &la : sym.get_layers()) {
canvas->set_layer_display(la.first, LayerDisplay(true, LayerDisplay::Mode::FILL));
}
Placement p;
p.set_angle_deg(view.first);
p.mirror = view.second;
symbol = sym;
symbol.text_placements.clear();
for (const auto &it : text_placements) {
std::tuple<int, bool, UUID> key(view.first, view.second, it.first);
symbol.text_placements[key] = it.second;
}
symbol.apply_placement(p);
for (auto &it : symbol.texts) {
if (it.second.text == "$VALUE")
it.second.text += "\nGroup\nTag";
}
canvas->update(symbol, p);
}
void SymbolPreviewBox::zoom_to_fit()
{
auto bb = canvas->get_bbox();
int64_t pad = 1_mm;
bb.first.x -= pad;
bb.first.y -= pad;
bb.second.x += pad;
bb.second.y += pad;
canvas->zoom_to_bbox(bb.first, bb.second);
}
void SymbolPreviewBox::set_placements()
{
text_placements.clear();
for (const auto &it : symbol.texts) {
text_placements[it.second.uuid] = it.second.placement;
}
s_signal_changed.emit();
}
void SymbolPreviewBox::clear_placements()
{
text_placements.clear();
s_signal_changed.emit();
}
std::map<std::tuple<int, bool, UUID>, Placement> SymbolPreviewBox::get_text_placements() const
{
std::map<std::tuple<int, bool, UUID>, Placement> r;
for (const auto &it : text_placements) {
std::tuple<int, bool, UUID> key(view.first, view.second, it.first);
r[key] = it.second;
}
return r;
}
void SymbolPreviewBox::set_text_placements(const std::map<std::tuple<int, bool, UUID>, Placement> &p)
{
text_placements.clear();
for (const auto &it : p) {
int angle;
bool mirror;
UUID uu;
std::tie(angle, mirror, uu) = it.first;
if (view.first == angle && view.second == mirror) {
text_placements[uu] = it.second;
set_button->set_label("Clear");
}
}
}
void SymbolPreviewBox::set_canvas_appearance(const Appearance &a)
{
canvas->set_appearance(a);
}
void SymbolPreviewBox::set_can_load(bool v)
{
load_button->set_sensitive(v);
}
} // namespace horizon
|
{
"pile_set_name": "Github"
}
|
/*++
Copyright (c) 2013 Minoca Corp.
This project is dual licensed. You are receiving it under the terms of the
GNU General Public License version 3 (GPLv3). Alternative licensing terms are
available. Contact [email protected] for details. See the LICENSE file at the
root of this project for complete licensing information.
Module Name:
sedparse.c
Abstract:
This module implements the script parsing functions for the sed utility.
Author:
Evan Green 11-Jul-2013
Environment:
POSIX
--*/
//
// ------------------------------------------------------------------- Includes
//
#include "sed.h"
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include "../swlib.h"
//
// ---------------------------------------------------------------- Definitions
//
#define SED_REGEX_COMPILE_ERROR_STRING "Failed to compile regular expression: "
#define SED_BRACE_RECURSION_MAX 150
//
// ------------------------------------------------------ Data Type Definitions
//
//
// ----------------------------------------------- Internal Function Prototypes
//
BOOL
SedParseCommand (
PSED_CONTEXT Context,
PSED_COMMAND Parent,
ULONG RecursionDepth,
PSTR *ScriptPointer
);
VOID
SedDestroyCommand (
PSED_CONTEXT Context,
PSED_COMMAND Command
);
BOOL
SedParseAddress (
PSED_CONTEXT Context,
PSTR *ScriptPointer,
PSED_ADDRESS Address,
PBOOL AddressFound
);
VOID
SedDestroyAddress (
PSED_ADDRESS Address
);
BOOL
SedFindRegularExpressionEnd (
PSED_CONTEXT Context,
CHAR Delimiter,
PSTR *ScriptPointer
);
BOOL
SedParseFunction (
PSED_CONTEXT Context,
ULONG RecursionDepth,
PSTR *ScriptPointer,
PSED_COMMAND Command,
PBOOL FunctionFound
);
VOID
SedDestroyFunction (
PSED_CONTEXT Context,
PSED_FUNCTION Function
);
BOOL
SedCreateRegularExpression (
PSED_CONTEXT Context,
PSTR ExpressionString,
UINTN Size,
CHAR Delimiter,
regex_t *Expression
);
BOOL
SedAdvancePastBlanks (
PSED_CONTEXT Context,
PSTR *ScriptPointer
);
BOOL
SedParseText (
PSED_CONTEXT Context,
BOOL AllowEscapes,
BOOL EndAtSpace,
PSTR *ScriptPointer,
PSED_STRING *Text
);
BOOL
SedParseSubstitute (
PSED_CONTEXT Context,
PSED_FUNCTION Function,
PSTR *ScriptPointer
);
BOOL
SedParseCharacterSubstitution (
PSED_CONTEXT Context,
PSED_FUNCTION Function,
PSTR *ScriptPointer
);
VOID
SedParseError (
PSED_CONTEXT Context,
PSTR QuotedArgument,
PSTR String
);
//
// -------------------------------------------------------------------- Globals
//
//
// Convert the commands back to characters for debugging purposes.
//
CHAR SedCommandToCharacterTable[] = {
'?',
'{',
'a',
'b',
'c',
'd',
'D',
'g',
'G',
'h',
'H',
'i',
'l',
'n',
'N',
'p',
'P',
'q',
'r',
's',
't',
'w',
'x',
'y',
':',
'=',
'#',
};
//
// ------------------------------------------------------------------ Functions
//
BOOL
SedAddScriptFile (
PSED_CONTEXT Context,
PSTR Path
)
/*++
Routine Description:
This routine loads a sed script contained in the file at the given path.
Arguments:
Context - Supplies a pointer to the application context.
Path - Supplies a pointer to a string containing the file path of the
script file to load.
Return Value:
TRUE on success.
FALSE on failure.
--*/
{
PSED_STRING FileContents;
PSED_SCRIPT_FRAGMENT Fragment;
BOOL Result;
Fragment = NULL;
//
// Read the file into a null terminated string buffer.
//
FileContents = SedReadFileIn(Path, TRUE);
if (FileContents == NULL) {
Result = FALSE;
goto ParseScriptFileEnd;
}
//
// Allocate and initialize the fragment so that if an error occurs during
// parsing it can be tracked.
//
Fragment = malloc(sizeof(SED_SCRIPT_FRAGMENT));
if (Fragment == NULL) {
Result = FALSE;
goto ParseScriptFileEnd;
}
memset(Fragment, 0, sizeof(SED_SCRIPT_FRAGMENT));
Fragment->FileName = Path;
Fragment->Offset = Context->ScriptString->Size;
Fragment->Size = FileContents->Size;
Result = SedAppendString(Context->ScriptString,
FileContents->Data,
Fragment->Size);
if (Result == FALSE) {
goto ParseScriptFileEnd;
}
SedAppendString(Context->ScriptString, "\n", 2);
INSERT_BEFORE(&(Fragment->ListEntry), &(Context->ScriptList));
Result = TRUE;
ParseScriptFileEnd:
if (FileContents != NULL) {
SedDestroyString(FileContents);
}
if (Result == FALSE) {
if (Fragment != NULL) {
free(Fragment);
}
}
return Result;
}
BOOL
SedAddScriptString (
PSED_CONTEXT Context,
PSTR Script
)
/*++
Routine Description:
This routine loads a sed script into the current context.
Arguments:
Context - Supplies a pointer to the application context.
Script - Supplies a pointer to the null terminated string containing the
script to load.
Return Value:
TRUE on success.
FALSE on failure.
--*/
{
PSED_SCRIPT_FRAGMENT Fragment;
BOOL Result;
//
// Allocate and initialize the fragment so that if an error occurs during
// parsing it can be tracked.
//
Fragment = malloc(sizeof(SED_SCRIPT_FRAGMENT));
if (Fragment == NULL) {
Result = FALSE;
goto SedParseScriptStringEnd;
}
memset(Fragment, 0, sizeof(SED_SCRIPT_FRAGMENT));
Context->CommandLineExpressionCount += 1;
Fragment->ExpressionNumber = Context->CommandLineExpressionCount;
Fragment->Offset = Context->ScriptString->Size;
Fragment->Size = strlen(Script);
Result = SedAppendString(Context->ScriptString, Script, Fragment->Size);
if (Result == FALSE) {
goto SedParseScriptStringEnd;
}
SedAppendString(Context->ScriptString, "\n", 2);
INSERT_BEFORE(&(Fragment->ListEntry), &(Context->ScriptList));
Result = TRUE;
SedParseScriptStringEnd:
if (Result == FALSE) {
if (Fragment != NULL) {
free(Fragment);
}
}
return Result;
}
BOOL
SedParseScript (
PSED_CONTEXT Context,
PSTR Script
)
/*++
Routine Description:
This routine loads a sed script into the current context.
Arguments:
Context - Supplies a pointer to the application context.
Script - Supplies a pointer to the null terminated string containing the
script to load.
Return Value:
TRUE on success.
FALSE on failure.
--*/
{
BOOL Result;
Context->CharacterNumber = 1;
//
// If the first two characters of a script are #n, that's like turning on
// the -n flag. The rest of the line is a comment.
//
if ((*Script == '#') && (*(Script + 1) == 'n')) {
Context->PrintLines = FALSE;
}
//
// Loop parsing commands.
//
Result = TRUE;
while (TRUE) {
if (*Script == '\0') {
break;
}
Result = SedParseCommand(Context, &(Context->HeadCommand), 0, &Script);
if (Result == FALSE) {
goto ParseScriptEnd;
}
}
ParseScriptEnd:
return Result;
}
VOID
SedDestroyCommands (
PSED_CONTEXT Context
)
/*++
Routine Description:
This routine destroys any commands on the given context.
Arguments:
Context - Supplies a pointer to the application context.
Return Value:
None.
--*/
{
PSED_COMMAND Command;
while (LIST_EMPTY(&(Context->HeadCommand.Function.U.ChildList)) == FALSE) {
Command = LIST_VALUE(Context->HeadCommand.Function.U.ChildList.Next,
SED_COMMAND,
ListEntry);
LIST_REMOVE(&(Command->ListEntry));
SedDestroyCommand(Context, Command);
}
return;
}
//
// --------------------------------------------------------- Internal Functions
//
BOOL
SedParseCommand (
PSED_CONTEXT Context,
PSED_COMMAND Parent,
ULONG RecursionDepth,
PSTR *ScriptPointer
)
/*++
Routine Description:
This routine parses a single sed command.
Arguments:
Context - Supplies a pointer to the application context.
Parent - Supplies an optional pointer to a parent command to put this new
command under.
RecursionDepth - Supplies the recursion depth of this command.
ScriptPointer - Supplies a pointer to a pointer to the beginning of the
command. On output, this pointer will be advanced beyond the command
parsed.
Return Value:
TRUE on success.
FALSE on failure.
--*/
{
BOOL AddressFound;
PSED_COMMAND Command;
BOOL FunctionFound;
BOOL Result;
PSTR Script;
Command = NULL;
Script = *ScriptPointer;
//
// Avoid recursing too deeply.
//
if (RecursionDepth >= SED_BRACE_RECURSION_MAX) {
SedParseError(Context, NULL, "Max brace recursion exceeded");
return FALSE;
}
//
// Advance past any blanks, semicolons, and newlines.
//
while (TRUE) {
Result = SedAdvancePastBlanks(Context, &Script);
if (Result == FALSE) {
Result = TRUE;
goto ParseCommandEnd;
}
if ((*Script == ';') || (*Script == '\n') || (*Script == '\r') ||
(*Script == '\v') || (*Script == '\f')) {
Script += 1;
Context->CharacterNumber += 1;
continue;
}
break;
}
//
// Create the command structure.
//
Command = malloc(sizeof(SED_COMMAND));
if (Command == NULL) {
goto ParseCommandEnd;
}
memset(Command, 0, sizeof(SED_COMMAND));
//
// Attempt to parse the first address.
//
Result = SedParseAddress(Context,
&Script,
&(Command->Address[0]),
&AddressFound);
if (Result == FALSE) {
goto ParseCommandEnd;
}
//
// If a first address was found, look for a comma and a second address.
//
if (AddressFound != FALSE) {
Command->AddressCount = 1;
SedAdvancePastBlanks(Context, &Script);
if (*Script == ',') {
Script += 1;
Context->CharacterNumber += 1;
SedAdvancePastBlanks(Context, &Script);
Result = SedParseAddress(Context,
&Script,
&(Command->Address[1]),
&AddressFound);
if (Result == FALSE) {
goto ParseCommandEnd;
}
if (AddressFound != FALSE) {
Command->AddressCount += 1;
SedAdvancePastBlanks(Context, &Script);
}
}
}
//
// Look out for a bang, which seems to affect a command as a whole and
// not a function specifically within a group (though the syntax allows it).
//
if (*Script == '!') {
Command->AddressNegated = TRUE;
Script += 1;
Context->CharacterNumber += 1;
SedAdvancePastBlanks(Context, &Script);
}
if ((*Script == '\0') || (*Script == '\n')) {
SedParseError(Context, NULL, "Missing command");
}
//
// Parse a function.
//
FunctionFound = FALSE;
Result = SedParseFunction(Context,
RecursionDepth,
&Script,
Command,
&FunctionFound);
if (Result == FALSE) {
goto ParseCommandEnd;
}
//
// Get past any blanks and semicolons on the end.
//
while ((*Script == ';') || (isspace(*Script))) {
Script += 1;
Context->CharacterNumber += 1;
SedAdvancePastBlanks(Context, &Script);
}
if (FunctionFound == FALSE) {
goto ParseCommandEnd;
}
//
// Add the function either to the parent or the root context.
//
assert(Parent->Function.Type == SedFunctionGroup);
Command->Parent = Parent;
INSERT_BEFORE(&(Command->ListEntry), &(Parent->Function.U.ChildList));
Result = TRUE;
ParseCommandEnd:
if (Result == FALSE) {
if (Command != NULL) {
SedDestroyCommand(Context, Command);
Command = NULL;
}
}
*ScriptPointer = Script;
return Result;
}
VOID
SedDestroyCommand (
PSED_CONTEXT Context,
PSED_COMMAND Command
)
/*++
Routine Description:
This routine destroys a sed command.
Arguments:
Context - Supplies a pointer to the application context.
Command - Supplies a pointer to the command.
Return Value:
None.
--*/
{
SedDestroyAddress(&(Command->Address[0]));
SedDestroyAddress(&(Command->Address[1]));
if (Command->Function.Type != SedFunctionInvalid) {
SedDestroyFunction(Context, &(Command->Function));
}
free(Command);
return;
}
BOOL
SedParseAddress (
PSED_CONTEXT Context,
PSTR *ScriptPointer,
PSED_ADDRESS Address,
PBOOL AddressFound
)
/*++
Routine Description:
This routine parses a sed address.
Arguments:
Context - Supplies a pointer to the application context.
ScriptPointer - Supplies a pointer to a pointer to the beginning of the
command. On output, this pointer will be advanced beyond the command
parsed.
Address - Supplies a pointer to the address structure to fill in.
AddressFound - Supplies a boolean indicating whether an address was
successfully parsed or not.
Return Value:
TRUE on success.
FALSE on a real failure.
--*/
{
PSTR AfterMatch;
CHAR Delimiter;
PSTR ExpressionBegin;
BOOL Result;
PSTR Script;
*AddressFound = FALSE;
Result = FALSE;
Script = *ScriptPointer;
//
// If it's a dollar sign, that means the last input line.
//
if (*Script == '$') {
*AddressFound = TRUE;
Address->Type = SedAddressLastLine;
Script += 1;
//
// If it's a digit, then this is a specific line number.
//
} else if (isdigit(*Script)) {
Address->Type = SedAddressNumber;
Address->U.Line = strtoll(Script, &AfterMatch, 10);
if ((Address->U.Line < 0) || (AfterMatch == Script)) {
SedParseError(Context, NULL, "Invalid address");
goto ParseAddressEnd;
}
Script = AfterMatch;
*AddressFound = TRUE;
//
// If it's a slash of some kind, this is a basic regular expression.
//
} else if ((*Script == '/') || (*Script == '\\')) {
Delimiter = *Script;
Script += 1;
if (Delimiter == '\\') {
Delimiter = *Script;
Script += 1;
}
if ((Delimiter == '\\') || (Delimiter == '\n')) {
SedParseError(Context, NULL, "Invalid address delimiter");
goto ParseAddressEnd;
}
ExpressionBegin = Script;
//
// Find the ending delimiter.
//
Result = SedFindRegularExpressionEnd(Context, Delimiter, &Script);
if (Result == FALSE) {
SedParseError(Context, NULL, "Unterminated address expression");
goto ParseAddressEnd;
}
assert(*Script == Delimiter);
//
// Make a regular expression out of this.
//
Result = SedCreateRegularExpression(
Context,
ExpressionBegin,
(UINTN)Script - (UINTN)ExpressionBegin,
Delimiter,
&(Address->U.Expression));
if (Result == FALSE) {
goto ParseAddressEnd;
}
Address->Type = SedAddressExpression;
//
// Move over that delimiter.
//
Script += 1;
*AddressFound = TRUE;
}
Result = TRUE;
ParseAddressEnd:
Context->CharacterNumber += (UINTN)Script - (UINTN)(*ScriptPointer);
*ScriptPointer = Script;
return Result;
}
VOID
SedDestroyAddress (
PSED_ADDRESS Address
)
/*++
Routine Description:
This routine destroys a sed address.
Arguments:
Address - Supplies a pointer to the address structure to destroy.
Return Value:
None.
--*/
{
if (Address->Type == SedAddressExpression) {
regfree(&(Address->U.Expression));
}
Address->Type = SedAddressInvalid;
return;
}
BOOL
SedFindRegularExpressionEnd (
PSED_CONTEXT Context,
CHAR Delimiter,
PSTR *ScriptPointer
)
/*++
Routine Description:
This routine finds the end of a regular expression.
Arguments:
Context - Supplies a pointer to the application context.
Delimiter - Supplies the delimiter to search for.
ScriptPointer - Supplies a pointer to a pointer to the beginning of the
command. On output, this pointer will be advanced beyond the command
parsed.
Return Value:
TRUE on success.
FALSE on a real failure.
--*/
{
ULONG BracketCount;
CHAR FunkyBracket;
BOOL Result;
PSTR Script;
BOOL WasBackslash;
BracketCount = 0;
FunkyBracket = 0;
Script = *ScriptPointer;
WasBackslash = FALSE;
while (((*Script != '\n') || (WasBackslash != FALSE)) &&
(*Script != '\0')) {
//
// Found the end if this is the delimiter.
//
if ((WasBackslash == FALSE) && (BracketCount == 0) &&
(*Script == Delimiter)) {
break;
}
//
// If this is an open bracket, up the bracket count.
//
if ((WasBackslash == FALSE) && (*Script == '[') && (BracketCount < 2)) {
BracketCount += 1;
//
// If not already in a funky bracket, look to see if this is a
// funky bracket [: [= or [..
//
if (FunkyBracket == 0) {
if ((*(Script + 1) == ':') || (*(Script + 1) == '=') ||
(*(Script + 1) == '.')) {
FunkyBracket = *(Script + 1);
Script += 1;
//
// This is not the opening of a funky bracket.
//
} else {
//
// There can only be two nested levels of brackets (regular
// and funky), and since this is not funky it must have
// just been a [ opener or [ inside a regular bracket
// expression.
//
BracketCount = 1;
//
// Skip a circumflex and closing brace if it comes right on
// the heels of the open bracket.
//
if (*(Script + 1) == '^') {
Script += 1;
}
if (*(Script + 1) == ']') {
Script += 1;
}
}
}
}
//
// If this is a close brace, handle it. Don't bother validating that
// it's the right funky bracket, but know that if there is a funky
// bracket this is definitely it, as the nesting combos can only be
// "regular" [asdf] , "regular, funky" [as[.d.]f], or "funky" [=a=].
//
if ((BracketCount != 0) && (*Script == ']')) {
BracketCount -= 1;
FunkyBracket = 0;
}
if ((BracketCount == 0) && (*Script == '\\')) {
WasBackslash = !WasBackslash;
} else {
WasBackslash = FALSE;
}
Script += 1;
}
Result = FALSE;
if (*Script == Delimiter) {
Result = TRUE;
}
*ScriptPointer = Script;
return Result;
}
BOOL
SedParseFunction (
PSED_CONTEXT Context,
ULONG RecursionDepth,
PSTR *ScriptPointer,
PSED_COMMAND Command,
PBOOL FunctionFound
)
/*++
Routine Description:
This routine parses a sed function (ie a command with the address already
stripped off).
Arguments:
Context - Supplies a pointer to the application context.
RecursionDepth - Supplies the current recursion depth.
ScriptPointer - Supplies a pointer to a pointer to the beginning of the
command. On output, this pointer will be advanced beyond the command
parsed.
Command - Supplies a pointer to the command containing this function.
FunctionFound - Supplies a pointer where a boolean will be returned
indicating if a function was found or not.
Return Value:
TRUE on success.
FALSE on a real failure.
--*/
{
ULONGLONG CharacterNumber;
CHAR CommandString[2];
PSED_STRING FileName;
PSED_FUNCTION Function;
BOOL Result;
PSTR Script;
INT Status;
Function = &(Command->Function);
*FunctionFound = TRUE;
Result = TRUE;
Script = *ScriptPointer;
//
// Get the command.
//
CommandString[0] = *Script;
Script += 1;
Context->CharacterNumber += 1;
if ((CommandString[0] != 's') && (CommandString[0] != 'y')) {
SedAdvancePastBlanks(Context, &Script);
}
switch (CommandString[0]) {
case '{':
Function->Type = SedFunctionGroup;
INITIALIZE_LIST_HEAD(&(Function->U.ChildList));
CharacterNumber = Context->CharacterNumber - 1;
while ((*Script != '\0') && (*Script != '}')) {
Result = SedParseCommand(Context,
Command,
RecursionDepth + 1,
&Script);
if (Result == FALSE) {
goto ParseFunctionEnd;
}
//
// Get past any blanks and semicolons.
//
while (*Script == ';') {
Script += 1;
Context->CharacterNumber += 1;
SedAdvancePastBlanks(Context, &Script);
}
}
if (*Script == '\0') {
Context->CharacterNumber = CharacterNumber;
SedParseError(Context, NULL, "Unterminated brace argument");
Result = FALSE;
goto ParseFunctionEnd;
}
//
// Advance over the closing brace.
//
Script += 1;
Context->CharacterNumber += 1;
break;
case '}':
SedParseError(Context, NULL, "Unexpected closing brace '}'");
Result = FALSE;
goto ParseFunctionEnd;
case 'a':
Function->Type = SedFunctionPrintTextAtLineEnd;
Result = SedParseText(Context,
TRUE,
FALSE,
&Script,
&(Function->U.StringArgument));
if (Result == FALSE) {
goto ParseFunctionEnd;
}
break;
case 'b':
Function->Type = SedFunctionBranch;
if (*Script != '\0') {
Result = SedParseText(Context,
FALSE,
TRUE,
&Script,
&(Function->U.StringArgument));
if (Result == FALSE) {
goto ParseFunctionEnd;
}
} else {
Function->U.StringArgument = NULL;
}
break;
case 'c':
Function->Type = SedFunctionDeleteAndPrintText;
Result = SedParseText(Context,
TRUE,
FALSE,
&Script,
&(Function->U.StringArgument));
if (Result == FALSE) {
goto ParseFunctionEnd;
}
break;
case 'd':
Function->Type = SedFunctionDelete;
break;
case 'D':
Function->Type = SedFunctionDeleteToNewline;
break;
case 'g':
Function->Type = SedFunctionReplacePatternWithHold;
break;
case 'G':
Function->Type = SedFunctionAppendHoldToPattern;
break;
case 'h':
Function->Type = SedFunctionReplaceHoldWithPattern;
break;
case 'H':
Function->Type = SedFunctionAppendPatternToHold;
break;
case 'i':
Function->Type = SedFunctionPrintText;
Result = SedParseText(Context,
TRUE,
FALSE,
&Script,
&(Function->U.StringArgument));
if (Result == FALSE) {
goto ParseFunctionEnd;
}
break;
case 'l':
Function->Type = SedFunctionWritePatternEscaped;
break;
case 'n':
Function->Type = SedFunctionMoveToNextLine;
break;
case 'N':
Function->Type = SedFunctionAppendNextLine;
break;
case 'p':
Function->Type = SedFunctionWritePattern;
break;
case 'P':
Function->Type = SedFunctionWritePatternToNewline;
break;
case 'q':
Function->Type = SedFunctionQuit;
break;
case 'r':
Function->Type = SedFunctionReadFile;
Result = SedParseText(Context,
FALSE,
FALSE,
&Script,
&(Function->U.StringArgument));
if (Result == FALSE) {
goto ParseFunctionEnd;
}
break;
case 's':
Function->Type = SedFunctionSubstitute;
Result = SedParseSubstitute(Context, Function, &Script);
if (Result == FALSE) {
goto ParseFunctionEnd;
}
break;
case 't':
Function->Type = SedFunctionTest;
if (*Script != '\0') {
Result = SedParseText(Context,
FALSE,
TRUE,
&Script,
&(Function->U.StringArgument));
if (Result == FALSE) {
goto ParseFunctionEnd;
}
} else {
Function->U.StringArgument = NULL;
}
break;
case 'w':
Function->Type = SedFunctionWriteFile;
Result = SedParseText(Context,
FALSE,
FALSE,
&Script,
&FileName);
if (Result == FALSE) {
goto ParseFunctionEnd;
}
Status = SedOpenWriteFile(Context, FileName, &(Function->U.WriteFile));
SedDestroyString(FileName);
if (Status != 0) {
Result = FALSE;
goto ParseFunctionEnd;
}
break;
case 'x':
Function->Type = SedFunctionExchangePatternAndHold;
break;
case 'y':
Function->Type = SedFunctionSubstituteCharacters;
Result = SedParseCharacterSubstitution(Context, Function, &Script);
if (Result == FALSE) {
goto ParseFunctionEnd;
}
break;
case ':':
Function->Type = SedFunctionLabel;
if (*Script != '\0') {
Result = SedParseText(Context,
FALSE,
TRUE,
&Script,
&(Function->U.StringArgument));
if (Result == FALSE) {
goto ParseFunctionEnd;
}
} else {
Function->U.StringArgument = NULL;
}
break;
case '=':
Function->Type = SedFunctionWriteLineNumber;
break;
//
// Handle a comment.
//
case '#':
while ((*Script != '\n') && (*Script != '\0')) {
Script += 1;
Context->CharacterNumber += 1;
}
if (*Script == '\n') {
Script += 1;
Context->CharacterNumber += 1;
}
*FunctionFound = FALSE;
break;
case '\n':
Script += 1;
Context->CharacterNumber += 1;
*FunctionFound = FALSE;
break;
case ';':
Script += 1;
Context->CharacterNumber += 1;
*FunctionFound = FALSE;
break;
default:
Context->CharacterNumber -= 1;
CommandString[1] = '\0';
SedParseError(Context, CommandString, "Unknown command");
*FunctionFound = FALSE;
Result = FALSE;
break;
}
ParseFunctionEnd:
*ScriptPointer = Script;
return Result;
}
VOID
SedDestroyFunction (
PSED_CONTEXT Context,
PSED_FUNCTION Function
)
/*++
Routine Description:
This routine destroys a function.
Arguments:
Context - Supplies a pointer to the application context.
Function - Supplies a pointer to the function to destroy. It's assumed this
function has already been removed from any list it's on.
Return Value:
TRUE on success.
FALSE on failure.
--*/
{
PSED_COMMAND Child;
switch (Function->Type) {
case SedFunctionGroup:
while (LIST_EMPTY(&(Function->U.ChildList)) == FALSE) {
Child = LIST_VALUE(Function->U.ChildList.Next,
SED_COMMAND,
ListEntry);
LIST_REMOVE(&(Child->ListEntry));
SedDestroyCommand(Context, Child);
}
break;
case SedFunctionPrintTextAtLineEnd:
case SedFunctionBranch:
case SedFunctionDeleteAndPrintText:
case SedFunctionPrintText:
case SedFunctionReadFile:
case SedFunctionTest:
case SedFunctionLabel:
if (Function->U.StringArgument != NULL) {
SedDestroyString(Function->U.StringArgument);
}
break;
case SedFunctionSubstitute:
regfree(&(Function->U.Substitute.Expression));
if (Function->U.Substitute.Replacement != NULL) {
SedDestroyString(Function->U.Substitute.Replacement);
}
if (Function->U.Substitute.Matches != NULL) {
free(Function->U.Substitute.Matches);
}
break;
case SedFunctionSubstituteCharacters:
if (Function->U.CharacterSubstitute.Characters != NULL) {
SedDestroyString(Function->U.CharacterSubstitute.Characters);
}
if (Function->U.CharacterSubstitute.Replacement != NULL) {
SedDestroyString(Function->U.CharacterSubstitute.Replacement);
}
break;
case SedFunctionWriteFile:
case SedFunctionDelete:
case SedFunctionDeleteToNewline:
case SedFunctionReplacePatternWithHold:
case SedFunctionAppendHoldToPattern:
case SedFunctionReplaceHoldWithPattern:
case SedFunctionAppendPatternToHold:
case SedFunctionWritePatternEscaped:
case SedFunctionMoveToNextLine:
case SedFunctionAppendNextLine:
case SedFunctionWritePattern:
case SedFunctionWritePatternToNewline:
case SedFunctionQuit:
case SedFunctionExchangePatternAndHold:
case SedFunctionWriteLineNumber:
case SedFunctionNop:
break;
default:
assert(FALSE);
break;
}
return;
}
BOOL
SedCreateRegularExpression (
PSED_CONTEXT Context,
PSTR ExpressionString,
UINTN Size,
CHAR Delimiter,
regex_t *Expression
)
/*++
Routine Description:
This routine creates a regular expression from a string.
Arguments:
Context - Supplies a pointer to the application context.
ExpressionString - Supplies a pointer to the beginning of the string
containing the regular expression.
Size - Supplies the size of the string in bytes.
Delimiter - Supplies the delimiter character.
Expression - Supplies a pointer where the compiled expression will be
returned on success.
Return Value:
TRUE on success.
FALSE on failure.
--*/
{
CHAR Character;
UINTN CopyIndex;
CHAR ErrorString[512];
UINTN Index;
ULONG RemainingSize;
BOOL Result;
int Status;
PSED_STRING String;
PSED_STRING SwapString;
Result = FALSE;
if (Size == 0) {
String = Context->PreviousRegularExpression;
if (String == NULL) {
SedParseError(Context, NULL, "No previous regular expression");
goto CreateRegularExpressionEnd;
}
} else {
//
// Create a copy of the expression string. This also null terminates it.
//
String = SedCreateString(ExpressionString, Size, TRUE);
if (String == NULL) {
goto CreateRegularExpressionEnd;
}
//
// Go through the expression and 1) remove any backslashes followed by
// the delimiter and 2) replace \n with the newline character.
//
Index = 0;
while (Index < String->Size - 1) {
if (String->Data[Index] == '\\') {
Character = String->Data[Index + 1];
if ((Character == 'n') || (Character == '\n') ||
(Character == Delimiter)) {
if (Character != Delimiter) {
Character = '\n';
}
//
// Replace the combination with the replacement character.
//
String->Data[Index] = Character;
//
// Move all the other characters down by one, and shrink
// the size by one.
//
for (CopyIndex = Index + 1;
CopyIndex < String->Size - 1;
CopyIndex += 1) {
String->Data[CopyIndex] = String->Data[CopyIndex + 1];
}
String->Size -= 1;
}
}
Index += 1;
}
}
//
// A string was found. Compile that regular expression.
//
Status = regcomp(Expression, String->Data, 0);
if (Status != 0) {
assert(sizeof(ErrorString) > sizeof(SED_REGEX_COMPILE_ERROR_STRING));
strcpy(ErrorString, SED_REGEX_COMPILE_ERROR_STRING);
RemainingSize = sizeof(ErrorString) -
sizeof(SED_REGEX_COMPILE_ERROR_STRING) + 1;
regerror(Status,
Expression,
ErrorString + sizeof(SED_REGEX_COMPILE_ERROR_STRING) - 1,
RemainingSize);
SedParseError(Context, ExpressionString, ErrorString);
goto CreateRegularExpressionEnd;
}
//
// Make this the new previous regular expression if it isn't already.
//
if (String != Context->PreviousRegularExpression) {
SwapString = String;
String = Context->PreviousRegularExpression;
Context->PreviousRegularExpression = SwapString;
} else {
String = NULL;
}
Result = TRUE;
CreateRegularExpressionEnd:
if (String != NULL) {
SedDestroyString(String);
}
return Result;
}
BOOL
SedAdvancePastBlanks (
PSED_CONTEXT Context,
PSTR *ScriptPointer
)
/*++
Routine Description:
This routine advances beyond any whitespace in the string.
Arguments:
Context - Supplies a pointer to the application context.
ScriptPointer - Supplies a pointer to a pointer to the beginning of the
blanks. On output, this pointer will be advanced beyond any blanks.
Return Value:
TRUE if there is more to the string.
FALSE if the string terminated before non-blanks were found.
--*/
{
PSTR Script;
Script = *ScriptPointer;
while (isblank(*Script)) {
Context->CharacterNumber += 1;
Script += 1;
}
*ScriptPointer = Script;
if (*Script == '\0') {
return FALSE;
}
return TRUE;
}
BOOL
SedParseText (
PSED_CONTEXT Context,
BOOL AllowEscapes,
BOOL EndAtSpace,
PSTR *ScriptPointer,
PSED_STRING *Text
)
/*++
Routine Description:
This routine parses a single text argument, used by many commands.
Arguments:
Context - Supplies a pointer to the application context.
AllowEscapes - Supplies a boolean indicating whether backslash escapes
text or not.
EndAtSpace - Supplies a boolean indicating whether the text ends at the
first space or not.
ScriptPointer - Supplies a pointer to a pointer to the beginning of the
blanks. On output, this pointer will be advanced beyond any blanks.
Text - Supplies a pointer where a pointer to the allocated text to print
will be returned on success. It is the caller's responsibility to
destroy this string.
Return Value:
TRUE on success.
FALSE if the string terminated before non-blanks were found.
--*/
{
CHAR Character;
BOOL Result;
PSTR Script;
PSED_STRING String;
BOOL TextAdded;
BOOL WasBackslash;
Result = FALSE;
Script = *ScriptPointer;
TextAdded = FALSE;
String = SedCreateString(NULL, 0, TRUE);
if (String == NULL) {
goto ParseTextEnd;
}
//
// If escapes are allowed and the first thing is an escaped newline, skip
// it.
//
if ((AllowEscapes != FALSE) &&
(*Script == '\\') && (*(Script + 1) == '\n')) {
Script += 2;
Context->LineNumber += 1;
}
WasBackslash = FALSE;
while (TRUE) {
Character = *Script;
if (Character == '\0') {
break;
}
Script += 1;
if (Character == '\n') {
Context->LineNumber += 1;
}
if ((WasBackslash != FALSE) && (AllowEscapes != FALSE)) {
//
// Certain characters can be escaped into fancier characters.
//
if (Character == 'n') {
Character = '\n';
} else if (Character == 'v') {
Character = '\v';
} else if (Character == 'f') {
Character = '\f';
} else if (Character == 't') {
Character = '\t';
} else if (Character == 'r') {
Character = '\r';
} else if (Character == 'b') {
Character = '\b';
} else if (Character == 'a') {
Character = '\a';
}
} else {
//
// A non-escaped newline or sometimes a space is the end of the
// text.
//
if ((Character == '\n') ||
((EndAtSpace != FALSE) &&
((Character == ' ') || (Character == ';') ||
(Character == '#')))) {
Script -= 1;
break;
}
}
//
// Add this character as long as it wasn't a backslash (or escapes are
// not allowed).
//
if ((AllowEscapes == FALSE) ||
(Character != '\\') ||
(WasBackslash != FALSE)) {
Result = SedAppendString(String, &Character, 1);
if (Result == FALSE) {
goto ParseTextEnd;
}
TextAdded = TRUE;
}
//
// Keep track of whether the previous character was a backslash.
//
if (Character == '\\') {
WasBackslash = !WasBackslash;
} else {
WasBackslash = FALSE;
}
}
Result = TRUE;
ParseTextEnd:
Context->CharacterNumber += (UINTN)Script - (UINTN)(*ScriptPointer);
*ScriptPointer = Script;
if ((Result == FALSE) || (TextAdded == FALSE)) {
if (String != NULL) {
SedDestroyString(String);
String = NULL;
}
}
*Text = String;
return Result;
}
BOOL
SedParseSubstitute (
PSED_CONTEXT Context,
PSED_FUNCTION Function,
PSTR *ScriptPointer
)
/*++
Routine Description:
This routine parses a substitute (s) function.
Arguments:
Context - Supplies a pointer to the application context.
Function - Supplies a pointer to the function to fill in.
ScriptPointer - Supplies a pointer to a pointer to the beginning of the
blanks. On output, this pointer will be advanced beyond any blanks.
Return Value:
TRUE on success.
FALSE if the string terminated before non-blanks were found.
--*/
{
ULONG AllocationSize;
CHAR Delimiter;
PSTR ExpressionBegin;
ULONG Flags;
CHAR FlagsString[2];
PSED_STRING Replacement;
PSTR ReplacementBegin;
BOOL Result;
PSTR Script;
UINTN Size;
int Status;
BOOL WasBackslash;
PSTR WriteFileBegin;
PSED_STRING WriteFileName;
assert(Function->Type == SedFunctionSubstitute);
Result = FALSE;
Script = *ScriptPointer;
//
// Get the delimiter.
//
Delimiter = *Script;
Script += 1;
if (Delimiter == '\0') {
SedParseError(Context, NULL, "Expected argument for command s");
goto ParseSubstituteEnd;
}
if ((Delimiter == '\\') || (Delimiter == '\n')) {
SedParseError(Context, NULL, "Illegal delimiter for s command");
goto ParseSubstituteEnd;
}
ExpressionBegin = Script;
Result = SedFindRegularExpressionEnd(Context, Delimiter, &Script);
if (Result == FALSE) {
SedParseError(Context,
NULL,
"Unterminated regular expression in s command");
goto ParseSubstituteEnd;
}
Size = (UINTN)Script - (UINTN)ExpressionBegin;
//
// Create the regular expression.
//
Result = SedCreateRegularExpression(Context,
ExpressionBegin,
Size,
Delimiter,
&(Function->U.Substitute.Expression));
if (Result == FALSE) {
goto ParseSubstituteEnd;
}
//
// Advance beyond the delimiter into the substitute string.
//
Script += 1;
WasBackslash = FALSE;
Size = 0;
ReplacementBegin = Script;
while (TRUE) {
if (((*Script == '\n') && (WasBackslash == FALSE)) ||
(*Script == '\0')) {
SedParseError(Context,
NULL,
"Unterminated replacement text in s command");
Result = FALSE;
goto ParseSubstituteEnd;
}
if (WasBackslash == FALSE) {
if (*Script == Delimiter) {
break;
}
}
if (*Script == '\\') {
WasBackslash = !WasBackslash;
} else {
WasBackslash = FALSE;
}
Size += 1;
Script += 1;
}
//
// Create the replacement string.
//
Replacement = SedCreateString(ReplacementBegin, Size, TRUE);
if (Replacement == NULL) {
Result = FALSE;
goto ParseSubstituteEnd;
}
Function->U.Substitute.Replacement = Replacement;
//
// Advance beyond the replacement into the flags.
//
Flags = 0;
Script += 1;
while (TRUE) {
//
// Watch out for the end.
//
if ((isblank(*Script)) || (*Script == '\n') || (*Script == '\0') ||
(*Script == ';')) {
break;
//
// If it's a digit, replace only the nth occurrence.
//
} else if (isdigit(*Script)) {
Function->U.Substitute.OccurrenceNumber = *Script - '0';
Script += 1;
} else if (*Script == 'g') {
Flags |= SED_SUBSTITUTE_FLAG_GLOBAL;
Script += 1;
} else if (*Script == 'p') {
Flags |= SED_SUBSTITUTE_FLAG_PRINT;
Script += 1;
} else if (*Script == 'w') {
Flags |= SED_SUBSTITUTE_FLAG_WRITE;
Script += 1;
} else {
FlagsString[0] = *Script;
FlagsString[1] = '\0';
SedParseError(Context, FlagsString, "Unknown flag");
Result = FALSE;
goto ParseSubstituteEnd;
}
}
Function->U.Substitute.Flags = Flags;
while (isblank(*Script)) {
Script += 1;
}
//
// If the write flag is set, then the next argument is a file name.
//
if ((Flags & SED_SUBSTITUTE_FLAG_WRITE) != 0) {
if ((*Script == '\0') || (*Script == '\n') || (*Script == ';')) {
SedParseError(Context, NULL, "Expected write file name");
Result = FALSE;
goto ParseSubstituteEnd;
}
WriteFileBegin = Script;
Size = 0;
while ((*Script != '\0') && (*Script != '\n') && (*Script != ';')) {
Script += 1;
Size += 1;
}
WriteFileName = SedCreateString(WriteFileBegin, Size, TRUE);
if (WriteFileName == NULL) {
goto ParseSubstituteEnd;
}
Status = SedOpenWriteFile(Context,
WriteFileName,
&(Function->U.Substitute.WriteFile));
SedDestroyString(WriteFileName);
if (Status != 0) {
Result = FALSE;
goto ParseSubstituteEnd;
}
}
//
// Allocate a match array.
//
AllocationSize = 10 * sizeof(regmatch_t);
Function->U.Substitute.Matches = malloc(AllocationSize);
if (Function->U.Substitute.Matches == NULL) {
Result = FALSE;
goto ParseSubstituteEnd;
}
Function->U.Substitute.MatchCount = 10;
Result = TRUE;
ParseSubstituteEnd:
Context->CharacterNumber += (UINTN)Script - (UINTN)(*ScriptPointer);
*ScriptPointer = Script;
return Result;
}
BOOL
SedParseCharacterSubstitution (
PSED_CONTEXT Context,
PSED_FUNCTION Function,
PSTR *ScriptPointer
)
/*++
Routine Description:
This routine parses the argument for a character replacement command.
Arguments:
Context - Supplies a pointer to the application context.
Function - Supplies a pointer to the character replacement function.
ScriptPointer - Supplies a pointer to a pointer to the beginning of the
blanks. On output, this pointer will be advanced beyond any blanks.
Return Value:
TRUE on success.
FALSE if the string terminated before non-blanks were found.
--*/
{
CHAR Character;
CHAR Delimiter;
BOOL Result;
PSTR Script;
PSED_STRING String[2];
ULONG StringIndex;
BOOL WasBackslash;
assert(Function->Type == SedFunctionSubstituteCharacters);
Result = FALSE;
Script = *ScriptPointer;
String[0] = NULL;
String[1] = NULL;
//
// Get the delimiter.
//
Delimiter = *Script;
if ((Delimiter == '\0') || (Delimiter == '\n') || (Delimiter == '\\')) {
SedParseError(Context,
NULL,
"Invalid character substitution delimimiter");
goto ParseCharacterSubsitutionEnd;
}
Script += 1;
//
// Loop getting the two character arrays.
//
for (StringIndex = 0; StringIndex < 2; StringIndex += 1) {
String[StringIndex] = SedCreateString(NULL, 0, TRUE);
if (String[StringIndex] == NULL) {
goto ParseCharacterSubsitutionEnd;
}
WasBackslash = FALSE;
while (TRUE) {
Character = *Script;
Script += 1;
if ((Character == '\0') || (Character == '\n')) {
SedParseError(Context,
NULL,
"Unterminated character substitution");
Result = FALSE;
goto ParseCharacterSubsitutionEnd;
}
if (WasBackslash != FALSE) {
//
// Certain characters can be escaped into fancier characters.
//
if (Character == 'n') {
Character = '\n';
} else if (Character == 'v') {
Character = '\v';
} else if (Character == 'f') {
Character = '\f';
} else if (Character == 't') {
Character = '\t';
} else if (Character == 'r') {
Character = '\r';
} else if (Character == 'b') {
Character = '\b';
} else if (Character == 'a') {
Character = '\a';
}
} else {
//
// A non-escaped delimiter is the end.
//
if (Character == Delimiter) {
break;
}
}
//
// Add this character as long as it wasn't a backslash.
//
if ((Character != '\\') || (WasBackslash != FALSE)) {
Result = SedAppendString(String[StringIndex], &Character, 1);
if (Result == FALSE) {
goto ParseCharacterSubsitutionEnd;
}
}
//
// Keep track of whether the previous character was a backslash.
//
if (Character == '\\') {
WasBackslash = !WasBackslash;
} else {
WasBackslash = FALSE;
}
}
}
//
// The strings really need to be the same length.
//
if (String[0]->Size != String[1]->Size) {
SedParseError(Context,
NULL,
"Character strings for 'y' are different lengths");
Result = FALSE;
goto ParseCharacterSubsitutionEnd;
}
Result = TRUE;
ParseCharacterSubsitutionEnd:
Context->CharacterNumber += (UINTN)Script - (UINTN)(*ScriptPointer);
*ScriptPointer = Script;
if (Result == FALSE) {
if (String[0] != NULL) {
SedDestroyString(String[0]);
String[0] = NULL;
}
if (String[1] != NULL) {
SedDestroyString(String[1]);
String[1] = NULL;
}
}
Function->U.CharacterSubstitute.Characters = String[0];
Function->U.CharacterSubstitute.Replacement = String[1];
return Result;
}
VOID
SedParseError (
PSED_CONTEXT Context,
PSTR QuotedArgument,
PSTR String
)
/*++
Routine Description:
This routine prints a sed script parsing error.
Arguments:
Context - Supplies a pointer to the application context.
QuotedArgument - Supplies an optional quoted string that will get put at
the end of the error string.
String - Supplies a pointer to a string containing the error to print.
Return Value:
None.
--*/
{
PLIST_ENTRY CurrentEntry;
PSTR CurrentString;
PSED_SCRIPT_FRAGMENT Fragment;
UINTN FragmentOffset;
ULONG Line;
UINTN Offset;
Offset = Context->CharacterNumber;
assert(LIST_EMPTY(&(Context->ScriptList)) == FALSE);
//
// Figure out which fragment this error originated in.
//
CurrentEntry = Context->ScriptList.Next;
while (CurrentEntry != &(Context->ScriptList)) {
Fragment = LIST_VALUE(CurrentEntry, SED_SCRIPT_FRAGMENT, ListEntry);
if (Fragment->Offset + Fragment->Size > Offset) {
break;
}
CurrentEntry = CurrentEntry->Next;
}
if (CurrentEntry == &(Context->ScriptList)) {
Fragment = LIST_VALUE(Context->ScriptList.Previous,
SED_SCRIPT_FRAGMENT,
ListEntry);
}
//
// The found fragment should really have started before the error.
//
assert(Fragment->Offset <= Offset);
//
// Figure out what line number the error was in.
//
CurrentString = Context->ScriptString->Data + Fragment->Offset - 1;
FragmentOffset = 0;
Line = 1;
while (Fragment->Offset + FragmentOffset < Offset) {
if (*CurrentString == '\n') {
Line += 1;
}
FragmentOffset += 1;
CurrentString += 1;
}
if (Fragment->ExpressionNumber != 0) {
if (Line != 1) {
SwPrintError(0,
QuotedArgument,
"Error parsing expression #%d, char %d, line %d: %s",
Fragment->ExpressionNumber,
(ULONG)FragmentOffset + 1,
Line,
String);
} else {
SwPrintError(0,
QuotedArgument,
"Error parsing expression #%d, char %d: %s",
Fragment->ExpressionNumber,
(ULONG)FragmentOffset + 1,
String);
}
} else {
SwPrintError(0,
QuotedArgument,
"Error parsing file '%s', line %d, char %d: %s",
Fragment->FileName,
Line,
(ULONG)FragmentOffset + 1,
String);
}
return;
}
|
{
"pile_set_name": "Github"
}
|
const { promisify } = require('util')
const binding = require('bindings')('bindings.node')
const AbstractBinding = require('@serialport/binding-abstract')
const linuxList = require('./linux-list')
const Poller = require('./poller')
const unixRead = require('./unix-read')
const unixWrite = require('./unix-write')
const { wrapWithHiddenComName } = require('./legacy')
const defaultBindingOptions = Object.freeze({
vmin: 1,
vtime: 0,
})
const asyncOpen = promisify(binding.open)
const asyncClose = promisify(binding.close)
const asyncUpdate = promisify(binding.update)
const asyncSet = promisify(binding.set)
const asyncGet = promisify(binding.get)
const asyncGetBaudRate = promisify(binding.getBaudRate)
const asyncDrain = promisify(binding.drain)
const asyncFlush = promisify(binding.flush)
/**
* The linux binding layer
*/
class LinuxBinding extends AbstractBinding {
static list() {
return wrapWithHiddenComName(linuxList())
}
constructor(opt = {}) {
super(opt)
this.bindingOptions = { ...defaultBindingOptions, ...opt.bindingOptions }
this.fd = null
this.writeOperation = null
}
get isOpen() {
return this.fd !== null
}
async open(path, options) {
await super.open(path, options)
this.openOptions = { ...this.bindingOptions, ...options }
const fd = await asyncOpen(path, this.openOptions)
this.fd = fd
this.poller = new Poller(fd)
}
async close() {
await super.close()
const fd = this.fd
this.poller.stop()
this.poller.destroy()
this.poller = null
this.openOptions = null
this.fd = null
return asyncClose(fd)
}
async read(buffer, offset, length) {
await super.read(buffer, offset, length)
return unixRead({ binding: this, buffer, offset, length })
}
async write(buffer) {
this.writeOperation = super.write(buffer).then(async () => {
if (buffer.length === 0) {
return
}
await unixWrite({ binding: this, buffer })
this.writeOperation = null
})
return this.writeOperation
}
async update(options) {
await super.update(options)
return asyncUpdate(this.fd, options)
}
async set(options) {
await super.set(options)
return asyncSet(this.fd, options)
}
async get() {
await super.get()
return asyncGet(this.fd)
}
async getBaudRate() {
await super.get()
return asyncGetBaudRate(this.fd)
}
async drain() {
await super.drain()
await this.writeOperation
return asyncDrain(this.fd)
}
async flush() {
await super.flush()
return asyncFlush(this.fd)
}
}
module.exports = LinuxBinding
|
{
"pile_set_name": "Github"
}
|
# CGI SAPI
|
{
"pile_set_name": "Github"
}
|
package com.baidu.rasp;
public class MysqlServlet extends BaseSqlServlet {
@Override
public void loadProperties() {
driver = "com.mysql.jdbc.Driver";
dbUrl = properties.getProperty("mysqlurl") + fileSeparator + properties.getProperty("mysqldb");
user = properties.getProperty("mysqluser");
password = properties.getProperty("mysqlpassword");
table = properties.getProperty("mysqltable");
checkField = properties.getProperty("mysqlcheckfield");
stringResult = properties.getProperty("mysqlstringresult");
intResult = properties.getProperty("mysqlintresult");
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.lang.findUsages;
import com.intellij.lang.Language;
import com.intellij.lang.LanguageExtension;
import com.intellij.lang.cacheBuilder.WordsScanner;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
/**
* @author yole
*/
public class LanguageFindUsages extends LanguageExtension<FindUsagesProvider> {
public static final LanguageFindUsages INSTANCE = new LanguageFindUsages() {
@NotNull
@Override
public List<FindUsagesProvider> allForLanguage(@NotNull Language language) {
List<FindUsagesProvider> result = super.allForLanguage(language);
if (result.isEmpty() ) {
return Collections.singletonList(getDefaultImplementation());
}
return result;
}
};
private LanguageFindUsages() {
super("com.intellij.lang.findUsagesProvider", new EmptyFindUsagesProvider());
}
/**
* {@link FindUsagesProvider#canFindUsagesFor(PsiElement)}
* @return true iff could be found usages by some provider for this element
*/
public static boolean canFindUsagesFor(@NotNull PsiElement psiElement) {
return getFromProviders(psiElement, Boolean.FALSE, p -> p.canFindUsagesFor(psiElement));
}
/**
* {@link FindUsagesProvider#getWordsScanner()}
* @return a word-scanner specified by some provider or null
*/
@Nullable
public static WordsScanner getWordsScanner(@NotNull Language language) {
for (FindUsagesProvider provider : INSTANCE.allForLanguage(language)) {
WordsScanner scanner = provider.getWordsScanner();
if (scanner != null) {
return scanner;
}
}
return null;
}
/**
* {@link FindUsagesProvider#getDescriptiveName(PsiElement)}
* @return specified by some provider non-empty user-visible descriptive name or empty string
*/
@NotNull
public static String getDescriptiveName(@NotNull PsiElement psiElement) {
return getFromProviders(psiElement, "", p -> p.getDescriptiveName(psiElement));
}
/**
* {@link FindUsagesProvider#getType(PsiElement)}
* @return specified by some provider non-empty user-visible type name or empty string
*/
@NotNull
public static String getType(@NotNull PsiElement psiElement) {
return getFromProviders(psiElement, "", p -> p.getType(psiElement));
}
/**
* {@link FindUsagesProvider#getNodeText(PsiElement, boolean)}
* @return specified by some provider the text representing the specified PSI element in the Find Usages tree or empty string
*/
@NotNull
public static String getNodeText(@NotNull PsiElement psiElement, boolean useFullName) {
return getFromProviders(psiElement, "", p -> p.getNodeText(psiElement, useFullName));
}
/**
* {@link FindUsagesProvider#getHelpId(PsiElement)}
* @return specified by some provider ID of the help topic
*/
@Nullable
public static String getHelpId(@NotNull PsiElement psiElement) {
return getFromProviders(psiElement, null, p -> p.getHelpId(psiElement));
}
private static <T> T getFromProviders(@NotNull PsiElement psiElement,
T defaultValue, @NotNull Function<? super FindUsagesProvider, ? extends T> getter) {
Language language = psiElement.getLanguage();
List<FindUsagesProvider> providers = INSTANCE.allForLanguage(language);
assert !providers.isEmpty() : "Element: " + psiElement + ", language: " + language;
for (FindUsagesProvider provider : providers) {
T res = getter.apply(provider);
if (res != null && !res.equals(defaultValue)) {
return res;
}
}
return defaultValue;
}
}
|
{
"pile_set_name": "Github"
}
|
## How To Contribute
We are always very happy to have contributions, whether for trivial cleanups or big new features.
We want to have high quality, well documented codes for each programming language, as well as the surrounding [ecosystem](https://github.com/apache/rocketmq-externals) of integration tools that people use with RocketMQ.
Nor is code the only way to contribute to the project. We strongly value documentation, integration with other project, and gladly accept improvements for these aspects.
## Contributing code
To submit a change for inclusion, please do the following:
#### If the change is non-trivial please include some unit tests that cover the new functionality.
#### If you are introducing a completely new feature or API it is a good idea to start a wiki and get consensus on the basic design first.
#### It is our job to follow up on patches in a timely fashion. Nag us if we aren't doing our job (sometimes we drop things).
## Becoming a Committer
We are always interested in adding new contributors. What we look for are series of contributions, good taste and ongoing interest in the project. If you are interested in becoming a committer, please let one of the existing committers know and they can help you walk through the process.
Nowadays,we have several important contribution points:
#### Wiki & JavaDoc
#### RocketMQ Console
#### RocketMQ SDK(C++\.Net\Php\Python\Go\Node.js)
#### RocketMQ MySQL(Oracle\PostgreSQL\Redis\MongoDB\HBase\MSSQL) Replicator
##### Prerequisite
If you want to contribute the above listing points, you must abide our some prerequisites:
###### Readability - API must have Javadoc,some very important methods also must have javadoc
###### Testability - 80% above unit test coverage about main process
###### Maintainability - Comply with our [checkstyle spec](style/rmq_checkstyle.xml), and at least 3 month update frequency
###### Deployability - We encourage you to deploy into [maven repository](http://search.maven.org/)
|
{
"pile_set_name": "Github"
}
|
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <unordered_map>
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
// class Alloc = allocator<pair<const Key, T>>>
// class unordered_multimap
// {
// public:
// // types
// typedef Key key_type;
// typedef T mapped_type;
// typedef Hash hasher;
// typedef Pred key_equal;
// typedef Alloc allocator_type;
// typedef pair<const key_type, mapped_type> value_type;
// typedef value_type& reference;
// typedef const value_type& const_reference;
// typedef typename allocator_traits<allocator_type>::pointer pointer;
// typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
// typedef typename allocator_traits<allocator_type>::size_type size_type;
// typedef typename allocator_traits<allocator_type>::difference_type difference_type;
#include <unordered_map>
#include <type_traits>
#include "min_allocator.h"
int main()
{
{
typedef std::unordered_multimap<char, short> C;
static_assert((std::is_same<C::key_type, char>::value), "");
static_assert((std::is_same<C::mapped_type, short>::value), "");
static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
static_assert((std::is_same<C::allocator_type, std::allocator<C::value_type> >::value), "");
static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
static_assert((std::is_same<C::reference, C::value_type&>::value), "");
static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
static_assert((std::is_same<C::pointer, C::value_type*>::value), "");
static_assert((std::is_same<C::const_pointer, const C::value_type*>::value), "");
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#if __cplusplus >= 201103L
{
typedef std::unordered_multimap<char, short, std::hash<char>, std::equal_to<char>,
min_allocator<std::pair<const char, short>>> C;
static_assert((std::is_same<C::key_type, char>::value), "");
static_assert((std::is_same<C::mapped_type, short>::value), "");
static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
static_assert((std::is_same<C::reference, C::value_type&>::value), "");
static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
// min_allocator doesn't have a size_type, so one gets synthesized
static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#endif
}
|
{
"pile_set_name": "Github"
}
|
# frozen_string_literal: true
Gem::Specification.new "samson_jenkins", "0.0.0" do |s|
s.summary = "Samson jenkins integration"
s.authors = ["Rupinder Dhanoa "]
s.email = "[email protected]"
s.add_runtime_dependency "jenkins_api_client", "~> 1.3"
end
|
{
"pile_set_name": "Github"
}
|
package io.boden.android;
import android.text.TextWatcher;
import android.text.Editable;
import android.widget.TextView;
public class NativeEditTextTextWatcher extends Object implements TextWatcher
{
public NativeEditTextTextWatcher(TextView view)
{
_view = view;
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
nativeBeforeTextChanged(_view, s.toString(), start, count, after);
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
nativeOnTextChanged(_view, s.toString(), start, before, count);
}
@Override
public void afterTextChanged(Editable s) {
nativeAfterTextChanged(_view);
}
public native void nativeBeforeTextChanged(TextView view, String string, int start, int count, int after);
public native void nativeOnTextChanged(TextView view, String string, int start, int before, int count);
public native void nativeAfterTextChanged(TextView view);
private TextView _view;
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
package io.ktor.util
import kotlin.reflect.*
@Suppress("ACTUAL_WITHOUT_EXPECT")
internal actual typealias CoroutineStackFrame = kotlin.coroutines.jvm.internal.CoroutineStackFrame
@Suppress("ACTUAL_WITHOUT_EXPECT")
internal actual typealias StackTraceElement = java.lang.StackTraceElement
@Suppress("FunctionName")
internal actual fun createStackTraceElement(
kClass: KClass<*>,
methodName: String,
fileName: String,
lineNumber: Int
): StackTraceElement {
return java.lang.StackTraceElement(
kClass.java.name,
methodName,
fileName, lineNumber
)
}
|
{
"pile_set_name": "Github"
}
|
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) 2015 Nuxi, https://nuxi.nl/
//
// SPDX-License-Identifier: BSD-2-Clause
#include <ctype.h>
int isprint(int c) {
return c >= ' ' && c <= '~';
}
|
{
"pile_set_name": "Github"
}
|
GLPSOL: GLPK LP/MIP Solver, v4.47
Parameter(s) specified in the command line:
--math GSS.mod
Reading model section from GSS.mod...
Reading data section from GSS.mod...
38 lines were read
Generating s...
Generating sos1...
Model has been successfully generated
GLPK Integer Optimizer, v4.47
2 rows, 21 columns, 41 non-zeros
21 integer variables, all of which are binary
Preprocessing...
1 row, 21 columns, 21 non-zeros
21 integer variables, all of which are binary
Scaling...
A: min|aij| = 1.000e+000 max|aij| = 1.000e+000 ratio = 1.000e+000
Problem data seem to be well scaled
Constructing initial basis...
Size of triangular part = 1
Solving LP relaxation...
GLPK Simplex Optimizer, v4.47
1 row, 21 columns, 21 non-zeros
* 0: obj = 1.000000000e+001 infeas = 0.000e+000 (0)
* 1: obj = 1.100000000e+001 infeas = 0.000e+000 (0)
OPTIMAL SOLUTION FOUND
Integer optimization begins...
+ 1: mip = not found yet <= +inf (1; 0)
+ 1: >>>>> 1.100000000e+001 <= 1.100000000e+001 0.0% (1; 0)
+ 1: mip = 1.100000000e+001 <= tree is empty 0.0% (0; 1)
INTEGER OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 0.1 Mb (135491 bytes)
A sub-sequence of length 2 sums to 11.000000:
7.000000 4.000000
Model has been successfully processed
|
{
"pile_set_name": "Github"
}
|
/*
* 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 wvlet.airframe.http.finagle
import com.twitter.finagle.http.{Request, Response, Status}
import com.twitter.util.Await
import wvlet.airframe.Design
import wvlet.airframe.control.Control.withResource
import wvlet.airframe.http._
import wvlet.airspec.AirSpec
import wvlet.log.LogSupport
case class User(id: Int, name: String, requestId: String) {
def withRequestId(newRequestId: String): User = User(id, name, newRequestId)
}
case class UserRequest(id: Int, name: String)
case class DeleteRequestBody(force: Boolean)
trait FinagleClientTestApi extends LogSupport {
@Endpoint(method = HttpMethod.GET, path = "/")
def info: String = {
"Ok"
}
private def getRequestId(request: Request): String = {
request.headerMap.getOrElse("X-Request-Id", "N/A")
}
@Endpoint(method = HttpMethod.GET, path = "/user/:id")
def get(id: Int, request: Request): User = {
User(id, "leo", getRequestId(request))
}
@Endpoint(method = HttpMethod.GET, path = "/user/:id/invalid")
def getInvalidUser(id: Int, request: Request): HttpMessage.Response = {
Http.response(HttpStatus.Ok_200).withJson("""{"id":"abc","user":"NA","requestId":"xxx"}""")
}
@Endpoint(method = HttpMethod.GET, path = "/user/info")
def getResource(id: Int, name: String, request: Request): User = {
User(id, name, getRequestId(request))
}
@Endpoint(method = HttpMethod.GET, path = "/user/info2")
def getResource(query: UserRequest, request: Request): User = {
User(query.id, query.name, getRequestId(request))
}
@Endpoint(method = HttpMethod.GET, path = "/user")
def list(request: Request): Seq[User] = {
Seq(User(1, "leo", getRequestId(request)))
}
@Endpoint(method = HttpMethod.POST, path = "/user")
def create(newUser: User, request: Request): User = {
newUser.withRequestId(getRequestId(request))
}
@Endpoint(method = HttpMethod.DELETE, path = "/user/:id")
def delete(id: Int, request: Request): User = {
User(id, "xxx", getRequestId(request))
}
@Endpoint(method = HttpMethod.PUT, path = "/user")
def put(updatedUser: User, request: Request): User = {
updatedUser.withRequestId(getRequestId(request))
}
@Endpoint(method = HttpMethod.PATCH, path = "/user")
def patch(updatedUser: User, request: Request): User = {
updatedUser.withRequestId(getRequestId(request))
}
@Endpoint(method = HttpMethod.GET, path = "/busy")
def busy: Response = {
trace("called busy method")
Response(Status.InternalServerError)
}
@Endpoint(method = HttpMethod.GET, path = "/forbidden")
def forbidden: Response = {
Response(Status.Forbidden)
}
@Endpoint(method = HttpMethod.GET, path = "/response")
def rawResponse: Response = {
val r = Response(Status.Ok)
r.setContentString("raw response")
r
}
}
/**
*/
class FinagleClientTest extends AirSpec {
private val r = Router.add[FinagleClientTestApi]
override protected def design: Design =
Finagle.server
.withName("test-server")
.withRouter(r)
.designWithSyncClient
def `convert HTTP responses into objects`(client: FinagleSyncClient): Unit = {
def addRequestId(request: Request): Request = {
request.headerMap.put("X-Request-Id", "10")
request
}
// Sending an implementation specific Request type
val ret = client.send(Request("/")).contentString
ret shouldBe "Ok"
// Using HTTP request wrappers
client.get[User]("/user/1") shouldBe User(1, "leo", "N/A")
client.getResource[UserRequest, User]("/user/info", UserRequest(2, "kai")) shouldBe User(2, "kai", "N/A")
client.getResource[UserRequest, User]("/user/info2", UserRequest(2, "kai")) shouldBe User(2, "kai", "N/A")
client.list[Seq[User]]("/user") shouldBe Seq(User(1, "leo", "N/A"))
client.post[User]("/user", User(2, "yui", "N/A")) shouldBe User(2, "yui", "N/A")
client.postOps[User, User]("/user", User(2, "yui", "N/A")) shouldBe User(2, "yui", "N/A")
client.put[User]("/user", User(10, "aina", "N/A")) shouldBe User(10, "aina", "N/A")
client.putOps[User, User]("/user", User(10, "aina", "N/A")) shouldBe User(10, "aina", "N/A")
client.patch[User]("/user", User(20, "joy", "N/A")) shouldBe User(20, "joy", "N/A")
client.patchOps[User, User]("/user", User(20, "joy", "N/A")) shouldBe User(20, "joy", "N/A")
client.delete[User]("/user/1") shouldBe User(1, "xxx", "N/A")
client.deleteOps[DeleteRequestBody, User]("/user/1", DeleteRequestBody(true)) shouldBe User(1, "xxx", "N/A")
// application/x-msgpack test
client.get[User]("/user/1", { r => r.accept = "application/x-msgpack"; r }) shouldBe User(1, "leo", "N/A")
client.post[User]("/user", User(2, "yui", "N/A"), { r => r.accept = "application/x-msgpack"; r }) shouldBe User(
2,
"yui",
"N/A"
)
// Get a response as is
client.get[Response]("/response").contentString shouldBe "raw response"
// Using a custom HTTP header
client.get[User]("/user/1", addRequestId) shouldBe User(1, "leo", "10")
client.getResource[UserRequest, User]("/user/info", UserRequest(2, "kai"), addRequestId) shouldBe User(
2,
"kai",
"10"
)
client.getResource[UserRequest, User]("/user/info2", UserRequest(2, "kai"), addRequestId) shouldBe User(
2,
"kai",
"10"
)
client.list[Seq[User]]("/user", addRequestId) shouldBe Seq(User(1, "leo", "10"))
client.post[User]("/user", User(2, "yui", "N/A"), addRequestId) shouldBe User(2, "yui", "10")
client.postOps[User, User]("/user", User(2, "yui", "N/A"), addRequestId) shouldBe User(2, "yui", "10")
client
.postRaw[User](
"/user",
User(2, "yui", "N/A"),
addRequestId
).contentString shouldBe """{"id":2,"name":"yui","requestId":"10"}"""
client.put[User]("/user", User(10, "aina", "N/A"), addRequestId) shouldBe User(10, "aina", "10")
client.putOps[User, User]("/user", User(10, "aina", "N/A"), addRequestId) shouldBe User(10, "aina", "10")
client
.putRaw[User](
"/user",
User(10, "aina", "N/A"),
addRequestId
).contentString shouldBe """{"id":10,"name":"aina","requestId":"10"}"""
client.patch[User]("/user", User(20, "joy", "N/A"), addRequestId) shouldBe User(20, "joy", "10")
client.patchOps[User, User]("/user", User(20, "joy", "N/A"), addRequestId) shouldBe User(20, "joy", "10")
client
.patchRaw[User](
"/user",
User(20, "joy", "N/A"),
addRequestId
).contentString shouldBe """{"id":20,"name":"joy","requestId":"10"}"""
client.delete[User]("/user/1", addRequestId) shouldBe User(1, "xxx", "10")
client.deleteOps[DeleteRequestBody, User]("/user/1", DeleteRequestBody(true), addRequestId) shouldBe User(
1,
"xxx",
"10"
)
client.deleteRaw("/user/1", addRequestId).contentString shouldBe """{"id":1,"name":"xxx","requestId":"10"}"""
}
def `fail request`(server: FinagleServer): Unit = {
withResource(
Finagle.client
.withMaxRetry(3)
.withBackOff(initialIntervalMillis = 1)
.newSyncClient(server.localAddress)
) { client =>
warn("Starting http client failure tests")
{
// Test max retry failure
val ex = intercept[HttpClientMaxRetryException] {
val resp = client.get[String]("/busy")
}
warn(ex.getMessage)
ex.retryContext.retryCount shouldBe 3
ex.retryContext.maxRetry shouldBe 3
val cause = ex.retryContext.lastError.asInstanceOf[HttpClientException]
cause.status shouldBe HttpStatus.InternalServerError_500
}
{
// Non retryable response
val cause = intercept[HttpClientException] {
client.get[String]("/forbidden")
}
warn(cause.getMessage)
cause.status shouldBe HttpStatus.Forbidden_403
}
{
// Parse invalid json response
val e = intercept[HttpClientException] {
client.get[User]("/user/1/invalid")
}
e.status shouldBe HttpStatus.Ok_200
e.getCause.getClass shouldBe classOf[IllegalArgumentException]
}
}
}
def `support https request`: Unit = {
withResource(Finagle.newSyncClient("https://wvlet.org")) { client =>
val page = client.get[String]("/airframe/")
trace(page)
page.contains("<html") shouldBe true
}
}
def `support sendRaw`: Unit = {
withResource(Finagle.newClient("https://wvlet.org")) { client =>
val r = client.sendRaw(Request("/airframe/")).map { x => x.contentString.contains("<html") shouldBe true }
Await.result(r)
}
}
}
|
{
"pile_set_name": "Github"
}
|
// SPDX-License-Identifier: MIT
/*
* Copyright © 2019 Intel Corporation
*
*/
#include "i915_drv.h"
#include "intel_display_types.h"
#define DSB_BUF_SIZE (2 * PAGE_SIZE)
/**
* DOC: DSB
*
* A DSB (Display State Buffer) is a queue of MMIO instructions in the memory
* which can be offloaded to DSB HW in Display Controller. DSB HW is a DMA
* engine that can be programmed to download the DSB from memory.
* It allows driver to batch submit display HW programming. This helps to
* reduce loading time and CPU activity, thereby making the context switch
* faster. DSB Support added from Gen12 Intel graphics based platform.
*
* DSB's can access only the pipe, plane, and transcoder Data Island Packet
* registers.
*
* DSB HW can support only register writes (both indexed and direct MMIO
* writes). There are no registers reads possible with DSB HW engine.
*/
/* DSB opcodes. */
#define DSB_OPCODE_SHIFT 24
#define DSB_OPCODE_MMIO_WRITE 0x1
#define DSB_OPCODE_INDEXED_WRITE 0x9
#define DSB_BYTE_EN 0xF
#define DSB_BYTE_EN_SHIFT 20
#define DSB_REG_VALUE_MASK 0xfffff
static inline bool is_dsb_busy(struct intel_dsb *dsb)
{
struct intel_crtc *crtc = container_of(dsb, typeof(*crtc), dsb);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
enum pipe pipe = crtc->pipe;
return DSB_STATUS & intel_de_read(dev_priv, DSB_CTRL(pipe, dsb->id));
}
static inline bool intel_dsb_enable_engine(struct intel_dsb *dsb)
{
struct intel_crtc *crtc = container_of(dsb, typeof(*crtc), dsb);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
enum pipe pipe = crtc->pipe;
u32 dsb_ctrl;
dsb_ctrl = intel_de_read(dev_priv, DSB_CTRL(pipe, dsb->id));
if (DSB_STATUS & dsb_ctrl) {
drm_dbg_kms(&dev_priv->drm, "DSB engine is busy.\n");
return false;
}
dsb_ctrl |= DSB_ENABLE;
intel_de_write(dev_priv, DSB_CTRL(pipe, dsb->id), dsb_ctrl);
intel_de_posting_read(dev_priv, DSB_CTRL(pipe, dsb->id));
return true;
}
static inline bool intel_dsb_disable_engine(struct intel_dsb *dsb)
{
struct intel_crtc *crtc = container_of(dsb, typeof(*crtc), dsb);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
enum pipe pipe = crtc->pipe;
u32 dsb_ctrl;
dsb_ctrl = intel_de_read(dev_priv, DSB_CTRL(pipe, dsb->id));
if (DSB_STATUS & dsb_ctrl) {
drm_dbg_kms(&dev_priv->drm, "DSB engine is busy.\n");
return false;
}
dsb_ctrl &= ~DSB_ENABLE;
intel_de_write(dev_priv, DSB_CTRL(pipe, dsb->id), dsb_ctrl);
intel_de_posting_read(dev_priv, DSB_CTRL(pipe, dsb->id));
return true;
}
/**
* intel_dsb_get() - Allocate DSB context and return a DSB instance.
* @crtc: intel_crtc structure to get pipe info.
*
* This function provides handle of a DSB instance, for the further DSB
* operations.
*
* Returns: address of Intel_dsb instance requested for.
* Failure: Returns the same DSB instance, but without a command buffer.
*/
struct intel_dsb *
intel_dsb_get(struct intel_crtc *crtc)
{
struct drm_device *dev = crtc->base.dev;
struct drm_i915_private *i915 = to_i915(dev);
struct intel_dsb *dsb = &crtc->dsb;
struct drm_i915_gem_object *obj;
struct i915_vma *vma;
u32 *buf;
intel_wakeref_t wakeref;
if (!HAS_DSB(i915))
return dsb;
if (dsb->refcount++ != 0)
return dsb;
wakeref = intel_runtime_pm_get(&i915->runtime_pm);
obj = i915_gem_object_create_internal(i915, DSB_BUF_SIZE);
if (IS_ERR(obj)) {
drm_err(&i915->drm, "Gem object creation failed\n");
goto out;
}
vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0, 0);
if (IS_ERR(vma)) {
drm_err(&i915->drm, "Vma creation failed\n");
i915_gem_object_put(obj);
goto out;
}
buf = i915_gem_object_pin_map(vma->obj, I915_MAP_WC);
if (IS_ERR(buf)) {
drm_err(&i915->drm, "Command buffer creation failed\n");
goto out;
}
dsb->id = DSB1;
dsb->vma = vma;
dsb->cmd_buf = buf;
out:
/*
* On error dsb->cmd_buf will continue to be NULL, making the writes
* pass-through. Leave the dangling ref to be removed later by the
* corresponding intel_dsb_put(): the important error message will
* already be logged above.
*/
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
return dsb;
}
/**
* intel_dsb_put() - To destroy DSB context.
* @dsb: intel_dsb structure.
*
* This function destroys the DSB context allocated by a dsb_get(), by
* unpinning and releasing the VMA object associated with it.
*/
void intel_dsb_put(struct intel_dsb *dsb)
{
struct intel_crtc *crtc = container_of(dsb, typeof(*crtc), dsb);
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
if (!HAS_DSB(i915))
return;
if (drm_WARN_ON(&i915->drm, dsb->refcount == 0))
return;
if (--dsb->refcount == 0) {
i915_vma_unpin_and_release(&dsb->vma, I915_VMA_RELEASE_MAP);
dsb->cmd_buf = NULL;
dsb->free_pos = 0;
dsb->ins_start_offset = 0;
}
}
/**
* intel_dsb_indexed_reg_write() -Write to the DSB context for auto
* increment register.
* @dsb: intel_dsb structure.
* @reg: register address.
* @val: value.
*
* This function is used for writing register-value pair in command
* buffer of DSB for auto-increment register. During command buffer overflow,
* a warning is thrown and rest all erroneous condition register programming
* is done through mmio write.
*/
void intel_dsb_indexed_reg_write(struct intel_dsb *dsb, i915_reg_t reg,
u32 val)
{
struct intel_crtc *crtc = container_of(dsb, typeof(*crtc), dsb);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
u32 *buf = dsb->cmd_buf;
u32 reg_val;
if (!buf) {
intel_de_write(dev_priv, reg, val);
return;
}
if (drm_WARN_ON(&dev_priv->drm, dsb->free_pos >= DSB_BUF_SIZE)) {
drm_dbg_kms(&dev_priv->drm, "DSB buffer overflow\n");
return;
}
/*
* For example the buffer will look like below for 3 dwords for auto
* increment register:
* +--------------------------------------------------------+
* | size = 3 | offset &| value1 | value2 | value3 | zero |
* | | opcode | | | | |
* +--------------------------------------------------------+
* + + + + + + +
* 0 4 8 12 16 20 24
* Byte
*
* As every instruction is 8 byte aligned the index of dsb instruction
* will start always from even number while dealing with u32 array. If
* we are writing odd no of dwords, Zeros will be added in the end for
* padding.
*/
reg_val = buf[dsb->ins_start_offset + 1] & DSB_REG_VALUE_MASK;
if (reg_val != i915_mmio_reg_offset(reg)) {
/* Every instruction should be 8 byte aligned. */
dsb->free_pos = ALIGN(dsb->free_pos, 2);
dsb->ins_start_offset = dsb->free_pos;
/* Update the size. */
buf[dsb->free_pos++] = 1;
/* Update the opcode and reg. */
buf[dsb->free_pos++] = (DSB_OPCODE_INDEXED_WRITE <<
DSB_OPCODE_SHIFT) |
i915_mmio_reg_offset(reg);
/* Update the value. */
buf[dsb->free_pos++] = val;
} else {
/* Update the new value. */
buf[dsb->free_pos++] = val;
/* Update the size. */
buf[dsb->ins_start_offset]++;
}
/* if number of data words is odd, then the last dword should be 0.*/
if (dsb->free_pos & 0x1)
buf[dsb->free_pos] = 0;
}
/**
* intel_dsb_reg_write() -Write to the DSB context for normal
* register.
* @dsb: intel_dsb structure.
* @reg: register address.
* @val: value.
*
* This function is used for writing register-value pair in command
* buffer of DSB. During command buffer overflow, a warning is thrown
* and rest all erroneous condition register programming is done
* through mmio write.
*/
void intel_dsb_reg_write(struct intel_dsb *dsb, i915_reg_t reg, u32 val)
{
struct intel_crtc *crtc = container_of(dsb, typeof(*crtc), dsb);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
u32 *buf = dsb->cmd_buf;
if (!buf) {
intel_de_write(dev_priv, reg, val);
return;
}
if (drm_WARN_ON(&dev_priv->drm, dsb->free_pos >= DSB_BUF_SIZE)) {
drm_dbg_kms(&dev_priv->drm, "DSB buffer overflow\n");
return;
}
dsb->ins_start_offset = dsb->free_pos;
buf[dsb->free_pos++] = val;
buf[dsb->free_pos++] = (DSB_OPCODE_MMIO_WRITE << DSB_OPCODE_SHIFT) |
(DSB_BYTE_EN << DSB_BYTE_EN_SHIFT) |
i915_mmio_reg_offset(reg);
}
/**
* intel_dsb_commit() - Trigger workload execution of DSB.
* @dsb: intel_dsb structure.
*
* This function is used to do actual write to hardware using DSB.
* On errors, fall back to MMIO. Also this function help to reset the context.
*/
void intel_dsb_commit(struct intel_dsb *dsb)
{
struct intel_crtc *crtc = container_of(dsb, typeof(*crtc), dsb);
struct drm_device *dev = crtc->base.dev;
struct drm_i915_private *dev_priv = to_i915(dev);
enum pipe pipe = crtc->pipe;
u32 tail;
if (!dsb->free_pos)
return;
if (!intel_dsb_enable_engine(dsb))
goto reset;
if (is_dsb_busy(dsb)) {
drm_err(&dev_priv->drm,
"HEAD_PTR write failed - dsb engine is busy.\n");
goto reset;
}
intel_de_write(dev_priv, DSB_HEAD(pipe, dsb->id),
i915_ggtt_offset(dsb->vma));
tail = ALIGN(dsb->free_pos * 4, CACHELINE_BYTES);
if (tail > dsb->free_pos * 4)
memset(&dsb->cmd_buf[dsb->free_pos], 0,
(tail - dsb->free_pos * 4));
if (is_dsb_busy(dsb)) {
drm_err(&dev_priv->drm,
"TAIL_PTR write failed - dsb engine is busy.\n");
goto reset;
}
drm_dbg_kms(&dev_priv->drm,
"DSB execution started - head 0x%x, tail 0x%x\n",
i915_ggtt_offset(dsb->vma), tail);
intel_de_write(dev_priv, DSB_TAIL(pipe, dsb->id),
i915_ggtt_offset(dsb->vma) + tail);
if (wait_for(!is_dsb_busy(dsb), 1)) {
drm_err(&dev_priv->drm,
"Timed out waiting for DSB workload completion.\n");
goto reset;
}
reset:
dsb->free_pos = 0;
dsb->ins_start_offset = 0;
intel_dsb_disable_engine(dsb);
}
|
{
"pile_set_name": "Github"
}
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayInsAutoUserMsgSendResponse(AlipayResponse):
def __init__(self):
super(AlipayInsAutoUserMsgSendResponse, self).__init__()
self._can_retry = None
@property
def can_retry(self):
return self._can_retry
@can_retry.setter
def can_retry(self, value):
self._can_retry = value
def parse_response_content(self, response_content):
response = super(AlipayInsAutoUserMsgSendResponse, self).parse_response_content(response_content)
if 'can_retry' in response:
self.can_retry = response['can_retry']
|
{
"pile_set_name": "Github"
}
|
package com.zvm.instruction.loadandstore.store;
import com.zvm.instruction.Instruction;
import com.zvm.interpreter.CallSite;
import com.zvm.interpreter.CodeUtils;
import com.zvm.interpreter.Interpreter;
import com.zvm.runtime.*;
public class Fstore_3 implements Instruction {
@Override
public void execute(RunTimeEnv runTimeEnv, JThread jThread, JavaClass javaClass, CallSite callSite, Interpreter interpreter, CodeUtils code) {
JavaFrame javaFrame = jThread.getTopFrame();
OperandStack operandStack = javaFrame.operandStack;
LocalVars localVars = javaFrame.localVars;
localVars.putFloat(3, operandStack.popFloat());
}
}
|
{
"pile_set_name": "Github"
}
|
<!---
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# cordova-plugin-splashscreen
這個外掛程式顯示和隱藏在應用程式啟動期間的初始螢幕。
## 安裝
cordova plugin add cordova-plugin-splashscreen
## 支援的平臺
* 亞馬遜火 OS
* Android 系統
* 黑莓 10
* iOS
* Windows Phone 7 和 8
* Windows 8
## 方法
* splashscreen.show
* splashscreen.hide
### Android 的怪癖
在你的 config.xml,您需要添加以下優惠:
<preference name="SplashScreen" value="foo" />
<preference name="SplashScreenDelay" value="10000" />
美孚在哪裡閃屏檔,最好是 9 修補程式檔的名稱。 請確保您的 splashcreen 檔添加到 res/xml 目錄下相應的資料夾。 第二個參數表示多久閃屏會顯示以毫秒為單位。 它將預設為 3000 毫秒。 有關更多資訊,請參見 [圖示和啟動畫面][1]。
[1]: http://cordova.apache.org/docs/en/edge/config_ref_images.md.html
## splashscreen.hide
解雇的閃屏。
navigator.splashscreen.hide();
### 黑莓 10,WP8,iOS 怪癖
`config.xml` 檔 `AutoHideSplashScreen` 設置必須是 `假` 的。 若要延遲兩秒鐘隱藏的閃屏,`deviceready` 事件處理常式中添加一個計時器,如下所示:
setTimeout(function() {
navigator.splashscreen.hide();
}, 2000);
## splashscreen.show
顯示初始螢幕。
navigator.splashscreen.show();
您的應用程式無法調用 `navigator.splashscreen.show()`,直到該應用程式已啟動,且觸發了 `deviceready` 事件。 但是,由於通常的閃屏為了是可見的在您的應用程式啟動之前,這似乎會打敗閃屏的目的。 提供一些配置在 `config.xml` 中的會自動 `show` 初始螢幕您的應用程式啟動後立即和之前它已經完全起步並收到 `deviceready` 事件。 做這種配置的詳細資訊,請參閱 [圖示和啟動畫面][1]。 出於此原因,不太可能您需要調用 `navigator.splashscreen.show()`,使初始螢幕可見為應用程式啟動。
|
{
"pile_set_name": "Github"
}
|
# lws api test Secure Streams
Performs some tests against httpbin.org server
to check Secure Streams client performance
## build
```
$ cmake . && make
```
## usage
Commandline option|Meaning
---|---
-d <loglevel>|Debug verbosity in decimal, eg, -d15
```
$ ./lws-api-test-secure-streams
```
|
{
"pile_set_name": "Github"
}
|
/*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
View containing an AVPlayerLayer.
*/
@import Foundation;
@import AVFoundation;
#import "AAPLPlayerView.h"
@implementation AAPLPlayerView
- (AVPlayer *)player {
return self.playerLayer.player;
}
- (void)setPlayer:(AVPlayer *)player {
self.playerLayer.player = player;
}
// override UIView
+ (Class)layerClass {
return [AVPlayerLayer class];
}
- (AVPlayerLayer *)playerLayer {
return (AVPlayerLayer *)self.layer;
}
@end
|
{
"pile_set_name": "Github"
}
|
#-------------------------------------------------------------------------------
#
# Define classes for (uni/multi)-variate kernel density estimation.
#
# Currently, only Gaussian kernels are implemented.
#
# Written by: Robert Kern
#
# Date: 2004-08-09
#
# Modified: 2005-02-10 by Robert Kern.
# Contributed to SciPy
# 2005-10-07 by Robert Kern.
# Some fixes to match the new scipy_core
#
# Copyright 2004-2005 by Enthought, Inc.
#
#-------------------------------------------------------------------------------
from __future__ import division, print_function, absolute_import
# Standard library imports.
import warnings
# SciPy imports.
from scipy._lib.six import callable, string_types
from scipy import linalg, special
from scipy.special import logsumexp
from scipy._lib._numpy_compat import cov
from numpy import (atleast_2d, reshape, zeros, newaxis, dot, exp, pi, sqrt,
ravel, power, atleast_1d, squeeze, sum, transpose, ones)
import numpy as np
from numpy.random import choice, multivariate_normal
# Local imports.
from . import mvn
__all__ = ['gaussian_kde']
class gaussian_kde(object):
"""Representation of a kernel-density estimate using Gaussian kernels.
Kernel density estimation is a way to estimate the probability density
function (PDF) of a random variable in a non-parametric way.
`gaussian_kde` works for both uni-variate and multi-variate data. It
includes automatic bandwidth determination. The estimation works best for
a unimodal distribution; bimodal or multi-modal distributions tend to be
oversmoothed.
Parameters
----------
dataset : array_like
Datapoints to estimate from. In case of univariate data this is a 1-D
array, otherwise a 2-D array with shape (# of dims, # of data).
bw_method : str, scalar or callable, optional
The method used to calculate the estimator bandwidth. This can be
'scott', 'silverman', a scalar constant or a callable. If a scalar,
this will be used directly as `kde.factor`. If a callable, it should
take a `gaussian_kde` instance as only parameter and return a scalar.
If None (default), 'scott' is used. See Notes for more details.
weights : array_like, optional
weights of datapoints. This must be the same shape as dataset.
If None (default), the samples are assumed to be equally weighted
Attributes
----------
dataset : ndarray
The dataset with which `gaussian_kde` was initialized.
d : int
Number of dimensions.
n : int
Number of datapoints.
neff : int
Effective number of datapoints.
.. versionadded:: 1.2.0
factor : float
The bandwidth factor, obtained from `kde.covariance_factor`, with which
the covariance matrix is multiplied.
covariance : ndarray
The covariance matrix of `dataset`, scaled by the calculated bandwidth
(`kde.factor`).
inv_cov : ndarray
The inverse of `covariance`.
Methods
-------
evaluate
__call__
integrate_gaussian
integrate_box_1d
integrate_box
integrate_kde
pdf
logpdf
resample
set_bandwidth
covariance_factor
Notes
-----
Bandwidth selection strongly influences the estimate obtained from the KDE
(much more so than the actual shape of the kernel). Bandwidth selection
can be done by a "rule of thumb", by cross-validation, by "plug-in
methods" or by other means; see [3]_, [4]_ for reviews. `gaussian_kde`
uses a rule of thumb, the default is Scott's Rule.
Scott's Rule [1]_, implemented as `scotts_factor`, is::
n**(-1./(d+4)),
with ``n`` the number of data points and ``d`` the number of dimensions.
In the case of unequally weighted points, `scotts_factor` becomes::
neff**(-1./(d+4)),
with ``neff`` the effective number of datapoints.
Silverman's Rule [2]_, implemented as `silverman_factor`, is::
(n * (d + 2) / 4.)**(-1. / (d + 4)).
or in the case of unequally weighted points::
(neff * (d + 2) / 4.)**(-1. / (d + 4)).
Good general descriptions of kernel density estimation can be found in [1]_
and [2]_, the mathematics for this multi-dimensional implementation can be
found in [1]_.
With a set of weighted samples, the effective number of datapoints ``neff``
is defined by::
neff = sum(weights)^2 / sum(weights^2)
as detailed in [5]_.
References
----------
.. [1] D.W. Scott, "Multivariate Density Estimation: Theory, Practice, and
Visualization", John Wiley & Sons, New York, Chicester, 1992.
.. [2] B.W. Silverman, "Density Estimation for Statistics and Data
Analysis", Vol. 26, Monographs on Statistics and Applied Probability,
Chapman and Hall, London, 1986.
.. [3] B.A. Turlach, "Bandwidth Selection in Kernel Density Estimation: A
Review", CORE and Institut de Statistique, Vol. 19, pp. 1-33, 1993.
.. [4] D.M. Bashtannyk and R.J. Hyndman, "Bandwidth selection for kernel
conditional density estimation", Computational Statistics & Data
Analysis, Vol. 36, pp. 279-298, 2001.
.. [5] Gray P. G., 1969, Journal of the Royal Statistical Society.
Series A (General), 132, 272
Examples
--------
Generate some random two-dimensional data:
>>> from scipy import stats
>>> def measure(n):
... "Measurement model, return two coupled measurements."
... m1 = np.random.normal(size=n)
... m2 = np.random.normal(scale=0.5, size=n)
... return m1+m2, m1-m2
>>> m1, m2 = measure(2000)
>>> xmin = m1.min()
>>> xmax = m1.max()
>>> ymin = m2.min()
>>> ymax = m2.max()
Perform a kernel density estimate on the data:
>>> X, Y = np.mgrid[xmin:xmax:100j, ymin:ymax:100j]
>>> positions = np.vstack([X.ravel(), Y.ravel()])
>>> values = np.vstack([m1, m2])
>>> kernel = stats.gaussian_kde(values)
>>> Z = np.reshape(kernel(positions).T, X.shape)
Plot the results:
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> ax.imshow(np.rot90(Z), cmap=plt.cm.gist_earth_r,
... extent=[xmin, xmax, ymin, ymax])
>>> ax.plot(m1, m2, 'k.', markersize=2)
>>> ax.set_xlim([xmin, xmax])
>>> ax.set_ylim([ymin, ymax])
>>> plt.show()
"""
def __init__(self, dataset, bw_method=None, weights=None):
self.dataset = atleast_2d(dataset)
if not self.dataset.size > 1:
raise ValueError("`dataset` input should have multiple elements.")
self.d, self.n = self.dataset.shape
if weights is not None:
self._weights = atleast_1d(weights).astype(float)
self._weights /= sum(self._weights)
if self.weights.ndim != 1:
raise ValueError("`weights` input should be one-dimensional.")
if len(self._weights) != self.n:
raise ValueError("`weights` input should be of length n")
self._neff = 1/sum(self._weights**2)
self.set_bandwidth(bw_method=bw_method)
def evaluate(self, points):
"""Evaluate the estimated pdf on a set of points.
Parameters
----------
points : (# of dimensions, # of points)-array
Alternatively, a (# of dimensions,) vector can be passed in and
treated as a single point.
Returns
-------
values : (# of points,)-array
The values at each point.
Raises
------
ValueError : if the dimensionality of the input points is different than
the dimensionality of the KDE.
"""
points = atleast_2d(points)
d, m = points.shape
if d != self.d:
if d == 1 and m == self.d:
# points was passed in as a row vector
points = reshape(points, (self.d, 1))
m = 1
else:
msg = "points have dimension %s, dataset has dimension %s" % (d,
self.d)
raise ValueError(msg)
result = zeros((m,), dtype=float)
whitening = linalg.cholesky(self.inv_cov)
scaled_dataset = dot(whitening, self.dataset)
scaled_points = dot(whitening, points)
if m >= self.n:
# there are more points than data, so loop over data
for i in range(self.n):
diff = scaled_dataset[:, i, newaxis] - scaled_points
energy = sum(diff * diff, axis=0) / 2.0
result += self.weights[i]*exp(-energy)
else:
# loop over points
for i in range(m):
diff = scaled_dataset - scaled_points[:, i, newaxis]
energy = sum(diff * diff, axis=0) / 2.0
result[i] = sum(exp(-energy)*self.weights, axis=0)
result = result / self._norm_factor
return result
__call__ = evaluate
def integrate_gaussian(self, mean, cov):
"""
Multiply estimated density by a multivariate Gaussian and integrate
over the whole space.
Parameters
----------
mean : aray_like
A 1-D array, specifying the mean of the Gaussian.
cov : array_like
A 2-D array, specifying the covariance matrix of the Gaussian.
Returns
-------
result : scalar
The value of the integral.
Raises
------
ValueError
If the mean or covariance of the input Gaussian differs from
the KDE's dimensionality.
"""
mean = atleast_1d(squeeze(mean))
cov = atleast_2d(cov)
if mean.shape != (self.d,):
raise ValueError("mean does not have dimension %s" % self.d)
if cov.shape != (self.d, self.d):
raise ValueError("covariance does not have dimension %s" % self.d)
# make mean a column vector
mean = mean[:, newaxis]
sum_cov = self.covariance + cov
# This will raise LinAlgError if the new cov matrix is not s.p.d
# cho_factor returns (ndarray, bool) where bool is a flag for whether
# or not ndarray is upper or lower triangular
sum_cov_chol = linalg.cho_factor(sum_cov)
diff = self.dataset - mean
tdiff = linalg.cho_solve(sum_cov_chol, diff)
sqrt_det = np.prod(np.diagonal(sum_cov_chol[0]))
norm_const = power(2 * pi, sum_cov.shape[0] / 2.0) * sqrt_det
energies = sum(diff * tdiff, axis=0) / 2.0
result = sum(exp(-energies)*self.weights, axis=0) / norm_const
return result
def integrate_box_1d(self, low, high):
"""
Computes the integral of a 1D pdf between two bounds.
Parameters
----------
low : scalar
Lower bound of integration.
high : scalar
Upper bound of integration.
Returns
-------
value : scalar
The result of the integral.
Raises
------
ValueError
If the KDE is over more than one dimension.
"""
if self.d != 1:
raise ValueError("integrate_box_1d() only handles 1D pdfs")
stdev = ravel(sqrt(self.covariance))[0]
normalized_low = ravel((low - self.dataset) / stdev)
normalized_high = ravel((high - self.dataset) / stdev)
value = np.sum(self.weights*(
special.ndtr(normalized_high) -
special.ndtr(normalized_low)))
return value
def integrate_box(self, low_bounds, high_bounds, maxpts=None):
"""Computes the integral of a pdf over a rectangular interval.
Parameters
----------
low_bounds : array_like
A 1-D array containing the lower bounds of integration.
high_bounds : array_like
A 1-D array containing the upper bounds of integration.
maxpts : int, optional
The maximum number of points to use for integration.
Returns
-------
value : scalar
The result of the integral.
"""
if maxpts is not None:
extra_kwds = {'maxpts': maxpts}
else:
extra_kwds = {}
value, inform = mvn.mvnun_weighted(low_bounds, high_bounds,
self.dataset, self.weights,
self.covariance, **extra_kwds)
if inform:
msg = ('An integral in mvn.mvnun requires more points than %s' %
(self.d * 1000))
warnings.warn(msg)
return value
def integrate_kde(self, other):
"""
Computes the integral of the product of this kernel density estimate
with another.
Parameters
----------
other : gaussian_kde instance
The other kde.
Returns
-------
value : scalar
The result of the integral.
Raises
------
ValueError
If the KDEs have different dimensionality.
"""
if other.d != self.d:
raise ValueError("KDEs are not the same dimensionality")
# we want to iterate over the smallest number of points
if other.n < self.n:
small = other
large = self
else:
small = self
large = other
sum_cov = small.covariance + large.covariance
sum_cov_chol = linalg.cho_factor(sum_cov)
result = 0.0
for i in range(small.n):
mean = small.dataset[:, i, newaxis]
diff = large.dataset - mean
tdiff = linalg.cho_solve(sum_cov_chol, diff)
energies = sum(diff * tdiff, axis=0) / 2.0
result += sum(exp(-energies)*large.weights, axis=0)*small.weights[i]
sqrt_det = np.prod(np.diagonal(sum_cov_chol[0]))
norm_const = power(2 * pi, sum_cov.shape[0] / 2.0) * sqrt_det
result /= norm_const
return result
def resample(self, size=None):
"""
Randomly sample a dataset from the estimated pdf.
Parameters
----------
size : int, optional
The number of samples to draw. If not provided, then the size is
the same as the effective number of samples in the underlying
dataset.
Returns
-------
resample : (self.d, `size`) ndarray
The sampled dataset.
"""
if size is None:
size = int(self.neff)
norm = transpose(multivariate_normal(zeros((self.d,), float),
self.covariance, size=size))
indices = choice(self.n, size=size, p=self.weights)
means = self.dataset[:, indices]
return means + norm
def scotts_factor(self):
"""Compute Scott's factor.
Returns
-------
s : float
Scott's factor.
"""
return power(self.neff, -1./(self.d+4))
def silverman_factor(self):
"""Compute the Silverman factor.
Returns
-------
s : float
The silverman factor.
"""
return power(self.neff*(self.d+2.0)/4.0, -1./(self.d+4))
# Default method to calculate bandwidth, can be overwritten by subclass
covariance_factor = scotts_factor
covariance_factor.__doc__ = """Computes the coefficient (`kde.factor`) that
multiplies the data covariance matrix to obtain the kernel covariance
matrix. The default is `scotts_factor`. A subclass can overwrite this
method to provide a different method, or set it through a call to
`kde.set_bandwidth`."""
def set_bandwidth(self, bw_method=None):
"""Compute the estimator bandwidth with given method.
The new bandwidth calculated after a call to `set_bandwidth` is used
for subsequent evaluations of the estimated density.
Parameters
----------
bw_method : str, scalar or callable, optional
The method used to calculate the estimator bandwidth. This can be
'scott', 'silverman', a scalar constant or a callable. If a
scalar, this will be used directly as `kde.factor`. If a callable,
it should take a `gaussian_kde` instance as only parameter and
return a scalar. If None (default), nothing happens; the current
`kde.covariance_factor` method is kept.
Notes
-----
.. versionadded:: 0.11
Examples
--------
>>> import scipy.stats as stats
>>> x1 = np.array([-7, -5, 1, 4, 5.])
>>> kde = stats.gaussian_kde(x1)
>>> xs = np.linspace(-10, 10, num=50)
>>> y1 = kde(xs)
>>> kde.set_bandwidth(bw_method='silverman')
>>> y2 = kde(xs)
>>> kde.set_bandwidth(bw_method=kde.factor / 3.)
>>> y3 = kde(xs)
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> ax.plot(x1, np.ones(x1.shape) / (4. * x1.size), 'bo',
... label='Data points (rescaled)')
>>> ax.plot(xs, y1, label='Scott (default)')
>>> ax.plot(xs, y2, label='Silverman')
>>> ax.plot(xs, y3, label='Const (1/3 * Silverman)')
>>> ax.legend()
>>> plt.show()
"""
if bw_method is None:
pass
elif bw_method == 'scott':
self.covariance_factor = self.scotts_factor
elif bw_method == 'silverman':
self.covariance_factor = self.silverman_factor
elif np.isscalar(bw_method) and not isinstance(bw_method, string_types):
self._bw_method = 'use constant'
self.covariance_factor = lambda: bw_method
elif callable(bw_method):
self._bw_method = bw_method
self.covariance_factor = lambda: self._bw_method(self)
else:
msg = "`bw_method` should be 'scott', 'silverman', a scalar " \
"or a callable."
raise ValueError(msg)
self._compute_covariance()
def _compute_covariance(self):
"""Computes the covariance matrix for each Gaussian kernel using
covariance_factor().
"""
self.factor = self.covariance_factor()
# Cache covariance and inverse covariance of the data
if not hasattr(self, '_data_inv_cov'):
self._data_covariance = atleast_2d(cov(self.dataset, rowvar=1,
bias=False,
aweights=self.weights))
self._data_inv_cov = linalg.inv(self._data_covariance)
self.covariance = self._data_covariance * self.factor**2
self.inv_cov = self._data_inv_cov / self.factor**2
self._norm_factor = sqrt(linalg.det(2*pi*self.covariance))
def pdf(self, x):
"""
Evaluate the estimated pdf on a provided set of points.
Notes
-----
This is an alias for `gaussian_kde.evaluate`. See the ``evaluate``
docstring for more details.
"""
return self.evaluate(x)
def logpdf(self, x):
"""
Evaluate the log of the estimated pdf on a provided set of points.
"""
points = atleast_2d(x)
d, m = points.shape
if d != self.d:
if d == 1 and m == self.d:
# points was passed in as a row vector
points = reshape(points, (self.d, 1))
m = 1
else:
msg = "points have dimension %s, dataset has dimension %s" % (d,
self.d)
raise ValueError(msg)
if m >= self.n:
# there are more points than data, so loop over data
energy = zeros((self.n, m), dtype=float)
for i in range(self.n):
diff = self.dataset[:, i, newaxis] - points
tdiff = dot(self.inv_cov, diff)
energy[i] = sum(diff*tdiff, axis=0) / 2.0
result = logsumexp(-energy.T,
b=self.weights / self._norm_factor, axis=1)
else:
# loop over points
result = zeros((m,), dtype=float)
for i in range(m):
diff = self.dataset - points[:, i, newaxis]
tdiff = dot(self.inv_cov, diff)
energy = sum(diff * tdiff, axis=0) / 2.0
result[i] = logsumexp(-energy, b=self.weights /
self._norm_factor)
return result
@property
def weights(self):
try:
return self._weights
except AttributeError:
self._weights = ones(self.n)/self.n
return self._weights
@property
def neff(self):
try:
return self._neff
except AttributeError:
self._neff = 1/sum(self.weights**2)
return self._neff
|
{
"pile_set_name": "Github"
}
|
丁-410
(43)第 39 次會議
時 間:中華民國 104 年 06 月 01 日上午 09 時 30 分
地 點:本會議事廳
出席議員:黃定和 張建榮 林錫明 江碧華 林岳賢 林志鴻 楊順木
林金龍 林東成 林成功 吳宏謀 陳俊宇 黃浴沂 陳福山
黃建勇 吳秋齡 陳漢鍾 黃素琴 劉添梧 陳鴻禧 沈德茂
黃適超 張明華 游祥德 楊政誠 張秋明 薛呈懿 陳文昌
邱嘉進 林棋山 陳正男 陳傑麟 陳孝仁 孫湯玉惠
列席人員:縣府—縣長林聰賢 建設處處長黃志良 工務處處長陳春錦
教育處處長文超順 警察局局長高壽孫
本會—秘書長陳茂琳 秘書吳國樑 秘書吳銘鴻 議事組主任陳
進煌 法制室主任徐明德
來 賓:各報及各廣播電台記者
主 席:陳議長文昌(自上午 9 時 30 分起至上午 11 時 31 分止)
林副議長棋山(自上午 11 時 31 分起至中午 12 時 5 分止)
記 錄:李双榮 游薏樺 陳宏謀
主席宣告開議
甲、報 告 事 項
一、主席報告簽到議員已達法定人數。
二、秘書長宣讀第 38 次會議議事錄。
三、主席陳議長文昌報告:(一)據陳議員福山提議就縣政府新訂定非都市甲、
乙種建築用地及申請興建農舍辦 法,事關人民
權益,納入排定之專題報告第六案一併報告,
可否?請公決。
決定:同意。
(二)據黃議員定和提議最近發生校園安全問題,納
入排定之專題報告第三案一併報告,可否?請
公決。
丁-411
決定:同意。
(三)
本會期各位議員所提臨時動議擬於今日下午五
時討論,可否?請公決。
決定:同意
四、林縣長聰賢率建設處處長黃志良等報告:本縣羅東地區鐵路是否就地高架
及礁溪地區鐵路東移高架計畫情
形。
五、林縣長聰賢率建設處處長黃志良等報告:羅東擴大都市計畫重新檢討及
擬定之情形。
六、林縣長聰賢率工務處處長陳春錦、教育處處長文超順、警察局局長高壽孫
等報告:人行道公設路霸拆除及校園安全情形。
乙、討 論 事 項
一、討論本縣羅東地區鐵路是否就地高架及礁溪地區鐵路東移高架計畫情形。
大會決議:請宜蘭縣政府建請交通部就本縣鐵路高架化,除礁溪段應採取
東移 800 公尺外,其餘平原路段均應採用就地高架化辦理。
二、討論羅東擴大都市計畫重新檢討及擬定之情形。
大會決議:
(一)羅東擴大都市計畫,應俟現有工業區及保護區開發完成後
始得進行。
(二)縣政府擬訂羅東擴大都市計畫,應讓民眾參與規劃方案的
擬定
,啟動羅東擴大都市計畫案時
,應建立公民參與機制。
三、討論人行道公設路霸拆除及校園安全情形。
大會決議:
(一)縣政府就各人行道之公共設施設置及附屬工程設計,應嚴
加督促各道路主管機關注意其影響公共安全之情形,並要
求需符合各項安全規範。
(二)請縣政府就校園安全工作及師生上下學期間交通動線之安
全,應作全面之檢討及強化。
散 會:中午 12 時 5 分
|
{
"pile_set_name": "Github"
}
|
# Kodi Media Center language file
# Addon Name: DirectX Spectrum
# Addon id: visualization.dxspectrum
# Addon Provider: Team-Kodi
msgid ""
msgstr ""
"Project-Id-Version: XBMC Main\n"
"Report-Msgid-Bugs-To: http://trac.xbmc.org/\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Kodi Translation Team\n"
"Language-Team: French (Canada) (http://www.transifex.com/projects/p/xbmc-main/language/fr_CA/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr_CA\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgctxt "#30000"
msgid "Mode"
msgstr "Mode"
msgctxt "#30001"
msgid "Filled"
msgstr "Plein"
msgctxt "#30002"
msgid "Wireframe"
msgstr "Fil de fer"
msgctxt "#30003"
msgid "Points"
msgstr "Points"
msgctxt "#30004"
msgid "Bar Height"
msgstr "Hauteur de barre"
msgctxt "#30005"
msgid "Small"
msgstr "Petit"
msgctxt "#30006"
msgid "Default"
msgstr "Valeur par défaut"
msgctxt "#30007"
msgid "Big"
msgstr "Grand"
msgctxt "#30008"
msgid "Very Big"
msgstr "Très grand"
msgctxt "#30009"
msgid "Speed"
msgstr "Vitesse"
msgctxt "#30010"
msgid "Very Slow"
msgstr "Très lent"
msgctxt "#30011"
msgid "Slow"
msgstr "Lent"
msgctxt "#30012"
msgid "Default"
msgstr "Valeur par défaut"
msgctxt "#30013"
msgid "Fast"
msgstr "Rapide"
msgctxt "#30014"
msgid "Very Fast"
msgstr "Très rapide"
|
{
"pile_set_name": "Github"
}
|
// Mixins
import Colorable from '../../mixins/colorable'
// Utilities
import mixins, { ExtractVue } from '../../util/mixins'
import { genPoints, genBars } from './helpers/core'
import { genPath } from './helpers/path'
// Types
import Vue, { VNode } from 'vue'
import { Prop, PropValidator } from 'vue/types/options'
export type SparklineItem = number | { value: number }
export type SparklineText = {
x: number
value: string
}
export interface Boundary {
minX: number
minY: number
maxX: number
maxY: number
}
export interface Point {
x: number
y: number
value: number
}
export interface Bar {
x: number
y: number
height: number
value: number
}
interface options extends Vue {
$refs: {
path: SVGPathElement
}
}
export default mixins<options &
/* eslint-disable indent */
ExtractVue<[
typeof Colorable
]>
/* eslint-enable indent */
>(
Colorable
).extend({
name: 'VSparkline',
inheritAttrs: false,
props: {
autoDraw: Boolean,
autoDrawDuration: {
type: Number,
default: 2000,
},
autoDrawEasing: {
type: String,
default: 'ease',
},
autoLineWidth: {
type: Boolean,
default: false,
},
color: {
type: String,
default: 'primary',
},
fill: {
type: Boolean,
default: false,
},
gradient: {
type: Array,
default: () => ([]),
} as PropValidator<string[]>,
gradientDirection: {
type: String as Prop<'top' | 'bottom' | 'left' | 'right'>,
validator: (val: string) => ['top', 'bottom', 'left', 'right'].includes(val),
default: 'top',
},
height: {
type: [String, Number],
default: 75,
},
labels: {
type: Array,
default: () => ([]),
} as PropValidator<SparklineItem[]>,
labelSize: {
type: [Number, String],
default: 7,
},
lineWidth: {
type: [String, Number],
default: 4,
},
padding: {
type: [String, Number],
default: 8,
},
showLabels: Boolean,
smooth: {
type: [Boolean, Number, String],
default: false,
},
type: {
type: String as Prop<'trend' | 'bar'>,
default: 'trend',
validator: (val: string) => ['trend', 'bar'].includes(val),
},
value: {
type: Array,
default: () => ([]),
} as PropValidator<SparklineItem[]>,
width: {
type: [Number, String],
default: 300,
},
},
data: () => ({
lastLength: 0,
}),
computed: {
parsedPadding (): number {
return Number(this.padding)
},
parsedWidth (): number {
return Number(this.width)
},
parsedHeight (): number {
return parseInt(this.height, 10)
},
parsedLabelSize (): number {
return parseInt(this.labelSize, 10) || 7
},
totalHeight (): number {
let height = this.parsedHeight
if (this.hasLabels) height += parseInt(this.labelSize, 10) * 1.5
return height
},
totalWidth (): number {
let width = this.parsedWidth
if (this.type === 'bar') width = Math.max(this.value.length * this._lineWidth, width)
return width
},
totalValues (): number {
return this.value.length
},
_lineWidth (): number {
if (this.autoLineWidth && this.type !== 'trend') {
const totalPadding = this.parsedPadding * (this.totalValues + 1)
return (this.parsedWidth - totalPadding) / this.totalValues
} else {
return parseFloat(this.lineWidth) || 4
}
},
boundary (): Boundary {
if (this.type === 'bar') return { minX: 0, maxX: this.totalWidth, minY: 0, maxY: this.parsedHeight }
const padding = this.parsedPadding
return {
minX: padding,
maxX: this.totalWidth - padding,
minY: padding,
maxY: this.parsedHeight - padding,
}
},
hasLabels (): boolean {
return Boolean(
this.showLabels ||
this.labels.length > 0 ||
this.$scopedSlots.label
)
},
parsedLabels (): SparklineText[] {
const labels = []
const points = this._values
const len = points.length
for (let i = 0; labels.length < len; i++) {
const item = points[i]
let value = this.labels[i]
if (!value) {
value = typeof item === 'object'
? item.value
: item
}
labels.push({
x: item.x,
value: String(value),
})
}
return labels
},
normalizedValues (): number[] {
return this.value.map(item => (typeof item === 'number' ? item : item.value))
},
_values (): Point[] | Bar[] {
return this.type === 'trend' ? genPoints(this.normalizedValues, this.boundary) : genBars(this.normalizedValues, this.boundary)
},
textY (): number {
let y = this.parsedHeight
if (this.type === 'trend') y -= 4
return y
},
_radius (): number {
return this.smooth === true ? 8 : Number(this.smooth)
},
},
watch: {
value: {
immediate: true,
handler () {
this.$nextTick(() => {
if (
!this.autoDraw ||
this.type === 'bar' ||
!this.$refs.path
) return
const path = this.$refs.path
const length = path.getTotalLength()
if (!this.fill) {
path.style.transition = 'none'
path.style.strokeDasharray = length + ' ' + length
path.style.strokeDashoffset = Math.abs(length - (this.lastLength || 0)).toString()
path.getBoundingClientRect()
path.style.transition = `stroke-dashoffset ${this.autoDrawDuration}ms ${this.autoDrawEasing}`
path.style.strokeDashoffset = '0'
} else {
path.style.transformOrigin = 'bottom center'
path.style.transition = 'none'
path.style.transform = `scaleY(0)`
path.getBoundingClientRect()
path.style.transition = `transform ${this.autoDrawDuration}ms ${this.autoDrawEasing}`
path.style.transform = `scaleY(1)`
}
this.lastLength = length
})
},
},
},
methods: {
genGradient () {
const gradientDirection = this.gradientDirection
const gradient = this.gradient.slice()
// Pushes empty string to force
// a fallback to currentColor
if (!gradient.length) gradient.push('')
const len = Math.max(gradient.length - 1, 1)
const stops = gradient.reverse().map((color, index) =>
this.$createElement('stop', {
attrs: {
offset: index / len,
'stop-color': color || 'currentColor',
},
})
)
return this.$createElement('defs', [
this.$createElement('linearGradient', {
attrs: {
id: this._uid,
gradientUnits: 'userSpaceOnUse',
x1: gradientDirection === 'left' ? '100%' : '0',
y1: gradientDirection === 'top' ? '100%' : '0',
x2: gradientDirection === 'right' ? '100%' : '0',
y2: gradientDirection === 'bottom' ? '100%' : '0',
},
}, stops),
])
},
genG (children: VNode[]) {
return this.$createElement('g', {
style: {
fontSize: '8',
textAnchor: 'middle',
dominantBaseline: 'mathematical',
fill: 'currentColor',
} as object, // TODO: TS 3.5 is too eager with the array type here
}, children)
},
genPath () {
const points = genPoints(this.normalizedValues, this.boundary)
return this.$createElement('path', {
attrs: {
d: genPath(points, this._radius, this.fill, this.parsedHeight),
fill: this.fill ? `url(#${this._uid})` : 'none',
stroke: this.fill ? 'none' : `url(#${this._uid})`,
},
ref: 'path',
})
},
genLabels (offsetX: number) {
const children = this.parsedLabels.map((item, i) => (
this.$createElement('text', {
attrs: {
x: item.x + offsetX + this._lineWidth / 2,
y: this.textY + (this.parsedLabelSize * 0.75),
'font-size': Number(this.labelSize) || 7,
},
}, [this.genLabel(item, i)])
))
return this.genG(children)
},
genLabel (item: SparklineText, index: number) {
return this.$scopedSlots.label
? this.$scopedSlots.label({ index, value: item.value })
: item.value
},
genBars () {
if (!this.value || this.totalValues < 2) return undefined as never
const bars = genBars(this.normalizedValues, this.boundary)
const offsetX = (Math.abs(bars[0].x - bars[1].x) - this._lineWidth) / 2
return this.$createElement('svg', {
attrs: {
display: 'block',
viewBox: `0 0 ${this.totalWidth} ${this.totalHeight}`,
},
}, [
this.genGradient(),
this.genClipPath(bars, offsetX, this._lineWidth, 'sparkline-bar-' + this._uid),
this.hasLabels ? this.genLabels(offsetX) : undefined as never,
this.$createElement('g', {
attrs: {
'clip-path': `url(#sparkline-bar-${this._uid}-clip)`,
fill: `url(#${this._uid})`,
},
}, [
this.$createElement('rect', {
attrs: {
x: 0,
y: 0,
width: this.totalWidth,
height: this.height,
},
}),
]),
])
},
genClipPath (bars: Bar[], offsetX: number, lineWidth: number, id: string) {
const rounding = typeof this.smooth === 'number'
? this.smooth
: this.smooth ? 2 : 0
return this.$createElement('clipPath', {
attrs: {
id: `${id}-clip`,
},
}, bars.map(item => {
return this.$createElement('rect', {
attrs: {
x: item.x + offsetX,
y: item.y,
width: lineWidth,
height: item.height,
rx: rounding,
ry: rounding,
},
}, [
this.autoDraw ? this.$createElement('animate', {
attrs: {
attributeName: 'height',
from: 0,
to: item.height,
dur: `${this.autoDrawDuration}ms`,
fill: 'freeze',
},
}) : undefined as never,
])
}))
},
genTrend () {
return this.$createElement('svg', this.setTextColor(this.color, {
attrs: {
...this.$attrs,
display: 'block',
'stroke-width': this._lineWidth || 1,
viewBox: `0 0 ${this.width} ${this.totalHeight}`,
},
}), [
this.genGradient(),
this.hasLabels && this.genLabels(-(this._lineWidth / 2)),
this.genPath(),
])
},
},
render (h): VNode {
if (this.totalValues < 2) return undefined as never
return this.type === 'trend' ? this.genTrend() : this.genBars()
},
})
|
{
"pile_set_name": "Github"
}
|
package umcg.genetica.io.trityper;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import cern.colt.matrix.tdouble.DoubleMatrix1D;
import cern.colt.matrix.tdouble.DoubleMatrix2D;
import org.apache.commons.cli.*;
import umcg.genetica.io.Gpio;
import umcg.genetica.io.bin.BinaryFile;
import umcg.genetica.io.text.TextFile;
import umcg.genetica.math.matrix2.DoubleMatrixDataset;
import umcg.genetica.util.Primitives;
import umcg.genetica.util.RankArray;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
/**
* @author Lude, Marc Jan
*/
public class ConvertDoubleMatrixDataToTriTyper {
private static final Pattern SPLIT_ON_TAB = Pattern.compile("\t");
public static void main(String[] args) throws IOException, Exception {
CommandLineParser parser = new GnuParser();
Options options = new Options();
Option datMatrix = OptionBuilder.withArgName("path").hasArg().withDescription("Location of the input file. Needs to be a tab seperated file with samples on the columns and traits on the rows.").withLongOpt("dataMatrix").create("d");
Option mapFile = OptionBuilder.withArgName("path").hasArg().withDescription("Location of the mapping file describing the chromosomal locations of the traits.").withLongOpt("mappingFile").create("m");
Option folderOut = OptionBuilder.withArgName("path").hasArg().withDescription("Location and name of the output TriTyper folder.").withLongOpt("OutputFile").create("o");
Option ranking = OptionBuilder.withArgName("boolean").withDescription("If set first rank the input data, before scaling.").create("r");
Option removeNan = OptionBuilder.withArgName("boolean").withDescription("If set first remove full non-numeric rows.").create("R");
options.addOption(folderOut).addOption(datMatrix).addOption(mapFile).addOption(ranking).addOption(removeNan);
String dataMatrix = null;
String outputFolder = null;
String mappingFile = null;
boolean rank = false;
boolean removeNanRow = false;
CommandLine cmd;
try {
cmd = parser.parse(options, args);
HelpFormatter formatter = new HelpFormatter();
if (cmd.hasOption("OutputFile") || cmd.hasOption("o")) {
// initialise the member variable
outputFolder = cmd.getOptionValue("OutputFile");
} else {
System.out.println("Missing necesarray information: output loc");
formatter.printHelp("ant", options);
System.exit(0);
}
if (cmd.hasOption("dataMatrix") || cmd.hasOption("d")) {
// initialise the member variable
dataMatrix = cmd.getOptionValue("dataMatrix");
} else {
System.out.println("Missing necessary information: data matrix");
formatter.printHelp("ant", options);
System.exit(0);
}
if (cmd.hasOption("mappingFile") || cmd.hasOption("m")) {
// initialise the member variable
mappingFile = cmd.getOptionValue("mappingFile");
}
rank = cmd.hasOption("r");
removeNanRow = cmd.hasOption("R");
} catch (org.apache.commons.cli.ParseException ex) {
Logger.getLogger(ConvertDoubleMatrixDataToTriTyper.class.getName()).log(Level.SEVERE, null, ex);
}
if (!(new File(outputFolder).exists())) {
Gpio.createDir(outputFolder);
} else if (!(new File(outputFolder).isDirectory())) {
System.out.println("Error file is already there but not a directory!");
System.exit(0);
}
HashSet<String> hashCpGSites = new HashSet<String>();
try {
System.out.println("Writing SNPMappings.txt to file:");
int nrSites = 0;
java.io.BufferedReader in = new java.io.BufferedReader(new java.io.FileReader(new File(mappingFile)));
java.io.BufferedWriter outSNPMappings = new java.io.BufferedWriter(new java.io.FileWriter(new File(outputFolder + "/SNPMappings.txt")));
String str;
in.readLine();
while ((str = in.readLine()) != null) {
String[] data = SPLIT_ON_TAB.split(str);
hashCpGSites.add(data[1]);
outSNPMappings.write(data[3] + '\t' + data[4] + '\t' + data[1] + '\n');
nrSites++;
}
System.out.println("Number of sites in mapping file:\t" + nrSites);
outSNPMappings.close();
} catch (Exception e) {
System.out.println("Error:\t" + e.getMessage());
e.printStackTrace();
System.exit(0);
}
System.out.println("Input: " + dataMatrix);
TextFile tf = new TextFile(dataMatrix, TextFile.R);
String[] header = tf.readLineElems(TextFile.tab);
System.out.println("Writing individuals and phenotype info: " + outputFolder + "/Individuals.txt");
BufferedWriter outIndNew = new BufferedWriter(new FileWriter(outputFolder + "/Individuals.txt"));
BufferedWriter outPhenoNew = new BufferedWriter(new FileWriter(outputFolder + "/PhenotypeInformation.txt"));
for (int i = 0; i < header.length; i++) {
outIndNew.write(header[i] + '\n');
outPhenoNew.write(header[i] + "\tcontrol\tinclude\tmale\n");
}
outIndNew.close();
outPhenoNew.close();
System.out.println("Now processing matrix.");
TextFile tfsnp = new TextFile(outputFolder + "/SNPs.txt", TextFile.W);
BinaryFile bfgt = new BinaryFile(outputFolder + "/GenotypeMatrix.dat", BinaryFile.W);
BinaryFile bfdo = new BinaryFile(outputFolder + "/ImputedDosageMatrix.dat", BinaryFile.W);
String[] elems = tf.readLineElems(TextFile.tab);
byte[] alleles = new byte[2];
alleles[0] = 84;
alleles[1] = 67;
int nrRowsRead = 0;
int nrRowsWritten = 0;
while (elems != null) {
String cpg = elems[0];
if (hashCpGSites == null || hashCpGSites.contains(cpg)) {
double[] vals = new double[elems.length - 1];
for (int i = 1; i < elems.length; i++) {
double d = Double.parseDouble(elems[i]);
vals[i - 1] = d;
}
if (rank) {
vals = rankRow(vals);
}
// rescale
vals = rescaleValue(vals, 200d);
int nrSamples = elems.length - 1;
byte[] allele1 = new byte[nrSamples];
byte[] allele2 = new byte[nrSamples];
byte[] dosageValues = new byte[nrSamples];
for (int ind = 0; ind < nrSamples; ind++) {
if (vals[ind] > 100) {
allele1[ind] = alleles[1];
allele2[ind] = alleles[1];
} else {
allele1[ind] = alleles[0];
allele2[ind] = alleles[0];
}
int dosageInt = (int) Math.round(vals[ind]);
byte value = (byte) (Byte.MIN_VALUE + dosageInt);
dosageValues[ind] = value;
}
bfgt.write(allele1);
bfgt.write(allele2);
bfdo.write(dosageValues);
tfsnp.writeln(cpg);
nrRowsWritten++;
}
nrRowsRead++;
if (nrRowsRead % 10000 == 0) {
System.out.println(nrRowsRead + " rows read, " + nrRowsWritten + " written.");
}
elems = tf.readLineElems(TextFile.tab);
}
tf.close();
tfsnp.close();
bfgt.close();
bfdo.close();
System.out.println("Finished.");
}
public static double[] rescaleValue(double[] row, Double multiplier) {
double[] output = new double[row.length];
double min = Primitives.min(row);
double max = Primitives.max(row);
double denominator = max - min;
if (multiplier != null) {
denominator = (max - min) / (1 / multiplier);
}
for (int i = 0; i < output.length; i++) {
output[i] = (row[i] - min) / denominator;
}
return output;
}
public static DoubleMatrix2D rescaleValue(DoubleMatrix2D matrix, Double multiplier) {
if (multiplier != null) {
for (int p = 0; p < matrix.rows(); p++) {
double min = matrix.viewRow(p).getMinLocation()[0];
double denominator = (matrix.viewRow(p).getMaxLocation()[0] - min) * (1 / multiplier);
for (int s = 0; s < matrix.columns(); s++) {
matrix.setQuick(p, s, ((matrix.getQuick(p, s) - min) / denominator));
}
}
} else {
for (int p = 0; p < matrix.rows(); p++) {
double min = matrix.viewRow(p).getMinLocation()[0];
double denominator = matrix.viewRow(p).getMaxLocation()[0] - min;
for (int s = 0; s < matrix.columns(); s++) {
matrix.setQuick(p, s, ((matrix.getQuick(p, s) - min) / denominator));
}
}
}
return matrix;
}
public static DoubleMatrix2D rankRows(DoubleMatrix2D matrix) {
RankArray rda = new RankArray();
for (int p = 0; p < matrix.rows(); p++) {
double[] rankedValues = rda.rank(matrix.viewRow(p).toArray(), true);
for (int s = 0; s < matrix.columns(); s++) {
matrix.setQuick(p, s, rankedValues[s]);
}
}
return matrix;
}
public static double[] rankRow(double[] row) {
RankArray rda = new RankArray();
return rda.rank(row, true);
}
}
|
{
"pile_set_name": "Github"
}
|
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <random>
// template<class Engine, size_t k>
// class shuffle_order_engine
// void discard(unsigned long long z);
#include <random>
#include <cassert>
void
test1()
{
std::knuth_b e1;
std::knuth_b e2 = e1;
assert(e1 == e2);
e1.discard(3);
assert(e1 != e2);
(void)e2();
(void)e2();
(void)e2();
assert(e1 == e2);
}
int main()
{
test1();
}
|
{
"pile_set_name": "Github"
}
|
__attribute__((format(printf, 1, 2)))
void myMultiplyDefinedPrintf(const char *format, ...); // this declaration does not match the definition
__attribute__((format(printf, 1, 2)))
void myMultiplyDefinedPrintf2(const char *format, ...);
__attribute__((format(printf, 1, 2)))
void myMultiplyDefinedPrintf3(const char *format, ...);
void test_custom_printf2()
{
myMultiplyDefinedPrintf("%i", 0); // BAD (too few format arguments)
myMultiplyDefinedPrintf("%i", 0, 1); // GOOD
myMultiplyDefinedPrintf("%i", 0, 1, 2); // BAD (too many format arguments)
myMultiplyDefinedPrintf2("%i", 0); // GOOD (we can't tell which definition is correct so we have to assume this is OK)
myMultiplyDefinedPrintf2("%i", 0, 1); // GOOD (we can't tell which definition is correct so we have to assume this is OK)
myMultiplyDefinedPrintf2("%i", 0, 1, 2); // BAD (too many format arguments regardless of which definition is correct) [NOT DETECTED]
myMultiplyDefinedPrintf3("%s", "%s"); // GOOD (we can't tell which definition is correct so we have to assume this is OK)
myMultiplyDefinedPrintf3("%s", "%s", "%s"); // GOOD (we can't tell which definition is correct so we have to assume this is OK)
myMultiplyDefinedPrintf3("%s", "%s", "%s", "%s"); // BAD (too many format arguments regardless of which definition is correct) [NOT DETECTED]
}
|
{
"pile_set_name": "Github"
}
|
/**
* Copyright (c) 2011-2020, JFXtras
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the organization nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package jfxtras.internal.scene.control.skin.agenda.icalendar.base24hour.popup;
import javafx.scene.Scene;
import jfxtras.icalendarfx.components.VDisplayable;
import jfxtras.icalendarfx.properties.component.recurrence.RecurrenceRule;
import jfxtras.scene.control.agenda.Agenda;
import jfxtras.scene.control.agenda.icalendar.ICalendarAgenda;
/**
* Base Scene for editing descriptive properties and a {@link RecurrenceRule} in a {@link VDisplayable}.
* A {@link EditDisplayableTabPane} passed to the constructor is the root node of the scene graph<br>
*
* @author David Bal
*/
public abstract class EditDisplayableScene extends Scene
{
public EditDisplayableScene(EditDisplayableTabPane<?,?> parent)
{
super(parent);
ICalendarAgenda.class.getResource(ICalendarAgenda.class.getSimpleName() + ".css").toExternalForm();
getStylesheets().addAll(ICalendarAgenda.ICALENDAR_STYLE_SHEET);
String agendaSheet = Agenda.class.getResource("/jfxtras/internal/scene/control/skin/agenda/" + Agenda.class.getSimpleName() + ".css").toExternalForm();
getStylesheets().addAll(ICalendarAgenda.ICALENDAR_STYLE_SHEET, agendaSheet);
}
public EditDisplayableTabPane<?,?> getEditDisplayableTabPane()
{
return (EditDisplayableTabPane<?, ?>) getRoot();
}
}
|
{
"pile_set_name": "Github"
}
|
fileFormatVersion: 2
guid: 00edab3b4c53a4ac792719f0ca7cec99
timeCreated: 1476799198
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
|
{
"pile_set_name": "Github"
}
|
'dblat3.out' NAME OF SUMMARY OUTPUT FILE
6 UNIT NUMBER OF SUMMARY FILE
'DBLAT3.SNAP' NAME OF SNAPSHOT OUTPUT FILE
-1 UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)
F LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.
F LOGICAL FLAG, T TO STOP ON FAILURES.
T LOGICAL FLAG, T TO TEST ERROR EXITS.
16.0 THRESHOLD VALUE OF TEST RATIO
6 NUMBER OF VALUES OF N
0 1 2 3 5 9 VALUES OF N
3 NUMBER OF VALUES OF ALPHA
0.0 1.0 0.7 VALUES OF ALPHA
3 NUMBER OF VALUES OF BETA
0.0 1.0 1.3 VALUES OF BETA
DGEMM T PUT F FOR NO TEST. SAME COLUMNS.
DSYMM T PUT F FOR NO TEST. SAME COLUMNS.
DTRMM T PUT F FOR NO TEST. SAME COLUMNS.
DTRSM T PUT F FOR NO TEST. SAME COLUMNS.
DSYRK T PUT F FOR NO TEST. SAME COLUMNS.
DSYR2K T PUT F FOR NO TEST. SAME COLUMNS.
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" />
<!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Initializers - Application Concerns - Ember Guides</title>
<meta name="description" content="Initializers provide an opportunity to configure your application as it boots.
There are two types of initializers: application initializers and application instance initializers.
Application initializers are run as your application boots, and provide...">
<meta name="referrer" content="unsafe-url">
<!---->
<!---->
<!---->
<!---->
<meta property="og:title" content="Initializers - Application Concerns - Ember Guides">
<!---->
<meta property="og:description" content="Initializers provide an opportunity to configure your application as it boots.
There are two types of initializers: application initializers and application instance initializers.
Application initializers are run as your application boots, and provide...">
<meta property="og:type" content="website">
<!---->
<meta name="twitter:card" content="summary">
<!---->
<!---->
<meta name="twitter:title" content="Initializers - Application Concerns - Ember Guides">
<!---->
<meta name="twitter:description" content="Initializers provide an opportunity to configure your application as it boots.
There are two types of initializers: application initializers and application instance initializers.
Application initializers are run as your application boots, and provide...">
<!---->
<!---->
<!----><meta name="ember-cli-head-end" content>
<link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css">
<link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css">
<link rel="shortcut icon" href="/images/favicon.png" />
</head>
<body class="application version show version-show">
<script type="x/boundary" id="fastboot-body-start"></script><!---->
<header id="ember106065" class="es-header ember-view" role="banner"><div id="ember106066" class="ember-view"><div class="container">
<nav id="ember106067" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com">
<svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg>
</a>
<button id="ember106068" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span>
</button>
<div id="ember106069" class="navbar-collapse collapse ember-view"><ul id="ember106070" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember106071" class="dropdown nav-item ember-view"> <a href="#" id="ember106072" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a>
<!---->
</li>
<!----><li id="ember106074" class="dropdown nav-item ember-view"> <a href="#" id="ember106075" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a>
<!---->
</li>
<li id="ember106077" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a>
</li><!---->
<!----><li id="ember106078" class="dropdown nav-item ember-view"> <a href="#" id="ember106079" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a>
<!---->
</li>
<!----><li id="ember106081" class="dropdown nav-item ember-view"> <a href="#" id="ember106082" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a>
<!---->
</li>
</ul><ul id="ember106084" class="nav navbar-nav ember-view"> <form>
<div id="ember106085" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search">
<div id="ember106086" class="ds-dropdown-results ember-tether ember-view"><!----></div></div>
</form>
</ul>
</div>
</nav></div>
</div>
</header>
<!---->
<div class="info-banner-wrapper">
<div class="info-banner-container">
<div id="ember106087" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p>
</div>
</div>
</div>
<main class="container">
<aside class="sidebar">
<label for="version-select" class="visually-hidden">Guides version</label>
<div id="ember106088" class="ember-basic-dropdown ember-view">
<div aria-label="v2.3.0" aria-owns="ember-basic-dropdown-content-ember106088" tabindex="0" data-ebd-id="ember106088-trigger" role="button" id="ember106089" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 2.3 <!---->
</span>
<!----><span class="ember-power-select-status-icon"></span>
</div>
<div id="ember-basic-dropdown-content-ember106088" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div>
</div>
<input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox">
<label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label>
<nav class="toc-container versions" aria-label="table of contents">
<ol id="ember106093" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0">
<div id="ember106096" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/getting-started" id="ember106097" class="cp-Panel-toggle ember-view"> Getting Started
</a>
<div id="ember106098" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106100" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/tutorial" id="ember106101" class="cp-Panel-toggle ember-view"> Tutorial
</a>
<div id="ember106102" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106104" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/object-model" id="ember106105" class="cp-Panel-toggle ember-view"> The Object Model
</a>
<div id="ember106106" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106108" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/routing" id="ember106109" class="cp-Panel-toggle ember-view"> Routing
</a>
<div id="ember106110" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106112" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/templates" id="ember106113" class="cp-Panel-toggle ember-view"> Templates
</a>
<div id="ember106114" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106116" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/components" id="ember106117" class="cp-Panel-toggle ember-view"> Components
</a>
<div id="ember106118" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106120" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/controllers" id="ember106121" class="cp-Panel-toggle ember-view"> Controllers
</a>
<div id="ember106122" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106124" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/models" id="ember106125" class="cp-Panel-toggle ember-view"> Models
</a>
<div id="ember106126" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106128" class="cp-Panel cp-is-open ember-view"><a href="/v2.3.0/applications" id="ember106129" class="cp-Panel-toggle ember-view"> Application Concerns
</a>
<div id="ember106130" class="cp-Panel-body cp-is-open ember-view">
<div class="cp-Panel-body-inner">
<ol id="ember106131" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 ">
<a href="/v2.3.0/applications/index" id="ember106133" class="ember-view"> Applications and Instances
</a> </li>
<li class="toc-link toc-level-1 ">
<a href="/v2.3.0/applications/dependency-injection" id="ember106135" class="ember-view"> Dependency Injection
</a> </li>
<li class="toc-link toc-level-1 selected">
<a href="/v2.3.0/applications/initializers" id="ember106137" class="selected ember-view"> Initializers
</a> </li>
<li class="toc-link toc-level-1 ">
<a href="/v2.3.0/applications/services" id="ember106139" class="ember-view"> Services
</a> </li>
<li class="toc-link toc-level-1 ">
<a href="/v2.3.0/applications/run-loop" id="ember106141" class="ember-view"> The Run Loop
</a> </li>
</ol>
</div>
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106143" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/testing" id="ember106144" class="cp-Panel-toggle ember-view"> Testing
</a>
<div id="ember106145" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106147" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/ember-inspector" id="ember106148" class="cp-Panel-toggle ember-view"> Ember Inspector
</a>
<div id="ember106149" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106151" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/addons-and-dependencies" id="ember106152" class="cp-Panel-toggle ember-view"> Addons and Dependencies
</a>
<div id="ember106153" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106155" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/configuring-ember" id="ember106156" class="cp-Panel-toggle ember-view"> Configuring Ember.js
</a>
<div id="ember106157" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106159" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/contributing" id="ember106160" class="cp-Panel-toggle ember-view"> Contributing to Ember.js
</a>
<div id="ember106161" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember106163" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/glossary" id="ember106164" class="cp-Panel-toggle ember-view"> Glossary
</a>
<div id="ember106165" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
</ol>
</nav>
</aside>
<article id="ember106166" class="chapter ember-view"> <div class="old-version-warning">
<i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v2.3.0.
<a href="/release/applications/initializers" id="ember106167" class="btn ember-view"> VIEW v3.15.0 </a>
</div>
<a href="https://github.com/ember-learn/guides-source/edit/master/guides/v2.3.0/applications/initializers.md" target="_blank" class="edit-page icon-pencil" rel="noopener">
Edit Page
</a>
<h1>
Initializers
</h1>
<hr>
<div id="ember106168" class="ember-view"><p>Initializers provide an opportunity to configure your application as it boots.</p>
<p>There are two types of initializers: application initializers and application instance initializers.</p>
<p>Application initializers are run as your application boots,
and provide the primary means to configure <a href="../dependency-injection/">dependency injections</a> in your application.</p>
<p>Application instance initializers are run as an application instance is loaded.
They provide a way to configure the initial state of your application,
as well as to set up dependency injections that are local to the application instance
(e.g. A/B testing configurations).</p>
<p>Operations performed in initializers should be kept as lightweight as possible
to minimize delays in loading your application.
Although advanced techniques exist for allowing asynchrony in application initializers
(i.e. <code>deferReadiness</code> and <code>advanceReadiness</code>), these techniques should generally be avoided.
Any asynchronous loading conditions (e.g. user authorization) are almost always
better handled in your application route's hooks,
which allows for DOM interaction while waiting for conditions to resolve.</p>
<h2 id="toc_application-initializers">Application Initializers</h2>
<section aria-labelledby="toc_application-initializers">
<p>Application initializers can be created with Ember CLI's <code>initializer</code> generator:</p>
<pre><code class="bash language-bash">ember generate initializer shopping-cart
</code></pre>
<p>Let's customize the <code>shopping-cart</code> initializer to inject a <code>cart</code> property into all the routes in your application:</p>
<pre><code class="javascript language-javascript"data-filename=app/initializers/shopping-cart.js>export function initialize(application) {
application.inject('route', 'cart', 'service:shopping-cart');
};
export default {
name: 'shopping-cart',
initialize: initialize
};
</code></pre>
</section>
<h2 id="toc_application-instance-initializers">Application Instance Initializers</h2>
<section aria-labelledby="toc_application-instance-initializers">
<p>Application instance initializers can be created with Ember CLI's <code>instance-initializer</code> generator:</p>
<pre><code class="bash language-bash">ember generate instance-initializer logger
</code></pre>
<p>Let's add some simple logging to indicate that the instance has booted:</p>
<pre><code class="javascript language-javascript"data-filename=app/instance-initializers/logger.js>export function initialize(applicationInstance) {
var logger = applicationInstance.lookup('logger:main');
logger.log('Hello from the instance initializer!');
}
export default {
name: 'logger',
initialize: initialize
};
</code></pre>
</section>
<h2 id="toc_specifying-initializer-order">Specifying Initializer Order</h2>
<section aria-labelledby="toc_specifying-initializer-order">
<p>If you'd like to control the order in which initializers run, you can use the <code>before</code> and/or <code>after</code> options:</p>
<pre><code class="javascript language-javascript"data-filename=app/initializers/config-reader.js>export function initialize(application) {
// ... your code ...
};
export default {
name: 'configReader',
before: 'websocketInit',
initialize: initialize
};
</code></pre>
<pre><code class="javascript language-javascript"data-filename=app/initializers/websocket-init.js>export function initialize(application) {
// ... your code ...
};
export default {
name: 'websocketInit',
after: 'configReader',
initialize: initialize
};
</code></pre>
<p>Note that ordering only applies to initializers of the same type (i.e. application or application instance).
Application initializers will always run before application instance initializers.</p>
</section>
</div>
<footer id="ember106169" class="ember-view"> <a href="/v2.3.0/applications/dependency-injection" id="ember106170" class="previous-guide ember-view">Dependency Injection</a>
<a href="/v2.3.0/applications/services" id="ember106171" class="next-guide ember-view"> Services
</a></footer>
</article>
</main>
<footer id="ember106172" class="es-footer ember-view" role="contentinfo"><div class="footer responsive">
<div class="container">
<div id="ember106173" class="footer-info ember-view">
Copyright 2020
<a href="http://tilde.io">Tilde Inc.</a>
<br>
<a href="https://emberjs.com/team">Team</a>
|
<a href="https://emberjs.com/sponsors">Sponsors</a>
<br>
<a href="https://emberjs.com/security">Security</a>
|
<a href="https://emberjs.com/legal">Legal</a>
|
<a href="https://emberjs.com/brand">Brand</a>
<br>
<a href="https://emberjs.com/guidelines">Community Guidelines</a>
<!----></div>
<div id="ember106174" class="footer-statement ember-view">
<p class="footer-tagline">Ember.js is free, open source and always will be.</p>
<div class="footer-social">
<a href="http://twitter.com/emberjs" title="Twitter">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg>
</a>
<a href="https://github.com/emberjs/ember.js" title="GitHub">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg>
</a>
<a href="https://discordapp.com/invite/zT3asNS" title="Discord">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg>
</a>
</div>
</div>
<div id="ember106175" class="footer-contributions ember-view">
<div class="contributor">
<p>Hosted by:</p>
<a href="https://www.heroku.com/emberjs">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg>
</a>
</div>
<div class="contributor">
<p>CDN provided by:</p>
<a href="https://www.fastly.com">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg>
</a>
</div>
<div class="contributor">
<p>Tested with:</p>
<a href="https://percy.io">
<svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg>
</a>
</div>
<div class="contributor">
<p>Resolved with:</p>
<a href="https://dnsimple.com/resolving/emberjs">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg>
</a>
</div>
</div>
</div>
</div>
</footer>
<script type="x/boundary" id="fastboot-body-end"></script>
<script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script>
<script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
# Dolibarr language file - Source file is en_US - members
MembersArea=Ledenoverzicht
MemberCard=Lidmaatschapskaart
SubscriptionCard=Inschrijvingskaart
Member=Lid
Members=Leden
ShowMember=Toon lidmaatschapskaart
UserNotLinkedToMember=Gebruiker niet gekoppeld aan een lid
ThirdpartyNotLinkedToMember=Derden niet gekoppeld aan een lid
MembersTickets=Leden tickets
FundationMembers=Stichtingsleden / -donateurs
ListOfValidatedPublicMembers=Lijst van gevalideerde openbare leden
ErrorThisMemberIsNotPublic=Dit lid is niet openbaar
ErrorMemberIsAlreadyLinkedToThisThirdParty=Een ander lid <b>(naam: %s, login: %s)</b> is al gekoppeld aan een derde partij <b>%s</b>. Verwijder deze link eerst omdat een derde partij niet kan worden gekoppeld aan slechts een lid (en vice versa).
ErrorUserPermissionAllowsToLinksToItselfOnly=Om veiligheidsredenen, moeten aan u rechten worden verleend voor het bewerken van alle gebruikers om in staat te zijn een lid te koppelen aan een gebruiker die niet van u is.
SetLinkToUser=Link naar een Dolibarr gebruiker
SetLinkToThirdParty=Link naar een derde partij in Dolibarr
MembersCards=Visitekaarten van leden
MembersList=Ledenlijst
MembersListToValid=Lijst van conceptleden (te valideren)
MembersListValid=Lijst van geldige leden
MembersListUpToDate=Lijst van geldige leden met een geldig lidmaatschap
MembersListNotUpToDate=Lijst van geldige leden met een verlopen lidmaatschap
MembersListResiliated=Lijst verwijderde leden
MembersListQualified=Lijst van gekwalificeerde leden
MenuMembersToValidate=Conceptleden
MenuMembersValidated=Gevalideerde leden
MenuMembersUpToDate=Bijgewerkte leden
MenuMembersNotUpToDate=Niet bijgewerkte leden
MenuMembersResiliated=Verwijderde leden
MembersWithSubscriptionToReceive=Leden die abonnement moeten ontvangen
MembersWithSubscriptionToReceiveShort=Abonnement ontvangen
DateSubscription=Inschrijvingsdatum
DateEndSubscription=Einddatum abonnement
EndSubscription=Einde abonnement
SubscriptionId=Inschrijvings-ID
MemberId=Lid ID
NewMember=Nieuw lid
MemberType=Type lid
MemberTypeId=Lidtype id
MemberTypeLabel=Lidtype label
MembersTypes=Ledentypes
MemberStatusDraft=Concept (moet worden gevalideerd)
MemberStatusDraftShort=Ontwerp
MemberStatusActive=Gevalideerd (wachtend op abonnement)
MemberStatusActiveShort=Gevalideerd
MemberStatusActiveLate=Abonnement verlopen
MemberStatusActiveLateShort=Verlopen
MemberStatusPaid=Abonnement bijgewerkt
MemberStatusPaidShort=Bijgewerkt
MemberStatusResiliated=Verwijderd lid
MemberStatusResiliatedShort=Verwijderd
MembersStatusToValid=Conceptleden
MembersStatusResiliated=Verwijderde leden
MemberStatusNoSubscription=Gevalideerd (geen abonnement vereist)
MemberStatusNoSubscriptionShort=Gevalideerd
SubscriptionNotNeeded=Geen abonnement nodig
NewCotisation=Nieuwe bijdrage
PaymentSubscription=Nieuwe bijdragebetaling
SubscriptionEndDate=Einddatum abonnement
MembersTypeSetup=Ledentype instellen
MemberTypeModified=Lid gewijzigd
DeleteAMemberType=Lid verwijderen
ConfirmDeleteMemberType=Weet u zeker dat u dit lid wilt verwijderen?
MemberTypeDeleted=Lid verwijderd
MemberTypeCanNotBeDeleted=Lid kan niet worden verwijderd
NewSubscription=Nieuw abonnement
NewSubscriptionDesc=Met dit formulier kunt u uw abonnement te nemen als nieuw lid van de stichting. Wilt u uw abonnement te verlengen (indien reeds lid is), dan kunt u in plaats daarvan contact op met stichtingsbestuur via e-mail %s.
Subscription=Abonnement
Subscriptions=Abonnementen
SubscriptionLate=Laat
SubscriptionNotReceived=Abonnement nooit ontvangen
ListOfSubscriptions=Abonnementenlijst
SendCardByMail=Verzend kaart per e-mail
AddMember=Creeer lid
NoTypeDefinedGoToSetup=Geen lidtypes ingesteld. Ga naar Home->Setup->Ledentypes
NewMemberType=Nieuw lidtype
WelcomeEMail=Welkomst e-mail
SubscriptionRequired=Abonnement vereist
DeleteType=Verwijderen
VoteAllowed=Stemming toegestaan
Physical=Fysiek
Moral=Moreel
MorPhy=Natuur
Reenable=Opnieuw inschakelen
ResiliateMember=Verwijder een lid
ConfirmResiliateMember=Weet je zeker dat je dit lidmaatschap wilt beëindigen?
DeleteMember=Lid verwijderen
ConfirmDeleteMember=Weet je zeker dat je dit lid wilt verwijderen (als je een lid verwijdert, worden al zijn abonnementen verwijderd)?
DeleteSubscription=Abonnement verwijderen
ConfirmDeleteSubscription=Weet u zeker dat u dit abonnement wilt verwijderen?
Filehtpasswd=htpasswd bestand
ValidateMember=Valideer een lid
ConfirmValidateMember=Weet u zeker dat u dit lid wilt valideren?
FollowingLinksArePublic=De volgende links zijn open pagina's die niet worden beschermd door enige Dolibarr-toestemming. Het zijn geen opgemaakte pagina's, die als voorbeeld worden gegeven om te laten zien hoe de ledendatabase moet worden weergegeven.
PublicMemberList=Publieke ledenlijst
BlankSubscriptionForm=Abonnement aanmeldformulier (openbaar)
BlankSubscriptionFormDesc=Dolibarr kan u een openbare URL / website bieden waarmee externe bezoekers kunnen vragen zich te abonneren op de stichting. Als een online betaalmodule is ingeschakeld, kan ook automatisch een betaalformulier worden verstrekt.
EnablePublicSubscriptionForm=Schakel de openbare website in met het zelfinschrijvingsformulier
ForceMemberType=Forceer het lidtype
ExportDataset_member_1=Leden en abonnementen
ImportDataset_member_1=Leden
LastMembersModified=Laatste %s gewijzigde leden
LastSubscriptionsModified=Laatste %s aangepaste abonnementen
String=String
Text=Tekst
Int=Numeriek
DateAndTime=Datum en tijd
PublicMemberCard=Publieke lidmaatschapskaart
SubscriptionNotRecorded=Abonnement niet vastgelegd
AddSubscription=Creëer abonnement
ShowSubscription=Toon abonnement
# Label of email templates
SendingAnEMailToMember=Informatie-e-mail naar lid verzenden
SendingEmailOnAutoSubscription=E-mail verzenden bij automatische registratie
SendingEmailOnMemberValidation=E-mail verzenden bij validatie van nieuwe leden
SendingEmailOnNewSubscription=E-mail verzenden bij nieuw abonnement
SendingReminderForExpiredSubscription=Herinnering verzenden voor verlopen abonnementen
SendingEmailOnCancelation=Verzenden van e-mail bij annulering
# Topic of email templates
YourMembershipRequestWasReceived=Je lidmaatschap is ontvangen.
YourMembershipWasValidated=Uw lidmaatschap is gevalideerd
YourSubscriptionWasRecorded=Uw nieuwe abonnement is opgenomen
SubscriptionReminderEmail=Abonnement herinnering
YourMembershipWasCanceled=Je lidmaatschap is geannuleerd
CardContent=Inhoud van uw lidmaatschapskaart
# Text of email templates
ThisIsContentOfYourMembershipRequestWasReceived=We willen je laten weten dat je lidmaatschapsverzoek is ontvangen. <br><br>
ThisIsContentOfYourMembershipWasValidated=We willen u laten weten dat uw lidmaatschap is gevalideerd met de volgende informatie: <br><br>
ThisIsContentOfYourSubscriptionWasRecorded=We willen u laten weten dat uw nieuwe abonnement is opgenomen. <br><br>
ThisIsContentOfSubscriptionReminderEmail=We willen je laten weten dat je abonnement bijna verloopt of al is verlopen (__MEMBER_LAST_SUBSCRIPTION_DATE_END__). We hopen dat je het zult vernieuwen. <br><br>
ThisIsContentOfYourCard=Dit is een samenvatting van de informatie die we over u hebben. Neem contact met ons op als er iets niet klopt. <br><br>
DescADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT=Onderwerp van de ontvangen e-mail in geval van automatische inschrijving van een gast
DescADHERENT_AUTOREGISTER_NOTIF_MAIL=Inhoud van de ontvangen e-mail in geval van automatische inschrijving van een gast
DescADHERENT_EMAIL_TEMPLATE_AUTOREGISTER=E-mailsjabloon om te gebruiken om e-mail naar een lid te sturen bij automatisch aanmelden van leden
DescADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION=E-mailsjabloon om te gebruiken om e-mail te verzenden naar een lid over de validatie van leden
DescADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION=E-mailsjabloon om te gebruiken om e-mail naar een lid te sturen bij nieuwe abonnementopname
DescADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION=E-mailsjabloon om te gebruiken om e-mailherinnering te verzenden wanneer het abonnement afloopt
DescADHERENT_EMAIL_TEMPLATE_CANCELATION=E-mailsjabloon om te gebruiken om e-mail naar een lid te verzenden bij annulering van een lid
DescADHERENT_MAIL_FROM=E-mail afzender voor automatische e-mails
DescADHERENT_ETIQUETTE_TYPE=Etikettenformaat
DescADHERENT_ETIQUETTE_TEXT=Tekst op leden adres-blad
DescADHERENT_CARD_TYPE=Formaat van kaarten pagina
DescADHERENT_CARD_HEADER_TEXT=Koptekst van lidmaatschapskaarten
DescADHERENT_CARD_TEXT=Tekst op de lidmaatschapskaarten
DescADHERENT_CARD_TEXT_RIGHT=Tekst gedrukt op lidmaatschapkaarten (Rechts uitlijnen)
DescADHERENT_CARD_FOOTER_TEXT=Voettekst van de lidmaatschapskaarten
ShowTypeCard=Toon type "%s"
HTPasswordExport=htpassword bestandsgeneratie
NoThirdPartyAssociatedToMember=Geen derde partijen geassocieerd aan dit lid
MembersAndSubscriptions= Leden en Abonnementen
MoreActions=Aanvullende acties bij inschrijving
MoreActionsOnSubscription=Bijkomende aktie die standaard wordt voorgesteld bij registratie van een inschrijving
MoreActionBankDirect=Aanmaken boeking in bankboek
MoreActionBankViaInvoice=Aanmaken factuur en betaling in bankboek
MoreActionInvoiceOnly=Creëer een factuur zonder betaling
LinkToGeneratedPages=Genereer visitekaartjes
LinkToGeneratedPagesDesc=Met behulp van dit scherm kunt u PDF-bestanden genereren met visitekaartjes voor al uw leden of een bepaald lid.
DocForAllMembersCards=Genereer visitekaartjes voor alle leden (Formaat voor de uitvoer zoals ingesteld: <b>%s</b>)
DocForOneMemberCards=Genereer visitekaartjes voor een bepaald lid (Format voor de uitvoer zoals ingesteld: <b>%s</b>)
DocForLabels=Genereer adresvellen (formaat voor de uitvoer zoals ingesteld: <b>%s</b>)
SubscriptionPayment=Betaling van abonnement
LastSubscriptionDate=Datum van laatste abonnementbetaling
LastSubscriptionAmount=Bedrag van het laatste abonnement
MembersStatisticsByCountries=Leden statistieken per land
MembersStatisticsByState=Leden statistieken per staat / provincie
MembersStatisticsByTown=Leden van de statistieken per gemeente
MembersStatisticsByRegion=Leden statistieken per regio
NbOfMembers=Aantal leden
NoValidatedMemberYet=Geen gevalideerde leden gevonden
MembersByCountryDesc=Dit scherm tonen statistieken over de leden door de landen. Grafisch is echter afhankelijk van Google online grafiek service en is alleen beschikbaar als een internet verbinding is werkt.
MembersByStateDesc=Dit scherm tonen statistieken over de leden door de staat / provincies / kanton.
MembersByTownDesc=Dit scherm tonen statistieken over de leden per gemeente.
MembersStatisticsDesc=Kies de statistieken die u wilt lezen ...
MenuMembersStats=Statistiek
LastMemberDate=Laatste liddatum
LatestSubscriptionDate=Laatste abonnementsdatum
MemberNature=Aard van het lid
Public=Informatie zijn openbaar (no = prive)
NewMemberbyWeb=Nieuw lid toegevoegd. In afwachting van goedkeuring
NewMemberForm=Nieuw lid formulier
SubscriptionsStatistics=Statistieken over abonnementen
NbOfSubscriptions=Aantal abonnementen
AmountOfSubscriptions=Hoeveelheid van abonnementen
TurnoverOrBudget=Omzet (voor een bedrijf) of Budget (voor een stichting)
DefaultAmount=Standaard hoeveelheid van het abonnement
CanEditAmount=Bezoeker kan kiezen / wijzigen bedrag van zijn inschrijving
MEMBER_NEWFORM_PAYONLINE=Spring op geïntegreerde online betaalpagina
ByProperties=Van nature
MembersStatisticsByProperties=Ledenstatistieken per aard
MembersByNature=Dit scherm toont statistieken over de leden per aard.
MembersByRegion=Dit scherm tonen statistieken over de leden per streek.
VATToUseForSubscriptions=BTW tarief voor inschrijvingen
NoVatOnSubscription=Geen btw voor abonnementen
ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS=Product gebruikt voor abbonement regel in factuur: %s
NameOrCompany=Naam of Bedrijf
SubscriptionRecorded=Abonnement opgenomen
NoEmailSentToMember=Geen e-mail verzonden naar lid
EmailSentToMember=E-mail verzonden naar lid op %s
SendReminderForExpiredSubscriptionTitle=Stuur een herinnering per e-mail voor een verlopen abonnement
SendReminderForExpiredSubscription=Stuur een herinnering per e-mail naar leden wanneer het abonnement afloopt (parameter is het aantal dagen voor het einde van het abonnement om de herinnering te verzenden. Het kan een lijst zijn met dagen gescheiden door een puntkomma, bijvoorbeeld '10; 5; 0; -5')
MembershipPaid=Lidmaatschap betaald voor huidige periode (tot %s)
YouMayFindYourInvoiceInThisEmail=Mogelijk vindt u uw factuur bij deze e-mail
XMembersClosed=%s lid (leden) gesloten
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2014 The Error Prone Authors.
*
* 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.errorprone.refaster.testdata;
/**
* Test data for {@code AssertTemplate}.
*/
public class AssertTemplateExample {
public void example(String s) {
assert !s.isEmpty() : s + " must not be empty";
assert !s.isEmpty();
System.out.println(s);
}
}
|
{
"pile_set_name": "Github"
}
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<AssemblyName>Xamarin.Forms.Mocks.Tests</AssemblyName>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.7.0.968" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TestAssembly\TestAssembly.csproj" />
<ProjectReference Include="..\Xamarin.Forms.Mocks\Xamarin.Forms.Mocks.csproj" />
<ProjectReference Include="..\Xamarin.Forms.Mocks.Xaml\Xamarin.Forms.Mocks.Xaml.csproj" />
</ItemGroup>
</Project>
|
{
"pile_set_name": "Github"
}
|
SPDX-License-Identifier: LGPL-2.0
|
{
"pile_set_name": "Github"
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alipay.lookout.remote.report;
/**
* Created by [email protected] on 2017/3/29.
*/
public final class Address {
private String ip;
private int port = 7200;
public Address(String ip) {
this.ip = ip.trim();
}
public Address(String ip, int port) {
this.ip = ip.trim();
this.port = port;
}
public String ip() {
return ip;
}
public int port() {
return port;
}
@Override
public String toString() {
return "{" + "ip='" + ip + '\'' + ", port=" + port + '}';
}
}
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="utf-8" ?>
<connectionStrings>
<!-- Rename this file SharedConfiguration.config and fill out your personal copy of the shared connection strings. -->
<!-- This is the primary Azure Storage Account you will use for your demos! -->
<!-- Create your account in Azure before demoing! -->
<add name="Azure Storage Account Demo Primary" connectionString="DefaultEndpointsProtocol=https;AccountName={youraccountname};AccountKey={youraccountkey}" />
<add name="Azure SQL Database Demo" connectionString="metadata=res://*/SqlDatabase.ProductsModel.csdl|res://*/SqlDatabase.ProductsModel.ssdl|res://*/SqlDatabase.ProductsModel.msl;provider=System.Data.SqlClient;provider connection string="data source={yourdatabase}.database.windows.net;initial catalog=AdventureWorksProducts;persist security info=True;user id={yourusername};password={yourpassword};MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/>
<add name="Azure DocumentDB Demo" connectionString="endpoint|{yourendpoint};authkey|{yourdoauthkey}"/>
</connectionStrings>
|
{
"pile_set_name": "Github"
}
|
---
title: Publicación y resolución de nombres del mismo nivel
ms.date: 03/30/2017
ms.assetid: f0370e08-9fa6-4ee5-ab78-9a58a20a7da2
ms.openlocfilehash: 4a0787972a61f5700d1e8728be96db8ef9ee749e
ms.sourcegitcommit: 7588136e355e10cbc2582f389c90c127363c02a5
ms.translationtype: HT
ms.contentlocale: es-ES
ms.lasthandoff: 03/15/2020
ms.locfileid: "64623198"
---
# <a name="peer-name-publication-and-resolution"></a>Publicación y resolución de nombres del mismo nivel
## <a name="publishing-a-peer-name"></a>Publicación de un nombre del mismo nivel
Para publicar un nuevo identificador PNRP, un elemento de mismo nivel realiza lo siguiente:
- Envía mensajes de publicación de PNRP a sus vecinos de caché (los elementos de mismo nivel que han registrado identificadores PNRP en el nivel más bajo de la memoria caché) para inicializar sus cachés.
- Elige nodos aleatorios en la nube que no son sus vecinos y les envía solicitudes de resolución de nombres de PNRP para su propio identificador P2P. El proceso de determinación del punto de conexión resultante inicializa las memorias caché de los nodos aleatorios en la nube con el identificador PNRP del elemento de mismo nivel de publicación.
Los nodos de la versión 2 de PNRP no publican identificadores PNRP si solo resuelven otros identificadores de P2P. El valor del Registro HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerNet\PNRP\IPV6-Global\SearchOnly=1 (tipo REG_DWORD) especifica que los elementos de mismo nivel solo usen PNRP para la resolución de nombres, nunca para la publicación de nombres. Este valor del Registro también se puede configurar mediante Directiva de grupo.
## <a name="resolving-a-peer-name"></a>Resolución de un nombre del mismo nivel
La búsqueda de otros elementos de mismo nivel en una red de PNRP o en la nube es un proceso que consta de dos fases:
1. Determinación del punto de conexión
2. Resolución de identificadores PNRP
En la fase de determinación del punto de conexión, un equipo de mismo nivel que está intentando resolver el identificador PNRP de un servicio en otro equipo determina la dirección IPv6 de ese equipo remoto de mismo nivel. El equipo remoto de mismo nivel es el que publica o está asociado con el identificador PNRP del equipo o servicio.
Después de confirmar que el punto de conexión remoto se ha registrado en la nube PNRP, el equipo de mismo nivel que realiza la solicitud en la fase de resolución de identificadores PNRP envía una solicitud a ese punto de conexión de mismo nivel para requerir el identificador PNRP del servicio deseado. El punto de conexión envía una respuesta que confirma el identificador PNRP del servicio, un comentario y hasta 4 kilobytes de información adicional que el equipo de mismo nivel que realiza la solicitud puede usar para la comunicación posterior. Por ejemplo, si el punto de conexión deseado es un servidor de juegos, los datos adicionales del registro de nombre de mismo nivel pueden contener información sobre el juego, el nivel de juego y el número actual de jugadores.
En la fase de determinación de punto de conexión, PNRP usa un proceso iterativo para buscar el nodo que publicó el identificador PNRP, en el que el nodo que realiza la resolución es responsable de ponerse en contacto con los nodos que están más cercanos consecutivamente al identificador PNRP de destino.
Para realizar la resolución de nombres en PNRP, el equipo de mismo nivel examina las entradas en su propia memoria caché para buscar una que coincida con el identificador PNRP de destino. Si se encuentra, el equipo de mismo nivel envía un mensaje de solicitud de PNRP y espera una respuesta. Si no se encuentra una entrada para el identificador PNRP, el equipo de mismo nivel envía un mensaje de solicitud PNRP al equipo de mismo nivel que se corresponde a la entrada que tiene un identificador PNRP que mejor coincida con el identificador PNRP de destino. El nodo que recibe el mensaje de solicitud de PNRP examina su propia memoria caché y realiza las acciones siguientes:
- Si se encuentra el identificador PNRP, el punto de conexión de mismo nivel solicitado responde directamente al equipo de mismo nivel que realizó la solicitud.
- Si no se encuentra el identificador PNRP y un identificador PNRP de la memoria caché está más próximo al identificador PNRP de destino, el equipo de mismo nivel receptor de la solicitud envía una respuesta al emisor de la solicitud que contiene la dirección IPv6 del equipo de mismo nivel que representa la entrada con un identificador PNRP que mejor coincida con el identificador PNRP de destino. Con la dirección IP en la respuesta, el nodo solicitante envía otro mensaje de solicitud de PNRP a la dirección IPv6 para responder o examinar su caché.
- Si no se encuentra el identificador PNRP y no hay ningún identificador PNRP en su memoria caché que se aproxime más al identificador PNRP de destino, el equipo de mismo nivel al que se realiza la solicitud envía al equipo solicitante una respuesta que indica esta condición. Después, el equipo de mismo nivel solicitante elige el identificador PNRP más cercano siguiente.
El equipo de mismo nivel solicitante continúa con iteraciones sucesivas, hasta localizar el nodo que registró el identificador PNRP.
En el espacio de nombres <xref:System.Net.PeerToPeer>, hay una relación de varios a varios entre los registros <xref:System.Net.PeerToPeer.PeerName> que contienen puntos de conexión y nubes PNRP o mallas en las que se comunican. Cuando hay entradas duplicadas u obsoletas, o varios nodos con el mismo nombre de mismo nivel, los nodos PNRP pueden obtener información actual mediante la clase <xref:System.Net.PeerToPeer.PeerNameResolver>. Los métodos <xref:System.Net.PeerToPeer.PeerNameResolver> usan un nombre de mismo nivel único para simplificar la perspectiva a registros de nombre de mismo nivel de uno a varios y del mismo equipo de mismo nivel a varias nubes. Esto es similar a una consulta realizada con una combinación de tabla relacional. Tras completarse correctamente, el objeto de resolución devuelve una <xref:System.Net.PeerToPeer.PeerNameRecordCollection> para el nombre de mismo nivel especificado. Por ejemplo, un nombre de mismo nivel se produciría en todos los registros de nombre de mismo nivel en la colección, ordenados por nube. Estas son las instancias del nombre de mismo nivel cuyos datos auxiliares se pueden solicitar mediante una aplicación basada en PNRP.
## <a name="see-also"></a>Vea también
- <xref:System.Net.PeerToPeer>
|
{
"pile_set_name": "Github"
}
|
class CTxnLocal[ T ] {
def set( x: T )( implicit t: Txn ) {}
def get( implicit t: Txn ) : T = null.asInstanceOf[ T ]
def initialValue( t: Txn ) : T = null.asInstanceOf[ T ]
}
trait Txn
trait ProcTxn {
def ccstm: Txn
}
trait TxnLocal[ @specialized T ] {
def apply()( implicit tx: ProcTxn ) : T
def set( v: T )( implicit tx: ProcTxn ) : Unit
def swap( v: T )( implicit tx: ProcTxn ) : T
def transform( f: T => T )( implicit tx: ProcTxn ) : Unit
}
object TxnLocal {
def apply[ @specialized T ] : TxnLocal[ T ] = new Impl( new CTxnLocal[ T ])
def apply[ @specialized T ]( initValue: => T ) : TxnLocal[ T ] = new Impl( new CTxnLocal[ T ] {
override def initialValue( tx: Txn ): T = initValue
})
private class Impl[ T ]( c: CTxnLocal[ T ]) extends TxnLocal[ T ] {
def apply()( implicit tx: ProcTxn ) : T = c.get( tx.ccstm )
def set( v: T )( implicit tx: ProcTxn ) : Unit = c.set( v )( tx.ccstm )
def swap( v: T )( implicit tx: ProcTxn ) : T = {
// currently not implemented in CTxnLocal
val oldV = apply
set( v )
oldV
}
def transform( f: T => T )( implicit tx: ProcTxn ) {
set( f( apply ))
}
}
}
object Transition {
private val currentRef = TxnLocal[ Transition ]( Instant )
def current( implicit tx: ProcTxn ) : Transition = currentRef()
}
sealed abstract class Transition
case object Instant extends Transition
|
{
"pile_set_name": "Github"
}
|
// Copyright (C) 2019 The Android Open Source Project
//
// 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.
import {Protocol} from 'devtools-protocol';
import {ProtocolProxyApi} from 'devtools-protocol/types/protocol-proxy-api';
import * as rpc from 'noice-json-rpc';
import {extractTraceConfig} from '../base/extract_utils';
import {TraceConfig} from '../common/protos';
import {
ConsumerPortResponse,
GetTraceStatsResponse,
ReadBuffersResponse
} from '../controller/consumer_port_types';
import {RpcConsumerPort} from '../controller/record_controller_interfaces';
import {perfetto} from '../gen/protos';
import {DevToolsSocket} from './devtools_socket';
const CHUNK_SIZE: number = 1024 * 1024 * 16; // 16Mb
export class ChromeTracingController extends RpcConsumerPort {
private streamHandle: string|undefined = undefined;
private uiPort: chrome.runtime.Port;
private api: ProtocolProxyApi.ProtocolApi;
private devtoolsSocket: DevToolsSocket;
private lastBufferUsageEvent: Protocol.Tracing.BufferUsageEvent|undefined;
constructor(port: chrome.runtime.Port) {
super({
onConsumerPortResponse: (message: ConsumerPortResponse) =>
this.uiPort.postMessage(message),
onError: (error: string) =>
this.uiPort.postMessage({type: 'ChromeExtensionError', error}),
onStatus: (status) =>
this.uiPort.postMessage({type: 'ChromeExtensionStatus', status})
});
this.uiPort = port;
this.devtoolsSocket = new DevToolsSocket();
this.devtoolsSocket.on('close', () => this.resetState());
const rpcClient = new rpc.Client(this.devtoolsSocket);
this.api = rpcClient.api();
this.api.Tracing.on('tracingComplete', this.onTracingComplete.bind(this));
this.api.Tracing.on('bufferUsage', this.onBufferUsage.bind(this));
}
handleCommand(methodName: string, requestData: Uint8Array) {
switch (methodName) {
case 'EnableTracing':
this.enableTracing(requestData);
break;
case 'FreeBuffers':
this.freeBuffers();
break;
case 'ReadBuffers':
this.readBuffers();
break;
case 'DisableTracing':
this.disableTracing();
break;
case 'GetTraceStats':
this.getTraceStats();
break;
case 'GetCategories':
this.getCategories();
break;
default:
this.sendErrorMessage('Action not recognized');
console.log('Received not recognized message: ', methodName);
break;
}
}
enableTracing(enableTracingRequest: Uint8Array) {
this.resetState();
const traceConfigProto = extractTraceConfig(enableTracingRequest);
if (!traceConfigProto) {
this.sendErrorMessage('Invalid trace config');
return;
}
const traceConfig = TraceConfig.decode(traceConfigProto);
const chromeConfig = this.extractChromeConfig(traceConfig);
this.handleStartTracing(chromeConfig);
}
toCamelCase(key: string, separator: string): string {
return key.split(separator)
.map((part, index) => {
return (index === 0) ? part : part[0].toUpperCase() + part.slice(1);
})
.join('');
}
// tslint:disable-next-line: no-any
convertDictKeys(obj: any): any {
if (Array.isArray(obj)) {
return obj.map(v => this.convertDictKeys(v));
}
if (typeof obj === 'object' && obj !== null) {
// tslint:disable-next-line: no-any
const converted: any = {};
for (const key of Object.keys(obj)) {
converted[this.toCamelCase(key, '_')] = this.convertDictKeys(obj[key]);
}
return converted;
}
return obj;
}
// tslint:disable-next-line: no-any
convertToDevToolsConfig(config: any): Protocol.Tracing.TraceConfig {
// DevTools uses a different naming style for config properties: Dictionary
// keys are named "camelCase" style, rather than "underscore_case" style as
// in the TraceConfig.
config = this.convertDictKeys(config);
// recordMode is specified as an enum with camelCase values.
if (config.recordMode) {
config.recordMode = this.toCamelCase(config.recordMode as string, '-');
}
return config as Protocol.Tracing.TraceConfig;
}
// TODO(nicomazz): write unit test for this
extractChromeConfig(perfettoConfig: TraceConfig):
Protocol.Tracing.TraceConfig {
for (const ds of perfettoConfig.dataSources) {
if (ds.config && ds.config.name === 'org.chromium.trace_event' &&
ds.config.chromeConfig && ds.config.chromeConfig.traceConfig) {
const chromeConfigJsonString = ds.config.chromeConfig.traceConfig;
const config = JSON.parse(chromeConfigJsonString);
return this.convertToDevToolsConfig(config);
}
}
return {};
}
freeBuffers() {
this.devtoolsSocket.detach();
this.sendMessage({type: 'FreeBuffersResponse'});
}
async readBuffers(offset = 0) {
if (!this.devtoolsSocket.isAttached() || this.streamHandle === undefined) {
this.sendErrorMessage('No tracing session to read from');
return;
}
const res = await this.api.IO.read(
{handle: this.streamHandle, offset, size: CHUNK_SIZE});
if (res === undefined) return;
const chunk = res.base64Encoded ? atob(res.data) : res.data;
// The 'as {} as UInt8Array' is done because we can't send ArrayBuffers
// trough a chrome.runtime.Port. The conversion from string to ArrayBuffer
// takes place on the other side of the port.
const response: ReadBuffersResponse = {
type: 'ReadBuffersResponse',
slices: [{data: chunk as {} as Uint8Array, lastSliceForPacket: res.eof}]
};
this.sendMessage(response);
if (res.eof) return;
this.readBuffers(offset + res.data.length);
}
async disableTracing() {
await this.api.Tracing.end();
this.sendMessage({type: 'DisableTracingResponse'});
}
getTraceStats() {
let percentFull = 0; // If the statistics are not available yet, it is 0.
if (this.lastBufferUsageEvent && this.lastBufferUsageEvent.percentFull) {
percentFull = this.lastBufferUsageEvent.percentFull;
}
const stats: perfetto.protos.ITraceStats = {
bufferStats:
[{bufferSize: 1000, bytesWritten: Math.round(percentFull * 1000)}]
};
const response: GetTraceStatsResponse = {
type: 'GetTraceStatsResponse',
traceStats: stats
};
this.sendMessage(response);
}
getCategories() {
const fetchCategories = async () => {
const categories = (await this.api.Tracing.getCategories()).categories;
this.uiPort.postMessage({type: 'GetCategoriesResponse', categories});
};
// If a target is already attached, we simply fetch the categories.
if (this.devtoolsSocket.isAttached()) {
fetchCategories();
return;
}
// Otherwise, we attach temporarily.
this.devtoolsSocket.attachToBrowser(async (error?: string) => {
if (error) {
this.sendErrorMessage(
`Could not attach to DevTools browser target ` +
`(req. Chrome >= M81): ${error}`);
return;
}
fetchCategories();
this.devtoolsSocket.detach();
});
}
resetState() {
this.devtoolsSocket.detach();
this.streamHandle = undefined;
}
onTracingComplete(params: Protocol.Tracing.TracingCompleteEvent) {
this.streamHandle = params.stream;
this.sendMessage({type: 'EnableTracingResponse'});
}
onBufferUsage(params: Protocol.Tracing.BufferUsageEvent) {
this.lastBufferUsageEvent = params;
}
handleStartTracing(traceConfig: Protocol.Tracing.TraceConfig) {
this.devtoolsSocket.attachToBrowser(async (error?: string) => {
if (error) {
this.sendErrorMessage(
`Could not attach to DevTools browser target ` +
`(req. Chrome >= M81): ${error}`);
return;
}
await this.api.Tracing.start({
traceConfig,
streamFormat: 'proto',
transferMode: 'ReturnAsStream',
streamCompression: 'gzip',
bufferUsageReportingInterval: 200
});
});
}
}
|
{
"pile_set_name": "Github"
}
|
client
dev tun
proto udp
remote gla-c01.ipvanish.com 443
resolv-retry infinite
nobind
persist-key
persist-tun
persist-remote-ip
ca /etc/openvpn/ipvanish/ca.ipvanish.com.crt
verify-x509-name gla-c01.ipvanish.com name
auth-user-pass /config/openvpn-credentials.txt
comp-lzo
verb 3
auth SHA256
cipher AES-256-CBC
keysize 256
tls-cipher TLS-DHE-RSA-WITH-AES-256-CBC-SHA:TLS-DHE-DSS-WITH-AES-256-CBC-SHA:TLS-RSA-WITH-AES-256-CBC-SHA
|
{
"pile_set_name": "Github"
}
|
html {
height: 100%;
}
body {
min-width: 1000px;
min-height: 600px;
height: 100%;
}
section {
height: 100%;
background-color: #f1f1f1;
padding: 10px 16px;
margin: 10px 16px;
}
textarea {
overflow: auto !important;
padding-left: 12px;
}
input[type="text"],
input[type="select"],
input[type="search"] {
height: 25px;
}
input[type="text"],
input[type="search"] {
padding-left: 12px;
}
[ng\:cloak],
[ng-cloak],
[data-ng-cloak],
[x-ng-cloak],
.ng-cloak,
.x-ng-cloak {
display: none !important;
}
form.form input.ng-invalid,
form.form select.ng-invalid,
form.form textarea.ng-invalid {
-webkit-box-shadow: none;
box-shadow: none;
border: 1px solid #d40018 !important;
}
form.form input.ng-valid,
form.form select.ng-valid,
form.form textarea.ng-valid {
-webkit-box-shadow: none;
box-shadow: none;
border: 1px solid #0e9300 !important;
}
form.form div.alert:not(.ng-hide) {
padding: 1px 10px;
margin: 0 10px;
}
form.form div.alert:not(.ng-hide) + div.alert:not(.ng-hide) {
margin-left: 0;
}
.row-layout {
height: 100%;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
overflow: hidden;
}
.col-layout {
height: 100%;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
overflow: hidden;
}
.row-layout > *,
.col-layout > * {
-webkit-box-flex: 1;
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
position: relative;
overflow: hidden;
}
.row-layout > .auto-size,
.col-layout > .auto-size {
-webkit-box-flex: 0;
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
position: relative;
}
.row-layout > * > .row-layout,
.col-layout > * > .row-layout,
.row-layout > * > .col-layout,
.col-layout > * > .col-layout,
.row-layout > * > .full-size,
.col-layout > * > .full-size {
position: absolute;
height: 100%;
width: 100%;
}
.row-layout > .auto-size > .row-layout,
.col-layout > .auto-size > .row-layout,
.row-layout > .auto-size > .col-layout,
.col-layout > .auto-size > .col-layout {
position: relative;
}
.delimiter {
height: 0;
-webkit-box-flex: 0;
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
margin: 1px 10px;
}
.delimiter.line {
border-bottom: 1px solid #d7d7d7;
}
.full-size {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
padding: 10px 16px;
}
.nav-tabs {
border-bottom: 1px solid #8f8f8f;
-webkit-box-flex: 0 !important;
-webkit-flex: 0 0 auto !important;
-ms-flex: 0 0 auto !important;
flex: 0 0 auto !important;
height: 25px;
overflow: visible;
}
.nav-tabs > li {
cursor: pointer;
}
.nav-tabs > li:first-child {
margin-left: 20px;
}
.nav-tabs > li > a {
line-height: .3;
color: #707070;
margin-right: 3px;
padding: 10px 16px;
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
border: 1px solid #8f8f8f;
border-bottom: none;
background-color: #f1f1f1;
height: 25px;
}
.nav-tabs > li:not(.active) > a {
height: 24px;
}
.nav-tabs > li:not(.active) > a,
.nav-tabs > li:not(.active) > a:focus {
border: 1px solid #d7d7d7;
background-color: #d7d7d7;
}
.nav-tabs > li:not(.active) > a:hover {
border: 1px solid #8f8f8f;
background-color: #8f8f8f;
color: #f1f1f1;
}
div.tab-content > div.tab-pane {
border-bottom: 1px solid #8f8f8f;
border-left: 1px solid #8f8f8f;
border-right: 1px solid #8f8f8f;
padding: 10px 16px;
position: absolute;
width: 100%;
height: 100%;
}
div.tab-content .nav-tabs > li.active > a,
div.tab-content .nav-tabs > li.active > a:hover,
div.tab-content .nav-tabs > li.active > a:focus {
background-color: white;
}
div.tab-content div.tab-content {
background-color: white;
}
.tab-hide-disabled > .nav-tabs > li.disabled {
display: none;
}
div.tabbable.tab-hide-inactive > .nav-tabs > li.active {
margin-left: 20px;
}
div.tabbable.tab-hide-inactive > .nav-tabs > li:not(.active ) {
display: none;
}
div.tabbable.tab-hide-inactive > .nav-tabs > li:not(.active ).cmp-tab-select-dropdown {
display: block;
}
.modal-header {
background-color: #f08532;
height: 25px;
padding: 0 10px;
color: white;
}
.modal-header .modal-header__close {
float: right;
cursor: pointer;
}
.modal-footer {
clear: both;
}
.interaction-modal > .modal-dialog {
width: 60%;
min-width: 600px;
max-width: 1000px;
padding: 0;
margin-top: 35px;
}
.interaction-modal > .modal-dialog .modal-body {
height: 400px;
width: 100%;
}
.fields {
max-height: 50px;
}
.fields div {
overflow: visible;
word-wrap: break-word;
}
.fields.static {
height: 50px;
}
.fields input,
.fields select {
width: 100%;
}
.aligned-fields.row-layout,
.aligned-fields.row-layout,
.aligned-fields.col-layout,
.aligned-fields.col-layout {
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
}
.aligned-fields .row-layout,
.aligned-fields .row-layout,
.aligned-fields .col-layout,
.aligned-fields .col-layout {
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
}
div.field-heading {
text-align: right;
font-weight: 700;
position: relative;
margin: 0 10px;
}
.dropdown [role="menuitem"] {
cursor: pointer;
}
.button-group .btn {
margin: 0 2px;
}
table.list {
background-color: inherit;
width: 100%;
}
table.list > tbody > tr {
height: 10px;
}
table.list > tbody > tr > td {
padding: 0;
}
div.indicator {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color: rgba(58, 58, 58, 0.25);
}
div.table__actions {
padding: 1px 0;
}
table.table thead i.active {
color: #f08532;
}
table.table thead tr.table__head-title {
background-color: #707070;
}
table.table thead tr.table__head-title > th:not(.table__head___checkmark) {
cursor: pointer;
padding: 0 5px;
}
table.table thead .table__head___checkmark {
vertical-align: top;
padding-left: 15px;
}
table.table thead tr.table__head___title {
float: left;
}
table.table thead .table__head___filter {
height: 25px;
float: right;
}
table.table thead .table__head___filter > i {
cursor: pointer;
}
table.table thead .table__head___filter > i:hover {
color: #f08532;
}
table.table thead td,
table.table thead th {
border-right: 1px solid white;
}
table.table thead td:last-child,
table.table thead th:last-child {
border-right: none;
}
table.table thead tr.table__head-search {
background-color: #d7d7d7;
}
table.table thead tr.table__head-search th {
width: auto;
}
table.table thead tr.table__head-search td input[type="search"] {
color: #707070;
border: 1px solid #d7d7d7;
}
table.table tbody {
background-color: #ffebd5;
}
table.table tbody > tr {
cursor: pointer;
}
table.table tbody > tr:nth-child( even ) {
background-color: #f1f1f1;
}
table.table tbody > tr:nth-child( odd ) {
background-color: white;
}
table.table tbody > tr:hover {
background-color: #cbebff;
}
table.table tbody > tr[selected="selected"] {
background-color: #79c7ff;
}
table.table tbody > tr[selected="selected"]:hover {
background-color: #cbebff;
}
table.table tbody > tr.table__row___sticky {
background-color: #ffebd5;
color: #ce5909;
}
table.table tr {
-webkit-transition: 0.5s ease-in-out -webkit-transform, opacity;
transition: 0.5s ease-in-out transform, opacity;
}
table.table tr.ng-enter {
-webkit-transform: translate(-2000px, 0px);
-ms-transform: translate(-2000px, 0px);
transform: translate(-2000px, 0px);
opacity: .8;
}
table.table tr.ng-enter-active,
table.table tr.ng-leave {
-webkit-transform: translate(0px, 0px);
-ms-transform: translate(0px, 0px);
transform: translate(0px, 0px);
opacity: 1;
}
table.table tr.ng-leave-active {
-webkit-transform: translate(2000px, 0px);
-ms-transform: translate(2000px, 0px);
transform: translate(2000px, 0px);
opacity: .8;
}
.table__load-more {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
}
div.table__container .table__column___xs {
width: 50px;
padding-left: 15px;
}
div.table__container table.table {
table-layout: fixed;
margin-bottom: 0;
border: none;
}
div.table__container table.table td,
div.table__container table.table th {
vertical-align: middle;
}
div.table__container > div.table__body {
overflow: auto;
}
div.table__container .table__head {
border: 1px solid #d7d7d7;
}
div.table__container .table__body {
border: 1px solid #d7d7d7;
border-top: none;
}
div.cmp-colored-dropdown {
width: 100%;
}
div.cmp-colored-dropdown ul.dropdown-menu {
top: 33px;
min-width: 100%;
}
div.cmp-colored-dropdown ul.dropdown-menu > li {
text-align: left;
cursor: pointer;
margin: 2px 0;
}
div.cmp-colored-dropdown ul.dropdown-menu > li > a {
color: #323232;
padding: 1px 0;
}
div.cmp-colored-dropdown ul.dropdown-menu > li > a > span.dropdown-color {
position: relative;
top: 2px;
}
div.cmp-colored-dropdown ul.dropdown-menu > li > a > span:not(.dropdown-color) {
margin-right: 10px;
position: relative;
top: -4px;
}
div.cmp-colored-dropdown .dropdown-color {
width: 20px;
height: 20px;
display: inline-block;
margin: 0 10px;
}
div.cmp-colored-dropdown button.cmp-colored-dropdown__heading {
background-color: white;
padding: 1px 0;
width: 100%;
height: 100%;
}
div.cmp-colored-dropdown button.cmp-colored-dropdown__heading div.dropdown-display-value {
text-overflow: ellipsis;
overflow-x: hidden;
text-align: left;
color: #323232;
}
div.cmp-colored-dropdown button.cmp-colored-dropdown__heading .dropdown-color {
margin-right: 10px;
}
div.cmp-colored-dropdown button.cmp-colored-dropdown__heading div.dropdown-caret {
margin: 0 10px;
color: #323232;
}
div.cmp-colored-dropdown button.cmp-colored-dropdown__heading > .col-layout {
margin: 3px 5px;
}
li.cmp-tab-dropdown > a {
padding: 5px 16px !important;
}
li.cmp-tab-dropdown > ul.dropdown-menu {
left: auto;
right: 0;
}
li.cmp-tab-select-dropdown > a {
padding: 5px 16px !important;
}
li.cmp-tab-select-dropdown > ul.dropdown-menu {
left: auto;
right: 0;
}
.cmp-error-container {
position: relative;
}
.cmp-error-container > .cmp-error-overlay {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.75);
color: #323232;
}
.cmp-error-container > .cmp-error-overlay > .cmp-error {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: start;
-webkit-align-items: flex-start;
-ms-flex-align: start;
align-items: flex-start;
position: absolute;
top: 50%;
left: 50%;
width: 300px;
margin-left: -150px;
padding: 10px 16px;
background-color: #d7d7d7;
}
.cmp-error-container > .cmp-error-overlay > .cmp-error > * {
-webkit-box-flex: 0;
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
margin-right: 10px;
}
.cmp-error-container > .cmp-error-overlay > .cmp-error > *:last-child {
margin-right: 0;
}
.cmp-error-container > .cmp-error-overlay > .cmp-error > .cmp-icon > img {
height: 30px;
}
.cmp-error-container > .cmp-error-overlay > .cmp-error > .cmp-message {
-webkit-box-flex: 1;
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
max-height: 150px;
overflow: hidden;
}
.cmp-error-container > .cmp-error-overlay > .cmp-error > .cmp-close .close {
color: #323232;
text-shadow: none;
}
.cmp-risk-matrix {
width: 100%;
max-width: 500px;
height: 100%;
position: relative;
font-size: 11px;
}
.cmp-risk-matrix .matrix-axis[data-axis-direction="x"] {
padding-top: 75%;
width: 100%;
padding-left: 10%;
text-align: center;
}
.cmp-risk-matrix .matrix-axis[data-axis-direction="y"] {
position: absolute;
top: 33%;
-webkit-transform: rotate(-90deg) translate(0px, -90%);
-ms-transform: rotate(-90deg) translate(0px, -90%);
transform: rotate(-90deg) translate(0px, -90%);
}
.cmp-risk-matrix .matrix-axis-label {
position: relative;
display: inline-block;
width: 16%;
height: 100%;
overflow: hidden;
text-align: center;
}
.cmp-risk-matrix .matrix-axis-label[data-axis-direction="y"] {
-webkit-transform: rotate(-90deg) translate(0px, 10%);
-ms-transform: rotate(-90deg) translate(0px, 10%);
transform: rotate(-90deg) translate(0px, 10%);
}
.cmp-risk-matrix .matrix-axis-label > span {
position: absolute;
width: 100%;
height: 100%;
left: 0;
font-size: 10px;
line-height: 1.0;
word-wrap: break-word;
}
.cmp-risk-matrix .risk-button {
border-radius: 50%;
width: 90%;
height: 90%;
padding: 20%;
left: 5%;
top: 5%;
position: absolute;
text-overflow: clip;
overflow: hidden;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.cmp-risk-matrix .risk-button[data-risk-type="gross"] {
background-color: #323232;
color: #f1f1f1;
}
.cmp-risk-matrix .risk-button[data-risk-type="net"] {
background-color: #f1f1f1;
color: #323232;
}
.cmp-risk-matrix .risk-button[data-risk-type="both"] {
background-image: -webkit-linear-gradient(330deg, #323232 50%, #f1f1f1 50%);
background-image: linear-gradient(120deg, #323232 50%, #f1f1f1 50%);
}
.cmp-risk-matrix .matrix-container {
width: 100%;
}
.cmp-risk-matrix .matrix {
position: absolute;
width: 80%;
left: 10%;
top: 0;
right: 0;
padding-top: 75%;
}
.cmp-risk-matrix .tile {
position: relative;
display: inline-block;
outline: 1px solid white;
width: 16%;
height: 100%;
}
.cmp-risk-matrix .tile[data-color="darkred"] {
background-color: #9d0012;
}
.cmp-risk-matrix .tile[data-color="red"] {
background-color: #f23717;
}
.cmp-risk-matrix .tile[data-color="orange"] {
background-color: #f08532;
}
.cmp-risk-matrix .tile[data-color="yellow"] {
background-color: #ffff00;
}
.cmp-risk-matrix .tile[data-color="green"] {
background-color: #78b924;
}
.cmp-risk-matrix .tile[data-color="darkgreen"] {
background-color: #006a0d;
}
.cmp-risk-matrix .tile-row {
position: absolute;
height: 16.66%;
width: 100%;
}
svg.cmp-spider-chart path {
stroke: black;
fill: none;
}
svg.cmp-spider-chart path.tick {
stroke-opacity: .75;
stroke-dasharray: 1pt 2pt;
}
.cmp-text-editable {
width: 100%;
vertical-align: top;
}
.cmp-text-editable > div {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.cmp-text-editable > div > .cmp-content {
-webkit-box-flex: 1;
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.cmp-text-editable > div > .cmp-actions {
-webkit-box-flex: 0;
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
}
.cmp-listpicker > .table__container {
-webkit-box-flex: 1;
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
max-height: 100%;
}
.cmp-listpicker > .table__container:first-child {
padding-right: 10px;
}
.cmp-listpicker > .table__container:last-child {
padding-left: 10px;
}
.cmp-listpicker > .listpicker__middle {
padding: 10px 0;
-webkit-box-flex: 0;
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
}
.cmp-listpicker > .listpicker__middle > .btn {
-webkit-box-flex: 0;
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
}
.cmp-listpicker .table__row___sticky {
cursor: pointer;
}
.cmp-listpicker .listpicker__selected tr {
-webkit-transition: 0.5s ease-in-out -webkit-transform, opacity;
transition: 0.5s ease-in-out transform, opacity;
}
.cmp-listpicker .listpicker__selected tr.ng-enter {
-webkit-transform: translate(-2000px, 0px);
-ms-transform: translate(-2000px, 0px);
transform: translate(-2000px, 0px);
opacity: .8;
}
.cmp-listpicker .listpicker__selected tr.ng-enter-active,
.cmp-listpicker .listpicker__selected tr.ng-leave {
-webkit-transform: translate(0px, 0px);
-ms-transform: translate(0px, 0px);
transform: translate(0px, 0px);
opacity: 1;
}
.cmp-listpicker .listpicker__selected tr.ng-leave-active {
-webkit-transform: translate(-2000px, 0px);
-ms-transform: translate(-2000px, 0px);
transform: translate(-2000px, 0px);
opacity: .8;
}
.cmp-listpicker .listpicker__available tr {
-webkit-transition: 0.5s ease-in-out -webkit-transform, opacity;
transition: 0.5s ease-in-out transform, opacity;
}
.cmp-listpicker .listpicker__available tr.ng-enter {
-webkit-transform: translate(2000px, 0px);
-ms-transform: translate(2000px, 0px);
transform: translate(2000px, 0px);
opacity: .8;
}
.cmp-listpicker .listpicker__available tr.ng-enter-active,
.cmp-listpicker .listpicker__available tr.ng-leave {
-webkit-transform: translate(0px, 0px);
-ms-transform: translate(0px, 0px);
transform: translate(0px, 0px);
opacity: 1;
}
.cmp-listpicker .listpicker__available tr.ng-leave-active {
-webkit-transform: translate(2000px, 0px);
-ms-transform: translate(2000px, 0px);
transform: translate(2000px, 0px);
opacity: .8;
}
header.header {
-webkit-transition: background-color 0.2s linear;
transition: background-color 0.2s linear;
background-color: #f08532;
height: 25px !important;
padding: 0 10px;
}
header.header[data-stage="asa-local-staging"] {
background-color: #323232;
border-bottom: 2px solid #f08532;
}
header.header[data-stage="integration-staging"] {
background-image: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(33%, #ff0000), color-stop(33%, #ffffff), color-stop(66%, #ffffff), color-stop(66%, #ff0000), to(#ff0000));
background-image: -webkit-linear-gradient(top, #ff0000 0%, #ff0000 33%, #ffffff 33%, #ffffff 66%, #ff0000 66%, #ff0000 100%);
background-image: linear-gradient(to bottom, #ff0000 0%, #ff0000 33%, #ffffff 33%, #ffffff 66%, #ff0000 66%, #ff0000 100%);
}
header.header[data-stage="integration-staging"] span,
header.header[data-stage="integration-staging"] div,
header.header[data-stage="integration-staging"] i.fa {
color: black !important;
}
header.header[data-stage="release-staging"] {
background-color: #04B4AE;
border-bottom: 2px solid #f08532;
}
header.header > .col-layout,
header.header.col-layout {
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
img#logo {
display: block;
height: 25px;
}
aside.sidebar {
background-color: #f1f1f1;
overflow: visible;
-webkit-transition: width linear 0.1s;
transition: width linear 0.1s;
width: 200px;
}
aside.sidebar.ng-hide {
display: block !important;
width: 70px;
}
li > i.fa.fa-caret-down,
li > i.fa.fa-caret-right {
margin-right: .5em;
}
div.sidebar__catalogues > ul {
margin-left: -1.5em;
}
div.sidebar__processes ul,
div.sidebar__applications ul {
list-style-type: none;
margin-left: -2em;
}
div.sidebar__processes .tree-collapsed > .tree-branch-head::before,
div.sidebar__applications .tree-collapsed > .tree-branch-head::before,
div.sidebar__processes .tree-expanded > .tree-branch-head::before,
div.sidebar__applications .tree-expanded > .tree-branch-head::before {
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
content: "\f0c8";
font-style: normal;
font-family: "FontAwesome";
font-size: .75em;
margin-right: .5em;
}
div.sidebar__processes .tree-collapsed > .tree-branch-head::before:hover,
div.sidebar__applications .tree-collapsed > .tree-branch-head::before:hover,
div.sidebar__processes .tree-expanded > .tree-branch-head::before:hover,
div.sidebar__applications .tree-expanded > .tree-branch-head::before:hover {
color: #f08532;
}
div.sidebar__processes .tree-collapsed,
div.sidebar__applications .tree-collapsed,
div.sidebar__processes .tree-expanded,
div.sidebar__applications .tree-expanded,
div.sidebar__processes .tree-leaf,
div.sidebar__applications .tree-leaf {
white-space: nowrap;
}
div.sidebar__processes .tree-leaf,
div.sidebar__applications .tree-leaf {
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
div.sidebar__processes .tree-leaf:hover,
div.sidebar__applications .tree-leaf:hover {
color: #f08532;
}
div.sidebar__processes .tree-leaf > .tree-leaf-head::before,
div.sidebar__applications .tree-leaf > .tree-leaf-head::before {
content: "\f096";
font-style: normal;
font-family: "FontAwesome";
font-size: .75em;
margin-right: .5em;
}
div.sidebar__processes .tree-label,
div.sidebar__applications .tree-label {
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
display: inline-block;
}
div.sidebar__processes .tree-label:hover,
div.sidebar__applications .tree-label:hover {
color: #f08532;
}
img.start__brandimage {
width: 100%;
}
div.sidebar__search {
height: 25px;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
overflow: visible;
margin: 10px 16px;
}
div.sidebar__search input {
height: 100%;
width: 100%;
}
div.sidebar__search i.fa.sidebar__search-icon {
position: absolute;
right: 10px;
margin-top: 6px;
color: #d7d7d7;
}
div.sidebar__search ul.dropdown-menu {
position: absolute;
}
div.sidebar__search ul.dropdown-menu > li {
cursor: pointer;
}
.main-header,
.main-header * {
overflow: visible;
}
.header__breadcrumbs > p {
margin: 0;
}
.main-header__settings {
display: inline-block;
float: right;
}
.main-header__settings i.fa {
color: white;
cursor: pointer;
}
.main-header__settings .dropdown-menu {
left: auto;
right: 0;
width: 200px;
}
.main-header__settings .dropdown-menu li.unselectable > span {
padding: 3px 20px;
cursor: default;
color: #8f8f8f;
}
.main-header__logout {
color: white;
float: right;
cursor: pointer;
display: inline-block;
margin-left: 16px;
}
.main-header__logout button {
display: inline;
font-weight: normal;
cursor: pointer;
border: none;
border-radius: 0;
padding: 0;
background-color: transparent;
-webkit-box-shadow: none;
box-shadow: none;
}
.main-header__logout button:hover {
color: white;
}
.main-header__email {
color: white;
}
div.sidebar__content {
overflow: auto;
padding: 0 16px;
}
.sidebar__hide {
cursor: pointer;
color: white;
}
.application-masterdata div.criticality-bar {
position: relative;
height: 19px;
min-width: 19px;
-webkit-box-flex: 1;
-webkit-flex: 1 1 19px;
-ms-flex: 1 1 19px;
flex: 1 1 19px;
-webkit-align-self: baseline;
-ms-flex-item-align: baseline;
align-self: baseline;
}
.application-masterdata div.criticality-bar[data-criticality-type="high"] {
background-color: #d40018;
}
.application-masterdata div.criticality-bar[data-criticality-type="mid"] {
background-color: #FFEC1C;
}
.application-masterdata div.criticality-bar[data-criticality-type="low"] {
background-color: #0e9300;
}
.application-masterdata div.criticality-bar[data-criticality-type="none"] {
background-color: #8f8f8f;
}
.application-criticalityassessment {
width: 100%;
height: 100%;
position: relative;
}
.application-riskassessment .panel.panel-default .panel-title {
cursor: pointer;
font-weight: normal;
}
.application-riskassessment .panel.panel-default[data-color="darkred"] > .panel-heading {
border-left: 10px solid #9d0012;
background: rgba(157, 0, 18, 0.2);
}
.application-riskassessment .panel.panel-default[data-color="red"] > .panel-heading {
border-left: 10px solid #f23717;
background: rgba(242, 55, 23, 0.2);
}
.application-riskassessment .panel.panel-default[data-color="orange"] > .panel-heading {
border-left: 10px solid #f08532;
background: rgba(240, 133, 50, 0.2);
}
.application-riskassessment .panel.panel-default[data-color="yellow"] > .panel-heading {
border-left: 10px solid #ffff00;
background: rgba(255, 255, 0, 0.2);
}
.application-riskassessment .panel.panel-default[data-color="green"] > .panel-heading {
border-left: 10px solid #78b924;
background: rgba(120, 185, 36, 0.2);
}
.application-riskassessment .panel.panel-default[data-color="darkgreen"] > .panel-heading {
border-left: 10px solid #006a0d;
background: rgba(0, 106, 13, 0.2);
}
.application-riskassessment .panel.panel-default[data-color="none"] > .panel-heading {
padding-left: 25px;
}
.application-riskassessment .risk-assessment {
width: 100%;
height: 100%;
position: relative;
}
.application-riskassessment .risk-assessment__main {
height: 90%;
width: 100%;
top: 40px;
}
.application-riskassessment .risk-assessment__btn-add {
position: relative;
}
.application-riskassessment .risk-assessment__header {
width: 100%;
padding-bottom: 10px;
}
.application-riskassessment .risk-assessment__aside___matrix {
width: 100%;
}
.application-riskassessment .risk-assessment__aside {
height: 100%;
}
.application-riskassessment .risk-assessment__accordion {
height: 100%;
position: relative;
}
.application-riskassessment .risk-accordion__head {
min-height: 50px;
}
.application-riskassessment .risk-accordion__title {
padding-bottom: 10px;
}
.application-riskassessment .risk-accordion__title > i.fa {
position: absolute;
}
.application-riskassessment .risk-accordion__title > strong {
margin-left: 20px;
}
.application-riskassessment .risk-accordion__summary table.list {
table-layout: fixed;
width: 100%;
max-width: 500px;
}
.application-riskassessment .risk-accordion__summary table.list td.column__xs {
width: 50px;
}
.application-riskassessment .risk-accordion__content {
height: 100%;
width: 100%;
position: relative;
}
.application-riskassessment .risk-accordion__content .risk-accordion__content___main {
position: relative;
}
.application-riskassessment .risk-accordion__content .risk-accordion__content___main .risk-accordion__content__assessment {
width: 66%;
float: left;
}
.application-riskassessment .risk-accordion__content .risk-accordion__content___main .risk-accordion__content__assessment select {
display: block;
}
.application-riskassessment .risk-accordion__content .risk-accordion__content___main .risk-accordion__content__assessment label {
font-weight: normal;
}
.application-riskassessment .risk-accordion__content .risk-accordion__content___main .risk-accordion__content__assessment .risk-accordion__assessment___factors,
.application-riskassessment .risk-accordion__content .risk-accordion__content___main .risk-accordion__content__assessment .risk-accordion__assessment___mitigations {
padding: 10px 0;
}
.application-riskassessment .risk-accordion__content .risk-accordion__content___main .risk-accordion__listpicker {
height: 300px;
width: 100%;
}
.application-riskassessment .risk-accordion__content .risk-accordion__content___main .risk-accordion__content__matrix {
width: 33%;
float: right;
}
.application-riskassessment .risk-accordion__content .risk-accordion__content___buttons {
position: relative;
width: 100%;
clear: both;
padding-top: 20px;
}
.riskcatalog .catalogue-form__header {
background-color: #8f8f8f;
color: white;
padding: 10px 16px;
}
.riskcatalog .catalogue-form {
border: 1px solid #8f8f8f;
background-color: #ffebd5;
}
.riskcatalog .catalogue-form div.alert:not(.ng-hide) {
padding: 1px 10px;
margin: 0 10px;
}
.riskcatalog .catalogue-form div.alert:not(.ng-hide) + div.alert:not(.ng-hide) {
margin-left: 0;
}
.riskcatalog form textarea {
height: 100%;
}
.riskcatalog .catalogue-form__content {
margin: 10px 10px;
}
.riskcatalog .catalogue-form__buttons {
margin: 10px 10px;
padding-left: 16px;
height: 30px;
}
.riskcatalog .catalogue-form__close {
cursor: pointer;
}
.riskcatalog .catalogue-form__close:hover {
color: #f08532;
}
.add-process-modal .modal-body {
height: 375px !important;
}
@media (max-width: 1000px) {
.add-process-modal .modal-body {
height: 450px !important;
}
}
.query .ace_editor {
height: 300px;
margin-bottom: 1px;
}
.query .formatted {
height: 100%;
}
.query .query__alert {
margin: 10px 0;
}
.query .alert {
color: white;
}
.query .raw textarea,
.query .export textarea {
height: 100%;
font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
margin-top: 10px;
}
.size-1x {
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
}
.size-2x {
-webkit-box-flex: 2;
-webkit-flex: 2;
-ms-flex: 2;
flex: 2;
}
.size-3x {
-webkit-box-flex: 3;
-webkit-flex: 3;
-ms-flex: 3;
flex: 3;
}
.size-5x {
-webkit-box-flex: 5;
-webkit-flex: 5;
-ms-flex: 5;
flex: 5;
}
.brand-color {
color: #f08532;
}
.text-right {
text-align: right;
}
.scroll {
overflow: auto;
}
.no-scroll {
overflow: visible;
}
|
{
"pile_set_name": "Github"
}
|
# SPDX-License-Identifier: GPL-2.0
snd-au8810-objs := au8810.o
snd-au8820-objs := au8820.o
snd-au8830-objs := au8830.o
obj-$(CONFIG_SND_AU8810) += snd-au8810.o
obj-$(CONFIG_SND_AU8820) += snd-au8820.o
obj-$(CONFIG_SND_AU8830) += snd-au8830.o
|
{
"pile_set_name": "Github"
}
|
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ er hentet og klar til brug! Vil du installere og genstarte %1$@ nu?";
"%1$@ can't be updated, because it was opened from a read-only or a temporary location. Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "%1$@ kan ikke opdateres når det køres fra en kun læsbar enhed. Flyt %1$@ til mappen Programmer, genstart derfra og prøv igen.";
"%@ %@ is currently the newest version available." = "%1$@ %2$@ er den aktuelle version.";
/* Description text for SUUpdateAlert when the update is downloadable. */
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ er tilgængelig! Du har %3$@. Skal den hentes nu?";
/* Description text for SUUpdateAlert when the update informational with no download. */
"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ is now available--you have %3$@. Would you like to learn more about this update on the web?";
"%@ downloaded" = "%@ hentet";
"%@ of %@" = "%1$@ af %2$@";
"A new version of %@ is available!" = "En ny version af %@ er tilgængelig!";
"A new version of %@ is ready to install!" = "En ny version af %@ er klar til installering!";
"An error occurred in retrieving update information. Please try again later." = "Kunne ikke modtage informationer om opdateringer. Kontroller at du har forbindelse til internettet eller prøv igen senere.";
"An error occurred while downloading the update. Please try again later." = "Opdateringen kunne ikke hentes. Prøv igen senere.";
"An error occurred while extracting the archive. Please try again later." = "Arkivet kunne ikke udpakkes. Prøv igen senere.";
"An error occurred while installing the update. Please try again later." = "Opdateringen kunne ikke installeres. Prøv igen senere.";
"An error occurred while parsing the update feed." = "An error occurred while parsing the update feed.";
"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "%1$@ kunne ikke genstartes. Den nye version vil være tilgængelig, næste gang %1$@ startes.";
/* the unit for bytes */
"B" = "B";
"Cancel" = "Annuller";
"Cancel Update" = "Annuller opdatering";
"Checking for updates..." = "Søger efter opdateringer…";
/* Take care not to overflow the status window. */
"Downloading update..." = "Henter opdatering…";
/* Take care not to overflow the status window. */
"Extracting update..." = "Udpakker arkiver…";
/* the unit for gigabytes */
"GB" = "GB";
"Install and Relaunch" = "Installer og genstart";
/* Take care not to overflow the status window. */
"Installing update..." = "Installerer opdatering…";
/* the unit for kilobytes */
"KB" = "KB";
/* the unit for megabytes */
"MB" = "MB";
/* OK button. */
"OK" = "OK";
/* Status message on progress window once download has finished. */
"Ready to Install" = "Klar til installering";
/* Message that is optionally shown at startup to allow users to turn on/off update checks. */
"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Skal %1$@ søge efter opdateringer automatisk? Du kan altid søge efter opdateringer manuelt fra programmets menu.";
"Update Error!" = "Der opstod en fejl!";
"Updating %@" = "Opdaterer %@";
/* 'Error' message when the user checks for updates but is already current or the feed doesn't contain any updates. (not necessarily shown in UI) */
"You already have the newest version of %@." = "Du har den seneste version af %@.";
/* Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates. */
"You're up-to-date!" = "Der er ingen opdateringer";
/* Alternative name for "Install" button if we have a paid update or other update
without a download but with a URL. */
"Learn More..." = "Læs mere…";
|
{
"pile_set_name": "Github"
}
|
(2..8).step(2) {|n| print "#{n}, "}
puts "who do we appreciate?"
|
{
"pile_set_name": "Github"
}
|
//
// SCManagedVideoCapturerHandler.h
// Snapchat
//
// Created by Jingtian Yang on 11/12/2017.
//
#import "SCManagedVideoCapturer.h"
#import <Foundation/Foundation.h>
@class SCCaptureResource;
@interface SCManagedVideoCapturerHandler : NSObject <SCManagedVideoCapturerDelegate>
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithCaptureResource:(SCCaptureResource *)captureResource;
@end
|
{
"pile_set_name": "Github"
}
|
class Some {
operator fun <caret>() {
}
}
// EXIST: {"lookupString":"compareTo","typeText":"< > <= >="}
// EXIST: {"lookupString":"contains","typeText":"in !in"}
// EXIST: {"lookupString":"dec","typeText":"--"}
// EXIST: {"lookupString":"div","typeText":"/"}
// EXIST: {"lookupString":"divAssign","typeText":"/="}
// EXIST: {"lookupString":"equals","typeText":"== !="}
// EXIST: {"lookupString":"get","typeText":"[...]"}
// EXIST: {"lookupString":"getValue"}
// EXIST: {"lookupString":"hasNext"}
// EXIST: {"lookupString":"inc","typeText":"++"}
// EXIST: {"lookupString":"invoke","typeText":"(...)"}
// EXIST: {"lookupString":"iterator"}
// EXIST: {"lookupString":"minus","typeText":"-"}
// EXIST: {"lookupString":"minusAssign","typeText":"-="}
// EXIST: {"lookupString":"next"}
// EXIST: {"lookupString":"not","typeText":"!"}
// EXIST: {"lookupString":"plus","typeText":"+"}
// EXIST: {"lookupString":"plusAssign","typeText":"+="}
// EXIST: {"lookupString":"rangeTo","typeText":".."}
// EXIST: {"lookupString":"rem","typeText":"%"}
// EXIST: {"lookupString":"remAssign","typeText":"%="}
// EXIST: {"lookupString":"set","typeText":"[...] = ..."}
// EXIST: {"lookupString":"setValue"}
// EXIST: {"lookupString":"times","typeText":"*"}
// EXIST: {"lookupString":"timesAssign","typeText":"*="}
// EXIST: {"lookupString":"unaryMinus","typeText":"-"}
// EXIST: {"lookupString":"unaryPlus","typeText":"+"}
// NOTHING_ELSE
|
{
"pile_set_name": "Github"
}
|
module.exports = {
mode: 'production',
devtool: 'source-map',
output: {
library: 'NetlifyClient',
libraryTarget: 'umd'
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
query: {
presets: [['@babel/preset-env', { modules: 'commonjs' }]],
plugins: ['@babel/plugin-transform-runtime']
}
}
}
]
}
}
|
{
"pile_set_name": "Github"
}
|
import UIKit
// I don't see how else to assert that the status bar should be hidden,
// other than to write my own UISearchController subclass
class MySearchController : UISearchController {
override var prefersStatusBarHidden : Bool {
return true
}
}
class RootViewController : UITableViewController, UISearchBarDelegate {
struct Section {
var sectionName : String
var rowData : [String]
}
var sections : [Section]!
var searcher : UISearchController!
override var prefersStatusBarHidden : Bool {
return true
}
let cellID = "Cell"
let headerID = "Header"
override func viewDidLoad() {
let s = try! String(
contentsOfFile: Bundle.main.path(
forResource: "states", ofType: "txt")!)
let states = s.components(separatedBy:"\n")
let d = Dictionary(grouping: states) {String($0.prefix(1))}
self.sections = Array(d).sorted{$0.key < $1.key}.map {
Section(sectionName: $0.key, rowData: $0.value)
}
self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: self.cellID)
self.tableView.register(UITableViewHeaderFooterView.self, forHeaderFooterViewReuseIdentifier: self.headerID)
self.tableView.sectionIndexColor = .white
self.tableView.sectionIndexBackgroundColor = .red
// self.tableView.sectionIndexTrackingBackgroundColor = .blue
self.tableView.backgroundColor = .yellow // but the search bar covers that
self.tableView.backgroundView = { // this will fix it
let v = UIView()
v.backgroundColor = .yellow
return v
}()
// most rudimentary possible search interface
// instantiate a view controller that will present the search results
let src = SearchResultsController(data: self.sections)
// instantiate a search controller and keep it alive
let searcher = MySearchController(searchResultsController: src)
self.searcher = searcher
// specify who the search controller should notify when the search bar changes
searcher.searchResultsUpdater = src
// put the search controller's search bar into the interface
let b = searcher.searchBar
b.sizeToFit() // crucial, trust me on this one
// okay, something has gone wrong in iOS 11: uncommenting the next line gives a mess
// b.scopeButtonTitles = ["Hey", "Ho"] // shows during search only; uncomment to see
// (not used in this example; just showing the interface)
// WARNING: do NOT call showsScopeBar! it messes things up!
// (buttons will show during search if there are titles)
// bug fixed! some time after iOS 11.0, maybe iOS 11.3? anyway it's okay now
b.autocapitalizationType = .none
self.tableView.tableHeaderView = b
self.tableView.reloadData()
self.tableView.scrollToRow(at:
IndexPath(row: 0, section: 0),
at:.top, animated:false)
// that's all! The rest is in SearchResultsController
}
override func numberOfSections(in tableView: UITableView) -> Int {
return self.sections.count
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.sections[section].rowData.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: self.cellID, for: indexPath)
let s = self.sections[indexPath.section].rowData[indexPath.row]
cell.textLabel!.text = s
// this part is not in the book, it's just for fun
var stateName = s
stateName = stateName.lowercased()
stateName = stateName.replacingOccurrences(of:" ", with:"")
stateName = "flag_\(stateName).gif"
let im = UIImage(named: stateName)
cell.imageView!.image = im
return cell
}
/*
override func tableView(_ tableView: UITableView!, titleForHeaderInSection section: Int) -> String! {
return self.sectionNames[section]
}
*/
// this is more "interesting"
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let h = tableView
.dequeueReusableHeaderFooterView(withIdentifier: self.headerID)!
if h.viewWithTag(1) == nil {
h.backgroundView = UIView()
h.backgroundView?.backgroundColor = .black
let lab = UILabel()
lab.tag = 1
lab.font = UIFont(name:"Georgia-Bold", size:22)
lab.textColor = .green
lab.backgroundColor = .clear
h.contentView.addSubview(lab)
let v = UIImageView()
v.tag = 2
v.backgroundColor = .black
v.image = UIImage(named:"us_flag_small.gif")
h.contentView.addSubview(v)
lab.translatesAutoresizingMaskIntoConstraints = false
v.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
NSLayoutConstraint.constraints(withVisualFormat:
"H:|-5-[lab(25)]-10-[v(40)]",
metrics:nil, views:["v":v, "lab":lab]),
NSLayoutConstraint.constraints(withVisualFormat:
"V:|[v]|",
metrics:nil, views:["v":v]),
NSLayoutConstraint.constraints(withVisualFormat:
"V:|[lab]|",
metrics:nil, views:["lab":lab])
].flatMap{$0})
}
let lab = h.contentView.viewWithTag(1) as! UILabel
lab.text = self.sections[section].sectionName
return h
}
/*
override func tableView(_ tableView: UITableView!, willDisplayHeaderView view: UIView!, forSection section: Int) {
println(view) // prove we are reusing header views
}
*/
override func sectionIndexTitles(for tableView: UITableView) -> [String]? {
return self.sections.map{$0.sectionName}
}
}
|
{
"pile_set_name": "Github"
}
|
/***
* Excerpted from "Test-Driven Development for Embedded C",
* published by The Pragmatic Bookshelf.
* Copyrights apply to this code. It may not be used to create training material,
* courses, books, articles, and the like. Contact us if you are in doubt.
* We make no guarantees that this code is fit for any purpose.
* Visit http://www.pragmaticprogrammer.com/titles/jgade for more book information.
***/
/*- ------------------------------------------------------------------ -*/
/*- Copyright (c) James W. Grenning -- All Rights Reserved -*/
/*- For use by owners of Test-Driven Development for Embedded C, -*/
/*- and attendees of Renaissance Software Consulting, Co. training -*/
/*- classes. -*/
/*- -*/
/*- Available at http://pragprog.com/titles/jgade/ -*/
/*- ISBN 1-934356-62-X, ISBN13 978-1-934356-62-3 -*/
/*- -*/
/*- Authorized users may use this source code in your own -*/
/*- projects, however the source code may not be used to -*/
/*- create training material, courses, books, articles, and -*/
/*- the like. We make no guarantees that this source code is -*/
/*- fit for any purpose. -*/
/*- -*/
/*- www.renaissancesoftware.net [email protected] -*/
/*- ------------------------------------------------------------------ -*/
#ifndef D_LedDriver_H
#define D_LedDriver_H
#include <stdint.h>
#define TRUE 1
#define FALSE 0
typedef int BOOL;
void LedDriver_Create(uint16_t * ledsAddress);
void LedDriver_Destroy(void);
void LedDriver_TurnOn(int ledNumber);
void LedDriver_TurnOff(int ledNumber);
void LedDriver_TurnAllOn(void);
void LedDriver_TurnAllOff(void);
BOOL LedDriver_IsOn(int ledNumber);
BOOL LedDriver_IsOff(int ledNumber);
#endif /* D_LedDriver_H */
/*
* Intermediate examples below this comment
*/
#if 0
#ifndef D_LedDriver_H
#define D_LedDriver_H
void LedDriver_Create(void);
void LedDriver_Destroy(void);
#endif /* D_LedDriver_H */
#if 0
#ifndef D_LedDriver_H
#define D_LedDriver_H
void LedDriver_Create(void);
void LedDriver_Destroy(void);
void LedDriver_TurnOn(int ledNumber);
void LedDriver_TurnOff(int ledNumber);
#endif
#endif /* D_LedDriver_H */
#endif
|
{
"pile_set_name": "Github"
}
|
{
"pile_set_name": "Github"
}
|
|
#
# The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
# (the "License"). You may not use this work except in compliance with the License, which is
# available at www.apache.org/licenses/LICENSE-2.0
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied, as more fully set forth in the License.
#
# See the NOTICE file distributed with this work for information regarding copyright ownership.
#
# Nothing to do
---
|
{
"pile_set_name": "Github"
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.isis.core.metamodel.facets.value.bigdecimal;
import org.apache.isis.core.metamodel.facetapi.Facet;
public interface BigDecimalValueFacet extends Facet {
/**
* Maximum length of digits for this decimal (in other words, its precision).
*
* <p>
* For example:
* <ul>
* <li><tt>12345.789</tt> has a length of 8 (and a {@link #getScale() scale} of 3)</li>
* <li><tt>12345</tt> has a length of 5 (and {@link #getScale() scale} of 0)</li>
* <li><tt>12345.0</tt> has a length of 6 (and {@link #getScale() scale} of 1)</li>
* </ul>
*/
Integer getPrecision();
/*
* Same as {@link #getPrecision()}.
*
* @deprecated
*/
//@Deprecated
//Integer getLength();
/**
* The number of digits to the right of the decimal place (fractional part) for this decimal.
*
* <p>
* For example:
* <ul>
* <li><tt>12345.789</tt> has scale of 3 (and a {@link #getLength() length} of 8)</li>
* <li><tt>12345</tt> has a scale of 0 (and a {@link #getLength() length} of 5)</li>
* <li><tt>12345.0</tt> has a scale of 1 (and a {@link #getLength() length} of 6)</li>
* </ul>
*/
Integer getScale();
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) Thomas Gleixner <[email protected]>
*
* SPDX-License-Identifier: GPL 2.0+ BSD-3-Clause
*/
#ifndef _UBOOT_MTD_UBISPL_H
#define _UBOOT_MTD_UBISPL_H
#include "../ubi/ubi-media.h"
#include "ubi-wrapper.h"
/*
* The maximum number of volume ids we scan. So you can load volume id
* 0 to (CONFIG_SPL_UBI_VOL_ID_MAX - 1)
*/
#define UBI_SPL_VOL_IDS CONFIG_SPL_UBI_VOL_IDS
/*
* The size of the read buffer for the fastmap blocks. In theory up to
* UBI_FM_MAX_BLOCKS * CONFIG_SPL_MAX_PEB_SIZE. In practice today
* one or two blocks.
*/
#define UBI_FM_BUF_SIZE (UBI_FM_MAX_BLOCKS*CONFIG_SPL_UBI_MAX_PEB_SIZE)
/*
* The size of the bitmaps for the attach/ scan
*/
#define UBI_FM_BM_SIZE ((CONFIG_SPL_UBI_MAX_PEBS / BITS_PER_LONG) + 1)
/*
* The maximum number of logical erase blocks per loadable volume
*/
#define UBI_MAX_VOL_LEBS CONFIG_SPL_UBI_MAX_VOL_LEBS
/*
* The bitmap size for the above to denote the found blocks inside the volume
*/
#define UBI_VOL_BM_SIZE ((UBI_MAX_VOL_LEBS / BITS_PER_LONG) + 1)
/**
* struct ubi_vol_info - UBISPL internal volume represenation
* @last_block: The last block (highest LEB) found for this volume
* @found: Bitmap to mark found LEBS
* @lebs_to_pebs: LEB to PEB translation table
*/
struct ubi_vol_info {
u32 last_block;
unsigned long found[UBI_VOL_BM_SIZE];
u32 lebs_to_pebs[UBI_MAX_VOL_LEBS];
};
/**
* struct ubi_scan_info - UBISPL internal data for FM attach and full scan
*
* @read: Read function to access the flash provided by the caller
* @peb_count: Number of physical erase blocks in the UBI FLASH area
* aka MTD partition.
* @peb_offset: Offset of PEB0 in the UBI FLASH area (aka MTD partition)
* to the real start of the FLASH in erase blocks.
* @fsize_mb: Size of the scanned FLASH area in MB (stats only)
* @vid_offset: Offset from the start of a PEB to the VID header
* @leb_start: Offset from the start of a PEB to the data area
* @leb_size: Size of the data area
*
* @fastmap_pebs: Counter of PEBs "attached" by fastmap
* @fastmap_anchor: The anchor PEB of the fastmap
* @fm_sb: The fastmap super block data
* @fm_vh: The fastmap VID header
* @fm: Pointer to the fastmap layout
* @fm_layout: The fastmap layout itself
* @fm_pool: The pool of PEBs to scan at fastmap attach time
* @fm_wl_pool: The pool of PEBs scheduled for wearleveling
*
* @fm_enabled: Indicator whether fastmap attachment is enabled.
* @fm_used: Bitmap to indicate the PEBS covered by fastmap
* @scanned: Bitmap to indicate the PEBS of which the VID header
* hase been physically scanned.
* @corrupt: Bitmap to indicate corrupt blocks
* @toload: Bitmap to indicate the volumes which should be loaded
*
* @blockinfo: The vid headers of the scanned blocks
* @volinfo: The volume information of the interesting (toload)
* volumes
*
* @fm_buf: The large fastmap attach buffer
*/
struct ubi_scan_info {
ubispl_read_flash read;
unsigned int fsize_mb;
unsigned int peb_count;
unsigned int peb_offset;
unsigned long vid_offset;
unsigned long leb_start;
unsigned long leb_size;
/* Fastmap: The upstream required fields */
int fastmap_pebs;
int fastmap_anchor;
size_t fm_size;
struct ubi_fm_sb fm_sb;
struct ubi_vid_hdr fm_vh;
struct ubi_fastmap_layout *fm;
struct ubi_fastmap_layout fm_layout;
struct ubi_fm_pool fm_pool;
struct ubi_fm_pool fm_wl_pool;
/* Fastmap: UBISPL specific data */
int fm_enabled;
unsigned long fm_used[UBI_FM_BM_SIZE];
unsigned long scanned[UBI_FM_BM_SIZE];
unsigned long corrupt[UBI_FM_BM_SIZE];
unsigned long toload[UBI_FM_BM_SIZE];
/* Data for storing the VID and volume information */
struct ubi_vol_info volinfo[UBI_SPL_VOL_IDS];
struct ubi_vid_hdr blockinfo[CONFIG_SPL_UBI_MAX_PEBS];
/* The large buffer for the fastmap */
uint8_t fm_buf[UBI_FM_BUF_SIZE];
};
#ifdef CFG_DEBUG
#define ubi_dbg(fmt, ...) printf("UBI: debug:" fmt "\n", ##__VA_ARGS__)
#else
#define ubi_dbg(fmt, ...)
#endif
#ifdef CONFIG_UBI_SILENCE_MSG
#define ubi_msg(fmt, ...)
#else
#define ubi_msg(fmt, ...) printf("UBI: " fmt "\n", ##__VA_ARGS__)
#endif
/* UBI warning messages */
#define ubi_warn(fmt, ...) printf("UBI warning: " fmt "\n", ##__VA_ARGS__)
/* UBI error messages */
#define ubi_err(fmt, ...) printf("UBI error: " fmt "\n", ##__VA_ARGS__)
#endif
|
{
"pile_set_name": "Github"
}
|
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [junit-4.11.jar:na]
at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [junit-4.11.jar:na]
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) [junit-rt.jar:na]
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) [junit-rt.jar:na]
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) [junit-rt.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_71]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_71]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) [idea_rt.jar:na]
Caused by: org.postgresql.util.PSQLException: ERROR: relation "post_comment_vote" does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2182) ~[postgresql-9.4-1202-jdbc41.jar:9.4]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1911) ~[postgresql-9.4-1202-jdbc41.jar:9.4]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:173) ~[postgresql-9.4-1202-jdbc41.jar:9.4]
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:615) ~[postgresql-9.4-1202-jdbc41.jar:9.4]
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:451) ~[postgresql-9.4-1202-jdbc41.jar:9.4]
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:443) ~[postgresql-9.4-1202-jdbc41.jar:9.4]
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_71]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_71]
at net.ttddyy.dsproxy.proxy.StatementProxyLogic.invoke(StatementProxyLogic.java:147) ~[datasource-proxy-1.3.3.jar:na]
at net.ttddyy.dsproxy.proxy.jdk.StatementInvocationHandler.invoke(StatementInvocationHandler.java:33) ~[datasource-proxy-1.3.3.jar:na]
at com.sun.proxy.$Proxy24.execute(Unknown Source) ~[na:na]
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:51) ~[hibernate-core-5.1.0.Final.jar:5.1.0.Final]
... 50 common frames omitted
WARN [Alice]: o.h.e.j.s.SqlExceptionHelper - SQL Warning Code: 0, SQLState: 00000
WARN [Alice]: o.h.e.j.s.SqlExceptionHelper - table "forum_user" does not exist, skipping
WARN [Alice]: o.h.e.j.s.SqlExceptionHelper - SQL Warning Code: 0, SQLState: 00000
WARN [Alice]: o.h.e.j.s.SqlExceptionHelper - table "post" does not exist, skipping
WARN [Alice]: o.h.e.j.s.SqlExceptionHelper - SQL Warning Code: 0, SQLState: 00000
WARN [Alice]: o.h.e.j.s.SqlExceptionHelper - table "post_comment" does not exist, skipping
WARN [Alice]: o.h.e.j.s.SqlExceptionHelper - SQL Warning Code: 0, SQLState: 00000
WARN [Alice]: o.h.e.j.s.SqlExceptionHelper - table "post_comment_vote" does not exist, skipping
WARN [Alice]: o.h.t.s.i.ExceptionHandlerLoggedImpl - GenerationTarget encountered exception accepting command : Unable to execute command [drop sequence hibernate_sequence]
org.hibernate.tool.schema.spi.CommandAcceptanceException: Unable to execute command [drop sequence hibernate_sequence]
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:63) ~[hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:370) [hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:355) [hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:245) [hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:153) [hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:125) [hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:111) [hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:137) [hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:64) [hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:458) [hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:465) [hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:881) [hibernate-entitymanager-5.1.0.Final.jar:5.1.0.Final]
at com.vladmihalcea.book.hpjp.util.AbstractTest.newEntityManagerFactory(AbstractTest.java:742) [test-classes/:na]
at com.vladmihalcea.book.hpjp.util.AbstractTest.init(AbstractTest.java:651) [test-classes/:na]
at com.vladmihalcea.book.hpjp.hibernate.query.recursive.AbstractPostCommentScorePerformanceTest.init(AbstractPostCommentScorePerformanceTest.java:72) [test-classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_71]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_71]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) [junit-4.11.jar:na]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.11.jar:na]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) [junit-4.11.jar:na]
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) [junit-4.11.jar:na]
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) [junit-4.11.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) [junit-4.11.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [junit-4.11.jar:na]
at org.junit.runners.Suite.runChild(Suite.java:127) [junit-4.11.jar:na]
at org.junit.runners.Suite.runChild(Suite.java:26) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [junit-4.11.jar:na]
at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [junit-4.11.jar:na]
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) [junit-rt.jar:na]
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) [junit-rt.jar:na]
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) [junit-rt.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_71]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_71]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) [idea_rt.jar:na]
Caused by: org.postgresql.util.PSQLException: ERROR: sequence "hibernate_sequence" does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2182) ~[postgresql-9.4-1202-jdbc41.jar:9.4]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1911) ~[postgresql-9.4-1202-jdbc41.jar:9.4]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:173) ~[postgresql-9.4-1202-jdbc41.jar:9.4]
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:615) ~[postgresql-9.4-1202-jdbc41.jar:9.4]
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:451) ~[postgresql-9.4-1202-jdbc41.jar:9.4]
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:443) ~[postgresql-9.4-1202-jdbc41.jar:9.4]
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_71]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_71]
at net.ttddyy.dsproxy.proxy.StatementProxyLogic.invoke(StatementProxyLogic.java:147) ~[datasource-proxy-1.3.3.jar:na]
at net.ttddyy.dsproxy.proxy.jdk.StatementInvocationHandler.invoke(StatementInvocationHandler.java:33) ~[datasource-proxy-1.3.3.jar:na]
at com.sun.proxy.$Proxy24.execute(Unknown Source) ~[na:na]
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:51) ~[hibernate-core-5.1.0.Final.jar:5.1.0.Final]
... 49 common frames omitted
INFO [Alice]: o.h.t.s.i.SchemaCreatorImpl - HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@5bb8f9e2'
INFO [Alice]: c.v.b.h.h.q.r.PostCommentScoreRecursiveCTEPerformanceTest - type=TIMER, name=PostCommentScoreRecursiveCTEPerformanceTest, count=10, min=4.029108, max=5.807598, mean=4.7722803, stddev=0.4667245716032208, median=4.701994, p75=4.9113739999999995, p95=5.807598, p98=5.807598, p99=5.807598, p999=5.807598, mean_rate=6.686894835599447, m1=0.0, m5=0.0, m15=0.0, rate_unit=events/second, duration_unit=milliseconds
INFO [Alice]: o.h.t.s.i.SchemaDropperImpl$DelayedDropActionImpl - HHH000477: Starting delayed drop of schema as part of SessionFactory shut-down'
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 1997, 2010, 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 "libadt/dict.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/thread.hpp"
// Dictionaries - An Abstract Data Type
// %%%%% includes not needed with AVM framework - Ungar
// #include "port.hpp"
//IMPLEMENTATION
// #include "dict.hpp"
#include <assert.h>
// The iostream is not needed and it gets confused for gcc by the
// define of bool.
//
// #include <iostream.h>
//------------------------------data-----------------------------------------
// String hash tables
#define MAXID 20
static byte initflag = 0; // True after 1st initialization
static const char shft[MAXID] = {1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6};
static short xsum[MAXID];
//------------------------------bucket---------------------------------------
class bucket : public ResourceObj {
public:
uint _cnt, _max; // Size of bucket
void **_keyvals; // Array of keys and values
};
//------------------------------Dict-----------------------------------------
// The dictionary is kept has a hash table. The hash table is a even power
// of two, for nice modulo operations. Each bucket in the hash table points
// to a linear list of key-value pairs; each key & value is just a (void *).
// The list starts with a count. A hash lookup finds the list head, then a
// simple linear scan finds the key. If the table gets too full, it's
// doubled in size; the total amount of EXTRA times all hash functions are
// computed for the doubling is no more than the current size - thus the
// doubling in size costs no more than a constant factor in speed.
Dict::Dict(CmpKey initcmp, Hash inithash) : _hash(inithash), _cmp(initcmp),
_arena(Thread::current()->resource_area()) {
int i;
// Precompute table of null character hashes
if( !initflag ) { // Not initializated yet?
xsum[0] = (1<<shft[0])+1; // Initialize
for(i=1; i<MAXID; i++) {
xsum[i] = (1<<shft[i])+1+xsum[i-1];
}
initflag = 1; // Never again
}
_size = 16; // Size is a power of 2
_cnt = 0; // Dictionary is empty
_bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size);
memset(_bin,0,sizeof(bucket)*_size);
}
Dict::Dict(CmpKey initcmp, Hash inithash, Arena *arena, int size)
: _hash(inithash), _cmp(initcmp), _arena(arena) {
int i;
// Precompute table of null character hashes
if( !initflag ) { // Not initializated yet?
xsum[0] = (1<<shft[0])+1; // Initialize
for(i=1; i<MAXID; i++) {
xsum[i] = (1<<shft[i])+1+xsum[i-1];
}
initflag = 1; // Never again
}
i=16;
while( i < size ) i <<= 1;
_size = i; // Size is a power of 2
_cnt = 0; // Dictionary is empty
_bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size);
memset(_bin,0,sizeof(bucket)*_size);
}
//------------------------------~Dict------------------------------------------
// Delete an existing dictionary.
Dict::~Dict() {
/*
tty->print("~Dict %d/%d: ",_cnt,_size);
for( uint i=0; i < _size; i++) // For complete new table do
tty->print("%d ",_bin[i]._cnt);
tty->print("\n");*/
/*for( uint i=0; i<_size; i++ ) {
FREE_FAST( _bin[i]._keyvals );
} */
}
//------------------------------Clear----------------------------------------
// Zap to empty; ready for re-use
void Dict::Clear() {
_cnt = 0; // Empty contents
for( uint i=0; i<_size; i++ )
_bin[i]._cnt = 0; // Empty buckets, but leave allocated
// Leave _size & _bin alone, under the assumption that dictionary will
// grow to this size again.
}
//------------------------------doubhash---------------------------------------
// Double hash table size. If can't do so, just suffer. If can, then run
// thru old hash table, moving things to new table. Note that since hash
// table doubled, exactly 1 new bit is exposed in the mask - so everything
// in the old table ends up on 1 of two lists in the new table; a hi and a
// lo list depending on the value of the bit.
void Dict::doubhash(void) {
uint oldsize = _size;
_size <<= 1; // Double in size
_bin = (bucket*)_arena->Arealloc( _bin, sizeof(bucket)*oldsize, sizeof(bucket)*_size );
memset( &_bin[oldsize], 0, oldsize*sizeof(bucket) );
// Rehash things to spread into new table
for( uint i=0; i < oldsize; i++) { // For complete OLD table do
bucket *b = &_bin[i]; // Handy shortcut for _bin[i]
if( !b->_keyvals ) continue; // Skip empties fast
bucket *nb = &_bin[i+oldsize]; // New bucket shortcut
uint j = b->_max; // Trim new bucket to nearest power of 2
while( j > b->_cnt ) j >>= 1; // above old bucket _cnt
if( !j ) j = 1; // Handle zero-sized buckets
nb->_max = j<<1;
// Allocate worst case space for key-value pairs
nb->_keyvals = (void**)_arena->Amalloc_4( sizeof(void *)*nb->_max*2 );
uint nbcnt = 0;
for( j=0; j<b->_cnt; j++ ) { // Rehash all keys in this bucket
void *key = b->_keyvals[j+j];
if( (_hash( key ) & (_size-1)) != i ) { // Moving to hi bucket?
nb->_keyvals[nbcnt+nbcnt] = key;
nb->_keyvals[nbcnt+nbcnt+1] = b->_keyvals[j+j+1];
nb->_cnt = nbcnt = nbcnt+1;
b->_cnt--; // Remove key/value from lo bucket
b->_keyvals[j+j ] = b->_keyvals[b->_cnt+b->_cnt ];
b->_keyvals[j+j+1] = b->_keyvals[b->_cnt+b->_cnt+1];
j--; // Hash compacted element also
}
} // End of for all key-value pairs in bucket
} // End of for all buckets
}
//------------------------------Dict-----------------------------------------
// Deep copy a dictionary.
Dict::Dict( const Dict &d ) : _size(d._size), _cnt(d._cnt), _hash(d._hash),_cmp(d._cmp), _arena(d._arena) {
_bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size);
memcpy( _bin, d._bin, sizeof(bucket)*_size );
for( uint i=0; i<_size; i++ ) {
if( !_bin[i]._keyvals ) continue;
_bin[i]._keyvals=(void**)_arena->Amalloc_4( sizeof(void *)*_bin[i]._max*2);
memcpy( _bin[i]._keyvals, d._bin[i]._keyvals,_bin[i]._cnt*2*sizeof(void*));
}
}
//------------------------------Dict-----------------------------------------
// Deep copy a dictionary.
Dict &Dict::operator =( const Dict &d ) {
if( _size < d._size ) { // If must have more buckets
_arena = d._arena;
_bin = (bucket*)_arena->Arealloc( _bin, sizeof(bucket)*_size, sizeof(bucket)*d._size );
memset( &_bin[_size], 0, (d._size-_size)*sizeof(bucket) );
_size = d._size;
}
uint i;
for( i=0; i<_size; i++ ) // All buckets are empty
_bin[i]._cnt = 0; // But leave bucket allocations alone
_cnt = d._cnt;
*(Hash*)(&_hash) = d._hash;
*(CmpKey*)(&_cmp) = d._cmp;
for( i=0; i<_size; i++ ) {
bucket *b = &d._bin[i]; // Shortcut to source bucket
for( uint j=0; j<b->_cnt; j++ )
Insert( b->_keyvals[j+j], b->_keyvals[j+j+1] );
}
return *this;
}
//------------------------------Insert----------------------------------------
// Insert or replace a key/value pair in the given dictionary. If the
// dictionary is too full, it's size is doubled. The prior value being
// replaced is returned (NULL if this is a 1st insertion of that key). If
// an old value is found, it's swapped with the prior key-value pair on the
// list. This moves a commonly searched-for value towards the list head.
void *Dict::Insert(void *key, void *val, bool replace) {
uint hash = _hash( key ); // Get hash key
uint i = hash & (_size-1); // Get hash key, corrected for size
bucket *b = &_bin[i]; // Handy shortcut
for( uint j=0; j<b->_cnt; j++ ) {
if( !_cmp(key,b->_keyvals[j+j]) ) {
if (!replace) {
return b->_keyvals[j+j+1];
} else {
void *prior = b->_keyvals[j+j+1];
b->_keyvals[j+j ] = key; // Insert current key-value
b->_keyvals[j+j+1] = val;
return prior; // Return prior
}
}
}
if( ++_cnt > _size ) { // Hash table is full
doubhash(); // Grow whole table if too full
i = hash & (_size-1); // Rehash
b = &_bin[i]; // Handy shortcut
}
if( b->_cnt == b->_max ) { // Must grow bucket?
if( !b->_keyvals ) {
b->_max = 2; // Initial bucket size
b->_keyvals = (void**)_arena->Amalloc_4(sizeof(void*) * b->_max * 2);
} else {
b->_keyvals = (void**)_arena->Arealloc(b->_keyvals, sizeof(void*) * b->_max * 2, sizeof(void*) * b->_max * 4);
b->_max <<= 1; // Double bucket
}
}
b->_keyvals[b->_cnt+b->_cnt ] = key;
b->_keyvals[b->_cnt+b->_cnt+1] = val;
b->_cnt++;
return NULL; // Nothing found prior
}
//------------------------------Delete---------------------------------------
// Find & remove a value from dictionary. Return old value.
void *Dict::Delete(void *key) {
uint i = _hash( key ) & (_size-1); // Get hash key, corrected for size
bucket *b = &_bin[i]; // Handy shortcut
for( uint j=0; j<b->_cnt; j++ )
if( !_cmp(key,b->_keyvals[j+j]) ) {
void *prior = b->_keyvals[j+j+1];
b->_cnt--; // Remove key/value from lo bucket
b->_keyvals[j+j ] = b->_keyvals[b->_cnt+b->_cnt ];
b->_keyvals[j+j+1] = b->_keyvals[b->_cnt+b->_cnt+1];
_cnt--; // One less thing in table
return prior;
}
return NULL;
}
//------------------------------FindDict-------------------------------------
// Find a key-value pair in the given dictionary. If not found, return NULL.
// If found, move key-value pair towards head of list.
void *Dict::operator [](const void *key) const {
uint i = _hash( key ) & (_size-1); // Get hash key, corrected for size
bucket *b = &_bin[i]; // Handy shortcut
for( uint j=0; j<b->_cnt; j++ )
if( !_cmp(key,b->_keyvals[j+j]) )
return b->_keyvals[j+j+1];
return NULL;
}
//------------------------------CmpDict--------------------------------------
// CmpDict compares two dictionaries; they must have the same keys (their
// keys must match using CmpKey) and they must have the same values (pointer
// comparison). If so 1 is returned, if not 0 is returned.
int32 Dict::operator ==(const Dict &d2) const {
if( _cnt != d2._cnt ) return 0;
if( _hash != d2._hash ) return 0;
if( _cmp != d2._cmp ) return 0;
for( uint i=0; i < _size; i++) { // For complete hash table do
bucket *b = &_bin[i]; // Handy shortcut
if( b->_cnt != d2._bin[i]._cnt ) return 0;
if( memcmp(b->_keyvals, d2._bin[i]._keyvals, b->_cnt*2*sizeof(void*) ) )
return 0; // Key-value pairs must match
}
return 1; // All match, is OK
}
//------------------------------print------------------------------------------
// Handier print routine
void Dict::print() {
DictI i(this); // Moved definition in iterator here because of g++.
tty->print("Dict@0x%lx[%d] = {", this, _cnt);
for( ; i.test(); ++i ) {
tty->print("(0x%lx,0x%lx),", i._key, i._value);
}
tty->print_cr("}");
}
//------------------------------Hashing Functions----------------------------
// Convert string to hash key. This algorithm implements a universal hash
// function with the multipliers frozen (ok, so it's not universal). The
// multipliers (and allowable characters) are all odd, so the resultant sum
// is odd - guaranteed not divisible by any power of two, so the hash tables
// can be any power of two with good results. Also, I choose multipliers
// that have only 2 bits set (the low is always set to be odd) so
// multiplication requires only shifts and adds. Characters are required to
// be in the range 0-127 (I double & add 1 to force oddness). Keys are
// limited to MAXID characters in length. Experimental evidence on 150K of
// C text shows excellent spreading of values for any size hash table.
int hashstr(const void *t) {
register char c, k = 0;
register int32 sum = 0;
register const char *s = (const char *)t;
while( ((c = *s++) != '\0') && (k < MAXID-1) ) { // Get characters till null or MAXID-1
c = (c<<1)+1; // Characters are always odd!
sum += c + (c<<shft[k++]); // Universal hash function
}
return (int)((sum+xsum[k]) >> 1); // Hash key, un-modulo'd table size
}
//------------------------------hashptr--------------------------------------
// Slimey cheap hash function; no guaranteed performance. Better than the
// default for pointers, especially on MS-DOS machines.
int hashptr(const void *key) {
#ifdef __TURBOC__
return ((intptr_t)key >> 16);
#else // __TURBOC__
return ((intptr_t)key >> 2);
#endif
}
// Slimey cheap hash function; no guaranteed performance.
int hashkey(const void *key) {
return (intptr_t)key;
}
//------------------------------Key Comparator Functions---------------------
int32 cmpstr(const void *k1, const void *k2) {
return strcmp((const char *)k1,(const char *)k2);
}
// Cheap key comparator.
int32 cmpkey(const void *key1, const void *key2) {
if (key1 == key2) return 0;
intptr_t delta = (intptr_t)key1 - (intptr_t)key2;
if (delta > 0) return 1;
return -1;
}
//=============================================================================
//------------------------------reset------------------------------------------
// Create an iterator and initialize the first variables.
void DictI::reset( const Dict *dict ) {
_d = dict; // The dictionary
_i = (uint)-1; // Before the first bin
_j = 0; // Nothing left in the current bin
++(*this); // Step to first real value
}
//------------------------------next-------------------------------------------
// Find the next key-value pair in the dictionary, or return a NULL key and
// value.
void DictI::operator ++(void) {
if( _j-- ) { // Still working in current bin?
_key = _d->_bin[_i]._keyvals[_j+_j];
_value = _d->_bin[_i]._keyvals[_j+_j+1];
return;
}
while( ++_i < _d->_size ) { // Else scan for non-zero bucket
_j = _d->_bin[_i]._cnt;
if( !_j ) continue;
_j--;
_key = _d->_bin[_i]._keyvals[_j+_j];
_value = _d->_bin[_i]._keyvals[_j+_j+1];
return;
}
_key = _value = NULL;
}
|
{
"pile_set_name": "Github"
}
|
namespace ClassLib049
{
public class Class048
{
public static string Property => "ClassLib049";
}
}
|
{
"pile_set_name": "Github"
}
|
apiVersion: v1
dryRun:
- "2"
fieldManager: "3"
kind: CreateOptions
|
{
"pile_set_name": "Github"
}
|
# Instruct user agent to not cache the response.
# Ref: http://stackoverflow.com/a/2068407/145400
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma no-cache;
add_header Expires 0;
|
{
"pile_set_name": "Github"
}
|
# bridge theme for SLIM
# by aditya shakya <[email protected]>
# using artwork from some free html+css login templates on the internet
# Messages (ie: shutdown)
msg_color #ffffff
msg_font Sans:size=18:bold:dpi=75
msg_x 50%
msg_y 30%
# Session Name
session_color #ffffff
session_font Sans:size=16:bold:dpi=75
session_x 50%
session_y 90%
# valid values: stretch, tile
background_style stretch
background_color #f2f2f2
# Input controls
input_panel_x 50%
input_panel_y 50%
input_name_x 145
input_name_y 145
input_pass_x 145
input_pass_y 207
input_font Sans:size=14:dpi=75
input_color #2196f3
username_msg
password_msg
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0"?>
<!--
Copyright (C) 2006, 2007, 2008, 2014, 2015 XStream Committers.
All rights reserved.
The software in this package is published under the terms of the BSD
style license a copy of which has been included with this distribution in
the LICENSE.txt file.
Created on 30. March 2006 by Joerg Schaible
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="immutableTypes|unreferenceableTypes">
<xsl:copy>
<xsl:apply-templates select="java-class">
<xsl:sort/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="names">
<xsl:copy>
<xsl:apply-templates select="string">
<xsl:sort/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="typeToImpl|typeToName|classToName|packageToName">
<xsl:copy>
<xsl:apply-templates select="entry">
<xsl:sort select="java-class[1]|string[1]"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
|
{
"pile_set_name": "Github"
}
|
JS-YAML - YAML 1.2 parser / writer for JavaScript
=================================================
[](https://travis-ci.org/nodeca/js-yaml)
[](https://www.npmjs.org/package/js-yaml)
__[Online Demo](http://nodeca.github.com/js-yaml/)__
This is an implementation of [YAML](http://yaml.org/), a human-friendly data
serialization language. Started as [PyYAML](http://pyyaml.org/) port, it was
completely rewritten from scratch. Now it's very fast, and supports 1.2 spec.
Installation
------------
### YAML module for node.js
```
npm install js-yaml
```
### CLI executable
If you want to inspect your YAML files from CLI, install js-yaml globally:
```
npm install -g js-yaml
```
#### Usage
```
usage: js-yaml [-h] [-v] [-c] [-t] file
Positional arguments:
file File with YAML document(s)
Optional arguments:
-h, --help Show this help message and exit.
-v, --version Show program's version number and exit.
-c, --compact Display errors in compact mode
-t, --trace Show stack trace on error
```
### Bundled YAML library for browsers
``` html
<!-- esprima required only for !!js/function -->
<script src="esprima.js"></script>
<script src="js-yaml.min.js"></script>
<script type="text/javascript">
var doc = jsyaml.load('greeting: hello\nname: world');
</script>
```
Browser support was done mostly for the online demo. If you find any errors - feel
free to send pull requests with fixes. Also note, that IE and other old browsers
needs [es5-shims](https://github.com/kriskowal/es5-shim) to operate.
Notes:
1. We have no resources to support browserified version. Don't expect it to be
well tested. Don't expect fast fixes if something goes wrong there.
2. `!!js/function` in browser bundle will not work by default. If you really need
it - load `esprima` parser first (via amd or directly).
3. `!!bin` in browser will return `Array`, because browsers do not support
node.js `Buffer` and adding Buffer shims is completely useless on practice.
API
---
Here we cover the most 'useful' methods. If you need advanced details (creating
your own tags), see [wiki](https://github.com/nodeca/js-yaml/wiki) and
[examples](https://github.com/nodeca/js-yaml/tree/master/examples) for more
info.
``` javascript
yaml = require('js-yaml');
fs = require('fs');
// Get document, or throw exception on error
try {
var doc = yaml.safeLoad(fs.readFileSync('/home/ixti/example.yml', 'utf8'));
console.log(doc);
} catch (e) {
console.log(e);
}
```
### safeLoad (string [ , options ])
**Recommended loading way.** Parses `string` as single YAML document. Returns a JavaScript
object or throws `YAMLException` on error. By default, does not support regexps,
functions and undefined. This method is safe for untrusted data.
options:
- `filename` _(default: null)_ - string to be used as a file path in
error/warning messages.
- `onWarning` _(default: null)_ - function to call on warning messages.
Loader will call this function with an instance of `YAMLException` for each warning.
- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ - specifies a schema to use.
- `FAILSAFE_SCHEMA` - only strings, arrays and plain objects:
http://www.yaml.org/spec/1.2/spec.html#id2802346
- `JSON_SCHEMA` - all JSON-supported types:
http://www.yaml.org/spec/1.2/spec.html#id2803231
- `CORE_SCHEMA` - same as `JSON_SCHEMA`:
http://www.yaml.org/spec/1.2/spec.html#id2804923
- `DEFAULT_SAFE_SCHEMA` - all supported YAML types, without unsafe ones
(`!!js/undefined`, `!!js/regexp` and `!!js/function`):
http://yaml.org/type/
- `DEFAULT_FULL_SCHEMA` - all supported YAML types.
- `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error.
NOTE: This function **does not** understand multi-document sources, it throws
exception on those.
NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions.
So, the JSON schema is not as strictly defined in the YAML specification.
It allows numbers in any notation, use `Null` and `NULL` as `null`, etc.
The core schema also has no such restrictions. It allows binary notation for integers.
### load (string [ , options ])
**Use with care with untrusted sources**. The same as `safeLoad()` but uses
`DEFAULT_FULL_SCHEMA` by default - adds some JavaScript-specific types:
`!!js/function`, `!!js/regexp` and `!!js/undefined`. For untrusted sources, you
must additionally validate object structure to avoid injections:
``` javascript
var untrusted_code = '"toString": !<tag:yaml.org,2002:js/function> "function (){very_evil_thing();}"';
// I'm just converting that string, what could possibly go wrong?
require('js-yaml').load(untrusted_code) + ''
```
### safeLoadAll (string [, iterator] [, options ])
Same as `safeLoad()`, but understands multi-document sources. Applies
`iterator` to each document if specified, or returns array of documents.
``` javascript
var yaml = require('js-yaml');
yaml.safeLoadAll(data, function (doc) {
console.log(doc);
});
```
### loadAll (string [, iterator] [ , options ])
Same as `safeLoadAll()` but uses `DEFAULT_FULL_SCHEMA` by default.
### safeDump (object [ , options ])
Serializes `object` as a YAML document. Uses `DEFAULT_SAFE_SCHEMA`, so it will
throw an exception if you try to dump regexps or functions. However, you can
disable exceptions by setting the `skipInvalid` option to `true`.
options:
- `indent` _(default: 2)_ - indentation width to use (in spaces).
- `noArrayIndent` _(default: false)_ - when true, will not add an indentation level to array elements
- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function
in the safe schema) and skip pairs and single values with such types.
- `flowLevel` (default: -1) - specifies level of nesting, when to switch from
block to flow style for collections. -1 means block style everwhere
- `styles` - "tag" => "style" map. Each tag may have own set of styles.
- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ specifies a schema to use.
- `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a
function, use the function to sort the keys.
- `lineWidth` _(default: `80`)_ - set max line width.
- `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references
- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older
yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1
- `condenseFlow` _(default: `false`)_ - if `true` flow sequences will be condensed, omitting the space between `a, b`. Eg. `'[a,b]'`, and omitting the space between `key: value` and quoting the key. Eg. `'{"a":b}'` Can be useful when using yaml for pretty URL query params as spaces are %-encoded.
The following table show availlable styles (e.g. "canonical",
"binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml
output is shown on the right side after `=>` (default setting) or `->`:
``` none
!!null
"canonical" -> "~"
"lowercase" => "null"
"uppercase" -> "NULL"
"camelcase" -> "Null"
!!int
"binary" -> "0b1", "0b101010", "0b1110001111010"
"octal" -> "01", "052", "016172"
"decimal" => "1", "42", "7290"
"hexadecimal" -> "0x1", "0x2A", "0x1C7A"
!!bool
"lowercase" => "true", "false"
"uppercase" -> "TRUE", "FALSE"
"camelcase" -> "True", "False"
!!float
"lowercase" => ".nan", '.inf'
"uppercase" -> ".NAN", '.INF'
"camelcase" -> ".NaN", '.Inf'
```
Example:
``` javascript
safeDump (object, {
'styles': {
'!!null': 'canonical' // dump null as ~
},
'sortKeys': true // sort object keys
});
```
### dump (object [ , options ])
Same as `safeDump()` but without limits (uses `DEFAULT_FULL_SCHEMA` by default).
Supported YAML types
--------------------
The list of standard YAML tags and corresponding JavaScipt types. See also
[YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and
[YAML types repository](http://yaml.org/type/).
```
!!null '' # null
!!bool 'yes' # bool
!!int '3...' # number
!!float '3.14...' # number
!!binary '...base64...' # buffer
!!timestamp 'YYYY-...' # date
!!omap [ ... ] # array of key-value pairs
!!pairs [ ... ] # array or array pairs
!!set { ... } # array of objects with given keys and null values
!!str '...' # string
!!seq [ ... ] # array
!!map { ... } # object
```
**JavaScript-specific tags**
```
!!js/regexp /pattern/gim # RegExp
!!js/undefined '' # Undefined
!!js/function 'function () {...}' # Function
```
Caveats
-------
Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects
or arrays as keys, and stringifies (by calling `toString()` method) them at the
moment of adding them.
``` yaml
---
? [ foo, bar ]
: - baz
? { foo: bar }
: - baz
- baz
```
``` javascript
{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] }
```
Also, reading of properties on implicit block mapping keys is not supported yet.
So, the following YAML document cannot be loaded.
``` yaml
&anchor foo:
foo: bar
*anchor: duplicate key
baz: bat
*anchor: duplicate key
```
Breaking changes in 2.x.x -> 3.x.x
----------------------------------
If you have not used __custom__ tags or loader classes and not loaded yaml
files via `require()`, no changes are needed. Just upgrade the library.
Otherwise, you should:
1. Replace all occurrences of `require('xxxx.yml')` by `fs.readFileSync()` +
`yaml.safeLoad()`.
2. rewrite your custom tags constructors and custom loader
classes, to conform the new API. See
[examples](https://github.com/nodeca/js-yaml/tree/master/examples) and
[wiki](https://github.com/nodeca/js-yaml/wiki) for details.
License
-------
View the [LICENSE](https://github.com/nodeca/js-yaml/blob/master/LICENSE) file
(MIT).
|
{
"pile_set_name": "Github"
}
|
byte a = 0 ; assert a instanceof Byte
short b = 0 ; assert b instanceof Short
int c = 0 ; assert c instanceof Integer
long d = 0L ; assert d instanceof Long
float e = 0F ; assert e instanceof Float
double f = 0D ; assert f instanceof Double
char g = 'a' ; assert g instanceof Character
boolean h = true ; assert h instanceof Boolean
|
{
"pile_set_name": "Github"
}
|
path: "tensorflow.TensorInfo"
tf_proto {
descriptor {
name: "TensorInfo"
field {
name: "name"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
oneof_index: 0
}
field {
name: "coo_sparse"
number: 4
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".tensorflow.TensorInfo.CooSparse"
oneof_index: 0
}
field {
name: "composite_tensor"
number: 5
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".tensorflow.TensorInfo.CompositeTensor"
oneof_index: 0
}
field {
name: "dtype"
number: 2
label: LABEL_OPTIONAL
type: TYPE_ENUM
type_name: ".tensorflow.DataType"
}
field {
name: "tensor_shape"
number: 3
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".tensorflow.TensorShapeProto"
}
nested_type {
name: "CooSparse"
field {
name: "values_tensor_name"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
}
field {
name: "indices_tensor_name"
number: 2
label: LABEL_OPTIONAL
type: TYPE_STRING
}
field {
name: "dense_shape_tensor_name"
number: 3
label: LABEL_OPTIONAL
type: TYPE_STRING
}
}
nested_type {
name: "CompositeTensor"
field {
name: "type_spec"
number: 1
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".tensorflow.TypeSpecProto"
}
field {
name: "components"
number: 2
label: LABEL_REPEATED
type: TYPE_MESSAGE
type_name: ".tensorflow.TensorInfo"
}
}
oneof_decl {
name: "encoding"
}
}
}
|
{
"pile_set_name": "Github"
}
|
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
<TemplateData>
<Name>Azure Storage Queues</Name>
<Description>Demonstrates include inserting, peeking, getting, and deleting queue messages, as well as creating and deleting queues using the Azure Storage Client for .NET.</Description>
<DefaultName>DataStorageQueue</DefaultName>
<ProjectType>CSharp</ProjectType>
<ProjectSubType></ProjectSubType>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<Icon>sw-file-icon.png</Icon>
<!-- Indicates how many parent folders this item template should appear in -->
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
</TemplateData>
<TemplateContent>
<Project TargetFileName="DataStorageQueue.csproj" File="DataStorageQueue.csproj" ReplaceParameters="true">
</Project>
</TemplateContent>
<WizardExtension>
<Assembly>ProjectWizard, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=caa87a55fd76d99d</Assembly>
<FullClassName>ProjectWizard.Wizard</FullClassName>
</WizardExtension>
</VSTemplate>
|
{
"pile_set_name": "Github"
}
|
{
"images" : [
{
"idiom" : "universal",
"filename" : "blue_sliderDown.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
|
{
"pile_set_name": "Github"
}
|
# -*- coding: utf-8 -*-
# Copyright (c) 2020 PaddlePaddle 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.
"""
:py:class:`DataSet`
"""
from text2sql.framework.register import RegisterSet
from text2sql.framework.reader.field import Field
from text2sql.framework.reader.reader_config import ReaderConfig
class DataSet(object):
"""DataSet"""
def __init__(self, params_dict):
""""""
self.train_reader = None
self.test_reader = None
self.evaluate_reader = None
self.predict_reader = None
self.params_dict = params_dict
def build(self):
"""
:return:
"""
reader_list = []
data_set_reader_dict = {}
if self.params_dict.__contains__("train_reader"):
reader_list.append("train_reader")
if self.params_dict.__contains__("test_reader"):
reader_list.append("test_reader")
if self.params_dict.__contains__("evaluate_reader"):
reader_list.append("evaluate_reader")
if self.params_dict.__contains__("predict_reader"):
reader_list.append("predict_reader")
for reader_name in reader_list:
cfg_list = self.params_dict.get(reader_name).get("fields")
train_fields = []
for item in cfg_list:
item_field = Field()
item_field.build(item)
if item_field.reader_info and item_field.reader_info.get("type", None):
reader_class = RegisterSet.field_reader.__getitem__(item_field.reader_info["type"])
field_reader = reader_class(item_field)
item_field.field_reader = field_reader
train_fields.append(item_field)
reader_cfg = ReaderConfig()
reader_cfg.build(self.params_dict.get(reader_name).get("config"))
dataset_reader_name = self.params_dict.get(reader_name).get("type")
dataset_reader_class = RegisterSet.data_set_reader.__getitem__(dataset_reader_name)
one_reader = dataset_reader_class(name=reader_name, fields=train_fields, config=reader_cfg)
data_set_reader_dict[reader_name] = one_reader
if data_set_reader_dict.__contains__("train_reader"):
self.train_reader = data_set_reader_dict["train_reader"]
if data_set_reader_dict.__contains__("test_reader"):
self.test_reader = data_set_reader_dict["test_reader"]
if data_set_reader_dict.__contains__("evaluate_reader"):
self.evaluate_reader = data_set_reader_dict["evaluate_reader"]
if data_set_reader_dict.__contains__("predict_reader"):
self.predict_reader = data_set_reader_dict["predict_reader"]
elif self.train_reader:
cfg_list = self.params_dict.get("train_reader").get("fields")
predict_fields = []
for item in cfg_list:
item_field = Field()
item_field.build(item)
if item_field.reader_info and item_field.reader_info.get("type", None):
reader_class = RegisterSet.field_reader.__getitem__(item_field.reader_info["type"])
field_reader = reader_class(item_field)
item_field.field_reader = field_reader
predict_fields.append(item_field)
reader_cfg = ReaderConfig()
reader_cfg.build(self.params_dict.get("train_reader").get("config"))
dataset_reader_name = self.params_dict.get("train_reader").get("type")
dataset_reader_class = RegisterSet.data_set_reader.__getitem__(dataset_reader_name)
self.predict_reader = dataset_reader_class(name="predict_reader", fields=predict_fields,
config=reader_cfg)
|
{
"pile_set_name": "Github"
}
|
{
"txid": "24225cf5e9391100d6b218134b9f03383ca4c880a1f634ac12990cf28b66adbc",
"hash": "24225cf5e9391100d6b218134b9f03383ca4c880a1f634ac12990cf28b66adbc",
"version": 1,
"size": 42,
"vsize": 42,
"locktime": 0,
"vin": [
],
"vout": [
{
"value": 0.00000000,
"n": 0,
"scriptPubKey": {
"asm": "OP_HASH160 6a2c482f4985f57e702f325816c90e3723ca81ae OP_EQUAL",
"hex": "a9146a2c482f4985f57e702f325816c90e3723ca81ae87",
"reqSigs": 1,
"type": "scripthash",
"addresses": [
"3BNQbeFeJJGMAyDxPwWPuqxPMrjsFLjk3f"
]
}
}
],
"hex": "010000000001000000000000000017a9146a2c482f4985f57e702f325816c90e3723ca81ae8700000000"
}
|
{
"pile_set_name": "Github"
}
|
module Spiral.CoreLib
let module_ = Types.module_
let core =
(
"Core",[],"The Core module.",
"""
/// Lifts a literal to the type level.
inl type_lit_lift x = !TypeLitCreate(x)
/// Raises a type error.
inl error_type x = !ErrorType(x)
/// Prints an expression at compile time.
inl print_static x = !PrintStatic(x)
/// Pushes the expression to runtime.
inl dyn x = !Dynamize(x)
/// Creates a term function with the given two types.
inl (=>) a b = !TermFunctionTypeCreate(a,b)
/// Splits the union or recursive type into a tuple.
inl split x = !TypeSplit(x)
/// Boxes a type.
inl box a b = !TypeBox(a,b)
/// Converts module or a function to a stack layout type.
inl stack x = !LayoutToStack(x)
/// Converts module or a function to a packed stack layout type.
inl packed_stack x = !LayoutToPackedStack(x)
/// Converts module or a function to a heap layout type.
inl heap x = !LayoutToHeap(x)
/// Converts module or a function to a mutable heap layout type.
inl heapm x = !LayoutToHeapMutable(x)
/// Converts a layout type to a module or a function.
inl indiv x = !LayoutToNone(x)
/// The type of a boolean.
inl bool = type true
/// The type of a int64.
inl int64 = type 0i64
/// The type of a int32.
inl int32 = type 0i32
/// The type of a int16.
inl int16 = type 0i16
/// The type of a int8.
inl int8 = type 0i8
/// The type of a uint64.
inl uint64 = type 0u64
/// The type of a uint32.
inl uint32 = type 0u32
/// The type of a uint16.
inl uint16 = type 0u16
/// The type of a uint8.
inl uint8 = type 0u8
/// The type of a float64.
inl float64 = type 0f64
/// The type of a float32.
inl float32 = type 0f32
/// The type of a string.
inl string = type ""
/// The type of a char.
inl char = type ' '
/// Casts a type literal to the term level.
inl type_lit_cast x = !TypeLitCast(x)
/// Returns whether the expression is a type literal as a bool.
inl type_lit_is x = !TypeLitIs(x)
/// Cast a function to the term level.
inl term_cast to from = !TermCast(to,from)
/// Does unchecked conversion for primitives.
inl to to from = !UnsafeConvert(to,from)
/// Unary negation.
inl negate x = !Neg(x)
/// Evaluates an expression and throws away the result.
inl ignore x = ()
/// Returns an expression after evaluating it.
inl id x = x
/// Throws away the second argument and returns the first.
inl const x _ = x
/// Creates a reference.
inl ref x = !ReferenceCreate(x)
/// Creates an array with the given type and the size.
inl array_create typ size = !ArrayCreate(size,typ)
/// Creates a Cuda shared memory array with the given type and the size.
inl array_create_cuda_shared typ size = !ArrayCreate(.cuda_shared,size,typ)
/// Creates a Cuda local memory array with the given type and the size.
inl array_create_cuda_local typ size = !ArrayCreate(.cuda_local,size,typ)
/// Returns the length of an array. Not applicable to Cuda arrays.
inl array_length ar = !ArrayLength(ar)
/// Partial active pattern. In `on_succ` it also passes the type of the array as a type string.
inl array_is x on_fail on_succ = !ArrayIs(x,on_fail,on_succ)
/// Type of an array with the given type.
inl array t = type (array_create t 1)
/// Binary addition.
inl (+) a b = !Add(a,b)
/// Binary subtraction.
inl (-) a b = !Sub(a,b)
/// Binary multiplication.
inl (*) a b = !Mult(a,b)
/// Binary power.
inl (**) a b = !Pow(a,b)
/// Binary division.
inl (/) a b = !Div(a,b)
/// Binary modulo.
inl (%) a b = !Mod(a,b)
/// Applies the first argument to the second.
inl (|>) a b = b a
/// Applies the second argument to the first.
inl (<|) a b = a b
/// Applies the third argument to the first and then the result of that to the second.
inl (>>) a b x = b (a x)
/// Applies the third argument to the second and then the result of that to the first.
inl (<<) a b x = a (b x)
/// Binary less-than-or-equals.
inl (<=) a b = !LTE(a,b)
/// Binary less-than.
inl (<) a b = !LT(a,b)
/// Binary equals.
inl (=) a b = !EQ(a,b)
/// Binary unequals.
inl (<>) a b = !NEQ(a,b)
/// Binary greater-than.
inl (>) a b = !GT(a,b)
/// Binary greater-than-or-equals.
inl (>=) a b = !GTE(a,b)
/// Bitwise and.
inl (&&&) a b = !BitwiseAnd(a,b)
/// Bitwise or.
inl (|||) a b = !BitwiseOr(a,b)
/// Bitwise xor.
inl (^^^) a b = !BitwiseXor(a,b)
/// Tuple cons.
inl (::) a b = !ListCons(a,b)
/// Shift left.
inl (<<<) a b = !ShiftLeft(a,b)
/// Shift right.
inl (>>>) a b = !ShiftRight(a,b)
/// Gets the first elements of a tuple.
inl fst x :: _ = x
/// Gets the second element of a tuple.
inl snd _ :: x :: _ = x
/// Unary negation.
inl not x = x = false
/// Returns the length of a string.
inl string_length x = !StringLength(x)
/// The .NET String.Format function.
/// https://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx
/// When its arguments are literals, it evaluates at compile time.
inl string_format a b = !StringFormat(a,b)
/// The F# String.concat function
/// https://msdn.microsoft.com/en-us/visualfsharpdocs/conceptual/string.concat-function-%5Bfsharp%5D
/// When its arguments are literals, it evaluates at compile time.
inl string_concat a b = !StringConcat(a,b)
/// Returns boolean whether the expression is a literal.
inl lit_is x = !LitIs(x)
/// Returns boolean whether the expression is a primitive type or a type literal.
inl val_is x = !ValIs(x)
/// Returns boolean whether the expression is a box (but not an union type.)
inl box_is x = !BoxIs(x)
/// Returns boolean whether the expression is a union or a recursive type (excluding boxes.)
inl caseable_is x = !CaseableIs(x)
/// Returns boolean whether the expression is a union or a recursive type.
inl caseable_box_is x = !CaseableBoxIs(x)
/// Raises an exception at runtime.
inl failwith typ msg = !FailWith(typ,msg)
/// Asserts an expression. If the conditional is a literal it raises a type error instead.
inl assert c msg =
inl raise =
if lit_is c then error_type
else failwith ()
if c = false then raise msg
/// Returns the maximum of the two expressions.
inl max a b = if a > b then a else b
/// Returns the minimum of the two expressions.
inl min a b = if a > b then b else a
/// The template for lit_min and lit_max.
inl lit_comp op a b =
if lit_is a && lit_is b then op a b
elif lit_is a then a
elif lit_is b then b
else error_type "a or b needs to be a literal"
/// Returns the compile time expressible maximum of the two expressions.
inl lit_max = lit_comp max
/// Returns the compile time expressible minimum of the two expressions.
inl lit_min = lit_comp min
/// Returns boolean whether the two expressions are equal in their types.
inl eq_type a b = !EqType(a,b)
/// Returns the values of a module in a tuple.
inl module_values x = !ModuleValues(x)
/// Maps over a module.
/// (string type_lit -> a -> b) -> a module -> b module
inl module_map f a = !ModuleMap(f,a)
/// Iterates over a module.
/// (string type_lit -> a -> ()) -> a module -> ()
inl module_iter f a = module_map (inl k a -> f k a; ()) a |> ignore
/// Filters a module at compile time.
/// (string type_lit -> a -> bool) -> a module -> a module
inl module_filter f a = !ModuleFilter(f,a)
/// Folds over a module left to right.
/// (string type_lit -> state -> a -> state) -> state -> a module -> state
inl module_foldl f s a = !ModuleFoldL(f,s,a)
/// Folds over a module right to left.
/// (string type_lit -> a -> state -> state) -> a module -> state -> state
inl module_foldr f a s = !ModuleFoldR(f,s,a)
/// Returns boolean whether the module has a member.
/// string type_lit -> a module -> bool
inl module_has_member x m = !ModuleHasMember(x,m)
/// Returns the module length.
/// module -> int64
inl module_length m = !ModuleLength(m)
/// Unsafe upcast. Unlike the F# compiler, Spiral won't check its correctness.
inl (:>) a b = !UnsafeUpcastTo(b,a)
/// Unsafe downcast. Unlike the F# compiler, Spiral won't check its correctness.
inl (:?>) a b = !UnsafeDowncastTo(b,a)
/// Structural polymorphic equality for every type in the language (apart from functions.)
inl (=) a b =
inl rec (=) a b =
inl body a,b =
match a,b with
| .(a), .(b) -> a = b
| a :: as', b :: bs -> a = b && as' = bs
| {} & a, {} & b -> module_values a = module_values b
| (), () -> true
| a, () -> false // Just in case `b` has not been `Case`d up to this point. This can happen for `(int64, int64) \/ int64` kind of types.
| a, b when eq_type a b -> !EQ(a, b) // This repeat eq_type check is because unboxed union types might lead to variables of different types to be compared.
| _ -> false
if caseable_is a && caseable_is b then join (body (a, b) : true)
else body (a, b)
if eq_type a b then a = b
else error_type ("Trying to compare variables of two different types. Got:",a,b)
/// Structural polymorphic unequality for every type in the language (apart from functions.)
inl (<>) a b = (a = b) <> true
/// Returns the size a type.
/// type -> int64
inl sizeof x = !SizeOf(x)
/// Creates a .NET type from a macro.
inl fs x = !DotNetTypeCreate(x)
/// Creates a Cuda type from a macro.
inl cd x = !CudaTypeCreate(x)
/// Natural Logarithm.
inl log x = !Log(x)
/// Exponent.
inl exp x = !Exp(x)
/// Hyperbolic tangent.
inl tanh x = !Tanh(x)
/// Square root.
inl sqrt x = !Sqrt(x)
/// Macros.
inl macro = {
/// F# macro.
fs = inl typ expr -> !MacroFs(typ,expr)
/// Cuda macro.
cd = inl typ expr -> !MacroCuda(typ,expr)
}
inl infinityf64 = !InfinityF64()
inl infinityf32 = !InfinityF32()
// Note: Nan is not allowed as a literal because it cannot be memoized. Just use zero or something else.
// Since join points use structural equality and nan = nan returns false, nans will cause the compiler to diverge.
// Note for future language designers - make nan = nan return true!
/// Returns the absolute value.
inl abs x = if x >= to x 0 then x else -x
/// Checks whether the type can move past language boundaries.
inl blittable_is x = !BlittableIs(x)
inl threadIdx (.x | .y | .z) as x = macro.cd int64 [text: "threadIdx."; text: x]
inl blockIdx (.x | .y | .z) as x = macro.cd int64 [text: "blockIdx."; text: x]
/// Converts a type to a variable. Not to be used on the term level.
inl var x = !ToVar(x)
/// Adds a variable to the module.
inl module_add name v s = !ModuleAdd(name,v,s)
/// Removes a variable from the module. Does nothing if the variable is not present.
inl module_remove name s = !ModuleRemove(name,s)
/// Converts the argument (usually a module) to the object form.
inl obj s x = s x s
/// Checks whether the float is a nan.
inl nan_is x = !NanIs(x)
/// Stackifies a module.
inl stackify = module_map (const stack) >> stack
/// Case that folds a literal through its branches.
inl case_foldl_map f s x = !CaseFoldLMap(f,s,x)
/// Does a map operation over a module while threading state.
inl module_foldl_map f s =
module_foldl (inl k (m,s) x ->
inl x, s = f k s x
inl m = module_add k x m
m, s
) ({}, s)
/// Maps the leaves of the intersection of the two modules.
inl module_intersect f a b =
inl rec loop = function
| {} & a, {} & b ->
module_foldl (inl k m a ->
match b with
| {$k=b} -> {m with $k=loop (a,b)}
| _ -> m
) {} a
| a,b -> f a b
loop (a,b)
/// Applies the unit to the function.
/// (() -> a) -> a
inl unconst x = x()
/// Raises an exception at the type level. `type_catch` should be used to contain and extract the type within it.
inl type_raise x = !TypeRaise(x)
{
type_lit_lift error_type print_static dyn (=>) cd fs log exp tanh sqrt array_create array_length array_is array
split box stack packed_stack heap heapm indiv bool int64 int32 int16 int8 uint64 uint32 uint16 uint8 float64 float32
string char type_lit_cast type_lit_is term_cast to negate ignore id const ref (+) (-) (*) (**) (/) (%)
(|>) (<|) (>>) (<<) (<=) (<) (=) (<>) (>) (>=) (&&&) (|||) (^^^) (::) (<<<) (>>>) fst snd not macro
string_length lit_is val_is box_is failwith assert max min eq_type module_values caseable_is caseable_box_is (:>)
(:?>) (=) module_map module_filter module_foldl module_foldr module_has_member sizeof string_format string_concat
array_create_cuda_shared array_create_cuda_local infinityf64 infinityf32 abs blittable_is threadIdx blockIdx
lit_min lit_max var module_add module_remove obj nan_is stackify case_foldl_map module_foldl_map module_length
module_intersect module_iter unconst type_raise
}
|> module_map (const stack)
""") |> module_
|
{
"pile_set_name": "Github"
}
|
//===----- CompileOnDemandLayerTest.cpp - Unit tests for the COD layer ----===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h"
#include "OrcTestCommon.h"
#include "gtest/gtest.h"
using namespace llvm;
using namespace llvm::orc;
namespace {
class DummyTrampolinePool : public orc::TrampolinePool {
public:
Expected<JITTargetAddress> getTrampoline() {
llvm_unreachable("Unimplemented");
}
};
class DummyCallbackManager : public JITCompileCallbackManager {
public:
DummyCallbackManager(ExecutionSession &ES)
: JITCompileCallbackManager(llvm::make_unique<DummyTrampolinePool>(), ES,
0) {}
};
class DummyStubsManager : public orc::IndirectStubsManager {
public:
Error createStub(StringRef StubName, JITTargetAddress InitAddr,
JITSymbolFlags Flags) override {
llvm_unreachable("Not implemented");
}
Error createStubs(const StubInitsMap &StubInits) override {
llvm_unreachable("Not implemented");
}
JITEvaluatedSymbol findStub(StringRef Name, bool ExportedStubsOnly) override {
llvm_unreachable("Not implemented");
}
JITEvaluatedSymbol findPointer(StringRef Name) override {
llvm_unreachable("Not implemented");
}
Error updatePointer(StringRef Name, JITTargetAddress NewAddr) override {
llvm_unreachable("Not implemented");
}
};
TEST(LegacyCompileOnDemandLayerTest, FindSymbol) {
MockBaseLayer<int, std::shared_ptr<Module>> TestBaseLayer;
TestBaseLayer.findSymbolImpl =
[](const std::string &Name, bool) {
if (Name == "foo")
return JITSymbol(1, JITSymbolFlags::Exported);
return JITSymbol(nullptr);
};
ExecutionSession ES(std::make_shared<SymbolStringPool>());
DummyCallbackManager CallbackMgr(ES);
auto GetResolver =
[](orc::VModuleKey) -> std::shared_ptr<llvm::orc::SymbolResolver> {
llvm_unreachable("Should never be called");
};
auto SetResolver = [](orc::VModuleKey, std::shared_ptr<orc::SymbolResolver>) {
llvm_unreachable("Should never be called");
};
llvm::orc::LegacyCompileOnDemandLayer<decltype(TestBaseLayer)> COD(
ES, TestBaseLayer, GetResolver, SetResolver,
[](Function &F) { return std::set<Function *>{&F}; }, CallbackMgr,
[] { return llvm::make_unique<DummyStubsManager>(); }, true);
auto Sym = COD.findSymbol("foo", true);
EXPECT_TRUE(!!Sym) << "CompileOnDemand::findSymbol should call findSymbol in "
"the base layer.";
}
}
|
{
"pile_set_name": "Github"
}
|
/***************************************************************/
/*** Turning general-purpose C structures into Python objects ***/
/***************************************************************/
#ifndef _CSTRUCT_H
#define _CSTRUCT_H
#include "psyco.h"
#define PyCStruct_HEAD \
PyObject_HEAD \
destructor cs_destructor; \
PyObject* cs_key;
typedef struct { /* internal */
PyCStruct_HEAD
} cstruct_header_t;
EXTERNVAR PyTypeObject PyCStruct_Type;
#define PyCStruct_Check(op) PyObject_TypeCheck(op, &PyCStruct_Type)
EXTERNFN PyObject* PyCStruct_New(size_t size, destructor d);
#define PyCStruct_NEW(TYPE, d) \
((TYPE*) PyCStruct_New(sizeof(TYPE), (destructor)(d)))
/* lookup in the given dict for the item whose key is a CStruct with
the given key as cs_key */
PSY_INLINE PyObject* PyCStruct_DictGet(PyObject* dict, PyObject* key)
{
cstruct_header_t sample;
sample.ob_type = &PyCStruct_Type;
sample.ob_refcnt = 1;
sample.cs_key = key;
return PyDict_GetItem(dict, (PyObject*) &sample);
}
#endif /* _CSTRUCT_H */
|
{
"pile_set_name": "Github"
}
|
[
{
"send": {
"key": "1",
"timestamp": 1,
"orig_path": [],
"communities": [],
"service": "a",
"type": "A",
"path": [8, 3, 2, 100],
"prefix": "10.0.0.0/8",
"peer_asn": 8
},
"detection_update_response": {
"key": "1",
"handled": true,
"matched_prefix": "10.0.0.0/8",
"origin_as": 100
},
"detection_hijack_response": {
"prefix": "10.0.0.0/8",
"hijack_as": 100,
"type": "E|0|-|-",
"time_started": 1.0,
"configured_prefix": "10.0.0.0/8"
},
"database_hijack_response": {
"type": "E|0|-|-",
"active": true,
"prefix": "10.0.0.0/8",
"asns_inf": [8, 2, 3],
"hijack_as": 100,
"peers_seen": [8],
"num_asns_inf": 3,
"num_peers_seen": 1,
"configured_prefix": "10.0.0.0/8"
}
},
{
"send": {
"key": "2",
"timestamp": 2,
"orig_path": [],
"communities": [],
"service": "a",
"type": "A",
"path": [9, 3, 2, 100],
"prefix": "10.0.0.0/8",
"peer_asn": 9
},
"detection_update_response": {
"key": "2",
"handled": true,
"matched_prefix": "10.0.0.0/8",
"origin_as": 100
},
"detection_hijack_response": {
"prefix": "10.0.0.0/8",
"hijack_as": 100,
"type": "E|0|-|-",
"time_started": 1.0,
"time_last": 2.0,
"configured_prefix": "10.0.0.0/8"
},
"database_hijack_response": {
"type": "E|0|-|-",
"active": true,
"prefix": "10.0.0.0/8",
"asns_inf": [9, 8, 2, 3],
"hijack_as": 100,
"peers_seen": [8, 9],
"num_asns_inf": 4,
"num_peers_seen": 2,
"configured_prefix": "10.0.0.0/8"
}
},
{
"send": {
"key": "3",
"timestamp": 3,
"orig_path": [],
"communities": [],
"service": "a",
"type": "A",
"path": [8, 3, 2, 1],
"prefix": "10.0.0.0/8",
"peer_asn": 8
},
"detection_update_response": [
{
"key": "3",
"handled": true,
"matched_prefix": "10.0.0.0/8",
"origin_as": 1
},
{
"handled": true,
"matched_prefix": "10.0.0.0/8",
"origin_as": -1
}
],
"database_hijack_response": {
"type": "E|0|-|-",
"prefix": "10.0.0.0/8",
"asns_inf": [9, 8, 2, 3],
"hijack_as": 100,
"peers_seen": [8, 9],
"num_asns_inf": 4,
"num_peers_seen": 2,
"configured_prefix": "10.0.0.0/8",
"peers_withdrawn": [8],
"active": true
}
},
{
"send": {
"key": "4",
"timestamp": 4,
"orig_path": [],
"communities": [],
"service": "a",
"type": "A",
"path": [9, 3, 2, 1],
"prefix": "10.0.0.0/8",
"peer_asn": 9
},
"detection_update_response": [
{
"key": "4",
"handled": true,
"matched_prefix": "10.0.0.0/8",
"origin_as": 1
},
{
"handled": true,
"matched_prefix": "10.0.0.0/8",
"origin_as": -1
}
],
"database_hijack_response": {
"type": "E|0|-|-",
"prefix": "10.0.0.0/8",
"asns_inf": [9, 8, 2, 3],
"hijack_as": 100,
"peers_seen": [8, 9],
"num_asns_inf": 4,
"num_peers_seen": 2,
"configured_prefix": "10.0.0.0/8",
"peers_withdrawn": [8,9],
"active": false,
"withdrawn": true
}
}
]
|
{
"pile_set_name": "Github"
}
|
//
// Input groups
// --------------------------------------------------
// Base styles
// -------------------------
.input-group {
position: relative; // For dropdowns
display: table;
border-collapse: separate; // prevent input groups from inheriting border styles from table cells when placed within a table
// Undo padding and float of grid classes
&[class*="col-"] {
float: none;
padding-left: 0;
padding-right: 0;
}
.form-control {
// Ensure that the input is always above the *appended* addon button for
// proper border colors.
position: relative;
z-index: 2;
// IE9 fubars the placeholder attribute in text inputs and the arrows on
// select elements in input groups. To fix it, we float the input. Details:
// https://github.com/twbs/bootstrap/issues/11561#issuecomment-28936855
float: left;
width: 100%;
margin-bottom: 0;
}
}
// Sizing options
//
// Remix the default form control sizing classes into new ones for easier
// manipulation.
.input-group-lg > .form-control,
.input-group-lg > .input-group-addon,
.input-group-lg > .input-group-btn > .btn {
.input-lg();
}
.input-group-sm > .form-control,
.input-group-sm > .input-group-addon,
.input-group-sm > .input-group-btn > .btn {
.input-sm();
}
// Display as table-cell
// -------------------------
.input-group-addon,
.input-group-btn,
.input-group .form-control {
display: table-cell;
&:not(:first-child):not(:last-child) {
border-radius: 0;
}
}
// Addon and addon wrapper for buttons
.input-group-addon,
.input-group-btn {
width: 1%;
white-space: nowrap;
vertical-align: middle; // Match the inputs
}
// Text input groups
// -------------------------
.input-group-addon {
padding: @padding-base-vertical @padding-base-horizontal;
font-size: @font-size-base;
font-weight: normal;
line-height: 1;
color: @input-color;
text-align: center;
background-color: @input-group-addon-bg;
border: 1px solid @input-group-addon-border-color;
border-radius: @border-radius-base;
// Sizing
&.input-sm {
padding: @padding-small-vertical @padding-small-horizontal;
font-size: @font-size-small;
border-radius: @border-radius-small;
}
&.input-lg {
padding: @padding-large-vertical @padding-large-horizontal;
font-size: @font-size-large;
border-radius: @border-radius-large;
}
// Nuke default margins from checkboxes and radios to vertically center within.
input[type="radio"],
input[type="checkbox"] {
margin-top: 0;
}
}
// Reset rounded corners
.input-group .form-control:first-child,
.input-group-addon:first-child,
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .btn-group > .btn,
.input-group-btn:first-child > .dropdown-toggle,
.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),
.input-group-btn:last-child > .btn-group:not(:last-child) > .btn {
.border-right-radius(0);
}
.input-group-addon:first-child {
border-right: 0;
}
.input-group .form-control:last-child,
.input-group-addon:last-child,
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .btn-group > .btn,
.input-group-btn:last-child > .dropdown-toggle,
.input-group-btn:first-child > .btn:not(:first-child),
.input-group-btn:first-child > .btn-group:not(:first-child) > .btn {
.border-left-radius(0);
}
.input-group-addon:last-child {
border-left: 0;
}
// Button input groups
// -------------------------
.input-group-btn {
position: relative;
// Jankily prevent input button groups from wrapping with `white-space` and
// `font-size` in combination with `inline-block` on buttons.
font-size: 0;
white-space: nowrap;
// Negative margin for spacing, position for bringing hovered/focused/actived
// element above the siblings.
> .btn {
position: relative;
+ .btn {
margin-left: -1px;
}
// Bring the "active" button to the front
&:hover,
&:focus,
&:active {
z-index: 2;
}
}
// Negative margin to only have a 1px border between the two
&:first-child {
> .btn,
> .btn-group {
margin-right: -1px;
}
}
&:last-child {
> .btn,
> .btn-group {
z-index: 2;
margin-left: -1px;
}
}
}
|
{
"pile_set_name": "Github"
}
|
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2014 Pedro Gonnet ([email protected])
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_MATH_FUNCTIONS_AVX_H
#define EIGEN_MATH_FUNCTIONS_AVX_H
/* The sin, cos, exp, and log functions of this file are loosely derived from
* Julien Pommier's sse math library: http://gruntthepeon.free.fr/ssemath/
*/
namespace Eigen {
namespace internal {
inline Packet8i pshiftleft(Packet8i v, int n)
{
#ifdef EIGEN_VECTORIZE_AVX2
return _mm256_slli_epi32(v, n);
#else
__m128i lo = _mm_slli_epi32(_mm256_extractf128_si256(v, 0), n);
__m128i hi = _mm_slli_epi32(_mm256_extractf128_si256(v, 1), n);
return _mm256_insertf128_si256(_mm256_castsi128_si256(lo), (hi), 1);
#endif
}
inline Packet8f pshiftright(Packet8f v, int n)
{
#ifdef EIGEN_VECTORIZE_AVX2
return _mm256_cvtepi32_ps(_mm256_srli_epi32(_mm256_castps_si256(v), n));
#else
__m128i lo = _mm_srli_epi32(_mm256_extractf128_si256(_mm256_castps_si256(v), 0), n);
__m128i hi = _mm_srli_epi32(_mm256_extractf128_si256(_mm256_castps_si256(v), 1), n);
return _mm256_cvtepi32_ps(_mm256_insertf128_si256(_mm256_castsi128_si256(lo), (hi), 1));
#endif
}
// Sine function
// Computes sin(x) by wrapping x to the interval [-Pi/4,3*Pi/4] and
// evaluating interpolants in [-Pi/4,Pi/4] or [Pi/4,3*Pi/4]. The interpolants
// are (anti-)symmetric and thus have only odd/even coefficients
template <>
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet8f
psin<Packet8f>(const Packet8f& _x) {
Packet8f x = _x;
// Some useful values.
_EIGEN_DECLARE_CONST_Packet8i(one, 1);
_EIGEN_DECLARE_CONST_Packet8f(one, 1.0f);
_EIGEN_DECLARE_CONST_Packet8f(two, 2.0f);
_EIGEN_DECLARE_CONST_Packet8f(one_over_four, 0.25f);
_EIGEN_DECLARE_CONST_Packet8f(one_over_pi, 3.183098861837907e-01f);
_EIGEN_DECLARE_CONST_Packet8f(neg_pi_first, -3.140625000000000e+00f);
_EIGEN_DECLARE_CONST_Packet8f(neg_pi_second, -9.670257568359375e-04f);
_EIGEN_DECLARE_CONST_Packet8f(neg_pi_third, -6.278329571784980e-07f);
_EIGEN_DECLARE_CONST_Packet8f(four_over_pi, 1.273239544735163e+00f);
// Map x from [-Pi/4,3*Pi/4] to z in [-1,3] and subtract the shifted period.
Packet8f z = pmul(x, p8f_one_over_pi);
Packet8f shift = _mm256_floor_ps(padd(z, p8f_one_over_four));
x = pmadd(shift, p8f_neg_pi_first, x);
x = pmadd(shift, p8f_neg_pi_second, x);
x = pmadd(shift, p8f_neg_pi_third, x);
z = pmul(x, p8f_four_over_pi);
// Make a mask for the entries that need flipping, i.e. wherever the shift
// is odd.
Packet8i shift_ints = _mm256_cvtps_epi32(shift);
Packet8i shift_isodd = _mm256_castps_si256(_mm256_and_ps(_mm256_castsi256_ps(shift_ints), _mm256_castsi256_ps(p8i_one)));
Packet8i sign_flip_mask = pshiftleft(shift_isodd, 31);
// Create a mask for which interpolant to use, i.e. if z > 1, then the mask
// is set to ones for that entry.
Packet8f ival_mask = _mm256_cmp_ps(z, p8f_one, _CMP_GT_OQ);
// Evaluate the polynomial for the interval [1,3] in z.
_EIGEN_DECLARE_CONST_Packet8f(coeff_right_0, 9.999999724233232e-01f);
_EIGEN_DECLARE_CONST_Packet8f(coeff_right_2, -3.084242535619928e-01f);
_EIGEN_DECLARE_CONST_Packet8f(coeff_right_4, 1.584991525700324e-02f);
_EIGEN_DECLARE_CONST_Packet8f(coeff_right_6, -3.188805084631342e-04f);
Packet8f z_minus_two = psub(z, p8f_two);
Packet8f z_minus_two2 = pmul(z_minus_two, z_minus_two);
Packet8f right = pmadd(p8f_coeff_right_6, z_minus_two2, p8f_coeff_right_4);
right = pmadd(right, z_minus_two2, p8f_coeff_right_2);
right = pmadd(right, z_minus_two2, p8f_coeff_right_0);
// Evaluate the polynomial for the interval [-1,1] in z.
_EIGEN_DECLARE_CONST_Packet8f(coeff_left_1, 7.853981525427295e-01f);
_EIGEN_DECLARE_CONST_Packet8f(coeff_left_3, -8.074536727092352e-02f);
_EIGEN_DECLARE_CONST_Packet8f(coeff_left_5, 2.489871967827018e-03f);
_EIGEN_DECLARE_CONST_Packet8f(coeff_left_7, -3.587725841214251e-05f);
Packet8f z2 = pmul(z, z);
Packet8f left = pmadd(p8f_coeff_left_7, z2, p8f_coeff_left_5);
left = pmadd(left, z2, p8f_coeff_left_3);
left = pmadd(left, z2, p8f_coeff_left_1);
left = pmul(left, z);
// Assemble the results, i.e. select the left and right polynomials.
left = _mm256_andnot_ps(ival_mask, left);
right = _mm256_and_ps(ival_mask, right);
Packet8f res = _mm256_or_ps(left, right);
// Flip the sign on the odd intervals and return the result.
res = _mm256_xor_ps(res, _mm256_castsi256_ps(sign_flip_mask));
return res;
}
// Natural logarithm
// Computes log(x) as log(2^e * m) = C*e + log(m), where the constant C =log(2)
// and m is in the range [sqrt(1/2),sqrt(2)). In this range, the logarithm can
// be easily approximated by a polynomial centered on m=1 for stability.
// TODO(gonnet): Further reduce the interval allowing for lower-degree
// polynomial interpolants -> ... -> profit!
template <>
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet8f
plog<Packet8f>(const Packet8f& _x) {
Packet8f x = _x;
_EIGEN_DECLARE_CONST_Packet8f(1, 1.0f);
_EIGEN_DECLARE_CONST_Packet8f(half, 0.5f);
_EIGEN_DECLARE_CONST_Packet8f(126f, 126.0f);
_EIGEN_DECLARE_CONST_Packet8f_FROM_INT(inv_mant_mask, ~0x7f800000);
// The smallest non denormalized float number.
_EIGEN_DECLARE_CONST_Packet8f_FROM_INT(min_norm_pos, 0x00800000);
_EIGEN_DECLARE_CONST_Packet8f_FROM_INT(minus_inf, 0xff800000);
// Polynomial coefficients.
_EIGEN_DECLARE_CONST_Packet8f(cephes_SQRTHF, 0.707106781186547524f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_log_p0, 7.0376836292E-2f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_log_p1, -1.1514610310E-1f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_log_p2, 1.1676998740E-1f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_log_p3, -1.2420140846E-1f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_log_p4, +1.4249322787E-1f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_log_p5, -1.6668057665E-1f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_log_p6, +2.0000714765E-1f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_log_p7, -2.4999993993E-1f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_log_p8, +3.3333331174E-1f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_log_q1, -2.12194440e-4f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_log_q2, 0.693359375f);
Packet8f invalid_mask = _mm256_cmp_ps(x, _mm256_setzero_ps(), _CMP_NGE_UQ); // not greater equal is true if x is NaN
Packet8f iszero_mask = _mm256_cmp_ps(x, _mm256_setzero_ps(), _CMP_EQ_OQ);
// Truncate input values to the minimum positive normal.
x = pmax(x, p8f_min_norm_pos);
Packet8f emm0 = pshiftright(x,23);
Packet8f e = _mm256_sub_ps(emm0, p8f_126f);
// Set the exponents to -1, i.e. x are in the range [0.5,1).
x = _mm256_and_ps(x, p8f_inv_mant_mask);
x = _mm256_or_ps(x, p8f_half);
// part2: Shift the inputs from the range [0.5,1) to [sqrt(1/2),sqrt(2))
// and shift by -1. The values are then centered around 0, which improves
// the stability of the polynomial evaluation.
// if( x < SQRTHF ) {
// e -= 1;
// x = x + x - 1.0;
// } else { x = x - 1.0; }
Packet8f mask = _mm256_cmp_ps(x, p8f_cephes_SQRTHF, _CMP_LT_OQ);
Packet8f tmp = _mm256_and_ps(x, mask);
x = psub(x, p8f_1);
e = psub(e, _mm256_and_ps(p8f_1, mask));
x = padd(x, tmp);
Packet8f x2 = pmul(x, x);
Packet8f x3 = pmul(x2, x);
// Evaluate the polynomial approximant of degree 8 in three parts, probably
// to improve instruction-level parallelism.
Packet8f y, y1, y2;
y = pmadd(p8f_cephes_log_p0, x, p8f_cephes_log_p1);
y1 = pmadd(p8f_cephes_log_p3, x, p8f_cephes_log_p4);
y2 = pmadd(p8f_cephes_log_p6, x, p8f_cephes_log_p7);
y = pmadd(y, x, p8f_cephes_log_p2);
y1 = pmadd(y1, x, p8f_cephes_log_p5);
y2 = pmadd(y2, x, p8f_cephes_log_p8);
y = pmadd(y, x3, y1);
y = pmadd(y, x3, y2);
y = pmul(y, x3);
// Add the logarithm of the exponent back to the result of the interpolation.
y1 = pmul(e, p8f_cephes_log_q1);
tmp = pmul(x2, p8f_half);
y = padd(y, y1);
x = psub(x, tmp);
y2 = pmul(e, p8f_cephes_log_q2);
x = padd(x, y);
x = padd(x, y2);
// Filter out invalid inputs, i.e. negative arg will be NAN, 0 will be -INF.
return _mm256_or_ps(
_mm256_andnot_ps(iszero_mask, _mm256_or_ps(x, invalid_mask)),
_mm256_and_ps(iszero_mask, p8f_minus_inf));
}
// Exponential function. Works by writing "x = m*log(2) + r" where
// "m = floor(x/log(2)+1/2)" and "r" is the remainder. The result is then
// "exp(x) = 2^m*exp(r)" where exp(r) is in the range [-1,1).
template <>
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet8f
pexp<Packet8f>(const Packet8f& _x) {
_EIGEN_DECLARE_CONST_Packet8f(1, 1.0f);
_EIGEN_DECLARE_CONST_Packet8f(half, 0.5f);
_EIGEN_DECLARE_CONST_Packet8f(127, 127.0f);
_EIGEN_DECLARE_CONST_Packet8f(exp_hi, 88.3762626647950f);
_EIGEN_DECLARE_CONST_Packet8f(exp_lo, -88.3762626647949f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_LOG2EF, 1.44269504088896341f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_exp_p0, 1.9875691500E-4f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_exp_p1, 1.3981999507E-3f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_exp_p2, 8.3334519073E-3f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_exp_p3, 4.1665795894E-2f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_exp_p4, 1.6666665459E-1f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_exp_p5, 5.0000001201E-1f);
// Clamp x.
Packet8f x = pmax(pmin(_x, p8f_exp_hi), p8f_exp_lo);
// Express exp(x) as exp(m*ln(2) + r), start by extracting
// m = floor(x/ln(2) + 0.5).
Packet8f m = _mm256_floor_ps(pmadd(x, p8f_cephes_LOG2EF, p8f_half));
// Get r = x - m*ln(2). If no FMA instructions are available, m*ln(2) is
// subtracted out in two parts, m*C1+m*C2 = m*ln(2), to avoid accumulating
// truncation errors. Note that we don't use the "pmadd" function here to
// ensure that a precision-preserving FMA instruction is used.
#ifdef EIGEN_VECTORIZE_FMA
_EIGEN_DECLARE_CONST_Packet8f(nln2, -0.6931471805599453f);
Packet8f r = _mm256_fmadd_ps(m, p8f_nln2, x);
#else
_EIGEN_DECLARE_CONST_Packet8f(cephes_exp_C1, 0.693359375f);
_EIGEN_DECLARE_CONST_Packet8f(cephes_exp_C2, -2.12194440e-4f);
Packet8f r = psub(x, pmul(m, p8f_cephes_exp_C1));
r = psub(r, pmul(m, p8f_cephes_exp_C2));
#endif
Packet8f r2 = pmul(r, r);
// TODO(gonnet): Split into odd/even polynomials and try to exploit
// instruction-level parallelism.
Packet8f y = p8f_cephes_exp_p0;
y = pmadd(y, r, p8f_cephes_exp_p1);
y = pmadd(y, r, p8f_cephes_exp_p2);
y = pmadd(y, r, p8f_cephes_exp_p3);
y = pmadd(y, r, p8f_cephes_exp_p4);
y = pmadd(y, r, p8f_cephes_exp_p5);
y = pmadd(y, r2, r);
y = padd(y, p8f_1);
// Build emm0 = 2^m.
Packet8i emm0 = _mm256_cvttps_epi32(padd(m, p8f_127));
emm0 = pshiftleft(emm0, 23);
// Return 2^m * exp(r).
return pmax(pmul(y, _mm256_castsi256_ps(emm0)), _x);
}
// Hyperbolic Tangent function.
template <>
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet8f
ptanh<Packet8f>(const Packet8f& x) {
return internal::generic_fast_tanh_float(x);
}
template <>
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4d
pexp<Packet4d>(const Packet4d& _x) {
Packet4d x = _x;
_EIGEN_DECLARE_CONST_Packet4d(1, 1.0);
_EIGEN_DECLARE_CONST_Packet4d(2, 2.0);
_EIGEN_DECLARE_CONST_Packet4d(half, 0.5);
_EIGEN_DECLARE_CONST_Packet4d(exp_hi, 709.437);
_EIGEN_DECLARE_CONST_Packet4d(exp_lo, -709.436139303);
_EIGEN_DECLARE_CONST_Packet4d(cephes_LOG2EF, 1.4426950408889634073599);
_EIGEN_DECLARE_CONST_Packet4d(cephes_exp_p0, 1.26177193074810590878e-4);
_EIGEN_DECLARE_CONST_Packet4d(cephes_exp_p1, 3.02994407707441961300e-2);
_EIGEN_DECLARE_CONST_Packet4d(cephes_exp_p2, 9.99999999999999999910e-1);
_EIGEN_DECLARE_CONST_Packet4d(cephes_exp_q0, 3.00198505138664455042e-6);
_EIGEN_DECLARE_CONST_Packet4d(cephes_exp_q1, 2.52448340349684104192e-3);
_EIGEN_DECLARE_CONST_Packet4d(cephes_exp_q2, 2.27265548208155028766e-1);
_EIGEN_DECLARE_CONST_Packet4d(cephes_exp_q3, 2.00000000000000000009e0);
_EIGEN_DECLARE_CONST_Packet4d(cephes_exp_C1, 0.693145751953125);
_EIGEN_DECLARE_CONST_Packet4d(cephes_exp_C2, 1.42860682030941723212e-6);
_EIGEN_DECLARE_CONST_Packet4i(1023, 1023);
Packet4d tmp, fx;
// clamp x
x = pmax(pmin(x, p4d_exp_hi), p4d_exp_lo);
// Express exp(x) as exp(g + n*log(2)).
fx = pmadd(p4d_cephes_LOG2EF, x, p4d_half);
// Get the integer modulus of log(2), i.e. the "n" described above.
fx = _mm256_floor_pd(fx);
// Get the remainder modulo log(2), i.e. the "g" described above. Subtract
// n*log(2) out in two steps, i.e. n*C1 + n*C2, C1+C2=log2 to get the last
// digits right.
tmp = pmul(fx, p4d_cephes_exp_C1);
Packet4d z = pmul(fx, p4d_cephes_exp_C2);
x = psub(x, tmp);
x = psub(x, z);
Packet4d x2 = pmul(x, x);
// Evaluate the numerator polynomial of the rational interpolant.
Packet4d px = p4d_cephes_exp_p0;
px = pmadd(px, x2, p4d_cephes_exp_p1);
px = pmadd(px, x2, p4d_cephes_exp_p2);
px = pmul(px, x);
// Evaluate the denominator polynomial of the rational interpolant.
Packet4d qx = p4d_cephes_exp_q0;
qx = pmadd(qx, x2, p4d_cephes_exp_q1);
qx = pmadd(qx, x2, p4d_cephes_exp_q2);
qx = pmadd(qx, x2, p4d_cephes_exp_q3);
// I don't really get this bit, copied from the SSE2 routines, so...
// TODO(gonnet): Figure out what is going on here, perhaps find a better
// rational interpolant?
x = _mm256_div_pd(px, psub(qx, px));
x = pmadd(p4d_2, x, p4d_1);
// Build e=2^n by constructing the exponents in a 128-bit vector and
// shifting them to where they belong in double-precision values.
__m128i emm0 = _mm256_cvtpd_epi32(fx);
emm0 = _mm_add_epi32(emm0, p4i_1023);
emm0 = _mm_shuffle_epi32(emm0, _MM_SHUFFLE(3, 1, 2, 0));
__m128i lo = _mm_slli_epi64(emm0, 52);
__m128i hi = _mm_slli_epi64(_mm_srli_epi64(emm0, 32), 52);
__m256i e = _mm256_insertf128_si256(_mm256_setzero_si256(), lo, 0);
e = _mm256_insertf128_si256(e, hi, 1);
// Construct the result 2^n * exp(g) = e * x. The max is used to catch
// non-finite values in the input.
return pmax(pmul(x, _mm256_castsi256_pd(e)), _x);
}
// Functions for sqrt.
// The EIGEN_FAST_MATH version uses the _mm_rsqrt_ps approximation and one step
// of Newton's method, at a cost of 1-2 bits of precision as opposed to the
// exact solution. It does not handle +inf, or denormalized numbers correctly.
// The main advantage of this approach is not just speed, but also the fact that
// it can be inlined and pipelined with other computations, further reducing its
// effective latency. This is similar to Quake3's fast inverse square root.
// For detail see here: http://www.beyond3d.com/content/articles/8/
#if EIGEN_FAST_MATH
template <>
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet8f
psqrt<Packet8f>(const Packet8f& _x) {
Packet8f half = pmul(_x, pset1<Packet8f>(.5f));
Packet8f denormal_mask = _mm256_and_ps(
_mm256_cmp_ps(_x, pset1<Packet8f>((std::numeric_limits<float>::min)()),
_CMP_LT_OQ),
_mm256_cmp_ps(_x, _mm256_setzero_ps(), _CMP_GE_OQ));
// Compute approximate reciprocal sqrt.
Packet8f x = _mm256_rsqrt_ps(_x);
// Do a single step of Newton's iteration.
x = pmul(x, psub(pset1<Packet8f>(1.5f), pmul(half, pmul(x,x))));
// Flush results for denormals to zero.
return _mm256_andnot_ps(denormal_mask, pmul(_x,x));
}
#else
template <> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet8f psqrt<Packet8f>(const Packet8f& x) {
return _mm256_sqrt_ps(x);
}
#endif
template <> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet4d psqrt<Packet4d>(const Packet4d& x) {
return _mm256_sqrt_pd(x);
}
#if EIGEN_FAST_MATH
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet8f prsqrt<Packet8f>(const Packet8f& _x) {
_EIGEN_DECLARE_CONST_Packet8f_FROM_INT(inf, 0x7f800000);
_EIGEN_DECLARE_CONST_Packet8f_FROM_INT(nan, 0x7fc00000);
_EIGEN_DECLARE_CONST_Packet8f(one_point_five, 1.5f);
_EIGEN_DECLARE_CONST_Packet8f(minus_half, -0.5f);
_EIGEN_DECLARE_CONST_Packet8f_FROM_INT(flt_min, 0x00800000);
Packet8f neg_half = pmul(_x, p8f_minus_half);
// select only the inverse sqrt of positive normal inputs (denormals are
// flushed to zero and cause infs as well).
Packet8f le_zero_mask = _mm256_cmp_ps(_x, p8f_flt_min, _CMP_LT_OQ);
Packet8f x = _mm256_andnot_ps(le_zero_mask, _mm256_rsqrt_ps(_x));
// Fill in NaNs and Infs for the negative/zero entries.
Packet8f neg_mask = _mm256_cmp_ps(_x, _mm256_setzero_ps(), _CMP_LT_OQ);
Packet8f zero_mask = _mm256_andnot_ps(neg_mask, le_zero_mask);
Packet8f infs_and_nans = _mm256_or_ps(_mm256_and_ps(neg_mask, p8f_nan),
_mm256_and_ps(zero_mask, p8f_inf));
// Do a single step of Newton's iteration.
x = pmul(x, pmadd(neg_half, pmul(x, x), p8f_one_point_five));
// Insert NaNs and Infs in all the right places.
return _mm256_or_ps(x, infs_and_nans);
}
#else
template <> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet8f prsqrt<Packet8f>(const Packet8f& x) {
_EIGEN_DECLARE_CONST_Packet8f(one, 1.0f);
return _mm256_div_ps(p8f_one, _mm256_sqrt_ps(x));
}
#endif
template <> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet4d prsqrt<Packet4d>(const Packet4d& x) {
_EIGEN_DECLARE_CONST_Packet4d(one, 1.0);
return _mm256_div_pd(p4d_one, _mm256_sqrt_pd(x));
}
} // end namespace internal
} // end namespace Eigen
#endif // EIGEN_MATH_FUNCTIONS_AVX_H
|
{
"pile_set_name": "Github"
}
|
from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
@override_settings(TWILIO_ACCOUNT="foo", TWILIO_AUTH="foo", TWILIO_FROM="123")
class AddCallTestCase(BaseTestCase):
def setUp(self):
super(AddCallTestCase, self).setUp()
self.url = "/projects/%s/add_call/" % self.project.code
def test_instructions_work(self):
self.client.login(username="[email protected]", password="password")
r = self.client.get(self.url)
self.assertContains(r, "Get a phone call")
@override_settings(USE_PAYMENTS=True)
def test_it_warns_about_limits(self):
self.profile.sms_limit = 0
self.profile.save()
self.client.login(username="[email protected]", password="password")
r = self.client.get(self.url)
self.assertContains(r, "upgrade to a")
def test_it_creates_channel(self):
form = {"label": "My Phone", "value": "+1234567890"}
self.client.login(username="[email protected]", password="password")
r = self.client.post(self.url, form)
self.assertRedirects(r, self.channels_url)
c = Channel.objects.get()
self.assertEqual(c.kind, "call")
self.assertEqual(c.phone_number, "+1234567890")
self.assertEqual(c.name, "My Phone")
self.assertEqual(c.project, self.project)
def test_it_rejects_bad_number(self):
form = {"value": "not a phone number"}
self.client.login(username="[email protected]", password="password")
r = self.client.post(self.url, form)
self.assertContains(r, "Invalid phone number format.")
def test_it_trims_whitespace(self):
form = {"value": " +1234567890 "}
self.client.login(username="[email protected]", password="password")
self.client.post(self.url, form)
c = Channel.objects.get()
self.assertEqual(c.phone_number, "+1234567890")
@override_settings(TWILIO_AUTH=None)
def test_it_requires_credentials(self):
self.client.login(username="[email protected]", password="password")
r = self.client.get(self.url)
self.assertEqual(r.status_code, 404)
def test_it_requires_rw_access(self):
self.bobs_membership.rw = False
self.bobs_membership.save()
self.client.login(username="[email protected]", password="password")
r = self.client.get(self.url)
self.assertEqual(r.status_code, 403)
|
{
"pile_set_name": "Github"
}
|
-----BEGIN CERTIFICATE-----
MIID1jCCAr6gAwIBAgIHBHLF4IuXeDANBgkqhkiG9w0BAQsFADCBnTELMAkGA1UE
BhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCUxvcyBHYXRvczEU
MBIGA1UECgwLTmV0ZmxpeCBJbmMxLTArBgNVBAsMJFBsYXRmb3JtIFNlY3VyaXR5
ICgxMjUyMDkzOTA4ODQwMjkwKTEgMB4GA1UEAwwXSW50ZXJtZWRpYXRlIENBIGZv
ciA5NjgwHhcNMjAwNzE0MDMxNzEzWhcNMjEwNzE0MDMwOTQ0WjCBlTELMAkGA1UE
BhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCUxvcyBHYXRvczEU
MBIGA1UECgwLTmV0ZmxpeCBJbmMxLTArBgNVBAsMJFBsYXRmb3JtIFNlY3VyaXR5
ICgxMjUyMDk0MTA4MTkwNjU2KTEYMBYGA1UEAwwPbG9jYWxob3N0LmxvY2FsMIIB
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuYc+Obyt5sgqvIsuVntuSaqI
iuesJza4VId9gYur/yFda93AMzNFBDT8EypllFudrQ28gITEUFQK9MNsBjbSoXNU
ssK5N9n53LvGnU6PsZoLSn1qGv8JrFhER5H+nRLVWfdEeyQk+pVfmpbmE1hOgsfU
l43xIEzhB8UO9NWQGh7VHM7gCkDKh8ER/ObV2o8g6MMeVFaIFj/HFPyq8uyM1AO6
eu6PfYjnlVKfm6GUzhciIY4/uLwHewI9SX0TA07FcaxYf/z2AgssySnfbNkuiMmG
x4bNQ1WAkgFO58Rd4bHWavh/9jvjaKRX0e1PTWbk0yRl5mLFOcexMiBRVVTy7wID
AQABoyEwHzAMBgNVHRMBAf8EAjAAMA8GA1UdEQQIMAaHBKwQAAEwDQYJKoZIhvcN
AQELBQADggEBAF9Jm4jWPTrVeO3ZlkSvjjmUoUuS/oJ0yNNe9vKjccKtsOTTm/l3
EbTcwu6tStWYLIJsF0tIAAZRXeonUn/sMFH0BXEiNsUi+GvSJV91a0HCOa4zguwQ
wRMmTjS0xDOe0+8NV5HLxoS4yPNN3Aq623STb5iDFrJEcKGx5MAKJR0gTJaJQlLn
hUCCfVRnoU3q/cZ6ommXsLQVm8jM6Rr6NLWSjmGXa3uGari2h5QJnHg7q/+SUnmD
q1+nA8Rau8KMNrrGX3fIPVFPuXagNur9UDVubT3NdBCY53OXORNCFwBd5eh32LkD
CiNfKQoM217h0mPB04850yszzT0ZWIYGPls=
-----END CERTIFICATE-----
|
{
"pile_set_name": "Github"
}
|
{% extends '@EasyAdmin/page/content.html.twig' %}
{% block content_body %}
<div style="max-width: 480px">
<h1 style="font-size: 21px">Welcome to the EasyAdmin Demo application</h1>
<p>
This is a <strong>sample application</strong> developed with
<a href="https://github.com/EasyCorp/EasyAdminBundle">EasyAdmin</a>,
which creates administration backends for your Symfony applications with unprecedented simplicity.
</p>
<p>
Click on any of the links in the main menu to start using this backend.
Open the <code>src/Controller/Admin/</code> directory to learn how this
backend was created.
</p>
<p>
<a href="https://github.com/EasyCorp/EasyAdminBundle">View the source code</a>
of this demo application, <a href="https://github.com/javiereguiluz/easy-admin-demo/issues">report issues</a>
or <a href="https://symfony.com/doc/current/bundles/EasyAdminBundle">read EasyAdmin docs</a>
to create your own backend.
</p>
</div>
{% endblock %}
|
{
"pile_set_name": "Github"
}
|
---
title: "container prune"
description: "Remove all stopped containers"
keywords: container, prune, delete, remove
---
<!-- This file is maintained within the docker/docker Github
repository at https://github.com/docker/docker/. Make all
pull requests against that repo. If you see this file in
another repository, consider it read-only there, as it will
periodically be overwritten by the definitive file. Pull
requests which include edits to this file in other repositories
will be rejected.
-->
# container prune
```markdown
Usage: docker container prune [OPTIONS]
Remove all stopped containers
Options:
Options:
--filter filter Provide filter values (e.g. 'until=<timestamp>')
-f, --force Do not prompt for confirmation
--help Print usage
```
## Examples
```bash
$ docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Deleted Containers:
4a7f7eebae0f63178aff7eb0aa39cd3f0627a203ab2df258c1a00b456cf20063
f98f9c2aa1eaf727e4ec9c0283bc7d4aa4762fbdba7f26191f26c97f64090360
Total reclaimed space: 212 B
```
## Filtering
The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more
than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)
The currently supported filters are:
* until (`<timestamp>`) - only remove containers created before given timestamp
The `until` filter can be Unix timestamps, date formatted
timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed
relative to the daemon machine’s time. Supported formats for date
formatted time stamps include RFC3339Nano, RFC3339, `2006-01-02T15:04:05`,
`2006-01-02T15:04:05.999999999`, `2006-01-02Z07:00`, and `2006-01-02`. The local
timezone on the daemon will be used if you do not provide either a `Z` or a
`+-00:00` timezone offset at the end of the timestamp. When providing Unix
timestamps enter seconds[.nanoseconds], where seconds is the number of seconds
that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap
seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a
fraction of a second no more than nine digits long.
The following removes containers created more than 5 minutes ago:
```bash
$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
CONTAINER ID IMAGE COMMAND CREATED AT STATUS
61b9efa71024 busybox "sh" 2017-01-04 13:23:33 -0800 PST Exited (0) 41 seconds ago
53a9bc23a516 busybox "sh" 2017-01-04 13:11:59 -0800 PST Exited (0) 12 minutes ago
$ docker container prune --force --filter "until=5m"
Deleted Containers:
53a9bc23a5168b6caa2bfbefddf1b30f93c7ad57f3dec271fd32707497cb9369
Total reclaimed space: 25 B
$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
CONTAINER ID IMAGE COMMAND CREATED AT STATUS
61b9efa71024 busybox "sh" 2017-01-04 13:23:33 -0800 PST Exited (0) 44 seconds ago
```
The following removes containers created before `2017-01-04T13:10:00`:
```bash
$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
CONTAINER ID IMAGE COMMAND CREATED AT STATUS
53a9bc23a516 busybox "sh" 2017-01-04 13:11:59 -0800 PST Exited (0) 7 minutes ago
4a75091a6d61 busybox "sh" 2017-01-04 13:09:53 -0800 PST Exited (0) 9 minutes ago
$ docker container prune --force --filter "until=2017-01-04T13:10:00"
Deleted Containers:
4a75091a6d618526fcd8b33ccd6e5928ca2a64415466f768a6180004b0c72c6c
Total reclaimed space: 27 B
$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
CONTAINER ID IMAGE COMMAND CREATED AT STATUS
53a9bc23a516 busybox "sh" 2017-01-04 13:11:59 -0800 PST Exited (0) 9 minutes ago
```
## Related information
* [system df](system_df.md)
* [volume prune](volume_prune.md)
* [image prune](image_prune.md)
* [network prune](network_prune.md)
* [system prune](system_prune.md)
|
{
"pile_set_name": "Github"
}
|
# Contribuindo
## Categorias de Pessoas Contribuidoras
* [Contribuidoras](CONTRIBUIDORAS.md)
* [Campeãs](CAMPEAS.md)
* [Curadoras](CURADORAS.md)
## Padrão
Cada tópico tem um arquivo Markdown na pasta `topics/` e para seu conteúdo
temos definido como padrão:
```md
# Tópico
Introdução ao Tópico
<!-- toc -->
## Subtópico
Descrição do subtópico
### Recursos
* [[Tipo do Recurso] Título](link)
```
A linha `<!-- toc -->` é para a geração automática do índice do tópico.
Os tipos de recurso podem ser: artigos, livros, vídeos, cursos, folha de dicas,
documentação, etc.
Caso o recurso seja noutra língua, adicione o ícone da bandeira. Exemplo:
```md
* [[Tipo do Recurso] Título](link) :uk:
```
## Testes
Lembre de checar suas alterações instalando as dependências necessárias e
rodando o teste:
```sh
npm install
npm test
```
Para rodar os testes continuamente enquanto escreve, utilize o comando abaixo:
```sh
npm run watch
```
Em caso de erro, mais informações sobre as regras aqui:
[Markdownlint - Rules](https://github.com/mivok/markdownlint/blob/master/docs/RULES.md)
## Visualizando alterações
Caso deseje visualizar como será a página gerada pelo Gitbook, execute:
```sh
npm start
```
## Validação de links
Para garantir que links externos novos que você adicionou não estão quebrados,
execute:
```sh
npm run check-link-diff
```
O comando acima só valida links que você adicionou. Porém, se quiser ajudar o
guia a se manter atualizado e verificar todos os links, execute:
```sh
npm run check-link-local
```
## Submetendo mudanças
Para submeter suas mudanças:
* Crie um fork do repositório
* Em uma feature branch, faça suas mudanças
* Garanta que suas sugestões seguem o padrão e passam os testes
* Crie uma pull request para mergear seu código nesse repositório
* Muito provavelmente, você receberá feedbacks ou nosso selo de aprovação
* Quando receber um "PBPM", ou uma aprovação, você está pronto para mergear suas
mudanças!
Se você não teve muitas experiências contribuindo para projetos open source com
git, sugerimos ler as [dicas do Github](https://guides.github.com/activities/contributing-to-open-source/#contributing)
:uk:.
|
{
"pile_set_name": "Github"
}
|
//===- LazyBlockFrequencyInfo.cpp - Lazy Block Frequency Analysis ---------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This is an alternative analysis pass to BlockFrequencyInfoWrapperPass. The
// difference is that with this pass the block frequencies are not computed when
// the analysis pass is executed but rather when the BFI result is explicitly
// requested by the analysis client.
//
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/LazyBlockFrequencyInfo.h"
#include "llvm/Analysis/LazyBranchProbabilityInfo.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/IR/Dominators.h"
using namespace llvm;
#define DEBUG_TYPE "lazy-block-freq"
INITIALIZE_PASS_BEGIN(LazyBlockFrequencyInfoPass, DEBUG_TYPE,
"Lazy Block Frequency Analysis", true, true)
INITIALIZE_PASS_DEPENDENCY(LazyBPIPass)
INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
INITIALIZE_PASS_END(LazyBlockFrequencyInfoPass, DEBUG_TYPE,
"Lazy Block Frequency Analysis", true, true)
char LazyBlockFrequencyInfoPass::ID = 0;
LazyBlockFrequencyInfoPass::LazyBlockFrequencyInfoPass() : FunctionPass(ID) {
initializeLazyBlockFrequencyInfoPassPass(*PassRegistry::getPassRegistry());
}
void LazyBlockFrequencyInfoPass::print(raw_ostream &OS, const Module *) const {
LBFI.getCalculated().print(OS);
}
void LazyBlockFrequencyInfoPass::getAnalysisUsage(AnalysisUsage &AU) const {
LazyBranchProbabilityInfoPass::getLazyBPIAnalysisUsage(AU);
// We require DT so it's available when LI is available. The LI updating code
// asserts that DT is also present so if we don't make sure that we have DT
// here, that assert will trigger.
AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<LoopInfoWrapperPass>();
AU.setPreservesAll();
}
void LazyBlockFrequencyInfoPass::releaseMemory() { LBFI.releaseMemory(); }
bool LazyBlockFrequencyInfoPass::runOnFunction(Function &F) {
auto &BPIPass = getAnalysis<LazyBranchProbabilityInfoPass>();
LoopInfo &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
LBFI.setAnalysis(&F, &BPIPass, &LI);
return false;
}
void LazyBlockFrequencyInfoPass::getLazyBFIAnalysisUsage(AnalysisUsage &AU) {
LazyBranchProbabilityInfoPass::getLazyBPIAnalysisUsage(AU);
AU.addRequired<LazyBlockFrequencyInfoPass>();
AU.addRequired<LoopInfoWrapperPass>();
}
void llvm::initializeLazyBFIPassPass(PassRegistry &Registry) {
initializeLazyBPIPassPass(Registry);
INITIALIZE_PASS_DEPENDENCY(LazyBlockFrequencyInfoPass);
INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass);
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 1997, 2008, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package javax.swing.undo;
import javax.swing.event.*;
import java.util.*;
/**
* A support class used for managing <code>UndoableEdit</code> listeners.
*
* @author Ray Ryan
*/
public class UndoableEditSupport {
protected int updateLevel;
protected CompoundEdit compoundEdit;
protected Vector<UndoableEditListener> listeners;
protected Object realSource;
/**
* Constructs an <code>UndoableEditSupport</code> object.
*/
public UndoableEditSupport() {
this(null);
}
/**
* Constructs an <code>UndoableEditSupport</code> object.
*
* @param r an <code>Object</code>
*/
public UndoableEditSupport(Object r) {
realSource = r == null ? this : r;
updateLevel = 0;
compoundEdit = null;
listeners = new Vector<UndoableEditListener>();
}
/**
* Registers an <code>UndoableEditListener</code>.
* The listener is notified whenever an edit occurs which can be undone.
*
* @param l an <code>UndoableEditListener</code> object
* @see #removeUndoableEditListener
*/
public synchronized void addUndoableEditListener(UndoableEditListener l) {
listeners.addElement(l);
}
/**
* Removes an <code>UndoableEditListener</code>.
*
* @param l the <code>UndoableEditListener</code> object to be removed
* @see #addUndoableEditListener
*/
public synchronized void removeUndoableEditListener(UndoableEditListener l)
{
listeners.removeElement(l);
}
/**
* Returns an array of all the <code>UndoableEditListener</code>s added
* to this UndoableEditSupport with addUndoableEditListener().
*
* @return all of the <code>UndoableEditListener</code>s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public synchronized UndoableEditListener[] getUndoableEditListeners() {
return listeners.toArray(new UndoableEditListener[0]);
}
/**
* Called only from <code>postEdit</code> and <code>endUpdate</code>. Calls
* <code>undoableEditHappened</code> in all listeners. No synchronization
* is performed here, since the two calling methods are synchronized.
*/
protected void _postEdit(UndoableEdit e) {
UndoableEditEvent ev = new UndoableEditEvent(realSource, e);
Enumeration cursor = ((Vector)listeners.clone()).elements();
while (cursor.hasMoreElements()) {
((UndoableEditListener)cursor.nextElement()).
undoableEditHappened(ev);
}
}
/**
* DEADLOCK WARNING: Calling this method may call
* <code>undoableEditHappened</code> in all listeners.
* It is unwise to call this method from one of its listeners.
*/
public synchronized void postEdit(UndoableEdit e) {
if (updateLevel == 0) {
_postEdit(e);
} else {
// PENDING(rjrjr) Throw an exception if this fails?
compoundEdit.addEdit(e);
}
}
/**
* Returns the update level value.
*
* @return an integer representing the update level
*/
public int getUpdateLevel() {
return updateLevel;
}
/**
*
*/
public synchronized void beginUpdate() {
if (updateLevel == 0) {
compoundEdit = createCompoundEdit();
}
updateLevel++;
}
/**
* Called only from <code>beginUpdate</code>.
* Exposed here for subclasses' use.
*/
protected CompoundEdit createCompoundEdit() {
return new CompoundEdit();
}
/**
* DEADLOCK WARNING: Calling this method may call
* <code>undoableEditHappened</code> in all listeners.
* It is unwise to call this method from one of its listeners.
*/
public synchronized void endUpdate() {
updateLevel--;
if (updateLevel == 0) {
compoundEdit.end();
_postEdit(compoundEdit);
compoundEdit = null;
}
}
/**
* Returns a string that displays and identifies this
* object's properties.
*
* @return a <code>String</code> representation of this object
*/
public String toString() {
return super.toString() +
" updateLevel: " + updateLevel +
" listeners: " + listeners +
" compoundEdit: " + compoundEdit;
}
}
|
{
"pile_set_name": "Github"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.